mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-03 08:49:22 +00:00
Compare commits
16 Commits
79cd1ddff6
...
7f7f1bb7ec
Author | SHA1 | Date | |
---|---|---|---|
|
7f7f1bb7ec | ||
|
2cb7605a24 | ||
|
8502c68d29 | ||
|
5afc347944 | ||
|
7d37fcbf52 | ||
|
7e5574f9e5 | ||
|
b2351a4ba5 | ||
|
3da568710f | ||
|
7d6932d20a | ||
|
f29bdea047 | ||
|
07cc7ea738 | ||
|
d25f0bdceb | ||
|
8aa9192ce9 | ||
|
44d4ee7f3d | ||
|
d5963606f0 | ||
|
f29ea08fd3 |
|
@ -54,7 +54,7 @@ pio2_2t = 2.0670321098263988236496903051604844e-43L, /* 0x127044533e63a0105df5
|
||||||
pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */
|
pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */
|
||||||
pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */
|
pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */
|
||||||
|
|
||||||
static inline __always_inline int
|
static __always_inline int
|
||||||
__ieee754_rem_pio2l(long double x, long double *y)
|
__ieee754_rem_pio2l(long double x, long double *y)
|
||||||
{
|
{
|
||||||
union IEEEl2bits u,u1;
|
union IEEEl2bits u,u1;
|
||||||
|
|
|
@ -444,7 +444,7 @@ struct ld {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STRUCT_RETURN
|
#ifdef STRUCT_RETURN
|
||||||
static inline __always_inline void
|
static __always_inline void
|
||||||
k_logl(long double x, struct ld *rp)
|
k_logl(long double x, struct ld *rp)
|
||||||
#else
|
#else
|
||||||
long double
|
long double
|
||||||
|
|
|
@ -66,7 +66,7 @@ pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */
|
||||||
pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */
|
pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline __always_inline int
|
static __always_inline int
|
||||||
__ieee754_rem_pio2l(long double x, long double *y)
|
__ieee754_rem_pio2l(long double x, long double *y)
|
||||||
{
|
{
|
||||||
union IEEEl2bits u,u1;
|
union IEEEl2bits u,u1;
|
||||||
|
|
|
@ -444,7 +444,7 @@ struct ld {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STRUCT_RETURN
|
#ifdef STRUCT_RETURN
|
||||||
static inline __always_inline void
|
static __always_inline void
|
||||||
k_logl(long double x, struct ld *rp)
|
k_logl(long double x, struct ld *rp)
|
||||||
#else
|
#else
|
||||||
long double
|
long double
|
||||||
|
|
|
@ -45,7 +45,7 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
|
||||||
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
||||||
|
|
||||||
#ifdef INLINE_REM_PIO2
|
#ifdef INLINE_REM_PIO2
|
||||||
static __inline __always_inline
|
static __always_inline
|
||||||
#endif
|
#endif
|
||||||
int
|
int
|
||||||
__ieee754_rem_pio2(double x, double *y)
|
__ieee754_rem_pio2(double x, double *y)
|
||||||
|
|
|
@ -38,7 +38,7 @@ pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */
|
||||||
pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */
|
pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */
|
||||||
|
|
||||||
#ifdef INLINE_REM_PIO2F
|
#ifdef INLINE_REM_PIO2F
|
||||||
static __inline __always_inline
|
static __always_inline
|
||||||
#endif
|
#endif
|
||||||
int
|
int
|
||||||
__ieee754_rem_pio2f(float x, double *y)
|
__ieee754_rem_pio2f(float x, double *y)
|
||||||
|
|
|
@ -64,6 +64,7 @@ static char *mod_searchmodule(char *name, struct mod_depend *verinfo);
|
||||||
static char * mod_searchmodule_pnpinfo(const char *bus, const char *pnpinfo);
|
static char * mod_searchmodule_pnpinfo(const char *bus, const char *pnpinfo);
|
||||||
static void file_insert_tail(struct preloaded_file *mp);
|
static void file_insert_tail(struct preloaded_file *mp);
|
||||||
static void file_remove(struct preloaded_file *fp);
|
static void file_remove(struct preloaded_file *fp);
|
||||||
|
static void file_remove_tail(struct preloaded_file *fp);
|
||||||
struct file_metadata* metadata_next(struct file_metadata *base_mp, int type);
|
struct file_metadata* metadata_next(struct file_metadata *base_mp, int type);
|
||||||
static void moduledir_readhints(struct moduledir *mdp);
|
static void moduledir_readhints(struct moduledir *mdp);
|
||||||
static void moduledir_rebuild(void);
|
static void moduledir_rebuild(void);
|
||||||
|
@ -876,7 +877,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
|
||||||
file_insert_tail(fp); /* Add to the list of loaded files */
|
file_insert_tail(fp); /* Add to the list of loaded files */
|
||||||
if (file_load_dependencies(fp) != 0) {
|
if (file_load_dependencies(fp) != 0) {
|
||||||
err = ENOENT;
|
err = ENOENT;
|
||||||
file_remove(fp);
|
file_remove_tail(fp);
|
||||||
loadaddr = loadaddr_saved;
|
loadaddr = loadaddr_saved;
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -1637,25 +1638,45 @@ file_insert_tail(struct preloaded_file *fp)
|
||||||
* Remove module from the chain
|
* Remove module from the chain
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
file_remove(struct preloaded_file *fp)
|
file_remove_impl(struct preloaded_file *fp, bool keep_tail)
|
||||||
{
|
{
|
||||||
struct preloaded_file *cm;
|
struct preloaded_file *cm, *next;
|
||||||
|
|
||||||
if (preloaded_files == NULL)
|
if (preloaded_files == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (keep_tail)
|
||||||
|
next = fp->f_next;
|
||||||
|
else
|
||||||
|
next = NULL;
|
||||||
|
|
||||||
if (preloaded_files == fp) {
|
if (preloaded_files == fp) {
|
||||||
preloaded_files = fp->f_next;
|
preloaded_files = next;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cm = preloaded_files; cm->f_next != NULL; cm = cm->f_next) {
|
for (cm = preloaded_files; cm->f_next != NULL; cm = cm->f_next) {
|
||||||
if (cm->f_next == fp) {
|
if (cm->f_next == fp) {
|
||||||
cm->f_next = fp->f_next;
|
cm->f_next = next;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_remove(struct preloaded_file *fp)
|
||||||
|
{
|
||||||
|
|
||||||
|
file_remove_impl(fp, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_remove_tail(struct preloaded_file *fp)
|
||||||
|
{
|
||||||
|
|
||||||
|
file_remove_impl(fp, false);
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
moduledir_fullpath(struct moduledir *mdp, const char *fname)
|
moduledir_fullpath(struct moduledir *mdp, const char *fname)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 ARM Ltd
|
* Copyright (c) 2024 Arm Ltd
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -27,157 +27,5 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ARM_ARCH
|
#ifndef __ARM_ARCH
|
||||||
|
#error Your compiler is too old
|
||||||
/* ACLE standardises a set of pre-defines that describe the ARM architecture.
|
#endif
|
||||||
These were mostly implemented in GCC around GCC-4.8; older versions
|
|
||||||
have no, or only partial support. To provide a level of backwards
|
|
||||||
compatibility we try to work out what the definitions should be, given
|
|
||||||
the older pre-defines that GCC did produce. This isn't complete, but
|
|
||||||
it should be enough for use by routines that depend on this header. */
|
|
||||||
|
|
||||||
/* No need to handle ARMv8, GCC had ACLE support before that. */
|
|
||||||
|
|
||||||
#define __ARM_ACLE 101
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_7__
|
|
||||||
/* The common subset of ARMv7 in all profiles. */
|
|
||||||
# define __ARM_ARCH 7
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 2
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# define __ARM_FEATURE_LDREX 7
|
|
||||||
# define __ARM_FEATURE_UNALIGNED
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__)
|
|
||||||
# define __ARM_ARCH 7
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 2
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# define __ARM_FEATURE_SIMD32
|
|
||||||
# define __ARM_FEATURE_DSP
|
|
||||||
# define __ARM_FEATURE_QBIT
|
|
||||||
# define __ARM_FEATURE_SAT
|
|
||||||
# define __ARM_FEATURE_LDREX 15
|
|
||||||
# define __ARM_FEATURE_UNALIGNED
|
|
||||||
# ifdef __ARM_ARCH_7A__
|
|
||||||
# define __ARM_ARCH_PROFILE 'A'
|
|
||||||
# else
|
|
||||||
# define __ARM_ARCH_PROFILE 'R'
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_7EM__
|
|
||||||
# define __ARM_ARCH 7
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 2
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# define __ARM_FEATURE_SIMD32
|
|
||||||
# define __ARM_FEATURE_DSP
|
|
||||||
# define __ARM_FEATURE_QBIT
|
|
||||||
# define __ARM_FEATURE_SAT
|
|
||||||
# define __ARM_FEATURE_LDREX 7
|
|
||||||
# define __ARM_FEATURE_UNALIGNED
|
|
||||||
# define __ARM_ARCH_PROFILE 'M'
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_7M__
|
|
||||||
# define __ARM_ARCH 7
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 2
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# define __ARM_FEATURE_QBIT
|
|
||||||
# define __ARM_FEATURE_SAT
|
|
||||||
# define __ARM_FEATURE_LDREX 7
|
|
||||||
# define __ARM_FEATURE_UNALIGNED
|
|
||||||
# define __ARM_ARCH_PROFILE 'M'
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_6T2__
|
|
||||||
# define __ARM_ARCH 6
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 2
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# define __ARM_FEATURE_SIMD32
|
|
||||||
# define __ARM_FEATURE_DSP
|
|
||||||
# define __ARM_FEATURE_QBIT
|
|
||||||
# define __ARM_FEATURE_SAT
|
|
||||||
# define __ARM_FEATURE_LDREX 4
|
|
||||||
# define __ARM_FEATURE_UNALIGNED
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_6M__
|
|
||||||
# define __ARM_ARCH 6
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 1
|
|
||||||
# define __ARM_ARCH_PROFILE 'M'
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) \
|
|
||||||
|| defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) \
|
|
||||||
|| defined (__ARM_ARCH_6ZK__)
|
|
||||||
# define __ARM_ARCH 6
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 1
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# define __ARM_FEATURE_SIMD32
|
|
||||||
# define __ARM_FEATURE_DSP
|
|
||||||
# define __ARM_FEATURE_QBIT
|
|
||||||
# define __ARM_FEATURE_SAT
|
|
||||||
# define __ARM_FEATURE_UNALIGNED
|
|
||||||
# ifndef __thumb__
|
|
||||||
# if defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
|
|
||||||
# define __ARM_FEATURE_LDREX 15
|
|
||||||
# else
|
|
||||||
# define __ARM_FEATURE_LDREX 4
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5E__)
|
|
||||||
# define __ARM_ARCH 5
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# ifdef __ARM_ARCH_5TE__
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 1
|
|
||||||
# endif
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# define __ARM_FEATURE_DSP
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5__)
|
|
||||||
# define __ARM_ARCH 5
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# ifdef __ARM_ARCH_5TE__
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 1
|
|
||||||
# endif
|
|
||||||
# define __ARM_FEATURE_CLZ
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_4T__
|
|
||||||
# define __ARM_ARCH 4
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# define __ARM_ARCH_ISA_THUMB 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_4__
|
|
||||||
# define __ARM_ARCH 4
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
|
|
||||||
# define __ARM_ARCH 3
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARM_ARCH_2__
|
|
||||||
# define __ARM_ARCH 2
|
|
||||||
# define __ARM_ARCH_ISA_ARM
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ARMEB__
|
|
||||||
# define __ARM_BIG_ENDIAN
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* If we still don't know what the target architecture is, then we're
|
|
||||||
probably not using GCC. */
|
|
||||||
# ifndef __ARM_ARCH
|
|
||||||
# error Unable to determine architecture version.
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif /* __ARM_ARCH */
|
|
||||||
|
|
|
@ -4349,9 +4349,7 @@ calculate_iaq(struct adapter *sc, struct intrs_and_queues *iaq, int itype,
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
if (iaq->nrxq > 1) {
|
if (iaq->nrxq > 1) {
|
||||||
do {
|
iaq->nrxq = rounddown_pow_of_two(iaq->nrxq - 1);
|
||||||
iaq->nrxq--;
|
|
||||||
} while (!powerof2(iaq->nrxq));
|
|
||||||
if (iaq->nnmrxq > iaq->nrxq)
|
if (iaq->nnmrxq > iaq->nrxq)
|
||||||
iaq->nnmrxq = iaq->nrxq;
|
iaq->nnmrxq = iaq->nrxq;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3099,6 +3099,7 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
|
||||||
if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY)
|
if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY)
|
||||||
return (0);
|
return (0);
|
||||||
isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl);
|
isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case ISPCTL_FCLINK_TEST:
|
case ISPCTL_FCLINK_TEST:
|
||||||
{
|
{
|
||||||
|
|
|
@ -711,7 +711,7 @@ ext4_ext_tree_init(struct inode *ip)
|
||||||
|
|
||||||
ip->i_flag |= IN_E4EXTENTS;
|
ip->i_flag |= IN_E4EXTENTS;
|
||||||
|
|
||||||
memset(ip->i_data, 0, EXT2_NDADDR + EXT2_NIADDR);
|
memset(ip->i_data, 0, sizeof(ip->i_data));
|
||||||
ehp = (struct ext4_extent_header *)ip->i_data;
|
ehp = (struct ext4_extent_header *)ip->i_data;
|
||||||
ehp->eh_magic = htole16(EXT4_EXT_MAGIC);
|
ehp->eh_magic = htole16(EXT4_EXT_MAGIC);
|
||||||
ehp->eh_max = htole16(ext4_ext_space_root(ip));
|
ehp->eh_max = htole16(ext4_ext_space_root(ip));
|
||||||
|
|
|
@ -93,13 +93,9 @@ static int looutput(struct ifnet *ifp, struct mbuf *m,
|
||||||
const struct sockaddr *dst, struct route *ro);
|
const struct sockaddr *dst, struct route *ro);
|
||||||
|
|
||||||
VNET_DEFINE(struct ifnet *, loif); /* Used externally */
|
VNET_DEFINE(struct ifnet *, loif); /* Used externally */
|
||||||
|
|
||||||
#ifdef VIMAGE
|
|
||||||
VNET_DEFINE_STATIC(struct if_clone *, lo_cloner);
|
VNET_DEFINE_STATIC(struct if_clone *, lo_cloner);
|
||||||
#define V_lo_cloner VNET(lo_cloner)
|
#define V_lo_cloner VNET(lo_cloner)
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct if_clone *lo_cloner;
|
|
||||||
static const char loname[] = "lo";
|
static const char loname[] = "lo";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -141,8 +137,6 @@ lo_clone_create(struct if_clone *ifc, char *name, size_t len,
|
||||||
ifp->if_hwassist = LO_CSUM_FEATURES | LO_CSUM_FEATURES6;
|
ifp->if_hwassist = LO_CSUM_FEATURES | LO_CSUM_FEATURES6;
|
||||||
if_attach(ifp);
|
if_attach(ifp);
|
||||||
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
|
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
|
||||||
if (V_loif == NULL)
|
|
||||||
V_loif = ifp;
|
|
||||||
*ifpp = ifp;
|
*ifpp = ifp;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -156,12 +150,9 @@ vnet_loif_init(const void *unused __unused)
|
||||||
.destroy_f = lo_clone_destroy,
|
.destroy_f = lo_clone_destroy,
|
||||||
.flags = IFC_F_AUTOUNIT,
|
.flags = IFC_F_AUTOUNIT,
|
||||||
};
|
};
|
||||||
lo_cloner = ifc_attach_cloner(loname, &req);
|
V_lo_cloner = ifc_attach_cloner(loname, &req);
|
||||||
#ifdef VIMAGE
|
|
||||||
V_lo_cloner = lo_cloner;
|
|
||||||
#endif
|
|
||||||
struct ifc_data ifd = { .unit = 0 };
|
struct ifc_data ifd = { .unit = 0 };
|
||||||
ifc_create_ifp(loname, &ifd, NULL);
|
ifc_create_ifp(loname, &ifd, &V_loif);
|
||||||
}
|
}
|
||||||
VNET_SYSINIT(vnet_loif_init, SI_SUB_PSEUDO, SI_ORDER_ANY,
|
VNET_SYSINIT(vnet_loif_init, SI_SUB_PSEUDO, SI_ORDER_ANY,
|
||||||
vnet_loif_init, NULL);
|
vnet_loif_init, NULL);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2016 Ruslan Bukin <br@bsdpad.com>
|
* Copyright (c) 2016-2024 Ruslan Bukin <br@bsdpad.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This software was developed by SRI International and the University of
|
* This software was developed by SRI International and the University of
|
||||||
|
@ -34,4 +34,14 @@
|
||||||
void fpe_state_save(struct thread *td);
|
void fpe_state_save(struct thread *td);
|
||||||
void fpe_state_clear(void);
|
void fpe_state_clear(void);
|
||||||
|
|
||||||
|
struct fpreg *fpu_save_area_alloc(void);
|
||||||
|
void fpu_save_area_free(struct fpreg *fsa);
|
||||||
|
void fpu_save_area_reset(struct fpreg *fsa);
|
||||||
|
|
||||||
|
void fpe_enable(void);
|
||||||
|
void fpe_disable(void);
|
||||||
|
|
||||||
|
void fpe_store(struct fpreg *state);
|
||||||
|
void fpe_restore(struct fpreg *state);
|
||||||
|
|
||||||
#endif /* !_MACHINE_FPE_H_ */
|
#endif /* !_MACHINE_FPE_H_ */
|
||||||
|
|
|
@ -49,6 +49,12 @@
|
||||||
#define SBI_IMPL_ID_KVM 3
|
#define SBI_IMPL_ID_KVM 3
|
||||||
#define SBI_IMPL_ID_RUSTSBI 4
|
#define SBI_IMPL_ID_RUSTSBI 4
|
||||||
#define SBI_IMPL_ID_DIOSIX 5
|
#define SBI_IMPL_ID_DIOSIX 5
|
||||||
|
#define SBI_IMPL_ID_COFFER 6
|
||||||
|
#define SBI_IMPL_ID_XEN_PROJECT 7
|
||||||
|
#define SBI_IMPL_ID_POLARFIRE_HSS 8
|
||||||
|
#define SBI_IMPL_ID_COREBOOT 9
|
||||||
|
#define SBI_IMPL_ID_OREBOOT 10
|
||||||
|
#define SBI_IMPL_ID_BHYVE 11
|
||||||
|
|
||||||
/* SBI Error Codes */
|
/* SBI Error Codes */
|
||||||
#define SBI_SUCCESS 0
|
#define SBI_SUCCESS 0
|
||||||
|
|
190
sys/riscv/riscv/fpe.c
Normal file
190
sys/riscv/riscv/fpe.c
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2024 Ruslan Bukin <br@bsdpad.com>
|
||||||
|
*
|
||||||
|
* This software was developed by the University of Cambridge Computer
|
||||||
|
* Laboratory (Department of Computer Science and Technology) under Innovate
|
||||||
|
* UK project 105694, "Digital Security by Design (DSbD) Technology Platform
|
||||||
|
* Prototype".
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/systm.h>
|
||||||
|
#include <sys/kernel.h>
|
||||||
|
|
||||||
|
#include <vm/uma.h>
|
||||||
|
|
||||||
|
#include <machine/fpe.h>
|
||||||
|
#include <machine/reg.h>
|
||||||
|
|
||||||
|
static uma_zone_t fpu_save_area_zone;
|
||||||
|
static struct fpreg *fpu_initialstate;
|
||||||
|
|
||||||
|
void
|
||||||
|
fpe_enable(void)
|
||||||
|
{
|
||||||
|
uint64_t reg;
|
||||||
|
|
||||||
|
reg = SSTATUS_FS_INITIAL;
|
||||||
|
|
||||||
|
csr_set(sstatus, reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fpe_disable(void)
|
||||||
|
{
|
||||||
|
uint64_t mask;
|
||||||
|
|
||||||
|
mask = SSTATUS_FS_MASK;
|
||||||
|
|
||||||
|
csr_clear(sstatus, mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fpe_store(struct fpreg *regs)
|
||||||
|
{
|
||||||
|
uint64_t fcsr, (*fp_x)[32][2];
|
||||||
|
|
||||||
|
fp_x = ®s->fp_x;
|
||||||
|
|
||||||
|
__asm __volatile(
|
||||||
|
"frcsr %0 \n"
|
||||||
|
"fsd f0, (16 * 0)(%1)\n"
|
||||||
|
"fsd f1, (16 * 1)(%1)\n"
|
||||||
|
"fsd f2, (16 * 2)(%1)\n"
|
||||||
|
"fsd f3, (16 * 3)(%1)\n"
|
||||||
|
"fsd f4, (16 * 4)(%1)\n"
|
||||||
|
"fsd f5, (16 * 5)(%1)\n"
|
||||||
|
"fsd f6, (16 * 6)(%1)\n"
|
||||||
|
"fsd f7, (16 * 7)(%1)\n"
|
||||||
|
"fsd f8, (16 * 8)(%1)\n"
|
||||||
|
"fsd f9, (16 * 9)(%1)\n"
|
||||||
|
"fsd f10, (16 * 10)(%1)\n"
|
||||||
|
"fsd f11, (16 * 11)(%1)\n"
|
||||||
|
"fsd f12, (16 * 12)(%1)\n"
|
||||||
|
"fsd f13, (16 * 13)(%1)\n"
|
||||||
|
"fsd f14, (16 * 14)(%1)\n"
|
||||||
|
"fsd f15, (16 * 15)(%1)\n"
|
||||||
|
"fsd f16, (16 * 16)(%1)\n"
|
||||||
|
"fsd f17, (16 * 17)(%1)\n"
|
||||||
|
"fsd f18, (16 * 18)(%1)\n"
|
||||||
|
"fsd f19, (16 * 19)(%1)\n"
|
||||||
|
"fsd f20, (16 * 20)(%1)\n"
|
||||||
|
"fsd f21, (16 * 21)(%1)\n"
|
||||||
|
"fsd f22, (16 * 22)(%1)\n"
|
||||||
|
"fsd f23, (16 * 23)(%1)\n"
|
||||||
|
"fsd f24, (16 * 24)(%1)\n"
|
||||||
|
"fsd f25, (16 * 25)(%1)\n"
|
||||||
|
"fsd f26, (16 * 26)(%1)\n"
|
||||||
|
"fsd f27, (16 * 27)(%1)\n"
|
||||||
|
"fsd f28, (16 * 28)(%1)\n"
|
||||||
|
"fsd f29, (16 * 29)(%1)\n"
|
||||||
|
"fsd f30, (16 * 30)(%1)\n"
|
||||||
|
"fsd f31, (16 * 31)(%1)\n"
|
||||||
|
: "=&r"(fcsr), "=r"(fp_x), "=m"(*fp_x));
|
||||||
|
|
||||||
|
regs->fp_fcsr = fcsr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fpe_restore(struct fpreg *regs)
|
||||||
|
{
|
||||||
|
uint64_t fcsr, (*fp_x)[32][2];
|
||||||
|
|
||||||
|
fp_x = ®s->fp_x;
|
||||||
|
fcsr = regs->fp_fcsr;
|
||||||
|
|
||||||
|
__asm __volatile(
|
||||||
|
"fscsr %0 \n"
|
||||||
|
"fld f0, (16 * 0)(%1)\n"
|
||||||
|
"fld f1, (16 * 1)(%1)\n"
|
||||||
|
"fld f2, (16 * 2)(%1)\n"
|
||||||
|
"fld f3, (16 * 3)(%1)\n"
|
||||||
|
"fld f4, (16 * 4)(%1)\n"
|
||||||
|
"fld f5, (16 * 5)(%1)\n"
|
||||||
|
"fld f6, (16 * 6)(%1)\n"
|
||||||
|
"fld f7, (16 * 7)(%1)\n"
|
||||||
|
"fld f8, (16 * 8)(%1)\n"
|
||||||
|
"fld f9, (16 * 9)(%1)\n"
|
||||||
|
"fld f10, (16 * 10)(%1)\n"
|
||||||
|
"fld f11, (16 * 11)(%1)\n"
|
||||||
|
"fld f12, (16 * 12)(%1)\n"
|
||||||
|
"fld f13, (16 * 13)(%1)\n"
|
||||||
|
"fld f14, (16 * 14)(%1)\n"
|
||||||
|
"fld f15, (16 * 15)(%1)\n"
|
||||||
|
"fld f16, (16 * 16)(%1)\n"
|
||||||
|
"fld f17, (16 * 17)(%1)\n"
|
||||||
|
"fld f18, (16 * 18)(%1)\n"
|
||||||
|
"fld f19, (16 * 19)(%1)\n"
|
||||||
|
"fld f20, (16 * 20)(%1)\n"
|
||||||
|
"fld f21, (16 * 21)(%1)\n"
|
||||||
|
"fld f22, (16 * 22)(%1)\n"
|
||||||
|
"fld f23, (16 * 23)(%1)\n"
|
||||||
|
"fld f24, (16 * 24)(%1)\n"
|
||||||
|
"fld f25, (16 * 25)(%1)\n"
|
||||||
|
"fld f26, (16 * 26)(%1)\n"
|
||||||
|
"fld f27, (16 * 27)(%1)\n"
|
||||||
|
"fld f28, (16 * 28)(%1)\n"
|
||||||
|
"fld f29, (16 * 29)(%1)\n"
|
||||||
|
"fld f30, (16 * 30)(%1)\n"
|
||||||
|
"fld f31, (16 * 31)(%1)\n"
|
||||||
|
:: "r"(fcsr), "r"(fp_x), "m"(*fp_x));
|
||||||
|
}
|
||||||
|
|
||||||
|
struct fpreg *
|
||||||
|
fpu_save_area_alloc(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (uma_zalloc(fpu_save_area_zone, M_WAITOK));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fpu_save_area_free(struct fpreg *fsa)
|
||||||
|
{
|
||||||
|
|
||||||
|
uma_zfree(fpu_save_area_zone, fsa);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fpu_save_area_reset(struct fpreg *fsa)
|
||||||
|
{
|
||||||
|
|
||||||
|
memcpy(fsa, fpu_initialstate, sizeof(*fsa));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fpe_init(const void *dummy __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
fpu_save_area_zone = uma_zcreate("FPE save area", sizeof(struct fpreg),
|
||||||
|
NULL, NULL, NULL, NULL, _Alignof(struct fpreg) - 1, 0);
|
||||||
|
fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
|
fpe_enable();
|
||||||
|
fpe_store(fpu_initialstate);
|
||||||
|
fpe_disable();
|
||||||
|
|
||||||
|
bzero(fpu_initialstate->fp_x, sizeof(fpu_initialstate->fp_x));
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSINIT(fpe, SI_SUB_CPU, SI_ORDER_ANY, fpe_init, NULL);
|
|
@ -132,6 +132,11 @@ sbi_print_version(void)
|
||||||
case (SBI_IMPL_ID_BBL):
|
case (SBI_IMPL_ID_BBL):
|
||||||
printf("SBI: Berkely Boot Loader %lu\n", sbi_impl_version);
|
printf("SBI: Berkely Boot Loader %lu\n", sbi_impl_version);
|
||||||
break;
|
break;
|
||||||
|
case (SBI_IMPL_ID_OPENSBI):
|
||||||
|
major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET;
|
||||||
|
minor = sbi_impl_version & OPENSBI_VERSION_MINOR_MASK;
|
||||||
|
printf("SBI: OpenSBI v%u.%u\n", major, minor);
|
||||||
|
break;
|
||||||
case (SBI_IMPL_ID_XVISOR):
|
case (SBI_IMPL_ID_XVISOR):
|
||||||
printf("SBI: eXtensible Versatile hypervISOR %lu\n",
|
printf("SBI: eXtensible Versatile hypervISOR %lu\n",
|
||||||
sbi_impl_version);
|
sbi_impl_version);
|
||||||
|
@ -146,10 +151,24 @@ sbi_print_version(void)
|
||||||
case (SBI_IMPL_ID_DIOSIX):
|
case (SBI_IMPL_ID_DIOSIX):
|
||||||
printf("SBI: Diosix %lu\n", sbi_impl_version);
|
printf("SBI: Diosix %lu\n", sbi_impl_version);
|
||||||
break;
|
break;
|
||||||
case (SBI_IMPL_ID_OPENSBI):
|
case (SBI_IMPL_ID_COFFER):
|
||||||
major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET;
|
printf("SBI: Coffer %lu\n", sbi_impl_version);
|
||||||
minor = sbi_impl_version & OPENSBI_VERSION_MINOR_MASK;
|
break;
|
||||||
printf("SBI: OpenSBI v%u.%u\n", major, minor);
|
case (SBI_IMPL_ID_XEN_PROJECT):
|
||||||
|
printf("SBI: Xen Project %lu\n", sbi_impl_version);
|
||||||
|
break;
|
||||||
|
case (SBI_IMPL_ID_POLARFIRE_HSS):
|
||||||
|
printf("SBI: PolarFire Hart Software Services %lu\n",
|
||||||
|
sbi_impl_version);
|
||||||
|
break;
|
||||||
|
case (SBI_IMPL_ID_COREBOOT):
|
||||||
|
printf("SBI: coreboot %lu\n", sbi_impl_version);
|
||||||
|
break;
|
||||||
|
case (SBI_IMPL_ID_OREBOOT):
|
||||||
|
printf("SBI: oreboot %lu\n", sbi_impl_version);
|
||||||
|
break;
|
||||||
|
case (SBI_IMPL_ID_BHYVE):
|
||||||
|
printf("SBI: bhyve %lu\n", sbi_impl_version);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("SBI: Unrecognized Implementation: %lu\n", sbi_impl_id);
|
printf("SBI: Unrecognized Implementation: %lu\n", sbi_impl_id);
|
||||||
|
|
|
@ -265,7 +265,7 @@
|
||||||
#define __malloc_like __attribute__((__malloc__))
|
#define __malloc_like __attribute__((__malloc__))
|
||||||
#define __pure __attribute__((__pure__))
|
#define __pure __attribute__((__pure__))
|
||||||
|
|
||||||
#define __always_inline __attribute__((__always_inline__))
|
#define __always_inline __inline __attribute__((__always_inline__))
|
||||||
#define __noinline __attribute__ ((__noinline__))
|
#define __noinline __attribute__ ((__noinline__))
|
||||||
#define __fastcall __attribute__((__fastcall__))
|
#define __fastcall __attribute__((__fastcall__))
|
||||||
#define __result_use_check __attribute__((__warn_unused_result__))
|
#define __result_use_check __attribute__((__warn_unused_result__))
|
||||||
|
|
|
@ -180,6 +180,7 @@ static __inline void
|
||||||
sched_unpin(void)
|
sched_unpin(void)
|
||||||
{
|
{
|
||||||
atomic_interrupt_fence();
|
atomic_interrupt_fence();
|
||||||
|
MPASS(curthread->td_pinned > 0);
|
||||||
curthread->td_pinned--;
|
curthread->td_pinned--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -315,13 +315,6 @@ dmar_ir_free_irte(struct dmar_unit *unit, u_int cookie)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u_int
|
|
||||||
clp2(u_int v)
|
|
||||||
{
|
|
||||||
|
|
||||||
return (powerof2(v) ? v : 1 << fls(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
dmar_init_irt(struct dmar_unit *unit)
|
dmar_init_irt(struct dmar_unit *unit)
|
||||||
{
|
{
|
||||||
|
@ -339,7 +332,7 @@ dmar_init_irt(struct dmar_unit *unit)
|
||||||
"QI disabled, disabling interrupt remapping\n");
|
"QI disabled, disabling interrupt remapping\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
unit->irte_cnt = clp2(num_io_irqs);
|
unit->irte_cnt = roundup_pow_of_two(num_io_irqs);
|
||||||
unit->irt = kmem_alloc_contig(unit->irte_cnt * sizeof(dmar_irte_t),
|
unit->irt = kmem_alloc_contig(unit->irte_cnt * sizeof(dmar_irte_t),
|
||||||
M_ZERO | M_WAITOK, 0, iommu_high, PAGE_SIZE, 0,
|
M_ZERO | M_WAITOK, 0, iommu_high, PAGE_SIZE, 0,
|
||||||
DMAR_IS_COHERENT(unit) ?
|
DMAR_IS_COHERENT(unit) ?
|
||||||
|
|
|
@ -1197,6 +1197,9 @@ ATF_TC_BODY(random_eor_and_waitall, tc)
|
||||||
size_t off;
|
size_t off;
|
||||||
int fd[2], eor;
|
int fd[2], eor;
|
||||||
|
|
||||||
|
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
|
||||||
|
atf_tc_skip("https://bugs.freebsd.org/279994");
|
||||||
|
|
||||||
arc4random_buf(params.seed, sizeof(params.seed));
|
arc4random_buf(params.seed, sizeof(params.seed));
|
||||||
printf("Using seed:");
|
printf("Using seed:");
|
||||||
for (u_int i = 0; i < (u_int)sizeof(params.seed)/sizeof(u_short); i++)
|
for (u_int i = 0; i < (u_int)sizeof(params.seed)/sizeof(u_short); i++)
|
||||||
|
|
|
@ -36,9 +36,6 @@ ulimit -t 20
|
||||||
# do not ignore the exit status of roff tools
|
# do not ignore the exit status of roff tools
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
# ignore SIGPIPE exits because pagers may exit before reading all their input.
|
|
||||||
trap '' SIGPIPE
|
|
||||||
|
|
||||||
# Usage: add_to_manpath path
|
# Usage: add_to_manpath path
|
||||||
# Adds a variable to manpath while ensuring we don't have duplicates.
|
# Adds a variable to manpath while ensuring we don't have duplicates.
|
||||||
# Returns true if we were able to add something. False otherwise.
|
# Returns true if we were able to add something. False otherwise.
|
||||||
|
|
|
@ -4469,7 +4469,7 @@ main(int argc, char **argv)
|
||||||
if (fd == -1 && errno == ENOENT) {
|
if (fd == -1 && errno == ENOENT) {
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
retval = kldload("ctl");
|
retval = kldload("ctl");
|
||||||
if (retval != -1)
|
if (retval != -1 || errno == EEXIST)
|
||||||
fd = open(device, O_RDWR);
|
fd = open(device, O_RDWR);
|
||||||
else
|
else
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user