How to implement an ISA
- 1 arguments.hh
- 2 faults.hh
- 3 interrupts.hh
- 4 isa_traits.hh
- 4.1 MachineBytes
- 4.2 Set endianness
- 4.3 delay slot define
- 4.4 NoopMachInst
- 4.5 DependenceTags
- 4.6 ZeroReg
- 4.7 ABI significant register indices
- 4.8 SyscallPseudoReturnReg
- 4.9 MaxInstSrcRegs
- 4.10 MaxInstDestRegs
- 4.11 LogVMPageSize, VMPageSize
- 4.12 SegKPMEnd SegKPBase
- 4.13 PageShift PageBytes
- 4.14 BranchPredAddrShiftAmt
- 4.15 decodeInst
- 4.16 Full system stuff
- 5 kernel_stats.hh
- 6 locked_mem.hh
- 7 mmaped_ipr.hh
- 8 process.hh
- 9 predecoder.hh
- 10 regfile.hh
- 11 remote_gdb.hh
- 12 stacktrace.hh
- 13 syscallreturn.hh
- 14 tlb.hh
- 15 types.hh
- 16 utility.hh
- 17 vtophys.hh
Move out of isa?
ISA specific fault classes to be used in the ISA.
Functions I'd like to get rid of
Shouldn't be capitalized. Gets a request to set the interrupt level and returns what the interrupt level was actually set to.
Request that an interrupt happen. Like asserting the interrupt line.
Request that an interrupt not happen. Like deasserting a level triggered interrupt line.
Breaks naming convention. Clear all interrupts
Breaks naming convention. Not sure if this is right. Check to see if there are any interrupts pending
Get an interrupt fault object to invoke. The Interrupts object should internally prioritize interrupts so that they are handled in the right order.
Breaks naming convention. Don't remember what this does. Need to find the email from Ali.
Breaks naming convention. Returns the vector which describes the pending(?) interrupts in SPARC which is available as a (memory mapped?) register. This function panics in anything currently implemented other than SPARC, and it breaks the abstraction of the Interrupts object. Its existence allows necessary communication between two ISA specific components but goes through the ISA agnostic cpu. An argument for this function is that the cpu may need to modify the value returned by this function, so it needs to be able to intercept values and change them. This -really- breaks the abstraction of the Interrupts object by forcing the cpu to know what the vector means and what values are appropriate. This function needs to go away.
Functions to serialize and unserialize the state in the Interrupts object.
Not sure if this is right The number of bytes in a machine instruction? If that's the case, this doesn't make sense for x86 and may need to be handled differently.
A "using" directive which selects which endianness conversion functions are available.
delay slot define
A preprocessor define which sets whether that architecture has delay slots. This needs to go away.
A machine instruction which encodes a noop
Offsets which separate the different register types from one another in a flattened indexing space. It would be nice to phase these out.
The integer register which is defined by the architecture to always contain the value zero. Not all ISAs actually have such a register, so this needs to be done differently. This is simultaneously used as the offset of the integer zero register and the floating point zero register. This is correct in Alpha, but SPARC doesn't have a zero floating point register, and not all architectures will necessarily have the same index for both registers.
ABI significant register indices
It's not clear how these should be defined for architectures like x86 which keep some of these values exclusively on the stack.
Second syscall return register
Maybe have the isa parser generate this value? Maximum number of source registers used by any instruction.
Maybe have the isa parser generate this value? Maximum number of destination registers used by any instruction.
Describes the size of a virtual memory page. Where is this used outside of translation? Where is translation not ISA specific? If there is no such place, maybe this should be defined internally to the ISA.
Not sure what these are for. If they only make sense for one ISA or are used only in ISA specific places, they might not need to be part of the ISA interface
Not sure how this is different from VMPageSize and LogVMPageSize respectively.
The number of bits a PC value should be shifted in order to provide a compacted instruction addressing space. This makes no sense for x86 or any other variable instruction width ISA.
Prototype for the decodeInst function. Maybe this should be generated automatically? Not a big deal.
Full system stuff
Yes, a mask for the address used by loads, but to produce an address with what properties and why?
Tlbs are ISA specific, so it's probably a good idea to put these in a new ISA internal header file, or in the existing tlb.hh.
This might belong in sparc_traits.hh (SPARC specific ISA parameters), or in interrupt.hh. There should be an alpha_traits.hh for analogous Alpha specific ISA parameters
Not sure what these do, although I'm sure it has to do with LL/SC.
These are for handling accesses to memory mapped registers. I believe IPR is an Alpha-ism and a different name might be more appropriate. Are these called from anywhere outside of ISA specific code? If not, they should be moved out of the ISA interface.
Need to document exactly what this does and how. Defines an isa specific process object.
These should both be eliminated. A better mechanism should be used to attach a predecoder to a thread context, perhaps just passing one in to relevant functions.
Feed more bytes to the predecoder.
Returns whether or not the predecoder needs more bytes, or in other words, whether you -don't- have left over data to start working with immediately.
Returns whether a whole ExtMachInst has been generated and is ready to be used.
Returns the ExtMachInst the predecoder has generated.
Provide access to the current pc.
Provide access to the next pc.
Provide access to the next NPC. Most relevant for architectures with a delay slot.
Blank register file contents.
Shouldn't be capitalized. Should link to an explanation of this whole system. Turn an architected register index into a canonical one.
Provides access to a misc register without triggering ISA defined side effects.
Provides access to a misc register and triggers ISA defined side effects.
Alpha specificish but hasn't yet been removed.
Provides access to the floating point registers.
Provide access to the floating point registers as an integer. This allows writing/reading floating point values as text without introducing rounding error.
This might not be complete. Need to document these functions.
Class to describe a process? Is this for Alpha's process control blocks? (or whatever those are called)
Should there be an underscore in this file name? Takes the generic SyscallReturn value and a thread context and sets up state as if a syscall was returning the value described by the SyscallReturn.
Looks up a tlb entry. Is this used only internally by the tlb?
Translates a request object
For consistency, maybe these should be called readMmuReg and setMmuReg? Access an mmu control register
Shouldn't be capitalized Is this part of the interface? Should look again.
Typedefs for the following types.
Returns whether a thread context is operating in user mode. "User mode" is a little vague, but not too vague to be useful.
Can these be purged? They don't seem to be used by anything.
What are these used for?
What is this used for? It doesn't make sense for x86 regardless.
Writes zero to the "zero" registers. This really needs to go away, for efficiency's sake if nothing else.
Initialize a cpu to the state it would have immediate after being powered on.
Actually activate a cpu to start "doing something".
Breaks naming convention. What does this do, precisely?
In what context is this supposed to be used? SE? FS? Translates a virtual address to a physical one.