1 /*
2  * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
3  *
4  */
5 
6 #include <xen/types.h>
7 
8 #include <asm/alternative.h>
9 #include <asm/livepatch.h>
10 #ifdef CONFIG_X86
11 #include <asm/nops.h>
12 #include <asm/uaccess.h>
13 
14 static unsigned long *non_canonical_addr = (unsigned long *)0xdead000000000000ULL;
15 #endif
16 
17 /* Our replacement function for xen_extra_version. */
xen_hello_world(void)18 const char *xen_hello_world(void)
19 {
20 #ifdef CONFIG_X86
21     unsigned long tmp;
22     int rc;
23 
24     alternative(ASM_NOP8, ASM_NOP1, LIVEPATCH_FEATURE);
25     /*
26      * Any BUG, or WARN_ON will contain symbol and payload name. Furthermore
27      * exceptions will be caught and processed properly.
28      */
29     rc = __get_user(tmp, non_canonical_addr);
30     BUG_ON(rc != -EFAULT);
31 #endif
32 #if defined(CONFIG_ARM) && defined(CONFIG_HAS_ALTERNATIVE)
33     asm(ALTERNATIVE("nop", "nop", LIVEPATCH_FEATURE));
34 #endif
35 
36     return "Hello World";
37 }
38 
39 /*
40  * Local variables:
41  * mode: C
42  * c-file-style: "BSD"
43  * c-basic-offset: 4
44  * tab-width: 4
45  * indent-tabs-mode: nil
46  * End:
47  */
48