public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] diag_printf, long long
@ 2001-07-12 20:35 Motoya Kurotsu
  2001-07-13 13:31 ` Jonathan Larmour
  0 siblings, 1 reply; 2+ messages in thread
From: Motoya Kurotsu @ 2001-07-12 20:35 UTC (permalink / raw)
  To: ecos-discuss

Hi,

I guess that diag_printf can't handle long long type of integers, at least
as far as with the gcc for 32 bit mips.
Below is the program to prove it.

#include <cyg/infra/diag.h>     // diag_printf
#include <stdio.h>              // printf
void cyg_user_start(void)
{
        unsigned long t1=0xaa00aa00;
        unsigned long long t2=0x22002200bb00bb00;
        unsigned long long t3=0x33003300cc00cc00;

        diag_printf("diag : t1:%16lx t1:%16llx t3:%16llx\n",t1,t2,t3);
        printf("stdio: t1:%16lx t1:%16llx t3:%16llx\n",t1,t2,t3);
        diag_printf("diag : t2:%16llx t1:%16lx t3:%16llx\n",t2,t1,t3);
        printf("stdio: t2:%16llx t1:%16lx t3:%16llx\n",t2,t1,t3);
        diag_printf("diag : t2:%16llx t3:%16llx t1:%16lx\n",t2,t3,t1);
        printf("stdio: t2:%16llx t3:%16llx t1:%16lx\n",t2,t3,t1);
	for(;;);
}

The attachment is my patch for this problem. I think this works with
32-bit compiler. But I suspect it does so with 64 bit compiler.
If you find anything or have better idea, please suggest me. 

Thank you in advance.

Regards,
Motoya Kurotsu
Alilled Telesis K.K.
-----------------------------------------------

--- diag.cxx.orig	Thu Jul 12 13:53:32 2001
+++ diag.cxx	Thu Jul 12 14:34:56 2001
@@ -262,6 +262,9 @@
 
 externC void diag_vprintf( const char *fmt, CYG_ADDRWORD *args)
 {
+
+    cyg_bool pad = true;
+
     if( !diag_check_string(fmt) )
     {
         int i;
@@ -309,6 +312,13 @@
                 }
             }
 
+            if (long_op) {
+                    if(pad) args++;
+                    pad=false;
+            } else {
+                    pad=!pad;
+            }
+		
             switch( c )
             {
             case 'd':

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] diag_printf, long long
  2001-07-12 20:35 [ECOS] diag_printf, long long Motoya Kurotsu
@ 2001-07-13 13:31 ` Jonathan Larmour
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Larmour @ 2001-07-13 13:31 UTC (permalink / raw)
  To: Motoya Kurotsu; +Cc: ecos-discuss

Motoya Kurotsu wrote:
> 
> Hi,
> 
> I guess that diag_printf can't handle long long type of integers, at least
> as far as with the gcc for 32 bit mips.

I've applied your patch for now. We'll shortly be merging the RedBoot I/O
code with the diag code so this will be fixed properly, even for targets
where CYG_ADDRWORD is 64-bit (like 64-bit targets).

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-13 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-12 20:35 [ECOS] diag_printf, long long Motoya Kurotsu
2001-07-13 13:31 ` Jonathan Larmour

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).