Not possible with vanilla C. It has to be done with assembler. C, especially of the ANSI variety knows jack about hardware, because that violates the 'platform independence' of ansi C.
I hate to think of what C would do if used for state saving and restoration. hehe. strange concept really.
Gotta say it. ANSI C is platform independent, fast and good at what it does. Java is none of those. Sorry, I just _really_ hate java. It was a good idea (I guess) that went badly astray.
I find contiki inspiring. To my eyes anyway, it is more capable byte for byte than GEOS, which was painfully optimised assembler. Mind you, geowrite still impresses me.
More OSes should be like it.
I get upset that any OS needs more than 1mb RAM. It shouldn't!...unless it does a lot of things like unix/linux which does pretty well at keeping its RAM footprint down.
And windows shouldn't need more than 640k RAM, because nothing should ever need more than that, eh, Mr. Gates?