svn commit: r220315 - in projects/altix/sys: amd64/conf amd64/ia32 amd64/linux32 arm/conf arm/econa boot/common boot/ia64/common boot/ia64/efi boot/ia64/ski boot/pc98/loader boot/sparc64/loader com...

Marcel Moolenaar marcel at FreeBSD.org
Mon Apr 4 03:41:19 UTC 2011


Author: marcel
Date: Mon Apr  4 03:41:18 2011
New Revision: 220315
URL: http://svn.freebsd.org/changeset/base/220315

Log:
  Merge svn+ssh://svn.freebsd.org/base/head@220314

Added:
  projects/altix/sys/dev/ath/if_ath_ahb.c
     - copied unchanged from r220314, head/sys/dev/ath/if_ath_ahb.c
  projects/altix/sys/dev/nvram2env/
     - copied from r220314, head/sys/dev/nvram2env/
  projects/altix/sys/kern/kern_racct.c
     - copied unchanged from r220314, head/sys/kern/kern_racct.c
  projects/altix/sys/kern/kern_rctl.c
     - copied unchanged from r220314, head/sys/kern/kern_rctl.c
  projects/altix/sys/mips/conf/AR91XX_BASE
     - copied unchanged from r220314, head/sys/mips/conf/AR91XX_BASE
  projects/altix/sys/mips/conf/AR91XX_BASE.hints
     - copied unchanged from r220314, head/sys/mips/conf/AR91XX_BASE.hints
  projects/altix/sys/mips/conf/RT305X
     - copied unchanged from r220314, head/sys/mips/conf/RT305X
  projects/altix/sys/mips/conf/RT305X.hints
     - copied unchanged from r220314, head/sys/mips/conf/RT305X.hints
  projects/altix/sys/mips/conf/TP-WN1043ND
     - copied unchanged from r220314, head/sys/mips/conf/TP-WN1043ND
  projects/altix/sys/mips/conf/TP-WN1043ND.hints
     - copied unchanged from r220314, head/sys/mips/conf/TP-WN1043ND.hints
  projects/altix/sys/mips/rt305x/
     - copied from r220314, head/sys/mips/rt305x/
  projects/altix/sys/modules/ath_ahb/
     - copied from r220314, head/sys/modules/ath_ahb/
  projects/altix/sys/modules/ath_pci/
     - copied from r220314, head/sys/modules/ath_pci/
  projects/altix/sys/modules/cxgbe/if_cxgbe/
     - copied from r220314, head/sys/modules/cxgbe/if_cxgbe/
  projects/altix/sys/sys/racct.h
     - copied unchanged from r220314, head/sys/sys/racct.h
  projects/altix/sys/sys/rctl.h
     - copied unchanged from r220314, head/sys/sys/rctl.h
Replaced:
  projects/altix/sys/modules/cxgbe/Makefile
     - copied unchanged from r220314, head/sys/modules/cxgbe/Makefile
Modified:
  projects/altix/sys/amd64/conf/GENERIC
  projects/altix/sys/amd64/ia32/ia32_misc.c
  projects/altix/sys/amd64/ia32/ia32_signal.c
  projects/altix/sys/amd64/ia32/ia32_sigtramp.S
  projects/altix/sys/amd64/ia32/ia32_syscall.c
  projects/altix/sys/amd64/linux32/linux.h
  projects/altix/sys/arm/conf/AVILA
  projects/altix/sys/arm/conf/CAMBRIA
  projects/altix/sys/arm/econa/ehci_ebus.c
  projects/altix/sys/boot/common/bootstrap.h
  projects/altix/sys/boot/common/load_elf.c
  projects/altix/sys/boot/common/load_elf_obj.c
  projects/altix/sys/boot/common/module.c
  projects/altix/sys/boot/ia64/common/copy.c
  projects/altix/sys/boot/ia64/common/exec.c
  projects/altix/sys/boot/ia64/common/libia64.h
  projects/altix/sys/boot/ia64/efi/main.c
  projects/altix/sys/boot/ia64/ski/efi_stub.c
  projects/altix/sys/boot/ia64/ski/main.c
  projects/altix/sys/boot/ia64/ski/skimd.c
  projects/altix/sys/boot/pc98/loader/main.c
  projects/altix/sys/boot/sparc64/loader/main.c
  projects/altix/sys/compat/freebsd32/freebsd32.h
  projects/altix/sys/compat/freebsd32/freebsd32_ioctl.c
  projects/altix/sys/compat/freebsd32/freebsd32_ioctl.h
  projects/altix/sys/compat/freebsd32/freebsd32_misc.c
  projects/altix/sys/compat/freebsd32/freebsd32_proto.h
  projects/altix/sys/compat/freebsd32/freebsd32_syscall.h
  projects/altix/sys/compat/freebsd32/freebsd32_syscalls.c
  projects/altix/sys/compat/freebsd32/freebsd32_sysent.c
  projects/altix/sys/compat/freebsd32/freebsd32_systrace_args.c
  projects/altix/sys/compat/freebsd32/syscalls.master
  projects/altix/sys/compat/ia32/ia32_genassym.c
  projects/altix/sys/compat/ia32/ia32_signal.h
  projects/altix/sys/compat/ia32/ia32_sysvec.c
  projects/altix/sys/compat/ia32/ia32_util.h
  projects/altix/sys/compat/linux/linux_socket.c
  projects/altix/sys/conf/NOTES
  projects/altix/sys/conf/files
  projects/altix/sys/conf/files.mips
  projects/altix/sys/conf/options
  projects/altix/sys/dev/age/if_age.c
  projects/altix/sys/dev/ath/ath_hal/ah.c
  projects/altix/sys/dev/ath/ath_hal/ah_internal.h
  projects/altix/sys/dev/ath/ath_hal/ar5416/ar2133.c
  projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416.h
  projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
  projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c
  projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  projects/altix/sys/dev/ath/ath_hal/ar9001/ar9160.ini
  projects/altix/sys/dev/ath/if_ath.c
  projects/altix/sys/dev/ath/if_ath_pci.c
  projects/altix/sys/dev/ath/if_ath_sysctl.c
  projects/altix/sys/dev/ath/if_athioctl.h
  projects/altix/sys/dev/bxe/if_bxe.c
  projects/altix/sys/dev/bxe/if_bxe.h
  projects/altix/sys/dev/cxgbe/common/common.h
  projects/altix/sys/dev/cxgbe/common/t4fw_interface.h
  projects/altix/sys/dev/cxgbe/t4_main.c
  projects/altix/sys/dev/e1000/if_em.c
  projects/altix/sys/dev/e1000/if_em.h
  projects/altix/sys/dev/pci/pci.c
  projects/altix/sys/dev/pci/pci_user.c
  projects/altix/sys/dev/pci/pcireg.h
  projects/altix/sys/dev/pci/pcivar.h
  projects/altix/sys/dev/streams/streams.c
  projects/altix/sys/dev/usb/controller/ehci_ixp4xx.c
  projects/altix/sys/dev/usb/controller/ehci_mv.c
  projects/altix/sys/dev/usb/controller/ehci_pci.c
  projects/altix/sys/dev/usb/usb_generic.c
  projects/altix/sys/dev/usb/usb_pf.c
  projects/altix/sys/dev/usb/usb_pf.h
  projects/altix/sys/dev/usb/usb_transfer.c
  projects/altix/sys/dev/usb/usbdi.h
  projects/altix/sys/dev/usb/wlan/if_run.c
  projects/altix/sys/fs/nfsclient/nfs_clcomsubs.c
  projects/altix/sys/fs/nfsclient/nfs_clrpcops.c
  projects/altix/sys/geom/eli/g_eli.c
  projects/altix/sys/geom/gate/g_gate.c
  projects/altix/sys/geom/nop/g_nop.c
  projects/altix/sys/geom/raid/g_raid.c
  projects/altix/sys/geom/raid/md_intel.c
  projects/altix/sys/geom/raid/md_jmicron.c
  projects/altix/sys/geom/raid/md_nvidia.c
  projects/altix/sys/geom/raid/md_promise.c
  projects/altix/sys/geom/raid/md_sii.c
  projects/altix/sys/geom/raid/tr_raid1.c
  projects/altix/sys/geom/raid/tr_raid1e.c
  projects/altix/sys/i386/conf/GENERIC
  projects/altix/sys/i386/conf/PAE
  projects/altix/sys/i386/linux/linux.h
  projects/altix/sys/ia64/ia32/ia32_misc.c
  projects/altix/sys/ia64/ia32/ia32_signal.c
  projects/altix/sys/ia64/include/bootinfo.h
  projects/altix/sys/isa/pnp.c
  projects/altix/sys/kern/imgact_aout.c
  projects/altix/sys/kern/init_main.c
  projects/altix/sys/kern/init_sysent.c
  projects/altix/sys/kern/kern_descrip.c
  projects/altix/sys/kern/kern_event.c
  projects/altix/sys/kern/kern_exit.c
  projects/altix/sys/kern/kern_fork.c
  projects/altix/sys/kern/kern_jail.c
  projects/altix/sys/kern/kern_linker.c
  projects/altix/sys/kern/kern_loginclass.c
  projects/altix/sys/kern/kern_prot.c
  projects/altix/sys/kern/kern_resource.c
  projects/altix/sys/kern/kern_thr.c
  projects/altix/sys/kern/sched_4bsd.c
  projects/altix/sys/kern/sched_ule.c
  projects/altix/sys/kern/sys_pipe.c
  projects/altix/sys/kern/syscalls.c
  projects/altix/sys/kern/syscalls.master
  projects/altix/sys/kern/systrace_args.c
  projects/altix/sys/kern/tty_pts.c
  projects/altix/sys/kern/uipc_mqueue.c
  projects/altix/sys/kern/uipc_sem.c
  projects/altix/sys/kern/uipc_shm.c
  projects/altix/sys/kern/uipc_syscalls.c
  projects/altix/sys/kern/vfs_syscalls.c
  projects/altix/sys/mips/atheros/ar71xx_ehci.c
  projects/altix/sys/mips/atheros/ar724x_chip.c
  projects/altix/sys/mips/atheros/ar724xreg.h
  projects/altix/sys/mips/atheros/if_arge.c
  projects/altix/sys/mips/conf/AR71XX
  projects/altix/sys/mips/conf/IDT
  projects/altix/sys/mips/conf/OCTEON1
  projects/altix/sys/mips/conf/SENTRY5
  projects/altix/sys/mips/rmi/xls_ehci.c
  projects/altix/sys/modules/Makefile
  projects/altix/sys/modules/ath/Makefile
  projects/altix/sys/modules/ipfw/Makefile
  projects/altix/sys/netinet/ipfw/ip_dn_glue.c
  projects/altix/sys/netinet/ipfw/ip_dummynet.c
  projects/altix/sys/netinet/ipfw/ip_fw2.c
  projects/altix/sys/netinet/tcp_input.c
  projects/altix/sys/netipsec/ipsec.h
  projects/altix/sys/netipsec/ipsec_output.c
  projects/altix/sys/netipsec/key.c
  projects/altix/sys/netipsec/key.h
  projects/altix/sys/netipsec/xform.h
  projects/altix/sys/netipsec/xform_ah.c
  projects/altix/sys/netipsec/xform_esp.c
  projects/altix/sys/netipsec/xform_ipcomp.c
  projects/altix/sys/opencrypto/cryptodev.c
  projects/altix/sys/pc98/conf/GENERIC
  projects/altix/sys/sparc64/conf/GENERIC
  projects/altix/sys/sparc64/pci/psycho.c
  projects/altix/sys/sparc64/pci/psychovar.h
  projects/altix/sys/sys/filedesc.h
  projects/altix/sys/sys/jail.h
  projects/altix/sys/sys/kernel.h
  projects/altix/sys/sys/loginclass.h
  projects/altix/sys/sys/param.h
  projects/altix/sys/sys/priv.h
  projects/altix/sys/sys/proc.h
  projects/altix/sys/sys/resourcevar.h
  projects/altix/sys/sys/syscall.h
  projects/altix/sys/sys/syscall.mk
  projects/altix/sys/sys/syscallsubr.h
  projects/altix/sys/sys/sysproto.h
  projects/altix/sys/tools/fw_stub.awk
  projects/altix/sys/ufs/ffs/ffs_softdep.c
Directory Properties:
  projects/altix/lib/libstand/   (props changed)
  projects/altix/sys/   (props changed)
  projects/altix/sys/amd64/include/xen/   (props changed)
  projects/altix/sys/boot/i386/efi/   (props changed)
  projects/altix/sys/boot/ia64/efi/   (props changed)
  projects/altix/sys/boot/ia64/ski/   (props changed)
  projects/altix/sys/boot/powerpc/boot1.chrp/   (props changed)
  projects/altix/sys/boot/powerpc/ofw/   (props changed)
  projects/altix/sys/cddl/contrib/opensolaris/   (props changed)
  projects/altix/sys/conf/   (props changed)
  projects/altix/sys/contrib/dev/acpica/   (props changed)
  projects/altix/sys/contrib/octeon-sdk/   (props changed)
  projects/altix/sys/contrib/pf/   (props changed)
  projects/altix/sys/contrib/x86emu/   (props changed)
  projects/altix/sys/kern/subr_busdma.c   (props changed)

Modified: projects/altix/sys/amd64/conf/GENERIC
==============================================================================
--- projects/altix/sys/amd64/conf/GENERIC	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/amd64/conf/GENERIC	Mon Apr  4 03:41:18 2011	(r220315)
@@ -257,7 +257,8 @@ device		wlan_ccmp	# 802.11 CCMP support
 device		wlan_tkip	# 802.11 TKIP support
 device		wlan_amrr	# AMRR transmit rate control algorithm
 device		an		# Aironet 4500/4800 802.11 wireless NICs.
-device		ath		# Atheros pci/cardbus NIC's
+device		ath		# Atheros NIC's
+device		ath_pci		# Atheros pci/cardbus glue
 device		ath_hal		# pci/cardbus chip support
 options 	AH_SUPPORT_AR5416	# enable AR5416 tx/rx descriptors
 device		ath_rate_sample	# SampleRate tx rate control for ath

Modified: projects/altix/sys/amd64/ia32/ia32_misc.c
==============================================================================
--- projects/altix/sys/amd64/ia32/ia32_misc.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/amd64/ia32/ia32_misc.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -69,3 +69,14 @@ freebsd32_sysarch(struct thread *td, str
 		return (sysarch(td, &uap1));
 	}
 }
+
+#ifdef COMPAT_43
+int
+ofreebsd32_getpagesize(struct thread *td,
+    struct ofreebsd32_getpagesize_args *uap)
+{
+
+	td->td_retval[0] = IA32_PAGE_SIZE;
+	return (0);
+}
+#endif

Modified: projects/altix/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- projects/altix/sys/amd64/ia32/ia32_signal.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/amd64/ia32/ia32_signal.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -300,6 +300,109 @@ freebsd32_swapcontext(struct thread *td,
  * frame pointer, it returns to the user
  * specified pc, psl.
  */
+
+#ifdef COMPAT_43
+static void
+ia32_osendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
+{
+	struct ia32_sigframe3 sf, *fp;
+	struct proc *p;
+	struct thread *td;
+	struct sigacts *psp;
+	struct trapframe *regs;
+	int sig;
+	int oonstack;
+
+	td = curthread;
+	p = td->td_proc;
+	PROC_LOCK_ASSERT(p, MA_OWNED);
+	sig = ksi->ksi_signo;
+	psp = p->p_sigacts;
+	mtx_assert(&psp->ps_mtx, MA_OWNED);
+	regs = td->td_frame;
+	oonstack = sigonstack(regs->tf_rsp);
+
+	/* Allocate space for the signal handler context. */
+	if ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&
+	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
+		fp = (struct ia32_sigframe3 *)(td->td_sigstk.ss_sp +
+		    td->td_sigstk.ss_size - sizeof(sf));
+		td->td_sigstk.ss_flags |= SS_ONSTACK;
+	} else
+		fp = (struct ia32_sigframe3 *)regs->tf_rsp - 1;
+
+	/* Translate the signal if appropriate. */
+	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
+		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
+
+	/* Build the argument list for the signal handler. */
+	sf.sf_signum = sig;
+	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
+	if (SIGISMEMBER(psp->ps_siginfo, sig)) {
+		/* Signal handler installed with SA_SIGINFO. */
+		sf.sf_arg2 = (register_t)&fp->sf_siginfo;
+		sf.sf_siginfo.si_signo = sig;
+		sf.sf_siginfo.si_code = ksi->ksi_code;
+		sf.sf_ah = (uintptr_t)catcher;
+	} else {
+		/* Old FreeBSD-style arguments. */
+		sf.sf_arg2 = ksi->ksi_code;
+		sf.sf_addr = (register_t)ksi->ksi_addr;
+		sf.sf_ah = (uintptr_t)catcher;
+	}
+	mtx_unlock(&psp->ps_mtx);
+	PROC_UNLOCK(p);
+
+	/* Save most if not all of trap frame. */
+	sf.sf_siginfo.si_sc.sc_eax = regs->tf_rax;
+	sf.sf_siginfo.si_sc.sc_ebx = regs->tf_rbx;
+	sf.sf_siginfo.si_sc.sc_ecx = regs->tf_rcx;
+	sf.sf_siginfo.si_sc.sc_edx = regs->tf_rdx;
+	sf.sf_siginfo.si_sc.sc_esi = regs->tf_rsi;
+	sf.sf_siginfo.si_sc.sc_edi = regs->tf_rdi;
+	sf.sf_siginfo.si_sc.sc_cs = regs->tf_cs;
+	sf.sf_siginfo.si_sc.sc_ds = regs->tf_ds;
+	sf.sf_siginfo.si_sc.sc_ss = regs->tf_ss;
+	sf.sf_siginfo.si_sc.sc_es = regs->tf_es;
+	sf.sf_siginfo.si_sc.sc_fs = regs->tf_fs;
+	sf.sf_siginfo.si_sc.sc_gs = regs->tf_gs;
+	sf.sf_siginfo.si_sc.sc_isp = regs->tf_rsp;
+
+	/* Build the signal context to be used by osigreturn(). */
+	sf.sf_siginfo.si_sc.sc_onstack = (oonstack) ? 1 : 0;
+	SIG2OSIG(*mask, sf.sf_siginfo.si_sc.sc_mask);
+	sf.sf_siginfo.si_sc.sc_esp = regs->tf_rsp;
+	sf.sf_siginfo.si_sc.sc_ebp = regs->tf_rbp;
+	sf.sf_siginfo.si_sc.sc_eip = regs->tf_rip;
+	sf.sf_siginfo.si_sc.sc_eflags = regs->tf_rflags;
+	sf.sf_siginfo.si_sc.sc_trapno = regs->tf_trapno;
+	sf.sf_siginfo.si_sc.sc_err = regs->tf_err;
+
+	/*
+	 * Copy the sigframe out to the user's stack.
+	 */
+	if (copyout(&sf, fp, sizeof(*fp)) != 0) {
+#ifdef DEBUG
+		printf("process %ld has trashed its stack\n", (long)p->p_pid);
+#endif
+		PROC_LOCK(p);
+		sigexit(td, SIGILL);
+	}
+
+	regs->tf_rsp = (uintptr_t)fp;
+	regs->tf_rip = p->p_sysent->sv_psstrings - sz_ia32_osigcode;
+	regs->tf_rflags &= ~(PSL_T | PSL_D);
+	regs->tf_cs = _ucode32sel;
+	regs->tf_ds = _udatasel;
+	regs->tf_es = _udatasel;
+	regs->tf_fs = _udatasel;
+	regs->tf_ss = _udatasel;
+	set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
+	PROC_LOCK(p);
+	mtx_lock(&psp->ps_mtx);
+}
+#endif
+
 #ifdef COMPAT_FREEBSD4
 static void
 freebsd4_ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
@@ -441,6 +544,12 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *
 		return;
 	}
 #endif
+#ifdef COMPAT_43
+	if (SIGISMEMBER(psp->ps_osigset, sig)) {
+		ia32_osendsig(catcher, ksi, mask);
+		return;
+	}
+#endif
 	mtx_assert(&psp->ps_mtx, MA_OWNED);
 	regs = td->td_frame;
 	oonstack = sigonstack(regs->tf_rsp);
@@ -547,6 +656,64 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *
  * make sure that the user has not modified the
  * state to gain improper privileges.
  */
+
+#ifdef COMPAT_43
+int
+ofreebsd32_sigreturn(struct thread *td, struct ofreebsd32_sigreturn_args *uap)
+{
+	struct ia32_sigcontext3 sc, *scp;
+	struct trapframe *regs;
+	int eflags, error;
+	ksiginfo_t ksi;
+
+	regs = td->td_frame;
+	error = copyin(uap->sigcntxp, &sc, sizeof(sc));
+	if (error != 0)
+		return (error);
+	scp = &sc;
+	eflags = scp->sc_eflags;
+	if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) {
+		return (EINVAL);
+	}
+	if (!CS_SECURE(scp->sc_cs)) {
+		ksiginfo_init_trap(&ksi);
+		ksi.ksi_signo = SIGBUS;
+		ksi.ksi_code = BUS_OBJERR;
+		ksi.ksi_trapno = T_PROTFLT;
+		ksi.ksi_addr = (void *)regs->tf_rip;
+		trapsignal(td, &ksi);
+		return (EINVAL);
+	}
+	regs->tf_ds = scp->sc_ds;
+	regs->tf_es = scp->sc_es;
+	regs->tf_fs = scp->sc_fs;
+	regs->tf_gs = scp->sc_gs;
+
+	regs->tf_rax = scp->sc_eax;
+	regs->tf_rbx = scp->sc_ebx;
+	regs->tf_rcx = scp->sc_ecx;
+	regs->tf_rdx = scp->sc_edx;
+	regs->tf_rsi = scp->sc_esi;
+	regs->tf_rdi = scp->sc_edi;
+	regs->tf_cs = scp->sc_cs;
+	regs->tf_ss = scp->sc_ss;
+	regs->tf_rbp = scp->sc_ebp;
+	regs->tf_rsp = scp->sc_esp;
+	regs->tf_rip = scp->sc_eip;
+	regs->tf_rflags = eflags;
+
+	if (scp->sc_onstack & 1)
+		td->td_sigstk.ss_flags |= SS_ONSTACK;
+	else
+		td->td_sigstk.ss_flags &= ~SS_ONSTACK;
+
+	kern_sigprocmask(td, SIG_SETMASK, (sigset_t *)&scp->sc_mask, NULL,
+	    SIGPROCMASK_OLD);
+	set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
+	return (EJUSTRETURN);
+}
+#endif
+
 #ifdef COMPAT_FREEBSD4
 /*
  * MPSAFE
@@ -734,6 +901,9 @@ ia32_setregs(struct thread *td, struct i
 		user_ldt_free(td);
 	else
 		mtx_unlock(&dt_lock);
+#ifdef COMPAT_43
+	setup_lcall_gate();
+#endif
 
 	pcb->pcb_fsbase = 0;
 	pcb->pcb_gsbase = 0;

Modified: projects/altix/sys/amd64/ia32/ia32_sigtramp.S
==============================================================================
--- projects/altix/sys/amd64/ia32/ia32_sigtramp.S	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/amd64/ia32/ia32_sigtramp.S	Mon Apr  4 03:41:18 2011	(r220315)
@@ -66,6 +66,35 @@ freebsd4_ia32_sigcode:
 	jmp	1b
 #endif
 
+#ifdef COMPAT_43
+	ALIGN_TEXT
+ia32_osigcode:
+	calll	*IA32_SIGF_HANDLER(%esp)/* call signal handler */
+	leal	IA32_SIGF_SC(%esp),%eax	/* get sigcontext */
+	pushl	%eax
+	movl	$103,%eax		/* 3.x SYS_sigreturn */
+	pushl	%eax			/* junk to fake return addr. */
+	int	$0x80			/* enter kernel with args */
+1:
+	jmp	1b
+
+
+	ALIGN_TEXT
+lcall_tramp:
+	pushl	%ebp
+	movl	%esp,%ebp
+	pushl	0x24(%ebp) /* arg 6 */
+	pushl	0x20(%ebp)
+	pushl	0x1c(%ebp)
+	pushl	0x18(%ebp)
+	pushl	0x14(%ebp)
+	pushl	0x10(%ebp) /* arg 1 */
+	pushl	0xc(%ebp) /* gap */
+	int	$0x80
+	leave
+	lretl
+#endif
+
 	ALIGN_TEXT
 esigcode:
 
@@ -78,3 +107,11 @@ sz_ia32_sigcode:
 sz_freebsd4_ia32_sigcode:
 	.long	esigcode-freebsd4_ia32_sigcode
 #endif
+#ifdef COMPAT_43
+	.globl	sz_ia32_osigcode
+sz_ia32_osigcode:
+	.long	esigcode-ia32_osigcode
+	.globl	sz_lcall_tramp
+sz_lcall_tramp:
+	.long	esigcode-lcall_tramp
+#endif

Modified: projects/altix/sys/amd64/ia32/ia32_syscall.c
==============================================================================
--- projects/altix/sys/amd64/ia32/ia32_syscall.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/amd64/ia32/ia32_syscall.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_clock.h"
+#include "opt_compat.h"
 #include "opt_cpu.h"
 #include "opt_isa.h"
 
@@ -78,7 +79,17 @@ __FBSDID("$FreeBSD$");
 #include <machine/intr_machdep.h>
 #include <machine/md_var.h>
 
+#include <compat/freebsd32/freebsd32_signal.h>
 #include <compat/freebsd32/freebsd32_util.h>
+#include <compat/ia32/ia32_signal.h>
+#include <machine/psl.h>
+#include <machine/segments.h>
+#include <machine/specialreg.h>
+#include <machine/sysarch.h>
+#include <machine/frame.h>
+#include <machine/md_var.h>
+#include <machine/pcb.h>
+#include <machine/cpufunc.h>
 
 #define	IDTVEC(name)	__CONCAT(X,name)
 
@@ -198,3 +209,45 @@ ia32_syscall_disable(void *dummy)
 
 SYSINIT(ia32_syscall, SI_SUB_EXEC, SI_ORDER_ANY, ia32_syscall_enable, NULL);
 SYSUNINIT(ia32_syscall, SI_SUB_EXEC, SI_ORDER_ANY, ia32_syscall_disable, NULL);
+
+#ifdef COMPAT_43
+int
+setup_lcall_gate(void)
+{
+	struct i386_ldt_args uap;
+	struct user_segment_descriptor descs[2];
+	struct gate_descriptor *ssd;
+	uint32_t lcall_addr;
+	int error;
+
+	bzero(&uap, sizeof(uap));
+	uap.start = 0;
+	uap.num = 2;
+
+	/*
+	 * This is the easiest way to cut the space for system
+	 * descriptor in ldt.  Manually adjust the descriptor type to
+	 * the call gate later.
+	 */
+	bzero(&descs[0], sizeof(descs));
+	descs[0].sd_type = SDT_SYSNULL;
+	descs[1].sd_type = SDT_SYSNULL;
+	error = amd64_set_ldt(curthread, &uap, descs);
+	if (error != 0)
+		return (error);
+
+	lcall_addr = curproc->p_sysent->sv_psstrings - sz_lcall_tramp;
+	mtx_lock(&dt_lock);
+	ssd = (struct gate_descriptor *)(curproc->p_md.md_ldt->ldt_base);
+	bzero(ssd, sizeof(*ssd));
+	ssd->gd_looffset = lcall_addr;
+	ssd->gd_hioffset = lcall_addr >> 16;
+	ssd->gd_selector = _ucode32sel;
+	ssd->gd_type = SDT_SYSCGT;
+	ssd->gd_dpl = SEL_UPL;
+	ssd->gd_p = 1;
+	mtx_unlock(&dt_lock);
+
+	return (0);
+}
+#endif

Modified: projects/altix/sys/amd64/linux32/linux.h
==============================================================================
--- projects/altix/sys/amd64/linux32/linux.h	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/amd64/linux32/linux.h	Mon Apr  4 03:41:18 2011	(r220315)
@@ -695,7 +695,6 @@ union l_semun {
 #define	LINUX_SO_NO_CHECK	11
 #define	LINUX_SO_PRIORITY	12
 #define	LINUX_SO_LINGER		13
-#define	LINUX_SO_PASSCRED	16
 #define	LINUX_SO_PEERCRED	17
 #define	LINUX_SO_RCVLOWAT	18
 #define	LINUX_SO_SNDLOWAT	19

Modified: projects/altix/sys/arm/conf/AVILA
==============================================================================
--- projects/altix/sys/arm/conf/AVILA	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/arm/conf/AVILA	Mon Apr  4 03:41:18 2011	(r220315)
@@ -120,7 +120,8 @@ device		wlan_ccmp	# 802.11 CCMP support
 device		wlan_tkip	# 802.11 TKIP support
 device		wlan_xauth
 
-device		ath		# Atheros pci/cardbus NIC's
+device		ath		# Atheros NIC's
+device		ath_pci		# Atheros pci/cardbus glue
 options 	ATH_DEBUG
 options 	ATH_DIAGAPI
 #options 	ATH_TX99_DIAG

Modified: projects/altix/sys/arm/conf/CAMBRIA
==============================================================================
--- projects/altix/sys/arm/conf/CAMBRIA	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/arm/conf/CAMBRIA	Mon Apr  4 03:41:18 2011	(r220315)
@@ -123,7 +123,8 @@ device		wlan_ccmp	# 802.11 CCMP support
 device		wlan_tkip	# 802.11 TKIP support
 device		wlan_xauth
 
-device		ath		# Atheros pci/cardbus NIC's
+device		ath		# Atheros NIC's
+device		ath_pci		# Atheros pci/cardbus glue
 options 	ATH_DEBUG
 options 	ATH_DIAGAPI
 #options 	ATH_TX99_DIAG

Modified: projects/altix/sys/arm/econa/ehci_ebus.c
==============================================================================
--- projects/altix/sys/arm/econa/ehci_ebus.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/arm/econa/ehci_ebus.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -241,7 +241,7 @@ ehci_ebus_detach(device_t self)
 	 * disable interrupts that might have been switched on in ehci_init
 	 */
 	if (sc->sc_io_res) {
-		EWRITE4(sc, EHCI_USBINTR, 0);
+		EOWRITE4(sc, EHCI_USBINTR, 0);
 		EWRITE4(sc, USB_BRIDGE_INTR_MASK, 0);
 	}
 	if (sc->sc_irq_res && sc->sc_intr_hdl) {

Modified: projects/altix/sys/boot/common/bootstrap.h
==============================================================================
--- projects/altix/sys/boot/common/bootstrap.h	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/common/bootstrap.h	Mon Apr  4 03:41:18 2011	(r220315)
@@ -296,8 +296,24 @@ struct arch_switch
     /* Perform ISA byte port I/O (only for systems with ISA) */
     int		(*arch_isainb)(int port);
     void	(*arch_isaoutb)(int port, int value);
-    /* Pass in initial kernel memory size */
-    void        (*arch_maphint)(vm_offset_t va, size_t len);	
+
+    /*
+     * Interface to adjust the load address according to the "object"
+     * being loaded.
+     */
+    uint64_t	(*arch_loadaddr)(u_int type, void *data, uint64_t addr);
+#define	LOAD_ELF	1	/* data points to the ELF header. */
+#define	LOAD_RAW	2	/* data points to the file name. */
+
+    /*
+     * Interface to inform MD code about a loaded (ELF) segment. This
+     * can be used to flush caches and/or set up translations.
+     */
+#ifdef __elfN
+    void	(*arch_loadseg)(Elf_Ehdr *eh, Elf_Phdr *ph, uint64_t delta);
+#else
+    void	(*arch_loadseg)(void *eh, void *ph, uint64_t delta);
+#endif
 };
 extern struct arch_switch archsw;
 

Modified: projects/altix/sys/boot/common/load_elf.c
==============================================================================
--- projects/altix/sys/boot/common/load_elf.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/common/load_elf.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -97,7 +97,6 @@ __elfN(loadfile)(char *filename, u_int64
     struct elf_file		ef;
     Elf_Ehdr 			*ehdr;
     int				err;
-    u_int			pad;
     ssize_t			bytes_read;
 
     fp = NULL;
@@ -157,12 +156,6 @@ __elfN(loadfile)(char *filename, u_int64
 	/* Looks OK, got ahead */
 	ef.kernel = 0;
 
-	/* Page-align the load address */
-	pad = (u_int)dest & PAGE_MASK;
-	if (pad != 0) {
-	    pad = PAGE_SIZE - pad;
-	    dest += pad;
-	}
     } else if (ehdr->e_type == ET_EXEC) {
 	/* Looks like a kernel */
 	if (kfp != NULL) {
@@ -173,7 +166,7 @@ __elfN(loadfile)(char *filename, u_int64
 	/* 
 	 * Calculate destination address based on kernel entrypoint 	
 	 */
-	dest = ehdr->e_entry;
+	dest = (ehdr->e_entry & ~PAGE_MASK);
 	if (dest == 0) {
 	    printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel (maybe static binary?)\n");
 	    err = EPERM;
@@ -186,6 +179,11 @@ __elfN(loadfile)(char *filename, u_int64
 	goto oerr;
     }
 
+    if (archsw.arch_loadaddr != NULL)
+	dest = archsw.arch_loadaddr(LOAD_ELF, ehdr, dest);
+    else
+	dest = roundup(dest, PAGE_SIZE);
+
     /* 
      * Ok, we think we should handle this.
      */
@@ -202,7 +200,7 @@ __elfN(loadfile)(char *filename, u_int64
 
 #ifdef ELF_VERBOSE
     if (ef.kernel)
-	printf("%s entry at 0x%jx\n", filename, (uintmax_t)dest);
+	printf("%s entry at 0x%jx\n", filename, (uintmax_t)ehdr->e_entry);
 #else
     printf("%s ", filename);
 #endif
@@ -362,6 +360,9 @@ __elfN(loadimage)(struct preloaded_file 
 	printf("\n");
 #endif
 
+	if (archsw.arch_loadseg != NULL)
+	    archsw.arch_loadseg(ehdr, phdr + i, off);
+
 	if (firstaddr == 0 || firstaddr > (phdr[i].p_vaddr + off))
 	    firstaddr = phdr[i].p_vaddr + off;
 	if (lastaddr == 0 || lastaddr < (phdr[i].p_vaddr + off + phdr[i].p_memsz))

Modified: projects/altix/sys/boot/common/load_elf_obj.c
==============================================================================
--- projects/altix/sys/boot/common/load_elf_obj.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/common/load_elf_obj.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -144,8 +144,10 @@ __elfN(obj_loadfile)(char *filename, u_i
 		goto oerr;
 	}
 
-	/* Page-align the load address */
-	dest = roundup(dest, PAGE_SIZE);
+	if (archsw.arch_loadaddr != NULL)
+		dest = archsw.arch_loadaddr(LOAD_ELF, hdr, dest);
+	else
+		dest = roundup(dest, PAGE_SIZE);
 
 	/*
 	 * Ok, we think we should handle this.

Modified: projects/altix/sys/boot/common/module.c
==============================================================================
--- projects/altix/sys/boot/common/module.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/common/module.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -275,6 +275,9 @@ file_load(char *filename, vm_offset_t de
     int error;
     int i;
 
+    if (archsw.arch_loadaddr != NULL)
+	dest = archsw.arch_loadaddr(LOAD_RAW, filename, dest);
+
     error = EFTYPE;
     for (i = 0, fp = NULL; file_formats[i] && fp == NULL; i++) {
 	error = (file_formats[i]->l_load)(filename, loadaddr, &fp);
@@ -352,9 +355,6 @@ file_loadraw(char *type, char *name)
     char			*cp;
     int				fd, got;
     vm_offset_t			laddr;
-#ifdef PC98
-    struct stat			st;
-#endif
 
     /* We can't load first */
     if ((file_findfile(NULL, NULL)) == NULL) {
@@ -369,20 +369,15 @@ file_loadraw(char *type, char *name)
 	return(CMD_ERROR);
     }
     name = cp;
-    
+
     if ((fd = open(name, O_RDONLY)) < 0) {
 	sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno));
 	free(name);
 	return(CMD_ERROR);
     }
 
-#ifdef PC98
-    /* We cannot use 15M-16M area on pc98. */
-    if (loadaddr < 0x1000000 &&
-	fstat(fd, &st) == 0 &&
-	(st.st_size == -1 || loadaddr + st.st_size > 0xf00000))
-	loadaddr = 0x1000000;
-#endif
+    if (archsw.arch_loadaddr != NULL)
+	loadaddr = archsw.arch_loadaddr(LOAD_RAW, name, loadaddr);
 
     laddr = loadaddr;
     for (;;) {
@@ -489,14 +484,6 @@ mod_loadkld(const char *kldname, int arg
 	;
 
     do {
-#ifdef PC98
-	/* We cannot use 15M-16M area on pc98. */
-	struct stat st;
-	if (loadaddr < 0x1000000 &&
-	    stat(filename, &st) == 0 &&
-	    (st.st_size == -1 || loadaddr + st.st_size > 0xf00000))
-	    loadaddr = 0x1000000;
-#endif
 	err = file_load(filename, loadaddr, &fp);
 	if (err)
 	    break;

Modified: projects/altix/sys/boot/ia64/common/copy.c
==============================================================================
--- projects/altix/sys/boot/ia64/common/copy.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/ia64/common/copy.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -28,10 +28,12 @@
 __FBSDID("$FreeBSD$");
 
 #include <stand.h>
-#include <ia64/include/vmparam.h>
+#include <machine/param.h>
 
 #include "libia64.h"
 
+u_int ia64_legacy_kernel;
+
 uint64_t *ia64_pgtbl;
 uint32_t ia64_pgtblsz;
 
@@ -80,8 +82,8 @@ pgtbl_extend(u_int idx)
 	return (0);
 }
 
-static void *
-va2pa(vm_offset_t va, size_t *len)
+void *
+ia64_va2pa(vm_offset_t va, size_t *len)
 {
 	uint64_t pa;
 	u_int idx, ofs;
@@ -89,6 +91,7 @@ va2pa(vm_offset_t va, size_t *len)
 
 	/* Backward compatibility. */
 	if (va >= IA64_RR_BASE(7)) {
+		ia64_legacy_kernel = 1;
 		pa = IA64_RR_MASK(va);
 		return ((void *)pa);
 	}
@@ -98,6 +101,8 @@ va2pa(vm_offset_t va, size_t *len)
 		goto fail;
 	}
 
+	ia64_legacy_kernel = 0;
+
 	idx = (va - IA64_PBVM_BASE) >> IA64_PBVM_PAGE_SHIFT;
 	if (idx >= (ia64_pgtblsz >> 3)) {
 		error = pgtbl_extend(idx);
@@ -138,7 +143,7 @@ ia64_copyin(const void *src, vm_offset_t
 	res = 0;
 	while (len > 0) {
 		sz = len;
-		pa = va2pa(va, &sz);
+		pa = ia64_va2pa(va, &sz);
 		if (sz == 0)
 			break;
 		bcopy(src, pa, sz);
@@ -159,7 +164,7 @@ ia64_copyout(vm_offset_t va, void *dst, 
 	res = 0;
 	while (len > 0) {
 		sz = len;
-		pa = va2pa(va, &sz);
+		pa = ia64_va2pa(va, &sz);
 		if (sz == 0)
 			break;
 		bcopy(pa, dst, sz);
@@ -170,6 +175,19 @@ ia64_copyout(vm_offset_t va, void *dst, 
 	return (res);
 }
 
+uint64_t
+ia64_loadaddr(u_int type, void *data, uint64_t addr)
+{
+	uint64_t align;
+
+	/*
+	 * Align ELF objects at PBVM page boundaries.  Align all other
+	 * objects at cache line boundaries for good measure.
+	 */
+	align = (type == LOAD_ELF) ? IA64_PBVM_PAGE_SIZE : CACHE_LINE_SIZE;
+	return ((addr + align - 1) & ~(align - 1));
+}
+
 ssize_t
 ia64_readin(int fd, vm_offset_t va, size_t len)
 {
@@ -180,7 +198,7 @@ ia64_readin(int fd, vm_offset_t va, size
 	res = 0;
 	while (len > 0) {
 		sz = len;
-		pa = va2pa(va, &sz);
+		pa = ia64_va2pa(va, &sz);
 		if (sz == 0)
 			break;
 		s = read(fd, pa, sz);

Modified: projects/altix/sys/boot/ia64/common/exec.c
==============================================================================
--- projects/altix/sys/boot/ia64/common/exec.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/ia64/common/exec.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -36,13 +36,20 @@ __FBSDID("$FreeBSD$");
 #include <machine/ia64_cpu.h>
 #include <machine/pte.h>
 
-#include <ia64/include/vmparam.h>
-
 #include <efi.h>
 #include <efilib.h>
 
 #include "libia64.h"
 
+static u_int itr_idx = 0;
+static u_int dtr_idx = 0;
+
+static vm_offset_t ia64_text_start;
+static size_t ia64_text_size;
+
+static vm_offset_t ia64_data_start;
+static size_t ia64_data_size;
+
 static int elf64_exec(struct preloaded_file *amp);
 static int elf64_obj_exec(struct preloaded_file *amp);
 
@@ -61,6 +68,26 @@ struct file_format *file_formats[] = {
 	NULL
 };
 
+static u_int
+sz2shft(vm_offset_t ofs, vm_size_t sz)
+{
+	vm_size_t s;
+	u_int shft;
+
+	shft = 12;	/* Start with 4K */
+	s = 1 << shft;
+	while (s < sz) {
+		shft++;
+		s <<= 1;
+	}
+	do {
+		shft--;
+		s >>= 1;
+	} while (ofs & (s - 1));
+
+	return (shft);
+}
+
 /*
  * Entered with psr.ic and psr.i both zero.
  */
@@ -84,49 +111,43 @@ enter_kernel(uint64_t start, struct boot
 	/* NOTREACHED */
 }
 
-static void
-mmu_wire(vm_offset_t va, vm_paddr_t pa, vm_size_t sz, u_int acc)
+static u_int
+mmu_wire(vm_offset_t va, vm_paddr_t pa, u_int pgshft, u_int acc)
 {
-	static u_int iidx = 0, didx = 0;
 	pt_entry_t pte;
-	u_int shft;
 
 	/* Round up to the smallest possible page size. */
-	if (sz < 4096)
-		sz = 4096;
-	/* Determine the exponent (base 2). */
-	shft = 0;
-	while (sz > 1) {
-		shft++;
-		sz >>= 1;
-	}
+	if (pgshft < 12)
+		pgshft = 12;
 	/* Truncate to the largest possible page size (256MB). */
-	if (shft > 28)
-		shft = 28;
+	if (pgshft > 28)
+		pgshft = 28;
 	/* Round down to a valid (mappable) page size. */
-	if (shft > 14 && (shft & 1) != 0)
-		shft--;
+	if (pgshft > 14 && (pgshft & 1) != 0)
+		pgshft--;
 
 	pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY |
 	    PTE_PL_KERN | (acc & PTE_AR_MASK) | (pa & PTE_PPN_MASK);
 
 	__asm __volatile("mov cr.ifa=%0" :: "r"(va));
-	__asm __volatile("mov cr.itir=%0" :: "r"(shft << 2));
+	__asm __volatile("mov cr.itir=%0" :: "r"(pgshft << 2));
 	__asm __volatile("srlz.d;;");
 
-	__asm __volatile("ptr.d %0,%1" :: "r"(va), "r"(shft << 2));
+	__asm __volatile("ptr.d %0,%1" :: "r"(va), "r"(pgshft << 2));
 	__asm __volatile("srlz.d;;");
-	__asm __volatile("itr.d dtr[%0]=%1" :: "r"(didx), "r"(pte));
+	__asm __volatile("itr.d dtr[%0]=%1" :: "r"(dtr_idx), "r"(pte));
 	__asm __volatile("srlz.d;;");
-	didx++;
+	dtr_idx++;
 
-	if (acc == PTE_AR_RWX) {
-		__asm __volatile("ptr.i %0,%1;;" :: "r"(va), "r"(shft << 2));
+	if (acc == PTE_AR_RWX || acc == PTE_AR_RX) {
+		__asm __volatile("ptr.i %0,%1;;" :: "r"(va), "r"(pgshft << 2));
 		__asm __volatile("srlz.i;;");
-		__asm __volatile("itr.i itr[%0]=%1;;" :: "r"(iidx), "r"(pte));
+		__asm __volatile("itr.i itr[%0]=%1;;" :: "r"(itr_idx), "r"(pte));
 		__asm __volatile("srlz.i;;");
-		iidx++;
+		itr_idx++;
 	}
+
+	return (pgshft);
 }
 
 static void
@@ -143,28 +164,43 @@ mmu_setup_legacy(uint64_t entry)
 	ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2));
 	__asm __volatile("srlz.i;;");
 
-	mmu_wire(entry, IA64_RR_MASK(entry), 1UL << 28, PTE_AR_RWX);
+	mmu_wire(entry, IA64_RR_MASK(entry), 28, PTE_AR_RWX);
 }
 
 static void
-mmu_setup_paged(vm_offset_t pbvm_top)
+mmu_setup_paged(struct bootinfo *bi)
 {
-	vm_size_t sz;
+	void *pa;
+	size_t sz;
+	u_int shft;
 
 	ia64_set_rr(IA64_RR_BASE(IA64_PBVM_RR),
 	    (IA64_PBVM_RR << 8) | (IA64_PBVM_PAGE_SHIFT << 2));
 	__asm __volatile("srlz.i;;");
 
 	/* Wire the PBVM page table. */
-	mmu_wire(IA64_PBVM_PGTBL, (uintptr_t)ia64_pgtbl, ia64_pgtblsz,
-	    PTE_AR_RW);
+	mmu_wire(IA64_PBVM_PGTBL, (uintptr_t)ia64_pgtbl,
+	    sz2shft(IA64_PBVM_PGTBL, ia64_pgtblsz), PTE_AR_RW);
 
-	/* Wire as much of the PBVM we can. This must be a power of 2. */
-	sz = pbvm_top - IA64_PBVM_BASE;
-	sz = (sz + IA64_PBVM_PAGE_MASK) & ~IA64_PBVM_PAGE_MASK;
-	while (sz & (sz - 1))
-		sz -= IA64_PBVM_PAGE_SIZE;
-	mmu_wire(IA64_PBVM_BASE, ia64_pgtbl[0], sz, PTE_AR_RWX);
+	/* Wire as much of the text segment as we can. */
+	sz = ia64_text_size;	/* XXX */
+	pa = ia64_va2pa(ia64_text_start, &ia64_text_size);
+	ia64_text_size = sz;	/* XXX */
+	shft = sz2shft(ia64_text_start, ia64_text_size);
+	shft = mmu_wire(ia64_text_start, (uintptr_t)pa, shft, PTE_AR_RX);
+	ia64_copyin(&shft, (uintptr_t)&bi->bi_text_mapped, 4);
+
+	/* Wire as much of the data segment as well. */
+	sz = ia64_data_size;	/* XXX */
+	pa = ia64_va2pa(ia64_data_start, &ia64_data_size);
+	ia64_data_size = sz;	/* XXX */
+	shft = sz2shft(ia64_data_start, ia64_data_size);
+	shft = mmu_wire(ia64_data_start, (uintptr_t)pa, shft, PTE_AR_RW);
+	ia64_copyin(&shft, (uintptr_t)&bi->bi_data_mapped, 4);
+
+	/* Update the bootinfo with the number of TRs used. */
+	ia64_copyin(&itr_idx, (uintptr_t)&bi->bi_itr_used, 4);
+	ia64_copyin(&dtr_idx, (uintptr_t)&bi->bi_dtr_used, 4);
 }
 
 static int
@@ -196,7 +232,7 @@ elf64_exec(struct preloaded_file *fp)
 	if (IS_LEGACY_KERNEL())
 		mmu_setup_legacy(hdr->e_entry);
 	else
-		mmu_setup_paged((uintptr_t)(bi + 1));
+		mmu_setup_paged(bi);
 
 	enter_kernel(hdr->e_entry, bi);
 	/* NOTREACHED */
@@ -211,3 +247,20 @@ elf64_obj_exec(struct preloaded_file *fp
 	    fp->f_name);
 	return (ENOSYS);
 }
+
+void
+ia64_loadseg(Elf_Ehdr *eh, Elf_Phdr *ph, uint64_t delta)
+{
+
+	if (eh->e_type != ET_EXEC)
+		return;
+
+	if (ph->p_flags & PF_X) {
+		ia64_text_start = ph->p_vaddr + delta;
+		ia64_text_size = ph->p_memsz;
+	} else {
+		ia64_data_start = ph->p_vaddr + delta;
+		ia64_data_size = ph->p_memsz;
+	}
+}
+

Modified: projects/altix/sys/boot/ia64/common/libia64.h
==============================================================================
--- projects/altix/sys/boot/ia64/common/libia64.h	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/ia64/common/libia64.h	Mon Apr  4 03:41:18 2011	(r220315)
@@ -31,9 +31,9 @@
 
 #include <bootstrap.h>
 #include <ia64/include/bootinfo.h>
-#include <ia64/include/vmparam.h>
+#include <machine/vmparam.h>
 
-#define	IS_LEGACY_KERNEL()	(ia64_pgtbl == NULL || ia64_pgtblsz == 0)
+#define	IS_LEGACY_KERNEL()	(ia64_legacy_kernel)
 
 /*
  * Portability functions provided by the loader
@@ -48,15 +48,24 @@ int ia64_platform_enter(const char *);
  * Functions and variables provided by the ia64 common code
  * and shared by all loader implementations.
  */
+extern u_int ia64_legacy_kernel;
+
 extern uint64_t *ia64_pgtbl;
 extern uint32_t ia64_pgtblsz;
 
 int ia64_autoload(void);
 int ia64_bootinfo(struct preloaded_file *, struct bootinfo **);
+uint64_t ia64_loadaddr(u_int, void *, uint64_t);
+#ifdef __elfN
+void ia64_loadseg(Elf_Ehdr *, Elf_Phdr *, uint64_t);
+#else
+void ia64_loadseg(void *, void *, uint64_t);
+#endif
 
 ssize_t ia64_copyin(const void *, vm_offset_t, size_t);
 ssize_t ia64_copyout(vm_offset_t, void *, size_t);
 ssize_t ia64_readin(int, vm_offset_t, size_t);
+void *ia64_va2pa(vm_offset_t, size_t *);
 
 char *ia64_fmtdev(struct devdesc *);
 int ia64_getdev(void **, const char *, const char **);

Modified: projects/altix/sys/boot/ia64/efi/main.c
==============================================================================
--- projects/altix/sys/boot/ia64/efi/main.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/ia64/efi/main.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -196,9 +196,11 @@ main(int argc, CHAR16 *argv[])
 	setenv("LINES", "24", 1);	/* optional */
 
 	archsw.arch_autoload = ia64_autoload;
-	archsw.arch_getdev = ia64_getdev;
 	archsw.arch_copyin = ia64_copyin;
 	archsw.arch_copyout = ia64_copyout;
+	archsw.arch_getdev = ia64_getdev;
+	archsw.arch_loadaddr = ia64_loadaddr;
+	archsw.arch_loadseg = ia64_loadseg;
 	archsw.arch_readin = ia64_readin;
 
 	interact();			/* doesn't return */

Modified: projects/altix/sys/boot/ia64/ski/efi_stub.c
==============================================================================
--- projects/altix/sys/boot/ia64/ski/efi_stub.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/ia64/ski/efi_stub.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -28,8 +28,8 @@
 __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
+#include <machine/bootinfo.h>
 #include <machine/efi.h>
-#include <ia64/include/bootinfo.h>
 #include <stand.h>
 #include "libski.h"
 
@@ -223,39 +223,37 @@ ResetSystem(enum efi_reset type, efi_sta
 void
 efi_stub_init(struct bootinfo *bi)
 {
-	struct efi_md *memp;
+	static struct efi_md memmap[4];
 
 	/* Describe the SKI memory map. */
-	bi->bi_memmap = (u_int64_t)(bi + 1);
-	bi->bi_memmap_size = 4 * sizeof(struct efi_md);
+	bi->bi_memmap = (uintptr_t)(void *)memmap;
+	bi->bi_memmap_size = sizeof(memmap);
 	bi->bi_memdesc_size = sizeof(struct efi_md);
 	bi->bi_memdesc_version = 1;
 
-	memp = (struct efi_md *)bi->bi_memmap;
-
-	memp[0].md_type = EFI_MD_TYPE_PALCODE;
-	memp[0].md_phys = 0x100000;
-	memp[0].md_virt = NULL;
-	memp[0].md_pages = (4L*1024*1024)>>12;
-	memp[0].md_attr = EFI_MD_ATTR_WB | EFI_MD_ATTR_RT;
-
-	memp[1].md_type = EFI_MD_TYPE_FREE;
-	memp[1].md_phys = 5L*1024*1024;
-	memp[1].md_virt = NULL;
-	memp[1].md_pages = (128L*1024*1024)>>12;
-	memp[1].md_attr = EFI_MD_ATTR_WB;
-
-	memp[2].md_type = EFI_MD_TYPE_FREE;
-	memp[2].md_phys = 4L*1024*1024*1024;
-	memp[2].md_virt = NULL;
-	memp[2].md_pages = (64L*1024*1024)>>12;
-	memp[2].md_attr = EFI_MD_ATTR_WB;
-
-	memp[3].md_type = EFI_MD_TYPE_IOPORT;
-	memp[3].md_phys = 0xffffc000000;
-	memp[3].md_virt = NULL;
-	memp[3].md_pages = (64L*1024*1024)>>12;
-	memp[3].md_attr = EFI_MD_ATTR_UC;
+	memmap[0].md_type = EFI_MD_TYPE_PALCODE;
+	memmap[0].md_phys = 0x100000;
+	memmap[0].md_virt = NULL;
+	memmap[0].md_pages = (1L*1024*1024)>>12;
+	memmap[0].md_attr = EFI_MD_ATTR_WB | EFI_MD_ATTR_RT;
+
+	memmap[1].md_type = EFI_MD_TYPE_FREE;
+	memmap[1].md_phys = 4L*1024*1024;
+	memmap[1].md_virt = NULL;
+	memmap[1].md_pages = (128L*1024*1024)>>12;
+	memmap[1].md_attr = EFI_MD_ATTR_WB;
+
+	memmap[2].md_type = EFI_MD_TYPE_FREE;
+	memmap[2].md_phys = 4L*1024*1024*1024;
+	memmap[2].md_virt = NULL;
+	memmap[2].md_pages = (64L*1024*1024)>>12;
+	memmap[2].md_attr = EFI_MD_ATTR_WB;
+
+	memmap[3].md_type = EFI_MD_TYPE_IOPORT;
+	memmap[3].md_phys = 0xffffc000000;
+	memmap[3].md_virt = NULL;
+	memmap[3].md_pages = (64L*1024*1024)>>12;
+	memmap[3].md_attr = EFI_MD_ATTR_UC;
 
 	bi->bi_systab = (u_int64_t)&efi_systab;
 }

Modified: projects/altix/sys/boot/ia64/ski/main.c
==============================================================================
--- projects/altix/sys/boot/ia64/ski/main.c	Mon Apr  4 02:57:19 2011	(r220314)
+++ projects/altix/sys/boot/ia64/ski/main.c	Mon Apr  4 03:41:18 2011	(r220315)
@@ -97,11 +97,13 @@ ski_main(void)
 	    env_nounset);
 
 	setenv("LINES", "24", 1);	/* optional */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list