sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-20 03:21:37 +00:00
parent fdad81bcfc
commit ed28f347da
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
53 changed files with 1138 additions and 405 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: i8259.c,v 1.11 2018/07/27 21:11:31 kettenis Exp $ */
/* $OpenBSD: i8259.c,v 1.12 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: i8259.c,v 1.2 2003/03/02 18:27:15 fvdl Exp $ */
/*
@ -100,6 +100,7 @@ struct pic i8259_pic = {
i8259_hwunmask,
i8259_setup,
i8259_setup,
NULL,
i8259_stubs,
i8259_stubs,
};

View file

@ -1,4 +1,4 @@
/* $OpenBSD: intr.c,v 1.55 2020/12/28 14:23:30 mpi Exp $ */
/* $OpenBSD: intr.c,v 1.56 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $ */
/*
@ -310,9 +310,16 @@ other:
}
return EBUSY;
found:
idtvec = idt_vec_alloc(APIC_LEVEL(level), IDT_INTR_HIGH);
if (pic->pic_allocidtvec) {
idtvec = pic->pic_allocidtvec(pic, pin,
APIC_LEVEL(level), IDT_INTR_HIGH);
} else {
idtvec = idt_vec_alloc(APIC_LEVEL(level),
IDT_INTR_HIGH);
}
if (idtvec == 0) {
free(ci->ci_isources[slot], M_DEVBUF, sizeof (struct intrsource));
free(ci->ci_isources[slot], M_DEVBUF,
sizeof (struct intrsource));
ci->ci_isources[slot] = NULL;
return EBUSY;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.288 2023/09/08 20:47:22 kn Exp $ */
/* $OpenBSD: machdep.c,v 1.289 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@ -1918,6 +1918,29 @@ idt_vec_alloc(int low, int high)
return 0;
}
int
idt_vec_alloc_range(int low, int high, int num)
{
int i, vec;
KASSERT(powerof2(num));
low = (low + num - 1) & ~(num - 1);
high = ((high + 1) & ~(num - 1)) - 1;
for (vec = low; vec <= high; vec += num) {
for (i = 0; i < num; i++) {
if (idt_allocmap[vec + i] != 0)
break;
}
if (i == num) {
for (i = 0; i < num; i++)
idt_allocmap[vec + i] = 1;
return vec;
}
}
return 0;
}
void
idt_vec_set(int vec, void (*function)(void))
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pci_machdep.h,v 1.30 2020/10/27 02:39:07 jordan Exp $ */
/* $OpenBSD: pci_machdep.h,v 1.31 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: pci_machdep.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */
/*
@ -79,8 +79,11 @@ int pci_conf_size(pci_chipset_tag_t, pcitag_t);
pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
void pci_conf_write(pci_chipset_tag_t, pcitag_t, int,
pcireg_t);
int pci_intr_enable_msivec(struct pci_attach_args *, int);
int pci_intr_map_msi(struct pci_attach_args *,
pci_intr_handle_t *);
int pci_intr_map_msivec(struct pci_attach_args *,
int, pci_intr_handle_t *);
int pci_intr_map_msix(struct pci_attach_args *,
int, pci_intr_handle_t *);
int pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pic.h,v 1.7 2014/12/16 21:20:23 tedu Exp $ */
/* $OpenBSD: pic.h,v 1.8 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: pic.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */
#ifndef _X86_PIC_H
@ -22,6 +22,7 @@ struct pic {
void (*pic_hwunmask)(struct pic *, int);
void (*pic_addroute)(struct pic *, struct cpu_info *, int, int, int);
void (*pic_delroute)(struct pic *, struct cpu_info *, int, int, int);
int (*pic_allocidtvec)(struct pic *, int, int, int);
struct intrstub *pic_level_stubs;
struct intrstub *pic_edge_stubs;
};

View file

@ -1,4 +1,4 @@
/* $OpenBSD: segments.h,v 1.15 2018/03/29 01:21:02 guenther Exp $ */
/* $OpenBSD: segments.h,v 1.16 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: segments.h,v 1.1 2003/04/26 18:39:47 fvdl Exp $ */
/*-
@ -160,6 +160,7 @@ void set_sys_segment(struct sys_segment_descriptor *, void *, size_t,
void set_mem_segment(struct mem_segment_descriptor *, void *, size_t,
int, int, int, int, int);
int idt_vec_alloc(int, int);
int idt_vec_alloc_range(int, int, int);
void idt_vec_set(int, void (*)(void));
void idt_vec_free(int);
void cpu_init_idt(void);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pci_machdep.c,v 1.77 2021/03/11 11:16:55 jsg Exp $ */
/* $OpenBSD: pci_machdep.c,v 1.78 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@ -315,10 +315,21 @@ pci_msix_table_unmap(pci_chipset_tag_t pc, pcitag_t tag,
_bus_space_unmap(memt, memh, tblsz * 16, NULL);
}
/*
* We pack the MSI vector number into the lower 8 bits of the PCI tag
* and use that as the MSI/MSI-X "PIC" pin number. This allows us to
* address 256 MSI vectors which ought to be enough for anybody.
*/
#define PCI_MSI_VEC_MASK 0xff
#define PCI_MSI_VEC(pin) ((pin) & PCI_MSI_VEC_MASK)
#define PCI_MSI_TAG(pin) ((pin) & ~PCI_MSI_VEC_MASK)
#define PCI_MSI_PIN(tag, vec) ((tag) | (vec))
void msi_hwmask(struct pic *, int);
void msi_hwunmask(struct pic *, int);
void msi_addroute(struct pic *, struct cpu_info *, int, int, int);
void msi_delroute(struct pic *, struct cpu_info *, int, int, int);
int msi_allocidtvec(struct pic *, int, int, int);
struct pic msi_pic = {
{0, {NULL}, NULL, 0, "msi", NULL, 0, 0},
@ -330,6 +341,7 @@ struct pic msi_pic = {
msi_hwunmask,
msi_addroute,
msi_delroute,
msi_allocidtvec,
NULL,
ioapic_edge_stubs
};
@ -345,57 +357,157 @@ msi_hwunmask(struct pic *pic, int pin)
}
void
msi_addroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type)
msi_addroute(struct pic *pic, struct cpu_info *ci, int pin, int idtvec,
int type)
{
pci_chipset_tag_t pc = NULL; /* XXX */
pcitag_t tag = pin;
pcitag_t tag = PCI_MSI_TAG(pin);
int vec = PCI_MSI_VEC(pin);
pcireg_t reg, addr;
int off;
if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, &reg) == 0)
panic("%s: no msi capability", __func__);
if (vec != 0)
return;
addr = 0xfee00000UL | (ci->ci_apicid << 12);
if (reg & PCI_MSI_MC_C64) {
pci_conf_write(pc, tag, off + PCI_MSI_MA, addr);
pci_conf_write(pc, tag, off + PCI_MSI_MAU32, 0);
pci_conf_write(pc, tag, off + PCI_MSI_MD64, vec);
pci_conf_write(pc, tag, off + PCI_MSI_MD64, idtvec);
} else {
pci_conf_write(pc, tag, off + PCI_MSI_MA, addr);
pci_conf_write(pc, tag, off + PCI_MSI_MD32, vec);
pci_conf_write(pc, tag, off + PCI_MSI_MD32, idtvec);
}
pci_conf_write(pc, tag, off, reg | PCI_MSI_MC_MSIE);
}
void
msi_delroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type)
msi_delroute(struct pic *pic, struct cpu_info *ci, int pin, int idtvec,
int type)
{
pci_chipset_tag_t pc = NULL; /* XXX */
pcitag_t tag = pin;
pcitag_t tag = PCI_MSI_TAG(pin);
int vec = PCI_MSI_VEC(pin);
pcireg_t reg;
int off;
if (vec != 0)
return;
if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, &reg))
pci_conf_write(pc, tag, off, reg & ~PCI_MSI_MC_MSIE);
}
int
msi_allocidtvec(struct pic *pic, int pin, int low, int high)
{
pci_chipset_tag_t pc = NULL; /* XXX */
pcitag_t tag = PCI_MSI_TAG(pin);
int vec = PCI_MSI_VEC(pin);
int idtvec, mme, off;
pcireg_t reg;
if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, &reg) == 0)
panic("%s: no msi capability", __func__);
reg = pci_conf_read(pc, tag, off);
mme = ((reg & PCI_MSI_MC_MME_MASK) >> PCI_MSI_MC_MME_SHIFT);
if (vec >= (1 << mme))
return 0;
if (vec == 0) {
idtvec = idt_vec_alloc_range(low, high, (1 << mme));
if (reg & PCI_MSI_MC_C64)
pci_conf_write(pc, tag, off + PCI_MSI_MD64, idtvec);
else
pci_conf_write(pc, tag, off + PCI_MSI_MD32, idtvec);
} else {
if (reg & PCI_MSI_MC_C64)
reg = pci_conf_read(pc, tag, off + PCI_MSI_MD64);
else
reg = pci_conf_read(pc, tag, off + PCI_MSI_MD32);
KASSERT(reg > 0);
idtvec = reg + vec;
}
return idtvec;
}
int
pci_intr_enable_msivec(struct pci_attach_args *pa, int num_vec)
{
pci_chipset_tag_t pc = pa->pa_pc;
pcitag_t tag = pa->pa_tag;
pcireg_t reg;
int mmc, mme, off;
if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || mp_busses == NULL ||
pci_get_capability(pc, tag, PCI_CAP_MSI, &off, &reg) == 0)
return 1;
mmc = ((reg & PCI_MSI_MC_MMC_MASK) >> PCI_MSI_MC_MMC_SHIFT);
if (num_vec > (1 << mmc))
return 1;
mme = ((reg & PCI_MSI_MC_MME_MASK) >> PCI_MSI_MC_MME_SHIFT);
while ((1 << mme) < num_vec)
mme++;
reg &= ~PCI_MSI_MC_MME_MASK;
reg |= (mme << PCI_MSI_MC_MME_SHIFT);
pci_conf_write(pc, tag, off, reg);
return 0;
}
int
pci_intr_map_msi(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
{
pci_chipset_tag_t pc = pa->pa_pc;
pcitag_t tag = pa->pa_tag;
pcireg_t reg;
int off;
if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || mp_busses == NULL ||
pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0)
pci_get_capability(pc, tag, PCI_CAP_MSI, &off, &reg) == 0)
return 1;
/* Make sure we only enable one MSI vector. */
reg &= ~PCI_MSI_MC_MME_MASK;
pci_conf_write(pc, tag, off, reg);
ihp->tag = tag;
ihp->line = APIC_INT_VIA_MSG;
ihp->pin = 0;
return 0;
}
int
pci_intr_map_msivec(struct pci_attach_args *pa, int vec,
pci_intr_handle_t *ihp)
{
pci_chipset_tag_t pc = pa->pa_pc;
pcitag_t tag = pa->pa_tag;
pcireg_t reg;
int mme, off;
if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || mp_busses == NULL ||
pci_get_capability(pc, tag, PCI_CAP_MSI, &off, &reg) == 0)
return 1;
mme = ((reg & PCI_MSI_MC_MME_MASK) >> PCI_MSI_MC_MME_SHIFT);
if (vec > (1 << mme))
return 0;
ihp->tag = PCI_MSI_PIN(tag, vec);
ihp->line = APIC_INT_VIA_MSG;
ihp->pin = 0;
return 0;
}
void msix_hwmask(struct pic *, int);
void msix_hwunmask(struct pic *, int);
void msix_addroute(struct pic *, struct cpu_info *, int, int, int);
@ -412,19 +524,10 @@ struct pic msix_pic = {
msix_addroute,
msix_delroute,
NULL,
NULL,
ioapic_edge_stubs
};
/*
* We pack the MSI-X vector number into the lower 8 bits of the PCI
* tag and use that as the MSI-X "PIC" pin number. This allows us to
* address 256 MSI-X vectors which ought to be enough for anybody.
*/
#define PCI_MSIX_VEC_MASK 0xff
#define PCI_MSIX_VEC(pin) ((pin) & PCI_MSIX_VEC_MASK)
#define PCI_MSIX_TAG(pin) ((pin) & ~PCI_MSIX_VEC_MASK)
#define PCI_MSIX_PIN(tag, vec) ((tag) | (vec))
void
msix_hwmask(struct pic *pic, int pin)
{
@ -436,13 +539,14 @@ msix_hwunmask(struct pic *pic, int pin)
}
void
msix_addroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type)
msix_addroute(struct pic *pic, struct cpu_info *ci, int pin, int idtvec,
int type)
{
pci_chipset_tag_t pc = NULL; /* XXX */
bus_space_tag_t memt = X86_BUS_SPACE_MEM; /* XXX */
bus_space_handle_t memh;
pcitag_t tag = PCI_MSIX_TAG(pin);
int entry = PCI_MSIX_VEC(pin);
pcitag_t tag = PCI_MSI_TAG(pin);
int entry = PCI_MSI_VEC(pin);
pcireg_t reg, addr;
uint32_t ctrl;
int off;
@ -459,7 +563,7 @@ msix_addroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type)
bus_space_write_4(memt, memh, PCI_MSIX_MA(entry), addr);
bus_space_write_4(memt, memh, PCI_MSIX_MAU32(entry), 0);
bus_space_write_4(memt, memh, PCI_MSIX_MD(entry), vec);
bus_space_write_4(memt, memh, PCI_MSIX_MD(entry), idtvec);
bus_space_barrier(memt, memh, PCI_MSIX_MA(entry), 16,
BUS_SPACE_BARRIER_WRITE);
ctrl = bus_space_read_4(memt, memh, PCI_MSIX_VC(entry));
@ -472,13 +576,14 @@ msix_addroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type)
}
void
msix_delroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type)
msix_delroute(struct pic *pic, struct cpu_info *ci, int pin, int idtvec,
int type)
{
pci_chipset_tag_t pc = NULL; /* XXX */
bus_space_tag_t memt = X86_BUS_SPACE_MEM; /* XXX */
bus_space_handle_t memh;
pcitag_t tag = PCI_MSIX_TAG(pin);
int entry = PCI_MSIX_VEC(pin);
pcitag_t tag = PCI_MSI_TAG(pin);
int entry = PCI_MSI_VEC(pin);
pcireg_t reg;
uint32_t ctrl;
@ -504,7 +609,7 @@ pci_intr_map_msix(struct pci_attach_args *pa, int vec, pci_intr_handle_t *ihp)
pcitag_t tag = pa->pa_tag;
pcireg_t reg;
KASSERT(PCI_MSIX_VEC(vec) == vec);
KASSERT(PCI_MSI_VEC(vec) == vec);
if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || mp_busses == NULL ||
pci_get_capability(pc, tag, PCI_CAP_MSIX, NULL, &reg) == 0)
@ -513,7 +618,7 @@ pci_intr_map_msix(struct pci_attach_args *pa, int vec, pci_intr_handle_t *ihp)
if (vec > PCI_MSIX_MC_TBLSZ(reg))
return 1;
ihp->tag = PCI_MSIX_PIN(tag, vec);
ihp->tag = PCI_MSI_PIN(tag, vec);
ihp->line = APIC_INT_VIA_MSGX;
ihp->pin = 0;
return 0;

View file

@ -1,4 +1,4 @@
# $OpenBSD: GENERIC,v 1.279 2023/12/28 17:36:29 stsp Exp $
# $OpenBSD: GENERIC,v 1.280 2024/01/19 06:59:10 mlarkin Exp $
#
# GENERIC machine description file
#
@ -393,6 +393,7 @@ vmx* at pci? # VMware VMXNET3 virtual interface
# PCI WiFi
athn* at pci? # Atheros AR9k (802.11a/g/n)
bwfm* at pci? # Broadcom FullMAC
iwn* at pci? # Intel WiFi Link 4965/5000/1000/6000
iwx* at pci? # Intel WiFi Link 22xxx
#qwx* at pci? # Qualcomm 802.11ax

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_re_cardbus.c,v 1.30 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_re_cardbus.c,v 1.31 2024/01/19 03:46:15 dlg Exp $ */
/*
* Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org>
@ -232,19 +232,8 @@ re_cardbus_detach(struct device *self, int flags)
struct re_cardbus_softc *csc = (void *)self;
struct rl_softc *sc = &csc->sc_rl;
struct cardbus_devfunc *ct = csc->ct;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
/* Remove timeout handler */
timeout_del(&sc->timer_handle);
/* Detach PHY */
if (LIST_FIRST(&sc->sc_mii.mii_phys) != NULL)
mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
/* Delete media stuff */
ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
if_detach(ifp);
re_detach(sc);
/* Disable interrupts */
if (sc->sc_ih != NULL)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rkdrm.c,v 1.19 2024/01/16 23:37:50 jsg Exp $ */
/* $OpenBSD: rkdrm.c,v 1.20 2024/01/19 17:51:15 kettenis Exp $ */
/* $NetBSD: rk_drm.c,v 1.3 2019/12/15 01:00:58 mrg Exp $ */
/*-
* Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@ -266,7 +266,7 @@ rkdrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
return ws_set_param(dp);
return -1;
case WSDISPLAYIO_GTYPE:
*(u_int *)data = WSDISPLAY_TYPE_RKDRM;
*(u_int *)data = WSDISPLAY_TYPE_KMS;
return 0;
case WSDISPLAYIO_GINFO:
wdf = (struct wsdisplay_fbinfo *)data;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: re.c,v 1.216 2023/11/10 15:51:20 bluhm Exp $ */
/* $OpenBSD: re.c,v 1.217 2024/01/19 03:46:14 dlg Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@ -199,6 +199,7 @@ int re_wol(struct ifnet*, int);
#endif
#if NKSTAT > 0
void re_kstat_attach(struct rl_softc *);
void re_kstat_detach(struct rl_softc *);
#endif
void in_delayed_cksum(struct mbuf *);
@ -1128,6 +1129,27 @@ fail_0:
return (1);
}
void
re_detach(struct rl_softc *sc)
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
#if NKSTAT > 0
re_kstat_detach(sc);
#endif
/* Remove timeout handler */
timeout_del(&sc->timer_handle);
/* Detach PHY */
if (LIST_FIRST(&sc->sc_mii.mii_phys) != NULL)
mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
/* Delete media stuff */
ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
if_detach(ifp);
}
int
re_newbuf(struct rl_softc *sc)
@ -2604,10 +2626,33 @@ unmap:
bus_dmamem_unmap(sc->sc_dmat,
(caddr_t)re_ks_sc->re_ks_sc_stats, sizeof(struct re_stats));
freedma:
bus_dmamem_free(sc->sc_dmat, &re_ks_sc->re_ks_sc_seg, 1);
bus_dmamem_free(sc->sc_dmat, &re_ks_sc->re_ks_sc_seg,
re_ks_sc->re_ks_sc_nsegs);
destroy:
bus_dmamap_destroy(sc->sc_dmat, re_ks_sc->re_ks_sc_map);
free:
free(re_ks_sc, M_DEVBUF, sizeof(*re_ks_sc));
}
void
re_kstat_detach(struct rl_softc *sc)
{
struct kstat *ks = sc->rl_kstat;
struct re_kstat_softc *re_ks_sc;
if (ks == NULL)
return;
kstat_remove(ks);
re_ks_sc = ks->ks_ptr;
kstat_destroy(ks);
bus_dmamap_unload(sc->sc_dmat, re_ks_sc->re_ks_sc_map);
bus_dmamem_unmap(sc->sc_dmat,
(caddr_t)re_ks_sc->re_ks_sc_stats, sizeof(struct re_stats));
bus_dmamem_free(sc->sc_dmat, &re_ks_sc->re_ks_sc_seg,
re_ks_sc->re_ks_sc_nsegs);
bus_dmamap_destroy(sc->sc_dmat, re_ks_sc->re_ks_sc_map);
free(re_ks_sc, M_DEVBUF, sizeof(*re_ks_sc));
}
#endif /* NKSTAT > 0 */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: revar.h,v 1.7 2010/07/27 20:53:39 kettenis Exp $ */
/* $OpenBSD: revar.h,v 1.8 2024/01/19 03:46:15 dlg Exp $ */
/*
* Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org>
@ -18,6 +18,7 @@
int re_intr(void *);
int re_attach(struct rl_softc *, const char *);
void re_detach(struct rl_softc *);
void re_reset(struct rl_softc *);
int re_init(struct ifnet *);
void re_stop(struct ifnet *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_bnxt.c,v 1.44 2024/01/15 08:56:45 jmatthew Exp $ */
/* $OpenBSD: if_bnxt.c,v 1.45 2024/01/19 03:25:13 jmatthew Exp $ */
/*-
* Broadcom NetXtreme-C/E network driver.
*
@ -68,6 +68,7 @@
#include <net/if.h>
#include <net/if_media.h>
#include <net/route.h>
#include <net/toeplitz.h>
#if NBPFILTER > 0
@ -75,7 +76,12 @@
#endif
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/if_ether.h>
#include <netinet/tcp.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#define BNXT_HWRM_BAR 0x10
#define BNXT_DOORBELL_BAR 0x18
@ -642,6 +648,7 @@ bnxt_attach(struct device *parent, struct device *self, void *aux)
ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 |
IFCAP_CSUM_UDPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv6 |
IFCAP_CSUM_TCPv6;
ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6;
#if NVLAN > 0
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
#endif
@ -929,7 +936,7 @@ bnxt_queue_up(struct bnxt_softc *sc, struct bnxt_queue *bq)
for (i = 0; i < tx->tx_ring.ring_size; i++) {
bs = &tx->tx_slots[i];
if (bus_dmamap_create(sc->sc_dmat, BNXT_MAX_MTU, BNXT_MAX_TX_SEGS,
if (bus_dmamap_create(sc->sc_dmat, MAXMCLBYTES, BNXT_MAX_TX_SEGS,
BNXT_MAX_MTU, 0, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
&bs->bs_map) != 0) {
printf("%s: failed to allocate tx dma maps\n",
@ -1337,11 +1344,12 @@ bnxt_start(struct ifqueue *ifq)
struct bnxt_tx_queue *tx = ifq->ifq_softc;
struct bnxt_softc *sc = tx->tx_softc;
struct bnxt_slot *bs;
struct ether_extracted ext;
bus_dmamap_t map;
struct mbuf *m;
u_int idx, free, used, laststart;
uint16_t txflags;
int i;
uint16_t txflags, lflags;
int i, slen;
txring = (struct tx_bd_short *)BNXT_DMA_KVA(tx->tx_ring_mem);
@ -1385,12 +1393,16 @@ bnxt_start(struct ifqueue *ifq)
txring[idx].len = htole16(map->dm_segs[0].ds_len);
txring[idx].opaque = tx->tx_prod;
txring[idx].addr = htole64(map->dm_segs[0].ds_addr);
if (m->m_pkthdr.csum_flags & M_TCP_TSO)
slen = m->m_pkthdr.ph_mss;
else
slen = map->dm_mapsize;
if (map->dm_mapsize < 512)
if (slen < 512)
txflags = TX_BD_LONG_FLAGS_LHINT_LT512;
else if (map->dm_mapsize < 1024)
else if (slen < 1024)
txflags = TX_BD_LONG_FLAGS_LHINT_LT1K;
else if (map->dm_mapsize < 2048)
else if (slen < 2048)
txflags = TX_BD_LONG_FLAGS_LHINT_LT2K;
else
txflags = TX_BD_LONG_FLAGS_LHINT_GTE2K;
@ -1409,12 +1421,44 @@ bnxt_start(struct ifqueue *ifq)
/* long tx descriptor */
txhi = (struct tx_bd_long_hi *)&txring[idx];
memset(txhi, 0, sizeof(*txhi));
txflags = 0;
if (m->m_pkthdr.csum_flags & (M_UDP_CSUM_OUT | M_TCP_CSUM_OUT))
txflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
if (m->m_pkthdr.csum_flags & M_IPV4_CSUM_OUT)
txflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
txhi->lflags = htole16(txflags);
lflags = 0;
if (m->m_pkthdr.csum_flags & M_TCP_TSO) {
uint16_t hdrsize;
uint32_t outlen;
uint32_t paylen;
ether_extract_headers(m, &ext);
if (ext.tcp) {
lflags |= TX_BD_LONG_LFLAGS_LSO;
hdrsize = sizeof(*ext.eh);
if (ext.ip4)
hdrsize += ext.ip4->ip_hl << 2;
else if (ext.ip6)
hdrsize += sizeof(*ext.ip6);
else
tcpstat_inc(tcps_outbadtso);
hdrsize += ext.tcp->th_off << 2;
txhi->hdr_size = htole16(hdrsize / 2);
outlen = m->m_pkthdr.ph_mss;
txhi->mss = htole32(outlen);
paylen = m->m_pkthdr.len - hdrsize;
tcpstat_add(tcps_outpkttso,
(paylen + outlen + 1) / outlen);
} else {
tcpstat_inc(tcps_outbadtso);
}
} else {
if (m->m_pkthdr.csum_flags & (M_UDP_CSUM_OUT |
M_TCP_CSUM_OUT))
lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
if (m->m_pkthdr.csum_flags & M_IPV4_CSUM_OUT)
lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
}
txhi->lflags = htole16(lflags);
#if NVLAN > 0
if (m->m_flags & M_VLANTAG) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_re_pci.c,v 1.56 2022/03/11 18:00:48 mpi Exp $ */
/* $OpenBSD: if_re_pci.c,v 1.57 2024/01/19 03:46:15 dlg Exp $ */
/*
* Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org>
@ -223,19 +223,8 @@ re_pci_detach(struct device *self, int flags)
{
struct re_pci_softc *psc = (struct re_pci_softc *)self;
struct rl_softc *sc = &psc->sc_rl;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
/* Remove timeout handler */
timeout_del(&sc->timer_handle);
/* Detach PHY */
if (LIST_FIRST(&sc->sc_mii.mii_phys) != NULL)
mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
/* Delete media stuff */
ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
if_detach(ifp);
re_detach(sc);
/* Disable interrupts */
if (sc->sc_ih != NULL)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pcireg.h,v 1.61 2022/06/17 10:08:36 kettenis Exp $ */
/* $OpenBSD: pcireg.h,v 1.62 2024/01/19 18:38:16 kettenis Exp $ */
/* $NetBSD: pcireg.h,v 1.26 2000/05/10 16:58:42 thorpej Exp $ */
/*
@ -516,8 +516,10 @@ typedef u_int8_t pci_revision_t;
*/
#define PCI_MSI_MC 0x00
#define PCI_MSI_MC_C64 0x00800000
#define PCI_MSI_MC_MME 0x00700000
#define PCI_MSI_MC_MMC 0x000e0000
#define PCI_MSI_MC_MME_MASK 0x00700000
#define PCI_MSI_MC_MME_SHIFT 20
#define PCI_MSI_MC_MMC_MASK 0x000e0000
#define PCI_MSI_MC_MMC_SHIFT 17
#define PCI_MSI_MC_MSIE 0x00010000
#define PCI_MSI_MA 0x04
#define PCI_MSI_MAU32 0x08

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wsconsio.h,v 1.100 2023/07/02 21:44:04 bru Exp $ */
/* $OpenBSD: wsconsio.h,v 1.101 2024/01/19 17:51:15 kettenis Exp $ */
/* $NetBSD: wsconsio.h,v 1.74 2005/04/28 07:15:44 martin Exp $ */
/*
@ -461,7 +461,7 @@ struct wsmouse_parameters {
#define WSDISPLAY_TYPE_INTELDRM 69 /* Intel KMS framebuffer */
#define WSDISPLAY_TYPE_RADEONDRM 70 /* ATI Radeon KMS framebuffer */
#define WSDISPLAY_TYPE_EFIFB 71 /* EFI framebuffer */
#define WSDISPLAY_TYPE_RKDRM 72 /* Rockchip KMS framebuffer */
#define WSDISPLAY_TYPE_KMS 72 /* Generic KMS framebuffer */
#define WSDISPLAY_TYPE_ASTFB 73 /* AST framebuffer */
#define WSDISPLAY_TYPE_VIOGPU 74 /* VirtIO GPU */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_exit.c,v 1.219 2024/01/16 19:05:01 deraadt Exp $ */
/* $OpenBSD: kern_exit.c,v 1.220 2024/01/19 01:43:26 bluhm Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@ -165,8 +165,6 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
/* main thread gotta wait because it has the pid, et al */
while (pr->ps_threadcnt > 1)
tsleep_nsec(&pr->ps_threads, PWAIT, "thrdeath", INFSLP);
LIST_REMOVE(pr, ps_list);
refcnt_finalize(&pr->ps_refcnt, "psdtor");
}
rup = pr->ps_ru;
@ -259,6 +257,7 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
if ((p->p_flag & P_THREAD) == 0) {
LIST_REMOVE(pr, ps_hash);
LIST_REMOVE(pr, ps_list);
if ((pr->ps_flags & PS_NOZOMBIE) == 0)
LIST_INSERT_HEAD(&zombprocess, pr, ps_list);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_fork.c,v 1.255 2024/01/16 19:05:01 deraadt Exp $ */
/* $OpenBSD: kern_fork.c,v 1.256 2024/01/19 01:43:26 bluhm Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@ -197,7 +197,6 @@ process_initialize(struct process *pr, struct proc *p)
LIST_INIT(&pr->ps_sigiolst);
TAILQ_INIT(&pr->ps_tslpqueue);
refcnt_init(&pr->ps_refcnt);
rw_init(&pr->ps_lock, "pslock");
mtx_init(&pr->ps_mtx, IPL_HIGH);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_proc.c,v 1.96 2024/01/15 15:47:37 mvs Exp $ */
/* $OpenBSD: kern_proc.c,v 1.97 2024/01/19 01:43:27 bluhm Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
@ -231,26 +231,6 @@ prfind(pid_t pid)
return (NULL);
}
struct process *
priterator(struct process *ps)
{
struct process *nps;
KERNEL_ASSERT_LOCKED();
if (ps == NULL)
nps = LIST_FIRST(&allprocess);
else
nps = LIST_NEXT(ps, ps_list);
if (nps)
refcnt_take(&nps->ps_refcnt);
if (ps)
refcnt_rele_wake(&ps->ps_refcnt);
return nps;
}
/*
* Locate a process group by number
*/

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.423 2024/01/18 08:48:32 mvs Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.424 2024/01/19 01:43:27 bluhm Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -1529,7 +1529,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
break;
}
matched = 0;
for (pr = priterator(NULL); pr != NULL; pr = priterator(pr)) {
LIST_FOREACH(pr, &allprocess, ps_list) {
/*
* skip system, exiting, embryonic and undead
* processes
@ -1561,7 +1561,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
error = ESRCH;
break;
case KERN_FILE_BYUID:
for (pr = priterator(NULL); pr != NULL; pr = priterator(pr)) {
LIST_FOREACH(pr, &allprocess, ps_list) {
/*
* skip system, exiting, embryonic and undead
* processes

View file

@ -1,4 +1,4 @@
/* $OpenBSD: subr_extent.c,v 1.64 2022/12/05 23:18:37 deraadt Exp $ */
/* $OpenBSD: subr_extent.c,v 1.65 2024/01/19 22:12:24 kettenis Exp $ */
/* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */
/*-
@ -398,9 +398,10 @@ extent_insert_and_optimize(struct extent *ex, u_long start, u_long size,
* Allocate a specific region in an extent map.
*/
int
extent_alloc_region(struct extent *ex, u_long start, u_long size, int flags)
extent_do_alloc_region(struct extent *ex, u_long start, u_long size,
int flags, struct extent_region *myrp)
{
struct extent_region *rp, *last, *myrp;
struct extent_region *rp, *last;
u_long end = start + (size - 1);
int error;
@ -435,23 +436,11 @@ extent_alloc_region(struct extent *ex, u_long start, u_long size, int flags)
__func__, start, end);
panic("%s: region lies outside extent", __func__);
#else
extent_free_region_descriptor(ex, myrp);
return (EINVAL);
#endif
}
/*
* Allocate the region descriptor. It will be freed later
* if we can coalesce with another region.
*/
myrp = extent_alloc_region_descriptor(ex, flags);
if (myrp == NULL) {
#ifdef DIAGNOSTIC
printf(
"%s: can't allocate region descriptor\n", __func__);
#endif
return (ENOMEM);
}
alloc_start:
/*
* Attempt to place ourselves in the desired area of the
@ -567,6 +556,39 @@ extent_alloc_region(struct extent *ex, u_long start, u_long size, int flags)
return (0);
}
int
extent_alloc_region(struct extent *ex, u_long start, u_long size, int flags)
{
struct extent_region *rp;
/*
* Allocate the region descriptor. It will be freed later
* if we can coalesce with another region.
*/
rp = extent_alloc_region_descriptor(ex, flags);
if (rp == NULL) {
#ifdef DIAGNOSTIC
printf("%s: can't allocate region descriptor\n", __func__);
#endif
return (ENOMEM);
}
return extent_do_alloc_region(ex, start, size, flags, rp);
}
int
extent_alloc_region_with_descr(struct extent *ex, u_long start,
u_long size, int flags, struct extent_region *rp)
{
#ifdef DIAGNOSTIC
if ((ex->ex_flags & EXF_NOCOALESCE) == 0)
panic("%s: EX_NOCOALESCE not set", __func__);
#endif
rp->er_flags = ER_DISCARD;
return extent_do_alloc_region(ex, start, size, flags, rp);
}
/*
* Macro to check (x + y) <= z. This check is designed to fail
* if an overflow occurs.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in_pcb.c,v 1.285 2024/01/18 11:03:16 claudio Exp $ */
/* $OpenBSD: in_pcb.c,v 1.286 2024/01/19 02:24:07 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@ -517,7 +517,7 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
#ifdef INET6
if (ISSET(inp->inp_flags, INP_IPV6))
return (in6_pcbconnect(inp, nam));
#endif /* INET6 */
#endif
if ((error = in_nam2sin(nam, &sin)))
return (error);
@ -652,6 +652,13 @@ in_setsockaddr(struct inpcb *inp, struct mbuf *nam)
{
struct sockaddr_in *sin;
#ifdef INET6
if (ISSET(inp->inp_flags, INP_IPV6)) {
in6_setsockaddr(inp, nam);
return;
}
#endif
nam->m_len = sizeof(*sin);
sin = mtod(nam, struct sockaddr_in *);
memset(sin, 0, sizeof(*sin));
@ -671,7 +678,7 @@ in_setpeeraddr(struct inpcb *inp, struct mbuf *nam)
in6_setpeeraddr(inp, nam);
return;
}
#endif /* INET6 */
#endif
nam->m_len = sizeof(*sin);
sin = mtod(nam, struct sockaddr_in *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_usrreq.c,v 1.228 2024/01/11 13:49:49 bluhm Exp $ */
/* $OpenBSD: tcp_usrreq.c,v 1.229 2024/01/19 02:24:07 bluhm Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@ -502,7 +502,7 @@ tcp_detach(struct socket *so)
{
struct inpcb *inp;
struct tcpcb *otp = NULL, *tp;
int error = 0;
int error;
short ostate;
soassertlocked(so);
@ -526,7 +526,7 @@ tcp_detach(struct socket *so)
if (otp)
tcp_trace(TA_USER, ostate, tp, otp, NULL, PRU_DETACH, 0);
return (error);
return (0);
}
/*
@ -685,26 +685,17 @@ tcp_accept(struct socket *so, struct mbuf *nam)
struct inpcb *inp;
struct tcpcb *tp;
int error;
short ostate;
soassertlocked(so);
if ((error = tcp_sogetpcb(so, &inp, &tp)))
return (error);
if (so->so_options & SO_DEBUG)
ostate = tp->t_state;
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
in6_setpeeraddr(inp, nam);
else
#endif
in_setpeeraddr(inp, nam);
in_setpeeraddr(inp, nam);
if (so->so_options & SO_DEBUG)
tcp_trace(TA_USER, ostate, tp, tp, NULL, PRU_ACCEPT, 0);
return (error);
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL, PRU_ACCEPT, 0);
return (0);
}
/*
@ -994,12 +985,7 @@ tcp_sockaddr(struct socket *so, struct mbuf *nam)
if ((error = tcp_sogetpcb(so, &inp, &tp)))
return (error);
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
in6_setsockaddr(inp, nam);
else
#endif
in_setsockaddr(inp, nam);
in_setsockaddr(inp, nam);
if (so->so_options & SO_DEBUG)
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL,
@ -1019,16 +1005,10 @@ tcp_peeraddr(struct socket *so, struct mbuf *nam)
if ((error = tcp_sogetpcb(so, &inp, &tp)))
return (error);
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
in6_setpeeraddr(inp, nam);
else
#endif
in_setpeeraddr(inp, nam);
in_setpeeraddr(inp, nam);
if (so->so_options & SO_DEBUG)
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL,
PRU_PEERADDR, 0);
tcp_trace(TA_USER, tp->t_state, tp, tp, NULL, PRU_PEERADDR, 0);
return (0);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: udp_usrreq.c,v 1.313 2024/01/10 16:44:30 bluhm Exp $ */
/* $OpenBSD: udp_usrreq.c,v 1.314 2024/01/19 02:24:07 bluhm Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@ -936,9 +936,9 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct mbuf *addr,
struct in_addr laddr;
int error = 0;
#ifdef DIAGNOSTIC
if ((inp->inp_flags & INP_IPV6) != 0)
panic("IPv6 inpcb to %s", __func__);
#ifdef INET6
if (ISSET(inp->inp_flags, INP_IPV6))
return (udp6_output(inp, m, addr, control));
#endif
/*
@ -1230,7 +1230,6 @@ udp_send(struct socket *so, struct mbuf *m, struct mbuf *addr,
struct mbuf *control)
{
struct inpcb *inp = sotoinpcb(so);
int error;
soassertlocked(so);
@ -1265,14 +1264,7 @@ udp_send(struct socket *so, struct mbuf *m, struct mbuf *addr,
}
#endif
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
error = udp6_output(inp, m, addr, control);
else
#endif
error = udp_output(inp, m, addr, control);
return (error);
return (udp_output(inp, m, addr, control));
}
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: extent.h,v 1.14 2014/02/08 20:29:01 kettenis Exp $ */
/* $OpenBSD: extent.h,v 1.15 2024/01/19 22:12:24 kettenis Exp $ */
/* $NetBSD: extent.h,v 1.6 1997/10/09 07:43:05 jtc Exp $ */
/*-
@ -110,6 +110,8 @@ int extent_alloc_subregion_with_descr(struct extent *, u_long, u_long,
u_long, u_long, u_long, u_long, int, struct extent_region *,
u_long *);
int extent_alloc_region(struct extent *, u_long, u_long, int);
int extent_alloc_region_with_descr(struct extent *, u_long, u_long,
int, struct extent_region *);
int extent_free(struct extent *, u_long, u_long, int);
void extent_print(struct extent *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: proc.h,v 1.354 2024/01/16 19:05:00 deraadt Exp $ */
/* $OpenBSD: proc.h,v 1.355 2024/01/19 01:43:27 bluhm Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@ -50,7 +50,6 @@
#include <sys/resource.h> /* For struct rusage */
#include <sys/rwlock.h> /* For struct rwlock */
#include <sys/sigio.h> /* For struct sigio */
#include <sys/refcnt.h>
#ifdef _KERNEL
#include <sys/atomic.h>
@ -172,7 +171,6 @@ struct process {
struct futex_list ps_ftlist; /* futexes attached to this process */
struct tslpqueue ps_tslpqueue; /* [p] queue of threads in thrsleep */
struct refcnt ps_refcnt;
struct rwlock ps_lock; /* per-process rwlock */
struct mutex ps_mtx; /* per-process mutex */
@ -540,7 +538,6 @@ void freepid(pid_t);
struct process *prfind(pid_t); /* Find process by id. */
struct process *zombiefind(pid_t); /* Find zombie process by id. */
struct process *priterator(struct process *);
struct proc *tfind(pid_t); /* Find thread by id. */
struct pgrp *pgfind(pid_t); /* Find process group by id. */
struct proc *tfind_user(pid_t, struct process *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ffs_vfsops.c,v 1.196 2024/01/09 03:16:00 guenther Exp $ */
/* $OpenBSD: ffs_vfsops.c,v 1.197 2024/01/19 18:58:17 deraadt Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@ -886,7 +886,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
strlcpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname, sizeof(fs->fs_fsmnt));
#if 0
if( mp->mnt_flag & MNT_ROOTFS) {
if (mp->mnt_flag & MNT_ROOTFS) {
/*
* Root mount; update timestamp in mount structure.
* this will be used by the common root mount code

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_extern.h,v 1.172 2024/01/17 22:22:25 kurt Exp $ */
/* $OpenBSD: uvm_extern.h,v 1.173 2024/01/19 21:20:35 deraadt Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
@ -214,8 +214,6 @@ struct vmspace {
caddr_t vm_daddr; /* [I] user virtual address of data */
caddr_t vm_maxsaddr; /* [I] user VA at max stack growth */
caddr_t vm_minsaddr; /* [I] user VA at top of stack */
vaddr_t vm_execve; /* [v] execve systemcall stub region */
vaddr_t vm_execve_end; /* [v] execve systemcall stub region */
};
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_mmap.c,v 1.184 2024/01/16 19:05:01 deraadt Exp $ */
/* $OpenBSD: uvm_mmap.c,v 1.185 2024/01/19 21:20:35 deraadt Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@ -618,29 +618,6 @@ sys_msyscall(struct proc *p, void *v, register_t *retval)
int
sys_pinsyscall(struct proc *p, void *v, register_t *retval)
{
struct sys_pinsyscall_args /* {
syscallarg(int) syscall;
syscallarg(void *) addr;
syscallarg(size_t) len;
} */ *uap = v;
struct vmspace *vm = p->p_vmspace;
vm_map_t map = &p->p_vmspace->vm_map;
vaddr_t start, end;
if (SCARG(uap, syscall) != SYS_execve)
return (EINVAL);
start = (vaddr_t)SCARG(uap, addr);
end = start + (vsize_t)SCARG(uap, len);
if (start >= end || start < map->min_offset || end > map->max_offset)
return (EFAULT);
vm_map_lock(map);
if (vm->vm_execve) {
vm_map_unlock(map);
return (EPERM);
}
vm->vm_execve = start;
vm->vm_execve_end = end;
vm_map_unlock(map);
return (0);
}