Date: Fri, 25 Jul 2003 23:17:25 -0700 (PDT) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 35024 for review Message-ID: <200307260617.h6Q6HPYg004561@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=35024 Change 35024 by marcel@marcel_nfs on 2003/07/25 23:16:37 IFC @35023 Affected files ... .. //depot/projects/uart/alpha/alpha/machdep.c#4 integrate .. //depot/projects/uart/alpha/alpha/pmap.c#5 integrate .. //depot/projects/uart/alpha/alpha/support.s#3 integrate .. //depot/projects/uart/alpha/include/alpha_cpu.h#2 integrate .. //depot/projects/uart/alpha/include/ucontext.h#2 integrate .. //depot/projects/uart/amd64/acpica/OsdEnvironment.c#2 integrate .. //depot/projects/uart/amd64/acpica/acpi_machdep.c#2 integrate .. //depot/projects/uart/amd64/acpica/acpi_wakeup.c#2 integrate .. //depot/projects/uart/amd64/amd64/amd64-gdbstub.c#2 integrate .. //depot/projects/uart/amd64/amd64/atomic.c#2 integrate .. //depot/projects/uart/amd64/amd64/autoconf.c#2 integrate .. //depot/projects/uart/amd64/amd64/critical.c#2 integrate .. //depot/projects/uart/amd64/amd64/db_disasm.c#2 integrate .. //depot/projects/uart/amd64/amd64/db_interface.c#2 integrate .. //depot/projects/uart/amd64/amd64/db_trace.c#2 integrate .. //depot/projects/uart/amd64/amd64/dump_machdep.c#2 integrate .. //depot/projects/uart/amd64/amd64/elf_machdep.c#2 integrate .. //depot/projects/uart/amd64/amd64/genassym.c#2 integrate .. //depot/projects/uart/amd64/amd64/identcpu.c#2 integrate .. //depot/projects/uart/amd64/amd64/in_cksum.c#2 integrate .. //depot/projects/uart/amd64/amd64/initcpu.c#2 integrate .. //depot/projects/uart/amd64/amd64/legacy.c#2 integrate .. //depot/projects/uart/amd64/amd64/machdep.c#3 integrate .. //depot/projects/uart/amd64/amd64/mem.c#2 integrate .. //depot/projects/uart/amd64/amd64/nexus.c#2 integrate .. //depot/projects/uart/amd64/amd64/pmap.c#7 integrate .. //depot/projects/uart/amd64/amd64/sys_machdep.c#2 integrate .. //depot/projects/uart/amd64/amd64/trap.c#2 integrate .. //depot/projects/uart/amd64/amd64/tsc.c#2 integrate .. //depot/projects/uart/amd64/amd64/vm_machdep.c#2 integrate .. //depot/projects/uart/amd64/ia32/ia32_genassym.c#2 integrate .. //depot/projects/uart/amd64/ia32/ia32_misc.c#2 integrate .. //depot/projects/uart/amd64/ia32/ia32_signal.c#2 integrate .. //depot/projects/uart/amd64/ia32/ia32_syscall.c#2 integrate .. //depot/projects/uart/amd64/ia32/ia32_sysvec.c#2 integrate .. //depot/projects/uart/amd64/isa/clock.c#2 integrate .. //depot/projects/uart/amd64/isa/intr_machdep.c#2 integrate .. //depot/projects/uart/amd64/isa/isa.c#2 integrate .. //depot/projects/uart/amd64/isa/isa_dma.c#2 integrate .. //depot/projects/uart/amd64/isa/ithread.c#2 integrate .. //depot/projects/uart/amd64/isa/npx.c#2 integrate .. //depot/projects/uart/amd64/pci/pci_bus.c#2 integrate .. //depot/projects/uart/amd64/pci/pci_cfgreg.c#2 integrate .. //depot/projects/uart/conf/kern.pre.mk#4 integrate .. //depot/projects/uart/conf/kmod.mk#3 integrate .. //depot/projects/uart/dev/acpica/acpi_ec.c#6 integrate .. //depot/projects/uart/dev/bge/if_bge.c#4 integrate .. //depot/projects/uart/dev/bge/if_bgereg.h#3 integrate .. //depot/projects/uart/dev/firewire/fwohcireg.h#2 integrate .. //depot/projects/uart/fs/ntfs/ntfs_subr.c#2 integrate .. //depot/projects/uart/fs/ntfs/ntfs_vfsops.c#2 integrate .. //depot/projects/uart/fs/smbfs/smbfs_vfsops.c#2 integrate .. //depot/projects/uart/ia64/conf/SKI#2 integrate .. //depot/projects/uart/ia64/ia64/machdep.c#3 integrate .. //depot/projects/uart/ia64/ia64/mem.c#2 integrate .. //depot/projects/uart/ia64/ia64/pmap.c#5 integrate .. //depot/projects/uart/ia64/ia64/trap.c#3 integrate .. //depot/projects/uart/ia64/include/_regset.h#3 integrate .. //depot/projects/uart/ia64/include/setjmp.h#2 integrate .. //depot/projects/uart/kern/kern_descrip.c#4 integrate .. //depot/projects/uart/kern/kern_sig.c#6 integrate .. //depot/projects/uart/libkern/scanc.c#2 integrate .. //depot/projects/uart/netatm/atm_cm.c#3 integrate .. //depot/projects/uart/netatm/atm_device.c#3 integrate .. //depot/projects/uart/netatm/atm_if.c#3 integrate .. //depot/projects/uart/netatm/atm_ioctl.h#2 integrate .. //depot/projects/uart/netatm/atm_proto.c#2 integrate .. //depot/projects/uart/netatm/atm_socket.c#3 integrate .. //depot/projects/uart/netatm/atm_subr.c#4 integrate .. //depot/projects/uart/netatm/atm_var.h#2 integrate .. //depot/projects/uart/netatm/ipatm/ipatm_input.c#2 integrate .. //depot/projects/uart/netatm/ipatm/ipatm_load.c#3 integrate .. //depot/projects/uart/netatm/ipatm/ipatm_output.c#2 integrate .. //depot/projects/uart/netatm/ipatm/ipatm_usrreq.c#2 integrate .. //depot/projects/uart/netatm/ipatm/ipatm_var.h#2 integrate .. //depot/projects/uart/netatm/ipatm/ipatm_vcm.c#3 integrate .. //depot/projects/uart/netatm/spans/spans_cls.c#3 integrate .. //depot/projects/uart/netatm/spans/spans_proto.c#2 integrate .. //depot/projects/uart/netatm/spans/spans_var.h#2 integrate .. //depot/projects/uart/netatm/uni/sscf_uni.c#3 integrate .. //depot/projects/uart/netatm/uni/sscf_uni_lower.c#2 integrate .. //depot/projects/uart/netatm/uni/sscf_uni_var.h#2 integrate .. //depot/projects/uart/netatm/uni/sscop_pdu.c#2 integrate .. //depot/projects/uart/netatm/uni/sscop_var.h#2 integrate .. //depot/projects/uart/netatm/uni/uniarp.c#3 integrate .. //depot/projects/uart/netatm/uni/uniarp_input.c#2 integrate .. //depot/projects/uart/netatm/uni/uniip_var.h#2 integrate .. //depot/projects/uart/netatm/uni/unisig_msg.c#3 integrate .. //depot/projects/uart/netatm/uni/unisig_proto.c#2 integrate .. //depot/projects/uart/netatm/uni/unisig_var.h#2 integrate .. //depot/projects/uart/netinet/ip_dummynet.c#2 integrate .. //depot/projects/uart/netncp/ncp_ncp.c#2 integrate .. //depot/projects/uart/netsmb/smb_usr.c#2 integrate .. //depot/projects/uart/sys/cdefs.h#3 integrate .. //depot/projects/uart/vm/uma_core.c#3 integrate .. //depot/projects/uart/vm/vm_contig.c#4 integrate Differences ... ==== //depot/projects/uart/alpha/alpha/machdep.c#4 (text+ko) ==== @@ -88,7 +88,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.205 2003/07/15 00:11:03 davidxu Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.207 2003/07/24 07:49:44 marcel Exp $"); #include "opt_compat.h" #include "opt_ddb.h" @@ -2033,8 +2033,11 @@ * When the thread is the current thread, the user stack pointer * is not in the PCB; it must be read from the PAL. */ - if (td == curthread) + if (td == curthread) { mcp->mc_regs[FRAME_SP] = alpha_pal_rdusp(); + mcp->mc_thrptr = alpha_pal_rdunique(); + } else + mcp->mc_thrptr = td->td_pcb->pcb_hw.apcb_unique; mcp->mc_format = _MC_REV0_TRAPFRAME; PROC_LOCK(curthread->td_proc); @@ -2056,6 +2059,12 @@ else if ((ret = set_fpcontext(td, mcp)) != 0) return (ret); + /* + * NOTE: We only need to restore mc_thrptr when the ucontext format + * is _MC_REV0_TRAPFRAME. Only get_mcontext() above creates such + * contexts and that's also the only place where we save the thread + * pointer in the context. + */ if (mcp->mc_format == _MC_REV0_SIGFRAME) { set_regs(td, (struct reg *)&mcp->mc_regs); val = (mcp->mc_regs[R_PS] | ALPHA_PSL_USERSET) & @@ -2065,10 +2074,13 @@ td->td_frame->tf_regs[FRAME_FLAGS] = 0; if (td == curthread) alpha_pal_wrusp(mcp->mc_regs[R_SP]); - } else { - if (td == curthread) + if (td == curthread) { alpha_pal_wrusp(mcp->mc_regs[FRAME_SP]); + alpha_pal_wrunique(mcp->mc_thrptr); + } else + td->td_pcb->pcb_hw.apcb_unique = mcp->mc_thrptr; + /* * The context is a trapframe, so just copy it over the * threads frame. @@ -2370,9 +2382,3 @@ pcpu->pc_idlepcb.apcb_ptbr = thread0.td_pcb->pcb_hw.apcb_ptbr; pcpu->pc_current_asngen = 1; } - -intptr_t -casuptr(intptr_t *p, intptr_t old, intptr_t new) -{ - return (-1); -} ==== //depot/projects/uart/alpha/alpha/pmap.c#5 (text+ko) ==== @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.130 2003/07/06 20:32:42 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/pmap.c,v 1.131 2003/07/25 18:58:39 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -2130,7 +2130,7 @@ mpte = NULL; for (i = 0; i < PAGEORDER_SIZE; i++) { - vm_object_t lobject; + vm_object_t backing_object, lobject; pt_entry_t *pte; addr = addra + pmap_prefault_pageorder[i]; @@ -2150,15 +2150,18 @@ pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; lobject = object; - for (m = vm_page_lookup(lobject, pindex); - (!m && (lobject->type == OBJT_DEFAULT) && (lobject->backing_object)); - lobject = lobject->backing_object) { + VM_OBJECT_LOCK(lobject); + while ((m = vm_page_lookup(lobject, pindex)) == NULL && + lobject->type == OBJT_DEFAULT && + (backing_object = lobject->backing_object) != NULL) { if (lobject->backing_object_offset & PAGE_MASK) break; - pindex += (lobject->backing_object_offset >> PAGE_SHIFT); - m = vm_page_lookup(lobject->backing_object, pindex); + pindex += lobject->backing_object_offset >> PAGE_SHIFT; + VM_OBJECT_LOCK(backing_object); + VM_OBJECT_UNLOCK(lobject); + lobject = backing_object; } - + VM_OBJECT_UNLOCK(lobject); /* * give-up when a page is not in memory */ ==== //depot/projects/uart/alpha/alpha/support.s#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/alpha/support.s,v 1.14 2003/06/29 17:14:42 marcel Exp $ + * $FreeBSD: src/sys/alpha/alpha/support.s,v 1.15 2003/07/24 07:49:45 marcel Exp $ */ /* @@ -59,7 +59,35 @@ .text /**************************************************************************/ - + +/* + * intptr_t + * casuptr(intptr_t *p, intptr_t old, intptr_t new) + */ + LEAF(casuptr, 3) + LDGP(pv) + + ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ + cmpult a0, t0, t1 + beq t1, fusufault + + lda t0, fusufault /* trap faults */ + ldq t2, PC_CURTHREAD(pcpup) + ldq t2, TD_PCB(t2) + + stq t0, PCB_ONFAULT(t2) +1: + ldq_l v0, 0(a0) /* try to load the old value */ + cmpeq v0, a1, t0 /* compare */ + beq t0, 2f /* exit if not equal */ + mov a2, t0 /* setup value to write */ + stq_c t0, 0(a0) /* write if address still locked */ + beq t0, 1b /* if it failed, spin */ +2: + stq zero, PCB_ONFAULT(t2) /* clean up */ + RET + END(casuptr) + /* * fu{byte,word} : fetch a byte (word) from user memory */ ==== //depot/projects/uart/alpha/include/alpha_cpu.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/alpha/include/alpha_cpu.h,v 1.9 2002/10/25 20:22:12 jhb Exp $ */ +/* $FreeBSD: src/sys/alpha/include/alpha_cpu.h,v 1.10 2003/07/24 07:41:08 marcel Exp $ */ /* From: NetBSD: alpha_cpu.h,v 1.15 1997/09/20 19:02:34 mjacob Exp */ /* @@ -459,6 +459,23 @@ } static __inline void +alpha_pal_wrunique(u_int64_t tp) +{ + register u_int64_t a0 __asm__("$16") = tp; + __asm__ __volatile__("call_pal 0x9f # PAL_wrunique" + : "+r" (a0) : : "$1", "$22", "$23", "$24", "$25"); +} + +static __inline u_int64_t +alpha_pal_rdunique(void) +{ + register u_int64_t v0 __asm__("$0"); + __asm__ __volatile__("call_pal 0x9e # PAL_rdunique" + : "=r" (v0) : : "$1", "$22", "$23", "$24", "$25"); + return (v0); +} + +static __inline void alpha_pal_tbi(u_int64_t op, u_int64_t va) { register u_int64_t a0 __asm__("$16") = op; ==== //depot/projects/uart/alpha/include/ucontext.h#2 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/include/ucontext.h,v 1.6 2002/11/16 06:35:51 deischen Exp $ + * $FreeBSD: src/sys/alpha/include/ucontext.h,v 1.7 2003/07/24 07:34:31 marcel Exp $ */ #ifndef _MACHINE_UCONTEXT_H_ @@ -50,7 +50,8 @@ #define _MC_REV0_SIGFRAME 1 /* context is a signal frame */ #define _MC_REV0_TRAPFRAME 2 /* context is a trap frame */ long mc_format; - long mc_spare[6]; + long mc_thrptr; /* Thread pointer */ + long mc_spare[5]; } mcontext_t; #if defined(_KERNEL) && defined(COMPAT_FREEBSD4) ==== //depot/projects/uart/amd64/acpica/OsdEnvironment.c#2 (text+ko) ==== @@ -23,10 +23,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/acpica/OsdEnvironment.c,v 1.9 2003/05/31 06:47:05 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/acpica/OsdEnvironment.c,v 1.10 2003/07/25 21:10:18 obrien Exp $"); + /* * 6.1 : Environmental support */ ==== //depot/projects/uart/amd64/acpica/acpi_machdep.c#2 (text+ko) ==== @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/acpica/acpi_machdep.c,v 1.9 2003/05/01 01:05:21 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/acpica/acpi_machdep.c,v 1.10 2003/07/25 21:10:19 obrien Exp $"); + #include <sys/param.h> #include <sys/bus.h> ==== //depot/projects/uart/amd64/acpica/acpi_wakeup.c#2 (text+ko) ==== @@ -23,9 +23,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/acpica/acpi_wakeup.c,v 1.19 2003/05/01 01:05:21 peter Exp $ */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/acpica/acpi_wakeup.c,v 1.20 2003/07/25 21:10:19 obrien Exp $"); + #include <sys/param.h> #include <sys/bus.h> ==== //depot/projects/uart/amd64/amd64/amd64-gdbstub.c#2 (text+ko) ==== @@ -92,7 +92,8 @@ * ****************************************************************************/ -/* $FreeBSD: src/sys/amd64/amd64/amd64-gdbstub.c,v 1.24 2003/05/31 22:00:57 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/amd64-gdbstub.c,v 1.25 2003/07/25 21:15:44 obrien Exp $"); #include <sys/param.h> #include <sys/reboot.h> ==== //depot/projects/uart/amd64/amd64/atomic.c#2 (text+ko) ==== @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/amd64/atomic.c,v 1.4 2000/09/06 11:21:14 phk Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/atomic.c,v 1.5 2003/07/25 21:15:44 obrien Exp $"); + /* This file creates publically callable functions to perform various * simple arithmetic on memory which is atomic in the presence of * interrupts and multiple processors. ==== //depot/projects/uart/amd64/amd64/autoconf.c#2 (text+ko) ==== @@ -33,10 +33,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $FreeBSD: src/sys/amd64/amd64/autoconf.c,v 1.173 2003/05/01 01:05:21 peter Exp $ + * @(#)autoconf.c 7.1 (Berkeley) 5/9/91 */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/autoconf.c,v 1.174 2003/07/25 21:15:44 obrien Exp $"); + /* * Setup the system to run on the current machine. * ==== //depot/projects/uart/amd64/amd64/critical.c#2 (text+ko) ==== @@ -1,10 +1,11 @@ /*- * Copyright (c) 2001 Matthew Dillon. This code is distributed under * the BSD copyright, /usr/src/COPYRIGHT. - * - * $FreeBSD: src/sys/amd64/amd64/critical.c,v 1.9 2003/05/01 01:05:21 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/critical.c,v 1.10 2003/07/25 21:15:44 obrien Exp $"); + #include <sys/param.h> #include <sys/systm.h> #include <sys/signalvar.h> ==== //depot/projects/uart/amd64/amd64/db_disasm.c#2 (text+ko) ==== @@ -22,10 +22,11 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. - * - * $FreeBSD: src/sys/amd64/amd64/db_disasm.c,v 1.26 2002/03/23 14:27:06 bde Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_disasm.c,v 1.27 2003/07/25 21:15:44 obrien Exp $"); + /* * Instruction disassembler. */ ==== //depot/projects/uart/amd64/amd64/db_interface.c#2 (text+ko) ==== @@ -22,10 +22,11 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. - * - * $FreeBSD: src/sys/amd64/amd64/db_interface.c,v 1.73 2003/05/30 01:01:07 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_interface.c,v 1.74 2003/07/25 21:15:44 obrien Exp $"); + /* * Interface to new debugger. */ ==== //depot/projects/uart/amd64/amd64/db_trace.c#2 (text+ko) ==== @@ -22,10 +22,11 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. - * - * $FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.57 2003/05/31 22:02:11 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.58 2003/07/25 21:15:44 obrien Exp $"); + #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> ==== //depot/projects/uart/amd64/amd64/dump_machdep.c#2 (text+ko) ==== @@ -31,10 +31,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/amd64/dump_machdep.c,v 1.8 2003/05/01 01:05:21 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/dump_machdep.c,v 1.9 2003/07/25 21:15:44 obrien Exp $"); + #include <sys/param.h> #include <sys/systm.h> #include <sys/conf.h> ==== //depot/projects/uart/amd64/amd64/elf_machdep.c#2 (text+ko) ==== @@ -21,10 +21,11 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.15 2003/05/11 22:40:24 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.16 2003/07/25 21:15:44 obrien Exp $"); + #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> ==== //depot/projects/uart/amd64/amd64/genassym.c#2 (text+ko) ==== @@ -33,10 +33,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.147 2003/05/23 05:04:53 peter Exp $ + * @(#)genassym.c 5.11 (Berkeley) 5/10/91 */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.148 2003/07/25 21:15:44 obrien Exp $"); + #include "opt_compat.h" #include "opt_kstack_pages.h" ==== //depot/projects/uart/amd64/amd64/identcpu.c#2 (text+ko) ==== @@ -38,9 +38,11 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.125 2003/05/27 21:59:56 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.126 2003/07/25 21:15:44 obrien Exp $"); + #include "opt_cpu.h" #include <sys/param.h> ==== //depot/projects/uart/amd64/amd64/in_cksum.c#2 (text+ko) ==== @@ -1,4 +1,3 @@ -/* $FreeBSD: src/sys/amd64/amd64/in_cksum.c,v 1.3 2001/10/05 18:58:22 dfr Exp $ */ /* $NetBSD: in_cksum.c,v 1.7 1997/09/02 13:18:15 thorpej Exp $ */ /* @@ -39,6 +38,7 @@ */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ +__FBSDID("$FreeBSD: src/sys/amd64/amd64/in_cksum.c,v 1.4 2003/07/25 21:15:44 obrien Exp $"); #include <sys/param.h> #include <sys/mbuf.h> ==== //depot/projects/uart/amd64/amd64/initcpu.c#2 (text+ko) ==== @@ -25,10 +25,11 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.45 2003/05/01 01:05:21 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.46 2003/07/25 21:15:44 obrien Exp $"); + #include "opt_cpu.h" #include <sys/param.h> ==== //depot/projects/uart/amd64/amd64/legacy.c#2 (text+ko) ==== @@ -25,10 +25,11 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.50 2003/05/01 01:05:21 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/legacy.c,v 1.51 2003/07/25 21:15:44 obrien Exp $"); + /* * This code implements a system driver for legacy systems that do not * support ACPI or when ACPI support is not present in the kernel. ==== //depot/projects/uart/amd64/amd64/machdep.c#3 (text+ko) ==== @@ -34,10 +34,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.584 2003/07/15 00:11:03 davidxu Exp $ + * @(#)machdep.c 7.4 (Berkeley) 6/3/91 */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.587 2003/07/25 21:15:44 obrien Exp $"); + #include "opt_atalk.h" #include "opt_compat.h" #include "opt_cpu.h" @@ -307,14 +309,17 @@ { struct proc *p; struct thread *td; + struct trapframe *regs; td = curthread; p = td->td_proc; + regs = td->td_frame; PROC_LOCK_ASSERT(p, MA_OWNED); bzero(si, sizeof(*si)); si->si_signo = sig; si->si_code = code; + si->si_addr = (void *)regs->tf_addr; /* XXXKSE fill other fields */ } @@ -1170,7 +1175,7 @@ setidt(0, &IDTVEC(div), SDT_SYSIGT, SEL_KPL, 0); setidt(1, &IDTVEC(dbg), SDT_SYSIGT, SEL_KPL, 0); setidt(2, &IDTVEC(nmi), SDT_SYSIGT, SEL_KPL, 0); - setidt(3, &IDTVEC(bpt), SDT_SYSIGT, SEL_KPL, 0); + setidt(3, &IDTVEC(bpt), SDT_SYSIGT, SEL_UPL, 0); setidt(4, &IDTVEC(ofl), SDT_SYSIGT, SEL_KPL, 0); setidt(5, &IDTVEC(bnd), SDT_SYSIGT, SEL_KPL, 0); setidt(6, &IDTVEC(ill), SDT_SYSIGT, SEL_KPL, 0); ==== //depot/projects/uart/amd64/amd64/mem.c#2 (text+ko) ==== @@ -36,11 +36,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: Utah $Hdr: mem.c 1.13 89/10/08$ - * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $FreeBSD: src/sys/amd64/amd64/mem.c,v 1.109 2003/06/22 12:59:43 simokawa Exp $ + * Utah $Hdr: mem.c 1.13 89/10/08$ + * @(#)mem.c 7.2 (Berkeley) 5/9/91 */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/mem.c,v 1.110 2003/07/25 21:15:44 obrien Exp $"); + /* * Memory special file */ ==== //depot/projects/uart/amd64/amd64/nexus.c#2 (text+ko) ==== @@ -25,10 +25,11 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.53 2003/05/31 21:58:55 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.54 2003/07/25 21:15:44 obrien Exp $"); + /* * This code implements a `root nexus' for Intel Architecture * machines. The function of the root nexus is to serve as an ==== //depot/projects/uart/amd64/amd64/pmap.c#7 (text+ko) ==== @@ -38,8 +38,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.424 2003/07/23 19:49:32 alc Exp $ + * @(#)pmap.c 7.7 (Berkeley) 5/12/91 */ /*- * Copyright (c) 2003 Networks Associates Technology, Inc. @@ -73,6 +72,9 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.426 2003/07/25 21:15:44 obrien Exp $"); + /* * Manages physical address maps. * @@ -2176,7 +2178,7 @@ mpte = NULL; for (i = 0; i < PAGEORDER_SIZE; i++) { - vm_object_t lobject; + vm_object_t backing_object, lobject; pt_entry_t *pte; addr = addra + pmap_prefault_pageorder[i]; @@ -2196,15 +2198,18 @@ pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; lobject = object; - for (m = vm_page_lookup(lobject, pindex); - (!m && (lobject->type == OBJT_DEFAULT) && (lobject->backing_object)); - lobject = lobject->backing_object) { + VM_OBJECT_LOCK(lobject); + while ((m = vm_page_lookup(lobject, pindex)) == NULL && + lobject->type == OBJT_DEFAULT && + (backing_object = lobject->backing_object) != NULL) { if (lobject->backing_object_offset & PAGE_MASK) break; - pindex += (lobject->backing_object_offset >> PAGE_SHIFT); - m = vm_page_lookup(lobject->backing_object, pindex); + pindex += lobject->backing_object_offset >> PAGE_SHIFT; + VM_OBJECT_LOCK(backing_object); + VM_OBJECT_UNLOCK(lobject); + lobject = backing_object; } - + VM_OBJECT_UNLOCK(lobject); /* * give-up when a page is not in memory */ ==== //depot/projects/uart/amd64/amd64/sys_machdep.c#2 (text+ko) ==== @@ -30,11 +30,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 - * $FreeBSD: src/sys/amd64/amd64/sys_machdep.c,v 1.83 2003/05/12 02:37:29 peter Exp $ - * + * @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/sys_machdep.c,v 1.85 2003/07/25 21:15:44 obrien Exp $"); + #include <sys/param.h> #include <sys/systm.h> #include <sys/lock.h> @@ -77,7 +78,7 @@ case AMD64_SET_GSBASE: error = copyin(uap->parms, &pcb->pcb_gsbase, sizeof(pcb->pcb_gsbase)); if (!error) - wrmsr(MSR_KGSBASE, pcb->pcb_fsbase); + wrmsr(MSR_KGSBASE, pcb->pcb_gsbase); break; default: ==== //depot/projects/uart/amd64/amd64/trap.c#2 (text+ko) ==== @@ -34,10 +34,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $FreeBSD: src/sys/amd64/amd64/trap.c,v 1.261 2003/06/15 00:31:22 davidxu Exp $ + * @(#)trap.c 7.4 (Berkeley) 5/13/91 */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/trap.c,v 1.262 2003/07/25 21:15:44 obrien Exp $"); + /* * AMD64 Trap and System call handling */ ==== //depot/projects/uart/amd64/amd64/tsc.c#2 (text+ko) ==== @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/amd64/tsc.c,v 1.200 2003/05/01 01:05:22 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/tsc.c,v 1.201 2003/07/25 21:15:44 obrien Exp $"); + #include "opt_clock.h" #include <sys/param.h> ==== //depot/projects/uart/amd64/amd64/vm_machdep.c#2 (text+ko) ==== @@ -36,11 +36,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 + * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.211 2003/06/11 05:20:32 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.214 2003/07/25 21:15:45 obrien Exp $"); + #include "opt_isa.h" #include "opt_kstack_pages.h" @@ -221,6 +223,51 @@ void cpu_set_upcall(struct thread *td, struct thread *td0) { + struct pcb *pcb2; + + /* Point the pcb to the top of the stack. */ + pcb2 = td->td_pcb; + + /* + * Copy the upcall pcb. This loads kernel regs. + * Those not loaded individually below get their default + * values here. + * + * XXXKSE It might be a good idea to simply skip this as + * the values of the other registers may be unimportant. + * This would remove any requirement for knowing the KSE + * at this time (see the matching comment below for + * more analysis) (need a good safe default). + */ + bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); + + /* + * Create a new fresh stack for the new thread. + * Don't forget to set this stack value into whatever supplies + * the address for the fault handlers. + * The contexts are filled in at the time we actually DO the + * upcall as only then do we know which KSE we got. + */ + bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_cr3 = vtophys(vmspace_pmap(td->td_proc->p_vmspace)->pm_pml4); + pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ + pcb2->pcb_rbp = 0; + pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ + pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ + pcb2->pcb_rip = (register_t)fork_trampoline; + pcb2->pcb_rflags = td->td_frame->tf_rflags & ~PSL_I; /* ints disabled */ + /* + * If we didn't copy the pcb, we'd need to do the following registers: + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_rflags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_[fg]sbase: cloned above + */ } /* @@ -231,6 +278,30 @@ void cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku) { + + /* + * Do any extra cleaning that needs to be done. + * The thread may have optional components + * that are not present in a fresh thread. + * This may be a recycled thread so make it look + * as though it's newly allocated. + */ + cpu_thread_clean(td); + + /* + * Set the trap frame to point at the beginning of the uts + * function. + */ + td->td_frame->tf_rsp = + ((register_t)ku->ku_stack.ss_sp + ku->ku_stack.ss_size) & ~0x0f; + td->td_frame->tf_rsp -= 8; + td->td_frame->tf_rip = (register_t)ku->ku_func; + + /* + * Pass the address of the mailbox for this kse to the uts + * function as a parameter on the stack. + */ + td->td_frame->tf_rdi = (register_t)ku->ku_mailbox; } ==== //depot/projects/uart/amd64/ia32/ia32_genassym.c#2 (text+ko) ==== @@ -1,4 +1,5 @@ -/* $FreeBSD: src/sys/amd64/ia32/ia32_genassym.c,v 1.1 2003/05/14 04:10:48 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_genassym.c,v 1.2 2003/07/25 21:16:26 obrien Exp $"); #include "opt_compat.h" ==== //depot/projects/uart/amd64/ia32/ia32_misc.c#2 (text+ko) ==== @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/ia32/ia32_misc.c,v 1.10 2003/05/14 04:10:48 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_misc.c,v 1.11 2003/07/25 21:16:26 obrien Exp $"); + #include "opt_compat.h" #include <sys/param.h> ==== //depot/projects/uart/amd64/ia32/ia32_signal.c#2 (text+ko) ==== @@ -33,10 +33,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/ia32/ia32_signal.c,v 1.2 2003/05/23 05:07:33 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_signal.c,v 1.3 2003/07/25 21:16:26 obrien Exp $"); + #include "opt_compat.h" #include <sys/param.h> ==== //depot/projects/uart/amd64/ia32/ia32_syscall.c#2 (text+ko) ==== @@ -33,10 +33,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/ia32/ia32_syscall.c,v 1.2 2003/05/31 06:49:53 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_syscall.c,v 1.3 2003/07/25 21:16:26 obrien Exp $"); + /* * 386 Trap and System call handling */ ==== //depot/projects/uart/amd64/ia32/ia32_sysvec.c#2 (text+ko) ==== @@ -23,10 +23,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD: src/sys/amd64/ia32/ia32_sysvec.c,v 1.5 2003/05/23 05:07:33 peter Exp $ */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_sysvec.c,v 1.6 2003/07/25 21:16:26 obrien Exp $"); + #include "opt_compat.h" #define __ELF_WORD_SIZE 32 ==== //depot/projects/uart/amd64/isa/clock.c#2 (text+ko) ==== @@ -33,10 +33,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/amd64/isa/clock.c,v 1.199 2003/05/01 01:05:24 peter Exp $ + * @(#)clock.c 7.2 (Berkeley) 5/12/91 */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/amd64/isa/clock.c,v 1.200 2003/07/25 21:18:52 obrien Exp $"); + >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200307260617.h6Q6HPYg004561>