Commit 21f15732 authored by swift_gan's avatar swift_gan Committed by swift_gan

[BugFix]Fix ADRP

parent b685a174
......@@ -58,8 +58,8 @@ Off A64_ADR_ADRP::GetImmPCOffset() {
}
Addr A64_ADR_ADRP::GetImmPCOffsetTarget() {
void* base = AlignDown(GetPC(), P_SIZE);
return offset + reinterpret_cast<Addr>(base);
Addr base = AlignDown((Addr) GetPC(), PAGE_SIZE);
return offset + base;
}
void A64_ADR_ADRP::Assemble() {
......
......@@ -27,7 +27,7 @@ void *AndroidCodeBuffer::GetBuffer(U32 size) {
return reinterpret_cast<void *>(retSpace);
}
label_alloc_new_space:
current_execute_page_size = static_cast<U32>(FIT(size, P_SIZE));
current_execute_page_size = static_cast<U32>(FIT(size, PAGE_SIZE));
mmapRes = mmap(NULL, current_execute_page_size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (mmapRes == MAP_FAILED) {
......
......@@ -35,7 +35,7 @@ typedef S64 Off;
const int BITS_OF_BYTE = 8;
const Addr P_SIZE = 2 << PAGE_OFFSET;
#define P_SIZE PAGE_SIZE
enum Arch {
arm32,
......
......@@ -22,7 +22,7 @@ bool FlushCache(Addr addr, Off len) {
extern "C" bool MemUnprotect(Addr addr, Addr len) {
long pagesize = P_SIZE;
long pagesize = PAGE_SIZE;
unsigned alignment = (unsigned)((unsigned long long)addr % pagesize);
int i = mprotect((void *) (addr - alignment), (size_t) (alignment + len),
PROT_READ | PROT_WRITE | PROT_EXEC);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment