JitCodeBuffer: Flush cache after committing code on ARM CPUs
ARM's instruction and data caches are not coherent, so we need to flush before executing to ensure there's no stale data left over.
This commit is contained in:
@ -4,34 +4,34 @@
|
||||
class JitCodeBuffer
|
||||
{
|
||||
public:
|
||||
JitCodeBuffer(size_t size = 64 * 1024 * 1024, size_t far_code_size = 0);
|
||||
JitCodeBuffer(u32 size = 64 * 1024 * 1024, u32 far_code_size = 0);
|
||||
~JitCodeBuffer();
|
||||
|
||||
void Reset();
|
||||
|
||||
void* GetFreeCodePointer() const { return m_free_code_ptr; }
|
||||
size_t GetFreeCodeSpace() const { return (m_code_size - m_code_used); }
|
||||
void CommitCode(size_t length);
|
||||
u8* GetFreeCodePointer() const { return m_free_code_ptr; }
|
||||
u32 GetFreeCodeSpace() const { return static_cast<u32>(m_code_size - m_code_used); }
|
||||
void CommitCode(u32 length);
|
||||
|
||||
void* GetFreeFarCodePointer() const { return m_free_far_code_ptr; }
|
||||
size_t GetFreeFarCodeSpace() const { return (m_far_code_size - m_far_code_used); }
|
||||
void CommitFarCode(size_t length);
|
||||
u8* GetFreeFarCodePointer() const { return m_free_far_code_ptr; }
|
||||
u32 GetFreeFarCodeSpace() const { return static_cast<u32>(m_far_code_size - m_far_code_used); }
|
||||
void CommitFarCode(u32 length);
|
||||
|
||||
/// Adjusts the free code pointer to the specified alignment, padding with bytes.
|
||||
/// Assumes alignment is a power-of-two.
|
||||
void Align(u32 alignment, u8 padding_value);
|
||||
|
||||
private:
|
||||
void* m_code_ptr;
|
||||
void* m_free_code_ptr;
|
||||
size_t m_code_size;
|
||||
size_t m_code_used;
|
||||
u8* m_code_ptr;
|
||||
u8* m_free_code_ptr;
|
||||
u32 m_code_size;
|
||||
u32 m_code_used;
|
||||
|
||||
void* m_far_code_ptr;
|
||||
void* m_free_far_code_ptr;
|
||||
size_t m_far_code_size;
|
||||
size_t m_far_code_used;
|
||||
u8* m_far_code_ptr;
|
||||
u8* m_free_far_code_ptr;
|
||||
u32 m_far_code_size;
|
||||
u32 m_far_code_used;
|
||||
|
||||
size_t m_total_size;
|
||||
u32 m_total_size;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user