<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-192079351385094431</id><updated>2012-01-16T07:33:47.934+01:00</updated><category term='silly'/><category term='arm'/><category term='tcp'/><category term='fanatik'/><category term='carpet'/><category term='usb'/><category term='dynamic_linking'/><category term='magic'/><category term='cores'/><category term='intro'/><category term='programming'/><category term='openmoko'/><category term='hid'/><category term='gcc'/><category term='raving'/><category term='blogging'/><category term='blinkenlights'/><category term='c++'/><category term='quiz'/><category term='networking'/><category term='helenos'/><category term='hardware'/><category term='c'/><title type='text'>Jiri's allegedly HelenOS blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-6563635971638341537</id><published>2011-11-23T08:03:00.000+01:00</published><updated>2011-11-23T13:05:54.060+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='helenos'/><category scheme='http://www.blogger.com/atom/ns#' term='networking'/><title type='text'>TCP... the truth will be revealed</title><content type='html'>I have long before recognized that the current network stack in HelenOS is messed up beyond repair and trying to fix it anymore is a waste of time. Since it's been two years after the master thesis was defended and we still do not have something that would work, it might not be well received by others if I threw everything out and started from zero, though.&lt;br /&gt;&lt;br /&gt;So I started with a complete rewrite of TCP. This is arguably the only more complex / non-trivial module in the stack and the part that is obviously most broken.&lt;br /&gt;&lt;br /&gt;Despite lack of spare time I have now a new TCP module that is not 100% complete, but complete enough so that it could be test-run against itself over the wire. I implemented it as a completely independent server that has nothing in common with the current networking stack. I tested the functionality using internal loopback in the TCP module and internal clients.&lt;br /&gt;&lt;br /&gt;Yesterday I started hooking it into the current network stack, the idea is to create a minimal connector between the two components. After three hours of work there is still some way to go before I can successfully send/receive PDUs to/from IP (I haven't started with the socket interface yet).&lt;br /&gt;&lt;br /&gt;During this work I had the chance to fully 'appreciate' the quirks and complexities of the network stack. IP understands sockets and TCP pseudo headers. TCP knows about IP headers and network devices. But who cares about layers or separation of concerns, right?&lt;br /&gt;&lt;br /&gt;Since quite a few people claimed that the remainder of the network stack actually works -- to some degree -- I wonder whether I get something at least remotely useful when I plug my TCP implementation into the stack. The truth will be revealed. And then I can maybe throw the rest of the rubbish out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-6563635971638341537?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/6563635971638341537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/11/tcp-truth-will-be-revealed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/6563635971638341537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/6563635971638341537'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/11/tcp-truth-will-be-revealed.html' title='TCP... the truth will be revealed'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-6587038831429576534</id><published>2011-08-10T20:18:00.000+02:00</published><updated>2011-08-10T20:18:35.831+02:00</updated><title type='text'>The first sentence counts</title><content type='html'>Of the novels and short stories I've read there were two cases where not only they were works of sheer literary genius, but also written with a humour that sold them to me with the very first sentence.&lt;br /&gt;&lt;br /&gt;In the first case the short story Jupiter Five, my favourite by sir A. C. Clarke, partly due to the excellent and slightly unusual Czech translation.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Profesor Forster měl tak drobnou postavu, že pro něho museli vyrobit speciální kosmoskafandr. (Profesor Forster's stature was so small they had to make a special spacesuit for him.)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;In the second case this was the (perhaps more widely known) novel Harry Potter and the Philosopher's stone:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Mr. and Mrs. Dursley, of number four, Privet Drive, were proud to say that they were perfectly normal, thank you very much.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;When a story starts with a sentence like this, you just know you're in for a treat :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-6587038831429576534?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/6587038831429576534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/08/first-sentence-counts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/6587038831429576534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/6587038831429576534'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/08/first-sentence-counts.html' title='The first sentence counts'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-5361853149394645444</id><published>2011-07-08T15:51:00.000+02:00</published><updated>2011-07-08T15:51:31.442+02:00</updated><title type='text'>Will ARM architecture go 64-bit?</title><content type='html'>For some time now I have been thinking about the increasing memory capacities of mobile devices and the fact that the ARM architecture, upon which they are built, is still 32-bit only. This was puzzling for me, so I decided to dig around a little. The results are more than interesting.&lt;br /&gt;&lt;br /&gt;Apparently, in November last year (2010) rumors started spreading that ARM holdings is working on a 64-bit ARM processor (see &lt;a href="http://www.xbitlabs.com/news/cpu/display/20101124221552_64_Bit_ARM_Chip_Design_in_the_Works_Report.html"&gt;Xbit labs&lt;/a&gt;, &lt;a href="http://www.v3.co.uk/v3-uk/news/1946826/rumours-hint-imminent-arm-bit-processor"&gt;v3.co.uk&lt;/a&gt;). These rumors were &lt;a href="http://www.computerworld.com/s/article/9208339/ARM_CEO_says_no_rush_to_64_bit_server_chip"&gt;denied by ARM CEO Warren East&lt;/a&gt; in February 2011.&lt;br /&gt;&lt;br /&gt;In an interesting turn of events, &lt;i&gt;before that&lt;/i&gt; in January 2011 at the Consumer Electronics Show in Las Vegas &lt;a href="http://blogs.nvidia.com/2011/01/project-denver-processor-to-usher-in-new-era-of-computing/"&gt;Nvidia announced project Denver&lt;/a&gt; which aims to create a 64-bit ARM processor powerful enough to compete on the desktop and server market. At the same time Microsoft announced that Windows 8 will run on ARM as well as on x86. You can read a vey nice &lt;a href="http://arstechnica.com/gadgets/news/2011/01/nvidias-project-denver-cpu-puts-the-nail-in-wintels-coffin.ars"&gt;analysis on Ars Technica&lt;/a&gt; or the  &lt;a href="http://venturebeat.com/2011/03/04/qa-nvidia-chief-explains-his-strategy-for-winning-in-mobile-computing/"&gt;interview with Nvidia CEO&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Nvidia's plans are very bold. Who knows whether they will succeed. If they do, this could stir the stale waters of x86 deskop quite a bit. Spending the last HelenOS camp finding a bug in the ARM context save/restore routines might not have been a waste of time after all. Who'd have thought? ^_^&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-5361853149394645444?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/5361853149394645444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/07/will-arm-architecture-go-64-bit.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5361853149394645444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5361853149394645444'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/07/will-arm-architecture-go-64-bit.html' title='Will ARM architecture go 64-bit?'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-8514603174933746761</id><published>2011-05-18T05:00:00.000+02:00</published><updated>2011-05-17T17:01:57.494+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='silly'/><category scheme='http://www.blogger.com/atom/ns#' term='helenos'/><category scheme='http://www.blogger.com/atom/ns#' term='magic'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='carpet'/><category scheme='http://www.blogger.com/atom/ns#' term='usb'/><category scheme='http://www.blogger.com/atom/ns#' term='hid'/><title type='text'>How to ride your magic carpet</title><content type='html'>Magic carpets are, you know, pretty much commonplace stuff. Everybody rides one, including Prince of Persia and the Rescue Rangers. Now the thing which has always bugged me is the question: How do you control which direction the carpet should fly?&lt;br /&gt;&lt;br /&gt;Looks like another big mystery solved. And I didn't have to look far for the answer, too. It's all written in, I am not kidding you, the &lt;a href="http://www.usb.org/developers/devclass_docs/Hut1_12.pdf"&gt;USB HID specifications&lt;/a&gt;. Quoting:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Magic Carpet Simulation Device&lt;br /&gt;&lt;br /&gt;CA – Allows a device to be generally classified as one that uses the standard control of a magic carpet. This control is a bar, grasped by both hands, that controls the Yaw, Pitch and Roll of the carpet.&lt;br /&gt;&lt;br /&gt;The bar, at which the pilot sits, may be pushed forward or pulled back to cause the carpet to dive or rise, respectively. In the zero position, the carpet is in level flight. Pushing forward on the bar causes the carpet to nose down and generates negative values. Pulling back on the bar causes the carpet to nose up and generates positive values.&lt;br /&gt;&lt;br /&gt;Turning the bar turns the carpet. In the zero position, the carpet travels straight ahead. Pulling back on the right side turns the carpet to the right and generates positive values. Pulling back on the left side turns the carpet to the left and generates negative values. Rotating the bar rolls the carpet. In the zero position, the carpet travels level.&lt;br /&gt;&lt;br /&gt;Rotating the bar in a clockwise direction rolls the carpet to the right and generates positive values. Rotating the bar in the counterclockwise direction rolls the carpet to the left and generates negative values.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Now fortunately HelenOS will soon get USB HID support. So that means I can run HelenOS on my magic carpet's on board computer and still use the &lt;i&gt;standard controls&lt;/i&gt; of the magic carpet, right? Right?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-8514603174933746761?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/8514603174933746761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/05/how-to-ride-magic-carpet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/8514603174933746761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/8514603174933746761'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/05/how-to-ride-magic-carpet.html' title='How to ride your magic carpet'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-9151421290630040555</id><published>2011-04-18T22:11:00.000+02:00</published><updated>2011-04-18T22:12:50.796+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='helenos'/><category scheme='http://www.blogger.com/atom/ns#' term='c'/><category scheme='http://www.blogger.com/atom/ns#' term='cores'/><category scheme='http://www.blogger.com/atom/ns#' term='dynamic_linking'/><title type='text'>Granumophobia</title><content type='html'>Getting dynamic linking to work right is a never-ending series of dumped cores. Today I found two bugs which were actually quite generic (i.e. not architecture-specific) and, to be honest, quite silly.&lt;br /&gt;&lt;br /&gt;First a sizeof(ptr) instead of sizeof(*ptr) passed to memset() caused the dyn_info_t structure not to be properly zeroed out. If something in dyn_info_t is not zero, it is assumed to be valid entry present in the dynamic section. Hence mysterious occasional crashes. Luckily thanks to the new memory allocator which has debugging turned on there was a suspicious quantity of dead beef being thrown around which slightly helped me find the problem.&lt;br /&gt;&lt;br /&gt;Second, the relocation processing code was dying while trying to fix up references to libc variables in the text segment of the main program, which is stored in a memory area with R-X permissions. Huh? Well, the main program is loaded by loader, instead of dynload. Unlike dynload, loader does not make all loaded segments writable. Bummer.&lt;br /&gt;&lt;br /&gt;Dynamic linking takes patience. If you suffer from &lt;a href="http://en.wikipedia.org/wiki/Nucleophilic"&gt;granumophobia&lt;/a&gt;, then stay away.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-9151421290630040555?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/9151421290630040555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/04/granumophobia.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/9151421290630040555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/9151421290630040555'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/04/granumophobia.html' title='Granumophobia'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-58375863033455809</id><published>2011-03-19T15:14:00.000+01:00</published><updated>2011-03-19T15:14:48.854+01:00</updated><title type='text'>Base class constructors? Oh my!</title><content type='html'>When a person with quite limited exposure to OO programming (like me) gets such a crazy idea like designing an OO programming language (like Sysel), they shouldn't be surprised when they forget about something important. Like invoking base class constructors.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;What happened was that while working on constructing the syntax tree in NNPS I was getting exceptions due to accessing nil reference (equivalent of null pointer dereference in C). The problem boils down to the following: we have two classes A and B, B derived from A. Both have constructors, the constructor for A initializes some reference in A. When a new object of class B was created, only constructor for B was called so the reference was not initialized.&lt;br /&gt;&lt;br /&gt;When a new object is created, constructors must be called for its class and all base classes. This is easy if the constructors do not have parameters (in this case it can be done implicitly). If the constructors do have parameters, the programmer must explicitly specify them (since the compiler does not know what they should be).&lt;br /&gt;&lt;br /&gt;Different languages solve the problem differently. In C++ (and similar languages) the arguments / call to base class constructor(s) appear to be part of the constructor's signature.&lt;br /&gt;&lt;pre&gt;class A {&lt;br /&gt;    public: A(int i, int j) { }&lt;br /&gt;};&lt;br /&gt;class B : public A {&lt;br /&gt;    public: B(int i) : A(i,i+1) { }&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;Others, like PHP, require the programmer to call the base class constructor with a syntax similar to a static method invocation:&lt;br /&gt;&lt;pre&gt;class A {&lt;br /&gt;   function __construct(i, j) { }&lt;br /&gt;}&lt;br /&gt;class B extends A {&lt;br /&gt;   function __construct() {&lt;br /&gt;       parent::__construct(i, i+1);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;The strength of the first approach is that it makes it is syntactically enforcible, i.e.&lt;br /&gt;if you forget about it, the compiler can easily tell. In the second case you can do more&lt;br /&gt;complex processing before calling the parent constructor (than just evaluating an expression),&lt;br /&gt;but it is difficult to tell at compile time whether all code paths contain the constructor&lt;br /&gt;invocation (a problem similar to determining if all code paths in a function end in a return statement).&lt;br /&gt;&lt;br /&gt;I still need to decide how to implement this in Sysel. Or I could just make my base class constructors parameter-less for the time being.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-58375863033455809?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/58375863033455809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/03/base-class-constructors-oh-my.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/58375863033455809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/58375863033455809'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/03/base-class-constructors-oh-my.html' title='Base class constructors? Oh my!'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-5796318386550862005</id><published>2011-03-19T14:36:00.000+01:00</published><updated>2011-03-19T14:36:45.385+01:00</updated><title type='text'>GSoC - Great System on a Chip? No!</title><content type='html'>It seems a little pointless repeating what has already been said, but, wow, is this something special! HelenOS has been accepted as a &lt;a href="http://www.google-melange.com/gsoc/program/accepted_orgs/google/gsoc2011"&gt;mentoring organization for 2011 Google Summer of Code&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What more to say? It feels great to be in company of so many well-known open-source projects from areas of OS, desktop, applications, games, scientific software, etc., etc.&lt;br /&gt;&lt;br /&gt;Now we need some students!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-5796318386550862005?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/5796318386550862005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/03/gsoc-great-system-on-chip-no.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5796318386550862005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5796318386550862005'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2011/03/gsoc-great-system-on-chip-no.html' title='GSoC - Great System on a Chip? No!'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-200733107148284236</id><published>2011-01-03T22:38:00.000+01:00</published><updated>2011-01-04T23:56:26.959+01:00</updated><title type='text'>Observations on HelenOS device drivers framework</title><content type='html'>Some time ago we merged Lenka's new Device Drivers Framework (DDF henceforth) to HelenOS mainline. When I finally read through her thesis and had a closer look at the code I promised to do a writeup of my observations. Here it is. A bit of a long read though, be warned.&lt;br /&gt;&lt;br /&gt;Let's start with a quick overview. Lenka's contribution can be broken down into several parts. First there is the &lt;tt&gt;devman&lt;/tt&gt; server which (a) manages the physical device topology, driver task life cycle, driver attaching and detaching, (b) maintains a 'logical' device topology (devices grouped by their class).&lt;br /&gt;&lt;br /&gt;Second, Lenka proposed that for any IPC communication between two drivers or an application and driver should be strictly defined in terms of function calls and the client- and server-side IPC glue code should be kept strictly separate in a library to be reused by all servers and clients using such code.&lt;br /&gt;&lt;br /&gt;Third, when mapping the function calls to IPC, Lenka reserved the first field of the message for an &lt;em&gt;interface id&lt;/em&gt;. This allowed her to communicate with a driver using several different protocols, namely a protocol for talking to the driver as such (create new instance) and for talking to the device itself (e.g. read/write, etc.).&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As you can see Lenka took on quite a challenge and tried to cover area that extends quite far past mere device management. I will not try to cover it all here, if you are interested, go ahead and read her thesis. I will only focus here on parts that I found particularly interesting, where I found room for improvement or that inspired me somehow.&lt;br /&gt;&lt;br /&gt;Summary of my observations. I have some practical concerns about the DDF, as it is implemented now:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Problematic support of pseudo-devices (e.g. &lt;tt&gt;file_bd&lt;/tt&gt;)&lt;/li&gt;&lt;li&gt;Problematic support of 'multi-function' devices (e.g. &lt;tt&gt;i8042&lt;/tt&gt;)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;I believe these need to be addressed before we can convert our current drivers to the new driver model. Also, what I don't like is:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Making devices 'special' and making them use different communication than the rest of the system.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;There are also two topics which I haven't seen mentioned in the thesis although they are highly relevant:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;parallelism in device enumeration&lt;/li&gt;&lt;li&gt;persistent device naming&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;I have some ideas what could be handled better or differently, which I will outline below.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;IPC communication suggestions&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The problem&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Lenka faced a practical problem when communicating to a driver. Sometimes she needed to control the driver as such using a generic driver protocol (e.g. add_device operation), sometimes she needed to talk to the driver using a device-specific protocol (e.g. char_read, char_write), etc.&lt;br /&gt;&lt;br /&gt;For this reason Lenka came up with the idea that a driver could implement multiple different protocols. She reserves the first field of an IPC message for the protocol ID, moving the method ID effectively to the second field of the message.&lt;br /&gt;&lt;br /&gt;Lenka envisaged another use of the multiple interface support, namely that a device could support multiple device-specific protocols and that the interfaces and their API stubs could be reused (in a duck-type manner) and combined, possibly for semantically completely different (but syntactically equivalent) sets of operations.&lt;br /&gt;&lt;br /&gt;The first thing that I don't like at all is that here devices drivers are made somehow special and they use a communication protocol completely different from the rest of the system services. There is no reason for that, it will just make communication between different types of tasks incompatible.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Better server task model&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;The proposed mechanism looks useful and something &lt;em&gt;similar&lt;/em&gt; could/should be used for &lt;em&gt;all&lt;/em&gt; IPC communications, not just to the device drivers!&lt;br /&gt;&lt;br /&gt;Recently Martin Děcký pushed some changes where he started a change in order to embed the interface ID (in the same sense as Lenka uses) to the first IPC message field (along with method ID) to use it in general IPC communication.&lt;br /&gt;&lt;br /&gt;Great! This is way better for two reasons:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;It is generic, applies to all IPC communication equally&lt;/li&gt;&lt;li&gt;It is more space-conscious, does not consume an entire argument&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;Still, I think we can do much better than that. (I already outlined this in the mailing list, but I'll repeat it here).&lt;br /&gt;&lt;br /&gt;First, embedding the interface ID in every message is wasteful, it stays the same for the duration of an exchange, at the minimum.&lt;br /&gt;&lt;br /&gt;Second, I think the problem being solved stems from the fact that we are trying to control different entities within the same server task. So, instead of trying to talk different protocols to the same entity, we are, in fact, trying to talk to different entities (each speaking different protocol, incidentally).&lt;br /&gt;&lt;br /&gt;The model of a server task can be described in terms of object-oriented programming:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Lenka says: A server task is an object that implements one or more interfaces.&lt;/li&gt;&lt;li&gt;Jiří says: A server task is a collection of objects, each belonging to (exactly one) class (classes form a true inheritance hierarchy).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;If we consider the driver to be a &lt;em&gt;collection&lt;/em&gt; of objects (driver control object, device control object(s)), it also solves the problem for the case of the device driver.&lt;br /&gt;&lt;br /&gt;Another way to look at this is that we add another level of addressing. We can imagine that we access the inside of the server task via different points of access. We can call them &lt;em&gt;ports&lt;/em&gt; in analogy with TCP/IP ports (or RM ISO/OSI SAPs) which allow talking to different entities within the same IP interface (IP node, IP address).&lt;br /&gt;&lt;br /&gt;One of the benefits of ports is that when a server provides access to a set of resources of some type (e.g. file, device) we can map each individual resource to a port. Then we don't need a special identifier (file descriptor, device descriptor) since the individual resource is already identified by the port (port ID). So we save one message field plus the framework actually understands that this is an identifier.&lt;br /&gt;&lt;br /&gt;Port references can be optionally made unforgeable (which is a very useful property). Ports can be implemented in different ways and have numerous other benefits which I will not detail here if just not to scare you off ;-)&lt;br /&gt;&lt;br /&gt;Implementation note: To allow the async framework to embed some information (any of interface ID, port ID, virtual path ID) automatically into a request slight changes to the async API are needed (when making a request we should pass a pointer to an exchange instead of integer/phone ID). Nevertheless the conversion of applications and servers is straight-forward and with a split API it can be implemented gradually, if needed.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Better use of message space&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;When talking to a port, we'll talk the same protocol the entire time. Therefore, we can establish that right upon connecting. Not only we eliminate redundancy, but we can tell that someone does not speak the expected protocol straight away (better than recognizing it upon the first operation).&lt;br /&gt;&lt;br /&gt;So rather than embedding interface ID in the message, we can embed the port ID (having established the protocol spoken by a port already).&lt;br /&gt;&lt;br /&gt;Still, an entire &lt;em&gt;exchange&lt;/em&gt; (see &lt;a href="http://trac.helenos.org/trac.fcgi/wiki/AsyncSessions"&gt;async sessions&lt;/a&gt;) will always talk to just one port, so this still seems a little wasteful.&lt;br /&gt;&lt;br /&gt;We could instead embed something that would allow us to identify different &lt;em&gt;exchanges&lt;/em&gt; and multiplex parallel operations onto a single physical IPC connection.&lt;br /&gt;&lt;br /&gt;A good way to implement that seems to embed a &lt;em&gt;virtual path ID&lt;/em&gt;. Virtual paths would be set up and torn down by the async framework (session code) on the client side. Each virtual path would be assigned an ID. The server would create a fibril to service each virtual path (within each connection). The session management code would no longer create (kernel-based) IPC connections for concurrent communication, but instead it would create (userspace-based) virtual paths. This provides and alternative (although not necessarily better?) to the current implementation, which creates multiple physical connections.&lt;br /&gt;&lt;br /&gt;The session API combines with this in the following way:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A client initiates a session to a server port.&lt;/li&gt;&lt;li&gt;On the session the client performs exchanges as usual.&lt;/li&gt;&lt;li&gt;Internally the async framework creates as many parallel virtual paths (within the physical connection) as necessary&lt;/li&gt;&lt;li&gt;The async framework on the server side creates a handler fibril for each incoming virtual path&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Device model suggestions&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Current model&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;In the current model we have two types of device nodes: nexus nodes and leaf nodes. A nexus node ('bus device') consists of several objects:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1 driver control object (generic driver protocol)&lt;/li&gt;&lt;li&gt;1 nexus (bus) device control object (device-specific protocol)&lt;/li&gt;&lt;li&gt;&lt;em&gt;n&lt;/em&gt; device attachment points (bus-specific protocol)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;A leaf node consists of:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1 driver control object (generic driver protocol)&lt;/li&gt;&lt;li&gt;1 leaf device control object (device-specific protocol)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Important to note is that the driver control object and device control objects always coexist (you can't have one without the other).&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Problems&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;The biggest problem I see in the current model is that it requires a 1:1 relationship between a physical device (something to which you can attach a driver) and its logical functions (services provided by the device), at least for leaf drivers (you can't have one without the other).&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Pseudo-driver&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;Let's call a pseudo-driver any driver whose life-cycle is not naturally controlled by bus enumeration. An example is &lt;tt&gt;file_bd&lt;/tt&gt; whose instance is naturally created when the user types in some command.&lt;br /&gt;&lt;br /&gt;If we wanted to port file_bd to the current DDF we would need to also add some special pseudo nexus driver (possibly a special one for file_bd) which the application would tell to attach a new child. Then we would need to somehow communicate the parameters to the child and...aargh!&lt;br /&gt;&lt;br /&gt;While the plain devmap-style drivers can be modified to speak a protocol compatible to the devman-style drivers, they are not fully fledged devices. We can't add them to device classes, so if we obtain a list of devices in some class, these pseudo-devices won't be included.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Multifunction device&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;Let's call a multifunction device any device which behind one physical interface provides access to multiple logical functions.&lt;br /&gt;&lt;br /&gt;Buses can be considered multifunction devices (they expose multiple device attachment points). Our concern however are multifunction leaf devices. A typical example is i8042 (which provides two character interfaces) or a (partitioned) disk (which provides multiple block interfaces).&lt;br /&gt;&lt;br /&gt;If we wanted to port these drivers to the current DDF, we would need to implement them in terms of a nexus device plus a leaf (connector) device. Even if we implemented both the nexus and connector device inside a single driver binary, it is just unnecessary complication. The connector device would do nothing but forward IPC communication to the nexus device. Why clutter device drivers with completely generic code?&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Proposed solution&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;I propose a more uniform device model, where each (nexus or leaf device) consists of:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1 driver object&lt;/li&gt;&lt;li&gt;1 (physical) device object&lt;/li&gt;&lt;li&gt;&lt;em&gt;n&lt;/em&gt; logical functions&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Each logical function can be either a &lt;em&gt;external / leaf function&lt;/em&gt; (exposed to clients outside of DDF) or &lt;em&gt;internal / non-leaf function&lt;/em&gt; to which the DDF can attach more levels of the device hierarchy.&lt;br /&gt;&lt;br /&gt;The choice of whether a logical function is external or internal could be up to the (nexus) device driver or, possibly, it could be made to depend on other factors (such as whether a device driver could be attached). Mixed-mode (leaf and nexus) drivers would be possible, if desired.&lt;br /&gt;&lt;br /&gt;More importantly, multifunction leaf devices would be easy to implement (just change the flavor of the functions from internal to external and voila). No need for implementing connector device nodes in such driver.&lt;br /&gt;&lt;br /&gt;Also we can make it possible for any server to call the DDF and say 'hey, I'm a pseudo driver' and to create logical functions. This enables us to construct (leaf) pseudo-device drivers in a simple and straightforward manner. These don't need to be included in the physical device tree (equivalent of UN*X /devices). Only their logical functions are included in the logical device function name space (equivalent of UN*X /dev).&lt;br /&gt;&lt;br /&gt;An interesting problem is the existence of pseudo nexus devices. A pseudo nexus device &lt;em&gt;must&lt;/em&gt; be included in the physical device hierarchy (because its children are not pseudo devices in the sense described above). If we choose to allow pseudo nexus drivers, we will need, in the end, some 'pseudo' node in the device tree as a root for them. Still, we will have the benefit of manual device lifetime management. I am not sure whether pseudo nexus devices are useful or not.&lt;br /&gt;&lt;br /&gt;As a side note, the operation &lt;em&gt;add logical function&lt;/em&gt; is (conceptually) more generic than &lt;em&gt;add child&lt;/em&gt; because it does not imply what gets connected to the attachment point (logical function). In a multi-pathed device scenario the device node is not attached directly to the parent node. Instead for some bus B there is a multiplexer which connects to each B host adapter node. All device nodes then attach to this multiplexer. (So their connection to the bus host adapter node is indirect).&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Providing device services&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Currently devman manages &lt;em&gt;device classes&lt;/em&gt;. A device driver will register a device in some class and then applications can e.g. list all devices in some class.&lt;br /&gt;&lt;br /&gt;This is not necessarily bad, although it might be an unnecessary complication. If we implement location services in the CORBA sense (naming and trading service), they will provide the same functionality for all IPC services.&lt;br /&gt;&lt;br /&gt;(Explanation of what I mean here by LS in the CORBA sense: Any server can register a (non-singleton) service, specifying its &lt;em&gt;name&lt;/em&gt; (generated hierarchical unambiguous (string) identifier) and &lt;em&gt;type&lt;/em&gt; (hierarchical name of a class/type of the service). Then we can list all services, services by class, etc.)&lt;br /&gt;&lt;br /&gt;Now it is perfectly possible to export services provided by some device via the location services instead of implementing a special registry in devman.&lt;br /&gt;&lt;br /&gt;So, in the scenario described above, there would seem to be little added value in using a special devman class database, instead of the more generic (and possibly smarter) location services.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Corollary&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;I described what I see as important limitations of the current HelenOS DDF. Lenka's work inspired me with many interesting ideas, which I described. I proposed a number of improvement proposals either to the DDF itself or in IPC. The proposals form a coherent vision, but many of the individual ideas are to a degree independent and thus they can be implemented individually and gradually.&lt;br /&gt;&lt;br /&gt;Thanks for reading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-200733107148284236?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/200733107148284236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/12/observations-on-helenos-device-drivers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/200733107148284236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/200733107148284236'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/12/observations-on-helenos-device-drivers.html' title='Observations on HelenOS device drivers framework'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-5086442881200989410</id><published>2010-12-28T19:54:00.000+01:00</published><updated>2010-12-28T22:15:19.868+01:00</updated><title type='text'>Mister triple W. meets miss H.</title><content type='html'>I think the following image speaks for itself.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_UVqyMZ9NOdM/TRoyodKet0I/AAAAAAAAABo/hBtHAY4OFHU/s1600/test.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 215px;" src="http://4.bp.blogspot.com/_UVqyMZ9NOdM/TRoyodKet0I/AAAAAAAAABo/hBtHAY4OFHU/s320/test.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5555808760919668546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After my recent bug fixes, HelenOS is able to serve a web page from inside Qemu. TCP is still shaky, sometimes it works, sometimes it does not. But it's still progress :-). In the past weeks and months I got my hands dirty in the networking stack and I tell you, the code is &lt;i&gt;weird&lt;/i&gt; throughout!&lt;br /&gt;&lt;br /&gt;The web server is mostly fake, but it does serve its purpose :-) I should be committing it shortly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-5086442881200989410?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/5086442881200989410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/12/mister-triple-w-meets-miss-h.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5086442881200989410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5086442881200989410'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/12/mister-triple-w-meets-miss-h.html' title='Mister triple W. meets miss H.'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_UVqyMZ9NOdM/TRoyodKet0I/AAAAAAAAABo/hBtHAY4OFHU/s72-c/test.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-5261503416639976944</id><published>2010-12-03T20:36:00.000+01:00</published><updated>2010-12-03T11:29:27.276+01:00</updated><title type='text'>A moment to remember</title><content type='html'>If you don't understand Czech, turn on CC (captions) in the player before starting the video.&lt;br /&gt;&lt;br /&gt;&lt;object width="360" height="288"&gt;&lt;param name="movie" value="http://www.youtube.com/v/oFPzVByyMtg?fs=1&amp;amp;hl=en_US"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/oFPzVByyMtg?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="360" height="288"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-5261503416639976944?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/5261503416639976944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/12/moment-to-remember.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5261503416639976944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5261503416639976944'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/12/moment-to-remember.html' title='A moment to remember'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-1758182056092017338</id><published>2010-11-30T06:57:00.000+01:00</published><updated>2011-01-03T23:02:01.375+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quiz'/><category scheme='http://www.blogger.com/atom/ns#' term='fanatik'/><category scheme='http://www.blogger.com/atom/ns#' term='intro'/><title type='text'>Nuts and bolts</title><content type='html'>Today I'm back with a now familiar picture of the &lt;b&gt;Fanatik 1&lt;/b&gt;, this time with the major parts labeled.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_UVqyMZ9NOdM/TOrl9-OQr0I/AAAAAAAAAAw/QH8Q_z30ILc/s1600/f1_legend.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_UVqyMZ9NOdM/TOrl9-OQr0I/AAAAAAAAAAw/QH8Q_z30ILc/s320/f1_legend.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5542495144270409538" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The system is divided roughly in two halves, the left half being the 'compute' part and the right half being the 'graphic' part.&lt;br /&gt;&lt;br /&gt;Let's start with the &lt;b&gt;CP&lt;/b&gt; (Central Processor). This is an &lt;a href="http://en.wikipedia.org/wiki/Atmel_AVR"&gt;Atmel AVR&lt;/a&gt; microcontroller, specifically ATMega162. This chip acts as the CPU, having access to the system's memory and some of the peripherals.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There are two SRAM memory chips called &lt;b&gt;CMEM&lt;/b&gt; and &lt;b&gt;GMEM&lt;/b&gt;, CMEM is primarily used for computing, while GMEM holds the video frame buffer.&lt;br /&gt;&lt;br /&gt;Fanatik has two analog video outputs, VGA and TV (cinch). These video signals are generated by the &lt;b&gt;GIA&lt;/b&gt; (Graphics and Interconnect Array). This is a Xilinx XC9572 &lt;a href="http://en.wikipedia.org/wiki/CPLD"&gt;CPLD&lt;/a&gt; (programmable logic device). The D/A converters are made solely from discrete resistors.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;SP&lt;/b&gt; (Supplementary Processor) serves as a clock generator and PS/2 keyboard controller. It can communicate with the CP via three dedicated lines plus over the eight (shared) bus data lines.&lt;br /&gt;&lt;br /&gt;The CP is also connected to the RS-232 interface (serial port), the buzzer/speaker output and the tape in/out ports ('mic' and 'ear'). Power (9-12 Volts DC) is provided via a standard DC power connector.&lt;br /&gt;&lt;br /&gt;The compute part and the graphics part each have its own bus. These are coupled by the passive &lt;b&gt;bus bridge&lt;/b&gt; (array of resistors). This allows the two buses to function independently or as one single bus, as needed.&lt;br /&gt;&lt;br /&gt;As you can see the Fanatik relies heavily on programmable hardware. As both the AVR MCUs and the Xilinx CPLDs are in-system-programmable, I can re-program them without unplugging them from the board :-).&lt;br /&gt;&lt;br /&gt;Hope you liked today's quick walk-through. Obviously I skipped a lot of details, but you can already see that the Fanatik is a pretty cool device with a decent range of I/O capabilities.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Correct answers from previous quiz&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;next to the heatsink screw on the top-left: &lt;a href="http://en.wikipedia.org/wiki/Trashman_(video_game)"&gt;Trashman&lt;/a&gt; (left of screw), &lt;a href="http://en.wikipedia.org/wiki/Knight_Lore"&gt;Sabreman&lt;/a&gt; (left and below of screw), diver from &lt;a href="http://www.worldofspectrum.org/infoseekid.cgi?id=0004381"&gt;Scuba Dive&lt;/a&gt; (right and below of screw),&lt;/li&gt;&lt;br /&gt;&lt;li&gt;around Fanatik label: &lt;a href="http://en.wikipedia.org/wiki/Horace_series"&gt;Horace&lt;/a&gt; (left and above), the knight from &lt;a href="http://www.worldofspectrum.org/infoseekid.cgi?id=0000856"&gt;Cavelon&lt;/a&gt; (below), Jet Man from &lt;a href="http://en.wikipedia.org/wiki/Jetpac"&gt;Jet Pac&lt;/a&gt; (right and above)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;left edge under the motto: Miner Willy from &lt;a href="http://en.wikipedia.org/wiki/Manic_Miner"&gt;Manic Miner&lt;/a&gt; (top), boy and girl from Quicsilva's &lt;a href="http://en.wikipedia.org/wiki/Ant_Attack"&gt;Ant Attack&lt;/a&gt; (middle), Jack from &lt;a href="http://en.wikipedia.org/wiki/Jumping_Jack_(game)"&gt;Jumping Jack&lt;/a&gt; (bottom).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;bottom edge and right edge: Interstellar Space Slug from &lt;a href="http://en.wikipedia.org/wiki/Pssst"&gt;Pssst&lt;/a&gt; (antagonist, bottom edge) and &lt;a href="http://en.wikipedia.org/wiki/Kokotoni_Wilf"&gt;Kokotoni Wilf&lt;/a&gt; (from the eponymous game).&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;Cookie winner: Jakub (congratulations! ^_^)&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;New quiz&lt;/h3&gt;&lt;br /&gt;(This time hopefully simpler.) Try a quick guess at the basic specs of the F-1. Namely try to guess the clock speed, RAM capacity and number of colors supported by the video outputs. Don't try to look it up, just give me the first number that comes to your head. Don't be shy! ;-)&lt;br /&gt;&lt;br /&gt;Till next time!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-1758182056092017338?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/1758182056092017338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/11/nuts-and-bolts.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/1758182056092017338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/1758182056092017338'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/11/nuts-and-bolts.html' title='Nuts and bolts'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_UVqyMZ9NOdM/TOrl9-OQr0I/AAAAAAAAAAw/QH8Q_z30ILc/s72-c/f1_legend.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-5631685935389749528</id><published>2010-11-17T23:30:00.000+01:00</published><updated>2010-11-18T00:30:01.526+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='fanatik'/><title type='text'>Faster than a speeding Panda</title><content type='html'>It's been more than a hundred days since I placed a pre-order on the &lt;a href="http://en.wikipedia.org/wiki/Pandora_(console)"&gt;demonic box&lt;/a&gt;. While those guys are still &lt;a href="http://www.youtube.com/watch?v=rvHJbmO9I04&amp;feature=player_embedded"&gt;trying to sort out their nubs&lt;/a&gt; I certainly haven't been biting my nails idly.&lt;br /&gt;&lt;br /&gt;Immediately after placing my order I set upon a quest. A quest to construct my own computing device. An so, after more than three months of planning, designing, etching, drilling and soldering I proudly present to you (lots of drum rolls and dramatic chords..) the one, the only, &lt;span style="font-weight:bold;"&gt;Fanatik 1&lt;/span&gt;!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_UVqyMZ9NOdM/TORizmJyJ7I/AAAAAAAAAAU/2mBsZOqiBrc/s1600/f1_front.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_UVqyMZ9NOdM/TORizmJyJ7I/AAAAAAAAAAU/2mBsZOqiBrc/s320/f1_front.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5540662080126986162" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Fanatik 1 is a one-of-a-kind computer heavily inspired by the classic 80's microcomputers, specifically the &lt;a href="http://en.wikipedia.org/wiki/Sinclair_ZX_Spectrum"&gt;ZX Spectrum&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_UVqyMZ9NOdM/TORi9rV2u5I/AAAAAAAAAAc/OTCoYWLc4Is/s1600/f1_back.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_UVqyMZ9NOdM/TORi9rV2u5I/AAAAAAAAAAc/OTCoYWLc4Is/s320/f1_back.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5540662253318486930" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I should get back to you soon with more details on the F-1. I will also present you with a series of quizzes. Today the question is simple: Try to name as many Speccy computer game protagonists as you can recognize etched on the Fanatik board. The winner will receive an original browser cookie.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-5631685935389749528?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/5631685935389749528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/11/faster-than-speeding-panda.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5631685935389749528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5631685935389749528'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/11/faster-than-speeding-panda.html' title='Faster than a speeding Panda'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_UVqyMZ9NOdM/TORizmJyJ7I/AAAAAAAAAAU/2mBsZOqiBrc/s72-c/f1_front.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-2432525188342863792</id><published>2010-11-06T11:23:00.000+01:00</published><updated>2010-11-06T11:29:06.676+01:00</updated><title type='text'>And you though your dreams were weird</title><content type='html'>Last night I dreamt I was trying to provoke &lt;a href="http://en.wikipedia.org/wiki/Murdoch_Mysteries#Detective_William_Murdoch"&gt;William Murdoch&lt;/a&gt; into inventing the &lt;a href="http://en.wikipedia.org/wiki/Water_turbine"&gt;water turbine&lt;/a&gt;. WTH?!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-2432525188342863792?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/2432525188342863792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/11/and-you-though-your-dreams-were-weird.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/2432525188342863792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/2432525188342863792'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/11/and-you-though-your-dreams-were-weird.html' title='And you though your dreams were weird'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-4684498346885990069</id><published>2010-10-25T09:13:00.000+02:00</published><updated>2010-10-25T09:40:50.318+02:00</updated><title type='text'>One, two, three... testing!</title><content type='html'>Many of you already know I've been busy with a 'top secret' electronics project. Especially Jakub has been nagging me to reveal something. Today I can share with you this photo of some mysterious tests that I've been performing. The results were satisfactory. That's all I will say for now. Mwahahaha!&lt;br /&gt;&lt;br /&gt;For those less versed in electronics let me describe the action for you. What you see in the picture are three joined-up &lt;a href="http://en.wikipedia.org/wiki/Breadboard"&gt;breadboards&lt;/a&gt;. On the breadboards we see some DIL &lt;a href="http://en.wikipedia.org/wiki/Integrated_circuit"&gt;ICs&lt;/a&gt; plus a bunch of wires and other stuff. The thing on the middle breadboard is a surface-mounted IC soldered to a home-made &lt;a href="http://en.wikipedia.org/wiki/Printed_circuit_board"&gt;PCB&lt;/a&gt; which has pins on the bottom side and allows one to plug the chip into the breadboard.&lt;br /&gt;&lt;br /&gt;And yes, the thing on the left side is a Logitronik II because George says every mad scientist should have a Logitronik II in their basement.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_UVqyMZ9NOdM/TMUvdlvvWLI/AAAAAAAAAAM/tCOoAhb8v6I/s1600/memtest.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_UVqyMZ9NOdM/TMUvdlvvWLI/AAAAAAAAAAM/tCOoAhb8v6I/s320/memtest.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5531879902689581234" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-4684498346885990069?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/4684498346885990069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/10/one-two-three-testing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/4684498346885990069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/4684498346885990069'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/10/one-two-three-testing.html' title='One, two, three... testing!'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_UVqyMZ9NOdM/TMUvdlvvWLI/AAAAAAAAAAM/tCOoAhb8v6I/s72-c/memtest.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-7561851511614631692</id><published>2010-08-09T19:18:00.000+02:00</published><updated>2010-08-09T19:46:51.565+02:00</updated><title type='text'>Reading for week 32</title><content type='html'>The guys from the (presumably dead) &lt;a href="http://tunes.org/"&gt;TUNES project&lt;/a&gt; seem to have liked writing essays more than actually writing code. (At least I was not able to find any). Compared to their cloud-castle project, Sysel seems boring and pure mainstream ^_^.&lt;br /&gt;&lt;br /&gt;They seem to have a &lt;a href="http://tunes.org/wiki/microkernel.html"&gt;clear opinion on microkernel OS design&lt;/a&gt; (calling it an &lt;a href="http://en.wikipedia.org/wiki/Abstraction_inversion"&gt;abstraction inversion&lt;/a&gt;) which I recommend reading.&lt;br /&gt;&lt;br /&gt;While cannot agree with everything therein, the article (or manifesto or whatever it is) accurately points out the principal weaknesses of microkernel design as such (as well as the faults in existing microkernel-based designs).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-7561851511614631692?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/7561851511614631692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/08/reading-for-week-32.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/7561851511614631692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/7561851511614631692'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/08/reading-for-week-32.html' title='Reading for week 32'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-7345888315042071124</id><published>2010-07-29T21:22:00.000+02:00</published><updated>2010-07-29T21:57:57.334+02:00</updated><title type='text'>Ensnared by the magic box</title><content type='html'>The magical Pandora's box surely worked its magic on me. I am now on the waiting list for the &lt;a href="http://en.wikipedia.org/wiki/Pandora_(console)"&gt;Pandora Console&lt;/a&gt; having just pre-ordered (and pre-payed) it. Now I just have to bear with the incredibly looong waiting time. (Supposing I do receive the console, it will be a pleasant surprise if I receive it this calendar year. Surprise me.)&lt;br /&gt;&lt;br /&gt;When I bought the &lt;a href="http://en.wikipedia.org/wiki/Neo_FreeRunner"&gt;Neo FreeRunner&lt;/a&gt; it was mostly for the sake of &lt;a href="http://trac.helenos.org/trac.fcgi/wiki/FreeRunner"&gt;porting HelenOS to it&lt;/a&gt; as I am not really into smartphones. It is still a cool device, though, thanks to the integrated Wireless Ethernet, GPS and accelerometers (and the openness, of course).&lt;br /&gt;&lt;br /&gt;With Pandora the situation is a little different. I really like old games and this is &lt;span style="font-style:italic;"&gt;the&lt;/span&gt; retro gaming device. The real selling point for me is the keyboard (although it probably is not a great one). Pandora also has gamepad controls, but I don't really like gamepads, anyway. It also has integrated WiFi (just imagine the multiplayer possibilities!) So I definitely want to use it on gaming (you could call it love at first sight).&lt;br /&gt;&lt;br /&gt;Porting HelenOS to Pandora should be relatively easy now, I should think, as I've already fixed the bugs that prevented HelenOS from running on a real ARM processor (despite working in emulators). Also, Pandora uses U-Boot just as FreeRunner does, so bootloader should not be a problem either.&lt;br /&gt;&lt;br /&gt;Anyway it will be long before I have my Pandora, so I still have plenty of time to improve FreeRunner support :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-7345888315042071124?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/7345888315042071124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/07/ensnared-by-magic-box.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/7345888315042071124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/7345888315042071124'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/07/ensnared-by-magic-box.html' title='Ensnared by the magic box'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-605932599725912317</id><published>2010-06-17T22:44:00.000+02:00</published><updated>2010-06-17T22:51:36.260+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arm'/><category scheme='http://www.blogger.com/atom/ns#' term='blinkenlights'/><category scheme='http://www.blogger.com/atom/ns#' term='helenos'/><category scheme='http://www.blogger.com/atom/ns#' term='openmoko'/><title type='text'>Watchen sie die blinkenlichten</title><content type='html'>Turn on CC (captions) in the player before starting the video.&lt;br /&gt;&lt;br /&gt;&lt;object width="360" height="288"&gt;&lt;param name="movie" value="http://www.youtube.com/v/EsQGxFEji98&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/EsQGxFEji98&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="360" height="288"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-605932599725912317?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/605932599725912317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/06/watchen-sie-die-blinkenlichten.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/605932599725912317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/605932599725912317'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/06/watchen-sie-die-blinkenlichten.html' title='Watchen sie die blinkenlichten'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-3760093486361142671</id><published>2010-06-04T19:56:00.000+02:00</published><updated>2010-06-04T23:16:06.414+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc'/><category scheme='http://www.blogger.com/atom/ns#' term='helenos'/><title type='text'>GCC: plus plus or not plus plus?</title><content type='html'>It appears that GCC has green light to start using C++ in their code. The idea seem to have been under &lt;a href="http://www.airs.com/ian/cxx-slides.pdf"&gt;consideration&lt;/a&gt; for about two years. This time, however, it has been &lt;a href="http://gcc.gnu.org/ml/gcc/2010-05/msg00705.html"&gt;approved by the GCC steering commitee and the FSF.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The surrounding discussion is is pretty much the old battle between C++ proponents (who point out its many merits) and opponents (who point out its many flaws). Concerns about speed and the need to teach GCC devs to use C++. Concerns about 'misuse of C++ features.' I find the slowness argument especially amusing since Clang/LLVM is written in C++ and it does not appear to be suffer from severe performance problems.&lt;br /&gt;&lt;br /&gt;And of course there are those who suggest only to use a subset of C++ that would not incur performance penalty nor contain features that are 'easily misused'. I hear many software projects claiming to use C++ are actually written in different, mutually incompatible subsets of C++ (using or not using exceptions, RTTI, templates, etc.) This seems to be encouraged by the historically bad conformance of C++ compilers to the language standard.&lt;br /&gt;&lt;br /&gt;Looking away from the rather amusing bickering, does this change affect me, a mere mortal user? Well normally I couldn't care less. When I compile GCC on Linux this certainly does not present any problem. From HelenOS point of view, this is more interesting.&lt;br /&gt;&lt;br /&gt;To make HelenOS self-hosting, we need to be able to have some compiler which can be compiled within the system. Question is, which compiler should it be? Today GCC is still a hot candidate -- it is probably the only compiler supporting all the CPU architectures and other features we need. Another selling point was it being written in C -- which it will now lose. In the future it would be necessary to implement or port the C++ standard library (and STL) to HelenOS in order to compile GCC in it.&lt;br /&gt;&lt;br /&gt;This makes GCC drop closer to Clang/LLVM on our suitability ladder. (Clang/LLVM is also written in C++). Practically the only remaining deficiency of Clang/LLVM w.r.t GCC is that unlike LLVM itself, which should have good support for several architectures, Clang currently only has good support for i386/x86_64. It should not be hard to improve Clang support for other targets, but still there must be sufficient demand to drive the development (Apple does not need it).&lt;br /&gt;&lt;br /&gt;Another player in the field is the Portable C Compiler. It is written in C, but it is a relatively small project and supports only a few CPU architectures. (Interestingly neither LLVM nor PCC support Intel Itanium architecture). I have some misgivings against depending on such project whose future is not very certain.&lt;br /&gt;&lt;br /&gt;In any case, the choice of a (first) C compiler to run in HelenOS remains open for now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-3760093486361142671?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/3760093486361142671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/06/gcc-plus-plus-or-not-plus-plus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/3760093486361142671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/3760093486361142671'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/06/gcc-plus-plus-or-not-plus-plus.html' title='GCC: plus plus or not plus plus?'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-2123926322628384054</id><published>2010-03-05T09:47:00.000+01:00</published><updated>2010-03-05T10:07:19.374+01:00</updated><title type='text'>Hash or dash?</title><content type='html'>I am pleased to say that SBI (Sysel Bootstrap Interpreter) is making good progress. You can already create object instances, play with the variadic built-in function Exec, raise and handle exceptions, etc.&lt;br /&gt;&lt;br /&gt;Now I know you might think I am just being silly, but I still haven't decided on how to write comments. Basically I am oscillating between &lt;span style="font-style:italic;"&gt;hash&lt;/span&gt; (as you saw in previous posts) and &lt;span style="font-style:italic;"&gt;dash&lt;/span&gt; (&lt;tt&gt;--&lt;/tt&gt;), i.e. double hyphen, for denoting comments.&lt;br /&gt;&lt;br /&gt;Hash is easier for me to type, because I can type hash with my left hand and use arrow keys with my right hand at the same time. For double hyphen I either need to use the little finger of my right hand, or lift the hand and move it towards the minus key.&lt;br /&gt;&lt;br /&gt;From aesthetic point of view... I just don't know. Most of the time I seem to prefer dash, although it clashes with the bullet point hyphens in the BSD license in the HelenOS format (but an alternative form could be used for that).&lt;br /&gt;&lt;br /&gt;What I am quite confident with is that the commonly used comments should be &lt;span style="font-style:italic;"&gt;single-line&lt;/span&gt; comments, where comments blocks would be created by typing in a series of single-line comments. Multi-line comments would only be used for disabling sections of code (typically for debugging purposes).&lt;br /&gt;&lt;br /&gt;Doc-blocks will be started by a special single-line comment (such as &lt;tt&gt;##&lt;/tt&gt; or &lt;tt&gt;---&lt;/tt&gt;) and continued by regular single-line comments (such as &lt;tt&gt;#&lt;/tt&gt; or &lt;tt&gt;--&lt;/tt&gt;).&lt;br /&gt;&lt;br /&gt;An interesting idea here pertains to the way of denoting the 'brief' part of the doc block. The common methods include: (1) up to the first period (&lt;tt&gt;.&lt;/tt&gt;), (2) the first paragraph, (3) the first paragraph if marked with some special tag (such as &lt;tt&gt;@brief&lt;/tt&gt;). Another way which came to my mind is that if the 'brief' part spanned more than one line, all these lines would use the same doc-comment mark. Example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;## First line of doc brief and&lt;br /&gt;## this is the second line.&lt;br /&gt;# &lt;br /&gt;# This is no longer part of&lt;br /&gt;# the brief.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;--- First line of doc brief and&lt;br /&gt;--- this is the second line.&lt;br /&gt;- &lt;br /&gt;- This is no longer part of&lt;br /&gt;- the brief.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do you like one of these comment styles better than the other? If so, why? Or would you recommend yet another one? Let's hear ye!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-2123926322628384054?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/2123926322628384054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/03/hash-or-dash.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/2123926322628384054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/2123926322628384054'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/03/hash-or-dash.html' title='Hash or dash?'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-61165031828536401</id><published>2010-02-23T21:39:00.000+01:00</published><updated>2010-02-23T21:50:58.542+01:00</updated><title type='text'>Watch out HelenOS, here comes Sysel!</title><content type='html'>It is alive! I had to put in some hacks to avoid name conflicts and I had to implement &lt;tt&gt;fgets()&lt;/tt&gt; in the HelenOS C library, but SBI now works in HelenOS. It's not really a big deal, as SBI still doesn't do so much, but it's still nice.&lt;br /&gt;&lt;br /&gt;If you're eager to try it, check out &lt;a href="https://code.launchpad.net/~jsvoboda/helenos/sysel"&gt;this Bazaar branch.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Build the system as usual and boot it. There are some &lt;i&gt;really&lt;/i&gt; trivial demos in the &lt;tt&gt;sysel/&lt;/tt&gt; directory. Just run SBI with the source file pathname as argument. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# sbi sysel/hello.sy&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Well... back to work!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-61165031828536401?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/61165031828536401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/watch-out-helenos-here-comes-sysel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/61165031828536401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/61165031828536401'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/watch-out-helenos-here-comes-sysel.html' title='Watch out HelenOS, here comes Sysel!'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-4871850943758646488</id><published>2010-02-22T22:49:00.000+01:00</published><updated>2010-02-22T23:16:46.820+01:00</updated><title type='text'>A Rodent is Born</title><content type='html'>I guess I cannot pretend it's a secret anymore. I am working on Sysel. What is sysel? Well, sysel is the Czech name for the &lt;a href="http://en.wikipedia.org/wiki/European_ground_squirrel"&gt;European ground squirrel&lt;/a&gt;, or, in layman's terms, the European gopher. &lt;br /&gt;&lt;br /&gt;Sysel with capital S is a programming language, however. From the previous posts you should already have some idea how Sysel should look like. Right now (in the 'first phase') I am developing Sysel Bootstrap Interpreter (or SBI for short). This is an interpreter of Sysel written in C.&lt;br /&gt;&lt;br /&gt;The main purpose of SBI is to bootstrap the prospective self-hosting Sysel compiler, as well as serving as a testbed and refining the language design. Nevertheless, SBI will run under both POSIX-based systems and, of course, &lt;a href="http://www.helenos.org/"&gt;HelenOS&lt;/a&gt;. SBI as well as other Sysel tools that I will produce will be available under the same BSD-like license that is used by HelenOS.&lt;br /&gt;&lt;br /&gt;Only real geeks develop alternative operating systems. Therefore, hopefully, by creating an alternative programming language to develop an alternative operating system in, I will be able to achieve whole new levels of geekiness.&lt;br /&gt;&lt;br /&gt;I have created a project on Launchpad where you can now &lt;a href="https://launchpad.net/sysel"&gt;track my progress&lt;/a&gt;. I will also publish a HelenOS+SBI branch when that's ready.&lt;br /&gt;&lt;br /&gt;Stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-4871850943758646488?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/4871850943758646488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/rodent-is-born.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/4871850943758646488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/4871850943758646488'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/rodent-is-born.html' title='A Rodent is Born'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-3860138606610663527</id><published>2010-02-14T12:05:00.000+01:00</published><updated>2010-02-14T12:21:12.385+01:00</updated><title type='text'>Inheritance Quiz</title><content type='html'>Now pay attention, class! Try to guess what does this fine C# program do?&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;using System;&lt;br /&gt;&lt;br /&gt;public class A {&lt;br /&gt;        public static void hello()&lt;br /&gt;        {&lt;br /&gt;                Console.WriteLine("Hello World!");&lt;br /&gt;        }&lt;br /&gt;        public class B : A {&lt;br /&gt;        }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Test {&lt;br /&gt;        public static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;                A.hello();&lt;br /&gt;                A.B.hello();&lt;br /&gt;                A.B.B.hello();&lt;br /&gt;                A.B.B.B.hello();&lt;br /&gt;                A.B.B.B.B.hello();&lt;br /&gt;        }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I'll give you a few options. This C# program, when compiled with GMCS will:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  (a) Compile without error and print "Hello World!" five times.&lt;/li&gt;&lt;br /&gt;  (b) Compile without error, but abort with a runtime error.&lt;/li&gt;&lt;br /&gt;  (c) Abort compilation because of the cyclic inheritance.&lt;/li&gt;&lt;br /&gt;  (d) Abort compilation because A.B is not defined.&lt;/li&gt;&lt;br /&gt;  (e) Abort compilation because A.B.B is not defined.&lt;/li&gt;&lt;br /&gt;  (f) Crash the compiler.&lt;/li&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;No cheating, please!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-3860138606610663527?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/3860138606610663527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/inheritance-quiz.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/3860138606610663527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/3860138606610663527'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/inheritance-quiz.html' title='Inheritance Quiz'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-354893027177960693</id><published>2010-02-03T21:44:00.000+01:00</published><updated>2010-04-21T11:17:54.314+02:00</updated><title type='text'>Syntax Silliness</title><content type='html'>I started to play around with the Mono C# compiler. Since all my previous experience with C# has been just passive (i.e. reading tutorials), I started with something very simple: a class implementing a generic doubly linked list. (It's completely brain dead, but should be sufficient for this example.)&lt;br /&gt;&lt;br /&gt;I thought it would be fun to convert it to an alternative syntax, so here it is. Note for example the syntax for type parameters. I also added some more specific ideas, like translatable strings with annotations, Python-like for loop, or the with-except-finally statement. The snippet is rather long, which is good, as it should deliver a more authentic experience. For the most part, this a transcription of real C# code, while some of it is completely constructed. If you don't know C# please be careful not to credit me with its inventions.&lt;br /&gt;&lt;br /&gt;What I like about this syntactic style is that it avoid C#'s sort of 'German' word order. Public static override void ... wait, where was I? Here, the name of the object being declared is reasonably close to the beginning (just the second word). Also the first word let's us know what kind of object we are dealing with (function, variable, class, etc.).&lt;br /&gt;&lt;br /&gt;My fingers didn't really object. Even though '&lt;tt&gt;end&lt;/tt&gt;' has three characters while '&lt;tt&gt;}&lt;/tt&gt;' has one, short keywords are actually easier to write than special symbols which require Shift to type. My eyes were O.K with it, too -- each declaration is visibly anchored and appears to be balanced. So I am reasonably happy with this creation.&lt;br /&gt;&lt;br /&gt;What about &lt;span style="font-style:italic;"&gt;you&lt;/span&gt;? Do you like it?&lt;br /&gt;&lt;br /&gt;&lt;pre style="line-height: 1.1em;"&gt;&lt;br /&gt;## Generic list type.&lt;br /&gt;#&lt;br /&gt;# Really just an example of program syntax style. This list can be&lt;br /&gt;# appended to or prepended. It implements an enumerator and an&lt;br /&gt;# indexer. Backwards or random-direction iteration is not possible.&lt;br /&gt;#&lt;br /&gt;# This class has one generic parameter (t), implements the&lt;br /&gt;# IEnumerable interface. t is subject to the constraint t : class&lt;br /&gt;# (t is a reference type) and the class MyList't is public.&lt;br /&gt;#&lt;br /&gt;# Note that this is meant only to demonstrate syntax style and&lt;br /&gt;# it's almost 1-1 translation of a C# program. (But some special&lt;br /&gt;# syntactic ideas are also demonstrated.&lt;br /&gt;#&lt;br /&gt;class MyList't : IEnumerable, where t : class, public is&lt;br /&gt;&lt;br /&gt;        class Node, protected is&lt;br /&gt;                var prev, next : Node, public;&lt;br /&gt;                var data : t, public;&lt;br /&gt;&lt;br /&gt;                constructor(new_data : t), public is&lt;br /&gt;                        data = new_data;&lt;br /&gt;                end&lt;br /&gt;&lt;br /&gt;                fun insertBetween(a, b : Node), public is&lt;br /&gt;                        prev = a; next = b;&lt;br /&gt;                        a.next = this; b.prev = this;&lt;br /&gt;                end&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        var head : Node, public;&lt;br /&gt;&lt;br /&gt;        constructor(), public is&lt;br /&gt;                head = new Node(null);&lt;br /&gt;                head.prev = head;&lt;br /&gt;                head.next = next;&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        fun append(data : t), public is&lt;br /&gt;                var e : Node;&lt;br /&gt;&lt;br /&gt;                e = new Node(data);&lt;br /&gt;                e.insertBetween(head.prev, head);&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        fun prepend(data: t), public is&lt;br /&gt;                var e : Node = new Node(data);&lt;br /&gt;                e.insertBetween(head, head.next);&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        fun printNodes(), public is&lt;br /&gt;                for data : t in this do&lt;br /&gt;                        Console.writeLine(data.toString());&lt;br /&gt;                end&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        fun getLength() : int, protected is&lt;br /&gt;                var len : int;&lt;br /&gt;&lt;br /&gt;                len = 0;&lt;br /&gt;                for data : t in this do&lt;br /&gt;                        len += 1;&lt;br /&gt;                end&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        ## Get the node at the specified index.&lt;br /&gt;        #&lt;br /&gt;        # @param pos    Index (0 = first, 1 = second, etc)&lt;br /&gt;        # @return       Node at the specified position.&lt;br /&gt;        #&lt;br /&gt;        fun getNodeAt(pos : int) : Node, protected is&lt;br /&gt;                var e : Node;&lt;br /&gt;                var i : int;&lt;br /&gt;&lt;br /&gt;                i = 0;&lt;br /&gt;                e = head.next;&lt;br /&gt;                while true do&lt;br /&gt;                        if e == head then&lt;br /&gt;                                raise new Exception();&lt;br /&gt;                        end&lt;br /&gt;                        if i == pos then&lt;br /&gt;                                break;&lt;br /&gt;                        end&lt;br /&gt;                        i += 1;&lt;br /&gt;                        e = e.next;&lt;br /&gt;                end&lt;br /&gt;&lt;br /&gt;                return e;&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        ## Number of nodes in the list.&lt;br /&gt;        #&lt;br /&gt;        # Property - looks like a member variable, but assigning&lt;br /&gt;        # to it or reading from it can have side effects.&lt;br /&gt;        #&lt;br /&gt;        prop length : int, public is&lt;br /&gt;                get is&lt;br /&gt;                        return getLength();&lt;br /&gt;                end&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        ## Indexer&lt;br /&gt;        #&lt;br /&gt;        # This a simpler variant of [] operator overloading. Here&lt;br /&gt;        # we can define the effects of reading from / writing to&lt;br /&gt;        # an object of this class with index (e.g. list[3]).&lt;br /&gt;        #&lt;br /&gt;        prop this[pos : int], public is&lt;br /&gt;                get is&lt;br /&gt;                        return getNodeAt(pos).data;&lt;br /&gt;                end&lt;br /&gt;                set is&lt;br /&gt;                        getNodeAt(pos).data = value;&lt;br /&gt;                end&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        fun toString() : string, public, override is&lt;br /&gt;                var s, sep : string;&lt;br /&gt;&lt;br /&gt;                s = ""; sep = "";&lt;br /&gt;                for data : t in this do&lt;br /&gt;                        s = s + sep + data.toString();&lt;br /&gt;                        sep = ",";&lt;br /&gt;                end&lt;br /&gt;&lt;br /&gt;                return "[" + s + "]";&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;        generator is&lt;br /&gt;                var e : Node;&lt;br /&gt;&lt;br /&gt;                e = head.next;&lt;br /&gt;                while e != head do&lt;br /&gt;                        yield e.data;&lt;br /&gt;                end&lt;br /&gt;        end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# An example how a variadic function might be declared (var&lt;br /&gt;# attribute). The + means that the argument must not be null.&lt;br /&gt;# The whole piece of code is disabled using a multi-line 'comment'&lt;br /&gt;# block. Only single-line comments are meant to be used for comments&lt;br /&gt;# per se, while multi-line blocks are meant for disabling sections&lt;br /&gt;# of code quickly.&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;#{&lt;br /&gt;class PrintFormatted, public is&lt;br /&gt;        fun format(fmt : +string; args : (+object)[], var) : string is&lt;br /&gt;                ...&lt;br /&gt;        end&lt;br /&gt;end&lt;br /&gt;#}&lt;br /&gt;&lt;br /&gt;class Test is&lt;br /&gt;        fun Main(args : string[]), public, static is&lt;br /&gt;                # Using a generic class&lt;br /&gt;                var list : MyList'string;&lt;br /&gt;&lt;br /&gt;                # Translatable string literal.&lt;br /&gt;                Console.writeLine("Hello World!"@);&lt;br /&gt;&lt;br /&gt;                # Translatable strings with annotations (these&lt;br /&gt;                # are used when have equal strings which are to&lt;br /&gt;                # be translated differently.&lt;br /&gt;                Console.writeLine("bug"@software);&lt;br /&gt;                Console.writeLine("bug"@insect);&lt;br /&gt;&lt;br /&gt;                list = new MyList'string();&lt;br /&gt;                list.append(1.toString());&lt;br /&gt;                list.append("hello"@greeting);&lt;br /&gt;&lt;br /&gt;                Console.writeLine("Objects in list:"@);&lt;br /&gt;&lt;br /&gt;                # It's really better always to iterate over some&lt;br /&gt;                # list. We don't need a C-style for(;;) so no need&lt;br /&gt;                # to call this foreach.&lt;br /&gt;                for o : string in list do&lt;br /&gt;                        Console.writeLine("Node " + o);&lt;br /&gt;                end&lt;br /&gt;&lt;br /&gt;                # Instead of for (i = 0; i &lt; 10; ++i)&lt;br /&gt;                for i : int in range(0, 9) do&lt;br /&gt;                        Console.writeLine(i);&lt;br /&gt;                end&lt;br /&gt;&lt;br /&gt;                #&lt;br /&gt;                # It would be possible to combine a context-&lt;br /&gt;                # management statement with a try block. So,&lt;br /&gt;                # try/except/finally can be thought of as a special&lt;br /&gt;                # case where we do not need to guard any resources&lt;br /&gt;                # with the 'with' statement.&lt;br /&gt;                #&lt;br /&gt;                with f : TextFile = TextFile.OpenFile("test.txt") do&lt;br /&gt;                        # If any exception happens here, f is cleaned up&lt;br /&gt;                        # gracefully via f.dispose() (or similar)&lt;br /&gt;                        var line : string = f.readLine();&lt;br /&gt;                        Console.writeLine(line);&lt;br /&gt;                except e : Exception do&lt;br /&gt;                        # And likely we also want to handle the exception&lt;br /&gt;                        Console.writeLine("Error reading file.");&lt;br /&gt;                finally&lt;br /&gt;                        Console.writeLine("Done");&lt;br /&gt;                end&lt;br /&gt;        end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-354893027177960693?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/354893027177960693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/syntax-silliness.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/354893027177960693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/354893027177960693'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/02/syntax-silliness.html' title='Syntax Silliness'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-8377992163083099071</id><published>2010-01-20T20:39:00.000+01:00</published><updated>2010-04-21T11:15:33.891+02:00</updated><title type='text'>Lua's syntax</title><content type='html'>In search of inspiration for language syntax style I remembered Lua. It takes the third major path apart from curly braces (C) and off-side rule (Python). It is thus reminiscent of the Algol family, especially Ada, UNIX shell syntax or Karel (at least some incarnations thereof).&lt;br /&gt;&lt;br /&gt;Lua is (mostly) free-form and uses what I call in my head (inappropriately, perhaps) &lt;span style="font-style:italic;"&gt;implicit block delimiters.&lt;/span&gt; Where a declaration of some program element in C might look like&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;declaration {&lt;br /&gt;        element;&lt;br /&gt;        element;&lt;br /&gt;        ...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;in Lua it is instead&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;declaration&lt;br /&gt;        element;&lt;br /&gt;        element;&lt;br /&gt;        ...&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;What I like about the latter case is that programmer is freed of the choice whether or not to use curly braces to delimit a single statement in control flow expressions such as &lt;tt&gt;if&lt;/tt&gt;, &lt;tt&gt;for&lt;/tt&gt;, &lt;tt&gt;while&lt;/tt&gt;. Still, the language remains free-form and the code looks visually balanced to my eyes. For some reason I feel the cosmic balance disturbed if the beginning end end statement are not both marked, with the same indentation. In Python the blocks feel&amp;ndash; incomplete&amp;ndash; without the final delimiter. Of course, which style has better signal-to-noise ratio, can be disputed.&lt;br /&gt;&lt;br /&gt;Here, Lua is somewhat more concise than Ada or Fortran where we annotate what kind of block we are ending (e.g. &lt;tt&gt;if ... then ... else ... end if&lt;/tt&gt;) in hope of helping the programmer match the delimiters more easily (and to help the compiler spot bracketing errors).&lt;br /&gt;&lt;br /&gt;One design element of Lua syntax that I don't really like is the freedom to or not to terminate any statement with a semicolon. Instead a statement can be terminated with a newline. On one hand this allows us to avoid using punctuation unless necessary, on the other hand the language is not fully free-form. Quoting from the reference manual, the code&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;a = f&lt;br /&gt;(g).x(a)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;would be mistaken for two statements. Gorgeous ^_^.&lt;br /&gt;&lt;br /&gt;In Ada all statements (and other program elements) are terminated with a semicolon. The Prosody IM software written in Lua seems to have adopted a coding style where every simple statement is terminated with a semicolon, while any compound statement or element ending with the &lt;tt&gt;end&lt;/tt&gt; keyword is not.&lt;br /&gt;&lt;br /&gt;Conclusion: While Lua syntax style need not be perfect, it demonstrates that even this syntactic style does not have to be excessively verbose. I like it enough to consider its style as a primary source of inspiration.&lt;br /&gt;&lt;br /&gt;Note: When will I actually post anything related to HelenOS?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-8377992163083099071?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/8377992163083099071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/luas-syntax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/8377992163083099071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/8377992163083099071'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/luas-syntax.html' title='Lua&apos;s syntax'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-2058843239638313753</id><published>2010-01-04T21:48:00.000+01:00</published><updated>2010-04-21T11:14:04.098+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='raving'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>The woes of C II: Attack of the Teenade Mutant Cabbage</title><content type='html'>Anyway, I can hardly imagine a supercalifragilisticexpialidocious operating system such as HelenOS can be 0.70710678118654757 as supercalifragilisticexpialidocious if it is written in C. Rather than using an existing programming language which is not s32s enough, I'd much rather design my own programming language.&lt;br /&gt;&lt;br /&gt;There are two cons: (1) bigger adoption barrier, (2) designing a language and writing the compiler is not a small job. (As a starting point for an estimate, the C compiler I wrote a few years ago while I was still at Uni took me (very roughly) 300 hours before it could compile itself. In this case I would have to design the language and write &lt;span style="font-style:italic;"&gt;two&lt;/span&gt; compilers. The first compiler (or interpreter) would have to be written in an existing language to bootstrap the new language and the other one a native compiler (i.e. written in the language itself).&lt;br /&gt;&lt;br /&gt;I have some idea of the main semantic features the language should have. The most important difference from C#, the basic integer type should allow for arbitrary-size numbers, as in Python. That's one important step Microsoft did not take.&lt;br /&gt;&lt;br /&gt;I am still looking for a good inspiration for the syntax though. I'd rather not go into curly braces. I like a lot of ideas from Python's syntax a lot. However, in a statically typed language the lines can get longer and this might not work as well. I also consider taking inspiration from functional languages such as Haskell for function-call syntax (i.e. 'f x y' instead of 'f(x, y)') although this might not work well with passing keyword arguments (passing arguments with names explicitly specified).&lt;br /&gt;&lt;br /&gt;In case you are wondering, yes, I already have designed a completely useless programming language (and wrote a compiler for it) and not published it. So I definitely do know I am perfectly capable of just that. Again.&lt;br /&gt;&lt;br /&gt;There you have it, I spent the whole evening babbling. However, if the sum of time other people spend reading these posts exceeds the time I spend writing them, then &lt;span style="font-style:italic;"&gt;vengeance&lt;/span&gt; will be mine! Maybe next time I will cover some less revolutionary, boring and virtual topic. Or not.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-2058843239638313753?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/2058843239638313753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/woes-of-c-ii-attack-of-teenade-mutant.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/2058843239638313753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/2058843239638313753'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/woes-of-c-ii-attack-of-teenade-mutant.html' title='The woes of C II: Attack of the Teenade Mutant Cabbage'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-5537793662171336713</id><published>2010-01-04T20:56:00.000+01:00</published><updated>2010-04-21T11:11:58.860+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='helenos'/><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>The woes of C</title><content type='html'>If I wanted to make this article look interesting, I would title it &lt;span style="font-style:italic;"&gt;C considered harmful&lt;/span&gt;, but I will not. HelenOS is written in C. C is a programming language created at the beginning of 1970's. It's creation is closely tied with the birth of UNIX. At the time of its creation, C was a simple and yet extremely powerful programming language.&lt;br /&gt;&lt;br /&gt;C maps (or can map) rather closely to the hardware. Originally it required no or very little run-time support. (What this means: a piece of code using only the core language -- not library routines -- can be compiled directly to machine code and does not require additional libraries or other support to execute).&lt;br /&gt;&lt;br /&gt;For quite some time C has been showing its age. Both the core language and the standard library are becoming more and more inadequate for implementation of applications.&lt;br /&gt;&lt;br /&gt;Working with strings has always been an extreme pain in C, but with multi-byte encoding (i.e. UCS/Unicode) it has become a nightmare. In HelenOS we decided to drop the standard C99 way of handling multi-byte strings altogether and implement our own. Needles to say, it's only a little better, the language won't allow us more. I  demand automatic memory management! I demand user-defined operators!&lt;br /&gt;&lt;br /&gt;String formatting in C is a chapter on its own. While this could be re-implemented in the standard library to be extensible (i.e. allow the consumer to register a formatting function for their custom type) we cannot really do away with the need to provide the type of argument in the formatting string, at least not in a sensible way. I demand virtual methods!&lt;br /&gt;&lt;br /&gt;What usually drives me mad is the complexity involved in using a hash table in HelenOS. I need to implement several callbacks just to get my int-&gt;pointer map. I want generics! I demand collections!&lt;br /&gt;&lt;br /&gt;There is a plan to implement a graphical user interface for HelenOS. Having to implement it in C is just giving me the Willies. We would probably end up with some monstrosity like GTK... or worse. I demand inheritance!&lt;br /&gt;&lt;br /&gt;I demand a language worthy of the 21st century!&lt;br /&gt;&lt;br /&gt;... to be continued.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-5537793662171336713?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/5537793662171336713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/woes-of-c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5537793662171336713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/5537793662171336713'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/woes-of-c.html' title='The woes of C'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-192079351385094431.post-3901367630648779177</id><published>2010-01-04T20:28:00.000+01:00</published><updated>2010-01-04T20:54:58.848+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='helenos'/><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><category scheme='http://www.blogger.com/atom/ns#' term='intro'/><title type='text'>What this blog is about</title><content type='html'>Now wait a minute... this blog has existed for a few months already, but the first post is dated today?! That can mean only two things: either (a) I am the laziest person in the solar system or (b) I prefer coding to writing about coding.&lt;br /&gt;&lt;br /&gt;This blog shall deal mostly with my contributions and ideas for HelenOS. If you don't know what &lt;a href="http://en.wikipedia.org/wiki/HelenOS"&gt;HelenOS&lt;/a&gt; is by the time you've finished reading this sentence, then you obviously have not followed the hyperlink embedded within it. Redo from start. Now you know HelenOS is a supercalifragilisticexpialidocious operating system.&lt;br /&gt;&lt;br /&gt;This information is mostly targeted at fellow HelenOS developers and enthusiasts so I will probably not bother to explain all background for the average passer-by most of the time.&lt;br /&gt;&lt;br /&gt;I might also blog here about other geeky stuff not related or vaguely related to HelenOS. That is, if I manage to blog at all. Because of (a) or (b).&lt;br /&gt;&lt;br /&gt;Hey Jakub, I blogged! &lt;a href="http://jakubsuniversalblog.blogspot.com/"&gt;Jakub&lt;/a&gt;'s been persuading me to blog about HelenOS for some time. So there. I've blogged. Blogo ergo sum. Although I don't have a MySpace account. So I don't exist. And I don't have FaceBook account nor a Twitter account nor a Peprnet acount and omega other accounts. So the cardinality of my non-existence set is omega. Doh.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/192079351385094431-3901367630648779177?l=jiri-svoboda.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jiri-svoboda.blogspot.com/feeds/3901367630648779177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/what-this-blog-is-about.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/3901367630648779177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/192079351385094431/posts/default/3901367630648779177'/><link rel='alternate' type='text/html' href='http://jiri-svoboda.blogspot.com/2010/01/what-this-blog-is-about.html' title='What this blog is about'/><author><name>Jiří Svoboda</name><uri>http://www.blogger.com/profile/09911075768532401265</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
