process.cc (8539:7d3ea3c65c66) | process.cc (8601:af28085882dc) |
---|---|
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; --- 155 unchanged lines hidden (view full) --- 164 // mark remaining fds as free 165 for (int i = 3; i <= MAX_FD; ++i) { 166 Process::FdMap *fdo = &fd_map[i]; 167 fdo->fd = -1; 168 } 169 170 mmap_start = mmap_end = 0; 171 nxm_start = nxm_end = 0; | 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; --- 155 unchanged lines hidden (view full) --- 164 // mark remaining fds as free 165 for (int i = 3; i <= MAX_FD; ++i) { 166 Process::FdMap *fdo = &fd_map[i]; 167 fdo->fd = -1; 168 } 169 170 mmap_start = mmap_end = 0; 171 nxm_start = nxm_end = 0; |
172 pTable = new PageTable(this); | 172 pTable = new PageTable(name(), M5_pid); |
173 // other parameters will be initialized when the program is loaded 174} 175 176 177void 178Process::regStats() 179{ 180 using namespace Stats; --- 142 unchanged lines hidden (view full) --- 323Process::sim_fd_obj(int tgt_fd) 324{ 325 if (tgt_fd < 0 || tgt_fd > MAX_FD) 326 return NULL; 327 328 return &fd_map[tgt_fd]; 329} 330 | 173 // other parameters will be initialized when the program is loaded 174} 175 176 177void 178Process::regStats() 179{ 180 using namespace Stats; --- 142 unchanged lines hidden (view full) --- 323Process::sim_fd_obj(int tgt_fd) 324{ 325 if (tgt_fd < 0 || tgt_fd > MAX_FD) 326 return NULL; 327 328 return &fd_map[tgt_fd]; 329} 330 |
331void 332Process::allocateMem(Addr vaddr, int64_t size, bool clobber) 333{ 334 int npages = divCeil(size, (int64_t)VMPageSize); 335 Addr paddr = system->allocPhysPages(npages); 336 pTable->map(vaddr, paddr, size, clobber); 337} 338 |
|
331bool 332Process::fixupStackFault(Addr vaddr) 333{ 334 // Check if this is already on the stack and there's just no page there 335 // yet. 336 if (vaddr >= stack_min && vaddr < stack_base) { | 339bool 340Process::fixupStackFault(Addr vaddr) 341{ 342 // Check if this is already on the stack and there's just no page there 343 // yet. 344 if (vaddr >= stack_min && vaddr < stack_base) { |
337 pTable->allocate(roundDown(vaddr, VMPageSize), VMPageSize); | 345 allocateMem(roundDown(vaddr, VMPageSize), VMPageSize); |
338 return true; 339 } 340 341 // We've accessed the next page of the stack, so extend it to include 342 // this address. 343 if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) { 344 while (vaddr < stack_min) { 345 stack_min -= TheISA::PageBytes; 346 if (stack_base - stack_min > max_stack_size) 347 fatal("Maximum stack size exceeded\n"); 348 if (stack_base - stack_min > 8 * 1024 * 1024) 349 fatal("Over max stack size for one thread\n"); | 346 return true; 347 } 348 349 // We've accessed the next page of the stack, so extend it to include 350 // this address. 351 if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) { 352 while (vaddr < stack_min) { 353 stack_min -= TheISA::PageBytes; 354 if (stack_base - stack_min > max_stack_size) 355 fatal("Maximum stack size exceeded\n"); 356 if (stack_base - stack_min > 8 * 1024 * 1024) 357 fatal("Over max stack size for one thread\n"); |
350 pTable->allocate(stack_min, TheISA::PageBytes); | 358 allocateMem(stack_min, TheISA::PageBytes); |
351 inform("Increasing stack size by one page."); 352 }; 353 return true; 354 } 355 warn("Not extending stack: address %#x isn't at the end of the stack.", 356 vaddr); 357 return false; 358} --- 377 unchanged lines hidden --- | 359 inform("Increasing stack size by one page."); 360 }; 361 return true; 362 } 363 warn("Not extending stack: address %#x isn't at the end of the stack.", 364 vaddr); 365 return false; 366} --- 377 unchanged lines hidden --- |