Deleted Added
sdiff udiff text old ( 6335:a08470cb53e5 ) new ( 6337:cac56cd6b015 )
full compact
1/*
2 * Copyright (c) 2009 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;

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

40{
41
42enum RegMask
43{
44 PSTATE_MASK = (((1 << 4) - 1) << 1) | (((1 << 4) - 1) << 6) | (1 << 12)
45};
46
47void
48ISA::clear()
49{
50 //y = 0;
51 //ccr = 0;
52 asi = 0;
53 tick = ULL(1) << 63;
54 fprs = 0;
55 gsr = 0;
56 softint = 0;
57 tick_cmpr = 0;
58 stick = 0;
59 stick_cmpr = 0;
60 memset(tpc, 0, sizeof(tpc));
61 memset(tnpc, 0, sizeof(tnpc));
62 memset(tstate, 0, sizeof(tstate));
63 memset(tt, 0, sizeof(tt));
64 pstate = 0;
65 tl = 0;
66 pil = 0;
67 cwp = 0;
68 //cansave = 0;
69 //canrestore = 0;
70 //cleanwin = 0;
71 //otherwin = 0;
72 //wstate = 0;
73 gl = 0;
74 //In a T1, bit 11 is apparently always 1
75 hpstate = (1 << 11);
76 memset(htstate, 0, sizeof(htstate));
77 hintp = 0;
78 htba = 0;
79 hstick_cmpr = 0;
80 //This is set this way in Legion for some reason
81 strandStatusReg = 0x50000;

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

525 else
526 tc->getCpuPtr()->clearInterrupt(IT_TRAP_LEVEL_ZERO, 0);
527#endif
528 return;
529 case MISCREG_CWP:
530 new_val = val >= NWindows ? NWindows - 1 : val;
531 if (val >= NWindows)
532 new_val = NWindows - 1;
533 break;
534 case MISCREG_GL:
535 break;
536 case MISCREG_PIL:
537 case MISCREG_SOFTINT:
538 case MISCREG_SOFTINT_SET:
539 case MISCREG_SOFTINT_CLR:
540 case MISCREG_TICK_CMPR:
541 case MISCREG_STICK_CMPR:
542 case MISCREG_HINTP:

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

663 UNSERIALIZE_ARRAY(tstate,MaxTL);
664 UNSERIALIZE_ARRAY(tt,MaxTL);
665 UNSERIALIZE_SCALAR(tba);
666 UNSERIALIZE_SCALAR(pstate);
667 UNSERIALIZE_SCALAR(tl);
668 UNSERIALIZE_SCALAR(pil);
669 UNSERIALIZE_SCALAR(cwp);
670 UNSERIALIZE_SCALAR(gl);
671 UNSERIALIZE_SCALAR(hpstate);
672 UNSERIALIZE_ARRAY(htstate,MaxTL);
673 UNSERIALIZE_SCALAR(hintp);
674 UNSERIALIZE_SCALAR(htba);
675 UNSERIALIZE_SCALAR(hstick_cmpr);
676 UNSERIALIZE_SCALAR(strandStatusReg);
677 UNSERIALIZE_SCALAR(fsr);
678 UNSERIALIZE_SCALAR(priContext);

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

718 em->schedule(hSTickCompare, hstick_cmp);
719 }
720 }
721 }
722
723 #endif
724}
725
726int
727ISA::flattenIntIndex(int reg)
728{
729 int gl = readMiscRegNoEffect(MISCREG_GL);
730 int cwp = readMiscRegNoEffect(MISCREG_CWP);
731 //DPRINTF(RegisterWindows, "Global Level = %d, Current Window Pointer = %d\n", gl, cwp);
732 int newReg;
733 //The total number of global registers
734 int numGlobals = (MaxGL + 1) * 8;
735 if(reg < 8)
736 {
737 //Global register
738 //Put it in the appropriate set of globals
739 newReg = reg + gl * 8;
740 }
741 else if(reg < NumIntArchRegs)
742 {
743 //Regular windowed register
744 //Put it in the window pointed to by cwp
745 newReg = numGlobals +
746 ((reg - 8 - cwp * 16 + NWindows * 16) % (NWindows * 16));
747 }
748 else if(reg < NumIntArchRegs + NumMicroIntRegs)
749 {
750 //Microcode register
751 //Displace from the end of the regular registers
752 newReg = reg - NumIntArchRegs + numGlobals + NWindows * 16;
753 }
754 else if(reg < 2 * NumIntArchRegs + NumMicroIntRegs)
755 {
756 reg -= (NumIntArchRegs + NumMicroIntRegs);
757 if(reg < 8)
758 {
759 //Global register from the next window
760 //Put it in the appropriate set of globals
761 newReg = reg + gl * 8;
762 }
763 else
764 {
765 //Windowed register from the previous window
766 //Put it in the window before the one pointed to by cwp
767 newReg = numGlobals +
768 ((reg - 8 - (cwp - 1) * 16 + NWindows * 16) % (NWindows * 16));
769 }
770 }
771 else if(reg < 3 * NumIntArchRegs + NumMicroIntRegs)
772 {
773 reg -= (2 * NumIntArchRegs + NumMicroIntRegs);
774 if(reg < 8)
775 {
776 //Global register from the previous window
777 //Put it in the appropriate set of globals
778 newReg = reg + gl * 8;
779 }
780 else
781 {
782 //Windowed register from the next window
783 //Put it in the window after the one pointed to by cwp
784 newReg = numGlobals +
785 ((reg - 8 - (cwp + 1) * 16 + NWindows * 16) % (NWindows * 16));
786 }
787 }
788 else
789 panic("Tried to flatten invalid register index %d!\n", reg);
790 DPRINTF(RegisterWindows, "Flattened register %d to %d.\n", reg, newReg);
791 return newReg;
792}
793
794}