Page 2 of 3

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 5:19 pm
by Candy
kataklinger wrote: I have no problems with that, and if I did I couldn't see solution? GCC? Nop, I don't think so. Reivent the world? ;) That would be great, but what are the chances?
And I changed my compiler (for OS development) two times DJGPP->MSVC++->Intel C++, and without major problems (maybe I lost few hours, but thats ok).
My point of vendor-lock-in was more about the .NET implicitness of people starting to use it. Nearly every aspect of .NET is lost when you stop using .NET. When you switch from STL to anything with it you can still use it.

I'm 100% pro fully reinventing the world. Busy with OS and compiler, starting work on a processor (just finishing up on the 1st tryout of the TLB). Call me nuts, wouldn't be the first and definately not the last.

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 5:23 pm
by Kemp
As for .NET (in the form of C# specifically), I've decided to hate it on the basis that it is essentially Microsoft Java and Java is bad enough as it is (not to start a flamewar, that's just the opinion among the people I know irl). I don't want or need an extra level of abstraction for the things I do.

In other news, one of my courseworks right now is related to designing processor micro-code :)

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 5:51 pm
by kataklinger
Good luck Candy :) I hope you'll supply us (os developers at this forum) with your CPU so we can write OSes for it. :D


And .NET is not so bad(or Java). I don't want to think about MM, pointers, stack... if I'm working on some business application or something like that. But if you are closer to the system, you should use c/c++ or something like that.

Use tools that can help you to solve problem easier not to make you life harder.

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 6:03 pm
by Kevin McGuire
The EXPRESS version has all the optimizations enabled, so get locked in with Microsoft - LOL. I am still waiting for someone to tell me:

1. They have tried the framework.
2. It helped them. (Learn/Explore/Fun)
3. It did not work. (Download/Compile/BOCHS)
4. It was too complex to use.

I can understand the purpose of wanting to write your own OS from scratch, but I would just like to help anyone who is having alot of problems have a way to ignore the boot loader, path problems, emulator problems, and have a way to jump right into playing with:

1. paging
2. interrupts
3. devices
4. tasks

This archive contains no more than needed to load the kernel in memory and jump into it. The only code in the kernel is what is required to relocate the it-self in memory. I don't want anyone thinking this is a kernel already written. Its just a framework.

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 6:11 pm
by kataklinger
Sorry, because I went offtopic.
I haven't tried it(and i'm can't access your webpage http://mcguire.sytes.net:8080/ or is it my bad internet connection >:( ), but I think it' a good idea.

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 6:41 pm
by Kevin McGuire
It was not working. I restarted it. Thats what I get for mixing apache and windows in a console window.

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 7:21 pm
by kataklinger
Now it works.

1. You should add _purecall function & _set_purecall_handler in order to be able to use pure virtual functions

2. It seems that you have no support for calling global objects constructors

3. also no support for new/delete operators

4. RTTI and exception handling would be great to see, if you do this, please let me know ;)

I has VS2003 (I haven't installed 2005 on this comuter yet) so I couldn't load the solution, so how do you build project as EXE or DLL and what optimization options do you use

Re:MSVC Kernel Framework

Posted: Mon Jan 02, 2006 8:45 pm
by Kevin McGuire
Thanks, I need to fix that notion since it was originaly meant to be only C. I do not plan to add C++ language extensions. I am not saying there are of no use to a kernel, but I am glad you noticed that it does look like you can stick in C++ code. For someone beginning they might get caught up on that.

Linker:
I use /FIXED:NO to generate a relocation section.
I also ignore the import library. I ignore libc.lib
It generates a DLL with no debugging w/ subsystem console.
Compiler:
I original wrote it using a single-thread dll option, although VS2005 changed it and it works fine with the multi-thread option. I would have named the files C instead of CPP, and set the compiler to compile for C code, but I thought I would just leave it with capabilities for C++ extensions.

I use the post-build event to execute the final batch cmds:
pe2hod.exe .\debug\2ndstage.dll 2ndstage.hod
cbmdf.exe /OUT:floppy.img /SDBA:hodboot.bin /KIBS:2ndstage.hod

Then:
bochs.exe -f mykernel.cfg -q

I normal use no optimization so I can use bochsdbg.exe, but I have tried using it and everything worked great.. and faster, or it halfed the file size when set to optimize for smaller code.

See, Im glad someone tested it out. I need to put a notice in the archive somehow that there is no support for C++ extensions. Thanks, kataklinger. ;)

Re:MSVC Kernel Framework

Posted: Tue Jan 03, 2006 6:56 am
by kataklinger
Linker:
I use /FIXED:NO to generate a relocation section.
I also ignore the import library. I ignore libc.lib
It generates a DLL with no debugging w/ subsystem console.
...
I use the post-build event to execute the final batch cmds:
pe2hod.exe .\debug\2ndstage.dll 2ndstage.hod
cbmdf.exe /OUT:floppy.img /SDBA:hodboot.bin /KIBS:2ndstage.hod
Well, I do it the other way around. I link kernel & 2nd stage bootloader as EXE (altought I'm planning to link kernel as DLL to make import/export thing for drivers and moduls easier) and not converting it to bin. Instead, I set section aligment in memory equal to aligment in file (=512 bytes) and the only thing you have to do is to find entery point, and that isn't so hard (few instruction would do the job).
I normal use no optimization so I can use bochsdbg.exe, but I have tried using it and everything worked great.. and faster, or it halfed the file size when set to optimize for smaller code.
What do you meen by this? Why can't you run optimized version in bochsdbg? If you change from Debug to Release version you may encouner some problems even in Windows applications, and needless to say what could happen in system development.

Re:MSVC Kernel Framework

Posted: Tue Jan 03, 2006 8:46 am
by Kemp
And .NET is not so bad(or Java). I don't want to think about MM, pointers, stack... if I'm working on some business application or something like that. But if you are closer to the system, you should use c/c++ or something like that.
:) My thoughts exactly. Every language has something it's good for and something it's no good for. My needs fall more with C++, your average business needs will fall more towards a language that is more abstracted from what's going on under the hood. Prototyping will be more VB's area and fast windowed app development (for me at least) is a job for Delphi. That's what I use them for anyway...

Re:MSVC Kernel Framework

Posted: Tue Jan 03, 2006 10:00 am
by Kevin McGuire
@kataklinger:
Using optimizations works great! :D
Well, I do it the other way around. I link kernel & 2nd stage bootloader as EXE (altought I'm planning to link kernel as DLL to make import/export thing for drivers and moduls easier) and not converting it to bin. Instead, I set section aligment in memory equal to aligment in file (=512 bytes) and the only thing you have to do is to find entery point, and that isn't so hard (few instruction would do the job).
I was thinking just then, why in the world did I write a new format a while back. I remember now, it was because I wanted something light-weight and small. I think I may be making more trouble for myself converting, instead I could and may use a PE32 format for the rest of the system since it requires no conversion. I am going to stick with the hod format for the kernel and may remove the functions for exports and such just so the kernel is very small. It really doesn't need a TEXT section or such to store static data.

How do you set section alignment in file, and you are right mabye since the kernel is going to be loaded to a static address every time?

Thanks, kataklinger. I really do love discussing my ideas and projects. I am so happy you replied! :D

Re:MSVC Kernel Framework

Posted: Tue Jan 03, 2006 10:15 am
by kataklinger
How do you set section alignment in file, and you are right mabye since the kernel is going to be loaded to a static address every time?
I think it isn't possibile to set file aligment but you can change memory aligment. You get same resault but smaller file on disk ;) (file aligment = 512 bytes and memory aligment = 4096 bytes). To change it add /ALIGN:0x200 option to Linker -> Command Line -> Additional options.

Re:MSVC Kernel Framework

Posted: Tue Jan 03, 2006 10:42 am
by Kevin McGuire
YES, I see! :D Thank You.

Re:MSVC Kernel Framework

Posted: Wed Jan 04, 2006 8:21 am
by Kevin McGuire
I'm becoming a GRUB supporter, I'm tired of this darn buggy boot loader crap!!! ROFL
I am going to write a small OS when I'm 90 years old going in this direction.

Once the kernel becomes around 4-5kb in size it starts to foobar, I'll reupload the msvcoek.zip when I get GRUB working!

Microsoft Visual C++ Express 32BIT Kernel Framework

Posted: Wed Jan 04, 2006 11:47 pm
by Kevin McGuire
I have done a complete revision to the framework.

It is now the:
Microsoft Visual C++ Express 32BIT Kernel Framework

I only have express installed. You can still use earlier versions however, you will need to download the options.txt and setup the solution and project by hand.


The kernel is now Multi-Boot Compliant, and can be loaded by GRUB.
It no longer needs ANY other programs to help format the kernel.
It uses a stub with source code in the archive to perform any boot initialization that GRUB can not perform.
It supports static and global varibles. (For Once I can use strings!)
It includes a Virtual Floppy driver for WinNT(XP/2K).
It includes BOCHS, preconfigured to use drive A: for boot.
It include nasm, presetup to compile the stub code.
It includes Solar's grub_disk.img.
It has not been thoughly tested, but any bugs have to be minor. (It comes with all the source.)
It uses John Fine's gdt.inc code.


http://my.execpc.com/~geezer/os/
http://www.mega-tokyo.com/forum/index.p ... 0#msg75930

So the bottom line is, this archive, now contains the real deal for writting a kernel with MSVC++. No tricks. Done the right way. :D

I don't care if you make money from it!

(Be patient this link will work. Sometimes it does go down.)
http://mcguire.sytes.net:8080/

I hope I got everything. ;D