Commit Graph

1095 Commits

Author SHA1 Message Date
ragge ad9091c30f Repair copyright that has been broken since -94.
Gently requested by Otto Moerbeek.
2007-01-14 13:26:18 +00:00
yamt ce9d4b0004 remove nqnfs from comments. from Arnaud Lacombe.
(no functional changes.)
2006-12-29 13:05:48 +00:00
chs 088fbfd7aa in fdloadfile(), fail if we can't read the entire exec header. 2006-12-09 22:11:36 +00:00
dogcow 437f8cc149 make bootxx_msdos fit in 8k again; thanks, __internal_memset_, for spilling
registers all over the place.
2006-12-02 00:38:22 +00:00
dyoung e3361bb265 Add strsep(3) to libkern.
To avoid code duplication, move strsep.c to the kernel/userland
common files.

Soon I will commit source-address selection (options IPSELSRC).
It will use strsep(3).
2006-11-13 03:26:43 +00:00
christos 9573aa20e8 - call the initialization routine for arc4randbytes.
- knf (add continues)
2006-11-05 14:13:56 +00:00
christos 31a62606ea Merge kernel and userland rmd160 and sha2 implementation.
XXX: We still install rmd160.h and sha2.h in /usr/include/crypto, unlike
the other hash functions which get installed in /usr/include for compatibility.
2006-10-27 21:20:48 +00:00
thorpej 82fd1ebbaa - Move strtoll.c and strtoull.c from libc/stdlib to common/libc/stdlib.
- Add strtoll.c and strtoull.c to libkern.
2006-10-08 03:14:55 +00:00
simonb a4c94c5ab7 Remove stale copy. Pointed out by uwe@ ages ago. 2006-09-28 13:12:59 +00:00
matt efc67dee86 Add a way for a user to know what nodes have changed when a node has been
inserted or removed.  Refactor node insertion to not require rebalancing
all the time or a loop if it does.  In rb_tree_swap_prune_and_rebalance,
don't call rb_tree_reparent_nodes, instead do the work ourselves (since
we will eventually undo half of the work of rb_tree_reparent_nodes).
2006-09-10 23:57:31 +00:00
matt 9bed3293b9 If __STDC__ and GNU C >= 3.0, define C99's bool, true, false 2006-09-10 23:49:21 +00:00
matt d9bb545dc5 Shrink rb_tree to 4 pointers (2 if RBSMALL is defined). Move compare
functions to a separate rb_tree_ops structure.  Make every int explicit
in being signed or unsigned.  Use RBDEBUG to enable debug code.  Move
rbt_count to RBSTATS.  Use RBSMALL to not keep track of min/max.
2006-09-09 06:52:18 +00:00
matt 75de26ab17 Add rb_tree_find_node_{geq,leq}. Add stats. Make TAILQ DEBUG only.
Keep track of tree's min/max nodes for easier iteration.  Improve comments.
Move functions around to improve locality.
2006-09-09 05:55:51 +00:00
matt 958730091e Fix and simplify node removal. Add lots of assertions and comments. 2006-09-08 04:07:15 +00:00
thorpej f68bacf5a3 Use static at the function decl if the prototype also uses static. 2006-09-06 20:01:57 +00:00
scw 24f4ed9338 The list of registers which sdivsi3 can clobber has changed in gcc4.
Make the necessary changes.
2006-09-05 22:07:08 +00:00
matt 3aa5e506b7 Rewrite of red-black tree code. 2006-09-05 04:35:45 +00:00
scw 456695f0eb The kernel is built with "-mdiv=call", so add a __sdivsi3_1 alias
for __sdivsi3.
2006-09-04 20:44:48 +00:00
matt 497415f67e Make this compile in _KERNEL || _STANDALONE. Make gcc4 happy. 2006-09-02 20:46:50 +00:00
dyoung 8cd106d3d2 Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h.  Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).

Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t.  XXX The manual
page lags this change by a bit.

Define __PRIxBIT and __PRIxBITS printf(3) format strings.
2006-08-31 19:24:37 +00:00
tsutsui a3bdccd23a Add src/common/include to include header search path so that
standalone programs can be built without installed ${DESTDIR} tree.
Okayed by christos, and should close PR 33431.
2006-08-28 13:34:18 +00:00
matt 5e87012f78 Add __NULL_STMT which is do { } while (/* CONSTCOND */ 0) 2006-08-25 19:07:44 +00:00
rillig b102417f76 Fixed the gcc warning that "static" should come before "const". 2006-07-16 06:06:20 +00:00
matt 53ea8158b4 With VAX & GCC4, use builtin memset and memmove. 2006-07-08 00:24:26 +00:00
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
uwe 497c1ccc27 Provide __movmem* aliases to __movstr* functions.
Gcc4 uses movmem, older versions use movstr.
2006-05-22 21:34:08 +00:00
uwe 9001bc2fd8 G/c #ifdef PIC we inherited from the userland. 2006-05-22 20:56:44 +00:00
mrg 696ab05f50 add (char *) cast to quieten GCC. 2006-05-20 19:40:46 +00:00
mrg abeaa4f60d apply -Wno-pointer-sign with GCC4. 2006-05-12 03:29:11 +00:00
mrg 22406ced78 ssize_t -> size_t to match variable and functions. 2006-05-11 01:13:44 +00:00
thorpej b69c14413b Support for building proplib in the kernel. 2006-04-27 20:43:09 +00:00
uwe e983955bb3 libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common.  Move it to sys/lib/libkern/arch/sh3.
2006-04-22 22:48:53 +00:00
thorpej 7d3d66c90e Move strtoumax.c from libc/stdlib to common/libc/stdlib and include it
in libkern.  Required for new code coming soon.
2006-04-22 15:33:33 +00:00
christos c76b868cf4 Imply DIAGNOSTIC if __COVERITY__. 2006-04-15 01:09:34 +00:00
christos 147a6ae8fb If __COVERITY__ is defined, turn on KASSERT and _DIAGASSERT. 2006-04-14 18:24:56 +00:00
nonaka 5918a2e057 Always _LOCORE is defined for standalone program. 2006-04-14 09:23:01 +00:00
cherry 39ba8074f1 Fixed CVS version headers 2006-04-07 14:27:33 +00:00
cherry ba7cbe760f Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
2006-04-07 13:57:43 +00:00
cherry c988ba8700 Pass by reference to MD_LOADSEG(). Thanks to Matt Thomas for pointing this out. 2006-04-06 09:25:58 +00:00
cherry 3627104dbe Encapsulated the MD test: phdr[i].p_type & PT_LOPROC out of MI code,
and into MD_LOADSEG() as suggested by Christos.
2006-04-03 15:45:36 +00:00
cherry 50756fb219 Allows processor ABI specific ELF segment loads.
If the macro MD_LOADSEG defined in
machine/loadfile_machdep.h evaluates to 1, the machine
specific segment is loaded.

See: http://mail-index.netbsd.org/tech-kern/2005/12/30/0003.html
2006-04-03 14:08:41 +00:00
tsutsui b3e724899c Remove unused file. Pointed out by uwe. 2006-03-30 13:44:51 +00:00
martin 972ca1ead8 Remove an unused, obsolete copy (pointed out by Valeriy E. Ushakov). 2006-03-30 08:07:47 +00:00
uwe 4dff387338 G/c this stale copy of SYS.h. It has not been updated since 1999. It
has not been used since an unused copy of setjmp.S has been removed
from here in 2002 (i386 removed its own in 1999).
2006-03-30 02:13:10 +00:00
dyoung 321a3122bb Per discussion on source-changes@, add __arraycount(array) for
counting the number of elements in a static array, using the idiom,
sizeof(array)/sizeof(array[0]).

XXX This may move in the future, but this is a safe place to put
XXX it for use in the kernel.
2006-03-27 21:18:33 +00:00
kleink 31930d4de5 Provide BCD<->binary conversion in libkern and turn <dev/clock_subr.h>'s
FROMBCD()/TOBCD() macros into wrappers around it, resulting in both
smaller code footprint and elimination of possible issues due to
multiple evaluation of macro arguments.

Suggested by Simon Burge and Anders Gavare on tech-kern.
2006-03-11 15:40:07 +00:00
dyoung cafe884d2c Change macro names to avoid collisions:
BIT -> __BIT
BITS -> __BITS
2006-03-08 08:26:50 +00:00
dyoung f66403a698 Move my bit-twiddling macros to libkern.h from my drivers, where
I had duplicated them.  Improve the macros' names.  Simplify their
implementation.

A brief description of each macro is below.

        BIT(n): Return a bitmask with bit m set, where the least
                significant bit is bit 0.

        BITS(m, n): Return a bitmask with bits m through n, inclusive,
                    set.  It does not matter whether m>n or m<=n.
                    The least significant bit is bit 0.

        A "bitfield" is a span of consecutive bits defined by a
        bitmask, where 1s select the bits in the bitfield.  SHIFTIN,
        SHIFTOUT, and SHIFTOUT_MASK help read and write bitfields
        from device registers.

        SHIFTIN(v, mask): Left-shift bits `v' into the bitfield
                          defined by `mask', and return them.  No
                          side-effects.

        SHIFTOUT(v, mask): Extract and return the bitfield selected
                           by `mask' from `v', right-shifting the
                           bits so that the rightmost selected bit
                           is at bit 0.  No side-effects.

        SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that
                             the rightmost non-zero bit is at bit
                             0.  This is useful for finding the
                             greatest unsigned value that a bitfield
                             can hold.  No side-effects.  Note that
                             SHIFTOUT_MASK(m) = SHIFTOUT(m, m).

Examples:

/*
 * Register definitions taken from the RFMD RF3000 manual.
 */
#define RF3000_GAINCTL          0x11            /* TX variable gain control */
#define         RF3000_GAINCTL_TXVGC_MASK       BITS(7, 2)
#define         RF3000_GAINCTL_SCRAMBLER        BIT(1)

/*
 * Shift the transmit power into the transmit-power field of the
 * gain-control register and write it to the baseband processor.
 */
atw_rf3000_write(sc, RF3000_GAINCTL,
    SHIFTIN(txpower, RF3000_GAINCTL_TXVGC_MASK));


/*
 * Register definitions taken from the ADMtek ADM8211 manual.
 *
 */
#define ATW_RXSTAT_OWN          BIT(31)         /* 1: NIC may fill descriptor */
/* ... */
#define ATW_RXSTAT_DA1          BIT(17)         /* DA bit 1, admin'd address */
#define ATW_RXSTAT_DA0          BIT(16)         /* DA bit 0, group address */
#define ATW_RXSTAT_RXDR_MASK    BITS(15,12)     /* RX data rate */
#define ATW_RXSTAT_FL_MASK      BITS(11,0)      /* RX frame length, last
                                                 * descriptor only
                                                 */

/* Extract the frame length from the Rx descriptor's
 * status field.
 */
len = SHIFTOUT(rxstat, ATW_RXSTAT_FL_MASK);
2006-03-08 00:24:06 +00:00
perry fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
uwe 0fc70b4831 Add bswap16.c and bswap32.c to SRCS. We need fallback versions for
kernels compiled without optimization (and thus without inlining of
bswap16 and bswap32)
2006-02-04 23:33:37 +00:00