2 * a utility for experimenting with mmap()-at-absolute-address-ranges
3 * as a crude way of checking whether it's reasonable for SBCL to
4 * reserve those address ranges for itself
8 * This software is part of the SBCL system. See the README file for
11 * This software is derived from the CMU CL system, which was
12 * written at Carnegie Mellon University and released into the
13 * public domain. The software is in the public domain and is
14 * provided with absolutely no warranty. See the COPYING and CREDITS
15 * files for more information.
19 #include <sys/types.h>
26 if (1 != sscanf(s, "%lx", &result)) {
27 fprintf(stderr, "can't parse \"%s\" as hexadecimal integer\n", s);
34 main(int argc, char *argv[])
39 /* FIXME: It would be nice to make the no-command-line-arguments
40 * case of this program automatically check all the spaces that
41 * SBCL likes to map. Then we could execute this program as a
42 * sanity check in make-target-2.sh before we try to execute sbcl
45 fprintf(stderr, "usage: %s $addr $size\n", argv[0]);
49 requested_addr = (char*)hexparse(argv[1]);
50 addr = mmap(requested_addr,
53 MAP_PRIVATE | MAP_ANON | MAP_FIXED,
57 /* FIXME: It would be nice to make this a stronger test. E.g.
58 * besides just trying to mmap() the area, we could check that the
59 * area is not already mapped (perhaps by checking that attempts
60 * to reference the to-be-mapped area cause SIGSEGV or SIGBUS).
61 * (At least on OpenBSD, "A successful mmap deletes any previous
62 * mapping in the allocated address range.") */
63 if (addr != requested_addr) {