MFhead @ r281584
This commit is contained in:
commit
2d138d0a35
4
UPDATING
4
UPDATING
@ -31,6 +31,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
|
||||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20150415:
|
||||
The const qualifier has been removed from iconv(3) to comply with
|
||||
POSIX. The ports tree is aware of this from r384038 onwards.
|
||||
|
||||
20150324:
|
||||
From legacy ata(4) driver was removed support for SATA controllers
|
||||
supported by more functional drivers ahci(4), siis(4) and mvs(4).
|
||||
|
@ -198,7 +198,7 @@
|
||||
#define HAVE_WCWIDTH 1
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#define ICONV_CONST const
|
||||
#define ICONV_CONST
|
||||
|
||||
/* Support NLS. */
|
||||
#define NLS 1
|
||||
|
@ -14,7 +14,11 @@ n0=`namegen`
|
||||
|
||||
cp -pf `which sleep` ${n0}
|
||||
./${n0} 3 &
|
||||
while ! pkill -0 -f ./${n0}; do
|
||||
sleep 0.1
|
||||
done
|
||||
expect ETXTBSY open ${n0} O_WRONLY
|
||||
expect ETXTBSY open ${n0} O_RDWR
|
||||
expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC
|
||||
pkill -9 -f ./${n0}
|
||||
expect 0 unlink ${n0}
|
||||
|
@ -14,5 +14,9 @@ n0=`namegen`
|
||||
|
||||
cp -pf `which sleep` ${n0}
|
||||
./${n0} 3 &
|
||||
while ! pkill -0 -f ./${n0}; do
|
||||
sleep 0.1
|
||||
done
|
||||
expect ETXTBSY truncate ${n0} 123
|
||||
pkill -9 -f ./${n0}
|
||||
expect 0 unlink ${n0}
|
||||
|
@ -191,7 +191,7 @@ int smb_ctx_readrc(struct smb_ctx *);
|
||||
int smb_ctx_resolve(struct smb_ctx *);
|
||||
int smb_ctx_setflags(struct smb_ctx *, int, int, int);
|
||||
|
||||
int smb_smb_open_print_file(struct smb_ctx *, int, int, const char *, smbfh*);
|
||||
int smb_smb_open_print_file(struct smb_ctx *, int, int, char *, smbfh*);
|
||||
int smb_smb_close_print_file(struct smb_ctx *, smbfh);
|
||||
|
||||
int smb_read(struct smb_ctx *, smbfh, off_t, size_t, char *);
|
||||
@ -204,8 +204,8 @@ int smb_rq_init(struct smb_ctx *, u_char, size_t, struct smb_rq **);
|
||||
void smb_rq_done(struct smb_rq *);
|
||||
void smb_rq_wend(struct smb_rq *);
|
||||
int smb_rq_simple(struct smb_rq *);
|
||||
int smb_rq_dmem(struct mbdata *, const char *, size_t);
|
||||
int smb_rq_dstring(struct mbdata *, const char *);
|
||||
int smb_rq_dmem(struct mbdata *, char *, size_t);
|
||||
int smb_rq_dstring(struct mbdata *, char *);
|
||||
|
||||
int smb_t2_request(struct smb_ctx *, int, int, const char *,
|
||||
int, void *, int, void *, int *, void *, int *, void *);
|
||||
@ -246,10 +246,10 @@ extern u_char nls_lower[256], nls_upper[256];
|
||||
|
||||
int nls_setrecode(const char *, const char *);
|
||||
int nls_setlocale(const char *);
|
||||
char* nls_str_toext(char *, const char *);
|
||||
char* nls_str_toloc(char *, const char *);
|
||||
void* nls_mem_toext(void *, const void *, int);
|
||||
void* nls_mem_toloc(void *, const void *, int);
|
||||
char* nls_str_toext(char *, char *);
|
||||
char* nls_str_toloc(char *, char *);
|
||||
void* nls_mem_toext(void *, void *, int);
|
||||
void* nls_mem_toloc(void *, void *, int);
|
||||
char* nls_str_upper(char *, const char *);
|
||||
char* nls_str_lower(char *, const char *);
|
||||
|
||||
|
@ -102,7 +102,7 @@ nls_setrecode(const char *local, const char *external)
|
||||
}
|
||||
|
||||
char *
|
||||
nls_str_toloc(char *dst, const char *src)
|
||||
nls_str_toloc(char *dst, char *src)
|
||||
{
|
||||
#ifdef HAVE_ICONV
|
||||
char *p = dst;
|
||||
@ -125,7 +125,7 @@ nls_str_toloc(char *dst, const char *src)
|
||||
}
|
||||
|
||||
char *
|
||||
nls_str_toext(char *dst, const char *src)
|
||||
nls_str_toext(char *dst, char *src)
|
||||
{
|
||||
#ifdef HAVE_ICONV
|
||||
char *p = dst;
|
||||
@ -148,11 +148,11 @@ nls_str_toext(char *dst, const char *src)
|
||||
}
|
||||
|
||||
void *
|
||||
nls_mem_toloc(void *dst, const void *src, int size)
|
||||
nls_mem_toloc(void *dst, void *src, int size)
|
||||
{
|
||||
#ifdef HAVE_ICONV
|
||||
char *p = dst;
|
||||
const char *s = src;
|
||||
char *s = src;
|
||||
size_t inlen, outlen;
|
||||
|
||||
if (size == 0)
|
||||
@ -174,11 +174,11 @@ nls_mem_toloc(void *dst, const void *src, int size)
|
||||
}
|
||||
|
||||
void *
|
||||
nls_mem_toext(void *dst, const void *src, int size)
|
||||
nls_mem_toext(void *dst, void *src, int size)
|
||||
{
|
||||
#ifdef HAVE_ICONV
|
||||
char *p = dst;
|
||||
const char *s = src;
|
||||
char *s = src;
|
||||
size_t inlen, outlen;
|
||||
|
||||
if (size == 0)
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
int
|
||||
smb_smb_open_print_file(struct smb_ctx *ctx, int setuplen, int mode,
|
||||
const char *ident, smbfh *fhp)
|
||||
char *ident, smbfh *fhp)
|
||||
{
|
||||
struct smb_rq *rqp;
|
||||
struct mbdata *mbp;
|
||||
|
@ -86,7 +86,7 @@ smb_rq_wend(struct smb_rq *rqp)
|
||||
}
|
||||
|
||||
int
|
||||
smb_rq_dmem(struct mbdata *mbp, const char *src, size_t size)
|
||||
smb_rq_dmem(struct mbdata *mbp, char *src, size_t size)
|
||||
{
|
||||
struct mbuf *m;
|
||||
char * dst;
|
||||
@ -118,7 +118,7 @@ smb_rq_dmem(struct mbdata *mbp, const char *src, size_t size)
|
||||
}
|
||||
|
||||
int
|
||||
smb_rq_dstring(struct mbdata *mbp, const char *s)
|
||||
smb_rq_dstring(struct mbdata *mbp, char *s)
|
||||
{
|
||||
return smb_rq_dmem(mbp, s, strlen(s) + 1);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ default:\
|
||||
:passwd_format=sha512:\
|
||||
:copyright=/etc/COPYRIGHT:\
|
||||
:welcome=/etc/motd:\
|
||||
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K:LC_COLLATE=C:\
|
||||
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
|
||||
:path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\
|
||||
:nologin=/var/run/nologin:\
|
||||
:cputime=unlimited:\
|
||||
|
@ -16,12 +16,19 @@ rcvar="hostid_enable"
|
||||
|
||||
hostid_save()
|
||||
{
|
||||
if [ ! -r ${hostid_file} ]; then
|
||||
$SYSCTL_N kern.hostuuid > ${hostid_file}
|
||||
if [ $? -ne 0 ]; then
|
||||
warn "could not store hostuuid in ${hostid_file}."
|
||||
current_hostid=`$SYSCTL_N kern.hostuuid`
|
||||
|
||||
if [ -r ${hostid_file} ]; then
|
||||
read saved_hostid < ${hostid_file}
|
||||
if [ ${saved_hostid} = ${current_hostid} ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ${current_hostid} > ${hostid_file}
|
||||
if [ $? -ne 0 ]; then
|
||||
warn "could not store hostuuid in ${hostid_file}."
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
@ -53,7 +53,7 @@ typedef struct __tag_iconv_t *iconv_t;
|
||||
|
||||
__BEGIN_DECLS
|
||||
iconv_t iconv_open(const char *, const char *);
|
||||
size_t iconv(iconv_t, const char ** __restrict,
|
||||
size_t iconv(iconv_t, char ** __restrict,
|
||||
size_t * __restrict, char ** __restrict,
|
||||
size_t * __restrict);
|
||||
int iconv_close(iconv_t);
|
||||
@ -62,7 +62,7 @@ int iconv_close(iconv_t);
|
||||
*/
|
||||
int __iconv_get_list(char ***, size_t *, __iconv_bool);
|
||||
void __iconv_free_list(char **, size_t);
|
||||
size_t __iconv(iconv_t, const char **, size_t *, char **,
|
||||
size_t __iconv(iconv_t, char **, size_t *, char **,
|
||||
size_t *, __uint32_t, size_t *);
|
||||
#define __ICONV_F_HIDE_INVALID 0x0001
|
||||
|
||||
|
@ -25,7 +25,7 @@ LIBADD+= md
|
||||
.if ${MK_ICONV} != "no"
|
||||
# TODO: This can be changed back to CFLAGS once iconv works correctly
|
||||
# with statically linked binaries.
|
||||
SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const
|
||||
SHARED_CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH:Marm*} != "" || ${MACHINE_ARCH:Mmips*} != "" || \
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "iconv-internal.h"
|
||||
|
||||
size_t
|
||||
__iconv(iconv_t a, const char **b, size_t *c, char **d,
|
||||
__iconv(iconv_t a, char **b, size_t *c, char **d,
|
||||
size_t *e, __uint32_t f, size_t *g)
|
||||
{
|
||||
return __bsd___iconv(a, b, c, d, e, f, g);
|
||||
|
@ -120,7 +120,7 @@ __bsd_iconv_close(iconv_t handle)
|
||||
}
|
||||
|
||||
size_t
|
||||
__bsd_iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout)
|
||||
__bsd_iconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout)
|
||||
{
|
||||
size_t ret;
|
||||
int err;
|
||||
@ -141,7 +141,7 @@ __bsd_iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *s
|
||||
}
|
||||
|
||||
size_t
|
||||
__bsd___iconv(iconv_t handle, const char **in, size_t *szin, char **out,
|
||||
__bsd___iconv(iconv_t handle, char **in, size_t *szin, char **out,
|
||||
size_t *szout, uint32_t flags, size_t *invalids)
|
||||
{
|
||||
size_t ret;
|
||||
|
@ -52,7 +52,7 @@ __END_DECLS
|
||||
*/
|
||||
static __inline int
|
||||
_citrus_iconv_convert(struct _citrus_iconv * __restrict cv,
|
||||
const char * __restrict * __restrict in, size_t * __restrict inbytes,
|
||||
char * __restrict * __restrict in, size_t * __restrict inbytes,
|
||||
char * __restrict * __restrict out, size_t * __restrict outbytes,
|
||||
uint32_t flags, size_t * __restrict nresults)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ static void _citrus_##_m_##_iconv_uninit_shared \
|
||||
(struct _citrus_iconv_shared *); \
|
||||
static int _citrus_##_m_##_iconv_convert \
|
||||
(struct _citrus_iconv * __restrict, \
|
||||
const char * __restrict * __restrict, \
|
||||
char * __restrict * __restrict, \
|
||||
size_t * __restrict, \
|
||||
char * __restrict * __restrict, \
|
||||
size_t * __restrict outbytes, \
|
||||
@ -75,7 +75,7 @@ typedef void (*_citrus_iconv_uninit_shared_t)
|
||||
(struct _citrus_iconv_shared *);
|
||||
typedef int (*_citrus_iconv_convert_t)
|
||||
(struct _citrus_iconv * __restrict,
|
||||
const char *__restrict* __restrict, size_t * __restrict,
|
||||
char *__restrict* __restrict, size_t * __restrict,
|
||||
char * __restrict * __restrict, size_t * __restrict, uint32_t,
|
||||
size_t * __restrict);
|
||||
typedef int (*_citrus_iconv_init_context_t)(struct _citrus_iconv *);
|
||||
|
@ -83,7 +83,7 @@ _citrus_NONE_stdenc_init_state(struct _citrus_stdenc * __restrict ce __unused,
|
||||
|
||||
static int
|
||||
_citrus_NONE_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce __unused,
|
||||
_csid_t *csid, _index_t *idx, const char **s, size_t n,
|
||||
_csid_t *csid, _index_t *idx, char **s, size_t n,
|
||||
void *ps __unused, size_t *nresult, struct iconv_hooks *hooks)
|
||||
{
|
||||
|
||||
@ -159,7 +159,7 @@ _citrus_NONE_stdenc_cstomb(struct _citrus_stdenc * __restrict ce __unused,
|
||||
|
||||
static int
|
||||
_citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused,
|
||||
_wc_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
_wc_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
void * __restrict pspriv __unused, size_t * __restrict nresult,
|
||||
struct iconv_hooks *hooks)
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ _citrus_stdenc_init_state(struct _citrus_stdenc * __restrict ce,
|
||||
static __inline int
|
||||
_citrus_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce,
|
||||
_citrus_csid_t * __restrict csid, _citrus_index_t * __restrict idx,
|
||||
const char ** __restrict s, size_t n, void * __restrict ps,
|
||||
char ** __restrict s, size_t n, void * __restrict ps,
|
||||
size_t * __restrict nresult, struct iconv_hooks *hooks)
|
||||
{
|
||||
|
||||
|
@ -55,7 +55,7 @@ static int _citrus_##_e_##_stdenc_mbtocs \
|
||||
(struct _citrus_stdenc * __restrict, \
|
||||
_citrus_csid_t * __restrict, \
|
||||
_citrus_index_t * __restrict, \
|
||||
const char ** __restrict, size_t, \
|
||||
char ** __restrict, size_t, \
|
||||
void * __restrict, size_t * __restrict, \
|
||||
struct iconv_hooks *); \
|
||||
static int _citrus_##_e_##_stdenc_cstomb \
|
||||
@ -66,7 +66,7 @@ static int _citrus_##_e_##_stdenc_cstomb \
|
||||
static int _citrus_##_e_##_stdenc_mbtowc \
|
||||
(struct _citrus_stdenc * __restrict, \
|
||||
_citrus_wc_t * __restrict, \
|
||||
const char ** __restrict, size_t, \
|
||||
char ** __restrict, size_t, \
|
||||
void * __restrict, size_t * __restrict, \
|
||||
struct iconv_hooks *); \
|
||||
static int _citrus_##_e_##_stdenc_wctomb \
|
||||
@ -106,7 +106,7 @@ typedef int (*_citrus_stdenc_init_state_t)
|
||||
typedef int (*_citrus_stdenc_mbtocs_t)
|
||||
(struct _citrus_stdenc * __restrict,
|
||||
_citrus_csid_t * __restrict, _citrus_index_t * __restrict,
|
||||
const char ** __restrict, size_t,
|
||||
char ** __restrict, size_t,
|
||||
void * __restrict, size_t * __restrict,
|
||||
struct iconv_hooks *);
|
||||
typedef int (*_citrus_stdenc_cstomb_t)
|
||||
@ -116,7 +116,7 @@ typedef int (*_citrus_stdenc_cstomb_t)
|
||||
typedef int (*_citrus_stdenc_mbtowc_t)
|
||||
(struct _citrus_stdenc * __restrict,
|
||||
_citrus_wc_t * __restrict,
|
||||
const char ** __restrict, size_t,
|
||||
char ** __restrict, size_t,
|
||||
void * __restrict, size_t * __restrict,
|
||||
struct iconv_hooks *);
|
||||
typedef int (*_citrus_stdenc_wctomb_t)
|
||||
|
@ -112,7 +112,7 @@ _FUNCNAME(stdenc_init_state)(struct _citrus_stdenc * __restrict ce,
|
||||
static int
|
||||
_FUNCNAME(stdenc_mbtocs)(struct _citrus_stdenc * __restrict ce,
|
||||
_citrus_csid_t * __restrict csid, _citrus_index_t * __restrict idx,
|
||||
const char ** __restrict s, size_t n, void * __restrict ps,
|
||||
char ** __restrict s, size_t n, void * __restrict ps,
|
||||
size_t * __restrict nresult, struct iconv_hooks *hooks)
|
||||
{
|
||||
wchar_t wc;
|
||||
@ -151,7 +151,7 @@ _FUNCNAME(stdenc_cstomb)(struct _citrus_stdenc * __restrict ce,
|
||||
|
||||
static int
|
||||
_FUNCNAME(stdenc_mbtowc)(struct _citrus_stdenc * __restrict ce,
|
||||
_citrus_wc_t * __restrict wc, const char ** __restrict s, size_t n,
|
||||
_citrus_wc_t * __restrict wc, char ** __restrict s, size_t n,
|
||||
void * __restrict ps, size_t * __restrict nresult,
|
||||
struct iconv_hooks *hooks)
|
||||
{
|
||||
|
@ -29,11 +29,11 @@
|
||||
/*
|
||||
* Interal prototypes for our back-end functions.
|
||||
*/
|
||||
size_t __bsd___iconv(iconv_t, const char **, size_t *, char **,
|
||||
size_t __bsd___iconv(iconv_t, char **, size_t *, char **,
|
||||
size_t *, __uint32_t, size_t *);
|
||||
void __bsd___iconv_free_list(char **, size_t);
|
||||
int __bsd___iconv_get_list(char ***, size_t *, __iconv_bool);
|
||||
size_t __bsd_iconv(iconv_t, const char ** __restrict,
|
||||
size_t __bsd_iconv(iconv_t, char ** __restrict,
|
||||
size_t * __restrict, char ** __restrict,
|
||||
size_t * __restrict);
|
||||
const char *__bsd_iconv_canonicalize(const char *);
|
||||
|
@ -48,7 +48,7 @@
|
||||
.Ft size_t
|
||||
.Fn iconv "iconv_t cd" "char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft"
|
||||
.Ft size_t
|
||||
.Fn __iconv "iconv_t cd" "const char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t * invalids"
|
||||
.Fn __iconv "iconv_t cd" "char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t * invalids"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn iconv_open
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "iconv-internal.h"
|
||||
|
||||
size_t
|
||||
iconv(iconv_t a, const char ** __restrict b,
|
||||
iconv(iconv_t a, char ** __restrict b,
|
||||
size_t * __restrict c, char ** __restrict d,
|
||||
size_t * __restrict e)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "iconv-internal.h"
|
||||
|
||||
size_t
|
||||
__iconv_compat(iconv_t a, const char ** b, size_t * c, char ** d,
|
||||
__iconv_compat(iconv_t a, char ** b, size_t * c, char ** d,
|
||||
size_t * e, __uint32_t f, size_t *g)
|
||||
{
|
||||
return __bsd___iconv(a, b, c, d, e, f, g);
|
||||
@ -56,7 +56,7 @@ __iconv_get_list_compat(char ***a, size_t *b, __iconv_bool c)
|
||||
}
|
||||
|
||||
size_t
|
||||
iconv_compat(iconv_t a, const char ** __restrict b,
|
||||
iconv_compat(iconv_t a, char ** __restrict b,
|
||||
size_t * __restrict c, char ** __restrict d,
|
||||
size_t * __restrict e)
|
||||
{
|
||||
|
@ -57,8 +57,7 @@ cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps,
|
||||
{
|
||||
_ConversionState *cs;
|
||||
struct _citrus_iconv *handle;
|
||||
const char *src;
|
||||
char *dst;
|
||||
char *src, *dst;
|
||||
size_t srcleft, dstleft, invlen;
|
||||
int err;
|
||||
|
||||
|
@ -99,8 +99,7 @@ mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n,
|
||||
|
||||
/* Convert as few characters to the dst buffer as possible. */
|
||||
for (i = 0; ; i++) {
|
||||
const char *src;
|
||||
char *dst;
|
||||
char *src, *dst;
|
||||
size_t srcleft, dstleft, invlen;
|
||||
int err;
|
||||
|
||||
|
@ -269,12 +269,12 @@ static int
|
||||
/*ARGSUSED*/
|
||||
_citrus_BIG5_mbrtowc_priv(_BIG5EncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc,
|
||||
const char ** __restrict s, size_t n,
|
||||
char ** __restrict s, size_t n,
|
||||
_BIG5State * __restrict psenc,
|
||||
size_t * __restrict nresult)
|
||||
{
|
||||
wchar_t wchar;
|
||||
const char *s0;
|
||||
char *s0;
|
||||
int c, chlenbak;
|
||||
|
||||
s0 = *s;
|
||||
|
@ -165,10 +165,10 @@ is_94charset(int c)
|
||||
static int
|
||||
/*ARGSUSED*/
|
||||
_citrus_DECHanyu_mbrtowc_priv(_DECHanyuEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_DECHanyuState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
wchar_t wc;
|
||||
int ch;
|
||||
|
||||
|
@ -190,12 +190,12 @@ _citrus_EUC_unpack_state(_EUCEncodingInfo *ei __unused, _EUCState *s,
|
||||
#endif
|
||||
|
||||
static int
|
||||
_citrus_EUC_mbrtowc_priv(_EUCEncodingInfo *ei, wchar_t *pwc, const char **s,
|
||||
_citrus_EUC_mbrtowc_priv(_EUCEncodingInfo *ei, wchar_t *pwc, char **s,
|
||||
size_t n, _EUCState *psenc, size_t *nresult)
|
||||
{
|
||||
wchar_t wchar;
|
||||
int c, chlenbak, cs, len;
|
||||
const char *s0, *s1 = NULL;
|
||||
char *s0, *s1 = NULL;
|
||||
|
||||
s0 = *s;
|
||||
|
||||
|
@ -176,10 +176,10 @@ _citrus_EUCTW_encoding_module_uninit(_EUCTWEncodingInfo *ei __unused)
|
||||
|
||||
static int
|
||||
_citrus_EUCTW_mbrtowc_priv(_EUCTWEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s,
|
||||
wchar_t * __restrict pwc, char ** __restrict s,
|
||||
size_t n, _EUCTWState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
wchar_t wchar;
|
||||
int c, chlenbak, cs;
|
||||
|
||||
|
@ -149,10 +149,10 @@ _mb_count(wchar_t v)
|
||||
|
||||
static int
|
||||
_citrus_GBK2K_mbrtowc_priv(_GBK2KEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_GBK2KState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *s0, *s1;
|
||||
char *s0, *s1;
|
||||
wchar_t wc;
|
||||
int chlenbak, len;
|
||||
|
||||
|
@ -175,13 +175,13 @@ _citrus_HZ_unpack_state(_HZEncodingInfo * __restrict ei __unused,
|
||||
|
||||
static int
|
||||
_citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_HZState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
escape_t *candidate, *init;
|
||||
graphic_t *graphic;
|
||||
const range_t *range;
|
||||
const char *s0;
|
||||
char *s0;
|
||||
wchar_t wc;
|
||||
int bit, ch, head, len, tail;
|
||||
|
||||
|
@ -574,7 +574,7 @@ terminate:
|
||||
|
||||
static wchar_t
|
||||
_ISO2022_sgetwchar(_ISO2022EncodingInfo * __restrict ei __unused,
|
||||
const char * __restrict string, size_t n, const char ** __restrict result,
|
||||
char * __restrict string, size_t n, char ** __restrict result,
|
||||
_ISO2022State * __restrict psenc)
|
||||
{
|
||||
const struct seqtable *sp;
|
||||
@ -842,10 +842,10 @@ asis:
|
||||
|
||||
static int
|
||||
_citrus_ISO2022_mbrtowc_priv(_ISO2022EncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s,
|
||||
wchar_t * __restrict pwc, char ** __restrict s,
|
||||
size_t n, _ISO2022State * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *p, *result, *s0;
|
||||
char *p, *result, *s0;
|
||||
wchar_t wchar;
|
||||
int c, chlenbak;
|
||||
|
||||
|
@ -145,10 +145,10 @@ ishanja(int l, int t)
|
||||
static int
|
||||
/*ARGSUSED*/
|
||||
_citrus_JOHAB_mbrtowc_priv(_JOHABEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_JOHABState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
int l, t;
|
||||
|
||||
if (*s == NULL) {
|
||||
|
@ -153,10 +153,10 @@ _citrus_MSKanji_unpack_state(_MSKanjiEncodingInfo * __restrict ei __unused,
|
||||
static int
|
||||
/*ARGSUSED*/
|
||||
_citrus_MSKanji_mbrtowc_priv(_MSKanjiEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_MSKanjiState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
wchar_t wchar;
|
||||
int chlenbak, len;
|
||||
|
||||
|
@ -185,10 +185,10 @@ is_basic(wchar_t wc)
|
||||
|
||||
static int
|
||||
_citrus_UES_mbrtowc_priv(_UESEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_UESState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
int ch, head, num, tail;
|
||||
wchar_t hi, wc;
|
||||
|
||||
|
@ -97,9 +97,9 @@ _citrus_UTF1632_init_state(_UTF1632EncodingInfo *ei __unused,
|
||||
|
||||
static int
|
||||
_citrus_UTF1632_mbrtowc_priv(_UTF1632EncodingInfo *ei, wchar_t *pwc,
|
||||
const char **s, size_t n, _UTF1632State *psenc, size_t *nresult)
|
||||
char **s, size_t n, _UTF1632State *psenc, size_t *nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
size_t result;
|
||||
wchar_t wc = L'\0';
|
||||
int chlenbak, endian, needlen;
|
||||
|
@ -151,11 +151,11 @@ static const char spaces[] = " \t\r\n";
|
||||
|
||||
static int
|
||||
_citrus_UTF7_mbtoutf16(_UTF7EncodingInfo * __restrict ei,
|
||||
uint16_t * __restrict u16, const char ** __restrict s, size_t n,
|
||||
uint16_t * __restrict u16, char ** __restrict s, size_t n,
|
||||
_UTF7State * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
_UTF7State sv;
|
||||
const char *s0;
|
||||
char *s0;
|
||||
int done, i, len;
|
||||
|
||||
s0 = *s;
|
||||
@ -244,7 +244,7 @@ ilseq:
|
||||
|
||||
static int
|
||||
_citrus_UTF7_mbrtowc_priv(_UTF7EncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_UTF7State * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
uint32_t u32;
|
||||
|
@ -177,10 +177,10 @@ _citrus_UTF8_unpack_state(_UTF8EncodingInfo *ei __unused, _UTF8State *s,
|
||||
#endif
|
||||
|
||||
static int
|
||||
_citrus_UTF8_mbrtowc_priv(_UTF8EncodingInfo *ei, wchar_t *pwc, const char **s,
|
||||
_citrus_UTF8_mbrtowc_priv(_UTF8EncodingInfo *ei, wchar_t *pwc, char **s,
|
||||
size_t n, _UTF8State *psenc, size_t *nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
wchar_t wchar;
|
||||
int i;
|
||||
uint8_t c;
|
||||
|
@ -252,11 +252,11 @@ _citrus_VIQR_unpack_state(_VIQREncodingInfo * __restrict ei __unused,
|
||||
|
||||
static int
|
||||
_citrus_VIQR_mbrtowc_priv(_VIQREncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
|
||||
_VIQRState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
mnemonic_t *m, *m0;
|
||||
const char *s0;
|
||||
char *s0;
|
||||
wchar_t wc;
|
||||
ssize_t i;
|
||||
int ch, escape;
|
||||
|
@ -107,10 +107,10 @@ _citrus_ZW_unpack_state(_ZWEncodingInfo * __restrict ei __unused,
|
||||
|
||||
static int
|
||||
_citrus_ZW_mbrtowc_priv(_ZWEncodingInfo * __restrict ei,
|
||||
wchar_t * __restrict pwc, const char **__restrict s, size_t n,
|
||||
wchar_t * __restrict pwc, char **__restrict s, size_t n,
|
||||
_ZWState * __restrict psenc, size_t * __restrict nresult)
|
||||
{
|
||||
const char *s0;
|
||||
char *s0;
|
||||
wchar_t wc;
|
||||
int ch, len;
|
||||
|
||||
|
@ -97,7 +97,7 @@ _citrus_iconv_none_iconv_uninit_context(struct _citrus_iconv *cv __unused)
|
||||
static int
|
||||
/*ARGSUSED*/
|
||||
_citrus_iconv_none_iconv_convert(struct _citrus_iconv * __restrict ci __unused,
|
||||
const char * __restrict * __restrict in, size_t * __restrict inbytes,
|
||||
char * __restrict * __restrict in, size_t * __restrict inbytes,
|
||||
char * __restrict * __restrict out, size_t * __restrict outbytes,
|
||||
uint32_t flags __unused, size_t * __restrict invalids)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ init_encoding_state(struct _citrus_iconv_std_encoding *se)
|
||||
|
||||
static __inline int
|
||||
mbtocsx(struct _citrus_iconv_std_encoding *se,
|
||||
_csid_t *csid, _index_t *idx, const char **s, size_t n, size_t *nresult,
|
||||
_csid_t *csid, _index_t *idx, char **s, size_t n, size_t *nresult,
|
||||
struct iconv_hooks *hooks)
|
||||
{
|
||||
|
||||
@ -461,7 +461,7 @@ _citrus_iconv_std_iconv_uninit_context(struct _citrus_iconv *cv)
|
||||
|
||||
static int
|
||||
_citrus_iconv_std_iconv_convert(struct _citrus_iconv * __restrict cv,
|
||||
const char * __restrict * __restrict in, size_t * __restrict inbytes,
|
||||
char * __restrict * __restrict in, size_t * __restrict inbytes,
|
||||
char * __restrict * __restrict out, size_t * __restrict outbytes,
|
||||
uint32_t flags, size_t * __restrict invalids)
|
||||
{
|
||||
@ -469,7 +469,7 @@ _citrus_iconv_std_iconv_convert(struct _citrus_iconv * __restrict cv,
|
||||
struct _citrus_iconv_std_context *sc = cv->cv_closure;
|
||||
_csid_t csid;
|
||||
_index_t idx;
|
||||
const char *tmpin;
|
||||
char *tmpin;
|
||||
size_t inval, szrin, szrout;
|
||||
int ret, state = 0;
|
||||
|
||||
|
@ -62,7 +62,7 @@ static int chklocale(int, const char *);
|
||||
typedef void *iconv_t;
|
||||
static int my_iconv_init(void);
|
||||
static iconv_t (*my_iconv_open)(const char *, const char *);
|
||||
static size_t (*my_iconv)(iconv_t, const char **, size_t *, char **, size_t *);
|
||||
static size_t (*my_iconv)(iconv_t, char **, size_t *, char **, size_t *);
|
||||
static int (*my_iconv_close)(iconv_t);
|
||||
#else
|
||||
#include <iconv.h>
|
||||
@ -71,7 +71,7 @@ static int (*my_iconv_close)(iconv_t);
|
||||
#define my_iconv iconv
|
||||
#define my_iconv_close iconv_close
|
||||
#endif
|
||||
static size_t my_iconv_char(iconv_t, const u_char **, size_t *, u_char **, size_t *);
|
||||
static size_t my_iconv_char(iconv_t, u_char **, size_t *, u_char **, size_t *);
|
||||
|
||||
int
|
||||
kiconv_add_xlat16_cspair(const char *tocode, const char *fromcode, int flag)
|
||||
@ -221,8 +221,8 @@ kiconv_xlat16_open(const char *tocode, const char *fromcode, int lcase)
|
||||
src[0] = (u_char)(c >> 8);
|
||||
src[1] = (u_char)c;
|
||||
|
||||
ret = my_iconv_char(cd, (const u_char **)&srcp,
|
||||
&inbytesleft, &dstp, &outbytesleft);
|
||||
ret = my_iconv_char(cd, &srcp, &inbytesleft,
|
||||
&dstp, &outbytesleft);
|
||||
if (ret == -1) {
|
||||
table[us] = 0;
|
||||
continue;
|
||||
@ -338,11 +338,10 @@ my_iconv_init(void)
|
||||
#endif
|
||||
|
||||
static size_t
|
||||
my_iconv_char(iconv_t cd, const u_char **ibuf, size_t * ilen, u_char **obuf,
|
||||
my_iconv_char(iconv_t cd, u_char **ibuf, size_t * ilen, u_char **obuf,
|
||||
size_t * olen)
|
||||
{
|
||||
const u_char *sp;
|
||||
u_char *dp, ilocal[3], olocal[3];
|
||||
u_char *sp, *dp, ilocal[3], olocal[3];
|
||||
u_char c1, c2;
|
||||
int ret;
|
||||
size_t ir, or;
|
||||
@ -352,7 +351,7 @@ my_iconv_char(iconv_t cd, const u_char **ibuf, size_t * ilen, u_char **obuf,
|
||||
ir = *ilen;
|
||||
|
||||
bzero(*obuf, *olen);
|
||||
ret = my_iconv(cd, (const char **)&sp, ilen, (char **)&dp, olen);
|
||||
ret = my_iconv(cd, (char **)&sp, ilen, (char **)&dp, olen);
|
||||
c1 = (*obuf)[0];
|
||||
c2 = (*obuf)[1];
|
||||
|
||||
@ -375,7 +374,7 @@ my_iconv_char(iconv_t cd, const u_char **ibuf, size_t * ilen, u_char **obuf,
|
||||
sp = ilocal;
|
||||
dp = olocal;
|
||||
|
||||
if ((my_iconv(cd,(const char **)&sp, &ir, (char **)&dp, &or)) != -1) {
|
||||
if ((my_iconv(cd,(char **)&sp, &ir, (char **)&dp, &or)) != -1) {
|
||||
if (olocal[0] != c1)
|
||||
return (ret);
|
||||
|
||||
@ -429,7 +428,7 @@ my_iconv_char(iconv_t cd, const u_char **ibuf, size_t * ilen, u_char **obuf,
|
||||
sp = ilocal + 1;
|
||||
dp = olocal;
|
||||
|
||||
if ((my_iconv(cd,(const char **)&sp, &ir, (char **)&dp, &or)) != -1) {
|
||||
if ((my_iconv(cd,(char **)&sp, &ir, (char **)&dp, &or)) != -1) {
|
||||
if (olocal[0] == c2)
|
||||
/*
|
||||
* inbuf is a single byte char
|
||||
|
@ -161,7 +161,7 @@ rtld_tlsdesc_handle_locked(struct tls_data *tlsdesc, int flags,
|
||||
if (def == NULL)
|
||||
rtld_die();
|
||||
|
||||
tlsdesc->index = defobj->tlsindex + def->st_value + rela->r_addend;
|
||||
tlsdesc->index = defobj->tlsoffset + def->st_value + rela->r_addend;
|
||||
|
||||
return (tlsdesc->index);
|
||||
}
|
||||
@ -206,7 +206,7 @@ reloc_plt(Obj_Entry *obj)
|
||||
case R_AARCH64_TLSDESC:
|
||||
if (ELF_R_SYM(rela->r_info) == 0) {
|
||||
where[0] = (Elf_Addr)_rtld_tlsdesc;
|
||||
where[1] = obj->tlsindex + rela->r_addend;
|
||||
where[1] = obj->tlsoffset + rela->r_addend;
|
||||
} else {
|
||||
where[0] = (Elf_Addr)_rtld_tlsdesc_dynamic;
|
||||
where[1] = (Elf_Addr)reloc_tlsdesc_alloc(obj,
|
||||
|
@ -1158,8 +1158,8 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
|
||||
obj->z_noopen = true;
|
||||
if ((dynp->d_un.d_val & DF_1_ORIGIN) && trust)
|
||||
obj->z_origin = true;
|
||||
/*if (dynp->d_un.d_val & DF_1_GLOBAL)
|
||||
XXX ;*/
|
||||
if (dynp->d_un.d_val & DF_1_GLOBAL)
|
||||
obj->z_global = true;
|
||||
if (dynp->d_un.d_val & DF_1_BIND_NOW)
|
||||
obj->bind_now = true;
|
||||
if (dynp->d_un.d_val & DF_1_NODELETE)
|
||||
@ -1790,22 +1790,35 @@ init_dag(Obj_Entry *root)
|
||||
}
|
||||
|
||||
static void
|
||||
process_nodelete(Obj_Entry *root)
|
||||
process_z(Obj_Entry *root)
|
||||
{
|
||||
const Objlist_Entry *elm;
|
||||
Obj_Entry *obj;
|
||||
|
||||
/*
|
||||
* Walk over object DAG and process every dependent object that
|
||||
* is marked as DF_1_NODELETE. They need to grow their own DAG,
|
||||
* which then should have its reference upped separately.
|
||||
* Walk over object DAG and process every dependent object
|
||||
* that is marked as DF_1_NODELETE or DF_1_GLOBAL. They need
|
||||
* to grow their own DAG.
|
||||
*
|
||||
* For DF_1_GLOBAL, DAG is required for symbol lookups in
|
||||
* symlook_global() to work.
|
||||
*
|
||||
* For DF_1_NODELETE, the DAG should have its reference upped.
|
||||
*/
|
||||
STAILQ_FOREACH(elm, &root->dagmembers, link) {
|
||||
if (elm->obj != NULL && elm->obj->z_nodelete &&
|
||||
!elm->obj->ref_nodel) {
|
||||
dbg("obj %s nodelete", elm->obj->path);
|
||||
init_dag(elm->obj);
|
||||
ref_dag(elm->obj);
|
||||
elm->obj->ref_nodel = true;
|
||||
obj = elm->obj;
|
||||
if (obj == NULL)
|
||||
continue;
|
||||
if (obj->z_nodelete && !obj->ref_nodel) {
|
||||
dbg("obj %s -z nodelete", obj->path);
|
||||
init_dag(obj);
|
||||
ref_dag(obj);
|
||||
obj->ref_nodel = true;
|
||||
}
|
||||
if (obj->z_global && objlist_find(&list_global, obj) == NULL) {
|
||||
dbg("obj %s -z global", obj->path);
|
||||
objlist_push_tail(&list_global, obj);
|
||||
init_dag(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3044,13 +3057,13 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
|
||||
initlist_add_objects(obj, &obj->next, &initlist);
|
||||
}
|
||||
/*
|
||||
* Process all no_delete objects here, given them own
|
||||
* DAGs to prevent their dependencies from being unloaded.
|
||||
* This has to be done after we have loaded all of the
|
||||
* dependencies, so that we do not miss any.
|
||||
* Process all no_delete or global objects here, given
|
||||
* them own DAGs to prevent their dependencies from being
|
||||
* unloaded. This has to be done after we have loaded all
|
||||
* of the dependencies, so that we do not miss any.
|
||||
*/
|
||||
if (obj != NULL)
|
||||
process_nodelete(obj);
|
||||
process_z(obj);
|
||||
} else {
|
||||
/*
|
||||
* Bump the reference counts for objects on this DAG. If
|
||||
|
@ -264,6 +264,7 @@ typedef struct Struct_Obj_Entry {
|
||||
bool z_loadfltr : 1; /* Immediately load filtees */
|
||||
bool z_interpose : 1; /* Interpose all objects but main */
|
||||
bool z_nodeflib : 1; /* Don't search default library path */
|
||||
bool z_global : 1; /* Make the object global */
|
||||
bool ref_nodel : 1; /* Refcount increased to prevent dlclose */
|
||||
bool init_scanned: 1; /* Object is already on init list. */
|
||||
bool on_fini_list: 1; /* Object is already on fini list. */
|
||||
|
@ -88,41 +88,42 @@ vfp_save_state(struct thread *td)
|
||||
uint64_t fpcr, fpsr;
|
||||
uint32_t cpacr;
|
||||
|
||||
critical_enter();
|
||||
/*
|
||||
* Only store the registers if the VFP is enabled,
|
||||
* i.e. return if we are trapping on FP access.
|
||||
*/
|
||||
cpacr = READ_SPECIALREG(cpacr_el1);
|
||||
if ((cpacr & CPACR_FPEN_MASK) != CPACR_FPEN_TRAP_NONE)
|
||||
return;
|
||||
if ((cpacr & CPACR_FPEN_MASK) == CPACR_FPEN_TRAP_NONE) {
|
||||
vfp_state = td->td_pcb->pcb_vfp;
|
||||
__asm __volatile(
|
||||
"mrs %0, fpcr \n"
|
||||
"mrs %1, fpsr \n"
|
||||
"stp q0, q1, [%2, #16 * 0]\n"
|
||||
"stp q2, q3, [%2, #16 * 2]\n"
|
||||
"stp q4, q5, [%2, #16 * 4]\n"
|
||||
"stp q6, q7, [%2, #16 * 6]\n"
|
||||
"stp q8, q9, [%2, #16 * 8]\n"
|
||||
"stp q10, q11, [%2, #16 * 10]\n"
|
||||
"stp q12, q13, [%2, #16 * 12]\n"
|
||||
"stp q14, q15, [%2, #16 * 14]\n"
|
||||
"stp q16, q17, [%2, #16 * 16]\n"
|
||||
"stp q18, q19, [%2, #16 * 18]\n"
|
||||
"stp q20, q21, [%2, #16 * 20]\n"
|
||||
"stp q22, q23, [%2, #16 * 22]\n"
|
||||
"stp q24, q25, [%2, #16 * 24]\n"
|
||||
"stp q26, q27, [%2, #16 * 26]\n"
|
||||
"stp q28, q29, [%2, #16 * 28]\n"
|
||||
"stp q30, q31, [%2, #16 * 30]\n"
|
||||
: "=&r"(fpcr), "=&r"(fpsr) : "r"(vfp_state));
|
||||
|
||||
vfp_state = td->td_pcb->pcb_vfp;
|
||||
__asm __volatile(
|
||||
"mrs %0, fpcr \n"
|
||||
"mrs %1, fpsr \n"
|
||||
"stp q0, q1, [%2, #16 * 0]\n"
|
||||
"stp q2, q3, [%2, #16 * 2]\n"
|
||||
"stp q4, q5, [%2, #16 * 4]\n"
|
||||
"stp q6, q7, [%2, #16 * 6]\n"
|
||||
"stp q8, q9, [%2, #16 * 8]\n"
|
||||
"stp q10, q11, [%2, #16 * 10]\n"
|
||||
"stp q12, q13, [%2, #16 * 12]\n"
|
||||
"stp q14, q15, [%2, #16 * 14]\n"
|
||||
"stp q16, q17, [%2, #16 * 16]\n"
|
||||
"stp q18, q19, [%2, #16 * 18]\n"
|
||||
"stp q20, q21, [%2, #16 * 20]\n"
|
||||
"stp q22, q23, [%2, #16 * 22]\n"
|
||||
"stp q24, q25, [%2, #16 * 24]\n"
|
||||
"stp q26, q27, [%2, #16 * 26]\n"
|
||||
"stp q28, q29, [%2, #16 * 28]\n"
|
||||
"stp q30, q31, [%2, #16 * 30]\n"
|
||||
: "=&r"(fpcr), "=&r"(fpsr) : "r"(vfp_state));
|
||||
td->td_pcb->pcb_fpcr = fpcr;
|
||||
td->td_pcb->pcb_fpsr = fpsr;
|
||||
|
||||
td->td_pcb->pcb_fpcr = fpcr;
|
||||
td->td_pcb->pcb_fpsr = fpsr;
|
||||
|
||||
dsb();
|
||||
vfp_disable();
|
||||
dsb();
|
||||
vfp_disable();
|
||||
}
|
||||
critical_exit();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -47,6 +47,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/pcb.h>
|
||||
#include <machine/frame.h>
|
||||
|
||||
#ifdef VFP
|
||||
#include <machine/vfp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Finish a fork operation, with process p2 nearly set up.
|
||||
* Copy and update the pcb, set up the stack so that the child
|
||||
@ -61,6 +65,19 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
|
||||
if ((flags & RFPROC) == 0)
|
||||
return;
|
||||
|
||||
if (td1 == curthread) {
|
||||
/*
|
||||
* Save the tpidr_el0 and the vfp state, these normally happen
|
||||
* in cpu_switch, but if userland changes these then forks
|
||||
* this may not have happened.
|
||||
*/
|
||||
td1->td_pcb->pcb_tpidr_el0 = READ_SPECIALREG(tpidr_el0);
|
||||
#ifdef VFP
|
||||
if ((td1->td_pcb->pcb_fpflags & PCB_FP_STARTED) != 0)
|
||||
vfp_save_state(td1);
|
||||
#endif
|
||||
}
|
||||
|
||||
pcb2 = (struct pcb *)(td2->td_kstack +
|
||||
td2->td_kstack_pages * PAGE_SIZE) - 1;
|
||||
|
||||
|
1
sys/arm64/include/psl.h
Normal file
1
sys/arm64/include/psl.h
Normal file
@ -0,0 +1 @@
|
||||
/* $FreeBSD$ */
|
@ -4,4 +4,4 @@
|
||||
SUBDIR+= fdt
|
||||
.endif
|
||||
|
||||
SUBDIR+= uboot
|
||||
SUBDIR+= efi uboot
|
||||
|
7
sys/boot/Makefile.arm64
Normal file
7
sys/boot/Makefile.arm64
Normal file
@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.if ${MK_FDT} != "no"
|
||||
SUBDIR+= fdt
|
||||
.endif
|
||||
|
||||
SUBDIR+= efi
|
3
sys/boot/arm64/Makefile
Normal file
3
sys/boot/arm64/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.subdir.mk>
|
95
sys/boot/arm64/libarm64/cache.c
Normal file
95
sys/boot/arm64/libarm64/cache.c
Normal file
@ -0,0 +1,95 @@
|
||||
/*-
|
||||
* Copyright (c) 2014 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Semihalf under
|
||||
* the sponsorship of the FreeBSD Foundation.
|
||||
* 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/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <machine/armreg.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include <efi.h>
|
||||
|
||||
#include "cache.h"
|
||||
|
||||
static unsigned int
|
||||
get_dcache_line_size(void)
|
||||
{
|
||||
uint64_t ctr;
|
||||
unsigned int dcl_size;
|
||||
|
||||
/* Accessible from all security levels */
|
||||
ctr = READ_SPECIALREG(ctr_el0);
|
||||
|
||||
/*
|
||||
* Relevant field [19:16] is LOG2
|
||||
* of the number of words in DCache line
|
||||
*/
|
||||
dcl_size = CTR_DLINE_SIZE(ctr);
|
||||
|
||||
/* Size of word shifted by cache line size */
|
||||
return (sizeof(int) << dcl_size);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_flush_dcache(const void *ptr, size_t len)
|
||||
{
|
||||
|
||||
uint64_t cl_size;
|
||||
vm_offset_t addr, end;
|
||||
|
||||
cl_size = get_dcache_line_size();
|
||||
|
||||
/* Calculate end address to clean */
|
||||
end = (vm_offset_t)(ptr + len);
|
||||
/* Align start address to cache line */
|
||||
addr = (vm_offset_t)ptr;
|
||||
addr = rounddown2(addr, cl_size);
|
||||
|
||||
for (; addr < end; addr += cl_size)
|
||||
__asm __volatile("dc civac, %0" : : "r" (addr) : "memory");
|
||||
/* Full system DSB */
|
||||
__asm __volatile("dsb sy" : : : "memory");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_inval_icache(const void *ptr, size_t len)
|
||||
{
|
||||
|
||||
/* NULL ptr or 0 len means all */
|
||||
if (ptr == NULL || len == 0) {
|
||||
__asm __volatile(
|
||||
"ic ialluis \n"
|
||||
"dsb ish \n"
|
||||
: : : "memory");
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO: Other cache ranges if necessary */
|
||||
}
|
38
sys/boot/arm64/libarm64/cache.h
Normal file
38
sys/boot/arm64/libarm64/cache.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*-
|
||||
* Copyright (c) 2014 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Semihalf under
|
||||
* the sponsorship of the FreeBSD Foundation.
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _CACHE_H_
|
||||
#define _CACHE_H_
|
||||
|
||||
/* cache.c */
|
||||
void cpu_flush_dcache(const void *, size_t);
|
||||
void cpu_inval_icache(const void *, size_t);
|
||||
|
||||
#endif /* _CACHE_H_ */
|
@ -9,6 +9,8 @@ SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c
|
||||
SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c
|
||||
.elif ${MACHINE} == "pc98"
|
||||
SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c
|
||||
.elif ${MACHINE_CPUARCH} == "aarch64"
|
||||
SRCS+= load_elf64.c reloc_elf64.c
|
||||
.elif ${MACHINE_CPUARCH} == "arm"
|
||||
SRCS+= load_elf32.c reloc_elf32.c
|
||||
.elif ${MACHINE_CPUARCH} == "powerpc"
|
||||
|
@ -10,7 +10,9 @@ SUBDIR+= fdt
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "arm"
|
||||
.if ${MACHINE_CPUARCH} == "aarch64" || \
|
||||
${MACHINE_CPUARCH} == "amd64" || \
|
||||
${MACHINE_CPUARCH} == "arm"
|
||||
SUBDIR+= loader boot1
|
||||
.endif
|
||||
|
||||
|
@ -17,12 +17,12 @@ SRCS= boot1.c reloc.c start.S
|
||||
|
||||
CFLAGS+= -I.
|
||||
CFLAGS+= -I${.CURDIR}/../include
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH}
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
|
||||
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
|
||||
CFLAGS+= -I${.CURDIR}/../../..
|
||||
|
||||
# Always add MI sources and REGULAR efi loader bits
|
||||
.PATH: ${.CURDIR}/../loader/arch/${MACHINE_CPUARCH}
|
||||
.PATH: ${.CURDIR}/../loader/arch/${MACHINE}
|
||||
.PATH: ${.CURDIR}/../loader
|
||||
.PATH: ${.CURDIR}/../../common
|
||||
CFLAGS+= -I${.CURDIR}/../../common
|
||||
@ -30,7 +30,7 @@ CFLAGS+= -I${.CURDIR}/../../common
|
||||
FILES= boot1.efi boot1.efifat
|
||||
FILESMODE_boot1.efi= ${BINMODE}
|
||||
|
||||
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE_CPUARCH}/ldscript.${MACHINE_CPUARCH}
|
||||
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
|
||||
LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
||||
@ -79,8 +79,8 @@ boot1.o: ${.CURDIR}/../../common/ufsread.c
|
||||
|
||||
boot1.efifat: boot1.efi
|
||||
echo ${.OBJDIR}
|
||||
uudecode ${.CURDIR}/fat-${MACHINE_CPUARCH}.tmpl.bz2.uu
|
||||
mv fat-${MACHINE_CPUARCH}.tmpl.bz2 ${.TARGET}.bz2
|
||||
uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
|
||||
mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
|
||||
bzip2 -f -d ${.TARGET}.bz2
|
||||
dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
|
||||
|
||||
|
26
sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu
Normal file
26
sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu
Normal file
@ -0,0 +1,26 @@
|
||||
FAT template boot filesystem created by generate-fat.sh
|
||||
DO NOT EDIT
|
||||
$FreeBSD$
|
||||
begin 644 fat-arm64.tmpl.bz2
|
||||
M0EIH.3%!62936:2BH:(`&T#_____ZZKJ[_^N_ZO_J_Z[OJ_NJ^JK^KZNKNNJ
|
||||
MZNKNZOJ^P`+\```"``:`9,@T&F3$,@!B`,AIHP$#0-`T``,09--&31IH9#)D
|
||||
M,(#$T&)B!A``-`,F0:#3)B&0`Q`&0TT8"!H&@:``&(,FFC)HTT,ADR&$!B:#
|
||||
M$Q`P@`&@&3(-!IDQ#(`8@#(::,!`T#0-``#$&331DT::&0R9#"`Q-!B8@8"J
|
||||
M*0GY$I&GH"-&AZ@T```T`:`!HT```&@&@-,C0`-`#U,(-`&)ZF(PGIJ>IO;U
|
||||
M^=&QL3`-\E@Q+$(RTHB$7I"(B(-W:73$0@A#;S##$3$`A#FL\LAF,;&8;[CE
|
||||
M&D=@ON\:9IWHO):QK7LL=LFN;1M6Y:%F>-1G^&O-A*(@0AQ,\#H*KRCJF>9Q
|
||||
MFF_,RWU4X-,R6K5EJU:M6L"JMB5555555JVJU*U-JU:M6MUB*I555555;XHJ
|
||||
ME555555YM='L;(N7+ERY<N4****************.2B55555555%%%%%%%%"B
|
||||
MBBBBBC#S/DW+ERY<N7+E&NE55555550HHHHHHHS_(SQEG'X7.OTSKFY=#*]*
|
||||
M9?C*,7MM&JO=0EIDQW:7C-0U;WGRM>_!^S^F[=KA#3YJ.S-)`!>O]K)`#-ZO
|
||||
MU=9T,X(@!H',-+,1Q'-6'#ZNQORGURS=]_O%.6SF5G,PC`G#X_@7W$RC>2Q)
|
||||
M9MW3P&G:AJFA?`^AKWXOV?R_QDL9F^`=5H>$UWWT9K&Q/HS.!KXB)U)9$6,)
|
||||
M*/!EJ7>+W2L65_C\&LP69G$?'M$18.(LL.G:AZ;%>TUKYF.V+9/W9AMF[<VT
|
||||
MS/X;%DL?1SW5Y]4L]R=+RLNCTMB[6_5C8C2+?DPWF/F.G]WN[5+:G4UOWC%E
|
||||
M*3V7BO??&^=COL?:V3]&T9#<-XWKX3\,BQ#[KW01%D(X'O<#8?*B.`D]1J&O
|
||||
M>&^]HFB?J_AM6V;ANF2RG7,61I)?])L35<Y8C.RWDHV3\GZOW;-TC:MLW#<O
|
||||
MG;QDO2<6_S5;,T$1["/3W^^]&4;3*_F\:?7"90R&E;=N']O@;ENF[?ZR6Q93
|
||||
M_F6SAO9,N65+9R:#69>2^EX5C12BSAX@$(3`!EWEZ6P2R$9#_Q=R13A0D*2B
|
||||
"H:(`
|
||||
`
|
||||
end
|
@ -18,7 +18,7 @@ BOOT1_SIZE=128k
|
||||
#
|
||||
# Known filenames
|
||||
# amd64: BOOTx64.efi
|
||||
# aarch64: BOOTaa64.efi
|
||||
# arm64: BOOTaa64.efi
|
||||
# arm: BOOTarm.efi
|
||||
# i386: BOOTia32.efi
|
||||
#
|
||||
|
@ -10,7 +10,7 @@ INTERNALLIB=
|
||||
SRCS= efi_fdt.c
|
||||
|
||||
CFLAGS+= -ffreestanding -msoft-float
|
||||
.if ${MACHINE_CPUARCH} == "arm64"
|
||||
.if ${MACHINE_CPUARCH} == "aarch64"
|
||||
CFLAGS+= -mgeneral-regs-only
|
||||
.endif
|
||||
|
||||
@ -18,7 +18,7 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
|
||||
|
||||
# EFI library headers
|
||||
CFLAGS+= -I${.CURDIR}/../include
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH}
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
|
||||
|
||||
# libfdt headers
|
||||
CFLAGS+= -I${.CURDIR}/../../fdt
|
||||
@ -27,7 +27,7 @@ CFLAGS+= -I${.CURDIR}/../../fdt
|
||||
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
|
||||
|
||||
machine:
|
||||
ln -sf ${.CURDIR}/../../../${MACHINE_CPUARCH}/include machine
|
||||
ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
|
||||
|
||||
CLEANFILES+= machine
|
||||
|
||||
|
219
sys/boot/efi/include/arm64/efibind.h
Normal file
219
sys/boot/efi/include/arm64/efibind.h
Normal file
@ -0,0 +1,219 @@
|
||||
/* $FreeBSD$ */
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
efefind.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/stdint.h>
|
||||
#else
|
||||
//
|
||||
// Basic int types of various widths
|
||||
//
|
||||
|
||||
#if (__STDC_VERSION__ < 199901L )
|
||||
|
||||
// No ANSI C 1999/2000 stdint.h integer width declarations
|
||||
|
||||
#if _MSC_EXTENSIONS
|
||||
|
||||
// Use Microsoft C compiler integer width declarations
|
||||
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int8 int8_t;
|
||||
#else
|
||||
#ifdef UNIX_LP64
|
||||
|
||||
// Use LP64 programming model from C_FLAGS for integer width declarations
|
||||
|
||||
typedef unsigned long uint64_t;
|
||||
typedef long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#else
|
||||
|
||||
// Assume P64 programming model from C_FLAGS for integer width declarations
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef long long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
//
|
||||
// Basic EFI types of various widths
|
||||
//
|
||||
|
||||
|
||||
typedef uint64_t UINT64;
|
||||
typedef int64_t INT64;
|
||||
typedef uint32_t UINT32;
|
||||
typedef int32_t INT32;
|
||||
typedef uint16_t UINT16;
|
||||
typedef int16_t INT16;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int8_t INT8;
|
||||
|
||||
|
||||
#undef VOID
|
||||
#define VOID void
|
||||
|
||||
|
||||
typedef int64_t INTN;
|
||||
typedef uint64_t UINTN;
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// BugBug: Code to debug
|
||||
//
|
||||
#define BIT63 0x8000000000000000
|
||||
|
||||
#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63)
|
||||
#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) )
|
||||
|
||||
//
|
||||
// Macro's with casts make this much easier to use and read.
|
||||
//
|
||||
#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port)))
|
||||
#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data))
|
||||
//
|
||||
// BugBug: End Debug Code!!!
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
#define EFIERR(a) (0x8000000000000000 | a)
|
||||
#define EFI_ERROR_MASK 0x8000000000000000
|
||||
#define EFIERR_OEM(a) (0xc000000000000000 | a)
|
||||
|
||||
#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
|
||||
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
#pragma intrinsic (__break)
|
||||
#define BREAKPOINT() __break(0)
|
||||
|
||||
//
|
||||
// Pointers must be aligned to these address to function
|
||||
// you will get an alignment fault if this value is less than 8
|
||||
//
|
||||
#define MIN_ALIGNMENT_SIZE 8
|
||||
|
||||
#define ALIGN_VARIABLE(Value , Adjustment) \
|
||||
(UINTN) Adjustment = 0; \
|
||||
if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
|
||||
(UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
|
||||
Value = (UINTN)Value + (UINTN)Adjustment
|
||||
|
||||
//
|
||||
// Define macros to create data structure signatures.
|
||||
//
|
||||
|
||||
#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
|
||||
#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
|
||||
#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
|
||||
|
||||
//
|
||||
// EFIAPI - prototype calling convention for EFI function pointers
|
||||
// BOOTSERVICE - prototype for implementation of a boot service interface
|
||||
// RUNTIMESERVICE - prototype for implementation of a runtime service interface
|
||||
// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
|
||||
// RUNTIME_CODE - pragma macro for declaring runtime code
|
||||
//
|
||||
|
||||
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
|
||||
#if _MSC_EXTENSIONS
|
||||
#define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
|
||||
#else
|
||||
#define EFIAPI // Substitute expresion to force C calling convention
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOTSERVICE
|
||||
#define RUNTIMESERVICE
|
||||
#define RUNTIMEFUNCTION
|
||||
|
||||
#define RUNTIME_CODE(a) alloc_text("rtcode", a)
|
||||
#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
|
||||
#define END_RUNTIME_DATA() data_seg()
|
||||
|
||||
#define VOLATILE volatile
|
||||
|
||||
//
|
||||
// BugBug: Need to find out if this is portable accross compliers.
|
||||
//
|
||||
void __mfa (void);
|
||||
#pragma intrinsic (__mfa)
|
||||
#define MEMORY_FENCE() __mfa()
|
||||
|
||||
#ifdef EFI_NO_INTERFACE_DECL
|
||||
#define EFI_FORWARD_DECLARATION(x)
|
||||
#define EFI_INTERFACE_DECL(x)
|
||||
#else
|
||||
#define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
|
||||
#define EFI_INTERFACE_DECL(x) typedef struct x
|
||||
#endif
|
||||
|
||||
//
|
||||
// When build similiar to FW, then link everything together as
|
||||
// one big module.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction)
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, entry)
|
||||
// entry(NULL, ST)
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define INTERFACE_DECL(x) struct x
|
||||
#else
|
||||
//
|
||||
// Some compilers don't support the forward reference construct:
|
||||
// typedef struct XXXXX
|
||||
//
|
||||
// The following macro provide a workaround for such cases.
|
||||
//
|
||||
#ifdef NO_INTERFACE_DECL
|
||||
#define INTERFACE_DECL(x)
|
||||
#else
|
||||
#define INTERFACE_DECL(x) typedef struct x
|
||||
#endif
|
||||
#endif
|
@ -10,7 +10,7 @@ SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
|
||||
CFLAGS+= -fPIC -mno-red-zone
|
||||
.endif
|
||||
CFLAGS+= -I${.CURDIR}/../include
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH}
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
|
||||
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
|
||||
|
||||
# Pick up the bootstrap header for some interface items
|
||||
|
@ -24,15 +24,15 @@ SRCS= autoload.c \
|
||||
smbios.c \
|
||||
vers.c
|
||||
|
||||
.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}
|
||||
.PATH: ${.CURDIR}/arch/${MACHINE}
|
||||
# For smbios.c
|
||||
.PATH: ${.CURDIR}/../../i386/libi386
|
||||
.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc"
|
||||
.include "${.CURDIR}/arch/${MACHINE}/Makefile.inc"
|
||||
|
||||
CFLAGS+= -I${.CURDIR}
|
||||
CFLAGS+= -I${.CURDIR}/arch/${MACHINE_CPUARCH}
|
||||
CFLAGS+= -I${.CURDIR}/arch/${MACHINE}
|
||||
CFLAGS+= -I${.CURDIR}/../include
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH}
|
||||
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
|
||||
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
|
||||
CFLAGS+= -I${.CURDIR}/../../..
|
||||
CFLAGS+= -I${.CURDIR}/../../i386/libi386
|
||||
@ -70,12 +70,12 @@ CFLAGS+= -I${.CURDIR}/../../common
|
||||
FILES= loader.efi
|
||||
FILESMODE_loader.efi= ${BINMODE}
|
||||
|
||||
LDSCRIPT= ${.CURDIR}/arch/${MACHINE_CPUARCH}/ldscript.${MACHINE_CPUARCH}
|
||||
LDSCRIPT= ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
|
||||
LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
|
||||
|
||||
CLEANFILES= vers.c loader.efi
|
||||
|
||||
NEWVERSWHAT= "EFI loader" ${MACHINE_CPUARCH}
|
||||
NEWVERSWHAT= "EFI loader" ${MACHINE}
|
||||
|
||||
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../efi/loader/version
|
||||
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
|
||||
|
@ -169,8 +169,7 @@ _start:
|
||||
pop {r0, r1}
|
||||
bl _C_LABEL(efi_main)
|
||||
|
||||
1: WFI
|
||||
b 1b
|
||||
1: b 1b
|
||||
|
||||
.Lbase:
|
||||
.word .
|
||||
|
9
sys/boot/efi/loader/arch/arm64/Makefile.inc
Normal file
9
sys/boot/efi/loader/arch/arm64/Makefile.inc
Normal file
@ -0,0 +1,9 @@
|
||||
# $FreeBSD$
|
||||
|
||||
LOADER_FDT_SUPPORT=yes
|
||||
SRCS+= exec.c \
|
||||
start.S
|
||||
|
||||
.PATH: ${.CURDIR}/../../arm64/libarm64
|
||||
CFLAGS+=-I${.CURDIR}/../../arm64/libarm64
|
||||
SRCS+= cache.c
|
109
sys/boot/efi/loader/arch/arm64/exec.c
Normal file
109
sys/boot/efi/loader/arch/arm64/exec.c
Normal file
@ -0,0 +1,109 @@
|
||||
/*-
|
||||
* Copyright (c) 2006 Marcel Moolenaar
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 ``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 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/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/linker.h>
|
||||
#include <machine/elf.h>
|
||||
|
||||
#include <bootstrap.h>
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
#include "loader_efi.h"
|
||||
#include "cache.h"
|
||||
|
||||
static int elf64_exec(struct preloaded_file *amp);
|
||||
static int elf64_obj_exec(struct preloaded_file *amp);
|
||||
|
||||
int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp);
|
||||
|
||||
static struct file_format arm64_elf = {
|
||||
elf64_loadfile,
|
||||
elf64_exec
|
||||
};
|
||||
|
||||
struct file_format *file_formats[] = {
|
||||
&arm64_elf,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int
|
||||
elf64_exec(struct preloaded_file *fp)
|
||||
{
|
||||
vm_offset_t modulep, kernendp;
|
||||
vm_offset_t clean_addr;
|
||||
size_t clean_size;
|
||||
struct file_metadata *md;
|
||||
EFI_STATUS status;
|
||||
EFI_PHYSICAL_ADDRESS addr;
|
||||
Elf_Ehdr *ehdr;
|
||||
int err;
|
||||
void (*entry)(vm_offset_t);
|
||||
|
||||
if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
|
||||
return(EFTYPE);
|
||||
|
||||
ehdr = (Elf_Ehdr *)&(md->md_data);
|
||||
entry = efi_translate(ehdr->e_entry);
|
||||
|
||||
err = bi_load(fp->f_args, &modulep, &kernendp);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
|
||||
status = BS->ExitBootServices(IH, efi_mapkey);
|
||||
if (EFI_ERROR(status)) {
|
||||
printf("%s: ExitBootServices() returned 0x%lx\n", __func__,
|
||||
(long)status);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
/* Clean D-cache under kernel area and invalidate whole I-cache */
|
||||
clean_addr = efi_translate(fp->f_addr);
|
||||
clean_size = efi_translate(kernendp) - clean_addr;
|
||||
|
||||
cpu_flush_dcache((void *)clean_addr, clean_size);
|
||||
cpu_inval_icache(NULL, 0);
|
||||
|
||||
(*entry)(modulep);
|
||||
panic("exec returned");
|
||||
}
|
||||
|
||||
static int
|
||||
elf64_obj_exec(struct preloaded_file *fp)
|
||||
{
|
||||
|
||||
printf("%s called for preloaded file %p (=%s):\n", __func__, fp,
|
||||
fp->f_name);
|
||||
return (ENOSYS);
|
||||
}
|
||||
|
80
sys/boot/efi/loader/arch/arm64/ldscript.arm64
Normal file
80
sys/boot/efi/loader/arch/arm64/ldscript.arm64
Normal file
@ -0,0 +1,80 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
OUTPUT_FORMAT("elf64-aarch64-freebsd", "elf64-aarch64-freebsd", "elf64-aarch64-freebsd")
|
||||
*/
|
||||
OUTPUT_ARCH(aarch64)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = 0;
|
||||
ImageBase = .;
|
||||
.text : {
|
||||
*(.peheader)
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.plt)
|
||||
} =0x00300000010070000002000001000400
|
||||
. = ALIGN(16);
|
||||
.data : {
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
|
||||
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
|
||||
*(.opd)
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.plabel)
|
||||
|
||||
. = ALIGN(16);
|
||||
__bss_start = .;
|
||||
*(.sbss .sbss.* .gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss *.bss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(16);
|
||||
__bss_end = .;
|
||||
}
|
||||
. = ALIGN(16);
|
||||
set_Xcommand_set : {
|
||||
__start_set_Xcommand_set = .;
|
||||
*(set_Xcommand_set)
|
||||
__stop_set_Xcommand_set = .;
|
||||
}
|
||||
. = ALIGN(16);
|
||||
__gp = .;
|
||||
.sdata : {
|
||||
*(.got.plt .got)
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
||||
*(dynsbss)
|
||||
*(.scommon)
|
||||
}
|
||||
. = ALIGN(16);
|
||||
.dynamic : { *(.dynamic) }
|
||||
. = ALIGN(16);
|
||||
.rela.dyn : {
|
||||
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
|
||||
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
|
||||
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
|
||||
*(.rela.got)
|
||||
*(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
|
||||
*(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
|
||||
*(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
|
||||
*(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
|
||||
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
|
||||
*(.rela.plt)
|
||||
*(.relset_*)
|
||||
*(.rela.dyn .rela.dyn.*)
|
||||
}
|
||||
. = ALIGN(16);
|
||||
.reloc : { *(.reloc) }
|
||||
. = ALIGN(16);
|
||||
.dynsym : { *(.dynsym) }
|
||||
_edata = .;
|
||||
|
||||
/* Unused sections */
|
||||
.dynstr : { *(.dynstr) }
|
||||
.hash : { *(.hash) }
|
||||
}
|
165
sys/boot/efi/loader/arch/arm64/start.S
Normal file
165
sys/boot/efi/loader/arch/arm64/start.S
Normal file
@ -0,0 +1,165 @@
|
||||
/*-
|
||||
* Copyright (c) 2014 Andrew Turner
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* We need to be a PE32+ file for EFI. On some architectures we can use
|
||||
* objcopy to create the correct file, however on arm64 we need to do
|
||||
* it ourselves.
|
||||
*/
|
||||
|
||||
#define IMAGE_FILE_MACHINE_ARM64 0xaa64
|
||||
|
||||
#define IMAGE_SCN_CNT_CODE 0x00000020
|
||||
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
|
||||
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
|
||||
#define IMAGE_SCN_MEM_EXECUTE 0x20000000
|
||||
#define IMAGE_SCN_MEM_READ 0x40000000
|
||||
|
||||
.section .peheader
|
||||
efi_start:
|
||||
/* The MS-DOS Stub, only used to get the offset of the COFF header */
|
||||
.ascii "MZ"
|
||||
.short 0
|
||||
.space 0x38
|
||||
.long pe_sig - efi_start
|
||||
|
||||
/* The PE32 Signature. Needs to be 8-byte aligned */
|
||||
.align 3
|
||||
pe_sig:
|
||||
.ascii "PE"
|
||||
.short 0
|
||||
coff_head:
|
||||
.short IMAGE_FILE_MACHINE_ARM64 /* AArch64 file */
|
||||
.short 2 /* 2 Sections */
|
||||
.long 0 /* Timestamp */
|
||||
.long 0 /* No symbol table */
|
||||
.long 0 /* No symbols */
|
||||
.short section_table - optional_header /* Optional header size */
|
||||
.short 0 /* Characteristics TODO: Fill in */
|
||||
|
||||
optional_header:
|
||||
.short 0x020b /* PE32+ (64-bit addressing) */
|
||||
.byte 0 /* Major linker version */
|
||||
.byte 0 /* Minor linker version */
|
||||
.long _edata - _end_header /* Code size */
|
||||
.long 0 /* No initialized data */
|
||||
.long 0 /* No uninitialized data */
|
||||
.long _start - efi_start /* Entry point */
|
||||
.long _end_header - efi_start /* Start of code */
|
||||
|
||||
optional_windows_header:
|
||||
.quad 0 /* Image base */
|
||||
.long 32 /* Section Alignment */
|
||||
.long 8 /* File alignment */
|
||||
.short 0 /* Major OS version */
|
||||
.short 0 /* Minor OS version */
|
||||
.short 0 /* Major image version */
|
||||
.short 0 /* Minor image version */
|
||||
.short 0 /* Major subsystem version */
|
||||
.short 0 /* Minor subsystem version */
|
||||
.long 0 /* Win32 version */
|
||||
.long _edata - efi_start /* Image size */
|
||||
.long _end_header - efi_start /* Header size */
|
||||
.long 0 /* Checksum */
|
||||
.short 0xa /* Subsystem (EFI app) */
|
||||
.short 0 /* DLL Characteristics */
|
||||
.quad 0 /* Stack reserve */
|
||||
.quad 0 /* Stack commit */
|
||||
.quad 0 /* Heap reserve */
|
||||
.quad 0 /* Heap commit */
|
||||
.long 0 /* Loader flags */
|
||||
.long 6 /* Number of RVAs */
|
||||
|
||||
/* RVAs: */
|
||||
.quad 0
|
||||
.quad 0
|
||||
.quad 0
|
||||
.quad 0
|
||||
.quad 0
|
||||
.quad 0
|
||||
|
||||
section_table:
|
||||
/* We need a .reloc section for EFI */
|
||||
.ascii ".reloc"
|
||||
.byte 0
|
||||
.byte 0 /* Pad to 8 bytes */
|
||||
.long 0 /* Virtual size */
|
||||
.long 0 /* Virtual address */
|
||||
.long 0 /* Size of raw data */
|
||||
.long 0 /* Pointer to raw data */
|
||||
.long 0 /* Pointer to relocations */
|
||||
.long 0 /* Pointer to line numbers */
|
||||
.short 0 /* Number of relocations */
|
||||
.short 0 /* Number of line numbers */
|
||||
.long (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | \
|
||||
IMAGE_SCN_MEM_DISCARDABLE) /* Characteristics */
|
||||
|
||||
/* The contents of the loader */
|
||||
.ascii ".text"
|
||||
.byte 0
|
||||
.byte 0
|
||||
.byte 0 /* Pad to 8 bytes */
|
||||
.long _edata - _end_header /* Virtual size */
|
||||
.long _end_header - efi_start /* Virtual address */
|
||||
.long _edata - _end_header /* Size of raw data */
|
||||
.long _end_header - efi_start /* Pointer to raw data */
|
||||
.long 0 /* Pointer to relocations */
|
||||
.long 0 /* Pointer to line numbers */
|
||||
.short 0 /* Number of relocations */
|
||||
.short 0 /* Number of line numbers */
|
||||
.long (IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | \
|
||||
IMAGE_SCN_MEM_READ) /* Characteristics */
|
||||
_end_header:
|
||||
|
||||
.text
|
||||
.globl _start
|
||||
_start:
|
||||
/* Save the boot params to the stack */
|
||||
stp x0, x1, [sp, #-16]!
|
||||
|
||||
adr x0, __bss_start
|
||||
adr x1, __bss_end
|
||||
|
||||
b 2f
|
||||
|
||||
1:
|
||||
stp xzr, xzr, [x0], #16
|
||||
2:
|
||||
cmp x0, x1
|
||||
b.lo 1b
|
||||
|
||||
adr x0, ImageBase
|
||||
adr x1, _DYNAMIC
|
||||
|
||||
bl _reloc
|
||||
|
||||
ldp x0, x1, [sp], #16
|
||||
|
||||
bl efi_main
|
||||
|
||||
1: b 1b
|
@ -61,8 +61,14 @@ efi_copy_init(void)
|
||||
}
|
||||
staging_end = staging + STAGE_PAGES * 4096;
|
||||
|
||||
#ifdef __arm__
|
||||
/* Round the kernel load address to a 2MiB value */
|
||||
#if defined(__aarch64__) || defined(__arm__)
|
||||
/*
|
||||
* Round the kernel load address to a 2MiB value. This is needed
|
||||
* because the kernel builds a page table based on where it has
|
||||
* been loaded in physical address space. As the kernel will use
|
||||
* either a 1MiB or 2MiB page for this we need to make sure it
|
||||
* is correctly aligned for both cases.
|
||||
*/
|
||||
staging = roundup2(staging, 2 * 1024 * 1024);
|
||||
#endif
|
||||
|
||||
|
@ -4264,8 +4264,10 @@ xpt_async(u_int32_t async_code, struct cam_path *path, void *async_arg)
|
||||
}
|
||||
memcpy(ccb->casync.async_arg_ptr, async_arg, size);
|
||||
ccb->casync.async_arg_size = size;
|
||||
} else if (size < 0)
|
||||
} else if (size < 0) {
|
||||
ccb->casync.async_arg_ptr = async_arg;
|
||||
ccb->casync.async_arg_size = size;
|
||||
}
|
||||
if (path->device != NULL && path->device->lun_id != CAM_LUN_WILDCARD)
|
||||
xpt_freeze_devq(path, 1);
|
||||
else
|
||||
|
@ -253,9 +253,8 @@ freebsd4_freebsd32_getfsstat(struct thread *td, struct freebsd4_freebsd32_getfss
|
||||
|
||||
count = uap->bufsize / sizeof(struct statfs32);
|
||||
size = count * sizeof(struct statfs);
|
||||
error = kern_getfsstat(td, &buf, size, UIO_SYSSPACE, uap->flags);
|
||||
error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->flags);
|
||||
if (size > 0) {
|
||||
count = td->td_retval[0];
|
||||
sp = buf;
|
||||
while (count > 0 && error == 0) {
|
||||
copy_statfs(sp, &stat32);
|
||||
@ -266,6 +265,8 @@ freebsd4_freebsd32_getfsstat(struct thread *td, struct freebsd4_freebsd32_getfss
|
||||
}
|
||||
free(buf, M_TEMP);
|
||||
}
|
||||
if (error == 0)
|
||||
td->td_retval[0] = count;
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
|
@ -53,10 +53,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/filedesc.h>
|
||||
#include <sys/jail.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/msg.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/namei.h>
|
||||
@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/sem.h>
|
||||
#include <sys/smp.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syscallsubr.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
@ -326,11 +327,12 @@ static int
|
||||
linprocfs_domtab(PFS_FILL_ARGS)
|
||||
{
|
||||
struct nameidata nd;
|
||||
struct mount *mp;
|
||||
const char *lep;
|
||||
char *dlep, *flep, *mntto, *mntfrom, *fstype;
|
||||
size_t lep_len;
|
||||
int error;
|
||||
struct statfs *buf, *sp;
|
||||
size_t count;
|
||||
|
||||
/* resolve symlinks etc. in the emulation tree prefix */
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
|
||||
@ -344,20 +346,26 @@ linprocfs_domtab(PFS_FILL_ARGS)
|
||||
}
|
||||
lep_len = strlen(lep);
|
||||
|
||||
mtx_lock(&mountlist_mtx);
|
||||
error = 0;
|
||||
TAILQ_FOREACH(mp, &mountlist, mnt_list) {
|
||||
buf = NULL;
|
||||
error = kern_getfsstat(td, &buf, SIZE_T_MAX, &count,
|
||||
UIO_SYSSPACE, MNT_WAIT);
|
||||
if (error != 0) {
|
||||
free(buf, M_TEMP);
|
||||
free(flep, M_TEMP);
|
||||
return (error);
|
||||
}
|
||||
|
||||
for (sp = buf; count > 0; sp++, count--) {
|
||||
/* determine device name */
|
||||
mntfrom = mp->mnt_stat.f_mntfromname;
|
||||
mntfrom = sp->f_mntfromname;
|
||||
|
||||
/* determine mount point */
|
||||
mntto = mp->mnt_stat.f_mntonname;
|
||||
if (strncmp(mntto, lep, lep_len) == 0 &&
|
||||
mntto[lep_len] == '/')
|
||||
mntto = sp->f_mntonname;
|
||||
if (strncmp(mntto, lep, lep_len) == 0 && mntto[lep_len] == '/')
|
||||
mntto += lep_len;
|
||||
|
||||
/* determine fs type */
|
||||
fstype = mp->mnt_stat.f_fstypename;
|
||||
fstype = sp->f_fstypename;
|
||||
if (strcmp(fstype, pn->pn_info->pi_name) == 0)
|
||||
mntfrom = fstype = "proc";
|
||||
else if (strcmp(fstype, "procfs") == 0)
|
||||
@ -365,16 +373,16 @@ linprocfs_domtab(PFS_FILL_ARGS)
|
||||
|
||||
if (strcmp(fstype, "linsysfs") == 0) {
|
||||
sbuf_printf(sb, "/sys %s sysfs %s", mntto,
|
||||
mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw");
|
||||
sp->f_flags & MNT_RDONLY ? "ro" : "rw");
|
||||
} else {
|
||||
/* For Linux msdosfs is called vfat */
|
||||
if (strcmp(fstype, "msdosfs") == 0)
|
||||
fstype = "vfat";
|
||||
sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype,
|
||||
mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw");
|
||||
sp->f_flags & MNT_RDONLY ? "ro" : "rw");
|
||||
}
|
||||
#define ADD_OPTION(opt, name) \
|
||||
if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name);
|
||||
if (sp->f_flags & (opt)) sbuf_printf(sb, "," name);
|
||||
ADD_OPTION(MNT_SYNCHRONOUS, "sync");
|
||||
ADD_OPTION(MNT_NOEXEC, "noexec");
|
||||
ADD_OPTION(MNT_NOSUID, "nosuid");
|
||||
@ -387,7 +395,8 @@ linprocfs_domtab(PFS_FILL_ARGS)
|
||||
/* a real Linux mtab will also show NFS options */
|
||||
sbuf_printf(sb, " 0 0\n");
|
||||
}
|
||||
mtx_unlock(&mountlist_mtx);
|
||||
|
||||
free(buf, M_TEMP);
|
||||
free(flep, M_TEMP);
|
||||
return (error);
|
||||
}
|
||||
|
@ -401,6 +401,13 @@ hdac_pin_patch(struct hdaa_widget *w)
|
||||
patch = "as=1 seq=15";
|
||||
break;
|
||||
}
|
||||
} else if (id == HDA_CODEC_ALC292 &&
|
||||
subid == LENOVO_X120BS_SUBVENDOR) {
|
||||
switch (nid) {
|
||||
case 21:
|
||||
patch = "as=1 seq=15";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (patch != NULL)
|
||||
|
@ -81,6 +81,8 @@ static const struct {
|
||||
{ HDA_INTEL_HSW1, "Intel Haswell", 0, 0 },
|
||||
{ HDA_INTEL_HSW2, "Intel Haswell", 0, 0 },
|
||||
{ HDA_INTEL_HSW3, "Intel Haswell", 0, 0 },
|
||||
{ HDA_INTEL_BDW1, "Intel Broadwell", 0, 0 },
|
||||
{ HDA_INTEL_BDW2, "Intel Broadwell", 0, 0 },
|
||||
{ HDA_INTEL_CPT, "Intel Cougar Point", 0, 0 },
|
||||
{ HDA_INTEL_PATSBURG,"Intel Patsburg", 0, 0 },
|
||||
{ HDA_INTEL_PPT1, "Intel Panther Point", 0, 0 },
|
||||
|
@ -46,6 +46,7 @@
|
||||
#define HDA_INTEL_HSW1 HDA_MODEL_CONSTRUCT(INTEL, 0x0a0c)
|
||||
#define HDA_INTEL_HSW2 HDA_MODEL_CONSTRUCT(INTEL, 0x0c0c)
|
||||
#define HDA_INTEL_HSW3 HDA_MODEL_CONSTRUCT(INTEL, 0x0d0c)
|
||||
#define HDA_INTEL_BDW1 HDA_MODEL_CONSTRUCT(INTEL, 0x160c)
|
||||
#define HDA_INTEL_CPT HDA_MODEL_CONSTRUCT(INTEL, 0x1c20)
|
||||
#define HDA_INTEL_PATSBURG HDA_MODEL_CONSTRUCT(INTEL, 0x1d20)
|
||||
#define HDA_INTEL_PPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x1e20)
|
||||
@ -67,6 +68,7 @@
|
||||
#define HDA_INTEL_WELLS2 HDA_MODEL_CONSTRUCT(INTEL, 0x8d21)
|
||||
#define HDA_INTEL_LPTLP1 HDA_MODEL_CONSTRUCT(INTEL, 0x9c20)
|
||||
#define HDA_INTEL_LPTLP2 HDA_MODEL_CONSTRUCT(INTEL, 0x9c21)
|
||||
#define HDA_INTEL_BDW2 HDA_MODEL_CONSTRUCT(INTEL, 0x9ca0)
|
||||
#define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff)
|
||||
|
||||
/* Nvidia */
|
||||
@ -235,6 +237,7 @@
|
||||
#define LENOVO_TCA55_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x1015)
|
||||
#define LENOVO_X1_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21e8)
|
||||
#define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9)
|
||||
#define LENOVO_X120BS_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x2227)
|
||||
#define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da)
|
||||
#define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac)
|
||||
#define LENOVO_T400_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2)
|
||||
@ -338,6 +341,7 @@
|
||||
#define HDA_CODEC_ALC273 HDA_CODEC_CONSTRUCT(REALTEK, 0x0273)
|
||||
#define HDA_CODEC_ALC275 HDA_CODEC_CONSTRUCT(REALTEK, 0x0275)
|
||||
#define HDA_CODEC_ALC276 HDA_CODEC_CONSTRUCT(REALTEK, 0x0276)
|
||||
#define HDA_CODEC_ALC292 HDA_CODEC_CONSTRUCT(REALTEK, 0x0292)
|
||||
#define HDA_CODEC_ALC660 HDA_CODEC_CONSTRUCT(REALTEK, 0x0660)
|
||||
#define HDA_CODEC_ALC662 HDA_CODEC_CONSTRUCT(REALTEK, 0x0662)
|
||||
#define HDA_CODEC_ALC663 HDA_CODEC_CONSTRUCT(REALTEK, 0x0663)
|
||||
@ -622,6 +626,7 @@
|
||||
#define HDA_CODEC_INTELCPT HDA_CODEC_CONSTRUCT(INTEL, 0x2805)
|
||||
#define HDA_CODEC_INTELPPT HDA_CODEC_CONSTRUCT(INTEL, 0x2806)
|
||||
#define HDA_CODEC_INTELHSW HDA_CODEC_CONSTRUCT(INTEL, 0x2807)
|
||||
#define HDA_CODEC_INTELBDW HDA_CODEC_CONSTRUCT(INTEL, 0x2808)
|
||||
#define HDA_CODEC_INTELCL HDA_CODEC_CONSTRUCT(INTEL, 0x29fb)
|
||||
#define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff)
|
||||
|
||||
|
@ -87,6 +87,7 @@ static const struct {
|
||||
{ HDA_CODEC_ALC273, 0, "Realtek ALC273" },
|
||||
{ HDA_CODEC_ALC275, 0, "Realtek ALC275" },
|
||||
{ HDA_CODEC_ALC276, 0, "Realtek ALC276" },
|
||||
{ HDA_CODEC_ALC292, 0, "Realtek ALC292" },
|
||||
{ HDA_CODEC_ALC660, 0, "Realtek ALC660-VD" },
|
||||
{ HDA_CODEC_ALC662, 0x0002, "Realtek ALC662 rev2" },
|
||||
{ HDA_CODEC_ALC662, 0, "Realtek ALC662" },
|
||||
@ -319,6 +320,7 @@ static const struct {
|
||||
{ HDA_CODEC_INTELCPT, 0, "Intel Cougar Point" },
|
||||
{ HDA_CODEC_INTELPPT, 0, "Intel Panther Point" },
|
||||
{ HDA_CODEC_INTELHSW, 0, "Intel Haswell" },
|
||||
{ HDA_CODEC_INTELBDW, 0, "Intel Broadwell" },
|
||||
{ HDA_CODEC_INTELCL, 0, "Intel Crestline" },
|
||||
{ HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" },
|
||||
{ HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" },
|
||||
|
@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$");
|
||||
static MALLOC_DEFINE(M_VTFONT, "vtfont", "vt font");
|
||||
|
||||
/* Some limits to prevent abnormal fonts from being loaded. */
|
||||
#define VTFONT_MAXMAPPINGS 8192
|
||||
#define VTFONT_MAXGLYPHSIZE 1048576
|
||||
#define VTFONT_MAXMAPPINGS 65536
|
||||
#define VTFONT_MAXGLYPHSIZE 2097152
|
||||
#define VTFONT_MAXDIMENSION 128
|
||||
|
||||
static uint16_t
|
||||
|
@ -675,7 +675,8 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp)
|
||||
* Initialize filesystem stat information in mount struct.
|
||||
*/
|
||||
MNT_ILOCK(mp);
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED;
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |
|
||||
MNTK_USES_BCACHE;
|
||||
MNT_IUNLOCK(mp);
|
||||
return (0);
|
||||
out:
|
||||
|
@ -337,6 +337,7 @@ fuse_vfsop_mount(struct mount *mp)
|
||||
MNT_ILOCK(mp);
|
||||
mp->mnt_data = data;
|
||||
mp->mnt_flag |= MNT_LOCAL;
|
||||
mp->mnt_kern_flag |= MNTK_USES_BCACHE;
|
||||
MNT_IUNLOCK(mp);
|
||||
/* We need this here as this slot is used by getnewvnode() */
|
||||
mp->mnt_stat.f_iosize = PAGE_SIZE;
|
||||
|
@ -759,6 +759,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
|
||||
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
|
||||
MNT_ILOCK(mp);
|
||||
mp->mnt_flag |= MNT_LOCAL;
|
||||
mp->mnt_kern_flag |= MNTK_USES_BCACHE;
|
||||
MNT_IUNLOCK(mp);
|
||||
|
||||
if (pmp->pm_flags & MSDOSFS_LARGEFS)
|
||||
|
@ -1391,6 +1391,7 @@ nandfs_mountfs(struct vnode *devvp, struct mount *mp)
|
||||
nmp->nm_ronly = ronly;
|
||||
MNT_ILOCK(mp);
|
||||
mp->mnt_flag |= MNT_LOCAL;
|
||||
mp->mnt_kern_flag |= MNTK_USES_BCACHE;
|
||||
MNT_IUNLOCK(mp);
|
||||
nmp->nm_nandfsdev = nandfsdev;
|
||||
/* Add our mountpoint */
|
||||
|
@ -1198,7 +1198,8 @@ nfs_mount(struct mount *mp)
|
||||
out:
|
||||
if (!error) {
|
||||
MNT_ILOCK(mp);
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF;
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF |
|
||||
MNTK_USES_BCACHE;
|
||||
MNT_IUNLOCK(mp);
|
||||
}
|
||||
return (error);
|
||||
|
@ -1270,8 +1270,11 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred,
|
||||
* file is done. At this time VOP_FSYNC does not accept offset and
|
||||
* byte count parameters so call VOP_FSYNC the whole file for now.
|
||||
* The same is true for NFSv4: RFC 3530 Sec. 14.2.3.
|
||||
* File systems that do not use the buffer cache (as indicated
|
||||
* by MNTK_USES_BCACHE not being set) must use VOP_FSYNC().
|
||||
*/
|
||||
if (cnt == 0 || cnt > MAX_COMMIT_COUNT) {
|
||||
if (cnt == 0 || cnt > MAX_COMMIT_COUNT ||
|
||||
(vp->v_mount->mnt_kern_flag & MNTK_USES_BCACHE) == 0) {
|
||||
/*
|
||||
* Give up and do the whole thing
|
||||
*/
|
||||
|
@ -199,7 +199,7 @@ nullfs_mount(struct mount *mp)
|
||||
}
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT;
|
||||
mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag &
|
||||
MNTK_SUSPENDABLE;
|
||||
(MNTK_SUSPENDABLE | MNTK_USES_BCACHE);
|
||||
MNT_IUNLOCK(mp);
|
||||
mp->mnt_data = xmp;
|
||||
vfs_getnewfsid(mp);
|
||||
|
@ -782,6 +782,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
if (__elfN(nxstack))
|
||||
imgp->stack_prot =
|
||||
__elfN(trans_prot)(phdr[i].p_flags);
|
||||
imgp->stack_sz = phdr[i].p_memsz;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1009,6 +1009,7 @@ exec_new_vmspace(imgp, sv)
|
||||
struct proc *p = imgp->proc;
|
||||
struct vmspace *vmspace = p->p_vmspace;
|
||||
vm_object_t obj;
|
||||
struct rlimit rlim_stack;
|
||||
vm_offset_t sv_minuser, stack_addr;
|
||||
vm_map_t map;
|
||||
u_long ssiz;
|
||||
@ -1058,10 +1059,22 @@ exec_new_vmspace(imgp, sv)
|
||||
}
|
||||
|
||||
/* Allocate a new stack */
|
||||
if (sv->sv_maxssiz != NULL)
|
||||
if (imgp->stack_sz != 0) {
|
||||
ssiz = imgp->stack_sz;
|
||||
PROC_LOCK(p);
|
||||
lim_rlimit(p, RLIMIT_STACK, &rlim_stack);
|
||||
PROC_UNLOCK(p);
|
||||
if (ssiz > rlim_stack.rlim_max)
|
||||
ssiz = rlim_stack.rlim_max;
|
||||
if (ssiz > rlim_stack.rlim_cur) {
|
||||
rlim_stack.rlim_cur = ssiz;
|
||||
kern_setrlimit(curthread, RLIMIT_STACK, &rlim_stack);
|
||||
}
|
||||
} else if (sv->sv_maxssiz != NULL) {
|
||||
ssiz = *sv->sv_maxssiz;
|
||||
else
|
||||
} else {
|
||||
ssiz = maxssiz;
|
||||
}
|
||||
stack_addr = sv->sv_usrstack - ssiz;
|
||||
error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz,
|
||||
obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot :
|
||||
|
@ -367,6 +367,9 @@ netisr_pollmore()
|
||||
struct timeval t;
|
||||
int kern_load;
|
||||
|
||||
if (poll_handlers == 0)
|
||||
return;
|
||||
|
||||
mtx_lock(&poll_mtx);
|
||||
if (!netisr_pollmore_scheduled) {
|
||||
mtx_unlock(&poll_mtx);
|
||||
@ -424,6 +427,9 @@ netisr_poll(void)
|
||||
int i, cycles;
|
||||
enum poll_cmd arg = POLL_ONLY;
|
||||
|
||||
if (poll_handlers == 0)
|
||||
return;
|
||||
|
||||
mtx_lock(&poll_mtx);
|
||||
if (!netisr_poll_scheduled) {
|
||||
mtx_unlock(&poll_mtx);
|
||||
|
@ -745,7 +745,12 @@ kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which,
|
||||
if (newlim != NULL)
|
||||
lim_free(oldlim);
|
||||
|
||||
if (which == RLIMIT_STACK) {
|
||||
if (which == RLIMIT_STACK &&
|
||||
/*
|
||||
* Skip calls from exec_new_vmspace(), done when stack is
|
||||
* not mapped yet.
|
||||
*/
|
||||
(td != curthread || (p->p_flag & P_INEXEC) == 0)) {
|
||||
/*
|
||||
* Stack is allocated to the max at exec time with only
|
||||
* "rlim_cur" bytes accessible. If stack limit is going
|
||||
|
@ -591,6 +591,8 @@ callout_cc_add(struct callout *c, struct callout_cpu *cc,
|
||||
c->c_iflags |= CALLOUT_PENDING;
|
||||
c->c_iflags &= ~CALLOUT_PROCESSED;
|
||||
c->c_flags |= CALLOUT_ACTIVE;
|
||||
if (flags & C_DIRECT_EXEC)
|
||||
c->c_iflags |= CALLOUT_DIRECT;
|
||||
c->c_func = func;
|
||||
c->c_time = sbt;
|
||||
c->c_precision = precision;
|
||||
|
@ -2112,6 +2112,16 @@ device_probe_child(device_t dev, device_t child)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Probes that return BUS_PROBE_NOWILDCARD or lower
|
||||
* only match on devices whose driver was explicitly
|
||||
* specified.
|
||||
*/
|
||||
if (result <= BUS_PROBE_NOWILDCARD &&
|
||||
!(child->flags & DF_FIXEDCLASS)) {
|
||||
result = ENXIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* The driver returned an error so it
|
||||
* certainly doesn't match.
|
||||
@ -2127,14 +2137,6 @@ device_probe_child(device_t dev, device_t child)
|
||||
* of pri for the first match.
|
||||
*/
|
||||
if (best == NULL || result > pri) {
|
||||
/*
|
||||
* Probes that return BUS_PROBE_NOWILDCARD
|
||||
* or lower only match on devices whose
|
||||
* driver was explicitly specified.
|
||||
*/
|
||||
if (result <= BUS_PROBE_NOWILDCARD &&
|
||||
!(child->flags & DF_FIXEDCLASS))
|
||||
continue;
|
||||
best = dl;
|
||||
pri = result;
|
||||
continue;
|
||||
|
@ -3147,6 +3147,7 @@ DB_SHOW_COMMAND(mount, db_show_mount)
|
||||
MNT_KERN_FLAG(MNTK_VGONE_WAITER);
|
||||
MNT_KERN_FLAG(MNTK_LOOKUP_EXCL_DOTDOT);
|
||||
MNT_KERN_FLAG(MNTK_MARKER);
|
||||
MNT_KERN_FLAG(MNTK_USES_BCACHE);
|
||||
MNT_KERN_FLAG(MNTK_NOASYNC);
|
||||
MNT_KERN_FLAG(MNTK_UNMOUNT);
|
||||
MNT_KERN_FLAG(MNTK_MWAIT);
|
||||
|
@ -434,9 +434,14 @@ sys_getfsstat(td, uap)
|
||||
int flags;
|
||||
} */ *uap;
|
||||
{
|
||||
size_t count;
|
||||
int error;
|
||||
|
||||
return (kern_getfsstat(td, &uap->buf, uap->bufsize, UIO_USERSPACE,
|
||||
uap->flags));
|
||||
error = kern_getfsstat(td, &uap->buf, uap->bufsize, &count,
|
||||
UIO_USERSPACE, uap->flags);
|
||||
if (error == 0)
|
||||
td->td_retval[0] = count;
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -446,7 +451,7 @@ sys_getfsstat(td, uap)
|
||||
*/
|
||||
int
|
||||
kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
|
||||
enum uio_seg bufseg, int flags)
|
||||
size_t *countp, enum uio_seg bufseg, int flags)
|
||||
{
|
||||
struct mount *mp, *nmp;
|
||||
struct statfs *sfsp, *sp, sb;
|
||||
@ -533,9 +538,9 @@ kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
|
||||
}
|
||||
mtx_unlock(&mountlist_mtx);
|
||||
if (sfsp && count > maxcount)
|
||||
td->td_retval[0] = maxcount;
|
||||
*countp = maxcount;
|
||||
else
|
||||
td->td_retval[0] = count;
|
||||
*countp = count;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -624,9 +629,9 @@ freebsd4_getfsstat(td, uap)
|
||||
|
||||
count = uap->bufsize / sizeof(struct ostatfs);
|
||||
size = count * sizeof(struct statfs);
|
||||
error = kern_getfsstat(td, &buf, size, UIO_SYSSPACE, uap->flags);
|
||||
error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE,
|
||||
uap->flags);
|
||||
if (size > 0) {
|
||||
count = td->td_retval[0];
|
||||
sp = buf;
|
||||
while (count > 0 && error == 0) {
|
||||
cvtstatfs(sp, &osb);
|
||||
@ -637,6 +642,8 @@ freebsd4_getfsstat(td, uap)
|
||||
}
|
||||
free(buf, M_TEMP);
|
||||
}
|
||||
if (error == 0)
|
||||
td->td_retval[0] = count;
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -243,10 +243,10 @@
|
||||
|
||||
#define IFT_STF 0xd7 /* 6to4 interface */
|
||||
|
||||
/* not based on IANA assignments */
|
||||
#define IFT_GIF 0xf0
|
||||
#define IFT_PVC 0xf1
|
||||
#define IFT_ENC 0xf4
|
||||
#define IFT_PFLOG 0xf6
|
||||
#define IFT_PFSYNC 0xf7
|
||||
/* FreeBSD specific, not based on IANA assignments */
|
||||
#define IFT_GIF 0xf0 /* Generic tunnel interface */
|
||||
#define IFT_PVC 0xf1 /* Unused */
|
||||
#define IFT_ENC 0xf4 /* Encapsulating interface */
|
||||
#define IFT_PFLOG 0xf6 /* PF packet filter logging */
|
||||
#define IFT_PFSYNC 0xf7 /* PF packet filter synchronization */
|
||||
#endif /* !_NET_IF_TYPES_H_ */
|
||||
|
@ -192,21 +192,20 @@ extern struct rwlock pf_rules_lock;
|
||||
|
||||
#define PF_AEQ(a, b, c) \
|
||||
((c == AF_INET && (a)->addr32[0] == (b)->addr32[0]) || \
|
||||
((a)->addr32[3] == (b)->addr32[3] && \
|
||||
(c == AF_INET6 && (a)->addr32[3] == (b)->addr32[3] && \
|
||||
(a)->addr32[2] == (b)->addr32[2] && \
|
||||
(a)->addr32[1] == (b)->addr32[1] && \
|
||||
(a)->addr32[0] == (b)->addr32[0])) \
|
||||
|
||||
#define PF_ANEQ(a, b, c) \
|
||||
((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \
|
||||
((a)->addr32[3] != (b)->addr32[3] || \
|
||||
(a)->addr32[2] != (b)->addr32[2] || \
|
||||
((a)->addr32[0] != (b)->addr32[0] || \
|
||||
(a)->addr32[1] != (b)->addr32[1] || \
|
||||
(a)->addr32[0] != (b)->addr32[0])) \
|
||||
(a)->addr32[2] != (b)->addr32[2] || \
|
||||
(a)->addr32[3] != (b)->addr32[3]) \
|
||||
|
||||
#define PF_AZERO(a, c) \
|
||||
((c == AF_INET && !(a)->addr32[0]) || \
|
||||
(!(a)->addr32[0] && !(a)->addr32[1] && \
|
||||
(c == AF_INET6 && !(a)->addr32[0] && !(a)->addr32[1] && \
|
||||
!(a)->addr32[2] && !(a)->addr32[3] )) \
|
||||
|
||||
#define PF_MATCHA(n, a, m, b, f) \
|
||||
|
@ -43,7 +43,6 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <net/rss_config.h>
|
||||
#include <net/netisr.h>
|
||||
#include <net/vnet.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
@ -6070,7 +6070,7 @@ pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp)
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
|
||||
if (ifp != m->m_pkthdr.rcvif)
|
||||
if (dir == PF_OUT && m->m_pkthdr.rcvif && ifp != m->m_pkthdr.rcvif)
|
||||
fwdir = PF_FWD;
|
||||
|
||||
if (!V_pf_status.running)
|
||||
|
@ -1643,7 +1643,7 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff,
|
||||
goto tcp_drop;
|
||||
|
||||
if (flags & TH_FIN)
|
||||
flags &= ~TH_FIN;
|
||||
goto tcp_drop;
|
||||
} else {
|
||||
/* Illegal packet */
|
||||
if (!(flags & (TH_ACK|TH_RST)))
|
||||
|
@ -80,6 +80,7 @@ struct image_params {
|
||||
unsigned long pagesizes;
|
||||
int pagesizeslen;
|
||||
vm_prot_t stack_prot;
|
||||
u_long stack_sz;
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user