Date: Wed, 23 Oct 2013 16:14:49 +0000 (UTC) From: Will Andrews <will@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256981 - in projects/vps/sys: amd64/amd64 i386/i386 mips/conf mips/mips vps Message-ID: <201310231614.r9NGEnOO044263@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: will Date: Wed Oct 23 16:14:48 2013 New Revision: 256981 URL: http://svnweb.freebsd.org/changeset/base/256981 Log: Sync with svn.7he.at/vps/trunk r184. r184 | klaus | 2013-07-09 03:58:48 -0600 (Tue, 09 Jul 2013) | 3 lines Fixed the mips port (td->td_md.md_tls was not set properly). Submitted by: Klaus P. Ohrhallinger <k@7he.at> Modified: projects/vps/sys/amd64/amd64/vps_machdep.c projects/vps/sys/i386/i386/vps_machdep.c projects/vps/sys/mips/conf/EDGEROUTER_VPS projects/vps/sys/mips/mips/vps_machdep.c projects/vps/sys/vps/vps2.h projects/vps/sys/vps/vps_libdump.h projects/vps/sys/vps/vps_priv.c projects/vps/sys/vps/vps_snapst.c projects/vps/sys/vps/vps_suspend.c Modified: projects/vps/sys/amd64/amd64/vps_machdep.c ============================================================================== --- projects/vps/sys/amd64/amd64/vps_machdep.c Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/amd64/amd64/vps_machdep.c Wed Oct 23 16:14:48 2013 (r256981) @@ -87,6 +87,14 @@ vps_md_print_thread(struct thread *td) /*__attribute__((inline))*/ int +vps_md_snapshot_thread(struct vps_dump_thread *vdtd, struct thread *td) +{ + + return (0); +} + +/*__attribute__((inline))*/ +int vps_md_restore_thread(struct vps_dump_thread *vdtd, struct thread *ntd, struct proc *p) { Modified: projects/vps/sys/i386/i386/vps_machdep.c ============================================================================== --- projects/vps/sys/i386/i386/vps_machdep.c Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/i386/i386/vps_machdep.c Wed Oct 23 16:14:48 2013 (r256981) @@ -87,6 +87,14 @@ vps_md_print_thread(struct thread *td) /*__attribute__((inline))*/ int +vps_md_snapshot_thread(struct vps_dump_thread *vdtd, struct thread *td) +{ + + return (0); +} + +/*__attribute__((inline))*/ +int vps_md_restore_thread(struct vps_dump_thread *vdtd, struct thread *ntd, struct proc *p) { Modified: projects/vps/sys/mips/conf/EDGEROUTER_VPS ============================================================================== --- projects/vps/sys/mips/conf/EDGEROUTER_VPS Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/mips/conf/EDGEROUTER_VPS Wed Oct 23 16:14:48 2013 (r256981) @@ -23,6 +23,7 @@ ident EDGEROUTER_VPS options VPS options VPS_STATIC options VIMAGE +options DIAGNOSTIC #options MD_ROOT_SIZE=8192 # Reserve 8 MB for MD root image #makeoptions MFS_IMAGE=/usr/src/edgerouter/mdroot.img Modified: projects/vps/sys/mips/mips/vps_machdep.c ============================================================================== --- projects/vps/sys/mips/mips/vps_machdep.c Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/mips/mips/vps_machdep.c Wed Oct 23 16:14:48 2013 (r256981) @@ -105,6 +105,16 @@ vps_md_print_thread(struct thread *td) /*__attribute__((inline))*/ int +vps_md_snapshot_thread(struct vps_dump_thread *vdtd, struct thread *td) +{ + + vdtd->td_spare[0] = (uint64)td->td_md.md_tls; + + return (0); +} + +/*__attribute__((inline))*/ +int vps_md_restore_thread(struct vps_dump_thread *vdtd, struct thread *ntd, struct proc *p) { @@ -116,17 +126,6 @@ vps_md_restore_thread(struct vps_dump_th return (EOPNOTSUPP); } - /* - ntd->td_pcb->pcb_cr3 = - DMAP_TO_PHYS((vm_offset_t)vmspace_pmap(p->p_vmspace)->pm_pml4); - ntd->td_pcb->pcb_r12 = (uint64_t)vps_func->vps_restore_return; - ntd->td_pcb->pcb_rbp = 0; - ntd->td_pcb->pcb_rsp = (uint64_t)ntd->td_frame - sizeof(void *); - ntd->td_pcb->pcb_rbx = (uint64_t)ntd; - ntd->td_pcb->pcb_rip = (uint64_t)fork_trampoline; - ntd->td_md.md_spinlock_count = 1; - ntd->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - */ ntd->td_pcb->pcb_context[PCB_REG_RA] = (register_t)(intptr_t) fork_trampoline; /* Make sp 64-bit aligned */ @@ -139,11 +138,12 @@ vps_md_restore_thread(struct vps_dump_th ntd->td_frame; ntd->td_pcb->pcb_context[PCB_REG_SR] = mips_rd_status() & (MIPS_SR_KX | MIPS_SR_UX | MIPS_SR_INT_MASK); - ntd->td_md.md_tls = curthread->td_md.md_tls; ntd->td_md.md_saved_intr = MIPS_SR_INT_IE; ntd->td_md.md_spinlock_count = 1; - /* XXX CPU_CNMIPS stuff ?! */ + ntd->td_md.md_tls = (void *)vdtd->td_spare[0]; + + /* XXX CPU_CNMIPS stuff */ ntd->td_errno = vdtd->td_errno; ntd->td_retval[0] = vdtd->td_retval[0]; @@ -279,7 +279,7 @@ XXX */ if (vdsf->sf_length != sizeof(struct savefpu)) { DBGCORE("%s: vdsf->sf_length != sizeof(struct savefpu) " - (%u != %lu)\n", __func__, vdsf->sf_length, + "(%u != %lu)\n", __func__, vdsf->sf_length, sizeof(struct savefpu)); return (EINVAL); } @@ -499,15 +499,6 @@ vps_md_syscall_fixup_setup_inthread(stru if (vps_func->vps_syscall_fixup_inthread == NULL) return (EOPNOTSUPP); - /* - td->td_pcb->pcb_r12 = - (uint64_t)vps_func->vps_syscall_fixup_inthread; - td->td_pcb->pcb_rip = (uint64_t)fork_trampoline; - td->td_pcb->pcb_rsp = (uint64_t)td->td_frame - - sizeof(void *); - td->td_pcb->pcb_rbx = (uint64_t)code; - td->td_pcb->pcb_rbp = 0; - */ td->td_pcb->pcb_context[PCB_REG_RA] = (register_t)(intptr_t) fork_trampoline; /* Make sp 64-bit aligned */ Modified: projects/vps/sys/vps/vps2.h ============================================================================== --- projects/vps/sys/vps/vps2.h Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/vps/vps2.h Wed Oct 23 16:14:48 2013 (r256981) @@ -240,6 +240,7 @@ struct vps_dump_thread; struct execve_args; void vps_md_print_thread(struct thread *td); void vps_md_print_pcb(struct thread *td); +int vps_md_snapshot_thread(struct vps_dump_thread *vdtd, struct thread *td); int vps_md_restore_thread(struct vps_dump_thread *vdtd, struct thread *ntd, struct proc *p); int vps_md_snapshot_sysentvec(struct sysentvec *sv, long *svtype); int vps_md_restore_sysentvec(long svtype, struct sysentvec **sv); Modified: projects/vps/sys/vps/vps_libdump.h ============================================================================== --- projects/vps/sys/vps/vps_libdump.h Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/vps/vps_libdump.h Wed Oct 23 16:14:48 2013 (r256981) @@ -128,7 +128,7 @@ void vps_libdump_printheader(struct vps_ #define VPS_DUMPOBJT_UCRED 120 #define VPS_DUMPH_MAGIC 0xc0debabe -#define VPS_DUMPH_VERSION 0x20130512 +#define VPS_DUMPH_VERSION 0x20130709 #define VPS_DUMPH_MSB 12 #define VPS_DUMPH_LSB 21 #define VPS_DUMPH_32BIT 32 @@ -573,6 +573,8 @@ struct vps_dump_thread { sint32 td_errno; uint32 _pad2; + uint64 td_spare[4]; + sint32 td_tid; uint32 td_kstack_pages; char td_kstack[0]; /* always padded to 64 bit alignment */ Modified: projects/vps/sys/vps/vps_priv.c ============================================================================== --- projects/vps/sys/vps/vps_priv.c Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/vps/vps_priv.c Wed Oct 23 16:14:48 2013 (r256981) @@ -383,7 +383,7 @@ vps_devfs_ruleset_free(struct vps *vps, struct thread *td; int ruleset_num; devfs_rid rid; - int error; + int error = 0; DBGCORE("%s: vps=%p dm=%p\n", __func__, vps, dm); Modified: projects/vps/sys/vps/vps_snapst.c ============================================================================== --- projects/vps/sys/vps/vps_snapst.c Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/vps/vps_snapst.c Wed Oct 23 16:14:48 2013 (r256981) @@ -3280,6 +3280,12 @@ vps_snapshot_thread(struct vps_snapst_ct goto again; } + if (vps_md_snapshot_thread(vdtd, td) != 0) { + thread_unlock(td); + vdo_discard(ctx, o1); + goto again; + } + if (vps_snapshot_thread_savefpu(ctx, vps, td) != 0) { thread_unlock(td); vdo_discard(ctx, o1); Modified: projects/vps/sys/vps/vps_suspend.c ============================================================================== --- projects/vps/sys/vps/vps_suspend.c Wed Oct 23 16:12:20 2013 (r256980) +++ projects/vps/sys/vps/vps_suspend.c Wed Oct 23 16:14:48 2013 (r256981) @@ -755,7 +755,7 @@ vps_syscall_fixup_inthread(register_t co DBGCORE("%s: ####################### curthread=%p/%u code=%zu\n", __func__, td, td->td_tid, (size_t)code); - KASSERT(frame == td->td_frame, ("%s: frame == td->td_frame\n", + KASSERT(frame == td->td_frame, ("%s: frame != td->td_frame\n", __func__)); switch(code) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310231614.r9NGEnOO044263>