[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 24/43] bsd-user: Create target specific vmparam.h
From: |
imp |
Subject: |
[PATCH v3 24/43] bsd-user: Create target specific vmparam.h |
Date: |
Thu, 2 Sep 2021 17:47:10 -0600 |
From: Warner Losh <imp@FreeBSD.org>
Target specific values for vm parameters and details.
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
bsd-user/freebsd/target_os_vmparam.h | 38 ++++++++++++++++++++++
bsd-user/i386/target_arch_vmparam.h | 46 +++++++++++++++++++++++++++
bsd-user/qemu.h | 1 +
bsd-user/x86_64/target_arch_vmparam.h | 46 +++++++++++++++++++++++++++
4 files changed, 131 insertions(+)
create mode 100644 bsd-user/freebsd/target_os_vmparam.h
create mode 100644 bsd-user/i386/target_arch_vmparam.h
create mode 100644 bsd-user/x86_64/target_arch_vmparam.h
diff --git a/bsd-user/freebsd/target_os_vmparam.h
b/bsd-user/freebsd/target_os_vmparam.h
new file mode 100644
index 0000000000..990300c619
--- /dev/null
+++ b/bsd-user/freebsd/target_os_vmparam.h
@@ -0,0 +1,38 @@
+/*
+ * FreeBSD VM parameters definitions
+ *
+ * Copyright (c) 2013 Stacey D. Son
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _TARGET_OS_VMPARAM_H_
+#define _TARGET_OS_VMPARAM_H_
+
+#include "target_arch_vmparam.h"
+
+/* Compare to sys/exec.h */
+struct target_ps_strings {
+ abi_ulong ps_argvstr;
+ uint32_t ps_nargvstr;
+ abi_ulong ps_envstr;
+ uint32_t ps_nenvstr;
+};
+
+extern abi_ulong target_stkbas;
+extern abi_ulong target_stksiz;
+
+#define TARGET_PS_STRINGS ((target_stkbas + target_stksiz) - \
+ sizeof(struct target_ps_strings))
+
+#endif /* !TARGET_OS_VMPARAM_H_ */
diff --git a/bsd-user/i386/target_arch_vmparam.h
b/bsd-user/i386/target_arch_vmparam.h
new file mode 100644
index 0000000000..bb7718265b
--- /dev/null
+++ b/bsd-user/i386/target_arch_vmparam.h
@@ -0,0 +1,46 @@
+/*
+ * i386 VM parameters definitions
+ *
+ * Copyright (c) 2013 Stacey D. Son
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _TARGET_ARCH_VMPARAM_H_
+#define _TARGET_ARCH_VMPARAM_H_
+
+#include "cpu.h"
+
+/* compare to i386/include/vmparam.h */
+#define TARGET_MAXTSIZ (128 * MiB) /* max text size */
+#define TARGET_DFLDSIZ (128 * MiB) /* initial data size limit */
+#define TARGET_MAXDSIZ (512 * MiB) /* max data size */
+#define TARGET_DFLSSIZ (8 * MiB) /* initial stack size limit */
+#define TARGET_MAXSSIZ (64 * MiB) /* max stack size */
+#define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */
+
+#define TARGET_RESERVED_VA 0xf7000000
+
+#define TARGET_USRSTACK (0xbfc00000)
+
+static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
+{
+ return state->regs[R_ESP];
+}
+
+static inline void set_second_rval(CPUX86State *state, abi_ulong retval2)
+{
+ state->regs[R_EDX] = retval2;
+}
+
+#endif /* !_TARGET_ARCH_VMPARAM_H_ */
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index fea1a167e4..1b37757e06 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -41,6 +41,7 @@ extern enum BSDType bsd_type;
#include "target_arch.h"
#include "syscall_defs.h"
#include "target_syscall.h"
+#include "target_os_vmparam.h"
#include "exec/gdbstub.h"
/*
diff --git a/bsd-user/x86_64/target_arch_vmparam.h
b/bsd-user/x86_64/target_arch_vmparam.h
new file mode 100644
index 0000000000..81a915f2e5
--- /dev/null
+++ b/bsd-user/x86_64/target_arch_vmparam.h
@@ -0,0 +1,46 @@
+/*
+ * Intel x86_64 VM parameters definitions
+ *
+ * Copyright (c) 2013 Stacey D. Son
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _TARGET_ARCH_VMPARAM_H_
+#define _TARGET_ARCH_VMPARAM_H_
+
+#include "cpu.h"
+
+/* compare to amd64/include/vmparam.h */
+#define TARGET_MAXTSIZ (128 * MiB) /* max text size */
+#define TARGET_DFLDSIZ (32 * GiB) /* initial data size limit */
+#define TARGET_MAXDSIZ (32 * GiB) /* max data size */
+#define TARGET_DFLSSIZ (8 * MiB) /* initial stack size limit */
+#define TARGET_MAXSSIZ (512 * MiB) /* max stack size */
+#define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */
+
+#define TARGET_VM_MAXUSER_ADDRESS (0x00007fffff000000UL)
+
+#define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE)
+
+static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
+{
+ return state->regs[R_ESP];
+}
+
+static inline void set_second_rval(CPUX86State *state, abi_ulong retval2)
+{
+ state->regs[R_EDX] = retval2;
+}
+
+#endif /* !_TARGET_ARCH_VMPARAM_H_ */
--
2.32.0
- Re: [PATCH v3 26/43] bsd-user: *BSD specific siginfo defintions, (continued)
- [PATCH v3 21/43] bsd-user: pull in target_arch_thread.h update target_arch_elf.h, imp, 2021/09/02
- [PATCH v3 30/43] bsd-user: elf cleanup, imp, 2021/09/02
- [PATCH v3 19/43] bsd-user: start to move target CPU functions to target_arch*, imp, 2021/09/02
- [PATCH v3 15/43] bsd-user: assume pthreads and support of __thread, imp, 2021/09/02
- [PATCH v3 23/43] bsd-user: define max args in terms of pages, imp, 2021/09/02
- [PATCH v3 22/43] bsd-user: Include more things in qemu.h, imp, 2021/09/02
- [PATCH v3 24/43] bsd-user: Create target specific vmparam.h,
imp <=
- [PATCH v3 33/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c, imp, 2021/09/02
- [PATCH v3 31/43] bsd-user: Remove dead #ifdefs from elfload.c, imp, 2021/09/02
- [PATCH v3 35/43] bsd-user: Add target_arch_reg to describe a target's register set, imp, 2021/09/02
- [PATCH v3 20/43] bsd-user: Move per-cpu code into target_arch_cpu.h, imp, 2021/09/02
- [PATCH v3 37/43] bsd-user: add stubbed out core dump support, imp, 2021/09/02
- [PATCH v3 41/43] bsd-user: Implement interlock for atomic operations, imp, 2021/09/02