| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE.md file. | |
| 4 | |
| 5 #ifndef INCLUDE_FLETCH_RELOCATION_API_H_ | |
| 6 #define INCLUDE_FLETCH_RELOCATION_API_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 #include <stddef.h> | |
| 10 | |
| 11 #include "include/fletch_api.h" | |
| 12 | |
| 13 // Returns the memory requirement in bytes for the given program. The | |
| 14 // reported memory requirement includes the size of an info block as | |
| 15 // appended when relocating a program. It is thus suitable as size | |
| 16 // argument to FletchRelocateProgram. | |
| 17 FLETCH_EXPORT size_t FletchGetProgramSize(FletchProgram program); | |
| 18 | |
| 19 // Relocates the given program to the new address given by base. | |
| 20 // The resulting blob is written to the memory region referred to | |
| 21 // by target. | |
| 22 // | |
| 23 // base and target may coincide, if the new location of the program | |
| 24 // is in random access memory. Otherwise, the caller is responsible | |
| 25 // for copying the blob written to target to its new location. | |
| 26 // | |
| 27 // The memory region pointed to by target has to be big enough to | |
| 28 // hold the relocated program plus an appended info block. The | |
| 29 // function FletchGetProgramSize can be used to query this information. | |
| 30 // | |
| 31 // The address referred to by base has to be 4k aligned. | |
| 32 // | |
| 33 // On success, the number of bytes written is returned. Otherwise, | |
| 34 // a negative value is returned. | |
| 35 FLETCH_EXPORT int FletchRelocateProgram(FletchProgram program, | |
| 36 void* target, | |
| 37 uintptr_t base); | |
| 38 | |
| 39 #endif // INCLUDE_FLETCH_RELOCATION_API_H_ | |
| OLD | NEW |