isa.cc (6335:a08470cb53e5) | isa.cc (6337:cac56cd6b015) |
---|---|
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 | 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::reloadRegMap() 49{ 50 installGlobals(gl, CurrentGlobalsOffset); 51 installWindow(cwp, CurrentWindowOffset); 52 // Microcode registers. 53 for (int i = 0; i < NumMicroIntRegs; i++) 54 intRegMap[MicroIntOffset + i] = i + TotalGlobals + NWindows * 16; 55 installGlobals(gl, NextGlobalsOffset); 56 installWindow(cwp - 1, NextWindowOffset); 57 installGlobals(gl, PreviousGlobalsOffset); 58 installWindow(cwp + 1, PreviousWindowOffset); 59} 60 61void 62ISA::installWindow(int cwp, int offset) 63{ 64 assert(offset >= 0 && offset + NumWindowedRegs <= NumIntRegs); 65 RegIndex *mapChunk = intRegMap + offset; 66 for (int i = 0; i < NumWindowedRegs; i++) 67 mapChunk[i] = TotalGlobals + 68 ((i - cwp * RegsPerWindow + TotalWindowed) % (TotalWindowed)); 69} 70 71void 72ISA::installGlobals(int gl, int offset) 73{ 74 assert(offset >= 0 && offset + NumGlobalRegs <= NumIntRegs); 75 RegIndex *mapChunk = intRegMap + offset; 76 mapChunk[0] = 0; 77 for (int i = 1; i < NumGlobalRegs; i++) 78 mapChunk[i] = i + gl * NumGlobalRegs; 79} 80 81void |
|
48ISA::clear() 49{ | 82ISA::clear() 83{ |
84 cwp = 0; 85 gl = 0; 86 reloadRegMap(); 87 |
|
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; | 88 //y = 0; 89 //ccr = 0; 90 asi = 0; 91 tick = ULL(1) << 63; 92 fprs = 0; 93 gsr = 0; 94 softint = 0; 95 tick_cmpr = 0; 96 stick = 0; 97 stick_cmpr = 0; 98 memset(tpc, 0, sizeof(tpc)); 99 memset(tnpc, 0, sizeof(tnpc)); 100 memset(tstate, 0, sizeof(tstate)); 101 memset(tt, 0, sizeof(tt)); 102 pstate = 0; 103 tl = 0; 104 pil = 0; |
67 cwp = 0; | |
68 //cansave = 0; 69 //canrestore = 0; 70 //cleanwin = 0; 71 //otherwin = 0; 72 //wstate = 0; | 105 //cansave = 0; 106 //canrestore = 0; 107 //cleanwin = 0; 108 //otherwin = 0; 109 //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; | 110 //In a T1, bit 11 is apparently always 1 111 hpstate = (1 << 11); 112 memset(htstate, 0, sizeof(htstate)); 113 hintp = 0; 114 htba = 0; 115 hstick_cmpr = 0; 116 //This is set this way in Legion for some reason 117 strandStatusReg = 0x50000; --- 443 unchanged lines hidden (view full) --- 561 else 562 tc->getCpuPtr()->clearInterrupt(IT_TRAP_LEVEL_ZERO, 0); 563#endif 564 return; 565 case MISCREG_CWP: 566 new_val = val >= NWindows ? NWindows - 1 : val; 567 if (val >= NWindows) 568 new_val = NWindows - 1; |
569 570 installWindow(new_val, CurrentWindowOffset); 571 installWindow(new_val - 1, NextWindowOffset); 572 installWindow(new_val + 1, PreviousWindowOffset); |
|
533 break; 534 case MISCREG_GL: | 573 break; 574 case MISCREG_GL: |
575 installGlobals(val, CurrentGlobalsOffset); 576 installGlobals(val, NextGlobalsOffset); 577 installGlobals(val, PreviousGlobalsOffset); |
|
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); | 578 break; 579 case MISCREG_PIL: 580 case MISCREG_SOFTINT: 581 case MISCREG_SOFTINT_SET: 582 case MISCREG_SOFTINT_CLR: 583 case MISCREG_TICK_CMPR: 584 case MISCREG_STICK_CMPR: 585 case MISCREG_HINTP: --- 120 unchanged lines hidden (view full) --- 706 UNSERIALIZE_ARRAY(tstate,MaxTL); 707 UNSERIALIZE_ARRAY(tt,MaxTL); 708 UNSERIALIZE_SCALAR(tba); 709 UNSERIALIZE_SCALAR(pstate); 710 UNSERIALIZE_SCALAR(tl); 711 UNSERIALIZE_SCALAR(pil); 712 UNSERIALIZE_SCALAR(cwp); 713 UNSERIALIZE_SCALAR(gl); |
714 reloadRegMap(); |
|
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 | 715 UNSERIALIZE_SCALAR(hpstate); 716 UNSERIALIZE_ARRAY(htstate,MaxTL); 717 UNSERIALIZE_SCALAR(hintp); 718 UNSERIALIZE_SCALAR(htba); 719 UNSERIALIZE_SCALAR(hstick_cmpr); 720 UNSERIALIZE_SCALAR(strandStatusReg); 721 UNSERIALIZE_SCALAR(fsr); 722 UNSERIALIZE_SCALAR(priContext); --- 39 unchanged lines hidden (view full) --- 762 em->schedule(hSTickCompare, hstick_cmp); 763 } 764 } 765 } 766 767 #endif 768} 769 |
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} | 770} |
793 794} | |