Lab 12, interrupts, part 1

Time to create content of io.h with references to control registers, irq nums etc: Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Lab 11, _div, testing print

Interesting point we missed in lab10. Those are stubs that we have in main():
_div, _divu, _mod, _modu Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Designing tree-like models

We found that developers are often confused about implementing tree-like models using Qt classes. Now we can show some tricks and considerations about the way of designing them.

First for some refreshment, let’s remind what you have for addressing the elements in the model. This is QModelIndex, which have pointer to model that created the index object, row and column and plus a some pointer or id (qint64) which can be used for addressing. Read More »

Posted in Blog, C++, Models, Qt, Research | 2 Comments

Overhead cost of using Qt models

I decided to run very simple test to have glance on performance of Qt models and overhead cost of using them.
Something very simple as make 1M random strings with random size (note: rnd_str(int) return some random string with specified size) Read More »

Posted in Blog, C++, Models, Qt, Research | 3 Comments

Lab 10, Bss, memory pools, malloc

Time to have a look at initial memory initializations.
First we need to initialize BSS (more details:, statically-allocated variables. We do it in next way: Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Lab 9, coding assembler part

Time to have assembler part of Inferno kernel to be implemented Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Lab 8, memory model

Now time to have a look at memory model. The BCM2835 gives next picture:
Screen Shot 2013-01-22 at 23.38.29

Actually Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

About Boost Multi-index Containers

I really like Qt Template Library (QTL), but still have lack of some important functionality which is usually called multi-index. Anyway there is very powerful implementation existing in Boost. I really need these templates to establish relations between different data structures. I often use it as internal “engine” for different Proxy models that I use to manipulate models.

So, I would like to remind and give quick recepies about such powerful module in Boost as multi_index_container. We know and intensively use standard STL templates for storing and access to data as lists, vectors, maps, hashes. There are a lot of information about them and very well explained.

Things get complicated when there is a need to store and access to objects by more then one set of keys or their combinations. Usually developers start from creation of two maps or hashes plus a log of synchronization of then, but later with increase of keys codes became much more complicated due to synchronization of hashes, insertions, key renames, removes etc. Also it is getting very hard to understand the computation complexity of every operation taken with such storage. And of course creation of such “bicycles” leads to high amount of bugs, needs of optimizations, etc.

Of course everything is invented before us and in Boost libraries you will find a module for solving these problems – boost::multi_index. Great advantage – speed, multi_index is very fast. But documentation for this module is, let’s say, complicated for understanding and especially for quick start, so newbies try to avoid the use of the module. And of course compiler messages about error due to use of multi_index templates give high amount of confusion.

I would like to remove confusion and give simple cases that will be good recipes of use. I will use it together with Qt classes for demo:
Read More »

Posted in Blog, Boost, C++, Models, Qt, Research | 3 Comments

Lab 7, linking, planning next

As we have the kernel almost compiled now it is time to check what is missing to have it linked. By checking header files and adding stubs into main.c we will get linked with very small changes as: Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Lab 6, Compile something

Now it is lab 6 and it is time to compile “something” – kernel of inferno, but we are going to compile without worrying that it would not work (even would not link). We just need inferno kernel which can be compiled okay for R-Pi using a lot of stabs.
Files/Folders structure:

 |    |-rpi/
 |    |    |-rpi
 |    |    |-mkfile
 |    |    |-load.s
 |    |    |-main.c

That is how port for R-Pi is organized – “os” folder contains all supported native versions of inferno os. We create there “rpi” folder and move inside our “hello world” example containing load.s and main.c(test.c) files. Now we need Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Lab 5, Hello World

This lab will be short but it is going to summarize all material provided in previous labs.
Our target to develop simple “barebone” program which can be loaded and executed by U-Boot.
It should only print “Hello world!” to our serial console.
Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | 4 Comments

Ru: Archive: O Boost Multi-index Containers

Хочу представить или даже напомнить о таком замечательном модуле Boost как multi_index_container. Все мы знаем и интенсивно пользуем стандартные STL классы для хранения и доступа к данным как списки, векторы, мапы?, хеши. Про них сказано уже немало и исследованы все особенности их применений.

Всё усложняется когда возникает необходимость в классе для хранения и доступа к объектам по более чем одному ключу или их комбинациям. Обычно начинают с создания двух мапов или хешей, потом при увеличении их числа всё становится сложнее и возникают усложнённые участки кода для синхронизации этих хешей, вставок, удаления и переименований плюс становится довольно сложно понять стоимость той или иной операции. Ну и конечно создание таких велосипедов ведёт к большому количеству багов, необходимости оптимизаций и так далее.

Конечно всё уже придуманно до нас и в библиотеке Boost уже есть модуль для решения данных проблем – boost::multi_index. Огромное преимущество – скорость, multi_index очень быстрый. Однако документация этого модуля скажем сложна для понимания и новички стараются обходить этот модуль стороной. И конечно отдельно можно сказать о сообщениях компилятора при ошибках при работе с multi_index_container – разобрать длинные сообщение о шаблонах не каждому под силу.

Постараемся ликвидировать этот пробел и показать простые примеры для горячего старта и использования этого мощного инструмента. Буду пользовать немного вместе с Qt в примерах. (Как раз в Qt с их собственной системой шаблонов мне часто не хватает примитива сравнимого с multi_index)
Read More »

Posted in Boost, C++, Ru, Tutorial | Leave a comment

Lab 4, Loading kernel

Time to study the way how we place our kernel into the memory on R-Pi.
U-Boot have usually convention to place loaded binaries at 0x8000 (32KB) and just pass control there. So, let’s compile trivial program and study generated binary to understand the way how we can operate with it.

In Lab 1 we found a way of making ARM executables. Check what actually the file is:

$ file test
test: Plan 9 executable, ARM 7-something

By checking Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Lab 3, R-Pi Booting process

Now time to study the boot process on Raspberry Pi.
Good source to study: R-Pi Boot process

1. Stage 1 boot is in the on-chip ROM. Loads stage2 in the L2 cache!
2. Stage 2 is bootcode.bin. Enables SDRAM and loads stage3
3. Stage 3 is loader.bin. Knows about elf format and load start.elf
4. start.elf loads kernel.img (also start.elf is the main gpu code).

  • It reads config.txt, cmdline.txt and bcm2835.dtb
  • If the dtb file exists, it is loaded at 0x100 & kernel @ 0x8000
  • Else if disable_commandline_tags is set load kernel @ 0x0
  • Else if load kernel @ 0x8000 and put ATAGS at 0x100

5. kernel.img, is the first! thing that runs on the ARM processor.

We will use u-boot as kernel.img so our config.txt will look as:
Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | 14 Comments

Lab 2, Hardware

We need to have possibility of booting kernel on Raspbery Pi. Because we will not have display driver soon, we need another approach – have serial port connected to get all output from booter and then from our kernel. We bought small FTDI 3.3V chip to have connected it to GPIO pins on one side and to USB port of my Mac on another side. Also need to install FTDIUSBSerialDriver_v2_2_18 for Mac.
Read More »

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Lab 1, Compiler

Let’s start with tools that we need to just build the OS for ARM. First clone official inferno os repository from google code repository:

# hg clone

What we need to move further? We need the ARM cross compiler, linker, etc. For this, let’s just compile inferno targeting mac as host (we are on mac now, so we will get hosted inferno for mac as result):

# cd inferno-os/
# INF_ROOT=`pwd` perl -i -pe 's/^ROOT=.*/ROOT=$ENV{INF_ROOT}/m' mkconfig
# perl -i -pe 's/^SYSHOST=.*/SYSHOST=MacOSX/m' mkconfig
# perl -i -pe 's/^OBJTYPE=.*/OBJTYPE=386/m' mkconfig
# sh
# PATH=`pwd`/MacOSX/386/bin:$PATH mk nuke
# PATH=`pwd`/MacOSX/386/bin:$PATH mk install
… waiting just few minutes … 
# ls MacOSX/386/bin/
0a         2l         8l         iar        ksize      ms2        tc
0c         5a         acid       idea       kstrip     ndate      va
0l         5c         asm        inm        limbo      qa         vc
1a         5coff      c2l        iyacc      md5sum     qc         vl
1c         5cv        data2c     ka         mk         ql
1l         5l         data2s     kc    sqz
2a         8a         emu        kl         mkext      srclist
2c         8c         ftl        kprof      mkppcimage styxtest

Yes! Now we have all needed cross-platform tools for building Inferno OS for ARM, see 5c – C compiler, 5a – ARM assembler, 5l – ARM linker.
Let’s check ARM asm generated:

# export PATH=`pwd`/MacOSX/386/bin:$PATH 
# echo "int main() { return 123; }" >tmp.c && 5c -S tmp.c && rm tmp.c
	TEXT	main+0(SB),0,$0
	MOVW	$123,R0
	RET	,
	RET	,
	END	,
Posted in Blog, Inferno OS, Raspberry Pi, Research | 3 Comments

Porting Inferno OS to Raspberry Pi

We started a small and exciting project just for fun as “Porting Inferno OS to Raspberry Pi”. Of course we would like to run it there as native, not hosted. It was always declared that this OS is very simple for porting to new platforms, so let’s just research this and reach new distilled experiences of system programming. Also this OS is very small, simple and easy to tweak for research purposes.

We decided to organize it as some set of small labs with very detailed steps of what is done to reach results and make everything easy to reproduce. Meet Lab 1 in next post.

Posted in Blog, Inferno OS, Raspberry Pi, Research | Leave a comment

Inferno OS

We are planning some posts about Inferno operating system. Stay tuned!

Posted in Blog, Inferno OS, Research | Leave a comment


People who are using Trac and have a need of possibility binding it with Perforce repository can find that appropriate plugin is dead and no support is possible. So I would like to do some refresh – I was able to do some fixing and made these plugins available for use with Trac 1.0 for win32. Attaching to the post.


Posted in Blog, Misc, Trac, Web | 1 Comment

Designing Undo for large-scale projects. Going deep.

That is huge architect-level article about designing undo in large-scale project, welcome under more label… Read More »

Posted in C++, Misc, Qt, Research, Undo | 1 Comment
Clef two-factor authentication