sync with OpenBSD -current

This commit is contained in:
purplerain 2024-02-01 02:39:06 +00:00
parent fe0bbab526
commit 6d4aa64db6
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
32 changed files with 551 additions and 517 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.103 2024/01/11 19:16:26 miod Exp $ */
/* $OpenBSD: trap.c,v 1.104 2024/01/31 06:06:28 guenther Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@ -553,7 +553,7 @@ syscall(struct trapframe *frame)
const struct sysent *callp;
struct proc *p;
int error = ENOSYS;
register_t code, args[6], rval[2], *argp;
register_t code, *args, rval[2];
verify_smap(__func__);
uvmexp.syscalls++;
@ -565,30 +565,16 @@ syscall(struct trapframe *frame)
}
code = frame->tf_rax;
argp = &args[0];
args = (register_t *)&frame->tf_rdi;
if (code <= 0 || code >= SYS_MAXSYSCALL)
goto bad;
callp = sysent + code;
switch (callp->sy_narg) {
case 6:
args[5] = frame->tf_r9;
case 5:
args[4] = frame->tf_r8;
case 4:
args[3] = frame->tf_r10;
case 3:
args[2] = frame->tf_rdx;
case 2:
args[1] = frame->tf_rsi;
case 1:
args[0] = frame->tf_rdi;
}
rval[0] = 0;
rval[1] = 0;
error = mi_syscall(p, code, callp, argp, rval);
error = mi_syscall(p, code, callp, args, rval);
switch (error) {
case 0:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmm_machdep.c,v 1.15 2024/01/11 17:13:48 jan Exp $ */
/* $OpenBSD: vmm_machdep.c,v 1.16 2024/01/31 05:49:33 guenther Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@ -4187,7 +4187,7 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
/* Restore any guest PKRU state. */
if (vmm_softc->sc_md.pkru_enabled)
wrpkru(vcpu->vc_pkru);
wrpkru(0, vcpu->vc_pkru);
ret = vmx_enter_guest(&vcpu->vc_control_pa,
&vcpu->vc_gueststate,
@ -4197,7 +4197,7 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
/* Restore host PKRU state. */
if (vmm_softc->sc_md.pkru_enabled) {
vcpu->vc_pkru = rdpkru(0);
wrpkru(PGK_VALUE);
wrpkru(0, PGK_VALUE);
}
lidt(&idtr);
@ -6500,7 +6500,7 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp)
/* Restore any guest PKRU state. */
if (vmm_softc->sc_md.pkru_enabled)
wrpkru(vcpu->vc_pkru);
wrpkru(0, vcpu->vc_pkru);
KASSERT(vmcb->v_intercept1 & SVM_INTERCEPT_INTR);
wrmsr(MSR_AMD_VM_HSAVE_PA, vcpu->vc_svm_hsa_pa);
@ -6511,7 +6511,7 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp)
/* Restore host PKRU state. */
if (vmm_softc->sc_md.pkru_enabled) {
vcpu->vc_pkru = rdpkru(0);
wrpkru(PGK_VALUE);
wrpkru(0, PGK_VALUE);
}
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpufunc.h,v 1.39 2023/01/30 02:32:01 dv Exp $ */
/* $OpenBSD: cpufunc.h,v 1.40 2024/01/31 05:49:33 guenther Exp $ */
/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
/*-
@ -241,10 +241,10 @@ rdpkru(u_int ecx)
}
static __inline void
wrpkru(uint32_t pkru)
wrpkru(u_int ecx, uint32_t pkru)
{
uint32_t ecx = 0, edx = 0;
__asm volatile("wrpkru" : : "a" (pkru), "c" (ecx), "d" (edx));
uint32_t edx = 0;
asm volatile("wrpkru" : : "a" (pkru), "c" (ecx), "d" (edx));
}
static __inline void

View file

@ -1,4 +1,4 @@
/* $OpenBSD: frame.h,v 1.10 2018/07/10 08:57:44 guenther Exp $ */
/* $OpenBSD: frame.h,v 1.11 2024/01/31 06:06:28 guenther Exp $ */
/* $NetBSD: frame.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ */
/*-
@ -82,13 +82,13 @@
* Exception/Trap Stack Frame
*/
struct trapframe {
int64_t tf_rdi;
int64_t tf_rdi; /* ordered by syscall args... */
int64_t tf_rsi;
int64_t tf_rdx;
int64_t tf_rcx;
int64_t tf_r8;
int64_t tf_r9;
int64_t tf_r10;
int64_t tf_r8;
int64_t tf_r9; /* ...to here */
int64_t tf_rcx;
int64_t tf_r11;
int64_t tf_r12;
int64_t tf_r13;
@ -115,10 +115,10 @@ struct intrframe {
int64_t if_rdi;
int64_t if_rsi;
int64_t if_rdx;
int64_t if_rcx;
int64_t if_r10;
int64_t if_r8;
int64_t if_r9;
int64_t if_r10;
int64_t if_rcx;
int64_t if_r11;
int64_t if_r12;
int64_t if_r13;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmparam.h,v 1.19 2018/03/05 01:39:13 deraadt Exp $ */
/* $OpenBSD: vmparam.h,v 1.20 2024/02/01 00:39:57 deraadt Exp $ */
/* $NetBSD: vmparam.h,v 1.18 2003/05/21 18:04:44 thorpej Exp $ */
/*
@ -46,7 +46,8 @@
#define USRSTACK VM_MAXUSER_ADDRESS
#define KERNBASE VM_MAXUSER_ADDRESS
#define MAXTSIZ (64*1024*1024) /* max text size */
#define MAXTSIZ (128*1024*1024) /* max text size */
#ifndef DFLDSIZ
#define DFLDSIZ (128*1024*1024) /* initial data size limit */
#endif