Generate a fault when a privileged PAL call is
executed in non-privileged (non-PAL) mode. --HG-- extra : convert_revision : c8823a1eec27d801a1ed6110ade07354c4dd2a32
This commit is contained in:
parent
37a718e45e
commit
f13509e968
1 changed files with 18 additions and 11 deletions
|
@ -1399,6 +1399,7 @@ declare {{
|
||||||
protected:
|
protected:
|
||||||
int palFunc; ///< Function code part of instruction
|
int palFunc; ///< Function code part of instruction
|
||||||
int palOffset; ///< Target PC, offset from IPR_PAL_BASE
|
int palOffset; ///< Target PC, offset from IPR_PAL_BASE
|
||||||
|
bool palPriv; ///< is this call privileged?
|
||||||
|
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
CallPalBase(const char *mnem, MachInst _machInst,
|
CallPalBase(const char *mnem, MachInst _machInst,
|
||||||
|
@ -1406,7 +1407,7 @@ declare {{
|
||||||
: AlphaStaticInst(mnem, _machInst, __opClass),
|
: AlphaStaticInst(mnem, _machInst, __opClass),
|
||||||
palFunc(PALFUNC)
|
palFunc(PALFUNC)
|
||||||
{
|
{
|
||||||
int palPriv = ((machInst & 0x80) != 0);
|
palPriv = ((machInst & 0x80) != 0);
|
||||||
int shortPalFunc = (machInst & 0x3f);
|
int shortPalFunc = (machInst & 0x3f);
|
||||||
palOffset = 0x2001 + (palPriv << 12) + (shortPalFunc << 6);
|
palOffset = 0x2001 + (palPriv << 12) + (shortPalFunc << 6);
|
||||||
}
|
}
|
||||||
|
@ -2352,6 +2353,11 @@ decode OPCODE default Unknown::unknown() {
|
||||||
|
|
||||||
#ifdef FULL_SYSTEM
|
#ifdef FULL_SYSTEM
|
||||||
0x00: CallPal::call_pal({{
|
0x00: CallPal::call_pal({{
|
||||||
|
if (palPriv && !PC_PAL(xc->regs.pc)) {
|
||||||
|
// attempt to do privileged PAL call in non-PAL mode
|
||||||
|
fault = Unimplemented_Opcode_Fault;
|
||||||
|
}
|
||||||
|
else {
|
||||||
// check to see if simulator wants to do something special
|
// check to see if simulator wants to do something special
|
||||||
// on this PAL call (including maybe suppress it)
|
// on this PAL call (including maybe suppress it)
|
||||||
bool dopal = xc->simPalCheck(palFunc);
|
bool dopal = xc->simPalCheck(palFunc);
|
||||||
|
@ -2367,6 +2373,7 @@ decode OPCODE default Unknown::unknown() {
|
||||||
xc->setIpr(AlphaISA::IPR_EXC_ADDR, NPC);
|
xc->setIpr(AlphaISA::IPR_EXC_ADDR, NPC);
|
||||||
NPC = xc->readIpr(AlphaISA::IPR_PAL_BASE, fault) + palOffset;
|
NPC = xc->readIpr(AlphaISA::IPR_PAL_BASE, fault) + palOffset;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}});
|
}});
|
||||||
#else
|
#else
|
||||||
0x00: decode PALFUNC {
|
0x00: decode PALFUNC {
|
||||||
|
|
Loading…
Reference in a new issue