Re: [PATCH] bsd-user: add option to enable plugins

2025-04-28 Thread Kyle Evans
y feedback from BSD side, could we consider to enable this upstream? Sorry- I have no strong opinion on plugins, but the diff looks incredibly reasonable and non-invasive. I'm not really seeing any reason we'd object, but I don't personally feel qualified to review this (except as a basic human C linter- I can't imagine the added calls breaking anything we rely on). Thanks, Kyle Evans

Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD

2024-02-05 Thread Kyle Evans
file is simply replaced by another, a directory being reported as shortened then extended is a valid and useful representation of the situation (even if not completely accurate) to avoid consumers missing the action entirely. Thanks, Kyle Evans

Re: [PATCH 1/7] bsd-user: spelling fixes

2023-09-11 Thread Kyle Evans
  | 2 +-   bsd-user/signal-common.h | 4 ++--   bsd-user/signal.c    | 6 +++---   7 files changed, 11 insertions(+), 11 deletions(-) Reviewed-by: Kyle Evans Thanks, Kyle Evans

Re: [PATCH 8/9] bsd-user: implement sysctlbyname(2)

2023-02-11 Thread Kyle Evans
On Sat, Feb 11, 2023 at 5:13 PM Richard Henderson wrote: > > On 2/10/23 13:18, Warner Losh wrote: > > From: Kyle Evans > > > > do_freebsd_sysctlbyname needs to translate the 'name' back down to a OID > > so we can intercept the special o

Re: [PATCH] linux-user,bsd-user: re-exec with G_SLICE=always-malloc

2022-10-06 Thread Kyle Evans
namically linked bsd-user and I'd go as far as to say that we have no desire to change that in the future, either -- the benefits are simply not there to outweigh the pain for our use-cases. Thanks, Kyle Evans

Re: [PATCH] tests: Add sndio to the FreeBSD CI containers / VM

2022-09-28 Thread Kyle Evans
# libs: networking > "libslirp", > + > +# libs: sndio > +"sndio", > ] > > BUILD_SCRIPT = """ > -- I'm afraid I'm not at all familiar with qemu's test setup, but sndio's a valid pkg name and I can deduce well enough from the context that these are indeed names that will be more or less passed to `pkg install` and thus, installed in the respective environments. FWIW: Reviewed-by: Kyle Evans

Re: [PATCH 22/22] bsd-user/freebsd/os-syscall.c: Implement exit

2022-02-01 Thread Kyle Evans
sd-proc.h | 43 +++ > bsd-user/freebsd/os-syscall.c | 7 ++ > 2 files changed, 50 insertions(+) > create mode 100644 bsd-user/bsd-proc.h > Reviewed-by: Kyle Evans > diff --git a/bsd-user/bsd-proc.h b/bsd-user/bsd-proc.h > new file mo

Re: [PATCH 13/22] bsd-user/bsd-file.h: Implementation details for the filesystem calls

2022-02-01 Thread Kyle Evans
s of the system call arguments. > > Signed-off-by: Warner Losh > --- > bsd-user/bsd-file.h | 39 +++ > bsd-user/freebsd/os-syscall.c | 2 ++ > 2 files changed, 41 insertions(+) > create mode 100644 bsd-user/bsd-file.h > Reviewed-b

Re: [PATCH 07/22] bsd-user/x86_64/target_arch_thread.h: Assume a FreeBSD target

2022-02-01 Thread Kyle Evans
umber of > other diffs that would be needed to make things work on OtherBSD, so it > doesn't make sense to preseve this one detail today. > > Signed-off-by: Warner Losh > --- > bsd-user/x86_64/target_arch_thread.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-)

Re: [PATCH 15/22] bsd-user/freebsd/os-syscall.c: unlock_iovec

2022-02-01 Thread Kyle Evans
On Tue, Feb 1, 2022 at 5:15 AM Warner Losh wrote: > > Releases the references to the iovec created by lock_iovec. > > Signed-off-by: Warner Losh > --- > bsd-user/freebsd/os-syscall.c | 23 +++ > 1 file changed, 23 insertions(+) > Reviewed-by: Kyle Ev

Re: [PATCH 14/22] bsd-user/freebsd/os-syscall.c: lock_iovec

2022-02-01 Thread Kyle Evans
gt; bsd-user/freebsd/os-syscall.c | 92 +++ > 1 file changed, 92 insertions(+) > Two typos, otherwise seems to LGTM: Reviewed-by: Kyle Evans > diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c > index 060134a9ecd..c21759ae7c

Re: [PATCH 12/22] bsd-user/freebsd/os-syscall.c: Add get_errno and host_to_target_errno

2022-02-01 Thread Kyle Evans
on FreeBSD they are the same on all architectures) along with a > comment about why it's the identity. > > Signed-off-by: Warner Losh > --- > bsd-user/freebsd/os-syscall.c | 23 +++ > bsd-user/qemu.h | 3 ++- > 2 files changed, 25 insertio

Re: [PATCH 18/22] bsd-user: Define target_arg64

2022-02-01 Thread Kyle Evans
s. > > Signed-off-by: Stacey Son > Signed-off-by: Warner Losh > --- > bsd-user/qemu.h | 13 + > 1 file changed, 13 insertions(+) > Reviewed-by: Kyle Evans > diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h > index a9efa807b78..af272c2a802 100644

Re: [PATCH 08/22] bsd-user: Remove bsd_type

2022-02-01 Thread Kyle Evans
> bsd-user/qemu.h | 7 --- > 2 files changed, 9 deletions(-) > Reviewed-by: Kyle Evans > diff --git a/bsd-user/main.c b/bsd-user/main.c > index bddb830e99b..88d347d05eb 100644 > --- a/bsd-user/main.c > +++ b/bsd-user/main.c > @@ -96,7 +96,6 @@ unsigned long reserved_va; >

Re: [PATCH 11/22] bsd-user/sycall.c: Now obsolete, remove

2022-02-01 Thread Kyle Evans
On Tue, Feb 1, 2022 at 5:15 AM Warner Losh wrote: > > Signed-off-by: Warner Losh > --- > bsd-user/syscall.c | 516 - > 1 file changed, 516 deletions(-) > delete mode 100644 bsd-user/syscall.c > Reviewed-by: Kyle Evans &g

Re: [PATCH 05/22] bsd-user/arm/target_arch_cpu.h: Only support FreeBSD sys calls

2022-02-01 Thread Kyle Evans
nv->thumb ? 2 : 4; > +break; > +} > +if ((unsigned int)ret >= (unsigned int)(-515)) { > +ret = -ret; > +cpsr_write(env, CPSR_C, CPSR_C, CPSRWriteByInstr); > +env->regs[0] = ret; > } else { > -fprintf(stderr, "qemu: bsd_type (= %d) syscall " > -"not supported\n", bsd_type); > +cpsr_write(env, 0, CPSR_C, CPSRWriteByInstr); > +env->regs[0] = ret; /* XXX need to handle lseek()? */ > +/* env->regs[1] = 0; */ > } > } > break; > We should probably fix the lseek() situation sooner rather than later, but: Reviewed-by: Kyle Evans

Re: [PATCH 03/22] bsd-user/x86_64/target_arch_cpu.h: Remove openbsd syscall

2022-02-01 Thread Kyle Evans
gt; --- > bsd-user/x86_64/target_arch_cpu.h | 27 --- > 1 file changed, 8 insertions(+), 19 deletions(-) > Reviewed-by: Kyle Evans As a general comment, I'd like to reach out to the others at some point and gauge interest/ability to participate, but I definite

Re: [PATCH 06/22] bsd-user/arm/target_arch_thread.h: Assume a FreeBSD target

2022-02-01 Thread Kyle Evans
> of other diffs that would be needed to make things work on OtherBSD, > so it doesn't make sense to preseve this one detail today. > > Signed-off-by: Warner Losh > --- > bsd-user/arm/target_arch_thread.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) >

Re: [PATCH 04/22] bsd-user/i386/target_arch_cpu.h: Remove openbsd syscall

2022-02-01 Thread Kyle Evans
SD again, drop it here. > > Signed-off-by: Warner Losh > --- > bsd-user/i386/target_arch_cpu.h | 84 +++-- > 1 file changed, 37 insertions(+), 47 deletions(-) > Reviewed-by: Kyle Evans > diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user

Re: [PATCH 17/22] bsd-user: introduce target.h

2022-02-01 Thread Kyle Evans
+++ > 4 files changed, 64 insertions(+) > create mode 100644 bsd-user/arm/target.h > create mode 100644 bsd-user/i386/target.h > create mode 100644 bsd-user/x86_64/target.h > Reviewed-by: Kyle Evans > diff --git a/bsd-user/arm/target.h b/bsd-user/arm/target.h > new

Re: [PATCH 02/22] bsd-user/x86_64/target_arch_cpu.h: int $80 never was a BSD system call on amd64

2022-02-01 Thread Kyle Evans
arget_arch_cpu.h | 58 --- > 1 file changed, 58 deletions(-) > Reviewed-by: Kyle Evans > diff --git a/bsd-user/x86_64/target_arch_cpu.h > b/bsd-user/x86_64/target_arch_cpu.h > index 0a9c0f08946..9dc52d5afc4 100644 > --- a/bsd-user/x86_64/target_arch_cpu.h > +++ b/bsd-

Re: [PATCH 09/22] bsd-user/freebsd/os-syscall.c: Move syscall processing here

2022-02-01 Thread Kyle Evans
nt at the end so that > + * actions, such as logging of syscall results, can be performed. All errnos > + * that do_syscall() returns must be -TARGET_. > + */ > +abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, > +abi_long arg2, abi_long arg3, abi_long arg4, > +abi_long arg5, abi_long arg6, abi_long arg7, > +abi_long arg8) > +{ > +return 0; > +} > + > +void syscall_init(void) > +{ > +} > -- > 2.33.1 > Small typo + omission, otherwise: Reviewed-by: Kyle Evans

Re: [PATCH 23/30] bsd-user/signal.c: sigset manipulation routines.

2022-01-22 Thread Kyle Evans
t host sigset to target >> > target_to_host_sigset_internal: convert target sigset to host >> > target_to_host_sigset: convert target sigset to host >> > >> > Signed-off-by: Stacey Son >> > Signed-off-by: Kyle Evans >> > Signed-off-by: Warner Losh

Re: [PATCH 21/30] bsd-user/signal.c: force_sig

2022-01-13 Thread Kyle Evans
case). My gut feeling is that it'll be more useful in the long run if we can more quickly identify parallels between the two, so changes affecting linux-user that may benefit bsd-user are more easily identified and exchanged (and vice-versa). Thanks, Kyle Evans

Re: [PATCH v4 01/36] bsd-user/mips*: Remove

2021-11-05 Thread Kyle Evans
On Fri, Nov 5, 2021 at 10:52 AM Richard Henderson wrote: > > On 11/4/21 11:18 PM, Warner Losh wrote: > > FreeBSD has dropped support for mips starting with FreeBSD 14. mips > > support has been removed from the bsd-user fork because updating it for > > new signal requirements. Remove it here since

Re: [PATCH 20/24] bsd-user/arm/target_arch_signal.h: arm set_sigtramp_args

2021-10-28 Thread Kyle Evans
On Thu, Oct 28, 2021 at 12:25 PM Richard Henderson wrote: > > On 10/19/21 9:44 AM, Warner Losh wrote: > > +regs->regs[TARGET_REG_PC] = ka->_sa_handler; > > Surely there should be some handling of thumb addresses here. > Honestly, this wouldn't surprise me- we're kind of a thumb landmine. The

Re: [PATCH 13/24] bsd-user/arm/target_arch_thread.h: Routines to create and switch to a thread

2021-10-27 Thread Kyle Evans
On Wed, Oct 27, 2021 at 10:35 AM Warner Losh wrote: > > > > On Tue, Oct 26, 2021 at 12:11 AM Kyle Evans wrote: >> >> On Tue, Oct 26, 2021 at 1:01 AM Kyle Evans wrote: >> > >> > On Tue, Oct 19, 2021 at 11:45 AM Warner Losh wrote: >> > > &

Re: [PATCH 24/24] bsd-user: add arm target build

2021-10-26 Thread Kyle Evans
-linux-user and i386-bsd-user, this seems sane and correct and I'm not aware of any other options that we would need to consider setting, so let's call it: Acked-by: Kyle Evans

Re: [PATCH 20/24] bsd-user/arm/target_arch_signal.h: arm set_sigtramp_args

2021-10-26 Thread Kyle Evans
TARGET_REG_SP] = frame_addr; > + regs->regs[TARGET_REG_LR] = TARGET_PS_STRINGS - TARGET_SZSIGCODE; > + > +return 0; > +} > + > #endif /* !_TARGET_ARCH_SIGNAL_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 18/24] bsd-user/arm/target_arch_signal.h: arm machine context for signals

2021-10-26 Thread Kyle Evans
pregset_t; > + > +typedef struct target_mcontext { > +uint32_t__gregs[TARGET__NGREG]; > +union { > +target__fpregset_t __fpregs; > + target__vfpregset_t __vfpregs; > +} __fpu; > +} target_mcontext_t; > + > #endif /* !_TARGET_ARCH_SIGNAL_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 21/24] bsd-user/arm/target_arch_signal.h: arm get_mcontext

2021-10-26 Thread Kyle Evans
gt;regs[8]); > +gr[TARGET_REG_R9] = tswap32(regs->regs[9]); > +gr[TARGET_REG_R10] = tswap32(regs->regs[10]); > +gr[TARGET_REG_R11] = tswap32(regs->regs[11]); > +gr[TARGET_REG_R12] = tswap32(regs->regs[12]); > + > +gr[TARGET_REG_SP] = tswap32(regs->regs[13])

Re: [PATCH 17/24] bsd-user/arm/target_arch_signal.h: arm specific signal registers and stack

2021-10-26 Thread Kyle Evans
G_R15 > + > +#define TARGET_INSN_SIZE4 /* arm instruction size */ > + > +/* Size of the signal trampolin code. See _sigtramp(). */ > +#define TARGET_SZSIGCODE((abi_ulong)(9 * TARGET_INSN_SIZE)) > + > +/* compare to arm/include/_limits.h */ > +#define TARGET_MINSIGSTKSZ (1024 * 4) /* min sig stack > size */ > +#define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768) /* recommended > size */ > + > +#endif /* !_TARGET_ARCH_SIGNAL_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 23/24] bsd-user/arm/target_arch_signal.h: arm get_ucontext_sigreturn

2021-10-25 Thread Kyle Evans
psr_read(regs); > + > +*target_uc = 0; > + > +if ((cpsr & CPSR_M) != ARM_CPU_MODE_USR || > +(cpsr & (CPSR_I | CPSR_F)) != 0) { > +return -TARGET_EINVAL; > +} > + > +*target_uc = target_sf; > + > +return 0; > +} > + > #endif /* !_TARGET_ARCH_SIGNAL_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 15/24] bsd-user/arm/target_arch_elf.h: arm get hwcap

2021-10-25 Thread Kyle Evans
f (cpu_isar_feature(aa32_simd_r32, cpu)) { > +hwcaps |= ARM_HWCAP_ARM_VFPD32; > +} else { > +hwcaps |= ARM_HWCAP_ARM_VFPv3D16; > +} > +} > +GET_FEATURE_ID(aa32_simdfmac, ARM_HWCAP_ARM_VFPv4); > + > +return hwcaps; > +} > + > +#undef GET_FEATURE > +#undef GET_FEATURE_ID > > #endif /* _TARGET_ARCH_ELF_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 14/24] bsd-user/arm/target_arch_elf.h: arm defines for ELF

2021-10-25 Thread Kyle Evans
_ARM > + > +#define USE_ELF_CORE_DUMP > +#define ELF_EXEC_PAGESIZE 4096 > + > +#define ELF_HWCAP 0 > + > +#endif /* _TARGET_ARCH_ELF_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 22/24] bsd-user/arm/target_arch_signal.h: arm set_mcontext

2021-10-25 Thread Kyle Evans
_SP]); > +regs->regs[14] = tswap32(gr[TARGET_REG_LR]); > +regs->regs[15] = tswap32(gr[TARGET_REG_PC]); > +cpsr = tswap32(gr[TARGET_REG_CPSR]); > +cpsr_write(regs, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr); > + > +return err; > +} > + > #endif /* !_TARGET_ARCH_SIGNAL_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 07/24] bsd-user/arm/target_arch_cpu.h: Implment trivial EXCP exceptions

2021-10-25 Thread Kyle Evans
default: > fprintf(stderr, "qemu: unhandled CPU exception 0x%x - > aborting\n", > trapnr); > -- > 2.32.0 > Modulo typo: Reviewed-by: Kyle Evans

Re: [PATCH 19/24] bsd-user/arm/target_arch_signal.h: arm user context and trapframe for signals

2021-10-25 Thread Kyle Evans
12; > +abi_ulong tf_usr_sp; > +abi_ulong tf_usr_lr; > +abi_ulong tf_svc_sp; /* Not used on arm26 */ > +abi_ulong tf_svc_lr; /* Not used on arm26 */ > +abi_ulong tf_pc; > +}; > + > #endif /* !_TARGET_ARCH_SIGNAL_H_ */ > -- > 2.32.0 > I didn't think we actually supported arm26, but I see those comments also exist verbatim in machine/frame.h; no objection to reflecting them here, as well. Reviewed-by: Kyle Evans

Re: [PATCH 13/24] bsd-user/arm/target_arch_thread.h: Routines to create and switch to a thread

2021-10-25 Thread Kyle Evans
On Tue, Oct 26, 2021 at 1:01 AM Kyle Evans wrote: > > On Tue, Oct 19, 2021 at 11:45 AM Warner Losh wrote: > > > > Implement target_thread_init (to create a thread) and target_set_upcall > > (to switch to a thread) for arm. > > > > Signed-off-by: Stace

Re: [PATCH 13/24] bsd-user/arm/target_arch_thread.h: Routines to create and switch to a thread

2021-10-25 Thread Kyle Evans
On Tue, Oct 19, 2021 at 11:45 AM Warner Losh wrote: > > Implement target_thread_init (to create a thread) and target_set_upcall > (to switch to a thread) for arm. > > Signed-off-by: Stacey Son > Signed-off-by: Klye Evans > Signed-off-by: Warner Losh > --- > bsd-user/arm/target_arch_thread.h |

Re: [PATCH 11/24] bsd-user/arm/target_arch_vmparam.h: Parameters for arm address space

2021-10-25 Thread Kyle Evans
ine TARGET_VM_MAXUSER_ADDRESS (0xc000 - (512 * MiB)) > +#define TARGET_USRSTACK TARGET_VM_MAXUSER_ADDRESS > + > +static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) > +{ > +return state->regs[13]; /* sp */ > +} > + > +static inline void set_second_rval(CPUARMState *state, abi_ulong retval2) > +{ > +state->regs[1] = retval2; > +} > + > +#endif /* ! _TARGET_ARCH_VMPARAM_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 16/24] bsd-user/arm/target_arch_elf.h: arm get_hwcap2 impl

2021-10-25 Thread Kyle Evans
aps = 0; > + > +GET_FEATURE_ID(aa32_aes, ARM_HWCAP2_ARM_AES); > +GET_FEATURE_ID(aa32_pmull, ARM_HWCAP2_ARM_PMULL); > +GET_FEATURE_ID(aa32_sha1, ARM_HWCAP2_ARM_SHA1); > +GET_FEATURE_ID(aa32_sha2, ARM_HWCAP2_ARM_SHA2); > +GET_FEATURE_ID(aa32_crc32, ARM_HWCAP2_ARM_CRC32); > +return hwcaps; > +} > + > #undef GET_FEATURE > #undef GET_FEATURE_ID > > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 12/24] bsd-user/arm/target_arch_sigtramp.h: Signal Trampoline for arm

2021-10-25 Thread Kyle Evans
++) { > +tswap32s(&sigtramp_code[i]); > +} > + > +return memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE); > +} > +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 10/24] bsd-user/arm/target_arch_reg.h: Implement core dump register copying

2021-10-25 Thread Kyle Evans
+regs->r[i] = tswapreg(env->regs[i + 1]); > +} > +regs->r_sp = tswapreg(env->regs[13]); > +regs->r_lr = tswapreg(env->regs[14]); > +regs->r_pc = tswapreg(env->regs[15]); > +regs->r_cpsr = tswapreg(cpsr_read((CPUARMState *)env)); > +} > + > +#undef tswapreg > + > +#endif /* !_TARGET_ARCH_REG_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 08/24] bsd-user/arm/target_arch_cpu.h: Implement data abort exceptions

2021-10-25 Thread Kyle Evans
t; +info.si_code = 0; > +info.si_addr = env->exception.vaddress; > +queue_signal(env, info.si_signo, &info); > + break; > case EXCP_DEBUG: > { > > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 06/24] bsd-user/arm/target_arch_cpu.h: Dummy target_cpu_loop implementation

2021-10-23 Thread Kyle Evans
trapnr); > +cpu_dump_state(cs, stderr, 0); > +abort(); > +} /* switch() */ > +process_pending_signals(env); > +} /* for (;;) */ > +} > + > static inline void target_cpu_clone_regs(CPUARMState *env, target_ulong > newsp) > { > if (newsp) { > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 03/24] bsd-user/arm/target_arch_cpu.c: Target specific TLS routines

2021-10-23 Thread Kyle Evans
env->cp15.tpidr_el[0] = newtls; > +env->cp15.tpidrro_el[0] = newtls; > +} > + > +target_ulong target_cpu_get_tls(CPUARMState *env) > +{ > +if (access_secure_reg(env)) { > +return env->cp15.tpidruro_s; > +} > +return env->cp15.tpidrro_el[0]; > +} > -- > 2.32.0 > Modulo typo: Reviewed-by: Kyle Evans

Re: [PATCH 04/24] bsd-user/arm/target_arch_cpu.h: CPU Loop definitions

2021-10-23 Thread Kyle Evans
*env, > +struct target_pt_regs *regs) > +{ > +int i; > + > +cpsr_write(env, regs->uregs[16], 0x, CPSRWriteRaw); > +for (i = 0; i < 16; i++) { > + env->regs[i] = regs->uregs[i]; > +} > +} > + > +static inline void target_cpu_reset(CPUArchState *cpu) > +{ > +} > + > +#endif /* !_TARGET_ARCH_CPU_H */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 09/24] bsd-user/arm/target_arch_cpu.h: Implement system call dispatch

2021-10-23 Thread Kyle Evans
env->regs[0] = ret; > +} else { > +cpsr_write(env, 0, CPSR_C, CPSRWriteByInstr); > +env->regs[0] = ret; /* XXX need to handle lseek()? */ > +/* env->regs[1] = 0; */ > + } > +} else { > +fprintf(stderr, "qemu: bsd_type (= %d) syscall " > +"not supported\n", bsd_type); > +} > +} > +break; > case EXCP_INTERRUPT: > /* just indicate that signals should be handled asap */ > break; > -- > 2.32.0 > Modulo typo: Reviewed-by: Kyle Evans

Re: [PATCH 05/24] bsd-user/arm/target_arch_cpu.h: Implement target_cpu_clone_regs

2021-10-23 Thread Kyle Evans
env, > } > } > > +static inline void target_cpu_clone_regs(CPUARMState *env, target_ulong > newsp) > +{ > +if (newsp) { > +env->regs[13] = newsp; > +} > +env->regs[0] = 0; > +} > + > static inline void target_cpu_reset(CPUArchState *cpu) > { > } > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 02/24] bsd-user/arm/target_syscall.h: Add copyright and update name

2021-10-23 Thread Kyle Evans
@@ -31,6 +50,6 @@ struct target_pt_regs { > #define TARGET_FREEBSD_ARM_GET_TP 3 > > #define TARGET_HW_MACHINE "arm" > -#define TARGET_HW_MACHINE_ARCH "armv6" > +#define TARGET_HW_MACHINE_ARCH "armv7" > > -#endif /* !BSD_USER_ARCH_SYSCALL_H_ */ > +#endif /* !_TARGET_ARCH_SYSCALL_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 01/24] bsd-user/arm/target_arch_sysarch.h: Use consistent include guards

2021-10-23 Thread Kyle Evans
arget_syscall.h" > #include "target_arch.h" > @@ -75,4 +75,4 @@ static inline void do_freebsd_arch_print_sysarch( > } > } > > -#endif /*!BSD_USER_ARCH_SYSARCH_H_ */ > +#endif /*!_TARGET_ARCH_SYSARCH_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured

2021-10-17 Thread Kyle Evans
On Mon, Oct 18, 2021 at 12:02 AM Warner Losh wrote: > > > > On Sun, Oct 17, 2021 at 10:29 PM Warner Losh wrote: >> >> >> >> On Sun, Oct 17, 2021 at 9:43 PM Kyle Evans wrote: >>> >>> On Fri, Oct 8, 2021 at 6:15 PM Warner Losh wrote: >>

Re: [PATCH v2 15/15] bsd-user/signal: Create a dummy signal queueing function

2021-10-17 Thread Kyle Evans
the virtual CPU as soon as > + * possible. > + */ > +void queue_signal(CPUArchState *env, int sig, target_siginfo_t *info) > +{ > +qemu_log_mask(LOG_UNIMP, "No signal queueing, dropping signal %d\n", > sig); > +} > + > void signal_init(void) > { > } > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v3 7/9] bsd-user/mmap.c: Don't mmap fd == -1 independently from MAP_ANON flag

2021-10-17 Thread Kyle Evans
nt > prot, > * worst case: we cannot map the file because the offset is not > * aligned, so we read it > */ > -if (!(flags & MAP_ANON) && > +if (fd != -1 && > (offset & ~qemu_host_page_mask) != (start & > ~qemu_host_page_mask)) { > /* > * msync() won't work here, so we return an error if write is > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured

2021-10-17 Thread Kyle Evans
27;thunk.c')) > specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) > > # needed for fuzzing binaries > -- > 2.32.0 > I don't understand the gdbstub.c removal here; don't we still want to be compiling it in, just only if the appropriate CONFIG_{BSD,LINUX}_USER knob is set? I note that it doesn't appear to be added in individual *-user/meson.build, I assume it's uncommon to add in ../foo.c in meson-land... Thanks, Kyle Evans

Re: [PATCH v3 6/9] bsd-user/mmap.c: Convert to qemu_log logging for mmap debugging

2021-10-17 Thread Kyle Evans
CL "); > +qemu_log("MAP_EXCL "); > } > if (flags & MAP_PRIVATE) { > -printf("MAP_PRIVATE "); > +qemu_log("MAP_PRIVATE "); > } > if (flags & MAP_SHARED) { > -printf("MAP_SHARED "); > +qemu_log("MAP_SHARED "); > } > if (flags & MAP_NOCORE) { > -printf("MAP_NOCORE "); > +qemu_log("MAP_NOCORE "); > } > if (flags & MAP_STACK) { > -printf("MAP_STACK "); > +qemu_log("MAP_STACK "); > } > -printf("fd=%d offset=0x%llx\n", fd, offset); > +qemu_log("fd=%d offset=0x%lx\n", fd, offset); > } > -#endif > > if ((flags & MAP_ANON) && fd != -1) { > errno = EINVAL; > -- > 2.32.0 > > Reviewed-by: Kyle Evans

Re: [PATCH v2 13/15] bsd-user/sysarch: Provide a per-arch framework for sysarch syscall

2021-10-17 Thread Kyle Evans
AGE_READ > diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c > index d3b9f431e2..d3322760f4 100644 > --- a/bsd-user/syscall.c > +++ b/bsd-user/syscall.c > @@ -88,13 +88,6 @@ static abi_long do_obreak(abi_ulong new_brk) > return 0; > } > > -#if defined(TARGET_I386) > -static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms) > -{ > -do_freebsd_arch_sysarch(env, op, parms); > -} > -#endif > - > #ifdef __FreeBSD__ > /* > * XXX this uses the undocumented oidfmt interface to find the kind of > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 10/15] bsd-user: Remove used from TaskState

2021-10-17 Thread Kyle Evans
5394c..c1170f14d9 100644 > --- a/bsd-user/qemu.h > +++ b/bsd-user/qemu.h > @@ -92,7 +92,6 @@ typedef struct TaskState { > > struct TaskState *next; > struct bsd_binprm *bprm; > -int used; /* non zero if used */ > struct image_info *info; > > struct emulated_sigtable sigtab[TARGET_NSIG]; > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 11/15] bsd-user: Add stop_all_tasks

2021-10-17 Thread Kyle Evans
it a/bsd-user/qemu.h b/bsd-user/qemu.h > index c1170f14d9..cdb85140f4 100644 > --- a/bsd-user/qemu.h > +++ b/bsd-user/qemu.h > @@ -103,6 +103,7 @@ typedef struct TaskState { > } __attribute__((aligned(16))) TaskState; > > void init_task_state(TaskState *ts); > +void stop_all_tasks(void); > extern const char *qemu_uname_release; > > /* > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 14/15] bsd-user: Rename sigqueue to qemu_sigqueue

2021-10-17 Thread Kyle Evans
t; -struct sigqueue *first_free; /* first free siginfo queue entry */ > +struct qemu_sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue > */ > +struct qemu_sigqueue *first_free; /* first free siginfo queue entry */ > int signal_pending; /* non zero if a signal may be pending */ > > uint8_t stack[]; > -- > 2.32.0 > Typo noted above in the commit message; otherwise: Reviewed-by: Kyle Evans

Re: [PATCH v2 09/15] bsd-user/target_os_elf: If ELF_HWCAP2 is defined, publish it

2021-10-17 Thread Kyle Evans
bi_ulong)geteuid()); > NEW_AUX_ENT(AT_GID, (abi_ulong)getgid()); > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 12/15] bsd-user/sysarch: Move to using do_freebsd_arch_sysarch interface

2021-10-17 Thread Kyle Evans
gt; -if (put_user(val, parms, abi_ulong)) > -return -TARGET_EFAULT; > -break; > -/* XXX handle the others... */ > - default: > -ret = -TARGET_EINVAL; > -break; > -} > -return ret; > +do_freebsd_arch_sysarch(env, op, parms); > } > #endif > > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 06/15] bsd-user/errno_defs.h: Add internal error numbers

2021-10-17 Thread Kyle Evans
modifing regs */ > +#define TARGET_ERESTART 255 /* Restart syscall */ > +#define TARGET_ERESTARTSYS TARGET_ERESTART /* Linux compat */ > + > +#endif /* ! _ERRNO_DEFS_H_ */ > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 08/15] bsd-user/target_os_elf.h: Remove fallback ELF_HWCAP and reorder

2021-10-17 Thread Kyle Evans
)); > NEW_AUX_ENT(AT_EGID, (abi_ulong)getegid()); > -features = ELF_HWCAP; > -NEW_AUX_ENT(FREEBSD_AT_HWCAP, features); > target_auxents = sp; /* Note where the aux entries are in the target > */ > #ifdef ARCH_DLINFO > /* > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 07/15] bsd-user: move TARGET_MC_GET_CLEAR_RET to target_os_signal.h

2021-10-17 Thread Kyle Evans
; +++ b/bsd-user/x86_64/target_arch_signal.h > @@ -27,8 +27,6 @@ > #define TARGET_MINSIGSTKSZ (512 * 4) /* min sig stack size */ > #define TARGET_SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended size */ > > -#define TARGET_MC_GET_CLEAR_RET 0x0001 > - > struct target_sigcontext { > /* to be added */ > }; > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 05/15] bsd-user: export get_errno and is_error from syscall.c

2021-10-17 Thread Kyle Evans
#define target_to_host_bitmask(x, tbl) (x) > > -static inline int is_error(abi_long ret) > +bool is_error(abi_long ret) > { > return (abi_ulong)ret >= (abi_ulong)(-4096); > } > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 04/15] bsd-user: TARGET_RESET define is unused, remove it

2021-10-17 Thread Kyle Evans
..5172b230f0 100644 > --- a/bsd-user/x86_64/target_arch_cpu.h > +++ b/bsd-user/x86_64/target_arch_cpu.h > @@ -23,8 +23,6 @@ > > #define TARGET_DEFAULT_CPU_MODEL "qemu64" > > -#define TARGET_CPU_RESET(cpu) > - > static inline void target_cpu_init(CPUX86State *env, > struct target_pt_regs *regs) > { > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 02/15] bsd-user/target_os-user.h: Remove support for FreeBSD older than 12.0

2021-10-14 Thread Kyle Evans
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 90 > int32_t kve_vn_type; /* Vnode type. */ > uint64_t kve_vn_size; /* File size. */ > -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 > uint32_t kve_vn_rdev_freebsd11; /* Device id if device. */ > -#else > -uint32_t kve_vn_rdev; /* Device id if device. */ > -#endif > uint16_t kve_vn_mode; /* File mode. */ > uint16_t kve_status; /* Status flags. */ > -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 > #if (__FreeBSD_version >= 1300501 && __FreeBSD_version < 140) ||\ > __FreeBSD_version >= 149 > union { > @@ -413,13 +322,6 @@ struct target_kinfo_vmentry { > #endif > uint64_t kve_vn_rdev; /* Device id if device. */ > int _kve_ispare[8]; /* Space for more stuff. */ > -#else > -int32_t _kve_ispare[12]; /* Space for more stuff. */ > -#endif > -#else /* ! __FreeBSD_version >= 90 */ > -int _kve_pad0; > -int32_t _kve_ispare[16]; /* Space for more stuff. */ > -#endif /* ! __FreeBSD_version >= 90 */ > /* Truncated before copyout in sysctl */ > char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ > }; > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v2 03/15] bsd-user/strace.list: Remove support for FreeBSD versions older than 12.0

2021-10-14 Thread Kyle Evans
quot;cap_rights_limit", NULL, NULL, NULL }, > @@ -146,9 +138,6 @@ > { TARGET_FREEBSD_NR_freebsd11_kevent, "freebsd11_kevent", NULL, NULL, NULL }, > { TARGET_FREEBSD_NR_kevent, "kevent", NULL, NULL, NULL }, > { TARGET_FREEBSD_NR_kill, "kill", NULL, NULL, NULL }, > -#if defined(__FreeBSD_version) && __FreeBSD_version < 100 > -{ TARGET_FREEBSD_NR_killpg, "killpg", NULL, NULL, NULL }, > -#endif > { TARGET_FREEBSD_NR_kqueue, "kqueue", NULL, NULL, NULL }, > { TARGET_FREEBSD_NR_ktrace, "ktrace", NULL, NULL, NULL }, > { TARGET_FREEBSD_NR_lchown, "lchown", NULL, NULL, NULL }, > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v3 4/9] bsd-user/mmap.c: mmap return ENOMEM on overflow

2021-10-14 Thread Kyle Evans
/* Check for overflows */ > +len = TARGET_PAGE_ALIGN(len); > +if (len == 0) { > +errno = ENOMEM; > +goto fail; > +} > + > real_start = start & qemu_host_page_mask; > host_offset = offset & qemu_host_page_mask; > > -- > 2.32.0 > > Reviewed-by: Kyle Evans

Re: [PATCH v3 3/9] bsd-user/mmap.c: MAP_ symbols are defined, so no need for ifdefs

2021-10-14 Thread Kyle Evans
t_mmap(abi_ulong start, abi_ulong len, int > prot, > goto fail; > } > } > -#endif /* MAP_STACK */ > -#ifdef MAP_GUARD > if ((flags & MAP_GUARD) && (prot != PROT_NONE || fd != -1 || > offset != 0 || (flags & (MAP_SHARED | MAP_PRIVATE | > /* MAP_PREFAULT | */ /* MAP_PREFAULT not in mman.h */ > @@ -462,7 +449,6 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int > prot, > errno = EINVAL; > goto fail; > } > -#endif > > if (offset & ~TARGET_PAGE_MASK) { > errno = EINVAL; > -- > 2.32.0 > > Reviewed-by: Kyle Evans

Re: [PATCH v3 9/9] bsd-user/mmap.c: assert that target_mprotect cannot fail

2021-10-14 Thread Kyle Evans
if (ret != 0) { > -start = ret; > -goto the_end; > -} > +assert(ret == 0); > } > goto the_end; > } > -- > 2.32.0 > > Reviewed-by: Kyle Evans

Re: [PATCH v3 5/9] bsd-user/mmap.c: mmap prefer MAP_ANON for BSD

2021-10-14 Thread Kyle Evans
te start so that it points to the file position at 'offset' */ > @@ -696,8 +696,7 @@ static void mmap_reserve(abi_ulong start, abi_ulong size) > } > if (real_start != real_end) { > mmap(g2h_untagged(real_start), real_end - real_start, PROT_NONE, > - MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, > - -1, 0); > + MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); > } > } > > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v3 2/9] bsd-user/mmap.c: check pread's return value to fix warnings with _FORTIFY_SOURCE

2021-10-14 Thread Kyle Evans
(start), len, offset) == -1) { > +goto fail; > +} > if (!(prot & PROT_WRITE)) { > ret = target_mprotect(start, len, prot); > if (ret != 0) { > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH v3 1/9] bsd-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag()

2021-10-14 Thread Kyle Evans
/ > if (prot_new != prot1) { > mprotect(host_start, qemu_host_page_size, prot_new); > } > +if (prot_new & PROT_WRITE) { > +memset(g2h_untagged(start), 0, end - start); > +} > } > return 0; > } > -- > 2.32.0 > Reviewed-by: Kyle Evans

Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function

2021-09-24 Thread Kyle Evans
Behind these reviews are three streams > of patches for 3 more architectures: arm, aarch64 and riscv64. > > I'll create a patch for both linux-user and fix in bsd-user as part of the > signal.c upstreaming I'm working on. > > It brings to mind something else... There's times it might be easier > to refactor between bsd-user and linux-user rather than upstream > something that's largely copied from linux-user. Is there a good > way to do that and talk about the design before I sink a ton of time > into something that's the wrong direction? > I had a proposal on this list a long while back to refactor some stuff into a top-level qemu-user that could be shared between the two, starting with safe_syscall (which syscall can be substantially shared), but it hadn't received any traction at that time. Thanks, Kyle Evans

Re: [PATCH v3 26/43] bsd-user: *BSD specific siginfo defintions

2021-09-05 Thread Kyle Evans
create mode 100644 bsd-user/i386/target_arch_signal.h > create mode 100644 bsd-user/netbsd/target_os_siginfo.h > create mode 100644 bsd-user/netbsd/target_os_signal.h > create mode 100644 bsd-user/openbsd/target_os_siginfo.h > create mode 100644 bsd-user/openbsd/target_os_signal.h > create mode 100644 bsd-user/x86_64/target_arch_signal.h > Reviewed-by: Kyle Evans

Re: [PATCH v3 30/43] bsd-user: elf cleanup

2021-09-05 Thread Kyle Evans
gned-off-by: Warner Losh > Signed-off-by: Stacey Son > Signed-off-by: Kyle Evans > Signed-off-by: Justin Hibbits > Signed-off-by: Alexander Kabaev > Acked-by: Richard Henderson > --- > bsd-user/elfload.c | 191

Re: [PATCH v3 18/43] bsd-user: save the path to the qemu emulator

2021-09-05 Thread Kyle Evans
n > --- > bsd-user/main.c | 21 + > bsd-user/qemu.h | 1 + > 2 files changed, 22 insertions(+) > Reviewed-by: Kyle Evans

Re: [PATCH v3 21/43] bsd-user: pull in target_arch_thread.h update target_arch_elf.h

2021-09-05 Thread Kyle Evans
arget_os_thread.h > create mode 100644 bsd-user/openbsd/target_os_thread.h > create mode 100644 bsd-user/x86_64/target_arch_thread.h > Minor message nits, but otherwise: Reviewed-by: Kyle Evans

Re: [PATCH v3 33/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c

2021-09-05 Thread Kyle Evans
On Thu, Sep 2, 2021 at 6:53 PM wrote: > > From: Warner Losh > > cpu_model and cpu_type will be used future commits, so move them from > main() scoped to file scoped. > > Signed-off-by: Warner Losh > Acked-by: Richard Henderson > --- > bsd-user/main.c | 4 ++-- > 1 file changed, 2 insertions(+)

Re: [PATCH v3 34/43] bsd-user: update debugging in mmap.c

2021-09-05 Thread Kyle Evans
On Thu, Sep 2, 2021 at 6:54 PM wrote: > > From: Warner Losh > > Update the debugging code for new features and different targets. > > Signed-off-by: Mikaël Urankar > Signed-off-by: Sean Bruno > Signed-off-by: Kyle Evans > Signed-off-by: Warner Losh > Acked-by: R

Re: [PATCH v3 32/43] bsd-user: Rewrite target system call definintion glue

2021-09-05 Thread Kyle Evans
> 3 files changed, 162 insertions(+), 208 deletions(-) > delete mode 100644 bsd-user/bsd-mman.h > Reviewed-by: Kyle Evans

Re: [PATCH v3 39/43] bsd-user: Refactor load_elf_sections and is_target_elf_binary

2021-09-05 Thread Kyle Evans
-- > bsd-user/elfload.c | 344 + > 1 file changed, 158 insertions(+), 186 deletions(-) > Reviewed-by: Kyle Evans

Re: [PATCH v3 36/43] bsd-user: Add target_os_user.h to capture the user/kernel structures

2021-09-05 Thread Kyle Evans
r Losh > Acked-by: Richard Henderson > --- > bsd-user/freebsd/target_os_user.h | 427 ++ > 1 file changed, 427 insertions(+) > create mode 100644 bsd-user/freebsd/target_os_user.h > Reviewed-by: Kyle Evans

Re: [PATCH v3 40/43] bsd-user: move qemu_log to later in the file

2021-09-05 Thread Kyle Evans
On Thu, Sep 2, 2021 at 6:56 PM wrote: > > From: Warner Losh > > Signed-off-by: Warner Losh > Acked-by: Richard Henderson > --- > bsd-user/main.c | 17 + > 1 file changed, 9 insertions(+), 8 deletions(-) > Subject nit: s/qemu_log/gemu_log/ Reviewed-by: Kyle Evans

Re: [PATCH v3 43/43] bsd-user: Update mapping to handle reserved and starting conditions

2021-09-05 Thread Kyle Evans
+- > 3 files changed, 392 insertions(+), 71 deletions(-) > Reviewed-by: Kyle Evans

Re: [PATCH for 6.2 12/49] bsd-user: implement path searching

2021-08-07 Thread Kyle Evans
he path at all in linux-user/. > IIRC imgact_binmisc will have the resolved path but preserve argv as it should have been were it not emulated, so we have to re-evaluate the PATH search here because we try to be faithful to the context. Thanks, Kyle Evans

Re: qemu bsd-user plans

2021-01-09 Thread Kyle Evans
;makes things better'. Given how broken bsd-user is today in qemu > upstream, at first that will a very easy standard to make. > > The first patch I'll submit will be changing MAINTAINERS to point to me, > since I'm acting as the point person in this effort. I'll then re-submit some > other changes that I've submitted in the past, but CC the FreeBSD folks that > are currently active (they were only CC'd to former developers who lack the > time to review). > Thanks for taking this on! Kyle Evans

Re: safe_syscall design guidance

2019-12-05 Thread Kyle Evans
On Mon, Oct 28, 2019 at 7:08 PM Kyle Evans wrote: > > Hi, > > We're working on improving bsd-user in a local tree and rebasing forward > to get our work suitable for upstreaming. I'm porting the safe_syscall stuff > over to bsd-user, and would like to get some design

safe_syscall design guidance

2019-10-28 Thread Kyle Evans
other arch are similar to the diff below. A full version of this can be found in my tree, currently only available on GitHub: https://github.com/kevans91/qemu-bsd-user/tree/safe_syscall -- this is applied to our version, currently based on qemu 3.1. Thoughts? Thanks, Kyle Evans diff