summaryrefslogtreecommitdiff
path: root/arch/alpha/pseudo_inst.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-04-22 13:12:03 -0400
committerNathan Binkert <binkertn@umich.edu>2005-04-22 13:12:03 -0400
commit5a7ee2b4952f8e4fde66a5bb2a50f8afba91b477 (patch)
tree80f020f814829256eb8e0f9991a371778d83bd4b /arch/alpha/pseudo_inst.cc
parent535cfaa01e0234e224e588e753419d8777e22d0b (diff)
downloadgem5-5a7ee2b4952f8e4fde66a5bb2a50f8afba91b477.tar.xz
Make code more portable and port to cygwin
arch/alpha/alpha_tru64_process.cc: getdirent isn't implemented by cygwin. panic if this function is executed. (It shouldn't be too much to emulate it using opendir, readdir, etc.) arch/alpha/pseudo_inst.cc: Use lseek once and read instead pread. base/intmath.hh: we want int, long, and long long variations of FloorLog2 instead of int32_t, int64_t. Otherwise, we leave one out. base/socket.cc: Fix define that seems to be for apple sim/serialize.cc: don't use the intXX_t stuff, instead, use the real types so we're sure that we cover all of them. --HG-- extra : convert_revision : 9fccaff583100b06bbaafd95a162c4e19beed59e
Diffstat (limited to 'arch/alpha/pseudo_inst.cc')
-rw-r--r--arch/alpha/pseudo_inst.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/alpha/pseudo_inst.cc b/arch/alpha/pseudo_inst.cc
index 3c3b37928..a4af891af 100644
--- a/arch/alpha/pseudo_inst.cc
+++ b/arch/alpha/pseudo_inst.cc
@@ -26,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <cstdio>
@@ -180,15 +181,17 @@ namespace AlphaPseudo
if (fd < 0)
panic("could not open file %s\n", file);
+ if (::lseek(fd, offset, SEEK_SET) < 0)
+ panic("could not seek: %s", strerror(errno));
+
char *buf = new char[len];
char *p = buf;
while (len > 0) {
- int bytes = ::pread(fd, p, len, offset);
+ int bytes = ::read(fd, p, len);
if (bytes <= 0)
break;
p += bytes;
- offset += bytes;
result += bytes;
len -= bytes;
}