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:
parent
bdca260795
commit
ca62070b69
6 changed files with 28 additions and 6 deletions
13
ChangeLog
13
ChangeLog
|
@ -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>
|
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/grub-mkrawimage.c (main): Call set_program_name.
|
* util/grub-mkrawimage.c (main): Call set_program_name.
|
||||||
|
|
|
@ -241,7 +241,7 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
pos = sector * 512UL;
|
pos = sector * 512UL;
|
||||||
|
|
||||||
grub_ieee1275_seek ((grub_ieee1275_ihandle_t) (unsigned long) disk->data,
|
grub_ieee1275_seek ((grub_ieee1275_ihandle_t) (unsigned long) disk->data,
|
||||||
(int) (pos >> 32), (int) pos & 0xFFFFFFFFUL, &status);
|
pos, &status);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return grub_error (GRUB_ERR_READ_ERROR,
|
return grub_error (GRUB_ERR_READ_ERROR,
|
||||||
"seek error, can't seek block %llu",
|
"seek error, can't seek block %llu",
|
||||||
|
|
|
@ -138,7 +138,7 @@ int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
|
||||||
void *buffer, grub_size_t len,
|
void *buffer, grub_size_t len,
|
||||||
grub_ssize_t *actualp);
|
grub_ssize_t *actualp);
|
||||||
int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle,
|
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);
|
grub_ssize_t *result);
|
||||||
int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node,
|
int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node,
|
||||||
grub_ieee1275_phandle_t *result);
|
grub_ieee1275_phandle_t *result);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
|
||||||
|
#define GRUB_IEEE1275_CELL_SIZEOF 4
|
||||||
typedef grub_uint32_t grub_ieee1275_cell_t;
|
typedef grub_uint32_t grub_ieee1275_cell_t;
|
||||||
|
|
||||||
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
|
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
|
||||||
|
#define GRUB_IEEE1275_CELL_SIZEOF 8
|
||||||
typedef grub_uint64_t grub_ieee1275_cell_t;
|
typedef grub_uint64_t grub_ieee1275_cell_t;
|
||||||
|
|
||||||
/* Encoding of 'mode' argument to grub_ieee1275_map_physical() */
|
/* Encoding of 'mode' argument to grub_ieee1275_map_physical() */
|
||||||
|
|
|
@ -284,8 +284,8 @@ grub_ieee1275_read (grub_ieee1275_ihandle_t ihandle, void *buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_ieee1275_seek (grub_ieee1275_ihandle_t ihandle, int pos_hi,
|
grub_ieee1275_seek (grub_ieee1275_ihandle_t ihandle, grub_disk_addr_t pos,
|
||||||
int pos_lo, grub_ssize_t *result)
|
grub_ssize_t *result)
|
||||||
{
|
{
|
||||||
struct write_args
|
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);
|
INIT_IEEE1275_COMMON (&args.common, "seek", 3, 1);
|
||||||
args.ihandle = ihandle;
|
args.ihandle = ihandle;
|
||||||
args.pos_hi = (grub_ieee1275_cell_t) pos_hi;
|
/* To prevent stupid gcc warning. */
|
||||||
args.pos_lo = (grub_ieee1275_cell_t) pos_lo;
|
#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)
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue