From 1359b6a4bcc9f37ab8d550cd960bfa6bd9a86a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 5 Apr 2018 11:50:23 +0200 Subject: Just note that we are checking endianity automatically --- qtmips_machine/programloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qtmips_machine') diff --git a/qtmips_machine/programloader.cpp b/qtmips_machine/programloader.cpp index f6c2e6d..db16ec5 100644 --- a/qtmips_machine/programloader.cpp +++ b/qtmips_machine/programloader.cpp @@ -28,6 +28,7 @@ ProgramLoader::ProgramLoader(const char *file) { if (this->hdr.e_type != ET_EXEC) throw QTMIPS_EXCEPTION(Input, "Invalid input file type", ""); // Check elf file architecture, of course only mips is supported. + // Note: This also checks that this is big endian as EM_MIPS is suppose to be: MIPS R3000 big-endian if (this->hdr.e_machine != EM_MIPS) throw QTMIPS_EXCEPTION(Input, "Invalid input file architecture", ""); // Check elf file class, only 32bit architecture is supported. @@ -36,7 +37,6 @@ ProgramLoader::ProgramLoader(const char *file) { throw QTMIPS_EXCEPTION(Input, "Getting elf class failed", elf_errmsg(-1)); if (elf_class != ELFCLASS32) throw QTMIPS_EXCEPTION(Input, "Only supported architecture is 32bit", ""); - // TODO We should check in what endianity elf file is coded in // Get number of program sections in elf file if (elf_getphdrnum(this->elf, &this->n_secs)) -- cgit v1.2.3