What's the process behind loading and executing a file?

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
ThisMayWork
Member
Member
Posts: 65
Joined: Sat Mar 22, 2014 1:14 pm
Location: /bin

What's the process behind loading and executing a file?

Post by ThisMayWork »

My kernel main is running, I am happily printing messages on the screen using VGA, I have a filesystem, now it's time to load and execute my first program. I took care of the actual loading, but I have no idea where to load it and how to execute it. Do I just call it's main and cross my fingers hopping that it'll work? Also, if it's written in C instead of assembly, how do I expose my printf header to it? (I don't want to build an OS specific toolchain, I only want a hacky method to do it for now).
"Programming is an art form that fights back."
-Kudzu
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: What's the process behind loading and executing a file?

Post by Combuster »

"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
ThisMayWork
Member
Member
Posts: 65
Joined: Sat Mar 22, 2014 1:14 pm
Location: /bin

Re: What's the process behind loading and executing a file?

Post by ThisMayWork »

Godsend, thank you Combuster.
"Programming is an art form that fights back."
-Kudzu
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: What's the process behind loading and executing a file?

Post by max »

ThisMayWork wrote:(I don't want to build an OS specific toolchain, I only want a hacky method to do it for now).
Starting to program in userspace is actually the exactly right time to build one. It is not as much effort as it looks, and you will love it. ;)
Post Reply