Module Name: src Committed By: skrll Date: Wed Aug 12 08:56:37 UTC 2020
Modified Files: src/sys/arch/mips/include: asm.h Log Message: Provide assmebler versions of BITS(3) macros. These are only good for 32 bit masks To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/mips/include/asm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/include/asm.h diff -u src/sys/arch/mips/include/asm.h:1.60 src/sys/arch/mips/include/asm.h:1.61 --- src/sys/arch/mips/include/asm.h:1.60 Mon Aug 10 14:37:38 2020 +++ src/sys/arch/mips/include/asm.h Wed Aug 12 08:56:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.60 2020/08/10 14:37:38 skrll Exp $ */ +/* $NetBSD: asm.h,v 1.61 2020/08/12 08:56:37 skrll Exp $ */ /* * Copyright (c) 1992, 1993 @@ -57,6 +57,13 @@ #include <sys/cdefs.h> /* for API selection */ #include <mips/regdef.h> +#define __BIT(n) (1 << (n)) +#define __BITS(hi,lo) ((~((~0)<<((hi)+1)))&((~0)<<(lo))) + +#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask)) +#define __SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask)) +#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask)) + /* * Define -pg profile entry code. * Must always be noreorder, must never use a macro instruction