Commit dda46460 authored by Damien George's avatar Damien George
Browse files

Code style/whitespace cleanup; remove obsolete headers.

And move the MAP_ANON redefinition from py/asmx64.c to unix/alloc.c.
parent a669cbc6
......@@ -84,8 +84,7 @@ void asm_arm_end_pass(asm_arm_t *as) {
if(as->code_base == NULL) {
assert(0);
}
}
else if(as->pass == ASM_ARM_PASS_EMIT) {
} else if(as->pass == ASM_ARM_PASS_EMIT) {
#ifdef __arm__
// flush I- and D-cache
asm volatile(
......
......@@ -35,15 +35,8 @@
// wrapper around everything in this file
#if MICROPY_EMIT_X64
#include <sys/types.h>
#include <sys/mman.h>
#include "asmx64.h"
#if defined(__OpenBSD__) || defined(__MACH__)
#define MAP_ANONYMOUS MAP_ANON
#endif
/* all offsets are measured in multiples of 8 bytes */
#define WORD_SIZE (8)
......
......@@ -30,8 +30,11 @@
#include "mpconfigport.h"
void mp_unix_alloc_exec(mp_uint_t min_size, void** ptr, mp_uint_t *size)
{
#if defined(__OpenBSD__) || defined(__MACH__)
#define MAP_ANONYMOUS MAP_ANON
#endif
void mp_unix_alloc_exec(mp_uint_t min_size, void **ptr, mp_uint_t *size) {
// size needs to be a multiple of the page size
*size = (min_size + 0xfff) & (~0xfff);
*ptr = mmap(NULL, *size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
......@@ -40,7 +43,6 @@ void mp_unix_alloc_exec(mp_uint_t min_size, void** ptr, mp_uint_t *size)
}
}
void mp_unix_free_exec(void *ptr, mp_uint_t size)
{
void mp_unix_free_exec(void *ptr, mp_uint_t size) {
munmap(ptr, size);
}
Supports Markdown
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