2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>

Fix over-4GiB seek on sparc64.

	* include/grub/ieee1275/ieee1275.h (grub_ieee1275_seek):
	Replace pos_i and pos_lo with pos. All users updated.
	* include/grub/powerpc/ieee1275/ieee1275.h (GRUB_IEEE1275_CELL_SIZEOF):
	New constant.
	* include/grub/sparc64/ieee1275/ieee1275.h (GRUB_IEEE1275_CELL_SIZEOF):
	Likewise.
	* kern/ieee1275/ieee1275.c (grub_ieee1275_seek): Split pos into pos_hi
	and pos_lo.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-13 16:13:28 +01:00
parent bdca260795
commit ca62070b69
6 changed files with 28 additions and 6 deletions

View File

@ -1,3 +1,16 @@
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
Fix over-4GiB seek on sparc64.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_seek):
Replace pos_i and pos_lo with pos. All users updated.
* include/grub/powerpc/ieee1275/ieee1275.h (GRUB_IEEE1275_CELL_SIZEOF):
New constant.
* include/grub/sparc64/ieee1275/ieee1275.h (GRUB_IEEE1275_CELL_SIZEOF):
Likewise.
* kern/ieee1275/ieee1275.c (grub_ieee1275_seek): Split pos into pos_hi
and pos_lo.
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrawimage.c (main): Call set_program_name.

View File

@ -241,7 +241,7 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
pos = sector * 512UL;
grub_ieee1275_seek ((grub_ieee1275_ihandle_t) (unsigned long) disk->data,
(int) (pos >> 32), (int) pos & 0xFFFFFFFFUL, &status);
pos, &status);
if (status < 0)
return grub_error (GRUB_ERR_READ_ERROR,
"seek error, can't seek block %llu",

View File

@ -138,7 +138,7 @@ int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
void *buffer, grub_size_t len,
grub_ssize_t *actualp);
int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle,
int pos_hi, int pos_lo,
grub_disk_addr_t pos,
grub_ssize_t *result);
int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node,
grub_ieee1275_phandle_t *result);

View File

@ -22,6 +22,7 @@
#include <grub/types.h>
#define GRUB_IEEE1275_CELL_SIZEOF 4
typedef grub_uint32_t grub_ieee1275_cell_t;
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */

View File

@ -22,6 +22,7 @@
#include <grub/types.h>
#define GRUB_IEEE1275_CELL_SIZEOF 8
typedef grub_uint64_t grub_ieee1275_cell_t;
/* Encoding of 'mode' argument to grub_ieee1275_map_physical() */

View File

@ -284,8 +284,8 @@ grub_ieee1275_read (grub_ieee1275_ihandle_t ihandle, void *buffer,
}
int
grub_ieee1275_seek (grub_ieee1275_ihandle_t ihandle, int pos_hi,
int pos_lo, grub_ssize_t *result)
grub_ieee1275_seek (grub_ieee1275_ihandle_t ihandle, grub_disk_addr_t pos,
grub_ssize_t *result)
{
struct write_args
{
@ -299,8 +299,15 @@ grub_ieee1275_seek (grub_ieee1275_ihandle_t ihandle, int pos_hi,
INIT_IEEE1275_COMMON (&args.common, "seek", 3, 1);
args.ihandle = ihandle;
args.pos_hi = (grub_ieee1275_cell_t) pos_hi;
args.pos_lo = (grub_ieee1275_cell_t) pos_lo;
/* To prevent stupid gcc warning. */
#if GRUB_IEEE1275_CELL_SIZEOF >= 8
args.pos_hi = 0;
args.pos_lo = pos;
#else
args.pos_hi = (grub_ieee1275_cell_t) (pos >> (8 * GRUB_IEEE1275_CELL_SIZEOF));
args.pos_lo = (grub_ieee1275_cell_t)
(pos & ((1ULL << (8 * GRUB_IEEE1275_CELL_SIZEOF)) - 1));
#endif
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
return -1;