Author: stepan
Date: 2006-09-14 17:06:38 +0200 (Thu, 14 Sep 2006)
New Revision: 83
Modified:
openbios-devel/include/libc/byteorder.h
openbios-devel/include/openbios/bindings.h
openbios-devel/kernel/cross.h
openbios-devel/kernel/internal.c
openbios-devel/modules/bindings.c
openbios-devel/modules/deblocker.c
openbios-devel/modules/disk-label.c
openbios-devel/modules/filesystems.c
Log:
64bit fixes from blueswirl
Modified: openbios-devel/include/libc/byteorder.h
===================================================================
--- openbios-devel/include/libc/byteorder.h 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/include/libc/byteorder.h 2006-09-14 15:06:38 UTC (rev 83)
@@ -18,27 +18,45 @@
(__bswap32((x) & 0xffffffff) << 32) )
#ifdef CONFIG_LITTLE_ENDIAN
+#define __cpu_to_le64(x) ((u64) (x))
+#define __le64_to_cpu(x) ((u64) (x))
#define __cpu_to_le32(x) ((u32) (x))
#define __le32_to_cpu(x) ((u32) (x))
#define __cpu_to_le16(x) ((u16) (x))
#define __le16_to_cpu(x) ((u16) (x))
+#define __cpu_to_be64(x) (__bswap64((u64) (x)))
+#define __be64_to_cpu(x) (__bswap64((u64) (x)))
#define __cpu_to_be32(x) (__bswap32((u32) (x)))
#define __be32_to_cpu(x) (__bswap32((u32) (x)))
#define __cpu_to_be16(x) (__bswap16((u16) (x)))
#define __be16_to_cpu(x) (__bswap16((u16) (x)))
#endif
#ifdef CONFIG_BIG_ENDIAN
+#define __cpu_to_le64(x) (__bswap64((u64) (x)))
+#define __le64_to_cpu(x) (__bswap64((u64) (x)))
#define __cpu_to_le32(x) (__bswap32((u32) (x)))
#define __le32_to_cpu(x) (__bswap32((u32) (x)))
#define __cpu_to_le16(x) (__bswap16((u16) (x)))
#define __le16_to_cpu(x) (__bswap16((u16) (x)))
+#define __cpu_to_be64(x) ((u64) (x))
+#define __be64_to_cpu(x) ((u64) (x))
#define __cpu_to_be32(x) ((u32) (x))
#define __be32_to_cpu(x) ((u32) (x))
#define __cpu_to_be16(x) ((u16) (x))
#define __be16_to_cpu(x) ((u16) (x))
#endif
+#if BITS==32
+#define __becell_to_cpu(x) (__be32_to_cpu(x))
+#define __lecell_to_cpu(x) (__le32_to_cpu(x))
+#define __cpu_to_becell(x) (__cpu_to_be32(x))
+#define __cpu_to_lecell(x) (__cpu_to_le32(x))
+#else
+#define __becell_to_cpu(x) (__be64_to_cpu(x))
+#define __lecell_to_cpu(x) (__le64_to_cpu(x))
+#define __cpu_to_becell(x) (__cpu_to_be64(x))
+#define __cpu_to_lecell(x) (__cpu_to_le64(x))
+#endif
-
#endif
Modified: openbios-devel/include/openbios/bindings.h
===================================================================
--- openbios-devel/include/openbios/bindings.h 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/include/openbios/bindings.h 2006-09-14 15:06:38 UTC (rev 83)
@@ -61,8 +61,8 @@
extern void set_property( phandle_t ph, const char *name,
const char *buf, int len );
extern void set_int_property( phandle_t ph, const char *name,
- int val );
-extern int get_int_property( phandle_t ph, const char *name,
+ cell val );
+extern cell get_int_property( phandle_t ph, const char *name,
int *retlen );
extern char *get_property( phandle_t ph, const char *name,
int *retlen );
@@ -76,7 +76,7 @@
}
/* forth bindings */
-extern int feval( const char *str );
+extern cell feval( const char *str );
extern void bind_xtfunc( const char *name, xt_t xt,
ucell arg, void (*func)(void) );
extern void bind_func( const char *name, void (*func)(void) );
@@ -85,7 +85,7 @@
extern char *pop_fstr_copy( void );
extern int _fword( const char *word, xt_t *cache_xt );
-extern int _eword( const char *word, xt_t *cache_xt, int nargs );
+extern cell _eword( const char *word, xt_t *cache_xt, int nargs );
extern int _selfword( const char *method, xt_t *cache_xt );
extern int _parword( const char *method, xt_t *cache_xt );
Modified: openbios-devel/kernel/cross.h
===================================================================
--- openbios-devel/kernel/cross.h 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/kernel/cross.h 2006-09-14 15:06:38 UTC (rev 83)
@@ -84,7 +84,7 @@
#define unaligned_write_long(addr, value) \
unaligned_write_word(addr, value & 0xffff); \
- unaligned_write_word(addr, value >> 16)
+ unaligned_write_word(addr + 2, value >> 16)
#endif
@@ -100,7 +100,7 @@
#define unaligned_write_long(addr, value) \
unaligned_write_word(addr, value >> 16); \
- unaligned_write_word(addr, value & 0xffff)
+ unaligned_write_word(addr + 2, value & 0xffff)
#endif
/* bit width handling */
Modified: openbios-devel/kernel/internal.c
===================================================================
--- openbios-devel/kernel/internal.c 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/kernel/internal.c 2006-09-14 15:06:38 UTC (rev 83)
@@ -115,14 +115,14 @@
static void docon(void)
{ /* DOCON */
- ucell tmp = read_cell(cell2pointer(read_ucell(cell2pointer(PC)) + sizeof(ucell)));
+ ucell tmp = read_ucell(cell2pointer(read_ucell(cell2pointer(PC)) + sizeof(ucell)));
PUSH(tmp);
dbg_interp_printk("docon: PC=%x, value=%x\n", PC, tmp);
}
static void dovar(void)
{ /* DOVAR */
- ucell tmp = read_cell(cell2pointer(PC)) + sizeof(ucell);
+ ucell tmp = read_ucell(cell2pointer(PC)) + sizeof(ucell);
PUSH(tmp); /* returns address to variable */
dbg_interp_printk("dovar: PC: %x, %x\n", PC, tmp);
}
Modified: openbios-devel/modules/bindings.c
===================================================================
--- openbios-devel/modules/bindings.c 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/modules/bindings.c 2006-09-14 15:06:38 UTC (rev 83)
@@ -33,18 +33,18 @@
}
/* WARNING: sloooow - AVOID */
-int
+cell
feval( const char *str )
{
push_str( str );
return eword("evaluate", 2);
}
-int
+cell
_eword( const char *word, xt_t *cache_xt, int nargs )
{
static xt_t catch_xt = 0;
- int ret = -1;
+ cell ret = -1;
if( !catch_xt )
catch_xt = findword("catch");
@@ -285,10 +285,10 @@
}
void
-set_int_property( phandle_t ph, const char *name, int val )
+set_int_property( phandle_t ph, const char *name, cell val )
{
- int swapped=__cpu_to_be32(val);
- set_property( ph, name, (char*)&swapped, 4 );
+ cell swapped=__cpu_to_becell(val);
+ set_property( ph, name, (char*)&swapped, sizeof(cell) );
}
char *
@@ -310,14 +310,14 @@
return (char*)POP();
}
-int
+cell
get_int_property( phandle_t ph, const char *name, int *retlen )
{
- int *p;
+ cell *p;
- if( !(p=(int*)get_property(ph, name, retlen)) )
+ if( !(p=(cell *)get_property(ph, name, retlen)) )
return 0;
- return *p;
+ return __becell_to_cpu(*p);
}
@@ -423,7 +423,7 @@
static void
call1_func( void )
{
- void (*func)(int v);
+ void (*func)(cell v);
func = (void*)POP();
(*func)( POP() );
Modified: openbios-devel/modules/deblocker.c
===================================================================
--- openbios-devel/modules/deblocker.c 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/modules/deblocker.c 2006-09-14 15:06:38 UTC (rev 83)
@@ -20,7 +20,7 @@
#include "modules.h"
typedef struct {
- ullong mark;
+ ducell mark;
xt_t read_xt;
xt_t write_xt;
@@ -70,14 +70,14 @@
static void
deblk_seek( deblk_info_t *di )
{
- uint pos_hi = POP();
- uint pos_lo = POP();
- ullong mark = ((ullong)pos_hi << 32) | pos_lo;
+ ucell pos_hi = POP();
+ ucell pos_lo = POP();
+ ducell mark = ((ducell)pos_hi << BITS) | pos_lo;
/* printk("deblk_seek %x %08x\n", pos_hi, pos_lo ); */
/* -1 means seek to EOF (at least in our implementation) */
- if( (llong)mark == -1 )
+ if( (dcell)mark == -1 )
RET(-1);
di->mark = mark;
@@ -102,7 +102,7 @@
int nblks;
/* byte operation */
- int offs;
+ cell offs;
int len;
char *data; /* start of data */
} work_t;
Modified: openbios-devel/modules/disk-label.c
===================================================================
--- openbios-devel/modules/disk-label.c 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/modules/disk-label.c 2006-09-14 15:06:38 UTC (rev 83)
@@ -22,8 +22,8 @@
typedef struct {
int fd;
- ullong offs;
- ullong size;
+ ducell offs;
+ ducell size;
int type; /* partition type or -1 */
ihandle_t part_ih;
Modified: openbios-devel/modules/filesystems.c
===================================================================
--- openbios-devel/modules/filesystems.c 2006-09-05 19:46:20 UTC (rev 82)
+++ openbios-devel/modules/filesystems.c 2006-09-14 15:06:38 UTC (rev 83)
@@ -203,7 +203,7 @@
files_seek( files_info_t *mi )
{
llong pos = DPOP();
- int ret;
+ cell ret;
if( mi->file ) {
int offs = (int)pos;