1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

MFhead @ r275302

This commit is contained in:
Enji Cooper 2014-11-30 06:48:37 +00:00
commit 162789296e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/building-blocks/; revision=275303
23 changed files with 244 additions and 203 deletions

View File

@ -84,6 +84,7 @@ enum option_values
OPTION_NO_KEEP_MEMORY,
OPTION_NO_WARN_MISMATCH,
OPTION_NO_WARN_SEARCH_MISMATCH,
OPTION_NO_WARN_FATAL,
OPTION_NOINHIBIT_EXEC,
OPTION_NON_SHARED,
OPTION_NO_WHOLE_ARCHIVE,
@ -375,6 +376,9 @@ static const struct ld_option ld_options[] =
{ {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL},
'\0', NULL, N_("Treat warnings as errors"),
TWO_DASHES },
{ {"no-fatal-warnings", no_argument, NULL, OPTION_NO_WARN_FATAL},
'\0', NULL, N_("Don't treat warnings as errors"),
TWO_DASHES },
{ {"fini", required_argument, NULL, OPTION_FINI},
'\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH },
{ {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX},
@ -568,6 +572,7 @@ parse_args (unsigned argc, char **argv)
struct option *really_longopts;
int last_optind;
enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
int no_fatal_warnings = FALSE;
shortopts = xmalloc (OPTION_COUNT * 3 + 2);
longopts = xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
@ -1317,6 +1322,9 @@ parse_args (unsigned argc, char **argv)
case OPTION_WARN_FATAL:
config.fatal_warnings = TRUE;
break;
case OPTION_NO_WARN_FATAL:
no_fatal_warnings = TRUE;
break;
case OPTION_WARN_MULTIPLE_GP:
config.warn_multiple_gp = TRUE;
break;
@ -1438,6 +1446,8 @@ parse_args (unsigned argc, char **argv)
break;
}
}
if (no_fatal_warnings)
config.fatal_warnings = FALSE;
if (ingroup)
lang_leave_group ();

View File

@ -32,6 +32,8 @@
__FBSDID("$FreeBSD$");
.syntax unified
/*
* ffs - find first set bit, this algorithm isolates the first set
* bit, then multiplies the number by 0x0450fbaf which leaves the top
@ -60,7 +62,7 @@ ENTRY(ffs)
rsbne r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */
/* now lookup in table indexed on top 6 bits of r0 */
ldrneb r0, [ r2, r0, lsr #26 ]
ldrbne r0, [ r2, r0, lsr #26 ]
RET
.text;

View File

@ -66,6 +66,8 @@
__FBSDID("$FreeBSD$");
.syntax unified
ENTRY(memcmp)
mov ip, r0
#if defined(_KERNEL) && !defined(_STANDALONE)
@ -76,7 +78,7 @@ ENTRY(memcmp)
/* Are both addresses aligned the same way? */
cmp r2, #0x00
eornes r3, ip, r1
eorsne r3, ip, r1
RETeq /* len == 0, or same addresses! */
tst r3, #0x03
subne r2, r2, #0x01

View File

@ -31,6 +31,9 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
.syntax unified
/*
* This is one fun bit of code ...
* Some easy listening music is suggested while trying to understand this
@ -91,8 +94,8 @@ ENTRY(memcpy)
bge .Lmemcpy_loop32
cmn r2, #0x10
ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmgeia r0!, {r3, r4, r12, lr}
ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmiage r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
ldmia sp!, {r4} /* return r4 */
@ -101,9 +104,9 @@ ENTRY(memcpy)
/* blat 12 bytes at a time */
.Lmemcpy_loop12:
ldmgeia r1!, {r3, r12, lr}
stmgeia r0!, {r3, r12, lr}
subges r2, r2, #0x0c
ldmiage r1!, {r3, r12, lr}
stmiage r0!, {r3, r12, lr}
subsge r2, r2, #0x0c
bge .Lmemcpy_loop12
.Lmemcpy_l12:
@ -113,26 +116,26 @@ ENTRY(memcpy)
subs r2, r2, #4
ldrlt r3, [r1], #4
strlt r3, [r0], #4
ldmgeia r1!, {r3, r12}
stmgeia r0!, {r3, r12}
ldmiage r1!, {r3, r12}
stmiage r0!, {r3, r12}
subge r2, r2, #4
.Lmemcpy_l4:
/* less than 4 bytes to go */
adds r2, r2, #4
#ifdef __APCS_26_
ldmeqia sp!, {r0, pc}^ /* done */
ldmiaeq sp!, {r0, pc}^ /* done */
#else
ldmeqia sp!, {r0, pc} /* done */
ldmiaeq sp!, {r0, pc} /* done */
#endif
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1], #1
strb r3, [r0], #1
ldrgeb r3, [r1], #1
strgeb r3, [r0], #1
ldrgtb r3, [r1], #1
strgtb r3, [r0], #1
ldrbge r3, [r1], #1
strbge r3, [r0], #1
ldrbgt r3, [r1], #1
strbgt r3, [r0], #1
ldmia sp!, {r0, pc}
/* erg - unaligned destination */
@ -143,10 +146,10 @@ ENTRY(memcpy)
/* align destination with byte copies */
ldrb r3, [r1], #1
strb r3, [r0], #1
ldrgeb r3, [r1], #1
strgeb r3, [r0], #1
ldrgtb r3, [r1], #1
strgtb r3, [r0], #1
ldrbge r3, [r1], #1
strbge r3, [r0], #1
ldrbgt r3, [r1], #1
strbgt r3, [r0], #1
subs r2, r2, r12
blt .Lmemcpy_l4 /* less the 4 bytes */

View File

@ -38,6 +38,8 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
.syntax unified
/* LINTSTUB: Func: void *memcpy(void *dst, const void *src, size_t len) */
ENTRY(memcpy)
pld [r1]
@ -52,12 +54,12 @@ ENTRY(memcpy)
ldrb ip, [r1], #0x01
sub r2, r2, #0x01
strb ip, [r3], #0x01
ldrleb ip, [r1], #0x01
ldrble ip, [r1], #0x01
suble r2, r2, #0x01
strleb ip, [r3], #0x01
ldrltb ip, [r1], #0x01
strble ip, [r3], #0x01
ldrblt ip, [r1], #0x01
sublt r2, r2, #0x01
strltb ip, [r3], #0x01
strblt ip, [r3], #0x01
/* Destination buffer is now word aligned */
.Lmemcpy_wordaligned:
@ -134,7 +136,7 @@ ENTRY(memcpy)
.Lmemcpy_w_lessthan128:
adds r2, r2, #0x80 /* Adjust for extra sub */
ldmeqfd sp!, {r4-r9}
ldmfdeq sp!, {r4-r9}
bxeq lr /* Return now if done */
subs r2, r2, #0x20
blt .Lmemcpy_w_lessthan32
@ -159,7 +161,7 @@ ENTRY(memcpy)
.Lmemcpy_w_lessthan32:
adds r2, r2, #0x20 /* Adjust for extra sub */
ldmeqfd sp!, {r4-r9}
ldmfdeq sp!, {r4-r9}
bxeq lr /* Return now if done */
and r4, r2, #0x18
@ -195,11 +197,11 @@ ENTRY(memcpy)
addlt r2, r2, #0x04
ldrb ip, [r1], #0x01
cmp r2, #0x02
ldrgeb r2, [r1], #0x01
ldrbge r2, [r1], #0x01
strb ip, [r3], #0x01
ldrgtb ip, [r1]
strgeb r2, [r3], #0x01
strgtb ip, [r3]
ldrbgt ip, [r1]
strbge r2, [r3], #0x01
strbgt ip, [r3]
bx lr
@ -253,7 +255,7 @@ ENTRY(memcpy)
bge .Lmemcpy_bad1_loop16
adds r2, r2, #0x10
ldmeqfd sp!, {r4-r7}
ldmfdeq sp!, {r4-r7}
bxeq lr /* Return now if done */
subs r2, r2, #0x04
sublt r1, r1, #0x03
@ -314,7 +316,7 @@ ENTRY(memcpy)
bge .Lmemcpy_bad2_loop16
adds r2, r2, #0x10
ldmeqfd sp!, {r4-r7}
ldmfdeq sp!, {r4-r7}
bxeq lr /* Return now if done */
subs r2, r2, #0x04
sublt r1, r1, #0x02
@ -375,7 +377,7 @@ ENTRY(memcpy)
bge .Lmemcpy_bad3_loop16
adds r2, r2, #0x10
ldmeqfd sp!, {r4-r7}
ldmfdeq sp!, {r4-r7}
bxeq lr /* Return now if done */
subs r2, r2, #0x04
sublt r1, r1, #0x01
@ -404,11 +406,11 @@ ENTRY(memcpy)
bxeq lr
ldrb ip, [r1], #0x01
cmp r2, #0x02
ldrgeb r2, [r1], #0x01
ldrbge r2, [r1], #0x01
strb ip, [r3], #0x01
ldrgtb ip, [r1]
strgeb r2, [r3], #0x01
strgtb ip, [r3]
ldrbgt ip, [r1]
strbge r2, [r3], #0x01
strbgt ip, [r3]
bx lr
@ -440,7 +442,7 @@ ENTRY(memcpy)
ldrb ip, [r1], #0x01
1: subs r2, r2, #0x01
strb ip, [r3], #0x01
ldrneb ip, [r1], #0x01
ldrbne ip, [r1], #0x01
bne 1b
bx lr

View File

@ -32,6 +32,8 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
.syntax unified
#ifndef _BCOPY
/* LINTSTUB: Func: void *memmove(void *, const void *, size_t) */
ENTRY(memmove)
@ -86,8 +88,8 @@ ENTRY(bcopy)
bge .Lmemmove_floop32
cmn r2, #0x10
ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmgeia r0!, {r3, r4, r12, lr}
ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmiage r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
ldmia sp!, {r4} /* return r4 */
@ -96,9 +98,9 @@ ENTRY(bcopy)
/* blat 12 bytes at a time */
.Lmemmove_floop12:
ldmgeia r1!, {r3, r12, lr}
stmgeia r0!, {r3, r12, lr}
subges r2, r2, #0x0c
ldmiage r1!, {r3, r12, lr}
stmiage r0!, {r3, r12, lr}
subsge r2, r2, #0x0c
bge .Lmemmove_floop12
.Lmemmove_fl12:
@ -108,23 +110,23 @@ ENTRY(bcopy)
subs r2, r2, #4
ldrlt r3, [r1], #4
strlt r3, [r0], #4
ldmgeia r1!, {r3, r12}
stmgeia r0!, {r3, r12}
ldmiage r1!, {r3, r12}
stmiage r0!, {r3, r12}
subge r2, r2, #4
.Lmemmove_fl4:
/* less than 4 bytes to go */
adds r2, r2, #4
ldmeqia sp!, {r0, pc} /* done */
ldmiaeq sp!, {r0, pc} /* done */
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1], #1
strb r3, [r0], #1
ldrgeb r3, [r1], #1
strgeb r3, [r0], #1
ldrgtb r3, [r1], #1
strgtb r3, [r0], #1
ldrbge r3, [r1], #1
strbge r3, [r0], #1
ldrbgt r3, [r1], #1
strbgt r3, [r0], #1
ldmia sp!, {r0, pc}
/* erg - unaligned destination */
@ -135,10 +137,10 @@ ENTRY(bcopy)
/* align destination with byte copies */
ldrb r3, [r1], #1
strb r3, [r0], #1
ldrgeb r3, [r1], #1
strgeb r3, [r0], #1
ldrgtb r3, [r1], #1
strgtb r3, [r0], #1
ldrbge r3, [r1], #1
strbge r3, [r0], #1
ldrbgt r3, [r1], #1
strbgt r3, [r0], #1
subs r2, r2, r12
blt .Lmemmove_fl4 /* less the 4 bytes */
@ -353,12 +355,12 @@ ENTRY(bcopy)
.Lmemmove_bl32:
cmn r2, #0x10
ldmgedb r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmgedb r0!, {r3, r4, r12, lr}
ldmdbge r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
stmdbge r0!, {r3, r4, r12, lr}
subge r2, r2, #0x10
adds r2, r2, #0x14
ldmgedb r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
stmgedb r0!, {r3, r12, lr}
ldmdbge r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
stmdbge r0!, {r3, r12, lr}
subge r2, r2, #0x0c
ldmia sp!, {r4, lr}
@ -368,8 +370,8 @@ ENTRY(bcopy)
subs r2, r2, #4
ldrlt r3, [r1, #-4]!
strlt r3, [r0, #-4]!
ldmgedb r1!, {r3, r12}
stmgedb r0!, {r3, r12}
ldmdbge r1!, {r3, r12}
stmdbge r0!, {r3, r12}
subge r2, r2, #4
.Lmemmove_bl4:
@ -381,10 +383,10 @@ ENTRY(bcopy)
cmp r2, #2
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
ldrgeb r3, [r1, #-1]!
strgeb r3, [r0, #-1]!
ldrgtb r3, [r1, #-1]!
strgtb r3, [r0, #-1]!
ldrbge r3, [r1, #-1]!
strbge r3, [r0, #-1]!
ldrbgt r3, [r1, #-1]!
strbgt r3, [r0, #-1]!
RET
/* erg - unaligned destination */
@ -394,10 +396,10 @@ ENTRY(bcopy)
/* align destination with byte copies */
ldrb r3, [r1, #-1]!
strb r3, [r0, #-1]!
ldrgeb r3, [r1, #-1]!
strgeb r3, [r0, #-1]!
ldrgtb r3, [r1, #-1]!
strgtb r3, [r0, #-1]!
ldrbge r3, [r1, #-1]!
strbge r3, [r0, #-1]!
ldrbgt r3, [r1, #-1]!
strbgt r3, [r0, #-1]!
subs r2, r2, r12
blt .Lmemmove_bl4 /* less than 4 bytes to go */
ands r12, r1, #3

View File

@ -69,6 +69,8 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
.syntax unified
/*
* memset: Sets a block of memory to the specified value
*
@ -125,39 +127,39 @@ ENTRY(memset)
.Lmemset_loop128:
subs r1, r1, #0x80
#ifdef _ARM_ARCH_5E
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
#else
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
#endif
bgt .Lmemset_loop128
RETeq /* Zero length so just exit */
@ -168,15 +170,15 @@ ENTRY(memset)
.Lmemset_loop32:
subs r1, r1, #0x20
#ifdef _ARM_ARCH_5E
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
#else
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
#endif
bgt .Lmemset_loop32
RETeq /* Zero length so just exit */
@ -185,11 +187,11 @@ ENTRY(memset)
/* Deal with 16 bytes or more */
#ifdef _ARM_ARCH_5E
strged r2, [ip], #0x08
strged r2, [ip], #0x08
strdge r2, [ip], #0x08
strdge r2, [ip], #0x08
#else
stmgeia ip!, {r2-r3}
stmgeia ip!, {r2-r3}
stmiage ip!, {r2-r3}
stmiage ip!, {r2-r3}
#endif
RETeq /* Zero length so just exit */
@ -212,17 +214,17 @@ ENTRY(memset)
#endif
strb r3, [ip], #0x01 /* Set 1 byte */
strgeb r3, [ip], #0x01 /* Set another byte */
strgtb r3, [ip] /* and a third */
strbge r3, [ip], #0x01 /* Set another byte */
strbgt r3, [ip] /* and a third */
RET /* Exit */
.Lmemset_wordunaligned:
rsb r2, r2, #0x004
strb r3, [ip], #0x01 /* Set 1 byte */
cmp r2, #0x02
strgeb r3, [ip], #0x01 /* Set another byte */
strbge r3, [ip], #0x01 /* Set another byte */
sub r1, r1, r2
strgtb r3, [ip], #0x01 /* and a third */
strbgt r3, [ip], #0x01 /* and a third */
cmp r1, #0x04 /* More than 4 bytes left? */
bge .Lmemset_wordaligned /* Yup */
@ -231,8 +233,8 @@ ENTRY(memset)
RETeq /* Zero length so exit */
strb r3, [ip], #0x01 /* Set 1 byte */
cmp r1, #0x02
strgeb r3, [ip], #0x01 /* Set another byte */
strgtb r3, [ip] /* and a third */
strbge r3, [ip], #0x01 /* Set another byte */
strbgt r3, [ip] /* and a third */
RET /* Exit */
#ifdef _BZERO
END(bzero)

View File

@ -27,6 +27,8 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
.syntax unified
ENTRY(strlen)
mov r1, #0
/* Check that the pointer is aligned on 32 bits. */
@ -53,23 +55,23 @@ ENTRY(strlen)
addne r1, r1, #1
.Ldo_3:
#ifndef __ARMEB__
andnes r3, r2, #0x0000ff00
andsne r3, r2, #0x0000ff00
#else
andnes r3, r2, #0x00ff0000
andsne r3, r2, #0x00ff0000
#endif
addne r1, r1, #1
.Ldo_2:
#ifndef __ARMEB__
andnes r3, r2, #0x00ff0000
andsne r3, r2, #0x00ff0000
#else
andnes r3, r2, #0x0000ff00
andsne r3, r2, #0x0000ff00
#endif
addne r1, r1, #1
.Ldo_1:
#ifndef __ARMEB__
andnes r3, r2, #0xff000000
andsne r3, r2, #0xff000000
#else
andnes r3, r2, #0x000000ff
andsne r3, r2, #0x000000ff
#endif
addne r1, r1, #1
bne .Loop

View File

@ -1,7 +1,7 @@
.\" $FreeBSD$
.\" Based on PR#2411
.\"
.Dd November 4, 2014
.Dd November 30, 2014
.Dt TAP 4
.Os
.Sh NAME
@ -34,6 +34,17 @@ or a terminal for
and a character-special device
.Dq control
interface.
A client program transfers Ethernet frames to or from the
.Nm
.Dq control
interface.
The
.Xr tun 4
interface provides similar functionality at the network layer:
a client will transfer IP (by default) packets to or from a
.Xr tun 4
.Dq control
interface.
.Pp
The network interfaces are named
.Dq Li tap0 ,
@ -314,4 +325,5 @@ VMware
.El
.Sh SEE ALSO
.Xr inet 4 ,
.Xr intro 4
.Xr intro 4 ,
.Xr tun 4

View File

@ -2,7 +2,7 @@
.\" $FreeBSD$
.\" Based on PR#2411
.\"
.Dd February 4, 2007
.Dd November 30, 2014
.Dt TUN 4
.Os
.Sh NAME
@ -35,6 +35,17 @@ or a terminal for
and a character-special device
.Dq control
interface.
A client program transfers IP (by default) packets to or from the
.Nm
.Dq control
interface.
The
.Xr tap 4
interface provides similar functionality at the Ethernet layer:
a client will transfer Ethernet frames to or from a
.Xr tap 4
.Dq control
interface.
.Pp
The network interfaces are named
.Dq Li tun0 ,
@ -307,6 +318,7 @@ them pile up.
.Xr inet 4 ,
.Xr intro 4 ,
.Xr pty 4 ,
.Xr tap 4 ,
.Xr ifconfig 8
.Sh AUTHORS
This manual page was originally obtained from

View File

@ -57,19 +57,6 @@
#define _FNEND
#endif
/*
* gas/arm uses @ as a single comment character and thus cannot be used here
* Instead it recognised the # instead of an @ symbols in .type directives
* We define a couple of macros so that assembly code will not be dependent
* on one or the other.
*/
#define _ASM_TYPE_FUNCTION #function
#define _ASM_TYPE_OBJECT #object
#define GLOBAL(X) .globl x
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: _FNSTART
#define _END(x) .size x, . - x; _FNEND
/*
* EENTRY()/EEND() mark "extra" entry/exit points from a function.
* The unwind info cannot handle the concept of a nested function, or a function
@ -79,8 +66,21 @@
* basically just a label that you can jump to. The EEND() macro does nothing
* at all, except document the exit point associated with the same-named entry.
*/
#define _EENTRY(x) .globl x; .type x,_ASM_TYPE_FUNCTION; x:
#define _EEND(x) /* nothing */
#define _EENTRY(x) .globl x; .type x,_ASM_TYPE_FUNCTION; x:
#define _EEND(x) /* nothing */
/*
* gas/arm uses @ as a single comment character and thus cannot be used here
* Instead it recognised the # instead of an @ symbols in .type directives
* We define a couple of macros so that assembly code will not be dependent
* on one or the other.
*/
#define _ASM_TYPE_FUNCTION #function
#define _ASM_TYPE_OBJECT #object
#define GLOBAL(X) .globl x
#define _ENTRY(x) \
.text; _ALIGN_TEXT; _EENTRY(x) _FNSTART
#define _END(x) .size x, . - x; _FNEND
#ifdef GPROF
# define _PROF_PROLOGUE \

View File

@ -938,7 +938,7 @@ moduledir_readhints(struct moduledir *mdp)
path = moduledir_fullpath(mdp, "linker.hints");
if (stat(path, &st) != 0 ||
st.st_size < (ssize_t)(sizeof(version) + sizeof(int)) ||
st.st_size > 100 * 1024 || (fd = open(path, O_RDONLY)) < 0) {
st.st_size > LINKER_HINTS_MAX || (fd = open(path, O_RDONLY)) < 0) {
free(path);
mdp->d_flags |= MDIR_NOHINTS;
return;

View File

@ -501,6 +501,7 @@ dskread(void *buf, unsigned lba, unsigned nblk)
char *sec;
unsigned i;
uint8_t sl;
const char *reason;
if (!dsk_meta) {
sec = dmadat->secbuf;
@ -525,8 +526,8 @@ dskread(void *buf, unsigned lba, unsigned nblk)
if (sl != COMPATIBILITY_SLICE)
dp += sl - BASE_SLICE;
if (dp->dp_typ != DOSPTYP_386BSD) {
printf("Invalid %s\n", "slice");
return -1;
reason = "slice";
goto error;
}
dsk.start = dp->dp_start;
}
@ -535,8 +536,8 @@ dskread(void *buf, unsigned lba, unsigned nblk)
d = (void *)(sec + LABELOFFSET);
if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) {
if (dsk.part != RAW_PART) {
printf("Invalid %s\n", "label");
return -1;
reason = "label";
goto error;
}
} else {
if (!dsk.init) {
@ -546,14 +547,17 @@ dskread(void *buf, unsigned lba, unsigned nblk)
}
if (dsk.part >= d->d_npartitions ||
!d->d_partitions[dsk.part].p_size) {
printf("Invalid %s\n", "partition");
return -1;
reason = "partition";
goto error;
}
dsk.start += d->d_partitions[dsk.part].p_offset;
dsk.start -= d->d_partitions[RAW_PART].p_offset;
}
}
return drvread(buf, dsk.start + lba, nblk);
error:
printf("Invalid %s\n", reason);
return -1;
}
static void

View File

@ -462,7 +462,8 @@ load(void)
caddr_t p;
ufs_ino_t ino;
uint32_t addr;
int i, j;
int k;
uint8_t i, j;
if (!(ino = lookup(kname))) {
if (!ls)
@ -483,7 +484,7 @@ load(void)
return;
} else if (IS_ELF(hdr.eh)) {
fs_off = hdr.eh.e_phoff;
for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) {
for (j = k = 0; k < hdr.eh.e_phnum && j < 2; k++) {
if (xfsread(ino, ep + j, sizeof(ep[0])))
return;
if (ep[j].p_type == PT_LOAD)
@ -533,6 +534,7 @@ parse()
const char *cp;
unsigned int drv;
int c, i, j;
size_t k;
while ((c = *arg++)) {
if (c == ' ' || c == '\t' || c == '\n')
@ -555,7 +557,7 @@ parse()
#if SERIAL
} else if (c == 'S') {
j = 0;
while ((unsigned int)(i = *arg++ - '0') <= 9)
while ((i = *arg++ - '0') <= 9)
j = j * 10 + i;
if (j > 0 && i == -'0') {
comspeed = j;
@ -618,10 +620,10 @@ parse()
dsk.daua = dsk.disk | dsk.unit;
dsk_meta = 0;
}
if ((i = ep - arg)) {
if ((size_t)i >= sizeof(knamebuf))
if (k = ep - arg) {
if (k >= sizeof(knamebuf))
return -1;
memcpy(knamebuf, arg, i + 1);
memcpy(knamebuf, arg, k + 1);
kname = knamebuf;
}
}
@ -639,6 +641,7 @@ dskread(void *buf, unsigned lba, unsigned nblk)
unsigned i;
uint8_t sl;
u_char *p;
const char *reason;
if (!dsk_meta) {
sec = dmadat->secbuf;
@ -660,8 +663,8 @@ dskread(void *buf, unsigned lba, unsigned nblk)
if (sl != WHOLE_DISK_SLICE) {
dp += sl - BASE_SLICE;
if (dp->dp_mid != DOSMID_386BSD) {
printf("Invalid %s\n", "slice");
return -1;
reason = "slice";
goto error;
}
dsk.start = dp->dp_scyl * dsk.head * dsk.sec +
dp->dp_shd * dsk.sec + dp->dp_ssect;
@ -671,14 +674,14 @@ dskread(void *buf, unsigned lba, unsigned nblk)
d = (void *)(sec + LABELOFFSET);
if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) {
if (dsk.part != RAW_PART) {
printf("Invalid %s\n", "label");
return -1;
reason = "label";
goto error;
}
} else {
if (dsk.part >= d->d_npartitions ||
!d->d_partitions[dsk.part].p_size) {
printf("Invalid %s\n", "partition");
return -1;
reason = "partition";
goto error;
}
dsk.start += d->d_partitions[dsk.part].p_offset;
dsk.start -= d->d_partitions[RAW_PART].p_offset;
@ -690,6 +693,9 @@ dskread(void *buf, unsigned lba, unsigned nblk)
return i;
}
return 0;
error:
printf("Invalid %s\n", reason);
return -1;
}
static void
@ -750,8 +756,10 @@ drvread(void *buf, unsigned lba)
head = x / dsk.sec;
sec = x % dsk.sec;
if (!OPT_CHECK(RBX_QUIET))
printf("%c\b", c = c << 8 | c >> 24);
if (!OPT_CHECK(RBX_QUIET)) {
xputc(c = c << 8 | c >> 24);
xputc('\b');
}
v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS;
v86.addr = READORG; /* call to read in boot1 */
v86.ecx = cyl;

View File

@ -39,7 +39,8 @@ CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \
CWARNEXTRA?= -Wno-error=inline -Wno-error=enum-compare -Wno-error=unused-but-set-variable \
-Wno-error=aggressive-loop-optimizations -Wno-error=maybe-uninitialized \
-Wno-error=array-bounds -Wno-error=address \
-Wno-error=cast-qual -Wno-error=sequence-point -Wno-error=attributes
-Wno-error=cast-qual -Wno-error=sequence-point -Wno-error=attributes \
-Wno-error=strict-overflow -Wno-error=overflow
.endif
# External compilers may not support our format extensions. Allow them

View File

@ -1752,7 +1752,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
/*
* XXX: we need to limit this number to some reasonable value
*/
if (vattr.va_size > 100 * 1024) {
if (vattr.va_size > LINKER_HINTS_MAX) {
printf("hints file too large %ld\n", (long)vattr.va_size);
goto bad;
}

View File

@ -318,7 +318,7 @@ pipe_zone_init(void *mem, int size, int flags)
pp = (struct pipepair *)mem;
mtx_init(&pp->pp_mtx, "pipe mutex", NULL, MTX_DEF | MTX_RECURSE);
mtx_init(&pp->pp_mtx, "pipe mutex", NULL, MTX_DEF);
return (0);
}
@ -1792,7 +1792,7 @@ filt_piperead(struct knote *kn, long hint)
struct pipe *wpipe = rpipe->pipe_peer;
int ret;
PIPE_LOCK(rpipe);
PIPE_LOCK_ASSERT(rpipe, MA_OWNED);
kn->kn_data = rpipe->pipe_buffer.cnt;
if ((kn->kn_data == 0) && (rpipe->pipe_state & PIPE_DIRECTW))
kn->kn_data = rpipe->pipe_map.cnt;
@ -1801,11 +1801,9 @@ filt_piperead(struct knote *kn, long hint)
wpipe->pipe_present != PIPE_ACTIVE ||
(wpipe->pipe_state & PIPE_EOF)) {
kn->kn_flags |= EV_EOF;
PIPE_UNLOCK(rpipe);
return (1);
}
ret = kn->kn_data > 0;
PIPE_UNLOCK(rpipe);
return ret;
}
@ -1816,12 +1814,11 @@ filt_pipewrite(struct knote *kn, long hint)
struct pipe *wpipe;
wpipe = kn->kn_hook;
PIPE_LOCK(wpipe);
PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
if (wpipe->pipe_present != PIPE_ACTIVE ||
(wpipe->pipe_state & PIPE_EOF)) {
kn->kn_data = 0;
kn->kn_flags |= EV_EOF;
PIPE_UNLOCK(wpipe);
return (1);
}
kn->kn_data = (wpipe->pipe_buffer.size > 0) ?
@ -1829,7 +1826,6 @@ filt_pipewrite(struct knote *kn, long hint)
if (wpipe->pipe_state & PIPE_DIRECTW)
kn->kn_data = 0;
PIPE_UNLOCK(wpipe);
return (kn->kn_data >= PIPE_BUF);
}

View File

@ -757,6 +757,10 @@ db_trap_glue(struct trapframe *frame)
|| frame->exc == EXC_BPT
|| frame->exc == EXC_DSI)) {
int type = frame->exc;
/* Ignore DTrace traps. */
if (*(uint32_t *)frame->srr0 == EXC_DTRACE)
return (0);
if (type == EXC_PGM && (frame->srr1 & 0x20000)) {
type = T_BREAKPOINT;
}

View File

@ -258,7 +258,8 @@ trap(struct trapframe *frame)
if (frame->srr1 & EXC_PGM_TRAP) {
#ifdef KDTRACE_HOOKS
inst = fuword32((const void *)frame->srr0);
if (inst == 0x0FFFDDDD && dtrace_pid_probe_ptr != NULL) {
if (inst == 0x0FFFDDDD &&
dtrace_pid_probe_ptr != NULL) {
struct reg regs;
fill_regs(td, &regs);
(*dtrace_pid_probe_ptr)(&regs);
@ -301,7 +302,7 @@ trap(struct trapframe *frame)
#ifdef KDTRACE_HOOKS
case EXC_PGM:
if (frame->srr1 & EXC_PGM_TRAP) {
if (*(uint32_t *)frame->srr0 == 0x7c810808) {
if (*(uint32_t *)frame->srr0 == EXC_DTRACE) {
if (dtrace_invop_jump_addr != NULL) {
dtrace_invop_jump_addr(frame);
return;

View File

@ -890,8 +890,7 @@ CNAME(dblow):
mfcr %r29 /* save CR in r29 */
mfsrr1 %r1
mtcr %r1
bf 17,2f /* branch if privileged */
1:
bf 17,1f /* branch if privileged */
/* Unprivileged case */
mtcr %r29 /* put the condition register back */
mfsprg2 %r29 /* ... and r29 */
@ -900,19 +899,7 @@ CNAME(dblow):
li %r1, 0 /* How to get the vector from LR */
bla generictrap /* and we look like a generic trap */
2:
#ifdef KDTRACE_HOOKS
/* Privileged, so drop to KDB */
mfsrr0 %r1
mtsprg3 %r3
lwz %r1,0(%r1)
/* Check if it's a DTrace trap. */
li %r3,0x0808
addis %r3,%r3,0x7c81
cmplw %cr0,%r3,%r1
mfsprg3 %r3
beq %cr0,1b
#endif
1:
/* Privileged, so drop to KDB */
GET_CPUINFO(%r1)
stw %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */

View File

@ -799,9 +799,8 @@ CNAME(dblow):
mfcr %r29 /* save CR in r29 */
mfsrr1 %r1
mtcr %r1
bf 17,2f /* branch if privileged */
bf 17,1f /* branch if privileged */
1:
/* Unprivileged case */
mtcr %r29 /* put the condition register back */
mfsprg2 %r29 /* ... and r29 */
@ -810,19 +809,7 @@ CNAME(dblow):
li %r1, 0 /* How to get the vector from LR */
bla generictrap /* and we look like a generic trap */
2:
#ifdef KDTRACE_HOOKS
/* Privileged, so drop to KDB */
mfsrr0 %r1
mtsprg3 %r3
lwz %r1,0(%r1)
/* Check if it's a DTrace trap. */
li %r3,0x0808
addis %r3,%r3,0x7c81
cmplw %cr0,%r3,%r1
mfsprg3 %r3
beq %cr0,1b
#endif
1:
GET_CPUINFO(%r1)
std %r27,(PC_DBSAVE+CPUSAVE_R27)(%r1) /* free r27 */
std %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */

View File

@ -120,6 +120,9 @@
#define EXC_PGM_PRIV (1UL << 18)
#define EXC_PGM_TRAP (1UL << 17)
/* DTrace trap opcode. */
#define EXC_DTRACE 0x7c810808
#ifndef LOCORE
struct trapframe;
struct pcb;

View File

@ -228,6 +228,7 @@ void *linker_hwpmc_list_objects(void);
#endif
#define LINKER_HINTS_VERSION 1 /* linker.hints file version */
#define LINKER_HINTS_MAX (1 << 20) /* Allow at most 1MB for linker.hints */
#ifdef _KERNEL