process.cc (8534:09745e0c3dd9) | process.cc (8539:7d3ea3c65c66) |
---|---|
1/* 2 * Copyright (c) 2001-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; --- 315 unchanged lines hidden (view full) --- 324{ 325 if (tgt_fd < 0 || tgt_fd > MAX_FD) 326 return NULL; 327 328 return &fd_map[tgt_fd]; 329} 330 331bool | 1/* 2 * Copyright (c) 2001-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; --- 315 unchanged lines hidden (view full) --- 324{ 325 if (tgt_fd < 0 || tgt_fd > MAX_FD) 326 return NULL; 327 328 return &fd_map[tgt_fd]; 329} 330 331bool |
332Process::checkAndAllocNextPage(Addr vaddr) | 332Process::fixupStackFault(Addr vaddr) |
333{ | 333{ |
334 // if this is an initial write we might not have | 334 // Check if this is already on the stack and there's just no page there 335 // yet. |
335 if (vaddr >= stack_min && vaddr < stack_base) { 336 pTable->allocate(roundDown(vaddr, VMPageSize), VMPageSize); 337 return true; 338 } 339 | 336 if (vaddr >= stack_min && vaddr < stack_base) { 337 pTable->allocate(roundDown(vaddr, VMPageSize), VMPageSize); 338 return true; 339 } 340 |
340 // We've accessed the next page of the stack, so extend the stack 341 // to cover it. | 341 // We've accessed the next page of the stack, so extend it to include 342 // this address. |
342 if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) { 343 while (vaddr < stack_min) { 344 stack_min -= TheISA::PageBytes; | 343 if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) { 344 while (vaddr < stack_min) { 345 stack_min -= TheISA::PageBytes; |
345 if(stack_base - stack_min > max_stack_size) | 346 if (stack_base - stack_min > max_stack_size) |
346 fatal("Maximum stack size exceeded\n"); | 347 fatal("Maximum stack size exceeded\n"); |
347 if(stack_base - stack_min > 8*1024*1024) | 348 if (stack_base - stack_min > 8 * 1024 * 1024) |
348 fatal("Over max stack size for one thread\n"); 349 pTable->allocate(stack_min, TheISA::PageBytes); 350 inform("Increasing stack size by one page."); 351 }; 352 return true; 353 } | 349 fatal("Over max stack size for one thread\n"); 350 pTable->allocate(stack_min, TheISA::PageBytes); 351 inform("Increasing stack size by one page."); 352 }; 353 return true; 354 } |
354 warn("Not increasing stack: requested vaddr is outside of stack range."); | 355 warn("Not extending stack: address %#x isn't at the end of the stack.", 356 vaddr); |
355 return false; 356} 357 358// find all offsets for currently open files and save them 359void 360Process::fix_file_offsets() 361{ 362 Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO]; --- 371 unchanged lines hidden --- | 357 return false; 358} 359 360// find all offsets for currently open files and save them 361void 362Process::fix_file_offsets() 363{ 364 Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO]; --- 371 unchanged lines hidden --- |