cp: direct all internal guest console messages to sclp
[hvf.git] / cp / include / nucleus.h
blobbe8752839ffa59c6a0d0b9184a1c969a8d04b132
1 /*
2 * (C) Copyright 2007-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 #ifndef __NUCLEUS_H
9 #define __NUCLEUS_H
11 #ifndef _ASM
13 #include <compiler.h>
14 #include <errno.h>
15 #include <string.h>
16 #include <binfmt_elf.h>
17 #include <sclp.h>
18 #include <arch.h>
20 extern volatile u64 ticks;
22 extern struct datetime ipltime;
24 /* The beginning of it all... */
25 extern void start(u64 __memsize, u32 __iplsch, Elf64_Ehdr *__symtab);
27 /* borrowed from Linux */
28 #define container_of(ptr, type, member) ({ \
29 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
30 (type *)( (char *)__mptr - offsetof(type,member) );})
32 /* borrowed from Linux */
33 #define offsetof(type, member) __builtin_offsetof(type,member)
35 #define BUG() do { \
36 asm volatile(".byte 0x00,0x00,0x00,0x00" : : : "memory"); \
37 } while(0)
38 #define BUG_ON(cond) do { \
39 if (unlikely(cond)) \
40 BUG(); \
41 } while(0)
42 #define assert(cond) do { \
43 if (unlikely(!(cond))) \
44 BUG(); \
45 } while(0)
46 #define assert(cond) do { \
47 if (unlikely(!(cond))) \
48 BUG(); \
49 } while(0)
51 #define FIXME(fmt, ...) sclp_msg("FIXME @ " __FILE__ ":%d: " fmt, __LINE__, ##__VA_ARGS__)
53 #include <config.h>
56 * stdio.h equivalents
58 struct virt_cons;
60 extern int con_printf(struct virt_cons *con, const char *fmt, ...)
61 __attribute__ ((format (printf, 2, 3)));
62 extern int con_vprintf(struct virt_cons *con, const char *fmt, va_list args)
63 __attribute__ ((format (printf, 2, 0)));
65 #endif
67 #endif