1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 3 #include "qemu/osdep.h" 4 #include "qemu.h" 5 #include "loader.h" 6 #include "target_elf.h" 7 8 9 const char *get_elf_cpu_model(uint32_t eflags) 10 { 11 return "hppa"; 12 } 13 14 const char *get_elf_platform(CPUState *cs) 15 { 16 return "PARISC"; 17 } 18 19 bool init_guest_commpage(void) 20 { 21 /* If reserved_va, then we have already mapped 0 page on the host. */ 22 if (!reserved_va) { 23 void *want, *addr; 24 25 want = g2h_untagged(LO_COMMPAGE); 26 addr = mmap(want, TARGET_PAGE_SIZE, PROT_NONE, 27 MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED_NOREPLACE, -1, 0); 28 if (addr == MAP_FAILED) { 29 perror("Allocating guest commpage"); 30 exit(EXIT_FAILURE); 31 } 32 if (addr != want) { 33 return false; 34 } 35 } 36 37 /* 38 * On Linux, page zero is normally marked execute only + gateway. 39 * Normal read or write is supposed to fail (thus PROT_NONE above), 40 * but specific offsets have kernel code mapped to raise permissions 41 * and implement syscalls. Here, simply mark the page executable. 42 * Special case the entry points during translation (see do_page_zero). 43 */ 44 page_set_flags(LO_COMMPAGE, LO_COMMPAGE | ~TARGET_PAGE_MASK, 45 PAGE_EXEC | PAGE_VALID, PAGE_VALID); 46 return true; 47 } 48