Clang: align after template expansion

Cannot align template structs. Also, cannot cast void* to addr_t in
constexpr function.
This commit is contained in:
Ehmry - 2019-09-26 12:37:45 +02:00
parent d557624469
commit b50d28c3e4
2 changed files with 19 additions and 9 deletions

View File

@ -57,13 +57,6 @@ namespace Hw
template <typename ENTRY, unsigned PAGE_SIZE_LOG2, unsigned SIZE_LOG2>
class Page_directory;
using Level_3_translation_table =
Page_directory<Level_4_translation_table,
SIZE_LOG2_2MB, SIZE_LOG2_1GB>;
using Level_2_translation_table =
Page_directory<Level_3_translation_table,
SIZE_LOG2_1GB, SIZE_LOG2_512GB>;
/**
* IA-32e common descriptor.
*
@ -489,7 +482,24 @@ class Hw::Page_directory
*/
void remove_translation(addr_t vo, size_t size, Allocator & alloc) {
_range_op(vo, 0, size, Remove_func(alloc)); }
} __attribute__((aligned(1 << ALIGNM_LOG2)));
};
namespace Hw {
struct Level_3_translation_table :
Page_directory<
Level_4_translation_table,
SIZE_LOG2_2MB, SIZE_LOG2_1GB>
{ } __attribute__((aligned(1 << ALIGNM_LOG2)));
struct Level_2_translation_table :
Page_directory<
Level_3_translation_table,
SIZE_LOG2_1GB, SIZE_LOG2_512GB>
{ } __attribute__((aligned(1 << ALIGNM_LOG2)));
}
class Hw::Pml4_table

View File

@ -56,7 +56,7 @@ namespace Hw
* \param p pointer
* \param alignm_log2 log2 of the required alignment
*/
constexpr bool aligned(void * const p, addr_t alignm_log2) {
inline bool aligned(void * const p, addr_t alignm_log2) {
return (addr_t)p == trunc((addr_t)p, alignm_log2); }
/**