aout_object.cc (8232:b28d06a175be) aout_object.cc (10880:61a56f76222b)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 25 unchanged lines hidden (view full) ---

34#include "base/loader/exec_aout.h"
35#include "base/loader/symtab.hh"
36#include "base/trace.hh"
37#include "debug/Loader.hh"
38
39using namespace std;
40
41ObjectFile *
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 25 unchanged lines hidden (view full) ---

34#include "base/loader/exec_aout.h"
35#include "base/loader/symtab.hh"
36#include "base/trace.hh"
37#include "debug/Loader.hh"
38
39using namespace std;
40
41ObjectFile *
42AoutObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
42AoutObject::tryFile(const string &fname, size_t len, uint8_t *data)
43{
44 if (!N_BADMAG(*(aout_exechdr *)data)) {
45 // right now this is only used for Alpha PAL code
43{
44 if (!N_BADMAG(*(aout_exechdr *)data)) {
45 // right now this is only used for Alpha PAL code
46 return new AoutObject(fname, fd, len, data,
46 return new AoutObject(fname, len, data,
47 ObjectFile::Alpha, ObjectFile::UnknownOpSys);
48 }
49 else {
50 return NULL;
51 }
52}
53
54
47 ObjectFile::Alpha, ObjectFile::UnknownOpSys);
48 }
49 else {
50 return NULL;
51 }
52}
53
54
55AoutObject::AoutObject(const string &_filename, int _fd,
55AoutObject::AoutObject(const string &_filename,
56 size_t _len, uint8_t *_data,
57 Arch _arch, OpSys _opSys)
56 size_t _len, uint8_t *_data,
57 Arch _arch, OpSys _opSys)
58 : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys)
58 : ObjectFile(_filename, _len, _data, _arch, _opSys)
59{
60 execHdr = (aout_exechdr *)fileData;
61
62 entry = execHdr->entry;
63
64 text.baseAddr = N_TXTADDR(*execHdr);
65 text.size = execHdr->tsize;
66 text.fileImage = fileData + N_TXTOFF(*execHdr);

--- 28 unchanged lines hidden ---
59{
60 execHdr = (aout_exechdr *)fileData;
61
62 entry = execHdr->entry;
63
64 text.baseAddr = N_TXTADDR(*execHdr);
65 text.size = execHdr->tsize;
66 text.fileImage = fileData + N_TXTOFF(*execHdr);

--- 28 unchanged lines hidden ---