From 3f098aed4500da38db8afdff111f02198158203a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 20 Aug 1998 14:37:17 +0000 Subject: FreeBSD stack compiles for the first time (except libc/strsep.c). --- cpukit/libnetworking/machine/param.h | 88 ++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 cpukit/libnetworking/machine/param.h (limited to 'cpukit/libnetworking/machine/param.h') diff --git a/cpukit/libnetworking/machine/param.h b/cpukit/libnetworking/machine/param.h new file mode 100644 index 0000000000..eae8554c2a --- /dev/null +++ b/cpukit/libnetworking/machine/param.h @@ -0,0 +1,88 @@ +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +/* + * These aren't really machine-dependent for RTEMS..... + */ + +/* +#define MACHINE "i386" +#define MID_MACHINE MID_I386 +*/ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#define ALIGNBYTES (sizeof(int) - 1) +#define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES) + +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK) +#define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#endif /* !_MACHINE_PARAM_H_ */ -- cgit v1.2.3