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