NASM: Calling Externals

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
Fear
Member
Member
Posts: 39
Joined: Wed May 24, 2006 11:00 pm

NASM: Calling Externals

Post by Fear »

I'm writing my kernel in NASM and compiling it into AOUT, which seems to have problems with my external functions. I can call functions in my other object files, but when I try and pass parameters, the can't be popped off the stack. In fact, neither push nor pop work in external procedures. How do I get it to work properly?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: NASM: Calling Externals

Post by Candy »

Fear wrote:I'm writing my kernel in NASM and compiling it into AOUT, which seems to have problems with my external functions. I can call functions in my other object files, but when I try and pass parameters, the can't be popped off the stack. In fact, neither push nor pop work in external procedures. How do I get it to work properly?
Do you use a Windows-output-generating compiler? If so, are you using stdcall or cdecl calling convention?

Is your stack valid?

Why do you use a.out as output file type?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: NASM: Calling Externals

Post by Brynet-Inc »

Candy wrote:...
Why do you use a.out as output file type?
Why else? Because it's a lovely executable format.. NetBSD/OpenBSD's a.out format was anyway. 8)

People still use ancient DOS formats in OSDev, What's wrong with using historic UNIX binary formats? :wink:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: NASM: Calling Externals

Post by Candy »

Brynet-Inc wrote:
Candy wrote:...
Why do you use a.out as output file type?
Why else? Because it's a lovely executable format.. NetBSD/OpenBSD's a.out format was anyway. 8)

People still use ancient DOS formats in OSDev, What's wrong with using historic UNIX binary formats? :wink:
The same as with ancient DOS formats :P. Knowing a murderer doesn't make it right to be a thief, as a matter of speech.
User avatar
smiddy
Member
Member
Posts: 127
Joined: Sun Oct 24, 2004 11:00 pm
Location: In my cube, like a good leming. ;-)

Re: NASM: Calling Externals

Post by smiddy »

Candy wrote:The same as with ancient DOS formats :P. Knowing a murderer doesn't make it right to be a thief, as a matter of speech.
You are so analogical it hurts! ;-)
Post Reply