diff options
author | Shuo Wang <wangshuo_1994@foxmail.com> | 2022-11-10 11:04:53 +0800 |
---|---|---|
committer | Dave Watson <dade.watson@gmail.com> | 2022-11-15 14:40:03 -0800 |
commit | 2d004eafc77f3c6a4bd9a44b1c35735273fd4e97 (patch) | |
tree | badde92b2af774e86e30431e9577fd94137c47c1 | |
parent | e8fa8d0ca5349d01cf5505eb0d952ef26c62cc94 (diff) | |
download | libunwind-2d004eafc77f3c6a4bd9a44b1c35735273fd4e97.tar.gz |
Updated to determine PAGE_SIZE dynamically for loongarch64
apply e85b65ce fix to loongarch64
Signed-off-by: Shuo Wang <wangshuo_1994@foxmail.com>
-rw-r--r-- | src/loongarch64/Ginit.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/loongarch64/Ginit.c b/src/loongarch64/Ginit.c index 555e8d80..8994e2ee 100644 --- a/src/loongarch64/Ginit.c +++ b/src/loongarch64/Ginit.c @@ -83,8 +83,6 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, return 0; } -#define PAGE_SIZE 4096 -#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) static int mem_validate_pipe[2] = {-1, -1}; @@ -196,11 +194,14 @@ tdep_init_mem_validate (void) #ifdef HAVE_MINCORE unsigned char present = 1; - unw_word_t addr = PAGE_START((unw_word_t)&present); + size_t len = unw_page_size; + unw_word_t addr = uwn_page_start((unw_word_t)&present); unsigned char mvec[1]; int ret; - while ((ret = mincore ((void*)addr, PAGE_SIZE, (unsigned char *)mvec)) == -1 && - errno == EAGAIN) {} + while ((ret = mincore ((void*)addr, len, (unsigned char *)mvec)) == -1 && + errno == EAGAIN) + { + } if (ret == 0) { Debug(1, "using mincore to validate memory\n"); @@ -292,14 +293,8 @@ cache_valid_mem(unw_word_t addr) static int validate_mem (unw_word_t addr) { - size_t len; - - if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr)) - len = PAGE_SIZE; - else - len = PAGE_SIZE * 2; - - addr = PAGE_START(addr); + size_t len = unw_page_size; + addr = uwn_page_start(addr); if (addr == 0) return -1; |