this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[mldr] Set kernel/user page shift values in memory

In the past these values would be hardcoded, but now these values are grabbed from memory.

Include the math library as part of the link libraries.

Thomas A 272dbd27 33e2d232

+10 -2
+2 -2
src/startup/mldr/CMakeLists.txt
··· 28 28 target_compile_options(mldr PRIVATE -pthread) 29 29 target_link_options(mldr PRIVATE -pthread) 30 30 31 - target_link_libraries(mldr PRIVATE -lrt -ldl mldr_dserver_rpc) 31 + target_link_libraries(mldr PRIVATE -lrt -ldl mldr_dserver_rpc -lm) 32 32 33 33 install(TARGETS mldr DESTINATION libexec/darling/usr/libexec/darling) 34 34 ··· 49 49 target_link_options(mldr32 PRIVATE -m32) 50 50 target_compile_options(mldr32 PRIVATE -pthread) 51 51 target_link_options(mldr32 PRIVATE -pthread) 52 - target_link_libraries(mldr32 PRIVATE -lrt -ldl mldr32_dserver_rpc) 52 + target_link_libraries(mldr32 PRIVATE -lrt -ldl mldr32_dserver_rpc -lm) 53 53 54 54 install(TARGETS mldr32 DESTINATION libexec/darling/usr/libexec/darling) 55 55 endif()
+8
src/startup/mldr/commpage.c
··· 2 2 #include <sys/mman.h> 3 3 #include <stdio.h> 4 4 #include <errno.h> 5 + #include <tgmath.h> 5 6 #include <string.h> 6 7 #include <stdlib.h> 7 8 #include <cpuid.h> ··· 29 30 uint64_t my_caps; 30 31 uint8_t *ncpus, *nactivecpus; 31 32 uint8_t *physcpus, *logcpus; 33 + uint8_t *user_page_shift, *kernel_page_shift; 32 34 struct sysinfo si; 33 35 34 36 commpage = (uint8_t*) mmap((void*)(_64bit ? _COMM_PAGE64_BASE_ADDRESS : _COMM_PAGE32_BASE_ADDRESS), ··· 57 59 physcpus = (uint8_t*)CGET(_COMM_PAGE_PHYSICAL_CPUS); 58 60 logcpus = (uint8_t*)CGET(_COMM_PAGE_LOGICAL_CPUS); 59 61 *physcpus = *logcpus = *ncpus; 62 + 63 + // I'm not sure if Linux has seperate page sizes for kernel and user space. 64 + // Apple's code uses left shift logical (1 << user_page_shift) to get the page size value. 65 + user_page_shift = (uint8_t*)CGET(_64bit ? _COMM_PAGE_USER_PAGE_SHIFT_64 : _COMM_PAGE_USER_PAGE_SHIFT_32); 66 + kernel_page_shift = (uint8_t*)CGET(_COMM_PAGE_KERNEL_PAGE_SHIFT); 67 + *kernel_page_shift = *user_page_shift = log2(sysconf(_SC_PAGESIZE)); 60 68 61 69 my_caps = get_cpu_caps(); 62 70 if (*ncpus == 1)