public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Thomas Klöber" <thomas@kdut.de>
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Type of alarm-function
Date: Wed, 05 Mar 2008 12:53:00 -0000	[thread overview]
Message-ID: <200803051352.17245.thomas@kdut.de> (raw)

Hello all,

I am porting eCos to the Infineon TriCore TC1796 as part of my studies. I am 
using the kernel testcases to verify it's working, most ones are running just 
fine. During stepping throug kclock0.c as it wouldn't work, I found the 
following:

The prototype for an alarm handler function in the C kernel api is

void alarm_handler(cyg_handle_t alarm, cyg_addrword_t data)

with cyg_handle_t being a cyg_uint32. The internal kernel prototype for 
calling the function however is

void cyg_alarm_fn(Cyg_Alarm *alarm, CYG_ADDRWORD data)

Note  that the first argument is a pointer in this case. While on most 
architectures this does not make any difference, it circumvents passing of 
parameters to the function.

The TC1796 has separate registers for addresses and for data which are used 
for passing parameters. When calling a function of type cyg_alarm_fn, the 
compiler puts the first argument into an address register (%a4) and the 
second one into a data register (%d4). Unfortunately, the called function has 
the type alarm_handler, so the compiler trys to read both values from data 
registers (%d4 and %d5) when entering the function.

The result is that neither of the arguments is passed correctly to the 
function as the first one lies in %a4 instead of %d4 and the second one lies 
in %d4 instead of %d5.

imho one of the prototypes for the function should be corrected to guarantee 
correct behaviour on all platforms.

Any opinions on this?


Tom

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

             reply	other threads:[~2008-03-05 12:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 12:53 Thomas Klöber [this message]
2008-03-07 12:06 ` Andrew Lunn
2008-04-30 14:26   ` Fabian Scheler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803051352.17245.thomas@kdut.de \
    --to=thomas@kdut.de \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).