aboutsummaryrefslogtreecommitdiffstats
path: root/linker/linker_allocator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linker/linker_allocator.cpp')
-rw-r--r--linker/linker_allocator.cpp12
1 files changed, 0 insertions, 12 deletions
diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp
index 805844fc2..60ce1ea47 100644
--- a/linker/linker_allocator.cpp
+++ b/linker/linker_allocator.cpp
@@ -42,8 +42,6 @@ void LinkerBlockAllocator::init(size_t block_size) {
void* LinkerBlockAllocator::alloc() {
if (free_block_list_ == nullptr) {
create_new_page();
- } else {
- protect_page(free_block_list_, PROT_READ | PROT_WRITE);
}
FreeBlockInfo* block_info = reinterpret_cast<FreeBlockInfo*>(free_block_list_);
@@ -82,10 +80,8 @@ void LinkerBlockAllocator::free(void* block) {
FreeBlockInfo* block_info = reinterpret_cast<FreeBlockInfo*>(block);
- protect_page(block_info, PROT_READ | PROT_WRITE);
block_info->next_block = free_block_list_;
block_info->num_free_blocks = 1;
- protect_page(block_info, PROT_READ);
free_block_list_ = block_info;
}
@@ -98,14 +94,6 @@ void LinkerBlockAllocator::protect_all(int prot) {
}
}
-void LinkerBlockAllocator::protect_page(void* block, int prot) {
- LinkerAllocatorPage* page = find_page(block);
- if (page == nullptr || mprotect(page, PAGE_SIZE, prot) == -1) {
- abort();
- }
-}
-
-
void LinkerBlockAllocator::create_new_page() {
LinkerAllocatorPage* page = reinterpret_cast<LinkerAllocatorPage*>(mmap(nullptr, PAGE_SIZE,
PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0));