I'm trying to enter the pmode..
But I have question..
I have well coded OS code from internet..
Usually I copy almost of them..
But code is the same but the output is quite different..
I don't know Y..
one asm file and one c file are compiled and assembled..
and then they are linked...
Usually in the output exe..
the real code (except PE head and etc) starts at 0x1000
(I checked all other exe files..)
But mine starts at 0x200 ..
I tried to change linker option.. But It doesn't work..
How can I make my output file's real code starts at 0x1000
Very easy question
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Very easy question
without your linker script, flags, options etc. it's quite hard for us to tell.
When you say "it starts at 0x200", are you speaking about the offset within the file or the target virtual address ?
Could it be that you're missing some alignment command ?
When you say "it starts at 0x200", are you speaking about the offset within the file or the target virtual address ?
Could it be that you're missing some alignment command ?
Re:Very easy question
Sorry for incomplete info..
I'll change my question..
Here is my source code
I compiled like this
and then I linked
What I've discovered in src.exe is that code section start at 0x200 and data section start at 0x400
What I want is code section starts at 0x1000 and data section starts at 0x2000
How can I do that?
The reason why I want that is 'dw msg' is assembled 0x00402000 and 'dw start' is assembled 0x00401008.
in my boot loader that src.exe will be loaded in 0x10000.
I'll jump to 0x11000 where code section start...
But the problem was in src.exe code section starts at 0x200
Can someone help me?
I'll change my question..
Here is my source code
Code: Select all
.386
.model flat,stdcall
.data
msg db "Here is data section"
.code
start:
dw msg
dw next
next:
end start
I compiled like this
Code: Select all
ml /c /coff src.asm
and then I linked
Code: Select all
link /subsystem:consol src.obj
What I've discovered in src.exe is that code section start at 0x200 and data section start at 0x400
What I want is code section starts at 0x1000 and data section starts at 0x2000
How can I do that?
The reason why I want that is 'dw msg' is assembled 0x00402000 and 'dw start' is assembled 0x00401008.
in my boot loader that src.exe will be loaded in 0x10000.
I'll jump to 0x11000 where code section start...
But the problem was in src.exe code section starts at 0x200
Can someone help me?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Very easy question
i virtually know nothing of the "ml" and "link" tools you use, and i don't know if they fit bootloader programming. All i could offer is the "BareBones" section of http://www.osdev.org/osfaq2/ which should show you how to use gnu tools instead to produce a bootable file ...
Re:Very easy question
all right..
I'd better off writing "os kernel loader" rather than linking
kernel loader with kernel..
Thanks anyway..
I'd better off writing "os kernel loader" rather than linking
kernel loader with kernel..
Thanks anyway..