Linux PowerPC port

This commit is contained in:
Nathaniel Filardo
2020-05-12 17:46:33 +00:00
parent 44e9abe888
commit 37766588de
3 changed files with 46 additions and 1 deletions

View File

@@ -19,6 +19,10 @@
# define PLATFORM_IS_ARM
#endif
#if defined(__powerpc__) || defined(__powerpc64__)
# define PLATFORM_IS_POWERPC
#endif
namespace snmalloc
{
/**
@@ -47,6 +51,7 @@ namespace snmalloc
enum AalName : int
{
ARM,
PowerPC,
X86,
X86_SGX,
};
@@ -140,6 +145,8 @@ namespace snmalloc
# include "aal_x86_sgx.h"
#elif defined(PLATFORM_IS_ARM)
# include "aal_arm.h"
#elif defined(PLATFORM_IS_POWERPC)
# include "aal_powerpc.h"
#endif
namespace snmalloc

37
src/aal/aal_powerpc.h Normal file
View File

@@ -0,0 +1,37 @@
#pragma once
#if defined(__powerpc64__)
# define SNMALLOC_VA_BITS_64
#else
# define SNMALLOC_VA_BITS_32
#endif
namespace snmalloc
{
/**
* ARM-specific architecture abstraction layer.
*/
class AAL_PowerPC
{
public:
/**
* Bitmap of AalFeature flags
*/
static constexpr uint64_t aal_features = IntegerPointers;
static constexpr enum AalName aal_name = PowerPC;
static constexpr size_t smallest_page_size = 0x1000;
/**
* On pipelined processors, notify the core that we are in a spin loop and
* that speculative execution past this point may not be a performance gain.
*/
static inline void pause()
{
__asm__ volatile("or 27,27,27"); // "yield"
}
};
using AAL_Arch = AAL_PowerPC;
} // namespace snmalloc

View File

@@ -25,7 +25,8 @@ namespace snmalloc
*/
static constexpr uint64_t pal_features = PALPOSIX::pal_features;
static constexpr size_t page_size = 0x1000;
static constexpr size_t page_size =
Aal::aal_name == PowerPC ? 0x10000 : 0x1000;
/**
* OS specific function for zeroing memory.