| 1 | /* libc-internal interface for tagged (colored) memory support. |
| 2 | Copyright (C) 2020-2021 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <http://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #ifndef _GENERIC_LIBC_MTAG_H |
| 20 | #define _GENERIC_LIBC_MTAG_H 1 |
| 21 | |
| 22 | /* Generic bindings for systems that do not support memory tagging. */ |
| 23 | |
| 24 | /* Used to ensure additional alignment when objects need to have distinct |
| 25 | tags. */ |
| 26 | #define __MTAG_GRANULE_SIZE 1 |
| 27 | |
| 28 | /* Non-zero if memory obtained via morecore (sbrk) is not tagged. */ |
| 29 | #define __MTAG_SBRK_UNTAGGED 0 |
| 30 | |
| 31 | /* Extra flags to pass to mmap() to request a tagged region of memory. */ |
| 32 | #define __MTAG_MMAP_FLAGS 0 |
| 33 | |
| 34 | /* Set the tags for a region of memory, which must have size and alignment |
| 35 | that are multiples of __MTAG_GRANULE_SIZE. Size cannot be zero. |
| 36 | void *__libc_mtag_tag_region (const void *, size_t) */ |
| 37 | #define __libc_mtag_tag_region(p, s) (p) |
| 38 | |
| 39 | /* Optimized equivalent to __libc_mtag_tag_region followed by memset. */ |
| 40 | #define __libc_mtag_memset_with_tag memset |
| 41 | |
| 42 | /* Convert address P to a pointer that is tagged correctly for that |
| 43 | location. |
| 44 | void *__libc_mtag_address_get_tag (void*) */ |
| 45 | #define __libc_mtag_address_get_tag(p) (p) |
| 46 | |
| 47 | /* Assign a new (random) tag to a pointer P (does not adjust the tag on |
| 48 | the memory addressed). |
| 49 | void *__libc_mtag_new_tag (void*) */ |
| 50 | #define __libc_mtag_new_tag(p) (p) |
| 51 | |
| 52 | #endif /* _GENERIC_LIBC_MTAG_H */ |
| 53 | |