Subject:
|
RE: H8/300 Assembler/C interface
|
Newsgroups:
|
lugnet.robotics.rcx
|
Date:
|
Sat, 21 Apr 2001 12:07:45 GMT
|
Viewed:
|
1548 times
|
| |
| |
> Ralph Hempel <rhempel@bmts.com> wrote:
> > Geez Kekoa, get some sleep. The GCC makes the callee clean up the
> > stack.
Sorry, looks like I need sleep too!
> Not my GCC:
>
> 00000016 <_main>:
> 16: 6d f6 mov.w r6,@-e7 <-- save frame pointer
> 18: 0d 76 mov.w r7,r6 <-- new frame pointer
> 1a: 6b 00 00 00 mov.w @0x0:16,r0 <-- r0r1 is 1st long param
> 1e: 6b 01 00 00 mov.w @0x0:16,r1
> 22: 6b 02 00 00 mov.w @0x0:16,r2 <-- load 2nd long param
> 26: 6b 03 00 00 mov.w @0x0:16,r3
> 2a: 6d f3 mov.w r3,@-e7 <-- put 2nd long param on stack
> 2c: 6d f2 mov.w r2,@-e7
Hmm, looks like r2 is a copy of the high byte of the second long,
but the complete long is pushed onto the stack! So the thing
about GCC NOT splitting is true, it just keeps a copy of the
higher order bytes around....
> 2e: 5e 00 00 00 jsr @0x0:0 <-- caller calls callee
> 32: 0d 10 mov.w r1,r0 <-- return lsw of long
> return value
> 34: 0b 87 adds #0x2,er7 <-- *** caller cleans
> up stack ***
> 36: 0b 87 adds #0x2,er7
> 38: 6d 76 mov.w @r7+,r6 <-- restore frame pointer
> 3a: 54 70 rts
OK, caller cleans up stack in GCC. That makes my routines a bit easier
to deal with anyways....
Thanks again
Cheers, Ralph Hempel
|
|
Message is in Reply To:
| | Re: H8/300 Assembler/C interface
|
| (...) Not my GCC: 00000016 <_main>: 16: 6d f6 mov.w r6,@-e7 <-- save frame pointer 18: 0d 76 mov.w r7,r6 <-- new frame pointer 1a: 6b 00 00 00 mov.w @0x0:16,r0 <-- r0r1 is 1st long param 1e: 6b 01 00 00 mov.w @0x0:16,r1 22: 6b 02 00 00 mov.w (...) (24 years ago, 21-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
|
|
|
|