Skip to content

Commit 11c2dbd

Browse files
charlie-rivospalmer-dabbelt
authored andcommitted
selftests: riscv: Allow mmap test to compile on 32-bit
Macros needed for 32-bit compilations were hidden behind 64-bit riscv ifdefs. Fix the 32-bit compilations by moving macros to allow the memory_layout test to run on 32-bit. Signed-off-by: Charlie Jenkins <[email protected]> Fixes: 73d0526 ("selftests: riscv: Generalize mm selftests") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 594ffcf commit 11c2dbd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/testing/selftests/riscv/mm/mmap_test.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ uint32_t random_addresses[] = {
4848
};
4949
#endif
5050

51-
// Only works on 64 bit
52-
#if __riscv_xlen == 64
5351
#define PROT (PROT_READ | PROT_WRITE)
5452
#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS)
5553

54+
// Only works on 64 bit
55+
#if __riscv_xlen == 64
5656
/* mmap must return a value that doesn't use more bits than the hint address. */
5757
static inline unsigned long get_max_value(unsigned long input)
5858
{
@@ -80,6 +80,8 @@ static inline unsigned long get_max_value(unsigned long input)
8080
})
8181
#endif /* __riscv_xlen == 64 */
8282

83+
#define TEST_MMAPS do { } while (0)
84+
8385
static inline int memory_layout(void)
8486
{
8587
void *value1 = mmap(NULL, sizeof(int), PROT, FLAGS, 0, 0);

0 commit comments

Comments
 (0)