chs
0454ead77f
the asm version of strlcpy() was buggy, just use the C version.
2003-09-11 05:04:33 +00:00
he
9ac0a9ed26
Um, undo last; libsa printf doesn't do %z.
2003-09-04 12:02:10 +00:00
he
bd42895755
Use the %zu format for size_t printing instead of cast + %lu.
2003-09-04 11:42:52 +00:00
he
022f01cef7
Cast size_t to u_long before printing, and use %lu instead of %d as format.
...
Fixes compilation on alpha.
2003-09-03 12:43:41 +00:00
dsl
fafabf93cc
Another attempt to get libsa to contain the right things.
...
- put a 'standards conforming' memcmp into memcmp.c
- make bcmp be a second label on the same code
- make bcmp.c be just #include "memcmp.c"
This means that libsa.o might contain both a memcmp.o and a bcmp.o, but
both contain the same code (defining both symbols) so it doesn't matter
which ld uses.
Saves worrying about which of bcmp.c and memcmp.c the architecture specific
Makefile requests.
2003-09-01 12:28:03 +00:00
fvdl
60ae17c7ae
Fix signed/unsigned warnings.
2003-08-31 22:40:13 +00:00
chs
6e0aaa640d
update for LWPs, and some lite cleanup.
2003-08-31 01:52:43 +00:00
dsl
22588a3d36
The __strong_alias() seems to have to be in the file with the definition.
...
So make bcmp.c define bcmp and memcmp.
This should (?) fix the atari build.
(I've now no idea why the previous change defined memcpy for the alpha build.)
2003-08-29 19:53:18 +00:00
dsl
904ed3bb04
An ever sneakier way of making memcmp and bcmp use the same code:
...
__strong_alias(memcmp,bcmp)
2003-08-27 22:53:18 +00:00
dsl
d0db314661
Use memset not bzero to help shrink alpha bootxx_lfs
...
(sys/arch/alpha/stand/common/start.S also uses bzero, I don't know
any alpha opcodes so cant change that one...)
2003-08-27 22:42:08 +00:00
matt
4a33fdce54
Actually the right instruction to fill a half-word.
...
From Juergen Hannken-Illjes hannken at eis dot cs dot tu-bs dot de
2003-08-27 17:37:43 +00:00
dsl
db4706faf9
Reduce memory footprint:
...
- use file buffer for all block reads
- only save a small amount of the indirect block list
Allows i386 bootxx_ufs code to load /boot from a filesystem with 32k blocks
while still fitting inside 64k of memory.
Code size reduced as well (by ~1k on i386).
It ought to be possible to use a buffer that is smaller than a filesystem
block. This might be needed in order to boot from filesystems with larger
block sizes.
2003-08-22 21:33:52 +00:00
elric
72e3ec4b0c
Should call ufs_close() if it isn't being built in.
2003-08-21 00:01:28 +00:00
elric
2a56d40c5c
make 'path' argument to cd9660_open 'const char *' and fix the fallout.
2003-08-21 00:00:52 +00:00
itojun
1403d9d920
KNF
2003-08-20 13:32:33 +00:00
ragge
a9e5513c6b
Kerner library files for pdp10.
2003-08-19 10:59:26 +00:00
dsl
8453fb0040
make 'path' argument to ufs_open 'const char *' and fix the fallout.
2003-08-18 15:45:27 +00:00
dsl
d678060c05
KNF, fix a comment or two
2003-08-18 08:00:52 +00:00
ragge
bc830a1980
Do not use the builtins for the mem* functions on vax, the compiler gets
...
confused with the static inline functions vax uses.
2003-08-13 11:34:24 +00:00
ragge
f69577d50c
Include the C versions of the string instructions.
...
Replace blkcpy() with a version that can handle overlapping data areas.
2003-08-13 11:32:23 +00:00
matt
f70606090a
Add a memset.S (does not use dcbz; to be added later). It does both bzero
...
and memset.
2003-08-10 21:17:08 +00:00
martin
785cae7ed0
Sync with userland version.
2003-08-10 14:20:03 +00:00
agc
aad01611e7
Move UCB-licensed code from 4-clause to 3-clause licence.
...
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
scw
5d91e08442
In lookup(), don't free "dir" on exit if we found a matching entry.
...
Otherwise the caller ends up with a pointer to free'd memory...
2003-07-15 13:27:07 +00:00
dsl
f92748a3e8
Add xlat_mbr_fstype - converts mbr type to disklabel type
2003-07-07 13:20:17 +00:00
martin
34718fb25a
Protect opt_*.h include by _KERNEL_OPT
2003-06-23 14:17:24 +00:00
martin
d505b18964
Make sure to include opt_foo.h if a defflag option FOO is used.
2003-06-23 11:00:59 +00:00
briggs
b2566d8735
Provide a strtoul() implementation based on the one in libc instead of the
...
totally different version that was here. This version, of course, has an
BSD license on it while the old one did not. This one also compiles down
to tighter code--the smaller the better for libkern & libsa.
2003-06-07 02:52:33 +00:00
itojun
da3884cbf4
latest copyright notice (more loose). noted by wiz
2003-05-15 15:02:52 +00:00
itojun
99c5869d56
add strl{cpy,cat} to libkern. code from lib/libc/string (originally from openbsd).
2003-05-15 13:50:35 +00:00
scw
3722390978
Allow the default location of "machine/loadfile_machdep.h" to be
...
overridden if MACHINE_LOADFILE_MACHDEP is defined.
This makes life much simpler in the face of the myriad of
different boot options for the evb* ports.
2003-04-29 13:03:55 +00:00
tron
e71f089777
Remove two unused variable to fix a build problem.
2003-04-27 11:12:14 +00:00
bjh21
01f90db242
Remove %b support.
...
Encouraged by thorpej.
2003-04-26 13:25:47 +00:00
christos
abfff333c3
don't define TRUE and FALSE locally.
2003-04-22 15:10:04 +00:00
bjh21
2456c80578
If the format string ends with "%" or "%l", print those characters, just
...
as we would if they were part of an invalid conversion specification.
Code-size neutral on ARM; not tested elsewhere.
2003-04-20 22:23:59 +00:00
bjh21
94c13ff2cd
ANSIfy, assume __STDC__, un-__P, KNF.
...
Generated code unchanged.
2003-04-20 19:31:29 +00:00
dsl
35632a80ac
lfs code is built from ufs.c
2003-04-16 19:52:58 +00:00
dsl
c327a133c6
Significantly faster memcpy/memmove/bcopy and memset/bzero
2003-04-15 22:49:50 +00:00
dsl
7c8e4cdaea
Add interface to boot password checking code that takes password parameter.
2003-04-15 22:26:42 +00:00
dsl
4efa73a16e
Build ffsv1 and ffsv2
2003-04-11 11:31:44 +00:00
dsl
ef32565239
Add externs for ffsv1_xxx and ffsv2_xxx
2003-04-11 11:30:12 +00:00
dsl
f671893500
Files to build ffsv1 and ffsv2 versions of ufs.c
2003-04-11 11:28:54 +00:00
dsl
af3660bcdb
Use common ffs/lfs file ufs.c instead of lfs specific version.
2003-04-11 11:27:06 +00:00
dsl
5a0534abeb
Merge in lfs.c, use defines to build ffsv1, ffsv2, lfsv1 or lfsv2.
...
(removes the ability to build a single ufs.o that supports ffs v1 and v2,
that animal was too large for some of the boot code.)
Use shifts and masks to avoid pulling in 64bit divide.
2003-04-11 11:24:49 +00:00
dsl
fbf4bd0cfe
Put extern definition of bcopy in () to avoid macro expansion when
...
LIBSA_USE_MEMCPY is defined. Fixes breakage because the return
type of memcpy() is different to that of bcopy.
2003-04-11 10:34:38 +00:00
dsl
cff85b34d5
Fix prototypes of null_read and null_write, change to return errno values.
...
This code can't actually be used anywhere! I don't think its obvious use
would compile!
2003-04-10 14:44:05 +00:00
dsl
4a16b1cc1d
Add FS_DEF() and FS_OPS() defines to save typing (and errors) elsewhere.
...
Kill __P() and argument names in prototypes.
(approved by christos)
2003-04-10 14:39:46 +00:00
scw
bfc4be13a6
When MEMCOPY is defined, don't bother checking if a backwards-copy is
...
required. That's what memmove() is for.
This should fix port-powerpc/16889. The backwards copyin can confuse
uiomove/genfs_getpages, resulting in corruption of files written over NFS.
2003-04-07 21:04:19 +00:00
bjh21
f34ba16c9c
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
2003-04-05 23:27:14 +00:00
he
97b6d5bf4f
Conditionalize declaration of local variable ``i'', now that the
...
code which uses it is also conditionalized.
2003-04-02 19:47:25 +00:00
fvdl
42614ed3f3
Add support for UFS2. UFS2 is an enhanced FFS, adding support for
...
64 bit block pointers, extended attribute storage, and a few
other things.
This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.
Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
2003-04-02 10:39:19 +00:00
mycroft
0b87bcb397
constify a couple of pointers.
2003-04-01 21:09:32 +00:00
thorpej
7a3fa51b7f
Garbage-collect the DYNAMIC_CRC_TABLE stuff. The table it computed
...
was incompatible with the new CRC code, and it is largely unnecessary
now, since the static table is so much smaller.
Fixes PR kern/20935.
2003-03-29 22:25:25 +00:00
drochner
8b0843a5b2
There is no point in initializing "rootpath" to "/".
...
Move it into BSS.
2003-03-27 12:28:58 +00:00
mycroft
d8c7d22134
*** empty log message ***
2003-03-25 22:52:48 +00:00
mycroft
8320edced9
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
...
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
2003-03-25 22:48:43 +00:00
mycroft
c6052ec21f
const! const!
2003-03-25 22:35:36 +00:00
drochner
f81c1c504b
remove stuff just moved to bootparam.c and some variables which are
...
never used.
2003-03-19 17:19:32 +00:00
drochner
3906113e15
Move global variables which are used only by bootparam here.
...
("domainname" is useless and could be removed, but adding code to
skip this in the RPC reply would probably be more expensive than leaving
it as a dummy variable.)
2003-03-19 17:18:07 +00:00
mycroft
4d7fb7469d
Finish const poisoning.
2003-03-18 20:00:47 +00:00
mycroft
bb478ade6c
Move more stuff into .rodata.
2003-03-18 19:33:51 +00:00
mycroft
f6258762e1
Move some stuff into .rodata.
2003-03-18 19:20:09 +00:00
drochner
68edf0e576
separate ether_sprintf() from the rest of ethernet support -- sometimes
...
it makes sense to use the former w/o the latter (eg PXE)
2003-03-12 16:46:31 +00:00
drochner
7b3b2ea783
no need to include "netif.h" anymore
...
(shared interface stuff is in iodesc.h, included by net.h)
2003-03-12 14:51:31 +00:00
drochner
7816074c59
separate the netif interface from the rest of the networking code,
...
so that it can be replaced easily in md code
2003-03-12 14:49:19 +00:00
jmmv
5649a49e43
After the "insert disk <number>, and press return..." message, check only
...
for the return keypress.
2003-03-11 19:43:04 +00:00
drochner
dd688f888f
translate EACCES (happens with NFS)
2003-03-11 15:02:54 +00:00
dsl
ef50700873
LIBSA_NO_CLOSE is LIBSA_NO_FS_CLOSE everywhere else.
2003-03-07 00:46:37 +00:00
matt
cc005c66db
Switch back to generic bzero/memset until new one is shown to work.
2003-02-25 20:15:02 +00:00
ragge
e8d062d58b
Remove bogus check for bogus netmask.
2003-02-25 14:42:30 +00:00
pk
d71686ab26
Introduce fdloadfile() to load an image from an open file descriptor;
...
implement loadfile() in terms of it.
This allows clients to open a file once and "load" it multiple times (e.g.
first with COUNT_KERNEL, then with LOAD_KERNEL) without the side-effects
of multiple open calls.
2003-02-24 10:51:05 +00:00
matt
97d38cdec2
Actually use bzero.S. Also fix bzero to use GET_CPUINFO
2003-02-24 07:14:17 +00:00
matt
05a4c83a70
Don't make memset.c since bzero.o has memset in addition to bzero.
2003-02-24 07:09:18 +00:00
simonb
6e4342ca79
Add support for LFSv2 filesystems. From a libsa standpoint, LFSv1 and
...
LFSv2 are treated as separate filesystem types for size considerations.
2003-02-23 23:17:42 +00:00
simonb
7d43baad24
Use the MAX() macro from <sys/param.h> instead of a local inline. Results
...
in same code size in ufs.c and removes an unused inline function in lfs.c.
2003-02-23 22:47:43 +00:00
simonb
8d6004faf3
We can't use <string.h> for standalone programs;
...
use <lib/libkern/libkern.h> for str*() prototypes instead.
2003-02-23 12:31:29 +00:00
dsl
2d1837c8fc
KNR, removing ugly 'unsigned' variables.
...
Probably should be size_t, but now matched prototype.
(mainly agreed with christos - he wanted size_t....)
2003-02-01 14:57:02 +00:00
dsl
912fab6ec9
Beautify a little
2003-02-01 14:54:22 +00:00
dsl
2c4edf02a4
Save some space
...
(agreed by christos)
2003-02-01 14:53:38 +00:00
dsl
3080e19ff3
Support limited filename globbing
...
- agreed by christos
2003-02-01 14:52:13 +00:00
fvdl
a3ff3a3038
Bump daddr_t to 64 bits. Replace it with int32_t in all places where
...
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
2003-01-24 21:55:02 +00:00
christos
8453828bf1
PR/19607: Bernd Ernesti: libsa does not have access to arpa/tftp.h. Put a
...
copy of it in our tftp.h
2003-01-12 18:59:15 +00:00
veego
a64314e402
Fix broken build due too the move of the cd9660 and msdosfs kernel source code.
2002-12-30 16:41:53 +00:00
pk
bd20047a69
Only display the final progress counter if any of the LOAD_ flags was given.
...
Fix comment describing the return value.
2002-12-11 09:55:20 +00:00
thorpej
e8cc3884de
Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
2002-12-10 17:14:02 +00:00
thorpej
4245ee1663
Wrap this file in "#ifndef _STANDALONE".
2002-12-05 17:12:06 +00:00
fvdl
144469b350
Add strtoul.c
2002-11-25 00:55:22 +00:00
fvdl
a186add0a8
If LIBKERN_ARCH is defined, use that as the architecture-specific
...
subdirectory. Needed for the x86_64 32bit compile case.
2002-11-23 23:35:50 +00:00
chris
f86ab1a63e
Sync arm asm libkern files with libc's asm files.
2002-11-23 14:29:29 +00:00
itohy
6e73936f81
Use assembly version of bzero() and memset().
2002-11-20 09:52:53 +00:00
itohy
5d1c87f395
Assembly version of bzero()/memset().
...
Written by SHIMIZU Ryo.
2002-11-20 09:51:52 +00:00
itohy
766d863c42
memcpy() and memmove() must return the first parameter.
...
Problem found by itohy, fixed by SHIMIZU Ryo.
2002-11-20 09:50:37 +00:00
rearnsha
6576c49b48
Add an assembler version of strcmp, based on example code from the ARM
...
ARM. As an example of the performance difference that this provides
a Dhrystone score on my Shark goes from 213k to 261k.
2002-11-16 18:27:40 +00:00
thorpej
7f74df5ef3
ABICALLS -> __ABICALLS__
2002-11-10 18:10:25 +00:00
perry
efd79c70c9
Add lint infrastructure
2002-11-02 07:48:17 +00:00
perry
6448ffbdfe
set LLIBS= so we don't try to check the lint lib against llib-lc.ln
2002-11-02 07:46:42 +00:00
chs
cab484e445
move includes to the top so that this builds in libc context too.
2002-10-29 04:40:55 +00:00
chs
c04f87a03e
remove setjmp/longjmp from libkern, they're not used.
2002-10-27 18:45:11 +00:00
chs
c5a350ef59
use %g5 instead of %g7 (since we want to use %g7 for the cpu_info pointer
...
in the kernel). resync libc and libkern versions of this file.
2002-10-27 18:41:27 +00:00
christos
07dca24022
make offsetof lint friendlier.
2002-10-24 20:53:50 +00:00
scw
03c573236d
Replace the SuperH memcpy() with homebrewed code. The former seems to have
...
a subtle failure mode which can result in corruption of memory outside the
bounds of the destination buffer.
2002-10-22 12:25:18 +00:00
scw
ac76a83a5c
Sync with libc/quad:
...
As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
2002-10-20 10:17:14 +00:00
scw
921743eed1
Fix a sign-extension botch for ILP32.
2002-10-19 08:54:23 +00:00
scw
0e1af8ca62
Doh. Bail out early if we're passed a zero-length buffer.
2002-10-19 08:53:45 +00:00
scw
99ad3a762b
Add native optimised assembler versions of some libkern routines.
...
The memcpy routine is courtesy of SuperH, with some tweaks by me.
XXX: There is room for further optimisation in some of these routines.
2002-10-17 11:53:32 +00:00
jdolecek
d32bd396f2
#undef ffs before the ffs() function definition, so that the name
...
isn't rewrote to __builtin_ffs() on gcc 2.95+; this fixes compilation
on sun2
also change the comment for function
2002-10-10 10:51:56 +00:00
jdolecek
aaccb8dc2b
need to include <sys/param.h> to get inline strlen() on vax; found
...
with help of Matt Thomas
2002-10-08 21:45:36 +00:00
simonb
a30355b57a
Add RCS ids.
2002-10-08 11:58:54 +00:00
dan
73390e7e36
let this compile in the non KERNEL case without NRND.
2002-10-06 13:42:36 +00:00
tls
0f95ec4fd5
ESP output was drawing down the entropy pool at a ferocious rate, a
...
particular problem on hosts with only wireless interfaces that are
definitely not safe to use as entropy sources.
Add arc4randbytes() which hands out bytes from the same source used
by arc4random(). This is intended to be a _temporary_ interface
until we can design and implement a better general PRNG interface
that is decoupled from the entropy-pool implementation.
Modify key_randomfill() (used only for initialization vectors on
SA creation and via key_sa_stir_iv(), which does not "stir",
despite its name) to use arc4randbytes() instead of pulling bits
directly from the entropy pool. It is my hope that this change
will pose minimal integration problems for the KAME folks as the
random-pool interface is *already* different between each BSD
variant; this just simplifies the NetBSD case and solves a
fairly serious problem.
Note that it is generally considered acceptable cryptographic
practice to use a fast stream cipher to generate IVs for encryption
with stronger block ciphers. For example, the use of "non-Approved"
PRNGs to generate IVs for "Approved" block ciphers is explicitly
sanctioned by FIPS 140-2.
2002-10-06 08:51:44 +00:00
tls
cd114adca5
This commit includes two major changes:
...
1) Speed up arc4random(). We make arc4randbyte() inline, which makes this
not much slower than, say, the other arc4 implementation in our kernel.
We also replace four calls to arc4randbyte() with a loop, saving about
20% on some processors where the "unrolled" arc4randbyte() calls would
needlessly stomp the cache.
2) Address various problems with the initialization/"stirring" code,
primarily in the area of handling of the source data from the kernel
entropy pool. We used to:
a) Ask the entropy pool for 32 bytes
b) If we got zero bytes, key with junk from the stack (ouch!)
which has some nasty implications, to say the least. For
example, we're most likely to get zero bytes at boot time,
when the stack contents are even more predictable than usual.
c) If we got less than 32 bytes but more than zero bytes, use
however many bytes we got as the arc4 key, copying it
repeatedly as per usual arc4 key setup.
Because of the way NetBSD's entropy pool works, this was
mostly harmless, because if you ask for RND_EXTRACT_ANY,
you always get as many bytes as you ask for. However,
this is probably a security hole in the original FreeBSD
code, where AFAICT you might end up using an 8-bit arc4
key -- not good, much worse than using the output of the
entropy pool hash function even when it thinks it only
has 8 bits of entropy to give you.
One thing this code could do on NetBSD that was not so
good was to replace a key with a lot of entropy with
one with less entropy. That's clearly counterproductive.
The new code, instead:
a) Asks for 32 good bytes. If it gets them, use them as the
arc4 key in the usual way.
b) Tracks how many entropy bytes the key it's replacing had.
If the new entropy request got less bytes, leave the old
key in place. Note that the first time through, the "old
key" had zero bytes, so we'll always replace it.
c) If we get less then 32 bytes but more than we had, request
EXTRACT_ANY bytes from the entropy pool, padding the key
out to 32 bytes which we then use as the arc4 key in the
usual way.
This is still really all rather backwards. Instead of this generator
deciding to rekey itself using a basically arbitrary metric, it should
register a callback so that the entropy pool code could rekey it when
a lot of bits were available. Details at 11.
Finally, rename the "stir" function (which did not stir) to "rekey",
which is what it actually does.
2002-10-06 06:47:40 +00:00
junyoung
2a1b344158
Unconditionally add strstr.c. Bill Studenmund.
2002-10-04 20:00:00 +00:00
junyoung
26737526db
Add strstr() to libkern. For now, it's only used in i386 (for processor
...
identification).
2002-10-04 18:39:52 +00:00
itojun
df6ef6d0d3
include rnd.h only under kernel build.
...
caveat: arc4random() will not get stirred in bootstrap code.
2002-10-04 07:33:26 +00:00
itojun
dfea6e4344
add missing "rnd.h" include - noted by simonb
2002-10-04 02:37:23 +00:00
matt
44bc4ef4a9
Ansify's (use prototypes).
2002-10-04 00:50:15 +00:00
scw
42ca361622
Preserve and restore the caller's FP status register, and ensure
...
it contains a sane value while we're doing FP ops.
2002-09-28 10:33:59 +00:00
provos
0f09ed48a5
remove trailing \n in panic(). approved perry.
2002-09-27 15:35:29 +00:00
chs
2841e1341c
add strtoul.c, it's now used in MI code.
2002-09-21 17:45:16 +00:00
ragge
77d3833330
Need strtoul() also.
2002-09-19 17:37:32 +00:00
thorpej
2699791533
Do not #include "/usr/include/arpa/tftp.h" directly. Doing so is
...
VERY BAD for cross-compiling.
2002-09-16 16:53:45 +00:00
msaitoh
a991dcef11
Add __movstr_i4_{odd,even} for -m4.
...
Written by SHIMIZU Ryo.
2002-09-05 08:35:15 +00:00
itohy
f89823c1f8
Save 1-4 instructions on all cases except for the ret=0 case.
...
This is probably the last version from me. :)
You are welcome to speed it up, of course. :)
Here's a benchmark on SH-4 200MHz.
9.2% faster if all the cases occur evenly.
return value C version previous vers this version speed ratio
of ffs() (ns/call) *1 (ns/call) (ns/call) *2 (*1/*2)
------------ ------------ ------------- ------------ -----------
0 86 81 81 1.06
1 110 106 91 1.21
2 132 106 92 1.43
3 165 117 96 1.72
4 201 116 95 2.12
5 237 107 99 2.39
6 271 106 101 2.68
7 307 116 107 2.87
8 342 116 105 3.26
9 376 126 111 3.39
10 410 127 110 3.73
11 446 136 115 3.88
12 483 134 116 4.16
13 518 125 119 4.35
14 551 126 120 4.59
15 587 135 127 4.62
16 624 136 126 4.95
17 658 139 126 5.22
18 694 140 126 5.51
19 727 148 131 5.55
20 764 150 131 5.83
21 799 141 135 5.92
22 834 142 135 6.18
23 868 152 140 6.20
24 903 153 142 6.36
25 939 140 127 7.39
26 974 141 126 7.73
27 1009 152 131 7.70
28 1044 148 130 8.03
29 1080 141 136 7.94
30 1115 141 136 8.20
31 1151 151 141 8.16
32 1185 151 140 8.46
2002-09-01 13:14:53 +00:00
itohy
fa5465079f
Slightly improved version of ffs(3).
...
Partially from SHIMIZU Ryo <ryo@iij.ad.jp>. Thanks.
Some cases are slower, but other most cases are faster.
Here's a benchmark on SH-4 200MHz.
return value C version previous vers this version speed ratio
of ffs() (ns/call) *1 (ns/call) (ns/call) *2 (*1/*2)
------------ ------------ ------------- ------------ -----------
0 86 86 81 1.06
1 110 86 106 *(slower) 1.04
2 132 86 106 * 1.25
3 165 105 117 * 1.41
4 201 104 116 * 1.73
5 237 111 107 2.21
6 271 111 106 2.56
7 307 126 116 2.65
8 342 125 116 2.95
9 376 122 126 * 2.98
10 410 121 127 * 3.23
11 446 139 136 3.28
12 483 140 134 3.60
13 518 146 125 4.14
14 551 146 126 4.37
15 587 161 135 4.35
16 624 162 136 4.59
17 658 141 139 4.73
18 694 142 140 4.96
19 727 160 148 4.91
20 764 161 150 5.09
21 799 167 141 5.67
22 834 167 142 5.87
23 868 181 152 5.71
24 903 181 153 5.90
25 939 146 140 6.71
26 974 146 141 6.91
27 1009 166 152 6.64
28 1044 165 148 7.05
29 1080 171 141 7.66
30 1115 171 141 7.91
31 1151 185 151 7.62
32 1185 186 151 7.85
2002-08-28 15:34:35 +00:00
thorpej
181f0a9b54
Tweak the previous change so that a prototype is always provided.
2002-08-25 21:09:45 +00:00
itohy
6736303e13
Use assembly version of ffs(3).
2002-08-24 06:39:48 +00:00
itohy
85ce1de27f
Oops, SYSLIBC_SCCS -> LIBC_SCCS
2002-08-24 06:37:24 +00:00
itohy
70b5675025
Assembly version of ffs(3).
...
Confirmed to return the same value as that of the C version.
The results of a simple benchmark on SH-4 200MHz, is shown below.
I think this shows acceptable performance.
return value C version this version speed
of ffs() (ns/call) (ns/call) ratio
------------ --------- ------------ -----
0 86 86 1.00
1 110 86 1.27
2 132 86 1.53
3 165 105 1.57
4 201 104 1.93
5 237 111 2.13
6 271 111 2.44
7 307 126 2.43
8 342 125 2.73
9 376 122 3.08
10 410 121 3.38
11 446 139 3.20
12 483 140 3.45
13 518 146 3.54
14 551 146 3.77
15 587 161 3.64
16 624 162 3.85
17 658 141 4.66
18 694 142 4.88
19 727 160 4.54
20 764 161 4.74
21 799 167 4.78
22 834 167 4.99
23 868 181 4.79
24 903 181 4.98
25 939 146 6.43
26 974 146 6.67
27 1009 166 6.07
28 1044 165 6.32
29 1080 171 6.31
30 1115 171 6.52
31 1151 185 6.22
32 1185 186 6.37
2002-08-24 06:30:34 +00:00
ragge
3f5fba68de
Do not try to use "__builtin_ffs" on vax, ffs is an instruction already.
...
Maybe possible to teach gcc to use it?
2002-08-23 08:45:27 +00:00
thorpej
c0d823519c
GCC 2.95 supports __builtin_ffs(); use it.
2002-08-21 01:27:58 +00:00
thorpej
dafc960ed6
Local label fixup.
2002-08-17 19:00:26 +00:00
chris
d8ac0fb3aa
pull in ffs.S from libc for arm.
...
The main benefit is that ffs always runs in constant time.
2002-08-17 01:22:33 +00:00
briggs
b98931f62e
Use .L prefix for all local labels.
2002-08-15 18:30:36 +00:00
matt
7c4618a9ce
cpu_info is not in spr0, but spr_g_0.
2002-07-30 06:10:46 +00:00
kent
6789db7962
Avoid redundant memory access.
2002-07-10 06:02:09 +00:00
scw
59474a8c82
NetBSD, meet the SH-5 cpu.
...
SH-5, meet NetBSD.
Let's hope this is the start of a long and fruitful relationship. :-)
This code, funded by Wasabi Systems, adds initial support for the
Hitachi SuperH(tm) SH-5 cpu architecture to NetBSD.
At the present time, NetBSD/evbsh5 only runs on a SH-5 core simulator
which has no simulated devices other than a simple console. However, it
is good enough to get to the "root device: " prompt.
Device driver support for Real SH-5 Hardware is in place, particularly for
supporting the up-coming Cayman evaluation board, and should be quite
easy to get running when the hardware is available.
There is no in-tree toolchain for this port at this time. Gcc-current has
rudimentary SH-5 support but it is known to be buggy. A working toolchain
was obtained from SuperH to facilitate this port. Gcc-current will be
fixed in due course.
The SH-5 architecture is fully 64-bit capable, although NetBSD/evbsh5 has
currently only been tested in 32-bit mode. It is bi-endian, via a boot-
time option and it also has an "SHcompact" mode in which it will execute
SH-[34] user-land instructions.
For more information on the SH-5, see www.superh.com. Suffice to say it
is *not* just another respin of the SH-[34].
2002-07-05 13:31:28 +00:00
bjh21
3763adaefd
Avoid leaving junk in the top half of R0 on return.
...
This fixes port-arm/17440.
2002-07-01 19:07:18 +00:00
wrstuden
10d47b4dd3
Updated version of cscope/mkid support. Check libkern and compat lib
...
for source files. Also include header files in mkid run.
2002-06-18 23:46:52 +00:00
matt
940fedda07
Fix make breakage. $ZDST != ${ZDST} in make. make clean/cleandir now works.
2002-06-15 19:30:56 +00:00
itojun
c3e57df04c
discard 256 bytes of output every time we stir (not just when initializing)
2002-06-14 03:05:46 +00:00
fredette
e978777b86
Added hppa support to libkern.
2002-06-06 20:03:37 +00:00
itojun
937b671271
use exit(int), not exit(void), consistently - even if the arg has no meaning.
2002-06-01 11:40:31 +00:00
itojun
c0e2bb0509
need libkern.h for bootloaders
2002-05-29 06:27:15 +00:00
bjh21
a20462dc6e
Implement LIBSA_NO_FS_CLOSE, LIBSA_NO_FS_WRITE and LIBSA_NO_FS_SEEK.
...
LIBSA_NO_FS_SYMLINK and LIBSA_FS_SINGLECOMPONENT are irrelevant here.
2002-05-28 14:30:53 +00:00
bjh21
43079a573b
KNF.
2002-05-28 14:26:01 +00:00
itojun
2e926ba699
no need for libkern.h
2002-05-28 12:21:22 +00:00
itojun
0ac289dea9
have arc4random(9).
2002-05-28 10:09:24 +00:00
lukem
e34d4e21de
fix comment
2002-05-10 11:07:01 +00:00
simonb
5457f78a34
Don't bother testing if a uint8_t is > 256 -- that test is always false.
2002-05-09 02:44:39 +00:00
simonb
67c33ffcda
Remove two shadowed variables, one of which was set to what it was
...
shadowing(!) and the other a temporary variable (as was it's shadow).
Code generated with "gcc -O2" is the same before and after.
2002-05-07 02:02:41 +00:00
martin
9f680534b0
Add strtoul.
2002-05-05 11:23:24 +00:00
ross
f98b9b43e8
Add strtoul.c
2002-04-24 16:56:36 +00:00
ragge
b0fa7eb2c1
Someone had a braino here; IP_TTL != IPDEFTTL. This caused the standalone
...
udp traffic to only have a ttl of 4.
Found by Jens Nilsson, jens@rockstorm.se .
2002-04-23 09:16:09 +00:00
martin
22143f5a44
Add strtoul.c, otherwise kernels using "wi* at pcmcia?" do not work
...
anymore.
Why only four archs provide this is beyound me.
2002-04-16 06:36:02 +00:00
matt
fd1c084a68
Add a 1byte pad to make the ustar_t word aligned so the uas_1cyl after it
...
will also be word aligned. This makes the VAX VMB bootrom happy since it
doesn't support odd-aligned buffers.
2002-03-30 01:29:48 +00:00
matt
cb520da5b3
Refresh from libc.
2002-03-28 00:46:08 +00:00
fredette
58830d68c5
Added brand-new integer multiply and divide support, used only
...
on the m68000.
2002-03-26 22:49:32 +00:00
matt
12810ed37d
Use size_t in prototype (so this will be LP64 clean for PPC64 someday).
...
Calculate len separately for icache & dcache in case each has different
cacheline widths. Make the code for both loops the same except for the
dcbst/icbi. Deal with sizes >=2GB properly (like that'll happen but ...)
2002-03-26 21:20:24 +00:00
fredette
d617871b0c
On the m68000, if and only if gcc doesn't seem to know
...
where libgcc.a is, fall back to one under DESTDIR.
2002-03-22 00:17:12 +00:00
thorpej
6440db6488
* Add a NetBSD Vendor Class Identifier option as proposed on tech-net
...
in message <20020216172527.C23901@dr-evil.shagadelic.org>.
* Print the bootp/dhcp response, as is done for rarp/bootparam
responses.
* Nuke bootp_flags and BOOTP_PXE; they're not used, nor should they be.
2002-03-20 23:10:39 +00:00
dbj
f0658bdada
make compile with _STANDALONE
2002-03-18 05:10:58 +00:00
gmcgarry
d16aceedcc
Protect remaining references to 'debug' with NETIF_DEBUG.
2002-03-17 05:46:37 +00:00
simonb
f28e18332c
Move files[] from globals.c to its own file. Including all of globals.o
...
breaks the size limit for at least the pmax bootblocks.
Fixes PR port-pmax/15924 from Gregory McGarry.
2002-03-15 13:23:34 +00:00
eeh
4c434f6210
Updated from libc.
2002-03-13 00:59:29 +00:00
fvdl
104148a990
Sync with userland (1.1.4)
2002-03-12 00:42:23 +00:00
matt
e2d6f22138
Add register prefixes to these.
2002-02-24 00:12:41 +00:00
matt
6cad4b795d
Upon further reflection, move udiv/urem to libkern and out of vax/vax.
2002-02-24 00:08:19 +00:00
thorpej
0b91bc440f
Move files[] from open.c to globals.c, so that it's possible to
...
use libsa in an application where there are no file systems or
devices.
2002-02-23 05:44:24 +00:00
lukem
da694bd77b
fix spelos
2002-02-22 12:46:53 +00:00
ragge
f2d946a56e
blkset() used a register for set value that get clobbered by movc5,
...
causing the set area to get unpredictable contents.
2002-02-19 21:46:17 +00:00
thorpej
15bffcdeed
Add a comment describing what SA_USE_LOADFILE is for.
2002-02-17 23:22:22 +00:00
thorpej
0d210931e3
Add a missing "static".
2002-02-17 23:19:00 +00:00
thorpej
bf9a052aa4
Add EOFFSET.
2002-02-17 23:18:32 +00:00
reinoud
e858ed8fa4
Not all ports use the `offset' in their calulations and on those platforms
...
compile errors are generated due to it. By explicitly using `offset=offset'
the variable is used in the compilers view and is optimised away anyway.
2002-02-11 20:25:56 +00:00
thorpej
2362fef9a8
Add __blkcpy() and __blkset() (renamed/modified from __blkclr()) to
...
libkern.
2002-02-10 22:04:51 +00:00
ross
e31435237d
sync
2002-01-24 00:45:22 +00:00
uch
e71de3f668
R5900 short-loop bug.
2002-01-02 12:34:27 +00:00
thorpej
23ed6be403
Always provide alloca() as __builtin_alloca().
2001-12-28 07:37:06 +00:00
shin
1bac15cba5
we need ffs().
2001-12-27 00:10:39 +00:00
shin
6870c1d462
don't use .abicalls in kernel.
2001-12-27 00:09:59 +00:00
shin
e509d7712d
copy from libc/arch/mips/string
2001-12-27 00:08:19 +00:00
thorpej
5ed948ecea
The kernel is now built with -ffreestanding, so GCC built-ins are
...
disabled. Explicitly re-enable some that we want to use, namely:
* memcpy() -> __builtin_memcpy()
* memcmp() -> __builtin_memcmp()
* memset() -> __builtin_memset()
* strcpy() -> __builtin_strcpy()
* strcmp() -> __builtin_strcmp()
* strlen() -> __builtin_strlen()
We might also consider some others for GCC 3.x.
2001-12-23 22:48:29 +00:00
tv
8e6f7afb5b
MKfoo=no -> NOfoo
2001-12-12 01:48:43 +00:00
wiz
b4371d47f5
Replace some misuses of "then" with "than".
2001-12-04 17:56:30 +00:00
mjl
f14e78b4c3
Disable bzero/memset assembler implementation until the dependency
...
problem on assym.h is sorted out and TRW to get at CACHELINESIZE in
the kernel is determined.
2001-12-02 11:03:39 +00:00
mjl
8231ab74c5
Add assembler version of strlen.
2001-11-30 02:27:20 +00:00
mjl
625c08cf7e
Outifdef some stuff not needed in the _KERNEL case.
2001-11-30 02:25:50 +00:00
mjl
4ee3b0f097
Add assembler versions of ffs, bzero and memset.
2001-11-29 00:27:07 +00:00
jmc
2229499bfb
Don't make clean and cleandir depend on the lib subdir. Just check for it's
...
existance before running the submake. This makes it possible to run a
make build (which runs cleandir before make obj) in a r/o source tree
2001-11-21 22:10:54 +00:00
chris
9cc0f33345
Tidy up some memory copying cruft:
...
bcopy.S is no longer needed
memmove and memcpy were both stacking r0 and unstacking it to keep the return value, so push this down into _memcpy.
rename _memcpy.S to memcpy.S.
memmove.S is now just a placeholder otherwise the make system automagically adds a memmove.c file to libkern.
memmove is just another entry point for memcpy.
2001-11-20 00:29:19 +00:00
lukem
2565646230
don't need <sys/types.h> when including <sys/param.h>
2001-11-15 09:47:59 +00:00
tv
4446c00002
Undefine DESTDIR; we don't want the special DESTDIR <bsd.lib.mk>
...
handling for kernel libraries.
XXX this build method should be replaced by something more sane
2001-11-14 21:59:31 +00:00
chris
4d1b8d545e
Sync to libc version of divsi3.S. This is to fix up the stack for 8 byte alignment.
2001-11-13 20:06:40 +00:00
christos
c89e803d30
Remove USB copyrights. The coff and elf loading code did not come with BSD4.4.
2001-11-09 19:27:25 +00:00
scw
f1defc3543
To avoid backwards seeks on sequential devices (eq. QIC tapes), read all
...
the program headers in one operation into an internal buffer.
2001-11-09 18:31:08 +00:00
thorpej
0971f93345
Make the ELF loadfile routines byte-order independent when used in
...
a non-_STANDALONE environment (e.g. installboot(8)): internalize and
externalize the exec, program, and section headers as necessary.
Reviewed and OK'd by Christos.
2001-10-31 21:24:09 +00:00
thorpej
a43b4351a8
Oops, committed wrong copy of file in previous revision.
2001-10-31 20:22:22 +00:00
thorpej
90aee7593a
Add standalone 64-bit to/from {big,little}-endian routines.
2001-10-31 20:19:52 +00:00
thorpej
e727e3f180
Split elf32 vs. elf64 handling in loadfile(), including support for
...
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
2001-10-31 17:20:45 +00:00
thorpej
4810d73020
Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
...
objects.
2001-10-31 01:51:42 +00:00
thorpej
91626c3515
Split the exec formats included by loadfile() into separate files.
...
Primary goal: explcitly select which ELF format (elf32 or elf64) to
support for a cross tool which uses loadfile().
2001-10-30 23:51:03 +00:00
thorpej
74eebee33c
Add standalone byte-swapping routines that don't require testing
...
the system's byte-order:
- host to {big,little}-endian {16,32}
- {big,little}-endian {16,32} to host
These are not intended to be used in libsa directly, but are rather
intended to be used by host tools which may use libsa routines (such
as loadfile()) which need to use explicit byte-ordering.
2001-10-30 23:35:33 +00:00
matt
920cfb5205
Add "Red Black +" balanced binary tree routines to libkern. These provide
...
O(log(N)) insertation, deletion, and lookup times. However, unlike most
red-black implemenations, this one does no additional memory allocations.
2001-10-24 22:40:56 +00:00
jdolecek
a8fcba2901
Fix compilation on Alpha with ARP_DEBUG.
...
Fixes kern/6440 by R. C. Dowdeswell
2001-10-18 19:00:38 +00:00
uch
07f8f33bb9
R5900 miss-prediction of branch targets for short-loop.
2001-10-16 15:40:53 +00:00
minoura
12ea5d8238
Add changedisk_hook().
...
Machine-dependent code can eject the floppy to prompt the next volume in it.
(Or add another method in devsw?)
2001-09-28 15:15:24 +00:00
wiz
4c99916337
va_{start,end} audit:
...
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).
Improved by comments from enami and christos -- thanks!
Heimdal/krb4/KAME changes already fed back, rest to follow.
Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
fvdl
f22b808267
Make new gas happy. Use movzbl instead of xorl + movb.
2001-09-21 14:14:30 +00:00
fredette
7aaa6a4bc4
On the 68010, don't bother with the by-8-longwords loop, instead
...
only 16-bit align the region and use loop mode with longwords
to do the bulk of the work.
On the 68020+, fixed an optimization bug where all regions that start
on odd addresses would not be properly longword aligned.
2001-09-06 21:30:15 +00:00
tsutsui
cf574991b8
Add a small version of memmove() for libsa.
...
Mostly identical with libsa/bcopy.c.
2001-09-02 07:04:16 +00:00
matt
28c81ffc15
7450 requires a sync before the the isync (MPC7450UM - 3.4.4.8)
2001-08-22 21:19:58 +00:00
itojun
9fe945f2fe
sync argument/return type of [hn]to[nh][ls] to XNET 5.2 (uint{16,32}_t).
...
as discussed on tech-net.
2001-08-22 07:42:07 +00:00
jdolecek
c495131fe3
Move _insque()/_remque() to libkern. Once remaining uses would
...
be converted to <sys/queue.h> macros, _insque()/_remque() would be eliminated
altogether.
2001-08-12 08:35:31 +00:00
lukem
9bbc26f3dc
convert to ansi knf, and fix a bug where the last arg was incorrectly
...
'u_char' instead of 'int' (per the prototype and usage and other scanc
implementations)
2001-08-09 08:03:34 +00:00
bjh21
acf574f63e
When loading ELF, zero out:
...
The e_shstrndx field in the ELF header, since we don't load .shstrtab.
The sh_name field in each section header, for the same reason.
The sh_offset field for any section we don't load.
This means the kernel has some chance of knowing what it's being given. It
also means that the behaviour of old kernels with new loaders should be
deterministic (if not terribly useful: they still can't find the symbol
table).
2001-07-31 22:11:57 +00:00
bjh21
30f144749a
G/C "off", since it was just tracking the difference between maxp and elfp.
2001-07-31 21:09:52 +00:00
bjh21
67a82e1d4e
Fix a small memory leak when counting the size of the symbol table (shp was
...
ALLOC'ed if (LOAD_SYM|COUNT_SYM), but FREEd if (LOAD_SYM)).
2001-07-31 20:03:03 +00:00
bjh21
1a35da3617
When loading an ELF kernel, don't load all the STRTAB sections. Instead, just
...
load those STRTAB sections that are referenced by a SYMTAB that we're loading.
The main advantage of this is that (at least with the binaries output by my
ARM ELF linker) this removes the need to seek backwards through the file, which
is a big win when loading a gzipped kernel.
While we're here, don't allocate space for string tables we don't load.
2001-07-31 19:20:29 +00:00
fvdl
3350f68f80
Avoid warnings about uninitialised usage.
2001-07-19 18:55:38 +00:00
wiz
1bc6d2cee9
Fix typo (`information' has an 'r').
2001-07-19 16:13:00 +00:00
christos
366971a414
Back out previous. The booter will need to find the symbol table itself,
...
as explained in the code.
2001-07-13 17:43:23 +00:00
christos
6711e49228
From Nigel Pearson: Make SYMS and NSYMS work on ELF.
...
The MacOS booter needs them.
2001-07-13 17:17:12 +00:00
thorpej
ac8a2539c1
Provide bcopy() here.
2001-07-13 00:04:00 +00:00
perry
5624bbb1d4
restore bzero and bcmp prototypes for now -- this has to be hashed out.
2001-07-07 17:22:25 +00:00
simonb
5439e1a9ff
Put the prototypes for bcmp() and bzero() back (ifdef _STANDALONE) so that
...
libsa builds again.
2001-07-07 12:23:43 +00:00
perry
7ab9c62227
Remove bcmp and bzero prototypes. And yes, I actually checked and
...
tested this time. (Slap self repeatedly.)
2001-07-07 05:42:16 +00:00
toshii
70e10fb682
Remove bcmp, bcopy and bzero. We don't need them as they aren't
...
called from asm code, and we shouldn't have them if we don't need them.
2001-07-06 17:35:44 +00:00
kleink
e69c885f3e
Sync with libc: use bzero-based assembly version of memset().
2001-07-01 11:55:36 +00:00
fvdl
9b4c0e34d2
Initial commit of the port to AMD's upcoming 64 bit architecture, the
...
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
2001-06-19 00:19:12 +00:00
fredette
49fda862f9
When MACHINE_ARCH is m68000, compile ffs.c and random.c
...
instead of ffs.s and random.s, and sneak the libgcc
integer support routines into the list of library objects.
2001-05-16 03:30:39 +00:00
fredette
332aa50acb
Use the EXTBL macro where we want the extbl instruction.
...
On the 68010 this expands to an extw/extl combination.
2001-05-16 03:14:12 +00:00
fredette
8ba384c841
On the 68010, we are forced to do bytewise compares
...
and copies if the two addresses aren't of the same
evenness.
2001-05-16 03:06:41 +00:00
kleink
95fa77ab80
Make this work for PIC (as opposed to pic) without taking chances of fitting
...
__ffstab into a GOT13 relocation; from Eduardo Horvath.
2001-05-13 20:03:45 +00:00
lukem
85772a1cef
remove some lint
2001-04-30 02:34:58 +00:00
ross
2df695b1e4
o IEEE 754 floating-point completion code.
...
o Implement the architected FP_C "Floating Point Control Quadword"
2001-04-26 03:10:44 +00:00
thorpej
4747025b48
ctype-like functions are now in libkern.
2001-04-18 15:40:58 +00:00
thorpej
23a3a54650
libkern.h now has the ctype routines.
2001-04-05 04:39:02 +00:00
thorpej
db5854a62c
Build strtoul.c
2001-04-05 04:38:33 +00:00
thorpej
554aa34ee7
Add ctype routines.
2001-04-05 04:38:06 +00:00
hubertf
267271c1b2
Explain some SA_* options - reading compressed kernels, netboot
...
Useful for stripping down bootcode.
2001-03-31 09:45:11 +00:00
cgd
b7ad250ab1
copy from lib/libc/arch/mips/gen
2001-02-27 19:45:26 +00:00
enami
3d31264640
Don't set ARCHSUBDIR to empty string.
2001-02-18 22:38:50 +00:00
bjh21
d308c5c5ed
Use MACHINE_CPU to find the architecture subdir, or MACHINE_ARCH if that
...
exists. Same algorithm as libc uses.
2001-02-16 16:58:27 +00:00
simonb
0292c3474f
Use arm arch directory for arm32 as well as arm26.
2001-02-15 23:17:44 +00:00
bjh21
da9d806354
Move arm32 over to using the shared ARM libkern.
2001-02-15 22:44:09 +00:00
msaitoh
3c31811206
don't profile (use NENTRY() and ALTENTRY())
2001-02-14 21:04:17 +00:00
msaitoh
9af8d0bdad
ENTRY()
2001-02-14 18:14:37 +00:00
msaitoh
2633a5dcb5
_C_LABEL()
2001-02-14 17:57:31 +00:00
bjh21
e68a8d59fa
Sync with libc for licence update.
2001-01-23 19:12:29 +00:00
itojun
f039f89ec5
prepare for sh3e[bl] split
2001-01-04 06:53:45 +00:00