1/* 2 * Copyright 2019, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12#include <sel4runtime/stddef.h> 13#include <sel4runtime/stdint.h> 14 15#define ALIGN_UP(x, n) (((x) + (n) - 1) & ~((n) - 1)) 16#define ALIGN_DOWN(x, n) ((x) & ~((n) - 1)) 17 18#define ROUND_DOWN(n, b) \ 19 ({ typeof (n) _n = (n); \ 20 typeof (b) _b = (b); \ 21 _n - (_n % _b); \ 22 }) 23 24#define ROUND_UP(n, b) \ 25 ({ typeof (n) _n = (n); \ 26 typeof (b) _b = (b); \ 27 (_n + (_n % _b == 0 ? 0 : (_b - (_n % _b)))); \ 28 }) 29 30/* 31 * We have our own copies of memset and memcpy to avoid conflicts and 32 * dependencies on libc. 33 */ 34 35void *__sel4runtime_memcpy( 36 void *restrict dest, 37 const void *restrict src, 38 sel4runtime_size_t n 39); 40void *__sel4runtime_memset(void *dest, int c, sel4runtime_size_t n); 41