From owner-svn-src-projects@FreeBSD.ORG Mon Aug 17 12:14:40 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDA1D106568D; Mon, 17 Aug 2009 12:14:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC3268FC65; Mon, 17 Aug 2009 12:14:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HCEeT6075391; Mon, 17 Aug 2009 12:14:40 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HCEeZD075387; Mon, 17 Aug 2009 12:14:40 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200908171214.n7HCEeZD075387@svn.freebsd.org> From: Warner Losh Date: Mon, 17 Aug 2009 12:14:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196313 - projects/mips/sys/mips/mips X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 12:14:40 -0000 Author: imp Date: Mon Aug 17 12:14:40 2009 New Revision: 196313 URL: http://svn.freebsd.org/changeset/base/196313 Log: suword64 and csuword64. Needed by ELF64 stuff... Modified: projects/mips/sys/mips/mips/elf_machdep.c projects/mips/sys/mips/mips/pmap.c projects/mips/sys/mips/mips/support.S Modified: projects/mips/sys/mips/mips/elf_machdep.c ============================================================================== --- projects/mips/sys/mips/mips/elf_machdep.c Mon Aug 17 10:21:37 2009 (r196312) +++ projects/mips/sys/mips/mips/elf_machdep.c Mon Aug 17 12:14:40 2009 (r196313) @@ -47,6 +47,59 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __mips_n64 +struct sysentvec elf64_freebsd_sysvec = { + .sv_size = SYS_MAXSYSCALL, + .sv_table = sysent, + .sv_mask = 0, + .sv_sigsize = 0, + .sv_sigtbl = NULL, + .sv_errsize = 0, + .sv_errtbl = NULL, + .sv_transtrap = NULL, + .sv_fixup = __elfN(freebsd_fixup), + .sv_sendsig = sendsig, + .sv_sigcode = sigcode, + .sv_szsigcode = &szsigcode, + .sv_prepsyscall = NULL, + .sv_name = "FreeBSD ELF64", + .sv_coredump = __elfN(coredump), + .sv_imgact_try = NULL, + .sv_minsigstksz = MINSIGSTKSZ, + .sv_pagesize = PAGE_SIZE, + .sv_minuser = VM_MIN_ADDRESS, + .sv_maxuser = VM_MAXUSER_ADDRESS, + .sv_usrstack = USRSTACK, + .sv_psstrings = PS_STRINGS, + .sv_stackprot = VM_PROT_ALL, + .sv_copyout_strings = exec_copyout_strings, + .sv_setregs = exec_setregs, + .sv_fixlimit = NULL, + .sv_maxssiz = NULL, + .sv_flags = SV_ABI_FREEBSD | SV_LP64 +}; + +static Elf64_Brandinfo freebsd_brand_info = { + .brand = ELFOSABI_FREEBSD, + .machine = EM_MIPS, + .compat_3_brand = "FreeBSD", + .emul_path = NULL, + .interp_path = "/libexec/ld-elf.so.1", + .sysvec = &elf64_freebsd_sysvec, + .interp_newpath = NULL, + .flags = 0 +}; + +SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, + (sysinit_cfunc_t) elf64_insert_brand_entry, + &freebsd_brand_info); + +void +elf64_dump_thread(struct thread *td __unused, void *dst __unused, + size_t *off __unused) +{ +} +#else struct sysentvec elf32_freebsd_sysvec = { .sv_size = SYS_MAXSYSCALL, .sv_table = sysent, @@ -98,6 +151,7 @@ elf32_dump_thread(struct thread *td __un size_t *off __unused) { } +#endif /* Process one elf relocation with addend. */ static int Modified: projects/mips/sys/mips/mips/pmap.c ============================================================================== --- projects/mips/sys/mips/mips/pmap.c Mon Aug 17 10:21:37 2009 (r196312) +++ projects/mips/sys/mips/mips/pmap.c Mon Aug 17 12:14:40 2009 (r196313) @@ -314,6 +314,8 @@ again: } } + Maxmem = atop(phys_avail[i - 1]); + if (bootverbose) { printf("Physical memory chunk(s):\n"); for (i = 0; phys_avail[i + 1] != 0; i += 2) { @@ -325,6 +327,7 @@ again: (uintmax_t) phys_avail[i + 1] - 1, (uintmax_t) size, (uintmax_t) size / PAGE_SIZE); } + printf("Maxmem is 0x%0lx\n", ptoa(Maxmem)); } /* * Steal the message buffer from the beginning of memory. @@ -398,21 +401,15 @@ again: for (i = 0, pte = pgtab; i < (nkpt * NPTEPG); i++, pte++) *pte = PTE_G; - printf("Va=0x%x Ve=%x\n", virtual_avail, virtual_end); /* * The segment table contains the KVA of the pages in the second * level page table. */ - printf("init kernel_segmap va >> = %d nkpt:%d\n", - (virtual_avail >> SEGSHIFT), - nkpt); for (i = 0, j = (virtual_avail >> SEGSHIFT); i < nkpt; i++, j++) kernel_segmap[j] = (pd_entry_t)(pgtab + (i * NPTEPG)); for (i = 0; phys_avail[i + 2]; i += 2) continue; - printf("avail_start:0x%x avail_end:0x%x\n", - phys_avail[0], phys_avail[i + 1]); /* * The kernel's pmap is statically allocated so we don't have to use @@ -1793,8 +1790,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, * Page Directory table entry not valid, we need a new PT page */ if (pte == NULL) { - panic("pmap_enter: invalid page directory, pdir=%p, va=0x%x\n", - (void *)pmap->pm_segtab, va); + panic("pmap_enter: invalid page directory, pdir=%p, va=%p\n", + (void *)pmap->pm_segtab, (void *)va); } pa = VM_PAGE_TO_PHYS(m); om = NULL; @@ -1855,7 +1852,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, mpte->wire_count--; KASSERT(mpte->wire_count > 0, ("pmap_enter: missing reference to page table page," - " va: 0x%x", va)); + " va: %p", (void *)va)); } } else pmap->pm_stats.resident_count++; @@ -1917,7 +1914,7 @@ validate: if (origpte & PTE_M) { KASSERT((origpte & PTE_RW), ("pmap_enter: modified page not writable:" - " va: 0x%x, pte: 0x%lx", va, origpte)); + " va: %p, pte: 0x%lx", (void *)va, origpte)); if (page_is_managed(opa)) vm_page_dirty(om); } @@ -2254,7 +2251,7 @@ pmap_zero_page(vm_page_t m) #endif if (phys < MIPS_KSEG0_LARGEST_PHYS) { - va = MIPS_PHYS_TO_UNCACHED(phys); + va = MIPS_PHYS_TO_CACHED(phys); bzero((caddr_t)va, PAGE_SIZE); mips_dcache_wbinv_range(va, PAGE_SIZE); @@ -2310,7 +2307,7 @@ pmap_zero_page_area(vm_page_t m, int off } else #endif if (phys < MIPS_KSEG0_LARGEST_PHYS) { - va = MIPS_PHYS_TO_UNCACHED(phys); + va = MIPS_PHYS_TO_CACHED(phys); bzero((char *)(caddr_t)va + off, size); mips_dcache_wbinv_range(va + off, size); } else { @@ -2349,7 +2346,7 @@ pmap_zero_page_idle(vm_page_t m) } else #endif if (phys < MIPS_KSEG0_LARGEST_PHYS) { - va = MIPS_PHYS_TO_UNCACHED(phys); + va = MIPS_PHYS_TO_CACHED(phys); bzero((caddr_t)va, PAGE_SIZE); mips_dcache_wbinv_range(va, PAGE_SIZE); } else { @@ -2835,11 +2832,12 @@ pmap_mapdev(vm_offset_t pa, vm_size_t si return (void *)MIPS_PHYS_TO_KSEG1(pa); else { offset = pa & PAGE_MASK; - size = roundup(size, PAGE_SIZE); + size = roundup(size + offset, PAGE_SIZE); va = kmem_alloc_nofault(kernel_map, size); if (!va) panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); + pa = trunc_page(pa); for (tmpva = va; size > 0;) { pmap_kenter(tmpva, pa); size -= PAGE_SIZE; @@ -2854,6 +2852,18 @@ pmap_mapdev(vm_offset_t pa, vm_size_t si void pmap_unmapdev(vm_offset_t va, vm_size_t size) { + vm_offset_t base, offset, tmpva; + + /* If the address is within KSEG1 then there is nothing to do */ + if (va >= MIPS_KSEG1_START && va <= MIPS_KSEG1_END) + return; + + base = trunc_page(va); + offset = va & PAGE_MASK; + size = roundup(size + offset, PAGE_SIZE); + for (tmpva = base; tmpva < base + size; tmpva += PAGE_SIZE) + pmap_kremove(tmpva); + kmem_free(kernel_map, base, size); } /* @@ -2990,7 +3000,7 @@ pmap_pid_dump(int pid) pde = &pmap->pm_segtab[i]; if (pde && pmap_pde_v(pde)) { for (j = 0; j < 1024; j++) { - unsigned va = base + + vm_offset_t va = base + (j << PAGE_SHIFT); pte = pmap_pte(pmap, va); @@ -3000,8 +3010,9 @@ pmap_pid_dump(int pid) pa = mips_tlbpfn_to_paddr(*pte); m = PHYS_TO_VM_PAGE(pa); - printf("va: 0x%x, pt: 0x%x, h: %d, w: %d, f: 0x%x", - va, pa, + printf("va: %p, pt: %p, h: %d, w: %d, f: 0x%x", + (void *)va, + (void *)pa, m->hold_count, m->wire_count, m->flags); Modified: projects/mips/sys/mips/mips/support.S ============================================================================== --- projects/mips/sys/mips/mips/support.S Mon Aug 17 10:21:37 2009 (r196312) +++ projects/mips/sys/mips/mips/support.S Mon Aug 17 12:14:40 2009 (r196313) @@ -460,8 +460,10 @@ ALEAF(fuibyte) sw zero, U_PCB_ONFAULT(v1) END(fubyte) -LEAF(suword) -XLEAF(suword32) +LEAF(suword32) +#ifndef __mips_n64 +XLEAF(suword) +#endif blt a0, zero, fswberr # make sure address is in user space li v0, FSWBERR GET_CPU_PCPU(v1) @@ -471,15 +473,36 @@ XLEAF(suword32) sw zero, U_PCB_ONFAULT(v1) j ra move v0, zero -END(suword) +END(suword32) + +#ifdef __mips_n64 +LEAF(suword64) +XLEAF(suword) + blt a0, zero, fswberr # make sure address is in user space + li v0, FSWBERR + GET_CPU_PCPU(v1) + lw v1, PC_CURPCB(v1) + sw v0, U_PCB_ONFAULT(v1) + sd a1, 0(a0) # store word + sw zero, U_PCB_ONFAULT(v1) + j ra + move v0, zero +END(suword64) +#endif /* - * XXXMIPS: ATM it's the same as casuword32, but MIPS64 will require - * own implementation * casuword(9) * u_long casuword(u_long *p, u_long oldval, u_long newval) */ -ENTRY(casuword) +/* + * casuword32(9) + * uint32_t casuword(uint32_t *p, uint32_t oldval, + * uint32_t newval) + */ +LEAF(casuword32) +#ifndef __mips_n64 +XLEAF(casuword) +#endif blt a0, zero, fswberr # make sure address is in user space li v0, FSWBERR GET_CPU_PCPU(v1) @@ -501,14 +524,11 @@ ENTRY(casuword) sw zero, U_PCB_ONFAULT(v1) jr ra nop -END(casuword) +END(casuword32) -/* - * casuword32(9) - * uint32_t casuword(uint32_t *p, uint32_t oldval, - * uint32_t newval) - */ -ENTRY(casuword32) +#ifdef __mips_n64 +LEAF(casuword64) +XLEAF(casuword) blt a0, zero, fswberr # make sure address is in user space li v0, FSWBERR GET_CPU_PCPU(v1) @@ -516,10 +536,10 @@ ENTRY(casuword32) sw v0, U_PCB_ONFAULT(v1) 1: move t0, a2 - ll v0, 0(a0) + lld v0, 0(a0) bne a1, v0, 2f nop - sc t0, 0(a0) # store word + scd t0, 0(a0) # store double word beqz t0, 1b nop j 3f @@ -530,7 +550,8 @@ ENTRY(casuword32) sw zero, U_PCB_ONFAULT(v1) jr ra nop -END(casuword32) +END(casuword64) +#endif #if 0 /* unused in FreeBSD */ From owner-svn-src-projects@FreeBSD.ORG Mon Aug 17 12:23:58 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A6DB106568E; Mon, 17 Aug 2009 12:23:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A1FB8FC67; Mon, 17 Aug 2009 12:23:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HCNwSY076195; Mon, 17 Aug 2009 12:23:58 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HCNwUC076193; Mon, 17 Aug 2009 12:23:58 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200908171223.n7HCNwUC076193@svn.freebsd.org> From: Warner Losh Date: Mon, 17 Aug 2009 12:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196314 - projects/mips/sys/mips/octeon1 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 12:23:58 -0000 Author: imp Date: Mon Aug 17 12:23:58 2009 New Revision: 196314 URL: http://svn.freebsd.org/changeset/base/196314 Log: Implement platform_reset. Also, make the code a tiny bit easier to read with ninja-C magic coupled with an illuminating comment. Modified: projects/mips/sys/mips/octeon1/octeon_machdep.c Modified: projects/mips/sys/mips/octeon1/octeon_machdep.c ============================================================================== --- projects/mips/sys/mips/octeon1/octeon_machdep.c Mon Aug 17 12:14:40 2009 (r196313) +++ projects/mips/sys/mips/octeon1/octeon_machdep.c Mon Aug 17 12:23:58 2009 (r196314) @@ -85,10 +85,10 @@ extern int *end; * Perform a board-level soft-reset. * Note that this is not emulated by gxemul. */ -void octeon_reset (void) +void +platform_reset(void) { - void (*reset_func)(void) = (void (*)(void) )0x1fc00000; - reset_func(); + ((void(*)(void))0x1fc00000)(); /* Jump to this hex address */ } From owner-svn-src-projects@FreeBSD.ORG Mon Aug 17 12:37:06 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCD601065691; Mon, 17 Aug 2009 12:37:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC97F8FC59; Mon, 17 Aug 2009 12:37:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HCb6wJ077650; Mon, 17 Aug 2009 12:37:06 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HCb6EC077648; Mon, 17 Aug 2009 12:37:06 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200908171237.n7HCb6EC077648@svn.freebsd.org> From: Warner Losh Date: Mon, 17 Aug 2009 12:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196315 - projects/mips/sys/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 12:37:06 -0000 Author: imp Date: Mon Aug 17 12:37:06 2009 New Revision: 196315 URL: http://svn.freebsd.org/changeset/base/196315 Log: Like qdivrem, remove the other quad_t support stuff from 64-bit kernels. # OCTEON1 now links! Modified: projects/mips/sys/conf/files.mips Modified: projects/mips/sys/conf/files.mips ============================================================================== --- projects/mips/sys/conf/files.mips Mon Aug 17 12:23:58 2009 (r196314) +++ projects/mips/sys/conf/files.mips Mon Aug 17 12:37:06 2009 (r196315) @@ -81,16 +81,16 @@ geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr libkern/ashldi3.c standard libkern/ashrdi3.c standard -libkern/divdi3.c standard +libkern/divdi3.c optional isa_mips32 libkern/ffsl.c standard libkern/fls.c standard libkern/flsl.c standard libkern/lshrdi3.c standard libkern/memmove.c standard -libkern/moddi3.c standard +libkern/moddi3.c optional isa_mips32 libkern/qdivrem.c optional isa_mips32 -libkern/udivdi3.c standard -libkern/umoddi3.c standard +libkern/udivdi3.c optional isa_mips32 +libkern/umoddi3.c optional isa_mips32 #XXX: We can't use these versions, as strcmp.c is included conf/files #libkern/mips/strcmp.S standard