faults.cc (3578:6ef440cfc250) faults.cc (3585:774b5b26a51a)
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;

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

488 {
489 CWP = (CWP + NWindows) % NWindows;
490 tc->setMiscRegWithEffect(MISCREG_CWP, CWP);
491 }
492}
493
494void getREDVector(Addr & PC, Addr & NPC)
495{
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;

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

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.
496 const Addr RSTVAddr = 0xFFFFFFFFF0000000ULL;
497 PC = RSTVAddr | 0xA0;
498 NPC = PC + sizeof(MachInst);
499}
500
497 const Addr RSTVAddr = 0xFFFFFFFFF0000000ULL;
498 PC = RSTVAddr | 0xA0;
499 NPC = PC + sizeof(MachInst);
500}
501
501void getHyperVector(Addr & PC, Addr & NPC, MiscReg TT)
502void getHyperVector(ThreadContext * tc, Addr & PC, Addr & NPC, MiscReg TT)
502{
503{
503 Addr HTBA ;
504 Addr HTBA = tc->readMiscReg(MISCREG_HTBA);
504 PC = (HTBA & ~mask(14)) | ((TT << 5) & mask(14));
505 NPC = PC + sizeof(MachInst);
506}
507
505 PC = (HTBA & ~mask(14)) | ((TT << 5) & mask(14));
506 NPC = PC + sizeof(MachInst);
507}
508
508void getPrivVector(Addr & PC, Addr & NPC, MiscReg TT, MiscReg TL)
509void getPrivVector(ThreadContext * tc, Addr & PC, Addr & NPC, MiscReg TT, MiscReg TL)
509{
510{
510 Addr TBA ;
511 Addr TBA = tc->readMiscReg(MISCREG_TBA);
511 PC = (TBA & ~mask(15)) |
512 (TL > 1 ? (1 << 14) : 0) |
513 ((TT << 5) & mask(14));
514 NPC = PC + sizeof(MachInst);
515}
516
517#if FULL_SYSTEM
518

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

551 //Do error_state somehow?
552 //Probably inject a WDR fault using the interrupt mechanism.
553 //What should the PC and NPC be set to?
554 }
555 else if(TL > MaxPTL && level == Privileged)
556 {
557 //guest_watchdog fault
558 doNormalFault(tc, trapType(), true);
512 PC = (TBA & ~mask(15)) |
513 (TL > 1 ? (1 << 14) : 0) |
514 ((TT << 5) & mask(14));
515 NPC = PC + sizeof(MachInst);
516}
517
518#if FULL_SYSTEM
519

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

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?
555 }
556 else if(TL > MaxPTL && level == Privileged)
557 {
558 //guest_watchdog fault
559 doNormalFault(tc, trapType(), true);
559 getHyperVector(PC, NPC, 2);
560 getHyperVector(tc, PC, NPC, 2);
560 }
561 else if(level == Hyperprivileged)
562 {
563 doNormalFault(tc, trapType(), true);
561 }
562 else if(level == Hyperprivileged)
563 {
564 doNormalFault(tc, trapType(), true);
564 getHyperVector(PC, NPC, trapType());
565 getHyperVector(tc, PC, NPC, trapType());
565 }
566 else
567 {
568 doNormalFault(tc, trapType(), false);
566 }
567 else
568 {
569 doNormalFault(tc, trapType(), false);
569 getPrivVector(PC, NPC, trapType(), TL+1);
570 getPrivVector(tc, PC, NPC, trapType(), TL+1);
570 }
571
572 tc->setPC(PC);
573 tc->setNextPC(NPC);
574 tc->setNextNPC(NPC + sizeof(MachInst));
575}
576
577void PowerOnReset::invoke(ThreadContext * tc)

--- 95 unchanged lines hidden ---
571 }
572
573 tc->setPC(PC);
574 tc->setNextPC(NPC);
575 tc->setNextNPC(NPC + sizeof(MachInst));
576}
577
578void PowerOnReset::invoke(ThreadContext * tc)

--- 95 unchanged lines hidden ---