process.cc (4997:e7380529bd2d) | process.cc (5128:69fb816fa927) |
---|---|
1/* 2 * Copyright (c) 2003-2004 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; --- 59 unchanged lines hidden (view full) --- 68 fillStart = 0; 69 spillStart = 0; 70} 71 72void SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc) 73{ 74 switch(trapNum) 75 { | 1/* 2 * Copyright (c) 2003-2004 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; --- 59 unchanged lines hidden (view full) --- 68 fillStart = 0; 69 spillStart = 0; 70} 71 72void SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc) 73{ 74 switch(trapNum) 75 { |
76 case 0x01: //Software breakpoint 77 warn("Software breakpoint encountered at pc %#x.\n", tc->readPC()); 78 break; 79 case 0x02: //Division by zero 80 warn("Software signaled a division by zero at pc %#x.\n", 81 tc->readPC()); 82 break; |
|
76 case 0x03: //Flush window trap | 83 case 0x03: //Flush window trap |
77 warn("Ignoring request to flush register windows.\n"); | 84 flushWindows(tc); |
78 break; | 85 break; |
86 case 0x04: //Clean windows 87 warn("Ignoring process request for clean register " 88 "windows at pc %#x.\n", tc->readPC()); 89 break; 90 case 0x05: //Range check 91 warn("Software signaled a range check at pc %#x.\n", 92 tc->readPC()); 93 break; 94 case 0x06: //Fix alignment 95 warn("Ignoring process request for os assisted unaligned accesses " 96 "at pc %#x.\n", tc->readPC()); 97 break; 98 case 0x07: //Integer overflow 99 warn("Software signaled an integer overflow at pc %#x.\n", 100 tc->readPC()); 101 break; 102 case 0x32: //Get integer condition codes 103 warn("Ignoring process request to get the integer condition codes " 104 "at pc %#x.\n", tc->readPC()); 105 break; 106 case 0x33: //Set integer condition codes 107 warn("Ignoring process request to set the integer condition codes " 108 "at pc %#x.\n", tc->readPC()); 109 break; |
|
79 default: 80 panic("Unimplemented trap to operating system: trap number %#x.\n", trapNum); 81 } 82} 83 84void 85Sparc32LiveProcess::startup() 86{ --- 544 unchanged lines hidden (view full) --- 631 threadContexts[0]->setNextPC(prog_entry + sizeof(MachInst)); 632 threadContexts[0]->setNextNPC(prog_entry + (2 * sizeof(MachInst))); 633 634 //Align the "stack_min" to a page boundary. 635 stack_min = roundDown(stack_min, pageSize); 636 637// num_processes++; 638} | 110 default: 111 panic("Unimplemented trap to operating system: trap number %#x.\n", trapNum); 112 } 113} 114 115void 116Sparc32LiveProcess::startup() 117{ --- 544 unchanged lines hidden (view full) --- 662 threadContexts[0]->setNextPC(prog_entry + sizeof(MachInst)); 663 threadContexts[0]->setNextNPC(prog_entry + (2 * sizeof(MachInst))); 664 665 //Align the "stack_min" to a page boundary. 666 stack_min = roundDown(stack_min, pageSize); 667 668// num_processes++; 669} |
670 671void Sparc32LiveProcess::flushWindows(ThreadContext *tc) 672{ 673 IntReg Cansave = tc->readIntReg(NumIntArchRegs + 3); 674 IntReg Canrestore = tc->readIntReg(NumIntArchRegs + 4); 675 IntReg Otherwin = tc->readIntReg(NumIntArchRegs + 6); 676 MiscReg CWP = tc->readMiscReg(MISCREG_CWP); 677 MiscReg origCWP = CWP; 678 CWP = (CWP + Cansave + 2) % NWindows; 679 while(NWindows - 2 - Cansave != 0) 680 { 681 if (Otherwin) { 682 panic("Otherwin non-zero.\n"); 683 } else { 684 tc->setMiscReg(MISCREG_CWP, CWP); 685 //Do the stores 686 IntReg sp = tc->readIntReg(StackPointerReg); 687 for (int index = 16; index < 32; index++) { 688 IntReg regVal = tc->readIntReg(index); 689 regVal = htog(regVal); 690 if (!tc->getMemPort()->tryWriteBlob( 691 sp + (index - 16) * 4, (uint8_t *)®Val, 4)) { 692 warn("Failed to save register to the stack when " 693 "flushing windows.\n"); 694 } 695 } 696 Canrestore--; 697 Cansave++; 698 CWP = (CWP + 1) % NWindows; 699 } 700 } 701 tc->setIntReg(NumIntArchRegs + 3, Cansave); 702 tc->setIntReg(NumIntArchRegs + 4, Canrestore); 703 tc->setMiscReg(MISCREG_CWP, origCWP); 704} 705 706void Sparc64LiveProcess::flushWindows(ThreadContext *tc) 707{ 708 IntReg Cansave = tc->readIntReg(NumIntArchRegs + 3); 709 IntReg Canrestore = tc->readIntReg(NumIntArchRegs + 4); 710 IntReg Otherwin = tc->readIntReg(NumIntArchRegs + 6); 711 MiscReg CWP = tc->readMiscReg(MISCREG_CWP); 712 MiscReg origCWP = CWP; 713 CWP = (CWP + Cansave + 2) % NWindows; 714 while(NWindows - 2 - Cansave != 0) 715 { 716 if (Otherwin) { 717 panic("Otherwin non-zero.\n"); 718 } else { 719 tc->setMiscReg(MISCREG_CWP, CWP); 720 //Do the stores 721 IntReg sp = tc->readIntReg(StackPointerReg); 722 for (int index = 16; index < 32; index++) { 723 IntReg regVal = tc->readIntReg(index); 724 regVal = htog(regVal); 725 if (!tc->getMemPort()->tryWriteBlob( 726 sp + 2047 + (index - 16) * 8, (uint8_t *)®Val, 8)) { 727 warn("Failed to save register to the stack when " 728 "flushing windows.\n"); 729 } 730 } 731 Canrestore--; 732 Cansave++; 733 CWP = (CWP + 1) % NWindows; 734 } 735 } 736 tc->setIntReg(NumIntArchRegs + 3, Cansave); 737 tc->setIntReg(NumIntArchRegs + 4, Canrestore); 738 tc->setMiscReg(MISCREG_CWP, origCWP); 739} |
|