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>
+
+ 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.
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",
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);
#include <grub/types.h>
+#define GRUB_IEEE1275_CELL_SIZEOF 4
typedef grub_uint32_t grub_ieee1275_cell_t;
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
#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() */
}
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
{
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;