Bona Fide OS Developer
View unanswered posts | View active topics It is currently Mon Dec 09, 2019 1:19 pm



Post new topic Reply to topic  [ 67 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
 How do i get my kernel to load binary programs? 
Author Message
Post Re: How do i get my kernel to load binary programs?
call _main wastes stack space and is unneccary for the first call


Wed Oct 07, 2009 1:21 pm

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post 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


Wed Oct 07, 2009 3:02 pm
Profile
Post Re: How do i get my kernel to load binary programs?
finding the constant data always sucks


Wed Oct 07, 2009 5:32 pm

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post 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...


Wed Oct 07, 2009 10:18 pm
Profile
Post Re: How do i get my kernel to load binary programs?
no far calls in bin or com formats
i had fun with that


Wed Oct 07, 2009 10:30 pm

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post Re: How do i get my kernel to load binary programs?
wont your OS be limited to 64KB total memory?


Wed Oct 07, 2009 10:36 pm
Profile
Post Re: How do i get my kernel to load binary programs?
yep
also -O switch to borland makes it smaller


Wed Oct 07, 2009 10:58 pm

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post 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


Thu Oct 08, 2009 11:01 am
Profile
Post 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


Thu Oct 08, 2009 1:11 pm

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post 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...


Thu Oct 08, 2009 3:09 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 67 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.