X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2Futil%2FELF.java;fp=src%2Forg%2Fxwt%2Fmips%2FELF.java;h=9d4c86262c51b1128f2085a537cf9c933d4ab97a;hp=18698f20e58776891d173469d2b928a7d072d3b7;hb=c2b2704764af1ade923ba8f15d517b87f9d16189;hpb=90f1aff73ed698ab5992fbd7eb53c1ba7329b1a5 diff --git a/src/org/xwt/mips/ELF.java b/src/org/ibex/nestedvm/util/ELF.java similarity index 97% rename from src/org/xwt/mips/ELF.java rename to src/org/ibex/nestedvm/util/ELF.java index 18698f2..9d4c862 100644 --- a/src/org/xwt/mips/ELF.java +++ b/src/org/ibex/nestedvm/util/ELF.java @@ -1,10 +1,9 @@ -package org.xwt.mips; +package org.ibex.nestedvm.util; -import org.xwt.mips.util.*; import java.io.*; public class ELF { - private SeekableData data; + private Seekable data; public ELFIdent ident; public ELFHeader header; @@ -74,10 +73,10 @@ public class ELF { public byte abiversion; ELFIdent() throws IOException { - if(readIntBE() != ELF_MAGIC) throw new ELFException("Bad Magic (is: " ); + if(readIntBE() != ELF_MAGIC) throw new ELFException("Bad Magic"); klass = readByte(); - if(klass != ELFCLASS32) throw new ELFException("org.xwt.mips.ELF does not suport 64-bit binaries"); + if(klass != ELFCLASS32) throw new ELFException("org.ibex.nestedvm.util.ELF does not suport 64-bit binaries"); data = readByte(); if(data != ELFDATA2LSB && data != ELFDATA2MSB) throw new ELFException("Unknown byte order"); @@ -202,8 +201,8 @@ public class ELF { public boolean isBSS() { return name.equals(".bss") || name.equals(".sbss"); } } - public ELF(String file) throws IOException, ELFException { this(new SeekableFile(file,false)); } - public ELF(SeekableData data) throws IOException, ELFException { + public ELF(String file) throws IOException, ELFException { this(new Seekable.File(file,false)); } + public ELF(Seekable data) throws IOException, ELFException { this.data = data; ident = new ELFIdent(); header = new ELFHeader(); @@ -348,7 +347,7 @@ public class ELF { private static String toHex(int n) { return "0x" + Long.toString(n & 0xffffffffL, 16); } public static void main(String[] args) throws IOException { - ELF elf = new ELF(new SeekableInputStream(new FileInputStream(args[0]))); + ELF elf = new ELF(new Seekable.InputStream(new FileInputStream(args[0]))); System.out.println("Type: " + toHex(elf.header.type)); System.out.println("Machine: " + toHex(elf.header.machine)); System.out.println("Entry: " + toHex(elf.header.entry));