OLD | NEW |
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 PLATFORMS_STM_DISCO_FLETCH_SRC_PAGE_ALLOCATOR_H_ | 5 #ifndef PLATFORMS_STM_DISCO_DARTINO_SRC_PAGE_ALLOCATOR_H_ |
6 #define PLATFORMS_STM_DISCO_FLETCH_SRC_PAGE_ALLOCATOR_H_ | 6 #define PLATFORMS_STM_DISCO_DARTINO_SRC_PAGE_ALLOCATOR_H_ |
7 | 7 |
8 #include <cinttypes> | 8 #include <cinttypes> |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 #include <cstring> | 10 #include <cstring> |
11 | 11 |
12 #include "platforms/stm/disco_fletch/src/globals.h" | 12 #include "platforms/stm/disco_dartino/src/globals.h" |
13 | 13 |
14 class PageAllocator { | 14 class PageAllocator { |
15 public: | 15 public: |
16 PageAllocator() { Initialize(); } | 16 PageAllocator() { Initialize(); } |
17 | 17 |
18 void Initialize() { | 18 void Initialize() { |
19 // The initialization must be simple, as it can be called early | 19 // The initialization must be simple, as it can be called early |
20 // during startup before the C++-runtime is fully initialized. | 20 // during startup before the C++-runtime is fully initialized. |
21 memset(&arenas_, 0, kMaxArenas * sizeof(Arena)); | 21 memset(&arenas_, 0, kMaxArenas * sizeof(Arena)); |
22 } | 22 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const char* name_; | 61 const char* name_; |
62 size_t pages_; | 62 size_t pages_; |
63 uint8_t* base_; | 63 uint8_t* base_; |
64 uint8_t* map_; | 64 uint8_t* map_; |
65 }; | 65 }; |
66 | 66 |
67 static const int kMaxArenas = 3; | 67 static const int kMaxArenas = 3; |
68 Arena arenas_[kMaxArenas]; | 68 Arena arenas_[kMaxArenas]; |
69 }; | 69 }; |
70 | 70 |
71 #endif // PLATFORMS_STM_DISCO_FLETCH_SRC_PAGE_ALLOCATOR_H_ | 71 #endif // PLATFORMS_STM_DISCO_DARTINO_SRC_PAGE_ALLOCATOR_H_ |
OLD | NEW |