Deleted Added
sdiff udiff text old ( 3585:774b5b26a51a ) new ( 3595:71574f980a5d )
full compact
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 269 unchanged lines hidden (view full) ---

278{
279 //@todo Disable the mmu?
280 //@todo Disable watchpoints?
281 MiscReg HPSTATE = tc->readMiscReg(MISCREG_HPSTATE);
282 //HPSTATE.red = 1
283 HPSTATE |= (1 << 5);
284 //HPSTATE.hpriv = 1
285 HPSTATE |= (1 << 2);
286 tc->setMiscReg(MISCREG_HPSTATE, HPSTATE);
287}
288
289/**
290 * This sets everything up for a RED state trap except for actually jumping to
291 * the handler.
292 */
293
294void doREDFault(ThreadContext *tc, TrapType tt)

--- 191 unchanged lines hidden (view full) ---

486
487 if(changedCWP)
488 {
489 CWP = (CWP + NWindows) % NWindows;
490 tc->setMiscRegWithEffect(MISCREG_CWP, CWP);
491 }
492}
493
494void getREDVector(Addr & PC, Addr & NPC)
495{
496 //XXX The following constant might belong in a header file.
497 const Addr RSTVAddr = 0xFFFFFFFFF0000000ULL;
498 PC = RSTVAddr | 0xA0;
499 NPC = PC + sizeof(MachInst);
500}
501
502void getHyperVector(ThreadContext * tc, Addr & PC, Addr & NPC, MiscReg TT)
503{
504 Addr HTBA = tc->readMiscReg(MISCREG_HTBA);
505 PC = (HTBA & ~mask(14)) | ((TT << 5) & mask(14));
506 NPC = PC + sizeof(MachInst);

--- 7 unchanged lines hidden (view full) ---

514 ((TT << 5) & mask(14));
515 NPC = PC + sizeof(MachInst);
516}
517
518#if FULL_SYSTEM
519
520void SparcFaultBase::invoke(ThreadContext * tc)
521{
522 FaultBase::invoke(tc);
523 countStat()++;
524
525 //We can refer to this to see what the trap level -was-, but something
526 //in the middle could change it in the regfile out from under us.
527 MiscReg TL = tc->readMiscReg(MISCREG_TL);
528 MiscReg TT = tc->readMiscReg(MISCREG_TT);
529 MiscReg PSTATE = tc->readMiscReg(MISCREG_PSTATE);

--- 8 unchanged lines hidden (view full) ---

538 current = Privileged;
539 else
540 current = Hyperprivileged;
541
542 PrivilegeLevel level = getNextLevel(current);
543
544 if(HPSTATE & (1 << 5) || TL == MaxTL - 1)
545 {
546 getREDVector(PC, NPC);
547 enterREDState(tc);
548 doREDFault(tc, TT);
549 }
550 else if(TL == MaxTL)
551 {
552 //Do error_state somehow?
553 //Probably inject a WDR fault using the interrupt mechanism.
554 //What should the PC and NPC be set to?

--- 23 unchanged lines hidden (view full) ---

578void PowerOnReset::invoke(ThreadContext * tc)
579{
580 //First, enter RED state.
581 enterREDState(tc);
582
583 //For SPARC, when a system is first started, there is a power
584 //on reset Trap which sets the processor into the following state.
585 //Bits that aren't set aren't defined on startup.
586 /*
587 tl = MaxTL;
588 gl = MaxGL;
589
590 tickFields.counter = 0; //The TICK register is unreadable bya
591 tickFields.npt = 1; //The TICK register is unreadable by by !priv
592
593 softint = 0; // Clear all the soft interrupt bits
594 tick_cmprFields.int_dis = 1; // disable timer compare interrupts
595 tick_cmprFields.tick_cmpr = 0; // Reset to 0 for pretty printing
596 stickFields.npt = 1; //The TICK register is unreadable by by !priv
597 stick_cmprFields.int_dis = 1; // disable timer compare interrupts
598 stick_cmprFields.tick_cmpr = 0; // Reset to 0 for pretty printing
599
600 tt[tl] = _trapType;
601 pstate = 0; // fields 0 but pef
602 pstateFields.pef = 1;
603
604 hpstate = 0;
605 hpstateFields.red = 1;
606 hpstateFields.hpriv = 1;
607 hpstateFields.tlz = 0; // this is a guess
608 hintp = 0; // no interrupts pending
609 hstick_cmprFields.int_dis = 1; // disable timer compare interrupts
610 hstick_cmprFields.tick_cmpr = 0; // Reset to 0 for pretty printing
611 */
612}
613
614#else // !FULL_SYSTEM
615

--- 58 unchanged lines hidden ---