1/* 2 * Copyright (c) 2007 The Hewlett-Packard Development Company 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 38 unchanged lines hidden (view full) --- 47#include "cpu/thread_context.hh" 48#include "debug/Faults.hh" 49#include "sim/full_system.hh" 50 51namespace X86ISA 52{ 53 void X86FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst) 54 { |
55 if (!FullSystem) { 56 FaultBase::invoke(tc, inst); 57 return; 58 } 59 60 PCState pcState = tc->pcState(); 61 Addr pc = pcState.pc(); 62 DPRINTF(Faults, "RIP %#x: vector %d: %s\n", 63 pc, vector, describe()); 64 using namespace X86ISAInst::RomLabels; 65 HandyM5Reg m5reg = tc->readMiscRegNoEffect(MISCREG_M5_REG); 66 MicroPC entry; 67 if (m5reg.mode == LongMode) { 68 if (isSoft()) { 69 entry = extern_label_longModeSoftInterrupt; |
70 } else { |
71 entry = extern_label_longModeInterrupt; |
72 } |
73 } else { |
74 entry = extern_label_legacyModeInterrupt; |
75 } |
76 tc->setIntReg(INTREG_MICRO(1), vector); 77 tc->setIntReg(INTREG_MICRO(7), pc); 78 if (errorCode != (uint64_t)(-1)) { 79 if (m5reg.mode == LongMode) { 80 entry = extern_label_longModeInterruptWithError; 81 } else { 82 panic("Legacy mode interrupts with error codes " 83 "aren't implementde.\n"); 84 } 85 // Software interrupts shouldn't have error codes. If one 86 // does, there would need to be microcode to set it up. 87 assert(!isSoft()); 88 tc->setIntReg(INTREG_MICRO(15), errorCode); 89 } 90 pcState.upc(romMicroPC(entry)); 91 pcState.nupc(romMicroPC(entry) + 1); 92 tc->pcState(pcState); |
93 } 94 95 std::string 96 X86FaultBase::describe() const 97 { 98 std::stringstream ss; 99 ccprintf(ss, "%s", mnemonic()); 100 if (errorCode != (uint64_t)(-1)) { 101 ccprintf(ss, "(%#x)", errorCode); 102 } 103 104 return ss.str(); 105 } 106 107 void X86Trap::invoke(ThreadContext * tc, StaticInstPtr inst) 108 { 109 X86FaultBase::invoke(tc); |
110 if (!FullSystem) 111 return; 112 113 // This is the same as a fault, but it happens -after- the 114 // instruction. 115 PCState pc = tc->pcState(); 116 pc.uEnd(); |
117 } 118 119 void X86Abort::invoke(ThreadContext * tc, StaticInstPtr inst) 120 { 121 panic("Abort exception!"); 122 } 123 124 void --- 174 unchanged lines hidden --- |