mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Don't assume that pointer and cell size are identical, part 1
On ppc64, cell size is 32 bits but pointers are 64-bit. Thus, direct casts result in warnings, treated as errors. Use [u]intptr_t cast or cell2pointer and pointer2cell macros as necessary. v2: * Drop changes related to physical addresses since physical addresses may be wider than pointers (e.g., 36 bits on sparc32, as pointed out by Blue). * Drop changes to cell2pointer() and pointer2cell() for now. Signed-off-by: Andreas Färber <andreas.faerber@web.de> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@922 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Andreas Färber
parent
28516584d1
commit
380cd335cc
@@ -96,7 +96,7 @@ deblk_tell( deblk_info_t *di )
|
||||
|
||||
|
||||
#define DO_IO( xt, buf, blk, n ) \
|
||||
({ PUSH3((ucell)(buf), blk, n); call_parent(xt); POP(); })
|
||||
({ PUSH3(pointer2cell(buf), blk, n); call_parent(xt); POP(); })
|
||||
|
||||
typedef struct {
|
||||
/* block operation */
|
||||
@@ -141,7 +141,7 @@ static int
|
||||
do_readwrite( deblk_info_t *di, int is_write, xt_t xt )
|
||||
{
|
||||
int blk, i, n, len = POP();
|
||||
char *dest = (char*)POP();
|
||||
char *dest = (char*)cell2pointer(POP());
|
||||
int last=0, retlen=0;
|
||||
work_t w[3];
|
||||
ducell mark = ((ducell)di->mark_hi << BITS) | di->mark_lo;
|
||||
|
||||
@@ -80,7 +80,7 @@ dlabel_open( dlabel_info_t *di )
|
||||
call_package(di->parent_seek_xt, my_parent());
|
||||
POP();
|
||||
|
||||
PUSH((ucell)block0);
|
||||
PUSH(pointer2cell(block0));
|
||||
PUSH(sizeof(block0));
|
||||
call_package(di->parent_read_xt, my_parent());
|
||||
status = POP();
|
||||
@@ -88,7 +88,7 @@ dlabel_open( dlabel_info_t *di )
|
||||
goto out;
|
||||
|
||||
/* Find partition handler */
|
||||
PUSH( (ucell)block0 );
|
||||
PUSH( pointer2cell(block0) );
|
||||
selfword("find-part-handler");
|
||||
ph = POP_ph();
|
||||
if( ph ) {
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct {
|
||||
DECLARE_NODE( macparts, INSTALL_OPEN, sizeof(macparts_info_t), "+/packages/mac-parts" );
|
||||
|
||||
#define SEEK( pos ) ({ DPUSH(pos); call_parent(di->seek_xt); POP(); })
|
||||
#define READ( buf, size ) ({ PUSH((ucell)buf); PUSH(size); call_parent(di->read_xt); POP(); })
|
||||
#define READ( buf, size ) ({ PUSH(pointer2cell(buf)); PUSH(size); call_parent(di->read_xt); POP(); })
|
||||
|
||||
/* ( open -- flag ) */
|
||||
static void
|
||||
@@ -267,7 +267,7 @@ out:
|
||||
static void
|
||||
macparts_probe( macparts_info_t *dummy )
|
||||
{
|
||||
desc_map_t *dmap = (desc_map_t*)POP();
|
||||
desc_map_t *dmap = (desc_map_t*)cell2pointer(POP());
|
||||
|
||||
DPRINTF("macparts_probe %x ?= %x\n", dmap->sbSig, DESC_MAP_SIGNATURE);
|
||||
if( __be16_to_cpu(dmap->sbSig) != DESC_MAP_SIGNATURE )
|
||||
|
||||
@@ -167,7 +167,7 @@ show_partitions( void )
|
||||
void
|
||||
update_nvram( void )
|
||||
{
|
||||
PUSH( (ucell)nvram.config->data );
|
||||
PUSH( pointer2cell(nvram.config->data) );
|
||||
PUSH( nvram.config_size );
|
||||
fword("nvram-store-configs");
|
||||
arch_nvram_put( nvram.data );
|
||||
@@ -202,7 +202,7 @@ nvconf_init( void )
|
||||
nvram.config_size = nvpart_size(p) - 0x10;
|
||||
|
||||
if( !once++ ) {
|
||||
PUSH( (ucell)p->data );
|
||||
PUSH( pointer2cell(p->data) );
|
||||
PUSH( nvram.config_size );
|
||||
fword("nvram-load-configs");
|
||||
}
|
||||
@@ -256,7 +256,7 @@ static void
|
||||
nvram_read( nvram_ibuf_t *nd )
|
||||
{
|
||||
int len = POP();
|
||||
char *p = (char*)POP();
|
||||
char *p = (char*)cell2pointer(POP());
|
||||
int n=0;
|
||||
|
||||
while( nd->mark_lo < nvram.size && n < len ) {
|
||||
@@ -272,7 +272,7 @@ static void
|
||||
nvram_write( nvram_ibuf_t *nd )
|
||||
{
|
||||
int len = POP();
|
||||
char *p = (char*)POP();
|
||||
char *p = (char*)cell2pointer(POP());
|
||||
int n=0;
|
||||
|
||||
while( nd->mark_lo < nvram.size && n < len ) {
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef struct {
|
||||
DECLARE_NODE( pcparts, INSTALL_OPEN, sizeof(pcparts_info_t), "+/packages/pc-parts" );
|
||||
|
||||
#define SEEK( pos ) ({ DPUSH(pos); call_parent(di->seek_xt); POP(); })
|
||||
#define READ( buf, size ) ({ PUSH((ucell)buf); PUSH(size); call_parent(di->read_xt); POP(); })
|
||||
#define READ( buf, size ) ({ PUSH(pointer2cell(buf)); PUSH(size); call_parent(di->read_xt); POP(); })
|
||||
|
||||
/* three helper functions */
|
||||
|
||||
@@ -294,7 +294,7 @@ pcparts_open( pcparts_info_t *di )
|
||||
static void
|
||||
pcparts_probe( pcparts_info_t *dummy )
|
||||
{
|
||||
unsigned char *buf = (unsigned char *)POP();
|
||||
unsigned char *buf = (unsigned char *)cell2pointer(POP());
|
||||
|
||||
DPRINTF("probing for PC partitions\n");
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ video_set_colors( void )
|
||||
{
|
||||
int count = POP();
|
||||
int start = POP();
|
||||
unsigned char *p = (unsigned char*)POP();
|
||||
unsigned char *p = (unsigned char*)cell2pointer(POP());
|
||||
int i;
|
||||
|
||||
for( i=0; i<count; i++, p+=3 ) {
|
||||
@@ -289,7 +289,7 @@ video_write(void)
|
||||
int len;
|
||||
|
||||
len = POP();
|
||||
addr = (char *)POP();
|
||||
addr = (char *)cell2pointer(POP());
|
||||
|
||||
console_draw_fstr(addr, len);
|
||||
PUSH(len);
|
||||
|
||||
Reference in New Issue
Block a user