To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 1202
1201  |  1203
Subject: 
Re: H8/300 Assembler/C interface
Newsgroups: 
lugnet.robotics.rcx
Date: 
Wed, 18 Apr 2001 23:15:51 GMT
Viewed: 
1204 times
  
Ralph Hempel <rhempel@bmts.com> wrote:
If any of these are incorrect, please let me know. I'm not at
my regular computer right now, or I'd look there...

Somebody correct me if I'm wrong.  I just compiled some programs to check
this.  I believe that maybe the *ROM* calling convection is as Ralph
described, but almost definitely the GCC calling convention is:

- r0, r1, r2 hold parameters from left to right
- additional parameters are pushed onto the stack before call
- rightmost parameters are pushed first
- registers may be joined to pass 32-bit parameters (i.e. r0r1 or r1r2)
- 32-bit parameters never split between r2 and stack
- return value in r0 (or r0r1 if 32-bits)

-Kekoa



Message has 2 Replies:
  Re: H8/300 Assembler/C interface
 
(...) Also: - caller cleans up parameters on stack - stack pointer is r7 The caller must clean up stack parameters b/c the return address is pushed after parameters are. -Kekoa (23 years ago, 18-Apr-01, to lugnet.robotics.rcx)
  RE: H8/300 Assembler/C interface
 
(...) Thanks Kekoa. One more question, are the other registers r3,r4,r5,r6 considered volatile across a function call in GCC? Cheers, Ralph (23 years ago, 19-Apr-01, to lugnet.robotics.rcx)

Message is in Reply To:
  H8/300 Assembler/C interface
 
Does anyone know offhand what the calling convention between C/C++ and H8/300 assembler is using the GNU tools? The assumptions I'm making are as follows: R7 is the stack pointer R6 is the first (leftmost) parameter passed and the result R0-5 are (...) (23 years ago, 18-Apr-01, to lugnet.robotics.rcx)

20 Messages in This Thread:





Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR