Bona Fide OS Development
http://forums.osdever.net/

How do i get my kernel to load binary programs?
http://forums.osdever.net/viewtopic.php?f=6&t=36
Page 4 of 7

Author:  smeezekitty [ Wed Oct 07, 2009 1:21 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

call _main wastes stack space and is unneccary for the first call

Author:  DudeOfX [ Wed Oct 07, 2009 3:02 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

well... it works... this is exactly what I needed...

anywho, I traced it and I am telling you man I think you need to issue a CALL instead of a JMP cause main() is behaving like a standard function, it issues a corresponding RETF at the end!!! BUT I suppose there is an infinite loop inside main() so there is no worries... BUT BUT there needs to be a CLI and STI when setting up a stack and I changed the model from tiny to large on the assembly stub...

playing with the DGROUP stuff at this time

Author:  smeezekitty [ Wed Oct 07, 2009 5:32 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

finding the constant data always sucks

Author:  DudeOfX [ Wed Oct 07, 2009 10:18 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

I am getting linker fixup overflow error as soon as I start making far function calls... if I change memory models it wont create a bin file because it sais there are relocations...

Author:  smeezekitty [ Wed Oct 07, 2009 10:30 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

no far calls in bin or com formats
i had fun with that

Author:  DudeOfX [ Wed Oct 07, 2009 10:36 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

wont your OS be limited to 64KB total memory?

Author:  smeezekitty [ Wed Oct 07, 2009 10:58 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

yep
also -O switch to borland makes it smaller

Author:  DudeOfX [ Thu Oct 08, 2009 11:01 am ]
Post subject:  Re: How do i get my kernel to load binary programs?

:lol: half a dozen copies of your OS can fit inside the cache of 1 modern CPU

Author:  smeezekitty [ Thu Oct 08, 2009 1:11 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

but still instructions such as
Code:
jmp
call
db
dd

will fail miserably with data misalignment
the question is is how do i acomplish relocation

Author:  DudeOfX [ Thu Oct 08, 2009 3:09 pm ]
Post subject:  Re: How do i get my kernel to load binary programs?

* in a tiny memory model jmp and calls can't missalign because they are relative to the instruction pointer.

* data will missalign because its relative to the begining of the data segment

* .COMs expect that everything originates 256 bytes from the begining of the code segment

* BIN files don't necessarily have that requirement, I think BIN files in most cases have their stuff originate at offset 0

* I believe tlink /t outputs .COM files and exe2bin output BIN files that originate at offset 0

* you have to understand how your malloc works because the malloc in the standard library reserves the first 4 bytes hence if you would simply load a pointer allocated by that malloc the stuff would originate at offset 4

* you can have your malloc do some simple segment offset math such that it would return a pointer with an offset = 256 which would make it .COM friendly

all of the stuff above you have to have clear on your head or you'll end up confused and hence why debuging pointers has a bad rep.

I am about to give up on TC cause I can't make it issue a far call... I am considering looking into the exe2bin source code to see if I can modify it to do my will...

Page 4 of 7 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/