mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Add sys/_align.h replacing machine/_align.h
Define _ALIGNBYTES using sizeof(void *) (no functional change on any existing architecture) which will allow it to work with CHERI were we must align things up to capability alignment. In _ALIGN, replace integer manipulation which does not preserve pointer provenance with a type and provenance preserving builtin. This requires modest changes in code which assumes _ALIGN returns an integer, but those are relatively rare. Reviewed by: kib, markj Effort: CHERI upstreaming Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D53947
This commit is contained in:
1 parent
cfae62eac0
commit
80203a27e9
16 files changed
+40
-260
No files matched your search
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
.PATH: ${SRCTOP}/sys/arm/include ${SRCTOP}/lib/msun/arm
|
.PATH: ${SRCTOP}/sys/arm/include ${SRCTOP}/lib/msun/arm
|
||||||
|
|
||||||
INCS= _align.h \
|
INCS= _inttypes.h \
|
||||||
_inttypes.h \
|
|
||||||
_limits.h \
|
_limits.h \
|
||||||
_stdint.h \
|
_stdint.h \
|
||||||
_types.h \
|
_types.h \
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
/*-
|
|
||||||
* This file is in the public domain.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <x86/_align.h>
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
#ifndef _AMD64_INCLUDE_PARAM_H_
|
#ifndef _AMD64_INCLUDE_PARAM_H_
|
||||||
#define _AMD64_INCLUDE_PARAM_H_
|
#define _AMD64_INCLUDE_PARAM_H_
|
||||||
|
|
||||||
#include <machine/_align.h>
|
#include <sys/_align.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Machine dependent constants for AMD64.
|
* Machine dependent constants for AMD64.
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
/*-
|
|
||||||
* SPDX-License-Identifier: BSD-4-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2001 David E. O'Brien
|
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* William Jolitz.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _ARM_INCLUDE__ALIGN_H_
|
|
||||||
#define _ARM_INCLUDE__ALIGN_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Round p (pointer or byte index) up to the hardware-required alignment which
|
|
||||||
* is sufficient for any data type, pointer or numeric. The resulting type
|
|
||||||
* is equivelent to arm's uintptr_t (but is purposely spelled "unsigned" here).
|
|
||||||
*/
|
|
||||||
#define _ALIGNBYTES (sizeof(int) - 1)
|
|
||||||
#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
|
|
||||||
|
|
||||||
#endif /* !_ARM_INCLUDE__ALIGN_H_ */
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
* Machine dependent constants for StrongARM
|
* Machine dependent constants for StrongARM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/_align.h>
|
#include <sys/_align.h>
|
||||||
|
|
||||||
#define STACKALIGNBYTES (8 - 1)
|
#define STACKALIGNBYTES (8 - 1)
|
||||||
#define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES)
|
#define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES)
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
/*-
|
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* William Jolitz.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __arm__
|
|
||||||
#include <arm/_align.h>
|
|
||||||
#else /* !__arm__ */
|
|
||||||
|
|
||||||
#ifndef _MACHINE__ALIGN_H_
|
|
||||||
#define _MACHINE__ALIGN_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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(long long) - 1)
|
|
||||||
#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
|
|
||||||
|
|
||||||
#endif /* !_MACHINE__ALIGN_H_ */
|
|
||||||
|
|
||||||
#endif /* !__arm__ */
|
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
* Machine dependent constants for arm64.
|
* Machine dependent constants for arm64.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/_align.h>
|
#include <sys/_align.h>
|
||||||
|
|
||||||
#define STACKALIGNBYTES (16 - 1)
|
#define STACKALIGNBYTES (16 - 1)
|
||||||
#define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES)
|
#define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES)
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
/*-
|
|
||||||
* This file is in the public domain.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <x86/_align.h>
|
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#ifndef _I386_INCLUDE_PARAM_H_
|
#ifndef _I386_INCLUDE_PARAM_H_
|
||||||
#define _I386_INCLUDE_PARAM_H_
|
#define _I386_INCLUDE_PARAM_H_
|
||||||
|
|
||||||
#include <machine/_align.h>
|
#include <sys/_align.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Machine dependent constants for Intel 386.
|
* Machine dependent constants for Intel 386.
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
/*-
|
|
||||||
* SPDX-License-Identifier: BSD-4-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2001 David E. O'Brien
|
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* William Jolitz.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _POWERPC_INCLUDE__ALIGN_H_
|
|
||||||
#define _POWERPC_INCLUDE__ALIGN_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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(register_t) - 1)
|
|
||||||
#define _ALIGN(p) (((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
|
|
||||||
|
|
||||||
#endif /* !_POWERPC_INCLUDE__ALIGN_H_ */
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
* Machine dependent constants for PowerPC
|
* Machine dependent constants for PowerPC
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/_align.h>
|
#include <sys/_align.h>
|
||||||
|
|
||||||
#ifndef MACHINE
|
#ifndef MACHINE
|
||||||
#define MACHINE "powerpc"
|
#define MACHINE "powerpc"
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
/*-
|
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* William Jolitz.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _MACHINE__ALIGN_H_
|
|
||||||
#define _MACHINE__ALIGN_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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(long long) - 1)
|
|
||||||
#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
|
|
||||||
|
|
||||||
#endif /* !_MACHINE__ALIGN_H_ */
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
* Machine dependent constants for RISC-V.
|
* Machine dependent constants for RISC-V.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/_align.h>
|
#include <sys/_align.h>
|
||||||
|
|
||||||
#define STACKALIGNBYTES (16 - 1)
|
#define STACKALIGNBYTES (16 - 1)
|
||||||
#define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES)
|
#define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES)
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 SRI International
|
||||||
|
*
|
||||||
|
* This software was developed by SRI International and the University of
|
||||||
|
* Cambridge Computer Laboratory (Department of Computer Science and
|
||||||
|
* Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
|
||||||
|
* DARPA SSITH research programme.
|
||||||
|
*/
|
||||||
|
#ifndef _SYS__ALIGN_H_
|
||||||
|
#define _SYS__ALIGN_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Round p up to the alignment of the largest, non-floating point, type
|
||||||
|
* that fits in a register. In practice this has always been the size
|
||||||
|
* of a pointer (but spelled in a wide varity of ways) and with CHERI
|
||||||
|
* that needs to remain true to support file descriptor passing within
|
||||||
|
* the kernel.
|
||||||
|
*
|
||||||
|
* Unlike historic implementations, _ALIGN macro preserves both the type
|
||||||
|
* and provenance of p.
|
||||||
|
*
|
||||||
|
* These interfaces are ambigiously defined and should be considred
|
||||||
|
* obsolete. New code that requires alignment adjustments should replace
|
||||||
|
* _ALIGNBYTES with alignof(appropriate type) and _ALIGN with
|
||||||
|
* __align_up(p, alignof(appropriate type)).
|
||||||
|
*/
|
||||||
|
#define _ALIGNBYTES (sizeof(void *) - 1)
|
||||||
|
#define _ALIGN(p) __align_up((p), _ALIGNBYTES + 1)
|
||||||
|
|
||||||
|
#endif /* !_SYS__ALIGN_H_ */
|
||||||
+1
-1
@@ -36,7 +36,7 @@
|
|||||||
#include <sys/_types.h>
|
#include <sys/_types.h>
|
||||||
#include <sys/_iovec.h>
|
#include <sys/_iovec.h>
|
||||||
#include <sys/_timeval.h>
|
#include <sys/_timeval.h>
|
||||||
#include <machine/_align.h>
|
#include <sys/_align.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definitions related to sockets: types, address families, options.
|
* Definitions related to sockets: types, address families, options.
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
/*-
|
|
||||||
* SPDX-License-Identifier: BSD-4-Clause
|
|
||||||
*
|
|
||||||
* Copyright (c) 2001 David E. O'Brien
|
|
||||||
* Copyright (c) 1990 The Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* William Jolitz.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _X86_INCLUDE__ALIGN_H_
|
|
||||||
#define _X86_INCLUDE__ALIGN_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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(__register_t) - 1)
|
|
||||||
#define _ALIGN(p) (((__uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
|
|
||||||
|
|
||||||
#endif /* !_X86_INCLUDE__ALIGN_H_ */
|
|
||||||
Reference in new issue
Block a user