John Bauman | 8940182 | 2014-05-06 15:04:28 -0400 | [diff] [blame] | 1 | // SwiftShader Software Renderer |
| 2 | // |
| 3 | // Copyright(c) 2005-2011 TransGaming Inc. |
| 4 | // |
| 5 | // All rights reserved. No part of this software may be copied, distributed, transmitted, |
| 6 | // transcribed, stored in a retrieval system, translated into any human or computer |
| 7 | // language by any means, or disclosed to third parties without the explicit written |
| 8 | // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express |
| 9 | // or implied, including but not limited to any patent rights, are granted to you. |
| 10 | // |
| 11 | |
| 12 | #include "MemoryManager.hpp" |
| 13 | |
| 14 | #include "Nucleus.hpp" |
| 15 | |
| 16 | namespace sw |
| 17 | { |
| 18 | using namespace llvm; |
| 19 | |
| 20 | MemoryManager::MemoryManager() |
| 21 | { |
| 22 | routine = 0; |
| 23 | } |
| 24 | |
| 25 | MemoryManager::~MemoryManager() |
| 26 | { |
| 27 | delete routine; |
| 28 | } |
| 29 | |
| 30 | void MemoryManager::AllocateGOT() |
| 31 | { |
| 32 | // FIXME: ASSERT(false); |
| 33 | } |
| 34 | |
| 35 | unsigned char *MemoryManager::allocateStub(const GlobalValue *function, unsigned stubSize, unsigned alignment) |
| 36 | { |
| 37 | // FIXME: ASSERT(false); |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | unsigned char *MemoryManager::startFunctionBody(const llvm::Function *function, uintptr_t &actualSize) |
| 43 | { |
| 44 | if(actualSize == 0) |
| 45 | { |
| 46 | actualSize = 4096; |
| 47 | } |
| 48 | |
| 49 | actualSize = (actualSize + 15) & -16; |
| 50 | |
| 51 | delete routine; |
| 52 | routine = new Routine(actualSize); |
| 53 | |
| 54 | return (unsigned char*)routine->getBuffer(); |
| 55 | } |
| 56 | |
| 57 | void MemoryManager::endFunctionBody(const llvm::Function *function, unsigned char *functionStart, unsigned char *functionEnd) |
| 58 | { |
| 59 | routine->setFunctionSize(functionEnd - functionStart); |
| 60 | } |
| 61 | |
| 62 | unsigned char *MemoryManager::startExceptionTable(const llvm::Function* F, uintptr_t &ActualSize) |
| 63 | { |
| 64 | // FIXME: ASSERT(false); |
| 65 | |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | void MemoryManager::endExceptionTable(const llvm::Function *F, unsigned char *TableStart, unsigned char *TableEnd, unsigned char* FrameRegister) |
| 70 | { |
| 71 | // FIXME: ASSERT(false); |
| 72 | } |
| 73 | |
| 74 | unsigned char *MemoryManager::getGOTBase() const |
| 75 | { |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | unsigned char *MemoryManager::allocateSpace(intptr_t Size, unsigned Alignment) |
| 80 | { |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | unsigned char *MemoryManager::allocateGlobal(uintptr_t Size, unsigned Alignment) |
| 85 | { |
| 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | void MemoryManager::deallocateFunctionBody(void *Body) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | void MemoryManager::deallocateExceptionTable(void *ET) |
| 94 | { |
| 95 | } |
| 96 | |
| 97 | void MemoryManager::setMemoryWritable() |
| 98 | { |
| 99 | } |
| 100 | |
| 101 | void MemoryManager::setMemoryExecutable() |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | void MemoryManager::setPoisonMemory(bool poison) |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | Routine *MemoryManager::acquireRoutine() |
| 110 | { |
| 111 | Routine *result = routine; |
| 112 | |
| 113 | routine = 0; |
| 114 | |
| 115 | return result; |
| 116 | } |
| 117 | |
| 118 | void MemoryManager::SetDlsymTable(void *pointer) |
| 119 | { |
| 120 | } |
| 121 | |
| 122 | void *MemoryManager::getDlsymTable() const |
| 123 | { |
| 124 | return 0; |
| 125 | } |
| 126 | } |