Saturday, October 01, 2005

Writing multiboot PE kernels using Visual C++


Sriram said...

Awesome post!

mduft said...

very, very kewl post!

However i can only display 15 characters with that code, and i cannot find anthing wrong with it.... ???

Do you know a solution to this?

Regards, Markus

TKF15H said...

Yeah, something is wrong, you can only have 16bytes worth of strings (15 without the null terminator).

Another thing:
push eax
push ebx
Should be:
push ebx
push eax

Marc said...

the 16 char limit is due to the
size given for data:

dd(0x0010200F) ; load_end_addr
dd(0x0010200F) ; bss_end_addr

I changed the 0x0010200F to 0x001020FF and I could embed more string data..
but where are the exact limits?

(It's a bit late but I just recently discovered this post :) )

Andrey said...

How can we implement object-oriented structure to this kernel?

Vahid said...

thanks for your nice post
but, i have a little problem!
is it possible to compile this code on VS 2008 using Intel C++ Compiler 10?!
it shows me this error: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

Kiechii said...

hmmz Vahid i think you are making a Windows Application. When you create a new application create an empty Windows Console Applications..
although i think since these files would contain the exe header we will need to take out the first 512 bytes! i could be wrong though i a fairly new myself

CybX said...

Hi, C++ 2008 just compiles text into ASM, and the ASM assembles into machine code symbols.
Now, C++ 2008 has several templates, some of which are purely naked of local variables, and to make a fully native executable, you need to strip the application of all .NET and Win32, etc libraries, and create these libraries yourself, or compact them using the .NET embedder (purchase needed). The Console Application of Win32 is the best you can use I think, so use this as your template. Add a seperate build step to cut the first 512 bytes of header off the front (memory protection and the type of executable property for Windows to read), seen as this is only needed by Windows, and you'd need Windows to call the 513th symbol, then you just remove the 512 symbols (bytes) from the front of the executable and you'll have a naked, native executable that is bootable as BIF or IMG file. You'll need to rename this file to BIF in PowerISO, and add it to a disc image (ISO), you can then mount this into a virtual machine and load your new OS/Kernel.
Using commands you then take control of all devices in the virtual machine, even create a boot image on a hard drive.
But to beginners, I advise you to just play with booting and take a course at university or college in ASM languages. Try 32/64-bit compilations from the actual compiler. 32/64-bit ASM/C++ knowledge is highly needed.

I have: Bsc Computer Science, study in kernel architecture with VC++ 2003.NET. 2008 is a better version though, just customsie your build to how you like. Don't be frightened of C++ and ASM, they're just bytes, bytes don't bite!

Thanks, EasyTec (aka CybX).

CybX said...

Could you post your project file, Kaushik.
I'm a little concerned as to what you've do in source code, I've tried it and it doesn't function very well in Microsoft Virtual PC 2007

cybx said...

Ok, may be we are all wasting time here.
I have been programming for a while, made my own stand-alone boot kernel, with Linux style movable windows.
I'd like to teach others about OS Development, it is a struggle to learn. But all you need to do is learn ASM and something like C++, I like PE because its native to the windows environment and it is designed to make powerful operating systems.
Of course patience is the key.
I'm starting a tutorial site, here:
Please say hello, even if you don't have a commitment to join.

Anonymous said...

welcome to the wow power leveling, cheap service site, buy cheap wow gold,wow gold,world of warcraft power leveling buy wow power leveling

Interrupt said...

I have found more infos here

Jack said...

I'm new to OS Development (started just under a week ago). I do have experience with C++ though (roughly three years).

With the IDE, I've chosen an empty Windows Console Application with no Precompiled Header.

With the linker script, do I replace the 'kernel.c' with my actual source file?