Is it possible to implement a small Disk OS in C or C++? -


i not trying such thing, wondering out of curiosity whether 1 implement "entire os" (not big linux or microsoft windows, more small dos-like operating system) in c and/or c++ using no or little assembly.

by implementing os , mean making os scratch starting boot-loader , kernel graphics drivers (and optionally gui) in c or c++. have seen few low-level things done in c++ accessing low-level features through compiler. can done entire os?

i not asking whether idea, asking whether remotely possible?

obligatory link osdev wiki, describes of steps needed create os described on x86/x64.

to answer question, gonna extremely difficult/unpleasant create boot loader , start protected mode without resorting @ least assembly, though can kept minimum (especially if you're not counting stuff using __asm__ ( "lidt %0\n" : : "m" (*idt) ); 'assembly').

a big hurdle (again on x86) processor starts in 16-bit real mode, need 16-bit code. according this discussion can have gcc generate 16-bit code, still need way setup memory, load code storage media , on, of requires interfacing hardware in ways standard c has no concept of (interrupts, io ports etc.).

for architectures communicate hardware solely through memory mapped io away writing except c start-up code (that sets stack, initializes variables , on) in pure c, though specific requirements of interrupt routines / exception or syscall gates etc. may difficult impossible implement (as have access special cpu registers).


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -