1 /* 2 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program. If not, see <http://www.gnu.org/licenses/>. 16 * 17 * max() was copied from xen/xen/include/xen/kernel.h. 18 */ 19 20 #ifndef __BOOT_DEFS_H__ 21 #define __BOOT_DEFS_H__ 22 23 #include "../../../include/xen/stdbool.h" 24 25 #define __packed __attribute__((__packed__)) 26 #define __stdcall __attribute__((__stdcall__)) 27 28 #define NULL ((void *)0) 29 30 #define ALIGN_UP(arg, align) \ 31 (((arg) + (align) - 1) & ~((typeof(arg))(align) - 1)) 32 33 #define min(x,y) ({ \ 34 const typeof(x) _x = (x); \ 35 const typeof(y) _y = (y); \ 36 (void) (&_x == &_y); \ 37 _x < _y ? _x : _y; }) 38 39 #define max(x,y) ({ \ 40 const typeof(x) _x = (x); \ 41 const typeof(y) _y = (y); \ 42 (void) (&_x == &_y); \ 43 _x > _y ? _x : _y; }) 44 45 #define _p(val) ((void *)(unsigned long)(val)) 46 47 #define tolower(c) ((c) | 0x20) 48 49 typedef unsigned char u8; 50 typedef unsigned short u16; 51 typedef unsigned int u32; 52 typedef unsigned long long u64; 53 typedef unsigned int size_t; 54 55 #define U16_MAX ((u16)(~0U)) 56 #define UINT_MAX (~0U) 57 58 #endif /* __BOOT_DEFS_H__ */ 59