Linked by Hadrien Grasland on Fri 28th Jan 2011 20:37 UTC
OSNews, Generic OSes It's recently been a year since I started working on my pet OS project, and I often end up looking backwards at what I have done, wondering what made things difficult in the beginning. One of my conclusions is that while there's a lot of documentation on OS development from a technical point of view, more should be written about the project management aspect of it. Namely, how to go from a blurry "I want to code an OS" vision to either a precise vision of what you want to achieve, or the decision to stop following this path before you hit a wall. This article series aims at putting those interested in hobby OS development on the right track, while keeping this aspect of things in mind.
Thread beginning with comment 460186
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[4]: Machine language or C
by Neolander on Sat 29th Jan 2011 19:58 UTC in reply to "RE[3]: Machine language or C"
Neolander
Member since:
2010-03-08

Not necessarily. You can create wrappers in order to use the arch-specific assembly functions you need in your language of choice, and keep all the logic written in this language.

As an example, if I need to output bytes on one of the ports of my x86 CPU, all I have to do is to create a "C version" of the OUTB assembly instruction, using macros and inline assembly, and after that I can use it in the middle of my C code at native speed.

With GCC's inline assembly, it'd look something like this :
"#define outb(value, port) \
__asm__ volatile ( \
"outb %b0,%w1" \
::"a" (value),"Nd" (port) \
)"

Yes, it's ugly, but you only have to do it once.

Edited 2011-01-29 20:09 UTC

Reply Parent Score: 1