Commit Graph

1064 Commits

Author SHA1 Message Date
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
uwe e7b43156c5 Truncate the argument to 16 bit with extu.w 2006-02-04 22:24:26 +00:00
uwe fe55d8a997 /* fall through */ -> /* FALLTHROUGH */ 2006-01-27 02:28:36 +00:00
uwe b04e9bed57 Support 'z' (size_t) and 't' (ptrdiff_t) specifiers.
XXX: ptrdiff_t is only ever defined in <stddef.h> and is defined
unconditionally, without the ifndef dance.  Until we have an expert
opinion, abuse intptr_t for the 't' size check.
2006-01-27 01:53:13 +00:00
uwe 090e596149 Don't omit int arguments in the K&R style function definitions. 2006-01-27 01:11:27 +00:00
christos e72f06abb2 Add the source directory of zlib in the include paths so that cread.c can
find zlib.h which is needed from <lib/libz/libz.h>.
2006-01-26 14:05:49 +00:00
uwe ba7d6bc890 Sync alloc/dealloc prototypes with unsigned int -> size_t change. 2006-01-25 22:44:37 +00:00
christos 6645a4f37b free -> dealloc 2006-01-25 18:27:23 +00:00
christos 8c98cc0872 - Add attributes to printf functions
- Fix attributes to noreturn functions
- free -> dealloc
- unsigned -> size_t for alloc, dealloc
2006-01-25 18:26:59 +00:00
christos 426a2fdd3b Changing len from int to size_t caused an infinite loop. Noticed by chuq. 2006-01-25 13:46:09 +00:00
christos 8f67218a4b PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
  on an mbuf and ip_cksum() operates on a plain buffer. We should not call
  functions that operate on different arguments the same name (this is not
  c++).
2006-01-24 17:07:19 +00:00
dsl 9813905f44 If _STANDALONE is defined, #include </lib/libsa/iodesc.h> instead of requiring
that the source that #includes net.h have lib/libsa in its include path.
In the non-_STANDALONE case make it easy for the user to supply their own iodesc.h.
2006-01-22 16:05:42 +00:00
dsl 05b5a4b77a Adjust code so that it will work when _STANDALONE isn't defined.
Allows it to be used for mount_nfs when SMALL is set - eg install floppies/
2006-01-21 10:06:06 +00:00
uwe ed89efb8bf Define indp_t as signed int32_t, like ffsv1.c does. 2006-01-18 02:52:22 +00:00
christos ddce00bf3c Don't include zlib.h directly; redirect through libz.h; this mirrors how
libkern is done and let's us abstract where the real zlib.h is kept.
2006-01-14 20:16:44 +00:00
christos b7c7f77db6 use zlib-1.2.3 2006-01-14 20:15:38 +00:00
christos a6d61f6709 constify write prototype. 2006-01-13 22:32:10 +00:00
yamt 43308ea339 fix build of bzero.
XXX is it better to remove it as i386?
2005-12-27 08:49:35 +00:00
perry 4a2c58419f __asm__ -> __asm 2005-12-24 23:29:06 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
christos f852d21f71 Add the state setting functions for the new random function, but use the
small one by default, so that we can switch in the future if we want to.
2005-12-21 14:24:44 +00:00
christos 153f1146ed Use common sources with userland. 2005-12-20 19:35:26 +00:00
christos 6fcf9fd532 Provide _DIAGASSERT and NULL, so that we don't have to do it in *all* the
libkern files.
Also the new inet_addr, provides inet_aton; advertise it.
2005-12-20 19:35:12 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
chs 8b17730eac put mcount.c in the normal object list, so that "make depend" works.
use a gcc attribute to prevent it from being instrumented.
2005-10-02 15:34:17 +00:00
uebayasi e6760038b8 Redo previous; don't add mcount.po to POBJS when MKPROFILE=no. 2005-08-25 08:55:42 +00:00
uebayasi bab482f18d Create mcount.po only when MKPROFILE != no. 2005-08-25 08:34:50 +00:00
christos 50f8955b6e 64 bit inode changes. 2005-08-19 02:04:03 +00:00
tron 72f9a2a842 Return correct error on all zero length codes. Fix from Gentoo bug 94584. 2005-08-04 14:36:42 +00:00
simonb bdc552eaee KNF nit. 2005-07-27 12:41:09 +00:00
christos 773f5f5489 rearrange free's and add a missing one. 2005-07-14 02:36:49 +00:00
tron b1be36cfb8 Don't use a static buffer in SHA1Transform() because it might cause
various problems including sporadic IPSec authentification failures
if this code is used by multiple instances in parallel.
2005-06-30 13:08:46 +00:00