1/*
2 * Copyright (c) 2011-2015 Advanced Micro Devices, Inc.
3 * All rights reserved.
4 *
5 * For use for simulation and test purposes only
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:

--- 64 unchanged lines hidden (view full) ---

73Shader::mmap(int length)
74{
75
76 Addr start;
77
78 // round up length to the next page
79 length = roundUp(length, TheISA::PageBytes);
80
81 if (X86Linux64::mmapGrowsDown()) {
81 Process *proc = gpuTc->getProcessPtr();
82
83 if (proc->mmapGrowsDown()) {
84 DPRINTF(HSAIL, "GROWS DOWN");
83 start = gpuTc->getProcessPtr()->mmap_end -length;
84 gpuTc->getProcessPtr()->mmap_end = start;
85 start = proc->mmap_end - length;
86 proc->mmap_end = start;
87 } else {
88 DPRINTF(HSAIL, "GROWS UP");
87 start = gpuTc->getProcessPtr()->mmap_end;
88 gpuTc->getProcessPtr()->mmap_end += length;
89 start = proc->mmap_end;
90 proc->mmap_end += length;
91
92 // assertion to make sure we don't overwrite the stack (it grows down)
91 assert(gpuTc->getProcessPtr()->mmap_end <
92 gpuTc->getProcessPtr()->stack_base -
93 gpuTc->getProcessPtr()->max_stack_size);
94
93 assert(proc->mmap_end < proc->stack_base - proc->max_stack_size);
94 }
95
96 DPRINTF(HSAIL,"Shader::mmap start= %#x, %#x\n", start, length);
97
99 gpuTc->getProcessPtr()->allocateMem(start,length);
98 proc->allocateMem(start, length);
99
100 return start;
101}
102
103void
104Shader::init()
105{
106 // grab the threadContext of the thread running on the CPU

--- 305 unchanged lines hidden ---