1 // SPDX-License-Identifier: GPL-2.0-only
2 #include <sys/mman.h>
3 #include <mmap_test.h>
4 
5 #include "../../kselftest_harness.h"
6 
TEST(infinite_rlimit)7 TEST(infinite_rlimit)
8 {
9 // Only works on 64 bit
10 #if __riscv_xlen == 64
11 	struct addresses mmap_addresses;
12 
13 	EXPECT_EQ(BOTTOM_UP, memory_layout());
14 
15 	do_mmaps(&mmap_addresses);
16 
17 	EXPECT_NE(MAP_FAILED, mmap_addresses.no_hint);
18 	EXPECT_NE(MAP_FAILED, mmap_addresses.on_37_addr);
19 	EXPECT_NE(MAP_FAILED, mmap_addresses.on_38_addr);
20 	EXPECT_NE(MAP_FAILED, mmap_addresses.on_46_addr);
21 	EXPECT_NE(MAP_FAILED, mmap_addresses.on_47_addr);
22 	EXPECT_NE(MAP_FAILED, mmap_addresses.on_55_addr);
23 	EXPECT_NE(MAP_FAILED, mmap_addresses.on_56_addr);
24 
25 	EXPECT_GT(1UL << 47, (unsigned long)mmap_addresses.no_hint);
26 	EXPECT_GT(1UL << 38, (unsigned long)mmap_addresses.on_37_addr);
27 	EXPECT_GT(1UL << 38, (unsigned long)mmap_addresses.on_38_addr);
28 	EXPECT_GT(1UL << 38, (unsigned long)mmap_addresses.on_46_addr);
29 	EXPECT_GT(1UL << 47, (unsigned long)mmap_addresses.on_47_addr);
30 	EXPECT_GT(1UL << 47, (unsigned long)mmap_addresses.on_55_addr);
31 	EXPECT_GT(1UL << 56, (unsigned long)mmap_addresses.on_56_addr);
32 #endif
33 }
34 
35 TEST_HARNESS_MAIN
36