aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-08-04 00:19:23 -0600
committerWarner Losh <imp@bsdimp.com>2021-09-10 14:13:06 -0600
commite5e44263067b0c0d401ca6deb745fd152d0a3996 (patch)
tree7963ae0272c141130a579d904fe81aed6e65ac0c
parentab77bd844b55b6b0e04c552d7e992911ff75ccd7 (diff)
bsd-user: define max args in terms of pages
For 32-bit platforms, pass in up to 256k of args. For 64-bit, bump that to 512k. Signed-off-by: Kyle Evans <kevans@freebsd.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--bsd-user/qemu.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 55d71130bb..fea1a167e4 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
+#include "qemu/units.h"
#include "exec/cpu_ldst.h"
#include "exec/exec-all.h"
@@ -101,11 +102,17 @@ extern const char *qemu_uname_release;
extern unsigned long mmap_min_addr;
/*
- * MAX_ARG_PAGES defines the number of pages allocated for arguments
- * and envelope for the new program. 32 should suffice, this gives
- * a maximum env+arg of 128kB w/4KB pages!
+ * TARGET_ARG_MAX defines the number of bytes allocated for arguments
+ * and envelope for the new program. 256k should suffice for a reasonable
+ * maxiumum env+arg in 32-bit environments, bump it up to 512k for !ILP32
+ * platforms.
*/
-#define MAX_ARG_PAGES 32
+#if TARGET_ABI_BITS > 32
+#define TARGET_ARG_MAX (512 * KiB)
+#else
+#define TARGET_ARG_MAX (256 * KiB)
+#endif
+#define MAX_ARG_PAGES (TARGET_ARG_MAX / TARGET_PAGE_SIZE)
/*
* This structure is used to hold the arguments that are