Thursday 19 April 2012

Printf flavours


I’ve been working on several things in the kernel lately. Among them are the slab allocator and the different flavours of the printf function (some of them).
I’ve now finished work (mostly) on these printf functions and I’m happy to present:
  1. sprintf,
  2. vsprintf,
  3. fprintf and
  4. vfprintf.
These functions have better formatting support than the current printf function. So in order to use these new formatting features one will have to make a string, format it using sprintf and then print it using printf.
As soon as we have a better self cleaning buffer in the kernel, we’ll implement it in the vga-text driver and make a new printf function that uses fprintf to write to stdout (which is connected to the driver).
Also work on the slab allocator is progressing, albeit slowly. There’s a lot of thinking involved in building a slab allocator, and I’m hoping to do it well the first time. This means there’s even more thinking involved.
Also this slab allocator will have to be used for page allocation, which makes the slab allocator come with a couple of restrictions (we can’t just assume we’ve got space everywhere outside of the text segment and annoying details like that). So for now we’re still using the slob (single list of blocks) allocator to do all the memory allocation for us, but we’re looking forward to a functional slab allocator (probably done in a couple of weeks).
That’s it for now!

No comments:

Post a Comment