ev5.cc revision 2654:9559cfa91b9d
12SN/A/*
21762SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
32SN/A * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu */
282665Ssaidi@eecs.umich.edu
292665Ssaidi@eecs.umich.edu#include "arch/alpha/tlb.hh"
302665Ssaidi@eecs.umich.edu#include "arch/alpha/isa_traits.hh"
312SN/A#include "arch/alpha/osfpal.hh"
322SN/A#include "base/kgdb.h"
332623SN/A#include "base/remote_gdb.hh"
342623SN/A#include "base/stats/events.hh"
352SN/A#include "config/full_system.hh"
361354SN/A#include "cpu/base.hh"
371858SN/A#include "cpu/cpu_exec_context.hh"
381717SN/A#include "cpu/exec_context.hh"
392683Sktlim@umich.edu#include "kern/kernel_stats.hh"
401354SN/A#include "sim/debug.hh"
411717SN/A#include "sim/sim_events.hh"
421354SN/A
432387SN/A#if FULL_SYSTEM
442387SN/A
452387SN/Ausing namespace EV5;
4656SN/A
472SN/A////////////////////////////////////////////////////////////////////////
482SN/A//
491858SN/A//  Machine dependent functions
502SN/A//
51676SN/Avoid
52676SN/AAlphaISA::initCPU(ExecContext *xc, int cpuId)
532462SN/A{
542SN/A    initIPRs(xc, cpuId);
552SN/A
562SN/A    xc->setIntReg(16, cpuId);
57715SN/A    xc->setIntReg(0, cpuId);
58715SN/A
59715SN/A    xc->setPC(xc->readMiscReg(IPR_PAL_BASE) + (new ResetFault)->vect());
60715SN/A    xc->setNextPC(xc->readPC() + sizeof(MachInst));
61715SN/A}
622SN/A
632SN/A////////////////////////////////////////////////////////////////////////
642680Sktlim@umich.edu//
65237SN/A//
662SN/A//
672SN/Avoid
682SN/AAlphaISA::initIPRs(ExecContext *xc, int cpuId)
692SN/A{
702SN/A    for (int i = 0; i < NumInternalProcRegs; ++i) {
712420SN/A        xc->setMiscReg(i, 0);
722623SN/A    }
732SN/A
742107SN/A    xc->setMiscReg(IPR_PAL_BASE, PalBase);
752107SN/A    xc->setMiscReg(IPR_MCSR, 0x6);
762159SN/A    xc->setMiscReg(IPR_PALtemp16, cpuId);
772455SN/A}
782455SN/A
792386SN/A
802499SN/Atemplate <class CPU>
812386SN/Avoid
822623SN/AAlphaISA::processInterrupts(CPU *cpu)
832SN/A{
841371SN/A    //Check if there are any outstanding interrupts
852SN/A    //Handle the interrupts
862SN/A    int ipl = 0;
872SN/A    int summary = 0;
882SN/A
892SN/A    cpu->checkInterrupts = false;
902SN/A
912SN/A    if (cpu->readMiscReg(IPR_ASTRR))
922SN/A        panic("asynchronous traps not implemented\n");
932SN/A
942SN/A    if (cpu->readMiscReg(IPR_SIRR)) {
952SN/A        for (int i = INTLEVEL_SOFTWARE_MIN;
961400SN/A             i < INTLEVEL_SOFTWARE_MAX; i++) {
971400SN/A            if (cpu->readMiscReg(IPR_SIRR) & (ULL(1) << i)) {
981400SN/A                // See table 4-19 of the 21164 hardware reference
992542SN/A                ipl = (i - INTLEVEL_SOFTWARE_MIN) + 1;
1001858SN/A                summary |= (ULL(1) << i);
1011400SN/A            }
1021400SN/A        }
1032SN/A    }
1041400SN/A
1052SN/A    uint64_t interrupts = cpu->intr_status();
1061400SN/A
1072623SN/A    if (interrupts) {
1082623SN/A        for (int i = INTLEVEL_EXTERNAL_MIN;
1092SN/A             i < INTLEVEL_EXTERNAL_MAX; i++) {
1101400SN/A            if (interrupts & (ULL(1) << i)) {
1112683Sktlim@umich.edu                // See table 4-19 of the 21164 hardware reference
1122683Sktlim@umich.edu                ipl = i;
1132190SN/A                summary |= (ULL(1) << i);
1142683Sktlim@umich.edu            }
1152683Sktlim@umich.edu        }
1162683Sktlim@umich.edu    }
1172680Sktlim@umich.edu
1182SN/A    if (ipl && ipl > cpu->readMiscReg(IPR_IPLR)) {
1191858SN/A        cpu->setMiscReg(IPR_ISR, summary);
1202SN/A        cpu->setMiscReg(IPR_INTID, ipl);
1212SN/A        cpu->trap(new InterruptFault);
1222SN/A        DPRINTF(Flow, "Interrupt! IPLR=%d ipl=%d summary=%x\n",
1232SN/A                cpu->readMiscReg(IPR_IPLR), ipl, summary);
1242SN/A    }
1252SN/A
1262SN/A}
1272SN/A
1282566SN/Atemplate <class CPU>
1292566SN/Avoid
1302566SN/AAlphaISA::zeroRegisters(CPU *cpu)
1311492SN/A{
1321492SN/A    // Insure ISA semantics
1331492SN/A    // (no longer very clean due to the change in setIntReg() in the
1341752SN/A    // cpu model.  Consider changing later.)
1351492SN/A    cpu->cpuXC->setIntReg(ZeroReg, 0);
1362107SN/A    cpu->cpuXC->setFloatReg(ZeroReg, 0.0);
1371469SN/A}
1382623SN/A
1392662Sstever@eecs.umich.eduFault
1402623SN/ACPUExecContext::hwrei()
1412623SN/A{
1422623SN/A    if (!inPalMode())
143180SN/A        return new UnimplementedOpcodeFault;
144393SN/A
145393SN/A    setNextPC(readMiscReg(AlphaISA::IPR_EXC_ADDR));
1462SN/A
1472SN/A    if (!misspeculating()) {
148334SN/A        if (kernelStats)
149334SN/A            kernelStats->hwrei();
1502SN/A
1512SN/A        cpu->checkInterrupts = true;
1522SN/A    }
153334SN/A
154729SN/A    // FIXME: XXX check for interrupts? XXX
155707SN/A    return NoFault;
156707SN/A}
157707SN/A
158707SN/Aint
159707SN/AAlphaISA::MiscRegFile::getInstAsid()
1602SN/A{
1612SN/A    return EV5::ITB_ASN_ASN(ipr[IPR_ITB_ASN]);
162729SN/A}
1632SN/A
164124SN/Aint
165124SN/AAlphaISA::MiscRegFile::getDataAsid()
166334SN/A{
167124SN/A    return EV5::DTB_ASN_ASN(ipr[IPR_DTB_ASN]);
1682SN/A}
169729SN/A
170729SN/AAlphaISA::MiscReg
1712SN/AAlphaISA::MiscRegFile::readIpr(int idx, Fault &fault, ExecContext *xc)
1722390SN/A{
173729SN/A    uint64_t retval = 0;	// return value, default 0
1742SN/A
1752SN/A    switch (idx) {
1762390SN/A      case AlphaISA::IPR_PALtemp0:
1772390SN/A      case AlphaISA::IPR_PALtemp1:
1782390SN/A      case AlphaISA::IPR_PALtemp2:
1792390SN/A      case AlphaISA::IPR_PALtemp3:
1802390SN/A      case AlphaISA::IPR_PALtemp4:
181729SN/A      case AlphaISA::IPR_PALtemp5:
1822SN/A      case AlphaISA::IPR_PALtemp6:
1832SN/A      case AlphaISA::IPR_PALtemp7:
1842390SN/A      case AlphaISA::IPR_PALtemp8:
1852390SN/A      case AlphaISA::IPR_PALtemp9:
1862390SN/A      case AlphaISA::IPR_PALtemp10:
1872390SN/A      case AlphaISA::IPR_PALtemp11:
188217SN/A      case AlphaISA::IPR_PALtemp12:
189237SN/A      case AlphaISA::IPR_PALtemp13:
1902SN/A      case AlphaISA::IPR_PALtemp14:
1911371SN/A      case AlphaISA::IPR_PALtemp15:
1921371SN/A      case AlphaISA::IPR_PALtemp16:
1932623SN/A      case AlphaISA::IPR_PALtemp17:
1942623SN/A      case AlphaISA::IPR_PALtemp18:
1951371SN/A      case AlphaISA::IPR_PALtemp19:
196581SN/A      case AlphaISA::IPR_PALtemp20:
1972SN/A      case AlphaISA::IPR_PALtemp21:
1982SN/A      case AlphaISA::IPR_PALtemp22:
1992SN/A      case AlphaISA::IPR_PALtemp23:
2002SN/A      case AlphaISA::IPR_PAL_BASE:
201753SN/A
2022SN/A      case AlphaISA::IPR_IVPTBR:
2032SN/A      case AlphaISA::IPR_DC_MODE:
2042SN/A      case AlphaISA::IPR_MAF_MODE:
205594SN/A      case AlphaISA::IPR_ISR:
206595SN/A      case AlphaISA::IPR_EXC_ADDR:
207594SN/A      case AlphaISA::IPR_IC_PERR_STAT:
208595SN/A      case AlphaISA::IPR_DC_PERR_STAT:
209705SN/A      case AlphaISA::IPR_MCSR:
210726SN/A      case AlphaISA::IPR_ASTRR:
211726SN/A      case AlphaISA::IPR_ASTER:
212726SN/A      case AlphaISA::IPR_SIRR:
213726SN/A      case AlphaISA::IPR_ICSR:
214726SN/A      case AlphaISA::IPR_ICM:
215726SN/A      case AlphaISA::IPR_DTB_CM:
216726SN/A      case AlphaISA::IPR_IPLR:
217726SN/A      case AlphaISA::IPR_INTID:
218726SN/A      case AlphaISA::IPR_PMCTR:
219726SN/A        // no side-effect
220705SN/A        retval = ipr[idx];
2212107SN/A        break;
222726SN/A
2232683Sktlim@umich.edu      case AlphaISA::IPR_CC:
224726SN/A        retval |= ipr[idx] & ULL(0xffffffff00000000);
225705SN/A        retval |= xc->getCpuPtr()->curCycle()  & ULL(0x00000000ffffffff);
2262455SN/A        break;
227726SN/A
228726SN/A      case AlphaISA::IPR_VA:
2292683Sktlim@umich.edu        retval = ipr[idx];
230726SN/A        break;
231705SN/A
2322455SN/A      case AlphaISA::IPR_VA_FORM:
233726SN/A      case AlphaISA::IPR_MM_STAT:
234726SN/A      case AlphaISA::IPR_IFAULT_VA_FORM:
2352683Sktlim@umich.edu      case AlphaISA::IPR_EXC_MASK:
236726SN/A      case AlphaISA::IPR_EXC_SUM:
237705SN/A        retval = ipr[idx];
2382455SN/A        break;
239726SN/A
240726SN/A      case AlphaISA::IPR_DTB_PTE:
2412683Sktlim@umich.edu        {
2422455SN/A            AlphaISA::PTE &pte = xc->getDTBPtr()->index(!xc->misspeculating());
2432455SN/A
2442455SN/A            retval |= ((u_int64_t)pte.ppn & ULL(0x7ffffff)) << 32;
2452455SN/A            retval |= ((u_int64_t)pte.xre & ULL(0xf)) << 8;
2462455SN/A            retval |= ((u_int64_t)pte.xwe & ULL(0xf)) << 12;
2472683Sktlim@umich.edu            retval |= ((u_int64_t)pte.fonr & ULL(0x1)) << 1;
248726SN/A            retval |= ((u_int64_t)pte.fonw & ULL(0x1))<< 2;
249705SN/A            retval |= ((u_int64_t)pte.asma & ULL(0x1)) << 4;
2502107SN/A            retval |= ((u_int64_t)pte.asn & ULL(0x7f)) << 57;
251726SN/A        }
2522683Sktlim@umich.edu        break;
253726SN/A
254705SN/A        // write only registers
2552455SN/A      case AlphaISA::IPR_HWINT_CLR:
256726SN/A      case AlphaISA::IPR_SL_XMIT:
257726SN/A      case AlphaISA::IPR_DC_FLUSH:
2582683Sktlim@umich.edu      case AlphaISA::IPR_IC_FLUSH:
259726SN/A      case AlphaISA::IPR_ALT_MODE:
260705SN/A      case AlphaISA::IPR_DTB_IA:
2612455SN/A      case AlphaISA::IPR_DTB_IAP:
262726SN/A      case AlphaISA::IPR_ITB_IA:
263726SN/A      case AlphaISA::IPR_ITB_IAP:
2642683Sktlim@umich.edu        fault = new UnimplementedOpcodeFault;
265726SN/A        break;
266726SN/A
2672455SN/A      default:
2682577SN/A        // invalid IPR
269726SN/A        fault = new UnimplementedOpcodeFault;
270726SN/A        break;
2712683Sktlim@umich.edu    }
2722455SN/A
2732455SN/A    return retval;
2742455SN/A}
2752455SN/A
2762455SN/A#ifdef DEBUG
2772683Sktlim@umich.edu// Cause the simulator to break when changing to the following IPL
278726SN/Aint break_ipl = -1;
279705SN/A#endif
2802683Sktlim@umich.edu
2812683Sktlim@umich.eduFault
2822683Sktlim@umich.eduAlphaISA::MiscRegFile::setIpr(int idx, uint64_t val, ExecContext *xc)
2832447SN/A{
2842683Sktlim@umich.edu    uint64_t old;
2852683Sktlim@umich.edu
2862683Sktlim@umich.edu    if (xc->misspeculating())
287705SN/A        return NoFault;
2882159SN/A
2892159SN/A    switch (idx) {
2902683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp0:
2912159SN/A      case AlphaISA::IPR_PALtemp1:
292705SN/A      case AlphaISA::IPR_PALtemp2:
2932159SN/A      case AlphaISA::IPR_PALtemp3:
2942159SN/A      case AlphaISA::IPR_PALtemp4:
2952683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp5:
2962159SN/A      case AlphaISA::IPR_PALtemp6:
2972159SN/A      case AlphaISA::IPR_PALtemp7:
2982159SN/A      case AlphaISA::IPR_PALtemp8:
2992159SN/A      case AlphaISA::IPR_PALtemp9:
3002683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp10:
3012159SN/A      case AlphaISA::IPR_PALtemp11:
3022159SN/A      case AlphaISA::IPR_PALtemp12:
3032159SN/A      case AlphaISA::IPR_PALtemp13:
3042159SN/A      case AlphaISA::IPR_PALtemp14:
3052683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp15:
3062159SN/A      case AlphaISA::IPR_PALtemp16:
307705SN/A      case AlphaISA::IPR_PALtemp17:
3081858SN/A      case AlphaISA::IPR_PALtemp18:
3092683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp19:
3102683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp20:
3112683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp21:
3122683Sktlim@umich.edu      case AlphaISA::IPR_PALtemp22:
3132680Sktlim@umich.edu      case AlphaISA::IPR_PAL_BASE:
3142683Sktlim@umich.edu      case AlphaISA::IPR_IC_PERR_STAT:
315705SN/A      case AlphaISA::IPR_DC_PERR_STAT:
3162683Sktlim@umich.edu      case AlphaISA::IPR_PMCTR:
317705SN/A        // write entire quad w/ no side-effect
318705SN/A        ipr[idx] = val;
3192683Sktlim@umich.edu        break;
3202680Sktlim@umich.edu
3212SN/A      case AlphaISA::IPR_CC_CTL:
3222SN/A        // This IPR resets the cycle counter.  We assume this only
3232623SN/A        // happens once... let's verify that.
324        assert(ipr[idx] == 0);
325        ipr[idx] = 1;
326        break;
327
328      case AlphaISA::IPR_CC:
329        // This IPR only writes the upper 64 bits.  It's ok to write
330        // all 64 here since we mask out the lower 32 in rpcc (see
331        // isa_desc).
332        ipr[idx] = val;
333        break;
334
335      case AlphaISA::IPR_PALtemp23:
336        // write entire quad w/ no side-effect
337        old = ipr[idx];
338        ipr[idx] = val;
339        if (xc->getKernelStats())
340            xc->getKernelStats()->context(old, val, xc);
341        break;
342
343      case AlphaISA::IPR_DTB_PTE:
344        // write entire quad w/ no side-effect, tag is forthcoming
345        ipr[idx] = val;
346        break;
347
348      case AlphaISA::IPR_EXC_ADDR:
349        // second least significant bit in PC is always zero
350        ipr[idx] = val & ~2;
351        break;
352
353      case AlphaISA::IPR_ASTRR:
354      case AlphaISA::IPR_ASTER:
355        // only write least significant four bits - privilege mask
356        ipr[idx] = val & 0xf;
357        break;
358
359      case AlphaISA::IPR_IPLR:
360#ifdef DEBUG
361        if (break_ipl != -1 && break_ipl == (val & 0x1f))
362            debug_break();
363#endif
364
365        // only write least significant five bits - interrupt level
366        ipr[idx] = val & 0x1f;
367        if (xc->getKernelStats())
368            xc->getKernelStats()->swpipl(ipr[idx]);
369        break;
370
371      case AlphaISA::IPR_DTB_CM:
372        if (val & 0x18) {
373            if (xc->getKernelStats())
374                xc->getKernelStats()->mode(Kernel::user, xc);
375        } else {
376            if (xc->getKernelStats())
377                xc->getKernelStats()->mode(Kernel::kernel, xc);
378        }
379
380      case AlphaISA::IPR_ICM:
381        // only write two mode bits - processor mode
382        ipr[idx] = val & 0x18;
383        break;
384
385      case AlphaISA::IPR_ALT_MODE:
386        // only write two mode bits - processor mode
387        ipr[idx] = val & 0x18;
388        break;
389
390      case AlphaISA::IPR_MCSR:
391        // more here after optimization...
392        ipr[idx] = val;
393        break;
394
395      case AlphaISA::IPR_SIRR:
396        // only write software interrupt mask
397        ipr[idx] = val & 0x7fff0;
398        break;
399
400      case AlphaISA::IPR_ICSR:
401        ipr[idx] = val & ULL(0xffffff0300);
402        break;
403
404      case AlphaISA::IPR_IVPTBR:
405      case AlphaISA::IPR_MVPTBR:
406        ipr[idx] = val & ULL(0xffffffffc0000000);
407        break;
408
409      case AlphaISA::IPR_DC_TEST_CTL:
410        ipr[idx] = val & 0x1ffb;
411        break;
412
413      case AlphaISA::IPR_DC_MODE:
414      case AlphaISA::IPR_MAF_MODE:
415        ipr[idx] = val & 0x3f;
416        break;
417
418      case AlphaISA::IPR_ITB_ASN:
419        ipr[idx] = val & 0x7f0;
420        break;
421
422      case AlphaISA::IPR_DTB_ASN:
423        ipr[idx] = val & ULL(0xfe00000000000000);
424        break;
425
426      case AlphaISA::IPR_EXC_SUM:
427      case AlphaISA::IPR_EXC_MASK:
428        // any write to this register clears it
429        ipr[idx] = 0;
430        break;
431
432      case AlphaISA::IPR_INTID:
433      case AlphaISA::IPR_SL_RCV:
434      case AlphaISA::IPR_MM_STAT:
435      case AlphaISA::IPR_ITB_PTE_TEMP:
436      case AlphaISA::IPR_DTB_PTE_TEMP:
437        // read-only registers
438        return new UnimplementedOpcodeFault;
439
440      case AlphaISA::IPR_HWINT_CLR:
441      case AlphaISA::IPR_SL_XMIT:
442      case AlphaISA::IPR_DC_FLUSH:
443      case AlphaISA::IPR_IC_FLUSH:
444        // the following are write only
445        ipr[idx] = val;
446        break;
447
448      case AlphaISA::IPR_DTB_IA:
449        // really a control write
450        ipr[idx] = 0;
451
452        xc->getDTBPtr()->flushAll();
453        break;
454
455      case AlphaISA::IPR_DTB_IAP:
456        // really a control write
457        ipr[idx] = 0;
458
459        xc->getDTBPtr()->flushProcesses();
460        break;
461
462      case AlphaISA::IPR_DTB_IS:
463        // really a control write
464        ipr[idx] = val;
465
466        xc->getDTBPtr()->flushAddr(val,
467                                   DTB_ASN_ASN(ipr[AlphaISA::IPR_DTB_ASN]));
468        break;
469
470      case AlphaISA::IPR_DTB_TAG: {
471          struct AlphaISA::PTE pte;
472
473          // FIXME: granularity hints NYI...
474          if (DTB_PTE_GH(ipr[AlphaISA::IPR_DTB_PTE]) != 0)
475              panic("PTE GH field != 0");
476
477          // write entire quad
478          ipr[idx] = val;
479
480          // construct PTE for new entry
481          pte.ppn = DTB_PTE_PPN(ipr[AlphaISA::IPR_DTB_PTE]);
482          pte.xre = DTB_PTE_XRE(ipr[AlphaISA::IPR_DTB_PTE]);
483          pte.xwe = DTB_PTE_XWE(ipr[AlphaISA::IPR_DTB_PTE]);
484          pte.fonr = DTB_PTE_FONR(ipr[AlphaISA::IPR_DTB_PTE]);
485          pte.fonw = DTB_PTE_FONW(ipr[AlphaISA::IPR_DTB_PTE]);
486          pte.asma = DTB_PTE_ASMA(ipr[AlphaISA::IPR_DTB_PTE]);
487          pte.asn = DTB_ASN_ASN(ipr[AlphaISA::IPR_DTB_ASN]);
488
489          // insert new TAG/PTE value into data TLB
490          xc->getDTBPtr()->insert(val, pte);
491      }
492        break;
493
494      case AlphaISA::IPR_ITB_PTE: {
495          struct AlphaISA::PTE pte;
496
497          // FIXME: granularity hints NYI...
498          if (ITB_PTE_GH(val) != 0)
499              panic("PTE GH field != 0");
500
501          // write entire quad
502          ipr[idx] = val;
503
504          // construct PTE for new entry
505          pte.ppn = ITB_PTE_PPN(val);
506          pte.xre = ITB_PTE_XRE(val);
507          pte.xwe = 0;
508          pte.fonr = ITB_PTE_FONR(val);
509          pte.fonw = ITB_PTE_FONW(val);
510          pte.asma = ITB_PTE_ASMA(val);
511          pte.asn = ITB_ASN_ASN(ipr[AlphaISA::IPR_ITB_ASN]);
512
513          // insert new TAG/PTE value into data TLB
514          xc->getITBPtr()->insert(ipr[AlphaISA::IPR_ITB_TAG], pte);
515      }
516        break;
517
518      case AlphaISA::IPR_ITB_IA:
519        // really a control write
520        ipr[idx] = 0;
521
522        xc->getITBPtr()->flushAll();
523        break;
524
525      case AlphaISA::IPR_ITB_IAP:
526        // really a control write
527        ipr[idx] = 0;
528
529        xc->getITBPtr()->flushProcesses();
530        break;
531
532      case AlphaISA::IPR_ITB_IS:
533        // really a control write
534        ipr[idx] = val;
535
536        xc->getITBPtr()->flushAddr(val,
537                                   ITB_ASN_ASN(ipr[AlphaISA::IPR_ITB_ASN]));
538        break;
539
540      default:
541        // invalid IPR
542        return new UnimplementedOpcodeFault;
543    }
544
545    // no error...
546    return NoFault;
547}
548
549void
550AlphaISA::copyIprs(ExecContext *src, ExecContext *dest)
551{
552    for (int i = IPR_Base_DepTag; i < NumInternalProcRegs; ++i) {
553        dest->setMiscReg(i, src->readMiscReg(i));
554    }
555}
556
557/**
558 * Check for special simulator handling of specific PAL calls.
559 * If return value is false, actual PAL call will be suppressed.
560 */
561bool
562CPUExecContext::simPalCheck(int palFunc)
563{
564    if (kernelStats)
565        kernelStats->callpal(palFunc, proxy);
566
567    switch (palFunc) {
568      case PAL::halt:
569        halt();
570        if (--System::numSystemsRunning == 0)
571            new SimExitEvent("all cpus halted");
572        break;
573
574      case PAL::bpt:
575      case PAL::bugchk:
576        if (system->breakpoint())
577            return false;
578        break;
579    }
580
581    return true;
582}
583
584#endif // FULL_SYSTEM
585