[OpenBIOS] 64bit paflof with lots of gnuisms
Stefan Reinauer
stepan at suse.de
Mon Jun 3 21:15:39 CEST 2002
Hi there,
I played around with paflof on 64bit platforms.
As we make heavy use of GNUisms, I got it working using some more.
I'll attach 2 patches, one cleans up 64bit compile warnings for
the fprintf stuff (cosmetic), the other fixes the double cell issue.
Unfortunately it does not compile on 32bit platforms without the ugly
#ifdef constructs. The error messages are "no data type for mode `TI'"
I am not sure whether this is a gcc bug or rather an error in my
thoughts. Any comments?
See you,
Stefan
--
The x86 isn't all that complex - it just doesn't make a lot of
sense. -- Mike Johnson, Leader of 80x86 Design at AMD
Microprocessor Report (1994)
-------------- next part --------------
? paflof-64bit.diff
Index: paflof.c
===================================================================
RCS file: /srv/cvs/openbios/paflof/paflof.c,v
retrieving revision 1.6
diff -u -r1.6 paflof.c
--- paflof.c 2002/05/30 04:11:05 1.6
+++ paflof.c 2002/06/03 15:40:39
@@ -64,10 +64,10 @@
cell *p;
for (p = interpreter->data_stack; p <= dp; p++)
- fprintf(stderr, "%x ", p->n);
+ fprintf(stderr, "%lx ", (unsigned long)(p->n));
fprintf(stderr, " R: ");
for (p = rp; p >= interpreter->return_stack; p--)
- fprintf(stderr, "%x ", p->n);
+ fprintf(stderr, "%lx ", (unsigned long)(p->n));
fprintf(stderr, "\n");
}
@@ -134,13 +134,13 @@
int i;
struct interpreter *interpreter;
-fprintf(stderr, "SANITY CHECK: (%d==1 %d==2 %d==4 %d==%d==%d %d==%d %d==%d)\n",
-sizeof(type_c),
-sizeof(type_w),
-sizeof(type_l),
-sizeof(type_n), sizeof(type_u), sizeof(void *),
-sizeof(type_d), sizeof(type_du),
-sizeof(type_d), 2*sizeof(type_n)
+fprintf(stderr, "SANITY CHECK: (%ld==1 %ld==2 %ld==4 %ld==%ld==%ld %ld==%ld %ld==%ld)\n",
+(unsigned long)sizeof(type_c),
+(unsigned long)sizeof(type_w),
+(unsigned long)sizeof(type_l),
+(unsigned long)sizeof(type_n), (unsigned long)sizeof(type_u), (unsigned long)sizeof(void *),
+(unsigned long)sizeof(type_d), (unsigned long)sizeof(type_du),
+(unsigned long)sizeof(type_d), (unsigned long)(2*sizeof(type_n))
);
init_terminal();
@@ -148,7 +148,8 @@
interpreter = init_engine();
for (i = 0; i < 1; i++) run_engine(interpreter);
{ cell *p;
-for (p = interpreter->dictionary; (void *)p < interpreter->here; p++) fprintf(stderr, "%p: 0x%0*x\n", p, 2 * CELLSIZE, p->u);
+for (p = interpreter->dictionary; (void *)p < interpreter->here; p++)
+ fprintf(stderr, "%p: 0x%0*lx\n", p, (unsigned long)(2 * CELLSIZE), (unsigned long)(p->u));
}
fini_engine(interpreter);
-------------- next part --------------
? paflof-64bit.diff
? ti-mode.diff
Index: paflof.c
===================================================================
RCS file: /srv/cvs/openbios/paflof/paflof.c,v
retrieving revision 1.6
diff -u -r1.6 paflof.c
--- paflof.c 2002/05/30 04:11:05 1.6
+++ paflof.c 2002/06/03 16:24:26
@@ -13,16 +13,28 @@
typedef uint32_t type_l; // 4 bytes
typedef intptr_t type_n; // cell size
typedef uintptr_t type_u; // cell size
+#if defined(__alpha__) || defined(__x86_64__) || \
+ defined(__ia64__) || defined(ppc64)
+typedef intmax_t type_d __attribute__ ((mode (TI))); // 2 * cell size
+typedef uintmax_t type_du __attribute__ ((mode (TI))); // 2 * cell size
+#else
typedef intmax_t type_d; // 2 * cell size
typedef uintmax_t type_du; // 2 * cell size
+#endif
#else
typedef unsigned char type_c; // 1 byte
typedef short type_w; // 2 bytes
typedef int type_l; // 4 bytes
typedef long type_n; // cell size
typedef unsigned long type_u; // cell size
+#if defined(__alpha__) || defined(__x86_64__) || \
+ defined(__ia64__) || defined(ppc64)
+typedef long type_d __attribute__ ((mode (TI))); // 2 * cell size
+typedef unsigned long type_du __attribute__ ((mode (TI))); // 2 * cell size
+#else
typedef long long type_d; // 2 * cell size
typedef unsigned long long type_du;// 2 * cell size
+#endif
#endif
#define CELLSIZE (sizeof(type_u) / sizeof(type_c))
More information about the openbios
mailing list