diff options
| author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-08-18 00:31:31 +0300 |
|---|---|---|
| committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-08-18 00:31:31 +0300 |
| commit | 2a6660ba595bd85a637249cb96a5f451a1aa4034 (patch) | |
| tree | 0e28cb2713536a76f59e726a9da5d1374ca0cb1b | |
| parent | 1abb449dfb1271416771913c45025b1b932c0496 (diff) | |
extmod/modmachine: Avoid conflicts with system PAGE_SIZE define, if any.
| -rw-r--r-- | extmod/modmachine.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/extmod/modmachine.c b/extmod/modmachine.c index b9ebee120..bebbc6bb8 100644 --- a/extmod/modmachine.c +++ b/extmod/modmachine.c @@ -33,12 +33,12 @@ #include <errno.h> #include <fcntl.h> #include <sys/mman.h> +#define MICROPY_PAGE_SIZE 4096 +#define MICROPY_PAGE_MASK (MICROPY_PAGE_SIZE - 1) #endif #if MICROPY_PY_MACHINE -#define PAGE_SIZE 4096 -#define PAGE_MASK (PAGE_SIZE - 1) STATIC mp_uint_t get_addr(mp_obj_t addr_o, uint align) { mp_uint_t addr = mp_obj_int_get_truncated(addr_o); @@ -58,12 +58,12 @@ STATIC mp_uint_t get_addr(mp_obj_t addr_o, uint align) { } } - mp_uint_t cur_base = addr & ~PAGE_MASK; + mp_uint_t cur_base = addr & ~MICROPY_PAGE_MASK; if (cur_base != last_base) { - map_page = (mp_uint_t)mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, cur_base); + map_page = (mp_uint_t)mmap(NULL, MICROPY_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, cur_base); last_base = cur_base; } - addr = map_page + (addr & PAGE_MASK); + addr = map_page + (addr & MICROPY_PAGE_MASK); } #endif |
