nachos.machine
Class Coff
java.lang.Object
|
+--nachos.machine.Coff
- public final class Coff
- extends Object
A COFF (common object file format) loader.
Constructor Summary |
Coff(OpenFile file)
Load the COFF executable in the specified file. |
Method Summary |
void |
close()
Close the executable file and release any resources allocated by this
loader. |
int |
getEntryPoint()
Return the program entry point. |
int |
getNumSections()
Return the number of sections in the executable. |
CoffSection |
getSection(int sectionNumber)
Return an object that can be used to access the specified section. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Coff
public Coff(OpenFile file)
throws EOFException
- Load the COFF executable in the specified file.
Notes:
- If the constructor returns successfully, the file becomes the
property of this loader, and should not be accessed any further.
- The autograder expects this loader class to be used. Do not load
sections through any other mechanism.
- This loader will verify that the file is backed by a file system,
by asserting that read() operations take non-zero simulated time to
complete. Do not supply a file backed by a simulated cache (the primary
purpose of this restriction is to prevent sections from being loaded
instantaneously while handling page faults).
- Parameters:
file
- the file containing the executable.- Throws:
- EOFException - if the executable is corrupt.
getNumSections
public int getNumSections()
- Return the number of sections in the executable.
- Returns:
- the number of sections in the executable.
getSection
public CoffSection getSection(int sectionNumber)
- Return an object that can be used to access the specified section. Valid
section numbers include 0 through getNumSections() -
1.
- Parameters:
section
- the section to select.- Returns:
- an object that can be used to access the specified section.
getEntryPoint
public int getEntryPoint()
- Return the program entry point. This is the value that to which the PC
register should be initialized to before running the program.
- Returns:
- the program entry point.
close
public void close()
- Close the executable file and release any resources allocated by this
loader.