process.cc (3114:7a4771b9b720) | process.cc (3415:72c48f292f6a) |
---|---|
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; --- 52 unchanged lines hidden (view full) --- 61 stack_base = (Addr)0x80000000000ULL; 62 63 // Set up region for mmaps. Tru64 seems to start just above 0 and 64 // grow up from there. 65 mmap_start = mmap_end = 0xfffff80000000000ULL; 66 67 // Set pointer for next thread stack. Reserve 8M for main stack. 68 next_thread_stack_base = stack_base - (8 * 1024 * 1024); | 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; --- 52 unchanged lines hidden (view full) --- 61 stack_base = (Addr)0x80000000000ULL; 62 63 // Set up region for mmaps. Tru64 seems to start just above 0 and 64 // grow up from there. 65 mmap_start = mmap_end = 0xfffff80000000000ULL; 66 67 // Set pointer for next thread stack. Reserve 8M for main stack. 68 next_thread_stack_base = stack_base - (8 * 1024 * 1024); |
69 70 //Initialize these to 0s 71 fillStart = 0; 72 spillStart = 0; |
|
69} 70 71void 72SparcLiveProcess::startup() 73{ 74 argsInit(MachineBytes, VMPageSize); 75 76 //From the SPARC ABI --- 6 unchanged lines hidden (view full) --- 83 84 threadContexts[0]->setMiscReg(MISCREG_TICK, 0); 85 // 86 /* 87 * Register window management registers 88 */ 89 90 //No windows contain info from other programs | 73} 74 75void 76SparcLiveProcess::startup() 77{ 78 argsInit(MachineBytes, VMPageSize); 79 80 //From the SPARC ABI --- 6 unchanged lines hidden (view full) --- 87 88 threadContexts[0]->setMiscReg(MISCREG_TICK, 0); 89 // 90 /* 91 * Register window management registers 92 */ 93 94 //No windows contain info from other programs |
91 threadContexts[0]->setMiscRegWithEffect(MISCREG_OTHERWIN, 0); | 95 threadContexts[0]->setMiscReg(MISCREG_OTHERWIN, 0); |
92 //There are no windows to pop | 96 //There are no windows to pop |
93 threadContexts[0]->setMiscRegWithEffect(MISCREG_CANRESTORE, 0); | 97 threadContexts[0]->setMiscReg(MISCREG_CANRESTORE, 0); |
94 //All windows are available to save into | 98 //All windows are available to save into |
95 threadContexts[0]->setMiscRegWithEffect(MISCREG_CANSAVE, NWindows - 2); | 99 threadContexts[0]->setMiscReg(MISCREG_CANSAVE, NWindows - 2); |
96 //All windows are "clean" | 100 //All windows are "clean" |
97 threadContexts[0]->setMiscRegWithEffect(MISCREG_CLEANWIN, NWindows); | 101 threadContexts[0]->setMiscReg(MISCREG_CLEANWIN, NWindows); |
98 //Start with register window 0 | 102 //Start with register window 0 |
99 threadContexts[0]->setMiscRegWithEffect(MISCREG_CWP, 0); | 103 threadContexts[0]->setMiscReg(MISCREG_CWP, 0); 104 //Always use spill and fill traps 0 105 threadContexts[0]->setMiscReg(MISCREG_WSTATE, 0); 106 //Set the trap level to 0 107 threadContexts[0]->setMiscReg(MISCREG_TL, 0); |
100} 101 102m5_auxv_t buildAuxVect(int64_t type, int64_t val) 103{ 104 m5_auxv_t result; 105 result.a_type = TheISA::htog(type); 106 result.a_val = TheISA::htog(val); 107 return result; 108} 109 | 108} 109 110m5_auxv_t buildAuxVect(int64_t type, int64_t val) 111{ 112 m5_auxv_t result; 113 result.a_type = TheISA::htog(type); 114 result.a_val = TheISA::htog(val); 115 return result; 116} 117 |
118//We only use 19 instructions for the trap handlers, but there would be 119//space for 32 in a real SPARC trap table. 120const int numFillInsts = 32; 121const int numSpillInsts = 32; 122 123MachInst fillHandler[numFillInsts] = 124{ 125 htog(0x87802018), //wr %g0, ASI_AIUP, %asi 126 htog(0xe0dba7ff), //ldxa [%sp + BIAS + (0*8)] %asi, %l0 127 htog(0xe2dba807), //ldxa [%sp + BIAS + (1*8)] %asi, %l1 128 htog(0xe4dba80f), //ldxa [%sp + BIAS + (2*8)] %asi, %l2 129 htog(0xe6dba817), //ldxa [%sp + BIAS + (3*8)] %asi, %l3 130 htog(0xe8dba81f), //ldxa [%sp + BIAS + (4*8)] %asi, %l4 131 htog(0xeadba827), //ldxa [%sp + BIAS + (5*8)] %asi, %l5 132 htog(0xecdba82f), //ldxa [%sp + BIAS + (6*8)] %asi, %l6 133 htog(0xeedba837), //ldxa [%sp + BIAS + (7*8)] %asi, %l7 134 htog(0xf0dba83f), //ldxa [%sp + BIAS + (8*8)] %asi, %i0 135 htog(0xf2dba847), //ldxa [%sp + BIAS + (9*8)] %asi, %i1 136 htog(0xf4dba84f), //ldxa [%sp + BIAS + (10*8)] %asi, %i2 137 htog(0xf6dba857), //ldxa [%sp + BIAS + (11*8)] %asi, %i3 138 htog(0xf8dba85f), //ldxa [%sp + BIAS + (12*8)] %asi, %i4 139 htog(0xfadba867), //ldxa [%sp + BIAS + (13*8)] %asi, %i5 140 htog(0xfcdba86f), //ldxa [%sp + BIAS + (14*8)] %asi, %i6 141 htog(0xfedba877), //ldxa [%sp + BIAS + (15*8)] %asi, %i7 142 htog(0x83880000), //restored 143 htog(0x83F00000), //retry 144 htog(0x00000000), //illtrap 145 htog(0x00000000), //illtrap 146 htog(0x00000000), //illtrap 147 htog(0x00000000), //illtrap 148 htog(0x00000000), //illtrap 149 htog(0x00000000), //illtrap 150 htog(0x00000000), //illtrap 151 htog(0x00000000), //illtrap 152 htog(0x00000000), //illtrap 153 htog(0x00000000), //illtrap 154 htog(0x00000000), //illtrap 155 htog(0x00000000), //illtrap 156 htog(0x00000000) //illtrap 157}; 158 159MachInst spillHandler[numSpillInsts] = 160{ 161 htog(0x87802018), //wr %g0, ASI_AIUP, %asi 162 htog(0xe0f3a7ff), //stxa %l0, [%sp + BIAS + (0*8)] %asi 163 htog(0xe2f3a807), //stxa %l1, [%sp + BIAS + (1*8)] %asi 164 htog(0xe4f3a80f), //stxa %l2, [%sp + BIAS + (2*8)] %asi 165 htog(0xe6f3a817), //stxa %l3, [%sp + BIAS + (3*8)] %asi 166 htog(0xe8f3a81f), //stxa %l4, [%sp + BIAS + (4*8)] %asi 167 htog(0xeaf3a827), //stxa %l5, [%sp + BIAS + (5*8)] %asi 168 htog(0xecf3a82f), //stxa %l6, [%sp + BIAS + (6*8)] %asi 169 htog(0xeef3a837), //stxa %l7, [%sp + BIAS + (7*8)] %asi 170 htog(0xf0f3a83f), //stxa %i0, [%sp + BIAS + (8*8)] %asi 171 htog(0xf2f3a847), //stxa %i1, [%sp + BIAS + (9*8)] %asi 172 htog(0xf4f3a84f), //stxa %i2, [%sp + BIAS + (10*8)] %asi 173 htog(0xf6f3a857), //stxa %i3, [%sp + BIAS + (11*8)] %asi 174 htog(0xf8f3a85f), //stxa %i4, [%sp + BIAS + (12*8)] %asi 175 htog(0xfaf3a867), //stxa %i5, [%sp + BIAS + (13*8)] %asi 176 htog(0xfcf3a86f), //stxa %i6, [%sp + BIAS + (14*8)] %asi 177 htog(0xfef3a877), //stxa %i7, [%sp + BIAS + (15*8)] %asi 178 htog(0x81880000), //saved 179 htog(0x83F00000), //retry 180 htog(0x00000000), //illtrap 181 htog(0x00000000), //illtrap 182 htog(0x00000000), //illtrap 183 htog(0x00000000), //illtrap 184 htog(0x00000000), //illtrap 185 htog(0x00000000), //illtrap 186 htog(0x00000000), //illtrap 187 htog(0x00000000), //illtrap 188 htog(0x00000000), //illtrap 189 htog(0x00000000), //illtrap 190 htog(0x00000000), //illtrap 191 htog(0x00000000), //illtrap 192 htog(0x00000000) //illtrap 193}; 194 |
|
110void 111SparcLiveProcess::argsInit(int intSize, int pageSize) 112{ 113 Process::startup(); 114 115 string filename; 116 if(argv.size() < 1) 117 filename = ""; --- 194 unchanged lines hidden (view full) --- 312 initVirtMem->writeBlob(auxv_array_base + 2 * intSize * auxv.size(), 313 (uint8_t*)&zero, 2 * intSize); 314 315 copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); 316 copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); 317 318 initVirtMem->writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); 319 | 195void 196SparcLiveProcess::argsInit(int intSize, int pageSize) 197{ 198 Process::startup(); 199 200 string filename; 201 if(argv.size() < 1) 202 filename = ""; --- 194 unchanged lines hidden (view full) --- 397 initVirtMem->writeBlob(auxv_array_base + 2 * intSize * auxv.size(), 398 (uint8_t*)&zero, 2 * intSize); 399 400 copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); 401 copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); 402 403 initVirtMem->writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); 404 |
405 //Stuff the trap handlers into the processes address space. 406 //Since the stack grows down and is the highest area in the processes 407 //address space, we can put stuff above it and stay out of the way. 408 int fillSize = sizeof(MachInst) * numFillInsts; 409 int spillSize = sizeof(MachInst) * numSpillInsts; 410 fillStart = stack_base; 411 spillStart = fillStart + fillSize; 412 initVirtMem->writeBlob(fillStart, (uint8_t*)fillHandler, fillSize); 413 initVirtMem->writeBlob(spillStart, (uint8_t*)spillHandler, spillSize); 414 415 //Set up the thread context to start running the process |
|
320 threadContexts[0]->setIntReg(ArgumentReg0, argc); 321 threadContexts[0]->setIntReg(ArgumentReg1, argv_array_base); 322 threadContexts[0]->setIntReg(StackPointerReg, stack_min - StackBias); 323 324 Addr prog_entry = objFile->entryPoint(); 325 threadContexts[0]->setPC(prog_entry); 326 threadContexts[0]->setNextPC(prog_entry + sizeof(MachInst)); 327 threadContexts[0]->setNextNPC(prog_entry + (2 * sizeof(MachInst))); 328 329// num_processes++; 330} | 416 threadContexts[0]->setIntReg(ArgumentReg0, argc); 417 threadContexts[0]->setIntReg(ArgumentReg1, argv_array_base); 418 threadContexts[0]->setIntReg(StackPointerReg, stack_min - StackBias); 419 420 Addr prog_entry = objFile->entryPoint(); 421 threadContexts[0]->setPC(prog_entry); 422 threadContexts[0]->setNextPC(prog_entry + sizeof(MachInst)); 423 threadContexts[0]->setNextNPC(prog_entry + (2 * sizeof(MachInst))); 424 425// num_processes++; 426} |