diff options
-rw-r--r-- | sys/boot/efi/libefi/elf_freebsd.c | 18 | ||||
-rw-r--r-- | sys/boot/efi/loader/main.c | 36 | ||||
-rw-r--r-- | sys/boot/ia64/common/exec.c | 18 | ||||
-rw-r--r-- | sys/boot/ia64/efi/main.c | 36 |
4 files changed, 42 insertions, 66 deletions
diff --git a/sys/boot/efi/libefi/elf_freebsd.c b/sys/boot/efi/libefi/elf_freebsd.c index 5f534b25b763..93cfdbde2e3b 100644 --- a/sys/boot/efi/libefi/elf_freebsd.c +++ b/sys/boot/efi/libefi/elf_freebsd.c @@ -137,7 +137,7 @@ elf64_exec(struct preloaded_file *fp) { struct file_metadata *md; Elf_Ehdr *hdr; - struct ia64_pte pte; + pt_entry_t pte; struct bootinfo *bi; u_int64_t psr; UINTN mapkey, pages, size; @@ -193,25 +193,17 @@ elf64_exec(struct preloaded_file *fp) ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (28 << 2)); ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2)); - bzero(&pte, sizeof(pte)); - pte.pte_p = 1; - pte.pte_ma = PTE_MA_WB; - pte.pte_a = 1; - pte.pte_d = 1; - pte.pte_pl = PTE_PL_KERN; - pte.pte_ar = PTE_AR_RWX; - pte.pte_ppn = 0; + pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | + PTE_PL_KERN | PTE_AR_RWX; __asm __volatile("mov cr.ifa=%0" :: "r"(IA64_RR_BASE(7))); __asm __volatile("mov cr.itir=%0" :: "r"(28 << 2)); __asm __volatile("ptr.i %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2)); __asm __volatile("ptr.d %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2)); __asm __volatile("srlz.i;;"); - __asm __volatile("itr.i itr[%0]=%1;;" - :: "r"(0), "r"(*(u_int64_t*)&pte)); + __asm __volatile("itr.i itr[%0]=%1;;" :: "r"(0), "r"(pte)); __asm __volatile("srlz.i;;"); - __asm __volatile("itr.d dtr[%0]=%1;;" - :: "r"(0), "r"(*(u_int64_t*)&pte)); + __asm __volatile("itr.d dtr[%0]=%1;;" :: "r"(0), "r"(pte)); __asm __volatile("srlz.i;;"); enter_kernel(hdr->e_entry, bi); diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c index 30b4f257e04c..64916836dcff 100644 --- a/sys/boot/efi/loader/main.c +++ b/sys/boot/efi/loader/main.c @@ -387,7 +387,7 @@ print_trs(int type) struct ia64_pal_result res; int i, maxtr; struct { - struct ia64_pte pte; + pt_entry_t pte; struct ia64_itir itir; uint64_t ifa; struct ia64_rr rr; @@ -436,28 +436,24 @@ print_trs(int type) continue; if (!(res.pal_result[0] & 1)) - buf.pte.pte_ar = 0; + buf.pte &= ~PTE_AR_MASK; if (!(res.pal_result[0] & 2)) - buf.pte.pte_pl = 0; + buf.pte &= ~PTE_PL_MASK; if (!(res.pal_result[0] & 4)) - buf.pte.pte_d = 0; + buf.pte &= ~PTE_DIRTY; if (!(res.pal_result[0] & 8)) - buf.pte.pte_ma = 0; - sprintf(lbuf, - "%03d %06x %013lx %013lx %4s %d %d %d %d %d %-3s %d %06x\n", - i, - buf.rr.rr_rid, - buf.ifa >> 12, - buf.pte.pte_ppn, - psnames[buf.itir.itir_ps], - buf.pte.pte_ed, - buf.pte.pte_ar, - buf.pte.pte_pl, - buf.pte.pte_d, - buf.pte.pte_a, - manames[buf.pte.pte_ma], - buf.pte.pte_p, - buf.itir.itir_key); + buf.pte &= ~PTE_MA_MASK; + sprintf(lbuf, "%03d %06x %013lx %013lx %4s %d %d %d %d %d " + "%-3s %d %06x\n", i, buf.rr.rr_rid, buf.ifa >> 12, + (buf.pte & PTE_PPN_MASK) >> 12, psnames[buf.itir.ps], + (buf.pte & PTE_ED) ? 1 : 0, + (int)(buf.pte & PTE_AR_MASK) >> 9, + (int)(buf.pte & PTE_PL_MASK) >> 7, + (buf.pte & PTE_DIRTY) ? 1 : 0, + (buf.pte & PTE_ACCESSED) ? 1 : 0, + manames[(buf.pte & PTE_MA_MASK) >> 2], + (buf.pte & PTE_PRESENT) ? 1 : 0, + buf.itir.key); pager_output(lbuf); } pager_close(); diff --git a/sys/boot/ia64/common/exec.c b/sys/boot/ia64/common/exec.c index 5f534b25b763..93cfdbde2e3b 100644 --- a/sys/boot/ia64/common/exec.c +++ b/sys/boot/ia64/common/exec.c @@ -137,7 +137,7 @@ elf64_exec(struct preloaded_file *fp) { struct file_metadata *md; Elf_Ehdr *hdr; - struct ia64_pte pte; + pt_entry_t pte; struct bootinfo *bi; u_int64_t psr; UINTN mapkey, pages, size; @@ -193,25 +193,17 @@ elf64_exec(struct preloaded_file *fp) ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (28 << 2)); ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2)); - bzero(&pte, sizeof(pte)); - pte.pte_p = 1; - pte.pte_ma = PTE_MA_WB; - pte.pte_a = 1; - pte.pte_d = 1; - pte.pte_pl = PTE_PL_KERN; - pte.pte_ar = PTE_AR_RWX; - pte.pte_ppn = 0; + pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | + PTE_PL_KERN | PTE_AR_RWX; __asm __volatile("mov cr.ifa=%0" :: "r"(IA64_RR_BASE(7))); __asm __volatile("mov cr.itir=%0" :: "r"(28 << 2)); __asm __volatile("ptr.i %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2)); __asm __volatile("ptr.d %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2)); __asm __volatile("srlz.i;;"); - __asm __volatile("itr.i itr[%0]=%1;;" - :: "r"(0), "r"(*(u_int64_t*)&pte)); + __asm __volatile("itr.i itr[%0]=%1;;" :: "r"(0), "r"(pte)); __asm __volatile("srlz.i;;"); - __asm __volatile("itr.d dtr[%0]=%1;;" - :: "r"(0), "r"(*(u_int64_t*)&pte)); + __asm __volatile("itr.d dtr[%0]=%1;;" :: "r"(0), "r"(pte)); __asm __volatile("srlz.i;;"); enter_kernel(hdr->e_entry, bi); diff --git a/sys/boot/ia64/efi/main.c b/sys/boot/ia64/efi/main.c index 30b4f257e04c..64916836dcff 100644 --- a/sys/boot/ia64/efi/main.c +++ b/sys/boot/ia64/efi/main.c @@ -387,7 +387,7 @@ print_trs(int type) struct ia64_pal_result res; int i, maxtr; struct { - struct ia64_pte pte; + pt_entry_t pte; struct ia64_itir itir; uint64_t ifa; struct ia64_rr rr; @@ -436,28 +436,24 @@ print_trs(int type) continue; if (!(res.pal_result[0] & 1)) - buf.pte.pte_ar = 0; + buf.pte &= ~PTE_AR_MASK; if (!(res.pal_result[0] & 2)) - buf.pte.pte_pl = 0; + buf.pte &= ~PTE_PL_MASK; if (!(res.pal_result[0] & 4)) - buf.pte.pte_d = 0; + buf.pte &= ~PTE_DIRTY; if (!(res.pal_result[0] & 8)) - buf.pte.pte_ma = 0; - sprintf(lbuf, - "%03d %06x %013lx %013lx %4s %d %d %d %d %d %-3s %d %06x\n", - i, - buf.rr.rr_rid, - buf.ifa >> 12, - buf.pte.pte_ppn, - psnames[buf.itir.itir_ps], - buf.pte.pte_ed, - buf.pte.pte_ar, - buf.pte.pte_pl, - buf.pte.pte_d, - buf.pte.pte_a, - manames[buf.pte.pte_ma], - buf.pte.pte_p, - buf.itir.itir_key); + buf.pte &= ~PTE_MA_MASK; + sprintf(lbuf, "%03d %06x %013lx %013lx %4s %d %d %d %d %d " + "%-3s %d %06x\n", i, buf.rr.rr_rid, buf.ifa >> 12, + (buf.pte & PTE_PPN_MASK) >> 12, psnames[buf.itir.ps], + (buf.pte & PTE_ED) ? 1 : 0, + (int)(buf.pte & PTE_AR_MASK) >> 9, + (int)(buf.pte & PTE_PL_MASK) >> 7, + (buf.pte & PTE_DIRTY) ? 1 : 0, + (buf.pte & PTE_ACCESSED) ? 1 : 0, + manames[(buf.pte & PTE_MA_MASK) >> 2], + (buf.pte & PTE_PRESENT) ? 1 : 0, + buf.itir.key); pager_output(lbuf); } pager_close(); |