Visual Studio for OS Developement

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
karloathian
Posts: 22
Joined: Fri Mar 28, 2008 12:09 am

Visual Studio for OS Developement

Post by karloathian »

So I've begun working on my own Hobby OS a few months ago, and for the kick of it ( because kernel development isn't hard enough :roll: ) I wanted to modify my kernel to be GRUB compliant and the PE format spewed out by Visual Studio.

I've pretty much been able to port most of my basic code from the GCC version to a MSVC version , along with using NASM instead of MASM. Anyway I'll get to the core of the question, I've been using this tutorial on creating a multiboot compliant PE, but the problem lies in the fact that GRUB needs to know where my code ends , where my .text section is , etc. The tutorial worked for a while , but at some my point .text grew larger and the physical addresses changed.

So my real question would be , is there a way like with LD to tell the linker to input the physical addresses of the .text sections .data and .code ?

ps. sorry for the long rant[/url]
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

You might want to take a look at the JLOC linker. You say you are using NASM now? I am using JLOC with NASM, and it gives you the complete ability to set all addresses and locations for every code/data segment. Setting up the control script is a bit iffy, but you only have to do it once.
You can find jloc on osdever.net
User avatar
binutils
Member
Member
Posts: 214
Joined: Thu Apr 05, 2007 6:07 am

Post by binutils »

i have never heard of anything which open source works fine with MS product, even if cygwin or mingw even though their great efforts.

better off to try pure open-source or MS-pro product(just like singularity, cosmos etc)
User avatar
karloathian
Posts: 22
Joined: Fri Mar 28, 2008 12:09 am

Post by karloathian »

bewing wrote:You might want to take a look at the JLOC linker. You say you are using NASM now? I am using JLOC with NASM, and it gives you the complete ability to set all addresses and locations for every code/data segment. Setting up the control script is a bit iffy, but you only have to do it once.
You can find jloc on osdever.net
Thanx , I'll definitly have a look into it

EDIT: Finally I was able to modify my code and make it so that GRUB would directly understand the PE format. I must really like torturing myself to be doing this.
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Re: Visual Studio for OS Developement

Post by trolly »

hi

here is a sample code for a multiboot kernel writen in visual c

in the code, the .text and .section is defined at 0x0

the .text in the header should correspond to the image size, i use also a utility (include in the zip file) to fix this value

kernel source
http://7a1pjw.bay.livefilestore.com/y1p ... p?download

multiboot header fixer code and binary
http://7a1pjw.bay.livefilestore.com/y1p ... p?download
User avatar
cr2
Member
Member
Posts: 162
Joined: Fri Jun 27, 2008 8:05 pm
Location: ND, USA

Re: Visual Studio for OS Developement

Post by cr2 »

The BrokenThorn Entertainment tutorials contains information writing a PE kernel with MSVC++.
OS-LUX V0.0
Working on...
Memory management: the Pool
PatrickV
Member
Member
Posts: 151
Joined: Sun Jul 06, 2008 7:50 pm
Location: New Zealand
Contact:

Re: Visual Studio for OS Developement

Post by PatrickV »

I use Visual Studio all the time when i create my os. But i don't do it in c. The Program can open up .asm file which when i comple things with nasm and error found . It is much easeir to use visual studio than text edit or otherwise i'll be counting lines all day :P :) anyway, nasm does not respond to end code sections far to my knowledge
tadada
Member
Member
Posts: 42
Joined: Sun Apr 20, 2008 5:32 pm
Location: Index 0 of the nearest Array

Re: Visual Studio for OS Developement

Post by tadada »

I use notepad++. just a text editor with syntax highlighting and it numbers the lines. (the main reason I got it. I once resorted to number every 25 lines... it didn't work out too well.) The syntax highlighting and the line numbering is a godsend and it is small and fast. Plus I don't have to work with a MS product (except for windows itself, while I do have a linux box I find programming my OS eaisier on windows :? .) Its pretty good. On wikipedia there is a page about text editors with links to a lot. Thats where I found notepad++. Theres other programs too though.
My OS: SOS (Simple Operating System).
User avatar
Adek336
Member
Member
Posts: 129
Joined: Thu May 12, 2005 11:00 pm
Location: Kabaty, Warszawa
Contact:

Re: Visual Studio for OS Developement

Post by Adek336 »

Post Reply