diff options
Diffstat (limited to 'miscutils/hexedit.c')
-rw-r--r-- | miscutils/hexedit.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/miscutils/hexedit.c b/miscutils/hexedit.c index 898d77376..f8ff9b62b 100644 --- a/miscutils/hexedit.c +++ b/miscutils/hexedit.c | |||
@@ -31,7 +31,8 @@ struct globals { | |||
31 | int fd; | 31 | int fd; |
32 | unsigned height; | 32 | unsigned height; |
33 | unsigned row; | 33 | unsigned row; |
34 | unsigned pagesize; | 34 | IF_VARIABLE_ARCH_PAGESIZE(unsigned pagesize;) |
35 | #define G_pagesize cached_pagesize(G.pagesize) | ||
35 | uint8_t *baseaddr; | 36 | uint8_t *baseaddr; |
36 | uint8_t *current_byte; | 37 | uint8_t *current_byte; |
37 | uint8_t *eof_byte; | 38 | uint8_t *eof_byte; |
@@ -46,15 +47,6 @@ struct globals { | |||
46 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ | 47 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ |
47 | } while (0) | 48 | } while (0) |
48 | 49 | ||
49 | //TODO: move to libbb | ||
50 | #if defined(__x86_64__) || defined(i386) | ||
51 | # define G_pagesize 4096 | ||
52 | # define INIT_PAGESIZE() ((void)0) | ||
53 | #else | ||
54 | # define G_pagesize (G.pagesize) | ||
55 | # define INIT_PAGESIZE() ((void)(G.pagesize = getpagesize())) | ||
56 | #endif | ||
57 | |||
58 | /* hopefully there aren't arches with PAGE_SIZE > 64k */ | 50 | /* hopefully there aren't arches with PAGE_SIZE > 64k */ |
59 | #define G_mapsize (64*1024) | 51 | #define G_mapsize (64*1024) |
60 | 52 | ||
@@ -262,7 +254,7 @@ int hexedit_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | |||
262 | int hexedit_main(int argc UNUSED_PARAM, char **argv) | 254 | int hexedit_main(int argc UNUSED_PARAM, char **argv) |
263 | { | 255 | { |
264 | INIT_G(); | 256 | INIT_G(); |
265 | INIT_PAGESIZE(); | 257 | INIT_PAGESIZE(G.pagesize); |
266 | 258 | ||
267 | get_terminal_width_height(-1, NULL, &G.height); | 259 | get_terminal_width_height(-1, NULL, &G.height); |
268 | if (1) { | 260 | if (1) { |