Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jan 2003 10:07:09 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        jmallett@FreeBSD.ORG
Cc:        marcel@xcllnt.net, current@FreeBSD.ORG
Subject:   Re: Patch to teach config(8) about "platforms".
Message-ID:  <20030130.100709.25156813.imp@bsdimp.com>
In-Reply-To: <20030128151749.A831@FreeBSD.org>
References:  <20030128120830.A81856@FreeBSD.org> <20030128225335.GB537@athlon.pn.xcllnt.net> <20030128151749.A831@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Any reason why the NetBSD approach to this problem won't work?  IMHO,
the meta-port should drive the derived ports.  The static parts of the
system are radically different between the different mips platforms.

Using the endian.h stuff as an example:

src/sys/arch/arc/include/endian.h is just "#include <sys/endian.h>"
src/sys/arch/arc/include/endian_machdep.h is

#define _BYTE_ORDER _LITTLE_ENDIAN
#include <mips/endian_machdep.h>

and src/sys/arch/mips/include/endian_machdep.h is a bunch of #defines
for assembler.

sys/endian.h looks like:

#define	_LITTLE_ENDIAN	1234	/* LSB first: i386, vax */
#define	_BIG_ENDIAN	4321	/* MSB first: 68000, ibm, net */
#define	_PDP_ENDIAN	3412	/* LSB first in word, MSW first in long */

#include <machine/endian_machdep.h>

...
#include <sys/cdefs.h>
#include <sys/types.h>

typedef u_int32_t	in_addr_t;
typedef u_int16_t	in_port_t;

__BEGIN_DECLS
uint32_t	htonl __P((uint32_t)) __attribute__((__const__));
uint16_t	htons __P((uint16_t)) __attribute__((__const__));
uint32_t	ntohl __P((uint32_t)) __attribute__((__const__));
uint16_t	ntohs __P((uint16_t)) __attribute__((__const__));
__END_DECLS

... (more macros/functions)

In this case, there's very little duplication of effort.

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030130.100709.25156813.imp>