nachos.machine
Class CoffSection
java.lang.Object
|
+--nachos.machine.CoffSection
- public class CoffSection
- extends Object
A CoffSection manages a single section within a COFF executable.
Field Summary |
static int |
headerLength
The length of a COFF section header. |
Constructor Summary |
CoffSection(OpenFile file,
int headerOffset)
Load a COFF section from an executable. |
Method Summary |
int |
getFirstVPN()
Return the first virtual page number used by this section. |
int |
getLength()
Return the length of this section in pages. |
String |
getName()
Return the name of this section. |
boolean |
isInitialzed()
Test whether this section is initialized. |
boolean |
isReadOnly()
Test whether this section is read-only. |
void |
loadPage(int spn,
int ppn)
Load a page from this segment into physical memory. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
headerLength
public static final int headerLength
- The length of a COFF section header.
CoffSection
public CoffSection(OpenFile file,
int headerOffset)
throws EOFException
- Load a COFF section from an executable.
- Parameters:
file
- the file containing the executable.headerOffset
- the offset of the section header in the
executable.- Throws:
- EOFException - if an error occurs.
getName
public String getName()
- Return the name of this section.
- Returns:
- the name of this section.
isReadOnly
public boolean isReadOnly()
- Test whether this section is read-only.
- Returns:
- true if this section should never be written.
isInitialzed
public boolean isInitialzed()
- Test whether this section is initialized. Loading a page from an
initialized section requires a disk access, while loading a page from an
uninitialized section requires only zero-filling the page.
- Returns:
- true if this section contains initialized data in the
executable.
getLength
public int getLength()
- Return the length of this section in pages.
- Returns:
- the number of pages in this section.
getFirstVPN
public int getFirstVPN()
- Return the first virtual page number used by this section.
- Returns:
- the first virtual page number used by this section.
loadPage
public void loadPage(int spn,
int ppn)
- Load a page from this segment into physical memory.
- Parameters:
spn
- the page number within this segment.ppn
- the physical page to load into.- Returns:
- true if successful.