summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-03 22:47:23 +0100
committerDamien George <damien.p.george@gmail.com>2014-09-03 22:47:23 +0100
commitdda46460fff56c0756adba0d63fd72b311bdbcc9 (patch)
treea93c903fe6e5e8b5f8078fb3555fa8049c1e340c
parenta669cbc690a2540f6a4cfe453fa4b5bab074d940 (diff)
downloadmicropython-dda46460fff56c0756adba0d63fd72b311bdbcc9.tar.gz
micropython-dda46460fff56c0756adba0d63fd72b311bdbcc9.zip
Code style/whitespace cleanup; remove obsolete headers.
And move the MAP_ANON redefinition from py/asmx64.c to unix/alloc.c.
-rw-r--r--py/asmarm.c7
-rw-r--r--py/asmx64.c9
-rw-r--r--py/compile.c2
-rw-r--r--py/emitnative.c2
-rw-r--r--unix/Makefile2
-rw-r--r--unix/alloc.c10
6 files changed, 13 insertions, 19 deletions
diff --git a/py/asmarm.c b/py/asmarm.c
index fff95fddb6..da9f40920f 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -84,16 +84,15 @@ 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(
+ asm volatile(
"0:"
"mrc p15, 0, r15, c7, c10, 3\n"
"bne 0b\n"
"mov r0, #0\n"
- "mcr p15, 0, r0, c7, c7, 0\n"
+ "mcr p15, 0, r0, c7, c7, 0\n"
: : : "r0", "cc");
#endif
}
diff --git a/py/asmx64.c b/py/asmx64.c
index cf9d8b0f23..940bd9ec4e 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -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)
@@ -164,7 +157,7 @@ void asm_x64_start_pass(asm_x64_t *as, uint pass) {
void asm_x64_end_pass(asm_x64_t *as) {
if (as->pass == ASM_X64_PASS_COMPUTE) {
MP_PLAT_ALLOC_EXEC(as->code_offset, (void**) &as->code_base, &as->code_size);
- if(as->code_base == NULL) {
+ if(as->code_base == NULL) {
assert(0);
}
//printf("code_size: %u\n", as->code_size);
diff --git a/py/compile.c b/py/compile.c
index 267eb2c181..d920187033 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -3692,7 +3692,7 @@ mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is
#elif MICROPY_EMIT_THUMB
emit_native_thumb_free(emit_native);
#elif MICROPY_EMIT_ARM
- emit_native_arm_free(emit_native);
+ emit_native_arm_free(emit_native);
#endif
}
#endif
diff --git a/py/emitnative.c b/py/emitnative.c
index 6e064fc4c3..1e1596ccc4 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -394,7 +394,7 @@ STATIC void emit_native_end_pass(emit_t *emit) {
void *f = asm_thumb_get_code(emit->as);
mp_uint_t f_len = asm_thumb_get_code_size(emit->as);
#elif N_ARM
- void *f = asm_arm_get_code(emit->as);
+ void *f = asm_arm_get_code(emit->as);
mp_uint_t f_len = asm_arm_get_code_size(emit->as);
#endif
diff --git a/unix/Makefile b/unix/Makefile
index 04a2dbda17..9d035cab76 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -75,7 +75,7 @@ SRC_C = \
file.c \
modsocket.c \
modos.c \
- alloc.c \
+ alloc.c \
$(SRC_MOD)
ifeq ($(UNAME_S),Darwin)
diff --git a/unix/alloc.c b/unix/alloc.c
index 2c09f18461..cb866c78a2 100644
--- a/unix/alloc.c
+++ b/unix/alloc.c
@@ -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);
}