OSDev.org

The Place to Start for Operating System Developers
It is currently Sat May 18, 2024 3:14 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Argument Counting in 64 Bit
PostPosted: Wed Nov 07, 2007 10:33 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

I am trying to implement a version of printf in my 64 bit kernel. Only problem is, the old version kind of relied on the variable number of arguments being on the stack. By default, GCC in 64 bit uses registers and the stack for argument passing. d'oh!

This means that my nice old function which incremented through the stack no longer works. Moreove, supplying the __stdcall attribute gets ignored by the compiler.

Does anyone have a neat way to deal with this (rather than having to remember which aregument I am on, and manually loading the data from each individual register?)

Cheers,
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 07, 2007 5:15 pm 
Offline
Member
Member

Joined: Wed Sep 27, 2006 2:34 pm
Posts: 41
I just used __builtin_va_arg and the like.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 2:27 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 27, 2007 3:21 pm
Posts: 553
Location: Best, Netherlands
I've build the x86_64 cross compiler and can use the #include <stdarg.h> and use the va_XXX macros without any problem.

_________________
Author of COBOS


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 4:39 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Thanks - I'll have a look (at the moment I am using absolutely no headers/code that I haven't written myself).

Cheers for the advice,
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 08, 2007 4:56 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Yep - it worked. What a plonker - I didn't remember one of the first things I read about devving a kernel in C which is that there are some headers which do not require special cross compiling to work in a freestanding environment - I'm almost tempted to add to the stupid mistakes thread :roll:

Cheers,
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 22, 2007 3:41 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 08, 2007 11:08 am
Posts: 670
AJ wrote:
Yep - it worked. What a plonker - I didn't remember one of the first things I read about devving a kernel in C which is that there are some headers which do not require special cross compiling to work in a freestanding environment - I'm almost tempted to add to the stupid mistakes thread :roll:

Cheers,
Adam


Your signature link says 403 btw..

_________________
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 23, 2007 2:39 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Yes - thanks. I have been fiddling with my site trying to get wiki-type software working to make editing quicker. Then, I got sidetracked with Caracal Boot Loader and the 'site' has been like that for a couple of weeks...you know how it is!

I hope to get something useable back up in the next few weeks.

Cheers,
Adam

[EDIT: While I'm on this topic, if anyone knows if it's possible to get any kind of SVN repository working on a 1and1 hosted web site with no root access (Linux home package), I would be most grateful to know how![/EDIT]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 23, 2007 5:18 am 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2426
Location: Canada
AJ wrote:
While I'm on this topic, if anyone knows if it's possible to get any kind of SVN repository working on a 1and1 hosted web site with no root access (Linux home package), I would be most grateful to know how!

Subversion can either operate as an Apache 2 module, or a stand-alone server "svnserve".

Unfortunately, most "shared hosting" providers will not allow you to use 3rd party software on their servers.

_________________
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group