From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32404 invoked by alias); 5 Mar 2008 12:53:02 -0000 Received: (qmail 32315 invoked by uid 22791); 5 Mar 2008 12:52:44 -0000 X-Spam-Check-By: sourceware.org Received: from moutng.kundenserver.de (HELO moutng.kundenserver.de) (212.227.126.177) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 05 Mar 2008 12:52:22 +0000 Received: from vpn-05be.vpn.informatik.uni-erlangen.de (faui02.informatik.uni-erlangen.de [131.188.30.102]) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis) id 0MKwpI-1JWt6Y43zB-0001Yn; Wed, 05 Mar 2008 13:52:19 +0100 From: Thomas =?utf-8?q?Kl=C3=B6ber?= To: ecos-discuss@ecos.sourceware.org Date: Wed, 05 Mar 2008 12:53:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803051352.17245.thomas@kdut.de> X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Type of alarm-function X-SW-Source: 2008-03/txt/msg00027.txt.bz2 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