To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 1405
1404  |  1406
Subject: 
Re: legOS-0.1.4
Newsgroups: 
lugnet.robotics
Date: 
Mon, 14 Dec 1998 08:35:36 GMT
Original-From: 
Kekoa Proudfoot <kekoa@Graphics.Stanford.EDU>
Viewed: 
1220 times
  
Hi Markus,

You wrote:
Matt suggested I check out the register clobbers in ROM calls with a
disassembler, and how right he was. gcc doesn't make the slightest
effort to save and restore registers. I fixed that, the system should be
more stable now.

The GNU info pages regarding the usage of __asm__ say:

     It is up to you to make sure that the assembler names you choose do
  not conflict with any other assembler symbols.  Also, you must not use a
  register name; that would produce completely invalid assembler code.

  (Last paragraph of the GCC -> C Extensions -> Asm Labels info page.)

This seems to explain some of the problems you seem to be having regarding
clobbering of registers, specifically, one of those that you mention in
your log book on your web page.

From my brief experience with GCC this afternoon, and from the information
in the info files regarding this topic, it seems to me that __asm__ is
basically a template mechanism.  GCC puts no intelligence into it at all.
So when you do something like:

  register unsigned _asdf __asm__ ("r6");

you cause _asdf to be referenced in assembly by the name r6; however, the
compiler does no interpretation on that name, and therefore does not notice
that it also uses that name for something else, namely register 6.

I don't think the inline assembly mechanism is as flexible as you'd like it
to be.

On the other hand, I have yet to see a case where something like

  __asm__ __volatile__ ("mov.w #0x1234,r6":::"r6");

fails to work.  For example:

  int test (int foo) {
      __asm__ volatile ("mov #0x0:0,r0" : : : "r0");
      return foo + 1;
  }

generates:

_test:
        push    r6
        mov.w   r7,r6
        mov.w   r0,r2
        mov #0x0:0,r0
        adds #1,r2
        mov.w   r2,r0
        pop     r6
        rts

It looks like r0 is indeed saved so that the return value is correct.

-Kekoa



Message is in Reply To:
  legOS-0.1.4
 
Hi, as you might guess by the date, it's raining in Grenoble, so I'm not romping about in the mountains. Matt suggested I check out the register clobbers in ROM calls with a disassembler, and how right he was. gcc doesn't make the slightest effort (...) (26 years ago, 12-Dec-98, to lugnet.robotics)

2 Messages in This Thread:

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

Custom Search

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