Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Sep 2012 12:34:02 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r240816 - in stable/9/sys/i386: i386 include
Message-ID:  <201209221234.q8MCY2qT066703@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Sep 22 12:34:02 2012
New Revision: 240816
URL: http://svn.freebsd.org/changeset/base/240816

Log:
  MFC r237435:
  Enable shared page on i386, now it has a use for vdso_timehands.
  
  MFC r237445:
  Commit changes missed from r237435.  Properly calculate the signal
  trampoline addresses after the shared page is enabled.  Handle FreeBSD
  ABIs without shared page support too.

Modified:
  stable/9/sys/i386/i386/elf_machdep.c
  stable/9/sys/i386/i386/machdep.c
  stable/9/sys/i386/include/vmparam.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/i386/i386/elf_machdep.c
==============================================================================
--- stable/9/sys/i386/i386/elf_machdep.c	Sat Sep 22 12:32:00 2012	(r240815)
+++ stable/9/sys/i386/i386/elf_machdep.c	Sat Sep 22 12:34:02 2012	(r240816)
@@ -74,12 +74,15 @@ struct sysentvec elf32_freebsd_sysvec = 
 	.sv_setregs	= exec_setregs,
 	.sv_fixlimit	= NULL,
 	.sv_maxssiz	= NULL,
-	.sv_flags	= SV_ABI_FREEBSD | SV_IA32 | SV_ILP32,
+	.sv_flags	= SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 | SV_SHP,
 	.sv_set_syscall_retval = cpu_set_syscall_retval,
 	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
 	.sv_syscallnames = syscallnames,
+	.sv_shared_page_base = SHAREDPAGE,
+	.sv_shared_page_len = PAGE_SIZE,
 	.sv_schedtail	= NULL,
 };
+INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
 
 static Elf32_Brandinfo freebsd_brand_info = {
 	.brand		= ELFOSABI_FREEBSD,

Modified: stable/9/sys/i386/i386/machdep.c
==============================================================================
--- stable/9/sys/i386/i386/machdep.c	Sat Sep 22 12:32:00 2012	(r240815)
+++ stable/9/sys/i386/i386/machdep.c	Sat Sep 22 12:34:02 2012	(r240816)
@@ -472,7 +472,13 @@ osendsig(sig_t catcher, ksiginfo_t *ksi,
 	}
 
 	regs->tf_esp = (int)fp;
-	regs->tf_eip = PS_STRINGS - szosigcode;
+	if (p->p_sysent->sv_sigcode_base != 0) {
+		regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
+		    szosigcode;
+	} else {
+		/* a.out sysentvec does not use shared page */
+		regs->tf_eip = p->p_sysent->sv_psstrings - szosigcode;
+	}
 	regs->tf_eflags &= ~(PSL_T | PSL_D);
 	regs->tf_cs = _ucodesel;
 	regs->tf_ds = _udatasel;
@@ -599,7 +605,8 @@ freebsd4_sendsig(sig_t catcher, ksiginfo
 	}
 
 	regs->tf_esp = (int)sfp;
-	regs->tf_eip = PS_STRINGS - szfreebsd4_sigcode;
+	regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
+	    szfreebsd4_sigcode;
 	regs->tf_eflags &= ~(PSL_T | PSL_D);
 	regs->tf_cs = _ucodesel;
 	regs->tf_ds = _udatasel;
@@ -750,7 +757,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	}
 
 	regs->tf_esp = (int)sfp;
-	regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode);
+	regs->tf_eip = p->p_sysent->sv_sigcode_base;
 	regs->tf_eflags &= ~(PSL_T | PSL_D);
 	regs->tf_cs = _ucodesel;
 	regs->tf_ds = _udatasel;

Modified: stable/9/sys/i386/include/vmparam.h
==============================================================================
--- stable/9/sys/i386/include/vmparam.h	Sat Sep 22 12:32:00 2012	(r240815)
+++ stable/9/sys/i386/include/vmparam.h	Sat Sep 22 12:34:02 2012	(r240816)
@@ -165,7 +165,8 @@
 
 #define VM_MAXUSER_ADDRESS	VADDR(PTDPTDI, 0)
 
-#define USRSTACK		VM_MAXUSER_ADDRESS
+#define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
+#define	USRSTACK		SHAREDPAGE
 
 #define VM_MAX_ADDRESS		VADDR(PTDPTDI, PTDPTDI)
 #define VM_MIN_ADDRESS		((vm_offset_t)0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209221234.q8MCY2qT066703>