diff options
author | Ruslan Bukin <br@bsdpad.com> | 2015-04-29 22:35:23 -0500 |
---|---|---|
committer | Ruslan Bukin <br@bsdpad.com> | 2015-04-29 22:35:23 -0500 |
commit | 81f3211149c051e4f70b0b12eb3709dfc6e0395c (patch) | |
tree | 9b9d276586b948252ec6a39a2748dbca43fe92d3 /src/base | |
parent | 52a3bc5e5c3cc694b3f8b29f38b0dd296b91350f (diff) | |
download | gem5-81f3211149c051e4f70b0b12eb3709dfc6e0395c.tar.xz |
arch, base, dev, kern, sym: FreeBSD support
This adds support for FreeBSD/aarch64 FS and SE mode (basic set of syscalls only)
Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/loader/elf_object.cc | 16 | ||||
-rw-r--r-- | src/base/loader/object_file.hh | 3 | ||||
-rw-r--r-- | src/base/output.cc | 1 | ||||
-rw-r--r-- | src/base/vnc/vncserver.cc | 12 |
4 files changed, 28 insertions, 4 deletions
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc index 4abf0a432..ed4fee37a 100644 --- a/src/base/loader/elf_object.cc +++ b/src/base/loader/elf_object.cc @@ -150,6 +150,9 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) case ELFOSABI_ARM: opSys = ObjectFile::LinuxArmOABI; break; + case ELFOSABI_FREEBSD: + opSys = ObjectFile::FreeBSD; + break; default: opSys = ObjectFile::UnknownOpSys; } @@ -160,7 +163,8 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) Elf_Scn *section; GElf_Shdr shdr; Elf_Data *data; - uint32_t osAbi;; + uint32_t osAbi; + uint32_t *elem; int secIdx = 1; // Get the first section @@ -194,6 +198,16 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) opSys = ObjectFile::Solaris; if (!strcmp(".stab.index", elf_strptr(elf, ehdr.e_shstrndx, shdr.sh_name))) opSys = ObjectFile::Solaris; + if (shdr.sh_type == SHT_NOTE && !strcmp(".note.tag", + elf_strptr(elf, ehdr.e_shstrndx, shdr.sh_name))) { + data = elf_rawdata(section, NULL); + assert(data->d_buf); + elem = (uint32_t *)data->d_buf; + if (elem[0] == 0x8) { //size of name + if (memcmp((void *)&elem[3], "FreeBSD", 0x8) == 0) + opSys = ObjectFile::FreeBSD; + } + } section = elf_getscn(elf, ++secIdx); } // while sections diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh index 09cde5b53..37f2aa585 100644 --- a/src/base/loader/object_file.hh +++ b/src/base/loader/object_file.hh @@ -63,7 +63,8 @@ class ObjectFile Tru64, Linux, Solaris, - LinuxArmOABI + LinuxArmOABI, + FreeBSD }; protected: diff --git a/src/base/output.cc b/src/base/output.cc index da9a551fa..ce1b49a82 100644 --- a/src/base/output.cc +++ b/src/base/output.cc @@ -32,6 +32,7 @@ #include <sys/stat.h> #include <sys/types.h> #include <dirent.h> +#include <unistd.h> #include <cassert> #include <cerrno> diff --git a/src/base/vnc/vncserver.cc b/src/base/vnc/vncserver.cc index 77a4316ab..6dc2f2f10 100644 --- a/src/base/vnc/vncserver.cc +++ b/src/base/vnc/vncserver.cc @@ -44,16 +44,24 @@ #include <sys/ioctl.h> #include <sys/stat.h> + +#if defined(__FreeBSD__) +#include <termios.h> + +#else #include <sys/termios.h> -#include <sys/types.h> + +#endif +#include "base/vnc/vncserver.hh" + #include <fcntl.h> #include <poll.h> +#include <sys/types.h> #include <unistd.h> #include <cerrno> #include <cstdio> -#include "base/vnc/vncserver.hh" #include "base/atomicio.hh" #include "base/bitmap.hh" #include "base/misc.hh" |