From owner-svn-src-projects@FreeBSD.ORG Mon Jul 4 10:45:55 2011
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 41622106564A;
Mon, 4 Jul 2011 10:45:55 +0000 (UTC)
(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 25E228FC12;
Mon, 4 Jul 2011 10:45:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p64Ajttk058538;
Mon, 4 Jul 2011 10:45:55 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p64AjteU058509;
Mon, 4 Jul 2011 10:45:55 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201107041045.p64AjteU058509@svn.freebsd.org>
From: Attilio Rao
Date: Mon, 4 Jul 2011 10:45:54 +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: r223756 - in projects/largeSMP: lib/libkvm sys/kern
sys/sys
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, 04 Jul 2011 10:45:55 -0000
Author: attilio
Date: Mon Jul 4 10:45:54 2011
New Revision: 223756
URL: http://svn.freebsd.org/changeset/base/223756
Log:
Completely remove now unused pc_other_cpus, pc_cpumask.
Tested by: pluknet
Modified:
projects/largeSMP/lib/libkvm/kvm_pcpu.c
projects/largeSMP/sys/kern/subr_pcpu.c
projects/largeSMP/sys/sys/pcpu.h
Modified: projects/largeSMP/lib/libkvm/kvm_pcpu.c
==============================================================================
--- projects/largeSMP/lib/libkvm/kvm_pcpu.c Mon Jul 4 07:37:28 2011 (r223755)
+++ projects/largeSMP/lib/libkvm/kvm_pcpu.c Mon Jul 4 10:45:54 2011 (r223756)
@@ -39,13 +39,11 @@
__FBSDID("$FreeBSD$");
#include
-#include
#include
#include
#include
#include
#include
-#include
#include "kvm_private.h"
@@ -120,9 +118,6 @@ _kvm_pcpu_clear(void)
void *
kvm_getpcpu(kvm_t *kd, int cpu)
{
- long kcpusetsize;
- ssize_t nbytes;
- uintptr_t readptr;
char *buf;
if (kd == NULL) {
@@ -130,10 +125,6 @@ kvm_getpcpu(kvm_t *kd, int cpu)
return (NULL);
}
- kcpusetsize = sysconf(_SC_CPUSET_SIZE);
- if (kcpusetsize == -1 || (u_long)kcpusetsize > sizeof(cpuset_t))
- return ((void *)-1);
-
if (maxcpu == 0)
if (_kvm_pcpu_init(kd) < 0)
return ((void *)-1);
@@ -146,26 +137,8 @@ kvm_getpcpu(kvm_t *kd, int cpu)
_kvm_err(kd, kd->program, "out of memory");
return ((void *)-1);
}
- nbytes = sizeof(struct pcpu) - 2 * kcpusetsize;
- readptr = (uintptr_t)pcpu_data[cpu];
- if (kvm_read(kd, readptr, buf, nbytes) != nbytes) {
- _kvm_err(kd, kd->program, "unable to read per-CPU data");
- free(buf);
- return ((void *)-1);
- }
-
- /* Fetch the valid cpuset_t objects. */
- CPU_ZERO((cpuset_t *)(buf + nbytes));
- CPU_ZERO((cpuset_t *)(buf + nbytes + sizeof(cpuset_t)));
- readptr += nbytes;
- if (kvm_read(kd, readptr, buf + nbytes, kcpusetsize) != kcpusetsize) {
- _kvm_err(kd, kd->program, "unable to read per-CPU data");
- free(buf);
- return ((void *)-1);
- }
- readptr += kcpusetsize;
- if (kvm_read(kd, readptr, buf + nbytes + sizeof(cpuset_t),
- kcpusetsize) != kcpusetsize) {
+ if (kvm_read(kd, (uintptr_t)pcpu_data[cpu], buf,
+ sizeof(struct pcpu)) != sizeof(struct pcpu)) {
_kvm_err(kd, kd->program, "unable to read per-CPU data");
free(buf);
return ((void *)-1);
Modified: projects/largeSMP/sys/kern/subr_pcpu.c
==============================================================================
--- projects/largeSMP/sys/kern/subr_pcpu.c Mon Jul 4 07:37:28 2011 (r223755)
+++ projects/largeSMP/sys/kern/subr_pcpu.c Mon Jul 4 10:45:54 2011 (r223756)
@@ -87,7 +87,6 @@ pcpu_init(struct pcpu *pcpu, int cpuid,
KASSERT(cpuid >= 0 && cpuid < MAXCPU,
("pcpu_init: invalid cpuid %d", cpuid));
pcpu->pc_cpuid = cpuid;
- CPU_SETOF(cpuid, &pcpu->pc_cpumask);
cpuid_to_pcpu[cpuid] = pcpu;
STAILQ_INSERT_TAIL(&cpuhead, pcpu, pc_allcpu);
cpu_pcpu_init(pcpu, cpuid, size);
Modified: projects/largeSMP/sys/sys/pcpu.h
==============================================================================
--- projects/largeSMP/sys/sys/pcpu.h Mon Jul 4 07:37:28 2011 (r223755)
+++ projects/largeSMP/sys/sys/pcpu.h Mon Jul 4 10:45:54 2011 (r223756)
@@ -196,18 +196,6 @@ struct pcpu {
* if only to make kernel debugging easier.
*/
PCPU_MD_FIELDS;
-
- /*
- * XXX
- * For the time being, keep the cpuset_t objects as the very last
- * members of the structure.
- * They are actually tagged to be removed soon, but as long as this
- * does not happen, it is necessary to find a way to implement
- * easilly interfaces to userland and leaving them last makes that
- * possible.
- */
- cpuset_t pc_cpumask; /* This cpu mask */
- cpuset_t pc_other_cpus; /* Mask of all other cpus */
} __aligned(CACHE_LINE_SIZE);
#ifdef _KERNEL
From owner-svn-src-projects@FreeBSD.ORG Mon Jul 4 11:13:01 2011
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 85F721065677;
Mon, 4 Jul 2011 11:13:01 +0000 (UTC)
(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 718638FC1D;
Mon, 4 Jul 2011 11:13:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p64BD1V4016574;
Mon, 4 Jul 2011 11:13:01 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p64BD1kU016553;
Mon, 4 Jul 2011 11:13:01 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201107041113.p64BD1kU016553@svn.freebsd.org>
From: Attilio Rao
Date: Mon, 4 Jul 2011 11:13:01 +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: r223757 - in projects/largeSMP: bin/ps contrib/gcc
contrib/lukemftpd/src contrib/sendmail/src contrib/top
sbin/ifconfig sbin/natd share/man/man9 share/mk
sys/amd64/amd64 sys/arm/arm sys...
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, 04 Jul 2011 11:13:01 -0000
Author: attilio
Date: Mon Jul 4 11:13:00 2011
New Revision: 223757
URL: http://svn.freebsd.org/changeset/base/223757
Log:
MFC
Added:
projects/largeSMP/sbin/ifconfig/iffib.c
- copied unchanged from r223756, head/sbin/ifconfig/iffib.c
projects/largeSMP/sys/boot/common/disk.c
- copied unchanged from r223756, head/sys/boot/common/disk.c
projects/largeSMP/sys/boot/common/disk.h
- copied unchanged from r223756, head/sys/boot/common/disk.h
projects/largeSMP/sys/boot/ficl/amd64/
- copied from r223756, head/sys/boot/ficl/amd64/
projects/largeSMP/sys/boot/userboot/
- copied from r223756, head/sys/boot/userboot/
Modified:
projects/largeSMP/bin/ps/ps.1
projects/largeSMP/contrib/gcc/c-decl.c
projects/largeSMP/contrib/gcc/c.opt
projects/largeSMP/contrib/gcc/common.opt
projects/largeSMP/contrib/gcc/tree-nested.c
projects/largeSMP/contrib/lukemftpd/src/ftpd.c
projects/largeSMP/contrib/sendmail/src/deliver.c
projects/largeSMP/sbin/ifconfig/Makefile
projects/largeSMP/sbin/ifconfig/ifconfig.8
projects/largeSMP/sbin/natd/natd.8
projects/largeSMP/share/man/man9/ifnet.9
projects/largeSMP/sys/amd64/amd64/pmap.c
projects/largeSMP/sys/amd64/amd64/sys_machdep.c
projects/largeSMP/sys/arm/arm/sys_machdep.c
projects/largeSMP/sys/boot/Makefile.amd64
projects/largeSMP/sys/boot/common/Makefile.inc
projects/largeSMP/sys/boot/common/load_elf.c
projects/largeSMP/sys/boot/common/reloc_elf.c
projects/largeSMP/sys/boot/i386/libi386/bioscd.c
projects/largeSMP/sys/boot/sparc64/loader/main.c
projects/largeSMP/sys/conf/NOTES
projects/largeSMP/sys/conf/options
projects/largeSMP/sys/dev/ahci/ahci.c
projects/largeSMP/sys/dev/iicbus/if_ic.c
projects/largeSMP/sys/dev/lmc/if_lmc.c
projects/largeSMP/sys/dev/ppbus/if_plip.c
projects/largeSMP/sys/dev/sound/usb/uaudio.c
projects/largeSMP/sys/dev/usb/input/uhid.c
projects/largeSMP/sys/dev/usb/input/ukbd.c
projects/largeSMP/sys/dev/usb/net/uhso.c
projects/largeSMP/sys/dev/usb/quirk/usb_quirk.c
projects/largeSMP/sys/dev/usb/quirk/usb_quirk.h
projects/largeSMP/sys/dev/usb/usb_hid.c
projects/largeSMP/sys/dev/usb/usbdevs
projects/largeSMP/sys/dev/usb/usbhid.h
projects/largeSMP/sys/fs/nfs/nfs_var.h
projects/largeSMP/sys/fs/nfsclient/nfs_clrpcops.c
projects/largeSMP/sys/fs/nfsclient/nfs_clstate.c
projects/largeSMP/sys/i386/i386/pmap.c
projects/largeSMP/sys/i386/i386/sys_machdep.c
projects/largeSMP/sys/i386/xen/pmap.c
projects/largeSMP/sys/ia64/ia64/exception.S
projects/largeSMP/sys/ia64/ia64/pmap.c
projects/largeSMP/sys/kern/imgact_elf.c
projects/largeSMP/sys/kern/kern_descrip.c
projects/largeSMP/sys/kern/kern_exec.c
projects/largeSMP/sys/kern/kern_jail.c
projects/largeSMP/sys/kern/tty.c
projects/largeSMP/sys/kern/uipc_shm.c
projects/largeSMP/sys/kern/uipc_syscalls.c
projects/largeSMP/sys/mips/mips/pmap.c
projects/largeSMP/sys/net/if.c
projects/largeSMP/sys/net/if.h
projects/largeSMP/sys/net/if_arcsubr.c
projects/largeSMP/sys/net/if_atmsubr.c
projects/largeSMP/sys/net/if_debug.c
projects/largeSMP/sys/net/if_ethersubr.c
projects/largeSMP/sys/net/if_fddisubr.c
projects/largeSMP/sys/net/if_fwsubr.c
projects/largeSMP/sys/net/if_gif.c
projects/largeSMP/sys/net/if_iso88025subr.c
projects/largeSMP/sys/net/if_spppfr.c
projects/largeSMP/sys/net/if_spppsubr.c
projects/largeSMP/sys/net/if_stf.c
projects/largeSMP/sys/net/if_tun.c
projects/largeSMP/sys/net/if_var.h
projects/largeSMP/sys/netgraph/netflow/netflow_v9.c
projects/largeSMP/sys/netgraph/netgraph.h
projects/largeSMP/sys/netgraph/ng_base.c
projects/largeSMP/sys/netgraph/ng_iface.c
projects/largeSMP/sys/netinet/if_ether.c
projects/largeSMP/sys/netinet/sctp_uio.h
projects/largeSMP/sys/netinet/sctp_usrreq.c
projects/largeSMP/sys/sparc64/include/cache.h
projects/largeSMP/sys/sparc64/include/cpu.h
projects/largeSMP/sys/sparc64/include/tlb.h
projects/largeSMP/sys/sparc64/sparc64/cache.c
projects/largeSMP/sys/sparc64/sparc64/cheetah.c
projects/largeSMP/sys/sparc64/sparc64/exception.S
projects/largeSMP/sys/sparc64/sparc64/interrupt.S
projects/largeSMP/sys/sparc64/sparc64/machdep.c
projects/largeSMP/sys/sparc64/sparc64/mp_exception.S
projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c
projects/largeSMP/sys/sparc64/sparc64/pmap.c
projects/largeSMP/sys/sparc64/sparc64/spitfire.c
projects/largeSMP/sys/sparc64/sparc64/sys_machdep.c
projects/largeSMP/sys/sparc64/sparc64/zeus.c
projects/largeSMP/sys/sys/_types.h
projects/largeSMP/sys/sys/file.h
projects/largeSMP/sys/sys/filedesc.h
projects/largeSMP/sys/sys/priv.h
projects/largeSMP/sys/sys/sockio.h
projects/largeSMP/sys/sys/tty.h
projects/largeSMP/sys/sys/ttydevsw.h
projects/largeSMP/sys/sys/types.h
projects/largeSMP/sys/vm/vm_pageout.c
projects/largeSMP/usr.sbin/config/main.c
projects/largeSMP/usr.sbin/rtadvd/if.c
Directory Properties:
projects/largeSMP/ (props changed)
projects/largeSMP/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/contrib/bind9/ (props changed)
projects/largeSMP/contrib/binutils/ (props changed)
projects/largeSMP/contrib/bzip2/ (props changed)
projects/largeSMP/contrib/compiler-rt/ (props changed)
projects/largeSMP/contrib/dialog/ (props changed)
projects/largeSMP/contrib/ee/ (props changed)
projects/largeSMP/contrib/expat/ (props changed)
projects/largeSMP/contrib/file/ (props changed)
projects/largeSMP/contrib/gcc/ (props changed)
projects/largeSMP/contrib/gdb/ (props changed)
projects/largeSMP/contrib/gdtoa/ (props changed)
projects/largeSMP/contrib/gnu-sort/ (props changed)
projects/largeSMP/contrib/groff/ (props changed)
projects/largeSMP/contrib/less/ (props changed)
projects/largeSMP/contrib/libpcap/ (props changed)
projects/largeSMP/contrib/libstdc++/ (props changed)
projects/largeSMP/contrib/llvm/ (props changed)
projects/largeSMP/contrib/llvm/tools/clang/ (props changed)
projects/largeSMP/contrib/ncurses/ (props changed)
projects/largeSMP/contrib/netcat/ (props changed)
projects/largeSMP/contrib/ntp/ (props changed)
projects/largeSMP/contrib/one-true-awk/ (props changed)
projects/largeSMP/contrib/openbsm/ (props changed)
projects/largeSMP/contrib/openpam/ (props changed)
projects/largeSMP/contrib/pf/ (props changed)
projects/largeSMP/contrib/sendmail/ (props changed)
projects/largeSMP/contrib/tcpdump/ (props changed)
projects/largeSMP/contrib/tcsh/ (props changed)
projects/largeSMP/contrib/tnftp/ (props changed)
projects/largeSMP/contrib/top/ (props changed)
projects/largeSMP/contrib/top/install-sh (props changed)
projects/largeSMP/contrib/tzcode/stdtime/ (props changed)
projects/largeSMP/contrib/tzcode/zic/ (props changed)
projects/largeSMP/contrib/tzdata/ (props changed)
projects/largeSMP/contrib/wpa/ (props changed)
projects/largeSMP/contrib/xz/ (props changed)
projects/largeSMP/crypto/openssh/ (props changed)
projects/largeSMP/crypto/openssl/ (props changed)
projects/largeSMP/gnu/lib/ (props changed)
projects/largeSMP/gnu/usr.bin/binutils/ (props changed)
projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed)
projects/largeSMP/gnu/usr.bin/gdb/ (props changed)
projects/largeSMP/lib/libc/ (props changed)
projects/largeSMP/lib/libc/stdtime/ (props changed)
projects/largeSMP/lib/libutil/ (props changed)
projects/largeSMP/lib/libz/ (props changed)
projects/largeSMP/sbin/ (props changed)
projects/largeSMP/sbin/ipfw/ (props changed)
projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed)
projects/largeSMP/share/zoneinfo/ (props changed)
projects/largeSMP/sys/ (props changed)
projects/largeSMP/sys/amd64/include/xen/ (props changed)
projects/largeSMP/sys/boot/ (props changed)
projects/largeSMP/sys/boot/i386/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/ski/ (props changed)
projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed)
projects/largeSMP/sys/boot/powerpc/ofw/ (props changed)
projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/sys/conf/ (props changed)
projects/largeSMP/sys/contrib/dev/acpica/ (props changed)
projects/largeSMP/sys/contrib/octeon-sdk/ (props changed)
projects/largeSMP/sys/contrib/pf/ (props changed)
projects/largeSMP/sys/contrib/x86emu/ (props changed)
projects/largeSMP/usr.bin/calendar/ (props changed)
projects/largeSMP/usr.bin/csup/ (props changed)
projects/largeSMP/usr.bin/procstat/ (props changed)
projects/largeSMP/usr.sbin/ndiscvt/ (props changed)
projects/largeSMP/usr.sbin/zic/ (props changed)
Modified: projects/largeSMP/bin/ps/ps.1
==============================================================================
--- projects/largeSMP/bin/ps/ps.1 Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/bin/ps/ps.1 Mon Jul 4 11:13:00 2011 (r223757)
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd June 14, 2011
+.Dd July 1, 2011
.Dt PS 1
.Os
.Sh NAME
@@ -492,6 +492,8 @@ command
command and arguments
.It Cm cpu
short-term CPU usage factor (for scheduling)
+.It Cm emul
+system-call emulation environment
.It Cm etime
elapsed running time, format
.Op days- Ns
@@ -527,6 +529,8 @@ lock currently blocked on (as a symbolic
login name of user who started the session
.It Cm lstart
time started
+.It Cm lwp
+process thread-id
.It Cm majflt
total page faults
.It Cm minflt
@@ -542,6 +546,8 @@ nice value (alias
.Cm ni )
.It Cm nivcsw
total involuntary context switches
+.It Cm nlwp
+number of threads tied to a process
.It Cm nsigs
total signals taken (alias
.Cm nsignals )
@@ -562,8 +568,6 @@ pageins (same as majflt)
process group number
.It Cm pid
process ID
-.It Cm poip
-pageouts in progress
.It Cm ppid
parent process ID
.It Cm pri
@@ -574,8 +578,6 @@ core residency time (in seconds; 127 = i
real group ID
.It Cm rgroup
group name (from rgid)
-.It Cm rlink
-reverse link on run queue, or 0
.It Cm rss
resident set size
.It Cm rtprio
@@ -630,8 +632,6 @@ text size (in Kbytes)
control terminal name (two letter abbreviation)
.It Cm tty
full name of control terminal
-.It Cm uprocp
-process pointer
.It Cm ucomm
name to be used for accounting
.It Cm uid
@@ -640,6 +640,8 @@ effective user ID (alias
.It Cm upr
scheduling priority on return from system call (alias
.Cm usrpri )
+.It Cm uprocp
+process pointer
.It Cm user
user name (from UID)
.It Cm usertime
Modified: projects/largeSMP/contrib/gcc/c-decl.c
==============================================================================
--- projects/largeSMP/contrib/gcc/c-decl.c Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/contrib/gcc/c-decl.c Mon Jul 4 11:13:00 2011 (r223757)
@@ -4340,6 +4340,8 @@ grokdeclarator (const struct c_declarato
pedwarn ("ISO C90 forbids variable-size array %qs",
name);
}
+ if (warn_variable_decl)
+ warning (0, "variable-sized array %qs", name);
}
if (integer_zerop (size))
Modified: projects/largeSMP/contrib/gcc/c.opt
==============================================================================
--- projects/largeSMP/contrib/gcc/c.opt Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/contrib/gcc/c.opt Mon Jul 4 11:13:00 2011 (r223757)
@@ -404,6 +404,10 @@ Wtraditional
C ObjC Var(warn_traditional)
Warn about features not present in traditional C
+Wtrampolines
+Common Var(warn_trampolines)
+Warn when trampolines are emitted
+
Wtrigraphs
C ObjC C++ ObjC++
Warn if trigraphs are encountered that might affect the meaning of the program
Modified: projects/largeSMP/contrib/gcc/common.opt
==============================================================================
--- projects/largeSMP/contrib/gcc/common.opt Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/contrib/gcc/common.opt Mon Jul 4 11:13:00 2011 (r223757)
@@ -189,6 +189,10 @@ Wunused-variable
Common Var(warn_unused_variable)
Warn when a variable is unused
+Wvariable-decl
+Common Var(warn_variable_decl)
+Warn about variable-sized declarations.
+
Wvolatile-register-var
Common Var(warn_register_var)
Warn when a register variable is declared volatile
Modified: projects/largeSMP/contrib/gcc/tree-nested.c
==============================================================================
--- projects/largeSMP/contrib/gcc/tree-nested.c Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/contrib/gcc/tree-nested.c Mon Jul 4 11:13:00 2011 (r223757)
@@ -750,7 +750,7 @@ check_for_nested_with_variably_modified
for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
{
for (arg = DECL_ARGUMENTS (cgn->decl); arg; arg = TREE_CHAIN (arg))
- if (variably_modified_type_p (TREE_TYPE (arg), 0), orig_fndecl)
+ if (variably_modified_type_p (TREE_TYPE (arg), orig_fndecl))
return true;
if (check_for_nested_with_variably_modified (cgn->decl, orig_fndecl))
@@ -1621,6 +1621,10 @@ convert_tramp_reference (tree *tp, int *
it doesn't need a trampoline. */
if (DECL_NO_STATIC_CHAIN (decl))
break;
+ if (warn_trampolines)
+ {
+ warning(0, "local function address taken needing trampoline generation");
+ }
/* Lookup the immediate parent of the callee, as that's where
we need to insert the trampoline. */
Modified: projects/largeSMP/contrib/lukemftpd/src/ftpd.c
==============================================================================
--- projects/largeSMP/contrib/lukemftpd/src/ftpd.c Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/contrib/lukemftpd/src/ftpd.c Mon Jul 4 11:13:00 2011 (r223757)
@@ -1263,8 +1263,9 @@ end_login(void)
curclass.type = CLASS_REAL;
(void) seteuid((uid_t)0);
#ifdef LOGIN_CAP
- setusercontext(NULL, getpwuid(0), 0,
- LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK|LOGIN_SETMAC);
+ setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN |
+ LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH |
+ LOGIN_SETENV));
#endif
#ifdef USE_PAM
if (pamh) {
@@ -1427,9 +1428,8 @@ pass(const char *passwd)
#endif
}
setsid();
- setusercontext(lc, pw, 0,
- LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY|
- LOGIN_SETRESOURCES|LOGIN_SETUMASK|LOGIN_SETMAC);
+ setusercontext(lc, pw, 0, LOGIN_SETALL &
+ ~(LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV));
#else
(void) initgroups(pw->pw_name, pw->pw_gid);
/* cache groups for cmds.c::matchgroup() */
Modified: projects/largeSMP/contrib/sendmail/src/deliver.c
==============================================================================
--- projects/largeSMP/contrib/sendmail/src/deliver.c Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/contrib/sendmail/src/deliver.c Mon Jul 4 11:13:00 2011 (r223757)
@@ -2416,6 +2416,12 @@ tryhost:
else
pwd = sm_getpwnam(contextaddr->q_user);
sucflags = LOGIN_SETRESOURCES|LOGIN_SETPRIORITY;
+#ifdef LOGIN_SETCPUMASK
+ sucflags |= LOGIN_SETCPUMASK;
+#endif /* LOGIN_SETCPUMASK */
+#ifdef LOGIN_SETLOGINCLASS
+ sucflags |= LOGIN_SETLOGINCLASS;
+#endif /* LOGIN_SETLOGINCLASS */
#ifdef LOGIN_SETMAC
sucflags |= LOGIN_SETMAC;
#endif /* LOGIN_SETMAC */
Modified: projects/largeSMP/sbin/ifconfig/Makefile
==============================================================================
--- projects/largeSMP/sbin/ifconfig/Makefile Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sbin/ifconfig/Makefile Mon Jul 4 11:13:00 2011 (r223757)
@@ -29,6 +29,7 @@ SRCS+= af_nd6.c # ND6 support
SRCS+= ifclone.c # clone device support
SRCS+= ifmac.c # MAC support
SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support
+SRCS+= iffib.c # non-default FIB support
SRCS+= ifvlan.c # SIOC[GS]ETVLAN support
SRCS+= ifgre.c # GRE keys etc
SRCS+= ifgif.c # GIF reversed header workaround
Modified: projects/largeSMP/sbin/ifconfig/ifconfig.8
==============================================================================
--- projects/largeSMP/sbin/ifconfig/ifconfig.8 Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sbin/ifconfig/ifconfig.8 Mon Jul 4 11:13:00 2011 (r223757)
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd May 31, 2011
+.Dd July 3, 2011
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -296,6 +296,19 @@ Remove the interface from the given
Fill interface index
(lowermost 64bit of an IPv6 address)
automatically.
+.It Cm fib Ar fib_number
+Specify interface FIB.
+A FIB
+.Ar fib_number
+is assigned to all frames or packets received on that interface.
+The FIB is not inherited, e.g. vlans or other sub-interfaces will use
+the default FIB (0) irrespective of the parent interface's FIB.
+The kernel needs to be tuned to support more than the default FIB
+using the
+.Va ROUTETABLES
+kernel configuration option, or the
+.Va net.fibs
+tunable.
.It Cm ipdst
This is used to specify an Internet host who is willing to receive
IP packets encapsulating IPX packets bound for a remote network.
Copied: projects/largeSMP/sbin/ifconfig/iffib.c (from r223756, head/sbin/ifconfig/iffib.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/largeSMP/sbin/ifconfig/iffib.c Mon Jul 4 11:13:00 2011 (r223757, copy of r223756, head/sbin/ifconfig/iffib.c)
@@ -0,0 +1,103 @@
+/*-
+ * Copyright (c) 2011 Alexander V. Chernikov
+ * Copyright (c) 2011 Christian S.J. Peron
+ * Copyright (c) 2011 Bjoern A. Zeeb
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY 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$
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include "ifconfig.h"
+
+static void
+fib_status(int s)
+{
+ struct ifreq ifr;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+
+ if (ioctl(s, SIOCGIFFIB, (caddr_t)&ifr) < 0)
+ return;
+
+ /* Ignore if it is the default. */
+ if (ifr.ifr_fib == 0)
+ return;
+
+ printf("\tfib: %u\n", ifr.ifr_fib);
+}
+
+static void
+setiffib(const char *val, int dummy __unused, int s,
+ const struct afswtch *afp)
+{
+ unsigned long fib;
+ char *ep;
+
+ fib = strtoul(val, &ep, 0);
+ if (*ep != '\0' || fib > UINT_MAX) {
+ warn("fib %s not valid", val);
+ return;
+ }
+
+ strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
+ ifr.ifr_fib = fib;
+ if (ioctl(s, SIOCSIFFIB, (caddr_t)&ifr) < 0)
+ warn("ioctl (SIOCSIFFIB)");
+}
+
+static struct cmd fib_cmds[] = {
+ DEF_CMD_ARG("fib", setiffib),
+};
+
+static struct afswtch af_fib = {
+ .af_name = "af_fib",
+ .af_af = AF_UNSPEC,
+ .af_other_status = fib_status,
+};
+
+static __constructor void
+fib_ctor(void)
+{
+#define N(a) (sizeof(a) / sizeof(a[0]))
+ size_t i;
+
+ for (i = 0; i < N(fib_cmds); i++)
+ cmd_register(&fib_cmds[i]);
+ af_register(&af_fib);
+#undef N
+}
Modified: projects/largeSMP/sbin/natd/natd.8
==============================================================================
--- projects/largeSMP/sbin/natd/natd.8 Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sbin/natd/natd.8 Mon Jul 4 11:13:00 2011 (r223757)
@@ -473,7 +473,7 @@ This option is intended to be used with
packets received on this port are checked against
internal translation tables of every configured instance.
If an entry is found, packet is aliased according to that entry.
-In no entry was found in any of the instances, packet is passed
+If no entry was found in any of the instances, packet is passed
unchanged, and no new entry will be created.
See the section
.Sx MULTIPLE INSTANCES
Modified: projects/largeSMP/share/man/man9/ifnet.9
==============================================================================
--- projects/largeSMP/share/man/man9/ifnet.9 Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/share/man/man9/ifnet.9 Mon Jul 4 11:13:00 2011 (r223757)
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 1, 2009
+.Dd July 3, 2011
.Dt IFNET 9
.Os
.Sh NAME
@@ -1169,11 +1169,12 @@ list.
Caller must have appropriate privilege.
(No call-down to driver.)
.It Dv SIOCGIFCAP
+.It Dv SIOCGIFFIB
.It Dv SIOCGIFFLAGS
.It Dv SIOCGIFMETRIC
.It Dv SIOCGIFMTU
.It Dv SIOCGIFPHYS
-Get interface capabilities, flags, metric, MTU, medium selection.
+Get interface capabilities, FIB, flags, metric, MTU, medium selection.
(No call-down to driver.)
.Pp
.It Dv SIOCSIFCAP
@@ -1192,6 +1193,12 @@ and
.Va if_data.ifi_hwassist
appropriately.
.Pp
+.It Dv SIOCSIFFIB
+Sets interface FIB.
+Caller must have appropriate privilege.
+FIB values start at 0 and values greater or equals than
+.Va net.fibs
+are considered invalid.
.It Dv SIOCSIFFLAGS
Change interface flags.
Caller must have appropriate privilege.
Modified: projects/largeSMP/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/largeSMP/sys/amd64/amd64/pmap.c Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sys/amd64/amd64/pmap.c Mon Jul 4 11:13:00 2011 (r223757)
@@ -2104,7 +2104,7 @@ pmap_collect(pmap_t locked_pmap, struct
vm_page_t m, free;
TAILQ_FOREACH(m, &vpq->pl, pageq) {
- if (m->hold_count || m->busy)
+ if ((m->flags & PG_MARKER) != 0 || m->hold_count || m->busy)
continue;
TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) {
va = pv->pv_va;
Modified: projects/largeSMP/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- projects/largeSMP/sys/amd64/amd64/sys_machdep.c Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sys/amd64/amd64/sys_machdep.c Mon Jul 4 11:13:00 2011 (r223757)
@@ -182,26 +182,28 @@ sysarch(td, uap)
#ifdef CAPABILITY_MODE
/*
- * Whitelist of operations which are safe enough for capability mode.
+ * When adding new operations, add a new case statement here to
+ * explicitly indicate whether or not the operation is safe to
+ * perform in capability mode.
*/
if (IN_CAPABILITY_MODE(td)) {
switch (uap->op) {
- case I386_GET_LDT:
- case I386_SET_LDT:
- case I386_GET_IOPERM:
- case I386_GET_FSBASE:
- case I386_SET_FSBASE:
- case I386_GET_GSBASE:
- case I386_SET_GSBASE:
- case AMD64_GET_FSBASE:
- case AMD64_SET_FSBASE:
- case AMD64_GET_GSBASE:
- case AMD64_SET_GSBASE:
- break;
+ case I386_GET_LDT:
+ case I386_SET_LDT:
+ case I386_GET_IOPERM:
+ case I386_GET_FSBASE:
+ case I386_SET_FSBASE:
+ case I386_GET_GSBASE:
+ case I386_SET_GSBASE:
+ case AMD64_GET_FSBASE:
+ case AMD64_SET_FSBASE:
+ case AMD64_GET_GSBASE:
+ case AMD64_SET_GSBASE:
+ break;
- case I386_SET_IOPERM:
- default:
- return (ECAPMODE);
+ case I386_SET_IOPERM:
+ default:
+ return (ECAPMODE);
}
}
#endif
Modified: projects/largeSMP/sys/arm/arm/sys_machdep.c
==============================================================================
--- projects/largeSMP/sys/arm/arm/sys_machdep.c Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sys/arm/arm/sys_machdep.c Mon Jul 4 11:13:00 2011 (r223757)
@@ -109,18 +109,20 @@ sysarch(td, uap)
#ifdef CAPABILITY_MODE
/*
- * Whitelist of operations which are safe enough for capability mode.
+ * When adding new operations, add a new case statement here to
+ * explicitly indicate whether or not the operation is safe to
+ * perform in capability mode.
*/
if (IN_CAPABILITY_MODE(td)) {
switch (uap->op) {
- case ARM_SYNC_ICACHE:
- case ARM_DRAIN_WRITEBUF:
- case ARM_SET_TP:
- case ARM_GET_TP:
- break;
+ case ARM_SYNC_ICACHE:
+ case ARM_DRAIN_WRITEBUF:
+ case ARM_SET_TP:
+ case ARM_GET_TP:
+ break;
- default:
- return (ECAPMODE);
+ default:
+ return (ECAPMODE);
}
}
#endif
Modified: projects/largeSMP/sys/boot/Makefile.amd64
==============================================================================
--- projects/largeSMP/sys/boot/Makefile.amd64 Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sys/boot/Makefile.amd64 Mon Jul 4 11:13:00 2011 (r223757)
@@ -2,3 +2,4 @@
SUBDIR+= efi
SUBDIR+= zfs
+SUBDIR+= userboot
Modified: projects/largeSMP/sys/boot/common/Makefile.inc
==============================================================================
--- projects/largeSMP/sys/boot/common/Makefile.inc Mon Jul 4 10:45:54 2011 (r223756)
+++ projects/largeSMP/sys/boot/common/Makefile.inc Mon Jul 4 11:13:00 2011 (r223757)
@@ -1,6 +1,6 @@
# $FreeBSD$
-SRCS+= boot.c commands.c console.c devopen.c interp.c
+SRCS+= boot.c commands.c console.c devopen.c disk.c interp.c
SRCS+= interp_backslash.c interp_parse.c ls.c misc.c
SRCS+= module.c panic.c
Copied: projects/largeSMP/sys/boot/common/disk.c (from r223756, head/sys/boot/common/disk.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/largeSMP/sys/boot/common/disk.c Mon Jul 4 11:13:00 2011 (r223757, copy of r223756, head/sys/boot/common/disk.c)
@@ -0,0 +1,799 @@
+/*-
+ * Copyright (c) 1998 Michael Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY 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.
+ */
+
+#include
+__FBSDID("$FreeBSD$");
+
+/*
+ * MBR/GPT partitioned disk device handling.
+ *
+ * Ideas and algorithms from:
+ *
+ * - NetBSD libi386/biosdisk.c
+ * - FreeBSD biosboot/disk.c
+ *
+ */
+
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+#include "disk.h"
+
+#ifdef DISK_DEBUG
+# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args)
+#else
+# define DEBUG(fmt, args...)
+#endif
+
+/*
+ * Search for a slice with the following preferences:
+ *
+ * 1: Active FreeBSD slice
+ * 2: Non-active FreeBSD slice
+ * 3: Active Linux slice
+ * 4: non-active Linux slice
+ * 5: Active FAT/FAT32 slice
+ * 6: non-active FAT/FAT32 slice
+ */
+#define PREF_RAWDISK 0
+#define PREF_FBSD_ACT 1
+#define PREF_FBSD 2
+#define PREF_LINUX_ACT 3
+#define PREF_LINUX 4
+#define PREF_DOS_ACT 5
+#define PREF_DOS 6
+#define PREF_NONE 7
+
+#ifdef LOADER_GPT_SUPPORT
+
+struct gpt_part {
+ int gp_index;
+ uuid_t gp_type;
+ uint64_t gp_start;
+ uint64_t gp_end;
+};
+
+static uuid_t efi = GPT_ENT_TYPE_EFI;
+static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
+static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
+static uuid_t freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
+static uuid_t freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
+static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
+
+#endif
+
+#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT)
+
+/* Given a size in 512 byte sectors, convert it to a human-readable number. */
+static char *
+display_size(uint64_t size)
+{
+ static char buf[80];
+ char unit;
+
+ size /= 2;
+ unit = 'K';
+ if (size >= 10485760000LL) {
+ size /= 1073741824;
+ unit = 'T';
+ } else if (size >= 10240000) {
+ size /= 1048576;
+ unit = 'G';
+ } else if (size >= 10000) {
+ size /= 1024;
+ unit = 'M';
+ }
+ sprintf(buf, "%.6ld%cB", (long)size, unit);
+ return (buf);
+}
+
+#endif
+
+#ifdef LOADER_MBR_SUPPORT
+
+static void
+disk_checkextended(struct disk_devdesc *dev,
+ struct dos_partition *slicetab, int slicenum, int *nslicesp)
+{
+ uint8_t buf[DISK_SECSIZE];
+ struct dos_partition *dp;
+ uint32_t base;
+ int rc, i, start, end;
+
+ dp = &slicetab[slicenum];
+ start = *nslicesp;
+
+ if (dp->dp_size == 0)
+ goto done;
+ if (dp->dp_typ != DOSPTYP_EXT)
+ goto done;
+ rc = dev->d_dev->dv_strategy(dev, F_READ, dp->dp_start, DISK_SECSIZE,
+ (char *) buf, NULL);
+ if (rc)
+ goto done;
+ if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) {
+ DEBUG("no magic in extended table");
+ goto done;
+ }
+ base = dp->dp_start;
+ dp = (struct dos_partition *) &buf[DOSPARTOFF];
+ for (i = 0; i < NDOSPART; i++, dp++) {
+ if (dp->dp_size == 0)
+ continue;
+ if (*nslicesp == NEXTDOSPART)
+ goto done;
+ dp->dp_start += base;
+ bcopy(dp, &slicetab[*nslicesp], sizeof(*dp));
+ (*nslicesp)++;
+ }
+ end = *nslicesp;
+
+ /*
+ * now, recursively check the slices we just added
+ */
+ for (i = start; i < end; i++)
+ disk_checkextended(dev, slicetab, i, nslicesp);
+done:
+ return;
+}
+
+static int
+disk_readslicetab(struct disk_devdesc *dev,
+ struct dos_partition **slicetabp, int *nslicesp)
+{
+ struct dos_partition *slicetab = NULL;
+ int nslices, i;
+ int rc;
+ uint8_t buf[DISK_SECSIZE];
+
+ /*
+ * Find the slice in the DOS slice table.
+ */
+ rc = dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE,
+ (char *) buf, NULL);
+ if (rc) {
+ DEBUG("error reading MBR");
+ return (rc);
+ }
+
+ /*
+ * Check the slice table magic.
+ */
+ if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) {
+ DEBUG("no slice table/MBR (no magic)");
+ return (rc);
+ }
+
+ /*
+ * copy the partition table, then pick up any extended partitions.
+ */
+ slicetab = malloc(NEXTDOSPART * sizeof(struct dos_partition));
+ bcopy(buf + DOSPARTOFF, slicetab,
+ sizeof(struct dos_partition) * NDOSPART);
+ nslices = NDOSPART; /* extended slices start here */
+ for (i = 0; i < NDOSPART; i++)
+ disk_checkextended(dev, slicetab, i, &nslices);
+
+ *slicetabp = slicetab;
+ *nslicesp = nslices;
+ return (0);
+}
+
+/*
+ * Search for the best MBR slice (typically the first FreeBSD slice).
+ */
+static int
+disk_bestslice(struct dos_partition *slicetab, int nslices)
+{
+ struct dos_partition *dp;
+ int pref, preflevel;
+ int i, prefslice;
+
+ prefslice = 0;
+ preflevel = PREF_NONE;
+
+ dp = &slicetab[0];
+ for (i = 0; i < nslices; i++, dp++) {
+ switch (dp->dp_typ) {
+ case DOSPTYP_386BSD: /* FreeBSD */
+ pref = dp->dp_flag & 0x80 ? PREF_FBSD_ACT : PREF_FBSD;
+ break;
+
+ case DOSPTYP_LINUX:
+ pref = dp->dp_flag & 0x80 ? PREF_LINUX_ACT : PREF_LINUX;
+ break;
+
+ case 0x01: /* DOS/Windows */
+ case 0x04:
+ case 0x06:
+ case 0x0b:
+ case 0x0c:
+ case 0x0e:
+ pref = dp->dp_flag & 0x80 ? PREF_DOS_ACT : PREF_DOS;
+ break;
+
+ default:
+ pref = PREF_NONE;
+ }
+ if (pref < preflevel) {
+ preflevel = pref;
+ prefslice = i + 1;
+ }
+ }
+ return (prefslice);
+}
+
+static int
+disk_openmbr(struct disk_devdesc *dev)
+{
+ struct dos_partition *slicetab = NULL, *dptr;
+ int nslices, sector, slice;
+ int rc;
+ uint8_t buf[DISK_SECSIZE];
+ struct disklabel *lp;
+
+ /*
+ * Following calculations attempt to determine the correct value
+ * for dev->d_offset by looking for the slice and partition specified,
+ * or searching for reasonable defaults.
+ */
+ rc = disk_readslicetab(dev, &slicetab, &nslices);
+ if (rc)
+ return (rc);
+
+ /*
+ * if a slice number was supplied but not found, this is an error.
+ */
+ if (dev->d_slice > 0) {
+ slice = dev->d_slice - 1;
+ if (slice >= nslices) {
+ DEBUG("slice %d not found", slice);
+ rc = EPART;
+ goto out;
+ }
+ }
+
+ /*
+ * Check for the historically bogus MBR found on true dedicated disks
+ */
+ if (slicetab[3].dp_typ == DOSPTYP_386BSD &&
+ slicetab[3].dp_start == 0 && slicetab[3].dp_size == 50000) {
+ sector = 0;
+ goto unsliced;
+ }
+
+ /*
+ * Try to auto-detect the best slice; this should always give
+ * a slice number
+ */
+ if (dev->d_slice == 0) {
+ slice = disk_bestslice(slicetab, nslices);
+ if (slice == -1) {
+ rc = ENOENT;
+ goto out;
+ }
+ dev->d_slice = slice;
+ }
+
+ /*
+ * Accept the supplied slice number unequivocally (we may be looking
+ * at a DOS partition).
+ * Note: we number 1-4, offsets are 0-3
+ */
+ dptr = &slicetab[dev->d_slice - 1];
+ sector = dptr->dp_start;
+ DEBUG("slice entry %d at %d, %d sectors",
+ dev->d_slice - 1, sector, dptr->dp_size);
+
+unsliced:
+ /*
+ * Now we have the slice offset, look for the partition in the
+ * disklabel if we have a partition to start with.
+ *
+ * XXX we might want to check the label checksum.
+ */
+ if (dev->d_partition < 0) {
+ /* no partition, must be after the slice */
+ DEBUG("opening raw slice");
+ dev->d_offset = sector;
+ rc = 0;
+ goto out;
+ }
+
+ rc = dev->d_dev->dv_strategy(dev, F_READ, sector + LABELSECTOR,
+ DISK_SECSIZE, (char *) buf, NULL);
+ if (rc) {
+ DEBUG("error reading disklabel");
+ goto out;
+ }
+
+ lp = (struct disklabel *) buf;
+
+ if (lp->d_magic != DISKMAGIC) {
+ DEBUG("no disklabel");
+ rc = ENOENT;
+ goto out;
+ }
+ if (dev->d_partition >= lp->d_npartitions) {
+ DEBUG("partition '%c' exceeds partitions in table (a-'%c')",
+ 'a' + dev->d_partition,
+ 'a' + lp->d_npartitions);
+ rc = EPART;
+ goto out;
+ }
+
+ dev->d_offset =
+ lp->d_partitions[dev->d_partition].p_offset -
+ lp->d_partitions[RAW_PART].p_offset +
+ sector;
+ rc = 0;
+
+out:
+ if (slicetab)
+ free(slicetab);
+ return (rc);
+}
+
+/*
+ * Print out each valid partition in the disklabel of a FreeBSD slice.
+ * For size calculations, we assume a 512 byte sector size.
+ */
+static void
+disk_printbsdslice(struct disk_devdesc *dev, daddr_t offset,
+ char *prefix, int verbose)
+{
+ char line[80];
+ char buf[DISK_SECSIZE];
+ struct disklabel *lp;
+ int i, rc, fstype;
+
+ /* read disklabel */
+ rc = dev->d_dev->dv_strategy(dev, F_READ, offset + LABELSECTOR,
+ DISK_SECSIZE, (char *) buf, NULL);
+ if (rc)
+ return;
+ lp =(struct disklabel *)(&buf[0]);
+ if (lp->d_magic != DISKMAGIC) {
+ sprintf(line, "%s: FFS bad disklabel\n", prefix);
+ pager_output(line);
+ return;
+ }
+
+ /* Print partitions */
+ for (i = 0; i < lp->d_npartitions; i++) {
+ /*
+ * For each partition, make sure we know what type of fs it
+ * is. If not, then skip it.
+ */
+ fstype = lp->d_partitions[i].p_fstype;
+ if (fstype != FS_BSDFFS &&
+ fstype != FS_SWAP &&
+ fstype != FS_VINUM)
+ continue;
+
+ /* Only print out statistics in verbose mode */
+ if (verbose)
+ sprintf(line, " %s%c: %s %s (%d - %d)\n",
+ prefix, 'a' + i,
+ (fstype == FS_SWAP) ? "swap " :
+ (fstype == FS_VINUM) ? "vinum" :
+ "FFS ",
+ display_size(lp->d_partitions[i].p_size),
+ lp->d_partitions[i].p_offset,
+ (lp->d_partitions[i].p_offset
+ + lp->d_partitions[i].p_size));
+ else
+ sprintf(line, " %s%c: %s\n", prefix, 'a' + i,
+ (fstype == FS_SWAP) ? "swap" :
+ (fstype == FS_VINUM) ? "vinum" :
+ "FFS");
+ pager_output(line);
+ }
+}
+
+static void
+disk_printslice(struct disk_devdesc *dev, int slice,
+ struct dos_partition *dp, char *prefix, int verbose)
+{
+ char stats[80];
+ char line[80];
+
+ if (verbose)
+ sprintf(stats, " %s (%d - %d)", display_size(dp->dp_size),
+ dp->dp_start, dp->dp_start + dp->dp_size);
+ else
+ stats[0] = '\0';
+
+ switch (dp->dp_typ) {
+ case DOSPTYP_386BSD:
+ disk_printbsdslice(dev, (daddr_t)dp->dp_start,
+ prefix, verbose);
+ return;
+ case DOSPTYP_LINSWP:
+ sprintf(line, "%s: Linux swap%s\n", prefix, stats);
+ break;
+ case DOSPTYP_LINUX:
+ /*
+ * XXX
+ * read the superblock to confirm this is an ext2fs partition?
+ */
+ sprintf(line, "%s: ext2fs%s\n", prefix, stats);
+ break;
+ case 0x00: /* unused partition */
+ case DOSPTYP_EXT:
+ return;
+ case 0x01:
+ sprintf(line, "%s: FAT-12%s\n", prefix, stats);
+ break;
+ case 0x04:
+ case 0x06:
+ case 0x0e:
+ sprintf(line, "%s: FAT-16%s\n", prefix, stats);
+ break;
+ case 0x07:
+ sprintf(line, "%s: NTFS/HPFS%s\n", prefix, stats);
+ break;
+ case 0x0b:
+ case 0x0c:
+ sprintf(line, "%s: FAT-32%s\n", prefix, stats);
+ break;
+ default:
+ sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, dp->dp_typ,
+ stats);
+ }
+ pager_output(line);
+}
+
+static int
+disk_printmbr(struct disk_devdesc *dev, char *prefix, int verbose)
+{
+ struct dos_partition *slicetab;
+ int nslices, i;
+ int rc;
+ char line[80];
+
+ rc = disk_readslicetab(dev, &slicetab, &nslices);
+ if (rc)
+ return (rc);
+ for (i = 0; i < nslices; i++) {
+ sprintf(line, "%ss%d", prefix, i + 1);
+ disk_printslice(dev, i, &slicetab[i], line, verbose);
+ }
+ free(slicetab);
+ return (0);
+}
+
+#endif
+
+#ifdef LOADER_GPT_SUPPORT
+
+static int
+disk_readgpt(struct disk_devdesc *dev, struct gpt_part **gptp, int *ngptp)
+{
+ struct dos_partition *dp;
+ struct gpt_hdr *hdr;
+ struct gpt_ent *ent;
+ struct gpt_part *gptab = NULL;
+ int entries_per_sec, rc, i, part;
+ daddr_t lba, elba;
+ uint8_t gpt[DISK_SECSIZE], tbl[DISK_SECSIZE];
+
+ /*
+ * Following calculations attempt to determine the correct value
+ * for dev->d_offset by looking for the slice and partition specified,
+ * or searching for reasonable defaults.
+ */
+ rc = 0;
+
+ /* First, read the MBR and see if we have a PMBR. */
+ rc = dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE,
+ (char *) tbl, NULL);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
From owner-svn-src-projects@FreeBSD.ORG Mon Jul 4 12:19:09 2011
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 86472106571D;
Mon, 4 Jul 2011 12:19:09 +0000 (UTC)
(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 5D45A8FC17;
Mon, 4 Jul 2011 12:19:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p64CJ9pT018699;
Mon, 4 Jul 2011 12:19:09 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p64CJ91M018698;
Mon, 4 Jul 2011 12:19:09 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201107041219.p64CJ91M018698@svn.freebsd.org>
From: Attilio Rao
Date: Mon, 4 Jul 2011 12:19:09 +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: r223760 - projects/largeSMP
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, 04 Jul 2011 12:19:09 -0000
Author: attilio
Date: Mon Jul 4 12:19:09 2011
New Revision: 223760
URL: http://svn.freebsd.org/changeset/base/223760
Log:
Delete the now unused project branch.
Deleted:
projects/largeSMP/
From owner-svn-src-projects@FreeBSD.ORG Mon Jul 4 19:33:04 2011
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 CDDE4106566B;
Mon, 4 Jul 2011 19:33:04 +0000 (UTC)
(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id BDB3F8FC0A;
Mon, 4 Jul 2011 19:33:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p64JX48b031503;
Mon, 4 Jul 2011 19:33:04 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p64JX4eO031501;
Mon, 4 Jul 2011 19:33:04 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201107041933.p64JX4eO031501@svn.freebsd.org>
From: Marcel Moolenaar
Date: Mon, 4 Jul 2011 19:33:04 +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: r223766 - projects/llvm-ia64/lib/clang
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, 04 Jul 2011 19:33:04 -0000
Author: marcel
Date: Mon Jul 4 19:33:04 2011
New Revision: 223766
URL: http://svn.freebsd.org/changeset/base/223766
Log:
Simplify dependency of generated headers on .td files. Since all headers
get generated from ${ARCH}.td, any and all .td files can influence the
outcome. As such, have all headers depend on all .td files. This is more
correct.
Modified:
projects/llvm-ia64/lib/clang/clang.build.mk
Modified: projects/llvm-ia64/lib/clang/clang.build.mk
==============================================================================
--- projects/llvm-ia64/lib/clang/clang.build.mk Mon Jul 4 17:43:04 2011 (r223765)
+++ projects/llvm-ia64/lib/clang/clang.build.mk Mon Jul 4 19:33:04 2011 (r223766)
@@ -61,19 +61,16 @@ Intrinsics.inc.h: ${LLVM_SRCS}/include/l
RegisterInfo/-gen-register-desc \
RegisterNames/-gen-register-enums \
Subtarget/-gen-subtarget
-${arch:T}Gen${hdr:H:C/$/.inc.h/}: ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td
+${arch:T}Gen${hdr:H:C/$/.inc.h/}: \
+ ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td \
+ ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}CallingConv.td \
+ ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}InstrFormats.td \
+ ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}InstrInfo.td \
+ ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}RegisterInfo.td
${TBLGEN} ${hdr:T:C/,/ /g} \
${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}.td > ${.TARGET}
. endfor
-. for hdr in \
- RegisterInfo.h \
- RegisterInfo \
- RegisterNames
-${arch:T}Gen${hdr}.inc.h: \
- ${LLVM_SRCS}/lib/Target/${arch:H}/${arch:T}RegisterInfo.td
-. endfor
-
.endfor
ARMGenDecoderTables.inc.h: ${LLVM_SRCS}/lib/Target/ARM/ARM.td
From owner-svn-src-projects@FreeBSD.ORG Mon Jul 4 19:51:26 2011
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 88729106564A;
Mon, 4 Jul 2011 19:51:26 +0000 (UTC)
(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 760998FC0A;
Mon, 4 Jul 2011 19:51:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p64JpQnR032085;
Mon, 4 Jul 2011 19:51:26 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p64JpQDk032074;
Mon, 4 Jul 2011 19:51:26 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201107041951.p64JpQDk032074@svn.freebsd.org>
From: Marcel Moolenaar
Date: Mon, 4 Jul 2011 19:51:26 +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: r223767 - in projects/llvm-ia64:
contrib/llvm/lib/Target/IA64 lib/clang/include
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, 04 Jul 2011 19:51:26 -0000
Author: marcel
Date: Mon Jul 4 19:51:26 2011
New Revision: 223767
URL: http://svn.freebsd.org/changeset/base/223767
Log:
o Implement LowerFormalArguments() LowerReturn() using CallingConv and
for general registers only.
o Implement IA64InstrInfo::copyPhysReg() for general registers. This
is needed during lowering and before copy elimination.
o Move IA instruction definitions from IA64.td to IA64InstrFormat.td and
IA64InstrInfo.td. Add the register form of the add instruction and add
the branch return instruction.
o Rename register classes to something a lot shorter: BR instead of Branch,
etc.
o Define branch registers properly. THis includes their DWARF register
numbers. Flesh out the general registers in a similar manner.
o Add the target-specific RET_FLAG SDNode type, that's used to represent
function returns.
o Implement IA64MCInstLower::Lower() for general registers, so that we
can lower add instructions to machine code.
Given that the assemblerwriter is based on machine code, this means that
we can properly compile:
long
add(long x, long y)
{
return (x + y);
}
into:
.file "add.c"
.text
.global add
.align 32
.type add,@function
add:
add r8=r33,r32
br.ret.sptk rp
.tmp0:
.size add, .tmp0-add
Added:
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrFormats.td
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.td
projects/llvm-ia64/lib/clang/include/IA64GenCallingConv.inc
Modified:
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.cpp
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.h
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64MCInstLower.cpp
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64RegisterInfo.td
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.cpp
projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.h
Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td
==============================================================================
--- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td Mon Jul 4 19:33:04 2011 (r223766)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td Mon Jul 4 19:51:26 2011 (r223767)
@@ -1,6 +1,5 @@
include "llvm/Target/Target.td"
-include "IA64RegisterInfo.td"
//
// Subtargets
@@ -24,20 +23,19 @@ def : IA64Impl<"montecito", [FeatureLong
def : IA64Impl<"montvale", [FeatureLongBranch]>;
//
-// Calling Convention
+// Registers
//
-include "IA64CallingConv.td"
+include "IA64RegisterInfo.td"
//
// Instructions
//
-class IA64Instruction : Instruction {
- let Namespace = "IA64";
- let OutOperandList = outs;
- let InOperandList = ins;
-}
+include "IA64InstrInfo.td"
-def NOP : IA64Instruction<(outs), (ins)>;
+//
+// Calling Convention
+//
+include "IA64CallingConv.td"
def IA64InstrInfo : InstrInfo;
Added: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrFormats.td
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrFormats.td Mon Jul 4 19:51:26 2011 (r223767)
@@ -0,0 +1,65 @@
+
+class
+IA64Instruction op, dag outs, dag ins, string as, list pat> :
+ Instruction
+{
+ let Namespace = "IA64";
+ // let Inst{40-37} = op;
+ let OutOperandList = outs;
+ let InOperandList = ins;
+ let AsmString = as;
+ let Pattern= pat;
+}
+
+//
+// A1-A10
+//
+
+class
+A1 x, dag outs, dag ins, string as, list pat> :
+ IA64Instruction<8, outs, ins, as, pat>
+{
+ // let Inst{35-27} = x;
+}
+
+//
+// B1-B9
+//
+
+class bwh h>
+{
+ bits<2> wh = h;
+}
+def sptk : bwh<0>;
+def spnt : bwh<1>;
+def dptk : bwh<2>;
+def dpnt : bwh<3>;
+
+class
+B4 x6, bits<3> btype, bwh wh, dag outs, dag ins, string as,
+ list pat> :
+ IA64Instruction<0, outs, ins, as, pat>
+{
+ // let Inst{35} = 0; // Branch Cache Deallocation Hint (0=none; 1=clr)
+ // let Inst{34-33} = wh;
+ // let Inst{32-27} = x6;
+ // let Inst{12} = 0; // Sequential Prefetch Hint (0=few; 1=many)
+ // let Inst{8-6} = btype;
+}
+
+//
+// F1-F16
+//
+
+//
+// I1-I30
+//
+
+//
+// M1-M48
+//
+
+//
+// X1-X5
+//
+
Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.cpp
==============================================================================
--- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.cpp Mon Jul 4 19:33:04 2011 (r223766)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.cpp Mon Jul 4 19:51:26 2011 (r223767)
@@ -20,3 +20,21 @@ IA64InstrInfo::IA64InstrInfo(IA64TargetM
{
// nothing to do
}
+
+void
+IA64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MI, DebugLoc DL, unsigned DestReg,
+ unsigned SrcReg, bool KillSrc) const
+{
+ bool GRDest = IA64::GRRegClass.contains(DestReg);
+ bool GRSrc = IA64::GRRegClass.contains(SrcReg);
+
+ if (GRDest && GRSrc) {
+ MachineInstrBuilder MIB = BuildMI(MBB, MI, DL, get(IA64::ADD), DestReg);
+ MIB.addReg(IA64::R0);
+ MIB.addReg(SrcReg, getKillRegState(KillSrc));
+ return;
+ }
+
+ llvm_unreachable(__func__);
+}
Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.h
==============================================================================
--- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.h Mon Jul 4 19:33:04 2011 (r223766)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.h Mon Jul 4 19:51:26 2011 (r223767)
@@ -22,6 +22,9 @@ namespace llvm {
///
virtual const TargetRegisterInfo &getRegisterInfo() const { return RI; }
+ virtual void copyPhysReg(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator MI, DebugLoc DL, unsigned DestReg,
+ unsigned SrcReg, bool KillSrc) const;
};
} // namespace llvm
Added: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.td
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64InstrInfo.td Mon Jul 4 19:51:26 2011 (r223767)
@@ -0,0 +1,20 @@
+
+include "IA64InstrFormats.td"
+
+def retflag : SDNode<"IA64ISD::RET_FLAG", SDTNone,
+ [SDNPHasChain, SDNPOptInGlue]>;
+
+def ADD : A1<0, (outs GR:$r1), (ins GR:$r2, GR:$r3),
+ "add\t$r1=$r2,$r3",
+ [(set GR:$r1, (add GR:$r2, GR:$r3))]>;
+
+def BR_RET : B4<21, 4, sptk, (outs), (ins),
+ "br.ret.sptk\trp", [(retflag)]>
+{
+ let isReturn = 1;
+ let isTerminator = 1;
+ let isBarrier = 1;
+}
+
+def NOP : IA64Instruction<0, (outs), (ins), "nop", []>;
+
Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64MCInstLower.cpp
==============================================================================
--- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64MCInstLower.cpp Mon Jul 4 19:33:04 2011 (r223766)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64MCInstLower.cpp Mon Jul 4 19:51:26 2011 (r223767)
@@ -54,5 +54,24 @@ IA64MCInstLower::LowerSymbolOperand(cons
void
IA64MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const
{
- llvm_unreachable(__func__);
+
+ OutMI.setOpcode(MI->getOpcode());
+
+ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ const MachineOperand &MO = MI->getOperand(i);
+
+ MCOperand MCOp;
+ switch (MO.getType()) {
+ case MachineOperand::MO_Register:
+ if (MO.isImplicit())
+ continue;
+ MCOp = MCOperand::CreateReg(MO.getReg());
+ break;
+ default:
+ MI->dump();
+ llvm_unreachable(__func__);
+ }
+
+ OutMI.addOperand(MCOp);
+ }
}
Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64RegisterInfo.td
==============================================================================
--- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64RegisterInfo.td Mon Jul 4 19:33:04 2011 (r223766)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64RegisterInfo.td Mon Jul 4 19:51:26 2011 (r223767)
@@ -26,7 +26,7 @@ def B5 : IA64Register<"b5">, DwarfRegNum
def B6 : IA64Register<"b6">, DwarfRegNum<[326]>;
def B7 : IA64Register<"b7">, DwarfRegNum<[327]>;
-def Branch : IA64RegisterClass<[i64], 64,
+def BR : IA64RegisterClass<[i64], 64,
[B6, B7, B0, B1, B2, B3, B4, B5]>;
//
@@ -67,34 +67,62 @@ def F29 : IA64Register<"f29">;
def F30 : IA64Register<"f30">;
def F31 : IA64Register<"f31">;
-def FloatingPoint : IA64RegisterClass<[f128], 128,
+def FR : IA64RegisterClass<[f128], 128,
[F0, F1, F2, F3, F4, F5, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17,
F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31]>;
//
// General registers
//
-def R0 : IA64Register<"r0">;
-def R1 : IA64Register<"r1">;
-def R4 : IA64Register<"r4">;
-def R5 : IA64Register<"r5">;
-def R6 : IA64Register<"r6">;
-def R7 : IA64Register<"r7">;
-def R8 : IA64Register<"r8">;
-def R12 : IA64Register<"r12">;
-def R13 : IA64Register<"r13">;
-// XXX
-def R32 : IA64Register<"r32">;
-def R33 : IA64Register<"r33">;
-def R34 : IA64Register<"r34">;
-def R35 : IA64Register<"r35">;
-def R36 : IA64Register<"r36">;
-def R37 : IA64Register<"r37">;
-def R38 : IA64Register<"r38">;
-def R39 : IA64Register<"r39">;
-
-def General : IA64RegisterClass<[i64], 64,
- [R0, R1, R4, R5, R6, R7, R8, R12, R13]>;
+def R0 : IA64Register<"r0">, DwarfRegNum<[0]>;
+def R1 : IA64Register<"r1">, DwarfRegNum<[1]>;
+def R2 : IA64Register<"r2">, DwarfRegNum<[2]>;
+def R3 : IA64Register<"r3">, DwarfRegNum<[3]>;
+def R4 : IA64Register<"r4">, DwarfRegNum<[4]>;
+def R5 : IA64Register<"r5">, DwarfRegNum<[5]>;
+def R6 : IA64Register<"r6">, DwarfRegNum<[6]>;
+def R7 : IA64Register<"r7">, DwarfRegNum<[7]>;
+def R8 : IA64Register<"r8">, DwarfRegNum<[8]>;
+def R9 : IA64Register<"r9">, DwarfRegNum<[9]>;
+def R10 : IA64Register<"r10">, DwarfRegNum<[10]>;
+def R11 : IA64Register<"r11">, DwarfRegNum<[11]>;
+def R12 : IA64Register<"r12">, DwarfRegNum<[12]>;
+def R13 : IA64Register<"r13">, DwarfRegNum<[13]>;
+def R14 : IA64Register<"r14">, DwarfRegNum<[14]>;
+def R15 : IA64Register<"r15">, DwarfRegNum<[15]>;
+def R16 : IA64Register<"r16">, DwarfRegNum<[16]>;
+def R17 : IA64Register<"r17">, DwarfRegNum<[17]>;
+def R18 : IA64Register<"r18">, DwarfRegNum<[18]>;
+def R19 : IA64Register<"r19">, DwarfRegNum<[19]>;
+def R20 : IA64Register<"r20">, DwarfRegNum<[20]>;
+def R21 : IA64Register<"r21">, DwarfRegNum<[21]>;
+def R22 : IA64Register<"r22">, DwarfRegNum<[22]>;
+def R23 : IA64Register<"r23">, DwarfRegNum<[23]>;
+def R24 : IA64Register<"r24">, DwarfRegNum<[24]>;
+def R25 : IA64Register<"r25">, DwarfRegNum<[25]>;
+def R26 : IA64Register<"r26">, DwarfRegNum<[26]>;
+def R27 : IA64Register<"r27">, DwarfRegNum<[27]>;
+def R28 : IA64Register<"r28">, DwarfRegNum<[28]>;
+def R29 : IA64Register<"r29">, DwarfRegNum<[29]>;
+def R30 : IA64Register<"r30">, DwarfRegNum<[30]>;
+def R31 : IA64Register<"r31">, DwarfRegNum<[31]>;
+def R32 : IA64Register<"r32">, DwarfRegNum<[32]>;
+def R33 : IA64Register<"r33">, DwarfRegNum<[33]>;
+def R34 : IA64Register<"r34">, DwarfRegNum<[34]>;
+def R35 : IA64Register<"r35">, DwarfRegNum<[35]>;
+def R36 : IA64Register<"r36">, DwarfRegNum<[36]>;
+def R37 : IA64Register<"r37">, DwarfRegNum<[37]>;
+def R38 : IA64Register<"r38">, DwarfRegNum<[38]>;
+def R39 : IA64Register<"r39">, DwarfRegNum<[39]>;
+
+def GR : IA64RegisterClass<[i64], 64,
+ [R14, R15, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27,
+ R28, R29, R30, R31,
+ R8, R9, R10, R11,
+ R2, R3,
+ R32, R33, R34, R35, R36, R37, R38, R39,
+ R4, R5, R6, R7,
+ R1, R12, R13, R0]>;
//
// Pregicate registers
@@ -154,7 +182,7 @@ def P61 : IA64Register<"p61">;
def P62 : IA64Register<"p62">;
def P63 : IA64Register<"p63">;
-def Predicate : IA64RegisterClass<[i1], 0,
+def P : IA64RegisterClass<[i1], 0,
[P0, P1, P2, P3, P4, P5, P16, P17, P18, P19, P20, P21, P22, P23, P24, P25,
P26, P27, P28, P29, P30, P31, P32, P33, P34, P35, P36, P37, P38, P39, P40,
P41, P42, P43, P44, P45, P46, P47, P48, P49, P50, P51, P52, P53, P54, P55,
Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.cpp
==============================================================================
--- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.cpp Mon Jul 4 19:33:04 2011 (r223766)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.cpp Mon Jul 4 19:51:26 2011 (r223767)
@@ -28,6 +28,8 @@
using namespace llvm;
+#include "IA64GenCallingConv.inc"
+
IA64TargetLowering::IA64TargetLowering(IA64TargetMachine &tm) :
TargetLowering(tm, new TargetLoweringObjectFileELF()),
Subtarget(*tm.getSubtargetImpl()),
@@ -36,10 +38,10 @@ IA64TargetLowering::IA64TargetLowering(I
TD = getTargetData();
// Set up the register classes.
- addRegisterClass(MVT::i64, &IA64::BranchRegClass);
- addRegisterClass(MVT::f128, &IA64::FloatingPointRegClass);
- addRegisterClass(MVT::i64, &IA64::GeneralRegClass);
- addRegisterClass(MVT::i1, &IA64::PredicateRegClass);
+ addRegisterClass(MVT::i64, &IA64::BRRegClass);
+ addRegisterClass(MVT::f128, &IA64::FRRegClass);
+ addRegisterClass(MVT::i64, &IA64::GRRegClass);
+ addRegisterClass(MVT::i1, &IA64::PRegClass);
// Compute derived properties from the register classes
computeRegisterProperties();
@@ -51,6 +53,18 @@ IA64TargetLowering::IA64TargetLowering(I
setJumpBufAlignment(16);
}
+const char *
+IA64TargetLowering::getTargetNodeName(unsigned Opcode) const
+{
+ const char *nn;
+
+ switch (Opcode) {
+ case IA64ISD::RET_FLAG: nn = "IA64ISD::RET_FLAG"; break;
+ default: nn = NULL; break;
+ }
+ return nn;
+}
+
SDValue
IA64TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
CallingConv::ID CallConv, bool isVarArg, bool &isTailCall,
@@ -72,21 +86,37 @@ IA64TargetLowering::LowerFormalArguments
SmallVectorImpl &InVals) const
{
MachineFunction &MF = DAG.getMachineFunction();
- SDValue Val;
+ SmallVector ArgLocs;
+ CCState CCInfo(CallConv, isVarArg, MF, getTargetMachine(), ArgLocs,
+ *DAG.getContext());
DEBUG(dbgs() << "XXX: IA64TargetLowering::" << __func__ << "\n");
- for (unsigned ArgNo = 0, e = Ins.size(); ArgNo != e; ++ArgNo) {
- EVT vt = Ins[ArgNo].VT;
+ CCInfo.AllocateStack(0, 8);
+ CCInfo.AnalyzeFormalArguments(Ins, CC_IA64);
- unsigned VReg =
- MF.getRegInfo().createVirtualRegister(&IA64::GeneralRegClass);
- MF.getRegInfo().addLiveIn(IA64::R32, VReg);
- Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i64);
- InVals.push_back(Val);
+ for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
+ CCValAssign &VA = ArgLocs[i];
+ EVT ValVT = VA.getValVT();
+ TargetRegisterClass *RC;
+
+ if (!VA.isRegLoc())
+ llvm_unreachable(__func__);
+
+ switch (ValVT.getSimpleVT().SimpleTy) {
+ case MVT::i64:
+ RC = &IA64::GRRegClass;
+ break;
+ default:
+ llvm_unreachable(__func__);
+ }
+
+ unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC);
+ SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, Reg, ValVT);
+ InVals.push_back(ArgValue);
- DEBUG(dbgs() << ArgNo << ": " << vt.getSimpleVT().SimpleTy << " -> " <<
- VReg << "\n:");
+ DEBUG(dbgs() << i << ": " << ValVT.getSimpleVT().SimpleTy << " -> " <<
+ Reg << "\n");
}
return Chain;
@@ -99,8 +129,34 @@ IA64TargetLowering::LowerReturn(SDValue
SelectionDAG &DAG) const
{
MachineFunction &MF = DAG.getMachineFunction();
+ SmallVector RVLocs;
+ CCState CCInfo(CallConv, isVarArg, MF, getTargetMachine(), RVLocs,
+ *DAG.getContext());
+ CCInfo.AnalyzeReturn(Outs, RetCC_IA64);
DEBUG(dbgs() << "XXX: IA64TargetLowering::" <<__func__ << "\n");
- return Chain;
+ if (MF.getRegInfo().liveout_empty()) {
+ for (unsigned i = 0; i != RVLocs.size(); ++i)
+ MF.getRegInfo().addLiveOut(RVLocs[i].getLocReg());
+ }
+
+ SDValue Flag;
+
+ for (unsigned i = 0; i != RVLocs.size(); ++i) {
+ CCValAssign &VA = RVLocs[i];
+
+ if (!VA.isRegLoc())
+ llvm_unreachable(__func__);
+
+ Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), OutVals[i], Flag);
+ Flag = Chain.getValue(1);
+ }
+
+ SDValue result;
+ if (Flag.getNode())
+ result = DAG.getNode(IA64ISD::RET_FLAG, dl, MVT::Other, Chain, Flag);
+ else
+ result = DAG.getNode(IA64ISD::RET_FLAG, dl, MVT::Other, Chain);
+ return result;
}
Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.h
==============================================================================
--- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.h Mon Jul 4 19:33:04 2011 (r223766)
+++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64TargetLowering.h Mon Jul 4 19:51:26 2011 (r223767)
@@ -7,6 +7,15 @@
namespace llvm {
+ namespace IA64ISD {
+
+ enum {
+ FIRST_NUMBER = ISD::BUILTIN_OP_END,
+ RET_FLAG, // Return with a flag operand (in operand 0).
+ };
+
+ } // namespace IA64ISD
+
class IA64Subtarget;
class IA64TargetMachine;
@@ -18,6 +27,8 @@ namespace llvm {
public:
explicit IA64TargetLowering(IA64TargetMachine &TM);
+ virtual const char *getTargetNodeName(unsigned Opcode) const;
+
virtual SDValue LowerCall(SDValue Chain, SDValue Callee,
CallingConv::ID CallConv, bool isVarArg, bool &isTailCall,
const SmallVectorImpl &Outs,
Added: projects/llvm-ia64/lib/clang/include/IA64GenCallingConv.inc
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/llvm-ia64/lib/clang/include/IA64GenCallingConv.inc Mon Jul 4 19:51:26 2011 (r223767)
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+#include "IA64GenCallingConv.inc.h"
From owner-svn-src-projects@FreeBSD.ORG Mon Jul 4 20:10:30 2011
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 61D1D1065674;
Mon, 4 Jul 2011 20:10:30 +0000 (UTC)
(envelope-from rdivacky@vlakno.cz)
Received: from vlakno.cz (lev.vlakno.cz [46.28.110.116])
by mx1.freebsd.org (Postfix) with ESMTP id 234E48FC1C;
Mon, 4 Jul 2011 20:10:29 +0000 (UTC)
Received: by vlakno.cz (Postfix, from userid 1002)
id A00377F4A4B; Mon, 4 Jul 2011 22:10:28 +0200 (CEST)
Date: Mon, 4 Jul 2011 22:10:28 +0200
From: Roman Divacky
To: Marcel Moolenaar
Message-ID: <20110704201028.GA5939@freebsd.org>
References: <201107041951.p64JpQDk032074@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201107041951.p64JpQDk032074@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r223767 - in projects/llvm-ia64:
contrib/llvm/lib/Target/IA64 lib/clang/include
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, 04 Jul 2011 20:10:30 -0000
First of all.. big wow :) This is awesome progress.
On Mon, Jul 04, 2011 at 07:51:26PM +0000, Marcel Moolenaar wrote:
> Author: marcel
> Date: Mon Jul 4 19:51:26 2011
> New Revision: 223767
> URL: http://svn.freebsd.org/changeset/base/223767
>
> Log:
> o Implement LowerFormalArguments() LowerReturn() using CallingConv and
> for general registers only.
> o Implement IA64InstrInfo::copyPhysReg() for general registers. This
> is needed during lowering and before copy elimination.
This seems wrong. See below.
> +void
> +IA64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
> + MachineBasicBlock::iterator MI, DebugLoc DL, unsigned DestReg,
> + unsigned SrcReg, bool KillSrc) const
> +{
> + bool GRDest = IA64::GRRegClass.contains(DestReg);
> + bool GRSrc = IA64::GRRegClass.contains(SrcReg);
> +
> + if (GRDest && GRSrc) {
> + MachineInstrBuilder MIB = BuildMI(MBB, MI, DL, get(IA64::ADD), DestReg);
> + MIB.addReg(IA64::R0);
> + MIB.addReg(SrcReg, getKillRegState(KillSrc));
> + return;
> + }
> +
> + llvm_unreachable(__func__);
> +}
copyPhysReg() done via ADD ? Is this just some temporary measure to achieve
emission of any code? I am not even sure how this can work. The IR should
require you to lower the ISD::ADD node, right? You don't seem to be doing that.
Anyway, pretty good progress - seems like you're getting grasp of LLVM very
fast!
roman
From owner-svn-src-projects@FreeBSD.ORG Mon Jul 4 20:39:37 2011
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 20DBE106567C;
Mon, 4 Jul 2011 20:39:37 +0000 (UTC)
(envelope-from marcel@xcllnt.net)
Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4])
by mx1.freebsd.org (Postfix) with ESMTP id DF4F88FC2B;
Mon, 4 Jul 2011 20:39:36 +0000 (UTC)
Received: from dhcp-192-168-2-22.wifi.xcllnt.net (atm.xcllnt.net [70.36.220.6])
(authenticated bits=0)
by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id p64KdWI0070662
(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO);
Mon, 4 Jul 2011 13:39:36 -0700 (PDT)
(envelope-from marcel@xcllnt.net)
Mime-Version: 1.0 (Apple Message framework v1084)
Content-Type: text/plain; charset=us-ascii
From: Marcel Moolenaar
In-Reply-To: <20110704201028.GA5939@freebsd.org>
Date: Mon, 4 Jul 2011 13:39:32 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <57E084BD-1E76-42F3-8B32-94FB3287F92D@xcllnt.net>
References: <201107041951.p64JpQDk032074@svn.freebsd.org>
<20110704201028.GA5939@freebsd.org>
To: Roman Divacky
X-Mailer: Apple Mail (2.1084)
Cc: svn-src-projects@freebsd.org, Marcel Moolenaar ,
src-committers@freebsd.org
Subject: Re: svn commit: r223767 - in projects/llvm-ia64:
contrib/llvm/lib/Target/IA64 lib/clang/include
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, 04 Jul 2011 20:39:37 -0000
On Jul 4, 2011, at 1:10 PM, Roman Divacky wrote:
> First of all.. big wow :) This is awesome progress.
Thanks!
>> +void
>> +IA64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
>> + MachineBasicBlock::iterator MI, DebugLoc DL, unsigned DestReg,
>> + unsigned SrcReg, bool KillSrc) const
>> +{
>> + bool GRDest =3D IA64::GRRegClass.contains(DestReg);
>> + bool GRSrc =3D IA64::GRRegClass.contains(SrcReg);
>> +
>> + if (GRDest && GRSrc) {
>> + MachineInstrBuilder MIB =3D BuildMI(MBB, MI, DL, get(IA64::ADD), =
DestReg);
>> + MIB.addReg(IA64::R0);
>> + MIB.addReg(SrcReg, getKillRegState(KillSrc));
>> + return;
>> + }
>> +
>> + llvm_unreachable(__func__);
>> +}
>=20
> copyPhysReg() done via ADD ? Is this just some temporary measure to =
achieve
> emission of any code? I am not even sure how this can work. The IR =
should
> require you to lower the ISD::ADD node, right? You don't seem to be =
doing that.
On ia64 there's no copy instruction in H/W. The assembler defines
"mov r1=3Dr2" as a pseudo-op of "adds r1=3D0,r2". Since I didn't want
to introduce an immediate operand yet, I simply used r0, which is
hardwired as 0. The result is the same...
As for the lowering: the add is eliminated shortly after it's
created by virtue of copy elimination, CSE and/or GVN on the
selection DAG. We know we can lower ADDs anyway, because it's
in the assembly output :-)
--=20
Marcel Moolenaar
marcel@xcllnt.net
From owner-svn-src-projects@FreeBSD.ORG Wed Jul 6 21:40:48 2011
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 66E87106566C;
Wed, 6 Jul 2011 21:40:48 +0000 (UTC)
(envelope-from neel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 5748C8FC13;
Wed, 6 Jul 2011 21:40:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p66Lema1032962;
Wed, 6 Jul 2011 21:40:48 GMT (envelope-from neel@svn.freebsd.org)
Received: (from neel@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p66LemEK032960;
Wed, 6 Jul 2011 21:40:48 GMT (envelope-from neel@svn.freebsd.org)
Message-Id: <201107062140.p66LemEK032960@svn.freebsd.org>
From: Neel Natu
Date: Wed, 6 Jul 2011 21:40:48 +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: r223826 - projects/bhyve/sys/amd64/vmm/io
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: Wed, 06 Jul 2011 21:40:48 -0000
Author: neel
Date: Wed Jul 6 21:40:48 2011
New Revision: 223826
URL: http://svn.freebsd.org/changeset/base/223826
Log:
Get rid of redundant initialization of 'dmask'. It was being re-initialized
shortly afterwards.
Modified:
projects/bhyve/sys/amd64/vmm/io/vlapic.c
Modified: projects/bhyve/sys/amd64/vmm/io/vlapic.c
==============================================================================
--- projects/bhyve/sys/amd64/vmm/io/vlapic.c Wed Jul 6 20:06:44 2011 (r223825)
+++ projects/bhyve/sys/amd64/vmm/io/vlapic.c Wed Jul 6 21:40:48 2011 (r223826)
@@ -443,8 +443,6 @@ lapic_process_icr(struct vlapic *vlapic,
cpuset_t dmask;
uint32_t dest, vec, mode;
- CPU_ZERO(&dmask);
-
dest = icrval >> 32;
vec = icrval & APIC_VECTOR_MASK;
mode = icrval & APIC_DELMODE_MASK;
From owner-svn-src-projects@FreeBSD.ORG Wed Jul 6 21:49:56 2011
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 6EF97106566C;
Wed, 6 Jul 2011 21:49:56 +0000 (UTC)
(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 5F3268FC1A;
Wed, 6 Jul 2011 21:49:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p66Lnua5033250;
Wed, 6 Jul 2011 21:49:56 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p66Lnufg033248;
Wed, 6 Jul 2011 21:49:56 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <201107062149.p66Lnufg033248@svn.freebsd.org>
From: Jamie Gritton
Date: Wed, 6 Jul 2011 21:49:56 +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: r223827 - projects/jailconf/usr.sbin/jail
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: Wed, 06 Jul 2011 21:49:56 -0000
Author: jamie
Date: Wed Jul 6 21:49:56 2011
New Revision: 223827
URL: http://svn.freebsd.org/changeset/base/223827
Log:
Don't report errors for the exit status of processes that are killed
as part of jail removal (IP_STOP_TIMEOUT).
Note a jail as "removed" even if it wasn't jail_remove() that did
the deed, e.g. if it already went away because all its processes
were killed.
Modified:
projects/jailconf/usr.sbin/jail/command.c
Modified: projects/jailconf/usr.sbin/jail/command.c
==============================================================================
--- projects/jailconf/usr.sbin/jail/command.c Wed Jul 6 21:40:48 2011 (r223826)
+++ projects/jailconf/usr.sbin/jail/command.c Wed Jul 6 21:49:56 2011 (r223827)
@@ -150,11 +150,15 @@ finish_command(struct cfjail *j)
if (!(j->flags & JF_SLEEPQ))
return 0;
j->flags &= ~JF_SLEEPQ;
- if (*j->comparam != IP_STOP_TIMEOUT) {
- paralimit++;
- if (!TAILQ_EMPTY(&runnable))
- requeue(TAILQ_FIRST(&runnable), &ready);
+ if (*j->comparam == IP_STOP_TIMEOUT)
+ {
+ j->flags &= ~JF_TIMEOUT;
+ j->pstatus = 0;
+ return 0;
}
+ paralimit++;
+ if (!TAILQ_EMPTY(&runnable))
+ requeue(TAILQ_FIRST(&runnable), &ready);
error = 0;
if (j->flags & JF_TIMEOUT) {
j->flags &= ~JF_TIMEOUT;
@@ -270,8 +274,8 @@ run_command(struct cfjail *j)
case IP__OP:
if (down) {
- if (jail_remove(j->jid) == 0 && verbose >= 0 &&
- (verbose > 0 || (j->flags & JF_STOP
+ (void)jail_remove(j->jid);
+ if (verbose > 0 || (verbose == 0 && (j->flags & JF_STOP
? note_remove : j->name != NULL)))
jail_note(j, "removed\n");
j->jid = -1;
From owner-svn-src-projects@FreeBSD.ORG Wed Jul 6 22:38:09 2011
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 EFEB7106566C;
Wed, 6 Jul 2011 22:38:09 +0000 (UTC)
(envelope-from neel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id DEB198FC14;
Wed, 6 Jul 2011 22:38:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p66Mc9s1034698;
Wed, 6 Jul 2011 22:38:09 GMT (envelope-from neel@svn.freebsd.org)
Received: (from neel@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p66Mc9sR034694;
Wed, 6 Jul 2011 22:38:09 GMT (envelope-from neel@svn.freebsd.org)
Message-Id: <201107062238.p66Mc9sR034694@svn.freebsd.org>
From: Neel Natu
Date: Wed, 6 Jul 2011 22:38:09 +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: r223828 - in projects/bhyve/usr.sbin: . bhyveload
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: Wed, 06 Jul 2011 22:38:10 -0000
Author: neel
Date: Wed Jul 6 22:38:09 2011
New Revision: 223828
URL: http://svn.freebsd.org/changeset/base/223828
Log:
'bhyveload' is a userspace FreeBSD loader that can load the kernel + metadata
inside a BHyVe-based virtual machine.
It is a thin wrapper on top of userboot.so which is a variant of the FreeBSD
loader packaged as a shared library. 'bhyveload' provides callbacks that are
utilized by userboot.so to do things like console i/o, disk i/o,
set virtual machine registers etc.
Thanks for Doug Rabson (dfr@) for making this happen.
Added:
projects/bhyve/usr.sbin/bhyveload/
projects/bhyve/usr.sbin/bhyveload/Makefile (contents, props changed)
projects/bhyve/usr.sbin/bhyveload/bhyveload.c (contents, props changed)
Modified:
projects/bhyve/usr.sbin/Makefile.amd64
Modified: projects/bhyve/usr.sbin/Makefile.amd64
==============================================================================
--- projects/bhyve/usr.sbin/Makefile.amd64 Wed Jul 6 21:49:56 2011 (r223827)
+++ projects/bhyve/usr.sbin/Makefile.amd64 Wed Jul 6 22:38:09 2011 (r223828)
@@ -11,6 +11,7 @@ SUBDIR+= apm
.endif
SUBDIR+= asf
SUBDIR+= bhyve
+SUBDIR+= bhyveload
SUBDIR+= boot0cfg
.if ${MK_TOOLCHAIN} != "no"
SUBDIR+= btxld
Added: projects/bhyve/usr.sbin/bhyveload/Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve/usr.sbin/bhyveload/Makefile Wed Jul 6 22:38:09 2011 (r223828)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PROG= bhyveload
+SRCS= bhyveload.c
+NO_MAN=
+
+DPADD+= ${LIBVMMAPI}
+LDADD+= -lvmmapi
+
+WARNS?= 3
+
+CFLAGS+=-I${.CURDIR}/../../sys/boot/userboot
+
+.include
Added: projects/bhyve/usr.sbin/bhyveload/bhyveload.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/bhyve/usr.sbin/bhyveload/bhyveload.c Wed Jul 6 22:38:09 2011 (r223828)
@@ -0,0 +1,604 @@
+/*-
+ * Copyright (c) 2011 NetApp, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY 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$
+ */
+
+/*-
+ * Copyright (c) 2011 Google, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY 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$
+ */
+
+#include
+__FBSDID("$FreeBSD$");
+
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include "userboot.h"
+
+#define MB (1024 * 1024UL)
+#define GB (1024 * 1024 * 1024UL)
+#define BSP 0
+
+static char *host_base = "/";
+static struct termios term, oldterm;
+static int disk_fd = -1;
+
+static char *vmname, *progname, *membase;
+static uint64_t lowmem, highmem;
+static struct vmctx *ctx;
+
+static uint64_t gdtbase, cr3, rsp;
+
+static void cb_exit(void *arg, int v);
+
+/*
+ * Console i/o callbacks
+ */
+
+static void
+cb_putc(void *arg, int ch)
+{
+ char c = ch;
+
+ write(1, &c, 1);
+}
+
+static int
+cb_getc(void *arg)
+{
+ char c;
+
+ if (read(0, &c, 1) == 1)
+ return (c);
+ return (-1);
+}
+
+static int
+cb_poll(void *arg)
+{
+ int n;
+
+ if (ioctl(0, FIONREAD, &n) >= 0)
+ return (n > 0);
+ return (0);
+}
+
+/*
+ * Host filesystem i/o callbacks
+ */
+
+struct cb_file {
+ int cf_isdir;
+ size_t cf_size;
+ struct stat cf_stat;
+ union {
+ int fd;
+ DIR *dir;
+ } cf_u;
+};
+
+static int
+cb_open(void *arg, const char *filename, void **hp)
+{
+ struct stat st;
+ struct cb_file *cf;
+ char path[PATH_MAX];
+
+ if (!host_base)
+ return (ENOENT);
+
+ strlcpy(path, host_base, PATH_MAX);
+ if (path[strlen(path) - 1] == '/')
+ path[strlen(path) - 1] = 0;
+ strlcat(path, filename, PATH_MAX);
+ cf = malloc(sizeof(struct cb_file));
+ if (stat(path, &cf->cf_stat) < 0) {
+ free(cf);
+ return (errno);
+ }
+
+ cf->cf_size = st.st_size;
+ if (S_ISDIR(cf->cf_stat.st_mode)) {
+ cf->cf_isdir = 1;
+ cf->cf_u.dir = opendir(path);
+ if (!cf->cf_u.dir)
+ goto out;
+ *hp = cf;
+ return (0);
+ }
+ if (S_ISREG(cf->cf_stat.st_mode)) {
+ cf->cf_isdir = 0;
+ cf->cf_u.fd = open(path, O_RDONLY);
+ if (cf->cf_u.fd < 0)
+ goto out;
+ *hp = cf;
+ return (0);
+ }
+
+out:
+ free(cf);
+ return (EINVAL);
+}
+
+static int
+cb_close(void *arg, void *h)
+{
+ struct cb_file *cf = h;
+
+ if (cf->cf_isdir)
+ closedir(cf->cf_u.dir);
+ else
+ close(cf->cf_u.fd);
+ free(cf);
+
+ return (0);
+}
+
+static int
+cb_isdir(void *arg, void *h)
+{
+ struct cb_file *cf = h;
+
+ return (cf->cf_isdir);
+}
+
+static int
+cb_read(void *arg, void *h, void *buf, size_t size, size_t *resid)
+{
+ struct cb_file *cf = h;
+ ssize_t sz;
+
+ if (cf->cf_isdir)
+ return (EINVAL);
+ sz = read(cf->cf_u.fd, buf, size);
+ if (sz < 0)
+ return (EINVAL);
+ *resid = size - sz;
+ return (0);
+}
+
+static int
+cb_readdir(void *arg, void *h, uint32_t *fileno_return, uint8_t *type_return,
+ size_t *namelen_return, char *name)
+{
+ struct cb_file *cf = h;
+ struct dirent *dp;
+
+ if (!cf->cf_isdir)
+ return (EINVAL);
+
+ dp = readdir(cf->cf_u.dir);
+ if (!dp)
+ return (ENOENT);
+
+ /*
+ * Note: d_namlen is in the range 0..255 and therefore less
+ * than PATH_MAX so we don't need to test before copying.
+ */
+ *fileno_return = dp->d_fileno;
+ *type_return = dp->d_type;
+ *namelen_return = dp->d_namlen;
+ memcpy(name, dp->d_name, dp->d_namlen);
+ name[dp->d_namlen] = 0;
+
+ return (0);
+}
+
+static int
+cb_seek(void *arg, void *h, uint64_t offset, int whence)
+{
+ struct cb_file *cf = h;
+
+ if (cf->cf_isdir)
+ return (EINVAL);
+ if (lseek(cf->cf_u.fd, offset, whence) < 0)
+ return (errno);
+ return (0);
+}
+
+static int
+cb_stat(void *arg, void *h, int *mode, int *uid, int *gid, uint64_t *size)
+{
+ struct cb_file *cf = h;
+
+ *mode = cf->cf_stat.st_mode;
+ *uid = cf->cf_stat.st_uid;
+ *gid = cf->cf_stat.st_gid;
+ *size = cf->cf_stat.st_size;
+ return (0);
+}
+
+/*
+ * Disk image i/o callbacks
+ */
+
+static int
+cb_diskread(void *arg, int unit, uint64_t from, void *to, size_t size,
+ size_t *resid)
+{
+ ssize_t n;
+
+ if (unit != 0 || disk_fd == -1)
+ return (EIO);
+ n = pread(disk_fd, to, size, from);
+ if (n < 0)
+ return (errno);
+ *resid = size - n;
+ return (0);
+}
+
+/*
+ * Guest virtual machine i/o callbacks
+ */
+static int
+cb_copyin(void *arg, const void *from, uint64_t to, size_t size)
+{
+
+ to &= 0x7fffffff;
+ if (to > lowmem)
+ return (EFAULT);
+ if (to + size > lowmem)
+ size = lowmem - to;
+
+ memcpy(&membase[to], from, size);
+
+ return (0);
+}
+
+static int
+cb_copyout(void *arg, uint64_t from, void *to, size_t size)
+{
+
+ from &= 0x7fffffff;
+ if (from > lowmem)
+ return (EFAULT);
+ if (from + size > lowmem)
+ size = lowmem - from;
+
+ memcpy(to, &membase[from], size);
+
+ return (0);
+}
+
+static void
+cb_setreg(void *arg, int r, uint64_t v)
+{
+ int error;
+ enum vm_reg_name vmreg;
+
+ vmreg = VM_REG_LAST;
+
+ switch (r) {
+ case 4:
+ vmreg = VM_REG_GUEST_RSP;
+ rsp = v;
+ break;
+ default:
+ break;
+ }
+
+ if (vmreg == VM_REG_LAST) {
+ printf("test_setreg(%d): not implemented\n", r);
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+
+ error = vm_set_register(ctx, BSP, vmreg, v);
+ if (error) {
+ perror("vm_set_register");
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+}
+
+static void
+cb_setmsr(void *arg, int r, uint64_t v)
+{
+ int error;
+ enum vm_reg_name vmreg;
+
+ vmreg = VM_REG_LAST;
+
+ switch (r) {
+ case MSR_EFER:
+ vmreg = VM_REG_GUEST_EFER;
+ break;
+ default:
+ break;
+ }
+
+ if (vmreg == VM_REG_LAST) {
+ printf("test_setmsr(%d): not implemented\n", r);
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+
+ error = vm_set_register(ctx, BSP, vmreg, v);
+ if (error) {
+ perror("vm_set_msr");
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+}
+
+static void
+cb_setcr(void *arg, int r, uint64_t v)
+{
+ int error;
+ enum vm_reg_name vmreg;
+
+ vmreg = VM_REG_LAST;
+
+ switch (r) {
+ case 0:
+ vmreg = VM_REG_GUEST_CR0;
+ break;
+ case 3:
+ vmreg = VM_REG_GUEST_CR3;
+ cr3 = v;
+ break;
+ case 4:
+ vmreg = VM_REG_GUEST_CR4;
+ break;
+ default:
+ break;
+ }
+
+ if (vmreg == VM_REG_LAST) {
+ printf("test_setcr(%d): not implemented\n", r);
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+
+ error = vm_set_register(ctx, BSP, vmreg, v);
+ if (error) {
+ perror("vm_set_cr");
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+}
+
+static void
+cb_setgdt(void *arg, uint64_t base, size_t size)
+{
+ int error;
+
+ error = vm_set_desc(ctx, BSP, VM_REG_GUEST_GDTR, base, size - 1, 0);
+ if (error != 0) {
+ perror("vm_set_desc(gdt)");
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+
+ gdtbase = base;
+}
+
+static void
+cb_exec(void *arg, uint64_t rip)
+{
+ int error;
+
+ error = vm_setup_freebsd_registers(ctx, BSP, rip, cr3, gdtbase, rsp);
+ if (error) {
+ perror("vm_setup_freebsd_registers");
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ }
+
+ cb_exit(NULL, 0);
+}
+
+/*
+ * Misc
+ */
+
+static void
+cb_delay(void *arg, int usec)
+{
+
+ usleep(usec);
+}
+
+static void
+cb_exit(void *arg, int v)
+{
+
+ tcsetattr(0, TCSAFLUSH, &oldterm);
+ exit(v);
+}
+
+static void
+cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *ret_highmem)
+{
+
+ *ret_lowmem = lowmem;
+ *ret_highmem = highmem;
+}
+
+static struct loader_callbacks_v1 cb = {
+ .getc = cb_getc,
+ .putc = cb_putc,
+ .poll = cb_poll,
+
+ .open = cb_open,
+ .close = cb_close,
+ .isdir = cb_isdir,
+ .read = cb_read,
+ .readdir = cb_readdir,
+ .seek = cb_seek,
+ .stat = cb_stat,
+
+ .diskread = cb_diskread,
+
+ .copyin = cb_copyin,
+ .copyout = cb_copyout,
+ .setreg = cb_setreg,
+ .setmsr = cb_setmsr,
+ .setcr = cb_setcr,
+ .setgdt = cb_setgdt,
+ .exec = cb_exec,
+
+ .delay = cb_delay,
+ .exit = cb_exit,
+ .getmem = cb_getmem,
+};
+
+static void
+usage(void)
+{
+
+ printf("usage: %s [-d ] [-h ] "
+ "[-m ][-M ] "
+ "\n", progname);
+ exit(1);
+}
+
+int
+main(int argc, char** argv)
+{
+ void *h;
+ void (*func)(struct loader_callbacks_v1 *, void *, int, int);
+ int opt, error;
+ char *disk_image;
+
+ progname = argv[0];
+
+ lowmem = 768 * MB;
+ highmem = 0;
+ disk_image = NULL;
+
+ while ((opt = getopt(argc, argv, "d:h:m:M:")) != -1) {
+ switch (opt) {
+ case 'd':
+ disk_image = optarg;
+ break;
+
+ case 'h':
+ host_base = optarg;
+ break;
+
+ case 'm':
+ lowmem = strtoul(optarg, NULL, 0) * MB;
+ break;
+
+ case 'M':
+ highmem = strtoul(optarg, NULL, 0) * MB;
+ break;
+
+ case '?':
+ usage();
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 1)
+ usage();
+
+ vmname = argv[0];
+
+ error = vm_create(vmname);
+ if (error != 0 && errno != EEXIST) {
+ perror("vm_create");
+ exit(1);
+
+ }
+
+ ctx = vm_open(vmname);
+ if (ctx == NULL) {
+ perror("vm_open");
+ exit(1);
+ }
+
+ error = vm_setup_memory(ctx, 0, lowmem, &membase);
+ if (error) {
+ perror("vm_setup_memory(lowmem)");
+ exit(1);
+ }
+
+ if (highmem != 0) {
+ error = vm_setup_memory(ctx, 4 * GB, highmem, NULL);
+ if (error) {
+ perror("vm_setup_memory(highmem)");
+ exit(1);
+ }
+ }
+
+ tcgetattr(0, &term);
+ oldterm = term;
+ term.c_lflag &= ~(ICANON|ECHO);
+ term.c_iflag &= ~ICRNL;
+ tcsetattr(0, TCSAFLUSH, &term);
+ h = dlopen("./userboot.so", RTLD_LOCAL);
+ if (!h) {
+ printf("%s\n", dlerror());
+ return (1);
+ }
+ func = dlsym(h, "loader_main");
+ if (!func) {
+ printf("%s\n", dlerror());
+ return (1);
+ }
+
+ if (disk_image) {
+ disk_fd = open(disk_image, O_RDONLY);
+ }
+ func(&cb, NULL, USERBOOT_VERSION_1, disk_fd >= 0);
+}
From owner-svn-src-projects@FreeBSD.ORG Thu Jul 7 05:07:26 2011
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 A975E106566B;
Thu, 7 Jul 2011 05:07:26 +0000 (UTC)
(envelope-from andreast@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 95A5E8FC14;
Thu, 7 Jul 2011 05:07:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6757Qbs046484;
Thu, 7 Jul 2011 05:07:26 GMT (envelope-from andreast@svn.freebsd.org)
Received: (from andreast@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6757QDd046463;
Thu, 7 Jul 2011 05:07:26 GMT (envelope-from andreast@svn.freebsd.org)
Message-Id: <201107070507.p6757QDd046463@svn.freebsd.org>
From: Andreas Tobler
Date: Thu, 7 Jul 2011 05:07:26 +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: r223833 - in projects/pseries: amd64/acpica amd64/amd64
amd64/include arm/arm arm/at91 arm/conf arm/mv arm/sa11x0
boot boot/common boot/ficl/amd64 boot/i386/libi386
boot/i386/zfsboot bo...
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: Thu, 07 Jul 2011 05:07:26 -0000
Author: andreast
Date: Thu Jul 7 05:07:25 2011
New Revision: 223833
URL: http://svn.freebsd.org/changeset/base/223833
Log:
MFC.
Added:
projects/pseries/boot/common/disk.c
- copied unchanged from r223832, head/sys/boot/common/disk.c
projects/pseries/boot/common/disk.h
- copied unchanged from r223832, head/sys/boot/common/disk.h
projects/pseries/boot/ficl/amd64/
- copied from r223832, head/sys/boot/ficl/amd64/
projects/pseries/boot/userboot/
- copied from r223832, head/sys/boot/userboot/
projects/pseries/contrib/pf/net/if_pflow.h
- copied unchanged from r223832, head/sys/contrib/pf/net/if_pflow.h
projects/pseries/contrib/pf/net/pf_lb.c
- copied unchanged from r223832, head/sys/contrib/pf/net/pf_lb.c
projects/pseries/dev/pci/pci_subr.c
- copied unchanged from r223832, head/sys/dev/pci/pci_subr.c
projects/pseries/modules/pfsync/
- copied from r223832, head/sys/modules/pfsync/
Deleted:
projects/pseries/contrib/pf/net/pf_subr.c
Modified:
projects/pseries/amd64/acpica/acpi_wakeup.c
projects/pseries/amd64/amd64/mp_machdep.c
projects/pseries/amd64/amd64/pmap.c
projects/pseries/amd64/amd64/sys_machdep.c
projects/pseries/amd64/amd64/vm_machdep.c
projects/pseries/amd64/include/cpufunc.h
projects/pseries/arm/arm/pmap.c
projects/pseries/arm/arm/sys_machdep.c
projects/pseries/arm/at91/at91_machdep.c
projects/pseries/arm/conf/CAMBRIA
projects/pseries/arm/mv/common.c
projects/pseries/arm/sa11x0/assabet_machdep.c
projects/pseries/arm/sa11x0/sa11x0.c
projects/pseries/boot/Makefile
projects/pseries/boot/Makefile.amd64
projects/pseries/boot/Makefile.arm
projects/pseries/boot/Makefile.powerpc
projects/pseries/boot/common/Makefile.inc
projects/pseries/boot/common/load_elf.c
projects/pseries/boot/common/reloc_elf.c
projects/pseries/boot/i386/libi386/bioscd.c
projects/pseries/boot/i386/zfsboot/zfsldr.S
projects/pseries/boot/sparc64/loader/main.c
projects/pseries/cam/cam_xpt.c
projects/pseries/cam/scsi/scsi_cd.c
projects/pseries/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
projects/pseries/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
projects/pseries/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c
projects/pseries/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
projects/pseries/cddl/dev/dtrace/amd64/dtrace_subr.c
projects/pseries/cddl/dev/dtrace/i386/dtrace_subr.c
projects/pseries/conf/NOTES
projects/pseries/conf/files
projects/pseries/conf/files.ia64
projects/pseries/conf/options
projects/pseries/contrib/altq/altq/altq_red.c
projects/pseries/contrib/pf/net/if_pflog.c
projects/pseries/contrib/pf/net/if_pflog.h
projects/pseries/contrib/pf/net/if_pfsync.c
projects/pseries/contrib/pf/net/if_pfsync.h
projects/pseries/contrib/pf/net/pf.c
projects/pseries/contrib/pf/net/pf_if.c
projects/pseries/contrib/pf/net/pf_ioctl.c
projects/pseries/contrib/pf/net/pf_mtag.h
projects/pseries/contrib/pf/net/pf_norm.c
projects/pseries/contrib/pf/net/pf_osfp.c
projects/pseries/contrib/pf/net/pf_ruleset.c
projects/pseries/contrib/pf/net/pf_table.c
projects/pseries/contrib/pf/net/pfvar.h
projects/pseries/dev/acpica/acpi.c
projects/pseries/dev/acpica/acpi_cpu.c
projects/pseries/dev/acpica/acpi_thermal.c
projects/pseries/dev/ahci/ahci.c
projects/pseries/dev/an/if_an.c
projects/pseries/dev/ath/ah_osdep.c
projects/pseries/dev/ath/ath_hal/ah_eeprom_9287.h
projects/pseries/dev/ath/ath_hal/ah_internal.h
projects/pseries/dev/ath/ath_hal/ar9002/ar9287_attach.c
projects/pseries/dev/ath/if_ath.c
projects/pseries/dev/dc/dcphy.c
projects/pseries/dev/dc/pnphy.c
projects/pseries/dev/e1000/if_em.c
projects/pseries/dev/e1000/if_igb.c
projects/pseries/dev/e1000/if_igb.h
projects/pseries/dev/en/if_en_pci.c
projects/pseries/dev/et/if_et.c
projects/pseries/dev/fdc/fdc_pccard.c
projects/pseries/dev/fxp/if_fxp.c
projects/pseries/dev/gem/if_gem.c
projects/pseries/dev/gem/if_gemvar.h
projects/pseries/dev/iicbus/if_ic.c
projects/pseries/dev/lmc/if_lmc.c
projects/pseries/dev/mfi/mfi_cam.c
projects/pseries/dev/mii/e1000phy.c
projects/pseries/dev/mii/miidevs
projects/pseries/dev/my/if_my.c
projects/pseries/dev/pci/pci_pci.c
projects/pseries/dev/ppbus/if_plip.c
projects/pseries/dev/pty/pty.c
projects/pseries/dev/sis/if_sis.c
projects/pseries/dev/snp/snp.c
projects/pseries/dev/sound/macio/i2s.c
projects/pseries/dev/sound/usb/uaudio.c
projects/pseries/dev/syscons/scterm-teken.c
projects/pseries/dev/tdfx/tdfx_pci.c
projects/pseries/dev/uart/uart_bus_pci.c
projects/pseries/dev/usb/input/uep.c
projects/pseries/dev/usb/input/uhid.c
projects/pseries/dev/usb/input/ukbd.c
projects/pseries/dev/usb/input/ums.c
projects/pseries/dev/usb/misc/udbp.c
projects/pseries/dev/usb/misc/ufm.c
projects/pseries/dev/usb/net/uhso.c
projects/pseries/dev/usb/quirk/usb_quirk.c
projects/pseries/dev/usb/quirk/usb_quirk.h
projects/pseries/dev/usb/serial/ufoma.c
projects/pseries/dev/usb/serial/umodem.c
projects/pseries/dev/usb/storage/urio.c
projects/pseries/dev/usb/usb_device.c
projects/pseries/dev/usb/usb_hid.c
projects/pseries/dev/usb/usb_lookup.c
projects/pseries/dev/usb/usb_msctest.c
projects/pseries/dev/usb/usbdevs
projects/pseries/dev/usb/usbdi.h
projects/pseries/dev/usb/usbhid.h
projects/pseries/dev/usb/wlan/if_uath.c
projects/pseries/dev/xen/control/control.c
projects/pseries/fs/nfs/nfs_var.h
projects/pseries/fs/nfs/nfsproto.h
projects/pseries/fs/nfsclient/nfs_clport.c
projects/pseries/fs/nfsclient/nfs_clrpcops.c
projects/pseries/fs/nfsclient/nfs_clstate.c
projects/pseries/fs/tmpfs/tmpfs_subr.c
projects/pseries/geom/part/g_part_ebr.c
projects/pseries/geom/part/g_part_gpt.c
projects/pseries/geom/part/g_part_mbr.c
projects/pseries/i386/i386/mp_machdep.c
projects/pseries/i386/i386/pmap.c
projects/pseries/i386/i386/sys_machdep.c
projects/pseries/i386/i386/vm_machdep.c
projects/pseries/i386/include/cpufunc.h
projects/pseries/i386/xen/mp_machdep.c
projects/pseries/i386/xen/pmap.c
projects/pseries/ia64/conf/GENERIC
projects/pseries/ia64/ia64/clock.c
projects/pseries/ia64/ia64/db_machdep.c
projects/pseries/ia64/ia64/exception.S
projects/pseries/ia64/ia64/interrupt.c
projects/pseries/ia64/ia64/machdep.c
projects/pseries/ia64/ia64/mp_machdep.c
projects/pseries/ia64/ia64/pmap.c
projects/pseries/ia64/include/pcpu.h
projects/pseries/ia64/include/smp.h
projects/pseries/kern/imgact_elf.c
projects/pseries/kern/kern_descrip.c
projects/pseries/kern/kern_exec.c
projects/pseries/kern/kern_exit.c
projects/pseries/kern/kern_fork.c
projects/pseries/kern/kern_jail.c
projects/pseries/kern/kern_rmlock.c
projects/pseries/kern/kern_thr.c
projects/pseries/kern/sched_4bsd.c
projects/pseries/kern/subr_kdb.c
projects/pseries/kern/subr_pcpu.c
projects/pseries/kern/subr_smp.c
projects/pseries/kern/subr_trap.c
projects/pseries/kern/sys_capability.c
projects/pseries/kern/sysv_msg.c
projects/pseries/kern/sysv_sem.c
projects/pseries/kern/sysv_shm.c
projects/pseries/kern/tty.c
projects/pseries/kern/tty_inq.c
projects/pseries/kern/tty_outq.c
projects/pseries/kern/tty_pts.c
projects/pseries/kern/tty_ttydisc.c
projects/pseries/kern/uipc_shm.c
projects/pseries/kern/uipc_syscalls.c
projects/pseries/kern/vfs_bio.c
projects/pseries/kern/vfs_subr.c
projects/pseries/mips/atheros/ar71xx_chip.c
projects/pseries/mips/atheros/ar71xx_machdep.c
projects/pseries/mips/atheros/ar71xx_ohci.c
projects/pseries/mips/atheros/ar71xx_setup.c
projects/pseries/mips/atheros/ar724x_chip.c
projects/pseries/mips/atheros/ar91xx_chip.c
projects/pseries/mips/mips/genassym.c
projects/pseries/mips/mips/mp_machdep.c
projects/pseries/mips/mips/pmap.c
projects/pseries/mips/mips/trap.c
projects/pseries/mips/rmi/dev/xlr/rge.c
projects/pseries/mips/rmi/fmn.c
projects/pseries/mips/rmi/iodi.c
projects/pseries/mips/sentry5/s5_machdep.c
projects/pseries/mips/sibyte/sb_machdep.c
projects/pseries/modules/Makefile
projects/pseries/modules/ipdivert/Makefile
projects/pseries/modules/pf/Makefile
projects/pseries/modules/pflog/Makefile
projects/pseries/net/if.c
projects/pseries/net/if.h
projects/pseries/net/if_arcsubr.c
projects/pseries/net/if_atmsubr.c
projects/pseries/net/if_debug.c
projects/pseries/net/if_ethersubr.c
projects/pseries/net/if_fddisubr.c
projects/pseries/net/if_fwsubr.c
projects/pseries/net/if_gif.c
projects/pseries/net/if_iso88025subr.c
projects/pseries/net/if_spppfr.c
projects/pseries/net/if_spppsubr.c
projects/pseries/net/if_stf.c
projects/pseries/net/if_tun.c
projects/pseries/net/if_var.h
projects/pseries/net80211/ieee80211_dfs.c
projects/pseries/netgraph/netflow/netflow.c
projects/pseries/netgraph/netflow/netflow_v9.c
projects/pseries/netgraph/netflow/ng_netflow.c
projects/pseries/netgraph/netflow/ng_netflow.h
projects/pseries/netgraph/netgraph.h
projects/pseries/netgraph/ng_base.c
projects/pseries/netgraph/ng_iface.c
projects/pseries/netinet/if_ether.c
projects/pseries/netinet/in_gif.c
projects/pseries/netinet/ip_divert.c
projects/pseries/netinet/ip_fw.h
projects/pseries/netinet/ip_icmp.c
projects/pseries/netinet/ip_var.h
projects/pseries/netinet/ipfw/ip_fw2.c
projects/pseries/netinet/ipfw/ip_fw_log.c
projects/pseries/netinet/ipfw/ip_fw_pfil.c
projects/pseries/netinet/ipfw/ip_fw_sockopt.c
projects/pseries/netinet/libalias/libalias.3
projects/pseries/netinet/raw_ip.c
projects/pseries/netinet/sctp_uio.h
projects/pseries/netinet/sctp_usrreq.c
projects/pseries/netinet/tcp_lro.c
projects/pseries/netinet/tcp_output.c
projects/pseries/netinet/tcp_subr.c
projects/pseries/netinet6/icmp6.c
projects/pseries/netinet6/in6_gif.c
projects/pseries/netipsec/ipsec_input.c
projects/pseries/netipsec/ipsec_output.c
projects/pseries/netipsec/xform_ipip.c
projects/pseries/nfs/bootp_subr.c
projects/pseries/powerpc/aim/mmu_oea.c
projects/pseries/powerpc/aim/mmu_oea64.c
projects/pseries/powerpc/aim/trap_subr32.S
projects/pseries/powerpc/aim/trap_subr64.S
projects/pseries/powerpc/booke/pmap.c
projects/pseries/powerpc/ofw/rtas.c
projects/pseries/powerpc/powermac/fcu.c
projects/pseries/powerpc/powerpc/mp_machdep.c
projects/pseries/powerpc/ps3/if_glc.c
projects/pseries/sparc64/include/cache.h
projects/pseries/sparc64/include/cpu.h
projects/pseries/sparc64/include/pmap.h
projects/pseries/sparc64/include/tlb.h
projects/pseries/sparc64/sparc64/cache.c
projects/pseries/sparc64/sparc64/cheetah.c
projects/pseries/sparc64/sparc64/exception.S
projects/pseries/sparc64/sparc64/interrupt.S
projects/pseries/sparc64/sparc64/machdep.c
projects/pseries/sparc64/sparc64/mp_exception.S
projects/pseries/sparc64/sparc64/mp_machdep.c
projects/pseries/sparc64/sparc64/pmap.c
projects/pseries/sparc64/sparc64/spitfire.c
projects/pseries/sparc64/sparc64/sys_machdep.c
projects/pseries/sparc64/sparc64/vm_machdep.c
projects/pseries/sparc64/sparc64/zeus.c
projects/pseries/sys/_types.h
projects/pseries/sys/capability.h
projects/pseries/sys/cpuset.h
projects/pseries/sys/diskmbr.h
projects/pseries/sys/file.h
projects/pseries/sys/filedesc.h
projects/pseries/sys/mbuf.h
projects/pseries/sys/param.h
projects/pseries/sys/pcpu.h
projects/pseries/sys/priv.h
projects/pseries/sys/sockio.h
projects/pseries/sys/soundcard.h
projects/pseries/sys/tty.h
projects/pseries/sys/ttydevsw.h
projects/pseries/sys/types.h
projects/pseries/teken/demo/teken_demo.c
projects/pseries/teken/gensequences
projects/pseries/teken/libteken/teken.3
projects/pseries/teken/teken.c
projects/pseries/teken/teken_subr.h
projects/pseries/ufs/ffs/ffs_inode.c
projects/pseries/ufs/ffs/ffs_softdep.c
projects/pseries/ufs/ffs/softdep.h
projects/pseries/ufs/ufs/ufs_inode.c
projects/pseries/vm/device_pager.c
projects/pseries/vm/swap_pager.c
projects/pseries/vm/vm_glue.c
projects/pseries/vm/vm_map.c
projects/pseries/vm/vm_mmap.c
projects/pseries/vm/vm_object.c
projects/pseries/vm/vm_object.h
projects/pseries/vm/vm_pageout.c
projects/pseries/vm/vm_unix.c
projects/pseries/vm/vnode_pager.c
Directory Properties:
projects/pseries/ (props changed)
projects/pseries/amd64/include/xen/ (props changed)
projects/pseries/boot/ (props changed)
projects/pseries/boot/i386/efi/ (props changed)
projects/pseries/boot/ia64/efi/ (props changed)
projects/pseries/boot/ia64/ski/ (props changed)
projects/pseries/boot/powerpc/boot1.chrp/ (props changed)
projects/pseries/boot/powerpc/ofw/ (props changed)
projects/pseries/cddl/contrib/opensolaris/ (props changed)
projects/pseries/conf/ (props changed)
projects/pseries/contrib/dev/acpica/ (props changed)
projects/pseries/contrib/octeon-sdk/ (props changed)
projects/pseries/contrib/pf/ (props changed)
projects/pseries/contrib/x86emu/ (props changed)
Modified: projects/pseries/amd64/acpica/acpi_wakeup.c
==============================================================================
--- projects/pseries/amd64/acpica/acpi_wakeup.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/amd64/acpica/acpi_wakeup.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -226,7 +226,8 @@ acpi_sleep_machdep(struct acpi_softc *sc
return (ret);
#ifdef SMP
- wakeup_cpus = PCPU_GET(other_cpus);
+ wakeup_cpus = all_cpus;
+ CPU_CLR(PCPU_GET(cpuid), &wakeup_cpus);
#endif
AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
Modified: projects/pseries/amd64/amd64/mp_machdep.c
==============================================================================
--- projects/pseries/amd64/amd64/mp_machdep.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/amd64/amd64/mp_machdep.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -604,10 +604,10 @@ cpu_mp_announce(void)
void
init_secondary(void)
{
- cpuset_t tcpuset, tallcpus;
struct pcpu *pc;
struct nmi_pcpu *np;
u_int64_t msr, cr0;
+ u_int cpuid;
int cpu, gsel_tss, x;
struct region_descriptor ap_gdt;
@@ -711,8 +711,9 @@ init_secondary(void)
fpuinit();
/* A quick check from sanity claus */
+ cpuid = PCPU_GET(cpuid);
if (PCPU_GET(apic_id) != lapic_id()) {
- printf("SMP: cpuid = %d\n", PCPU_GET(cpuid));
+ printf("SMP: cpuid = %d\n", cpuid);
printf("SMP: actual apic_id = %d\n", lapic_id());
printf("SMP: correct apic_id = %d\n", PCPU_GET(apic_id));
panic("cpuid mismatch! boom!!");
@@ -734,19 +735,13 @@ init_secondary(void)
smp_cpus++;
- CTR1(KTR_SMP, "SMP: AP CPU #%d Launched", PCPU_GET(cpuid));
- printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid));
- tcpuset = PCPU_GET(cpumask);
+ CTR1(KTR_SMP, "SMP: AP CPU #%d Launched", cpuid);
+ printf("SMP: AP CPU #%d Launched!\n", cpuid);
/* Determine if we are a logical CPU. */
/* XXX Calculation depends on cpu_logical being a power of 2, e.g. 2 */
if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0)
- CPU_OR(&logical_cpus_mask, &tcpuset);
-
- /* Build our map of 'other' CPUs. */
- tallcpus = all_cpus;
- CPU_NAND(&tallcpus, &tcpuset);
- PCPU_SET(other_cpus, tallcpus);
+ CPU_SET(cpuid, &logical_cpus_mask);
if (bootverbose)
lapic_dump("AP");
@@ -893,7 +888,6 @@ assign_cpu_ids(void)
static int
start_all_aps(void)
{
- cpuset_t tallcpus, tcpuset;
vm_offset_t va = boot_address + KERNBASE;
u_int64_t *pt4, *pt3, *pt2;
u_int32_t mpbioswarmvec;
@@ -961,12 +955,6 @@ start_all_aps(void)
CPU_SET(cpu, &all_cpus); /* record AP in CPU map */
}
- /* build our map of 'other' CPUs */
- tallcpus = all_cpus;
- tcpuset = PCPU_GET(cpumask);
- CPU_NAND(&tallcpus, &tcpuset);
- PCPU_SET(other_cpus, tallcpus);
-
/* restore the warmstart vector */
*(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec;
@@ -1150,9 +1138,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask
if (othercpus < 1)
return;
} else {
- sched_pin();
- CPU_NAND(&mask, PCPU_PTR(cpumask));
- sched_unpin();
+ CPU_CLR(PCPU_GET(cpuid), &mask);
if (CPU_EMPTY(&mask))
return;
}
@@ -1349,11 +1335,13 @@ ipi_cpu(int cpu, u_int ipi)
void
ipi_all_but_self(u_int ipi)
{
+ cpuset_t other_cpus;
+
+ other_cpus = all_cpus;
+ CPU_CLR(PCPU_GET(cpuid), &other_cpus);
- sched_pin();
if (IPI_IS_BITMAPED(ipi)) {
- ipi_selected(PCPU_GET(other_cpus), ipi);
- sched_unpin();
+ ipi_selected(other_cpus, ipi);
return;
}
@@ -1363,8 +1351,7 @@ ipi_all_but_self(u_int ipi)
* Set the mask of receiving CPUs for this purpose.
*/
if (ipi == IPI_STOP_HARD)
- CPU_OR_ATOMIC(&ipi_nmi_pending, PCPU_PTR(other_cpus));
- sched_unpin();
+ CPU_OR_ATOMIC(&ipi_nmi_pending, &other_cpus);
CTR2(KTR_SMP, "%s: ipi: %x", __func__, ipi);
lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS);
@@ -1373,7 +1360,7 @@ ipi_all_but_self(u_int ipi)
int
ipi_nmi_handler()
{
- cpuset_t cpumask;
+ u_int cpuid;
/*
* As long as there is not a simple way to know about a NMI's
@@ -1381,13 +1368,11 @@ ipi_nmi_handler()
* the global pending bitword an IPI_STOP_HARD has been issued
* and should be handled.
*/
- sched_pin();
- cpumask = PCPU_GET(cpumask);
- sched_unpin();
- if (!CPU_OVERLAP(&ipi_nmi_pending, &cpumask))
+ cpuid = PCPU_GET(cpuid);
+ if (!CPU_ISSET(cpuid, &ipi_nmi_pending))
return (1);
- CPU_NAND_ATOMIC(&ipi_nmi_pending, &cpumask);
+ CPU_CLR_ATOMIC(cpuid, &ipi_nmi_pending);
cpustop_handler();
return (0);
}
@@ -1399,25 +1384,21 @@ ipi_nmi_handler()
void
cpustop_handler(void)
{
- cpuset_t cpumask;
u_int cpu;
- sched_pin();
cpu = PCPU_GET(cpuid);
- cpumask = PCPU_GET(cpumask);
- sched_unpin();
savectx(&stoppcbs[cpu]);
/* Indicate that we are stopped */
- CPU_OR_ATOMIC(&stopped_cpus, &cpumask);
+ CPU_SET_ATOMIC(cpu, &stopped_cpus);
/* Wait for restart */
- while (!CPU_OVERLAP(&started_cpus, &cpumask))
+ while (!CPU_ISSET(cpu, &started_cpus))
ia32_pause();
- CPU_NAND_ATOMIC(&started_cpus, &cpumask);
- CPU_NAND_ATOMIC(&stopped_cpus, &cpumask);
+ CPU_CLR_ATOMIC(cpu, &started_cpus);
+ CPU_CLR_ATOMIC(cpu, &stopped_cpus);
if (cpu == 0 && cpustop_restartfunc != NULL) {
cpustop_restartfunc();
@@ -1432,19 +1413,17 @@ cpustop_handler(void)
void
cpususpend_handler(void)
{
- cpuset_t cpumask;
register_t cr3, rf;
u_int cpu;
cpu = PCPU_GET(cpuid);
- cpumask = PCPU_GET(cpumask);
rf = intr_disable();
cr3 = rcr3();
if (savectx(susppcbs[cpu])) {
wbinvd();
- CPU_OR_ATOMIC(&stopped_cpus, &cpumask);
+ CPU_SET_ATOMIC(cpu, &stopped_cpus);
} else {
pmap_init_pat();
PCPU_SET(switchtime, 0);
@@ -1452,11 +1431,11 @@ cpususpend_handler(void)
}
/* Wait for resume */
- while (!CPU_OVERLAP(&started_cpus, &cpumask))
+ while (!CPU_ISSET(cpu, &started_cpus))
ia32_pause();
- CPU_NAND_ATOMIC(&started_cpus, &cpumask);
- CPU_NAND_ATOMIC(&stopped_cpus, &cpumask);
+ CPU_CLR_ATOMIC(cpu, &started_cpus);
+ CPU_CLR_ATOMIC(cpu, &stopped_cpus);
/* Restore CR3 and enable interrupts */
load_cr3(cr3);
Modified: projects/pseries/amd64/amd64/pmap.c
==============================================================================
--- projects/pseries/amd64/amd64/pmap.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/amd64/amd64/pmap.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -925,16 +925,18 @@ pmap_update_pde_invalidate(vm_offset_t v
void
pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
{
- cpuset_t cpumask, other_cpus;
+ cpuset_t other_cpus;
+ u_int cpuid;
sched_pin();
if (pmap == kernel_pmap || !CPU_CMP(&pmap->pm_active, &all_cpus)) {
invlpg(va);
smp_invlpg(va);
} else {
- cpumask = PCPU_GET(cpumask);
- other_cpus = PCPU_GET(other_cpus);
- if (CPU_OVERLAP(&pmap->pm_active, &cpumask))
+ cpuid = PCPU_GET(cpuid);
+ other_cpus = all_cpus;
+ CPU_CLR(cpuid, &other_cpus);
+ if (CPU_ISSET(cpuid, &pmap->pm_active))
invlpg(va);
CPU_AND(&other_cpus, &pmap->pm_active);
if (!CPU_EMPTY(&other_cpus))
@@ -946,8 +948,9 @@ pmap_invalidate_page(pmap_t pmap, vm_off
void
pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
{
- cpuset_t cpumask, other_cpus;
+ cpuset_t other_cpus;
vm_offset_t addr;
+ u_int cpuid;
sched_pin();
if (pmap == kernel_pmap || !CPU_CMP(&pmap->pm_active, &all_cpus)) {
@@ -955,9 +958,10 @@ pmap_invalidate_range(pmap_t pmap, vm_of
invlpg(addr);
smp_invlpg_range(sva, eva);
} else {
- cpumask = PCPU_GET(cpumask);
- other_cpus = PCPU_GET(other_cpus);
- if (CPU_OVERLAP(&pmap->pm_active, &cpumask))
+ cpuid = PCPU_GET(cpuid);
+ other_cpus = all_cpus;
+ CPU_CLR(cpuid, &other_cpus);
+ if (CPU_ISSET(cpuid, &pmap->pm_active))
for (addr = sva; addr < eva; addr += PAGE_SIZE)
invlpg(addr);
CPU_AND(&other_cpus, &pmap->pm_active);
@@ -970,16 +974,18 @@ pmap_invalidate_range(pmap_t pmap, vm_of
void
pmap_invalidate_all(pmap_t pmap)
{
- cpuset_t cpumask, other_cpus;
+ cpuset_t other_cpus;
+ u_int cpuid;
sched_pin();
if (pmap == kernel_pmap || !CPU_CMP(&pmap->pm_active, &all_cpus)) {
invltlb();
smp_invltlb();
} else {
- cpumask = PCPU_GET(cpumask);
- other_cpus = PCPU_GET(other_cpus);
- if (CPU_OVERLAP(&pmap->pm_active, &cpumask))
+ cpuid = PCPU_GET(cpuid);
+ other_cpus = all_cpus;
+ CPU_CLR(cpuid, &other_cpus);
+ if (CPU_ISSET(cpuid, &pmap->pm_active))
invltlb();
CPU_AND(&other_cpus, &pmap->pm_active);
if (!CPU_EMPTY(&other_cpus))
@@ -999,11 +1005,11 @@ pmap_invalidate_cache(void)
}
struct pde_action {
- cpuset_t store; /* processor that updates the PDE */
cpuset_t invalidate; /* processors that invalidate their TLB */
vm_offset_t va;
pd_entry_t *pde;
pd_entry_t newpde;
+ u_int store; /* processor that updates the PDE */
};
static void
@@ -1011,12 +1017,8 @@ pmap_update_pde_action(void *arg)
{
struct pde_action *act = arg;
- sched_pin();
- if (!CPU_CMP(&act->store, PCPU_PTR(cpumask))) {
- sched_unpin();
+ if (act->store == PCPU_GET(cpuid))
pde_store(act->pde, act->newpde);
- } else
- sched_unpin();
}
static void
@@ -1024,12 +1026,8 @@ pmap_update_pde_teardown(void *arg)
{
struct pde_action *act = arg;
- sched_pin();
- if (CPU_OVERLAP(&act->invalidate, PCPU_PTR(cpumask))) {
- sched_unpin();
+ if (CPU_ISSET(PCPU_GET(cpuid), &act->invalidate))
pmap_update_pde_invalidate(act->va, act->newpde);
- } else
- sched_unpin();
}
/*
@@ -1044,28 +1042,30 @@ static void
pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, pd_entry_t newpde)
{
struct pde_action act;
- cpuset_t active, cpumask, other_cpus;
+ cpuset_t active, other_cpus;
+ u_int cpuid;
sched_pin();
- cpumask = PCPU_GET(cpumask);
- other_cpus = PCPU_GET(other_cpus);
+ cpuid = PCPU_GET(cpuid);
+ other_cpus = all_cpus;
+ CPU_CLR(cpuid, &other_cpus);
if (pmap == kernel_pmap)
active = all_cpus;
else
active = pmap->pm_active;
if (CPU_OVERLAP(&active, &other_cpus)) {
- act.store = cpumask;
+ act.store = cpuid;
act.invalidate = active;
act.va = va;
act.pde = pde;
act.newpde = newpde;
- CPU_OR(&cpumask, &active);
- smp_rendezvous_cpus(cpumask,
+ CPU_SET(cpuid, &active);
+ smp_rendezvous_cpus(active,
smp_no_rendevous_barrier, pmap_update_pde_action,
pmap_update_pde_teardown, &act);
} else {
pde_store(pde, newpde);
- if (CPU_OVERLAP(&active, &cpumask))
+ if (CPU_ISSET(cpuid, &active))
pmap_update_pde_invalidate(va, newpde);
}
sched_unpin();
@@ -2104,7 +2104,7 @@ pmap_collect(pmap_t locked_pmap, struct
vm_page_t m, free;
TAILQ_FOREACH(m, &vpq->pl, pageq) {
- if (m->hold_count || m->busy)
+ if ((m->flags & PG_MARKER) != 0 || m->hold_count || m->busy)
continue;
TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) {
va = pv->pv_va;
@@ -2847,8 +2847,8 @@ pmap_remove_all(vm_page_t m)
vm_offset_t va;
vm_page_t free;
- KASSERT((m->flags & PG_FICTITIOUS) == 0,
- ("pmap_remove_all: page %p is fictitious", m));
+ KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+ ("pmap_remove_all: page %p is not managed", m));
free = NULL;
vm_page_lock_queues();
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
@@ -5095,17 +5095,19 @@ void
pmap_activate(struct thread *td)
{
pmap_t pmap, oldpmap;
+ u_int cpuid;
u_int64_t cr3;
critical_enter();
pmap = vmspace_pmap(td->td_proc->p_vmspace);
oldpmap = PCPU_GET(curpmap);
+ cpuid = PCPU_GET(cpuid);
#ifdef SMP
- CPU_NAND_ATOMIC(&oldpmap->pm_active, PCPU_PTR(cpumask));
- CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
+ CPU_CLR_ATOMIC(cpuid, &oldpmap->pm_active);
+ CPU_SET_ATOMIC(cpuid, &pmap->pm_active);
#else
- CPU_NAND(&oldpmap->pm_active, PCPU_PTR(cpumask));
- CPU_OR(&pmap->pm_active, PCPU_PTR(cpumask));
+ CPU_CLR(cpuid, &oldpmap->pm_active);
+ CPU_SET(cpuid, &pmap->pm_active);
#endif
cr3 = DMAP_TO_PHYS((vm_offset_t)pmap->pm_pml4);
td->td_pcb->pcb_cr3 = cr3;
Modified: projects/pseries/amd64/amd64/sys_machdep.c
==============================================================================
--- projects/pseries/amd64/amd64/sys_machdep.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/amd64/amd64/sys_machdep.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -33,7 +33,7 @@
#include
__FBSDID("$FreeBSD$");
-#include "opt_capabilities.h"
+#include "opt_capsicum.h"
#include
#include
@@ -180,28 +180,30 @@ sysarch(td, uap)
uint64_t a64base;
struct i386_ioperm_args iargs;
-#ifdef CAPABILITIES
+#ifdef CAPABILITY_MODE
/*
- * Whitelist of operations which are safe enough for capability mode.
+ * When adding new operations, add a new case statement here to
+ * explicitly indicate whether or not the operation is safe to
+ * perform in capability mode.
*/
if (IN_CAPABILITY_MODE(td)) {
switch (uap->op) {
- case I386_GET_LDT:
- case I386_SET_LDT:
- case I386_GET_IOPERM:
- case I386_GET_FSBASE:
- case I386_SET_FSBASE:
- case I386_GET_GSBASE:
- case I386_SET_GSBASE:
- case AMD64_GET_FSBASE:
- case AMD64_SET_FSBASE:
- case AMD64_GET_GSBASE:
- case AMD64_SET_GSBASE:
- break;
+ case I386_GET_LDT:
+ case I386_SET_LDT:
+ case I386_GET_IOPERM:
+ case I386_GET_FSBASE:
+ case I386_SET_FSBASE:
+ case I386_GET_GSBASE:
+ case I386_SET_GSBASE:
+ case AMD64_GET_FSBASE:
+ case AMD64_SET_FSBASE:
+ case AMD64_GET_GSBASE:
+ case AMD64_SET_GSBASE:
+ break;
- case I386_SET_IOPERM:
- default:
- return (ECAPMODE);
+ case I386_SET_IOPERM:
+ default:
+ return (ECAPMODE);
}
}
#endif
Modified: projects/pseries/amd64/amd64/vm_machdep.c
==============================================================================
--- projects/pseries/amd64/amd64/vm_machdep.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/amd64/amd64/vm_machdep.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
#include
#include
#include
@@ -535,8 +534,8 @@ cpu_reset()
u_int cnt;
if (smp_active) {
- sched_pin();
- map = PCPU_GET(other_cpus);
+ map = all_cpus;
+ CPU_CLR(PCPU_GET(cpuid), &map);
CPU_NAND(&map, &stopped_cpus);
if (!CPU_EMPTY(&map)) {
printf("cpu_reset: Stopping other CPUs\n");
@@ -545,7 +544,6 @@ cpu_reset()
if (PCPU_GET(cpuid) != 0) {
cpu_reset_proxyid = PCPU_GET(cpuid);
- sched_unpin();
cpustop_restartfunc = cpu_reset_proxy;
cpu_reset_proxy_active = 0;
printf("cpu_reset: Restarting BSP\n");
@@ -564,8 +562,7 @@ cpu_reset()
while (1);
/* NOTREACHED */
- } else
- sched_unpin();
+ }
DELAY(1000000);
}
Modified: projects/pseries/amd64/include/cpufunc.h
==============================================================================
--- projects/pseries/amd64/include/cpufunc.h Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/amd64/include/cpufunc.h Thu Jul 7 05:07:25 2011 (r223833)
@@ -467,16 +467,18 @@ load_es(u_short sel)
}
static __inline void
-cpu_monitor(const void *addr, int extensions, int hints)
+cpu_monitor(const void *addr, u_long extensions, u_int hints)
{
- __asm __volatile("monitor;"
- : :"a" (addr), "c" (extensions), "d"(hints));
+
+ __asm __volatile("monitor"
+ : : "a" (addr), "c" (extensions), "d" (hints));
}
static __inline void
-cpu_mwait(int extensions, int hints)
+cpu_mwait(u_long extensions, u_int hints)
{
- __asm __volatile("mwait;" : :"a" (hints), "c" (extensions));
+
+ __asm __volatile("mwait" : : "a" (hints), "c" (extensions));
}
#ifdef _KERNEL
Modified: projects/pseries/arm/arm/pmap.c
==============================================================================
--- projects/pseries/arm/arm/pmap.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/arm/arm/pmap.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -3120,8 +3120,8 @@ pmap_remove_all(vm_page_t m)
pmap_t curpm;
int flags = 0;
- KASSERT((m->flags & PG_FICTITIOUS) == 0,
- ("pmap_remove_all: page %p is fictitious", m));
+ KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
+ ("pmap_remove_all: page %p is not managed", m));
if (TAILQ_EMPTY(&m->md.pv_list))
return;
vm_page_lock_queues();
Modified: projects/pseries/arm/arm/sys_machdep.c
==============================================================================
--- projects/pseries/arm/arm/sys_machdep.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/arm/arm/sys_machdep.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -36,7 +36,7 @@
#include
__FBSDID("$FreeBSD$");
-#include "opt_capabilities.h"
+#include "opt_capsicum.h"
#include
#include
@@ -107,20 +107,22 @@ sysarch(td, uap)
{
int error;
-#ifdef CAPABILITIES
+#ifdef CAPABILITY_MODE
/*
- * Whitelist of operations which are safe enough for capability mode.
+ * When adding new operations, add a new case statement here to
+ * explicitly indicate whether or not the operation is safe to
+ * perform in capability mode.
*/
if (IN_CAPABILITY_MODE(td)) {
switch (uap->op) {
- case ARM_SYNC_ICACHE:
- case ARM_DRAIN_WRITEBUF:
- case ARM_SET_TP:
- case ARM_GET_TP:
- break;
+ case ARM_SYNC_ICACHE:
+ case ARM_DRAIN_WRITEBUF:
+ case ARM_SET_TP:
+ case ARM_GET_TP:
+ break;
- default:
- return (ECAPMODE);
+ default:
+ return (ECAPMODE);
}
}
#endif
Modified: projects/pseries/arm/at91/at91_machdep.c
==============================================================================
--- projects/pseries/arm/at91/at91_machdep.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/arm/at91/at91_machdep.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -91,7 +91,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */
#define KERNEL_PT_KERN 1
Modified: projects/pseries/arm/conf/CAMBRIA
==============================================================================
--- projects/pseries/arm/conf/CAMBRIA Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/arm/conf/CAMBRIA Thu Jul 7 05:07:25 2011 (r223833)
@@ -130,7 +130,7 @@ options ATH_DIAGAPI
#options ATH_TX99_DIAG
device ath_rate_sample # SampleRate tx rate control for ath
-options AH_DEBUG
+#options AH_DEBUG
#options AH_ASSERT
options AH_PRIVATE_DIAG
#device ath_ar5210
Modified: projects/pseries/arm/mv/common.c
==============================================================================
--- projects/pseries/arm/mv/common.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/arm/mv/common.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -122,7 +122,7 @@ static struct soc_node_spec soc_nodes[]
{ "mrvl,sata", &decode_win_sata_setup, NULL },
{ "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump },
{ "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump },
- { "mvrl,pcie", &decode_win_pcie_setup, NULL },
+ { "mrvl,pcie", &decode_win_pcie_setup, NULL },
{ NULL, NULL, NULL },
};
Modified: projects/pseries/arm/sa11x0/assabet_machdep.c
==============================================================================
--- projects/pseries/arm/sa11x0/assabet_machdep.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/arm/sa11x0/assabet_machdep.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
#include
#include
-#include
#include
#include
#include
Modified: projects/pseries/arm/sa11x0/sa11x0.c
==============================================================================
--- projects/pseries/arm/sa11x0/sa11x0.c Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/arm/sa11x0/sa11x0.c Thu Jul 7 05:07:25 2011 (r223833)
@@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
#include
#include
#include
@@ -74,7 +73,6 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
-#include
extern void sa11x0_activateirqs(void);
Modified: projects/pseries/boot/Makefile
==============================================================================
--- projects/pseries/boot/Makefile Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/boot/Makefile Thu Jul 7 05:07:25 2011 (r223833)
@@ -8,10 +8,6 @@
SUBDIR+= ficl
.endif
-.if ${MK_FDT} != "no"
-SUBDIR+= fdt
-.endif
-
# Pick the machine-dependent subdir based on the target architecture.
ADIR= ${MACHINE:S/amd64/i386/:S/powerpc64/powerpc/}
.if exists(${.CURDIR}/${ADIR}/.)
Modified: projects/pseries/boot/Makefile.amd64
==============================================================================
--- projects/pseries/boot/Makefile.amd64 Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/boot/Makefile.amd64 Thu Jul 7 05:07:25 2011 (r223833)
@@ -2,3 +2,4 @@
SUBDIR+= efi
SUBDIR+= zfs
+SUBDIR+= userboot
Modified: projects/pseries/boot/Makefile.arm
==============================================================================
--- projects/pseries/boot/Makefile.arm Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/boot/Makefile.arm Thu Jul 7 05:07:25 2011 (r223833)
@@ -1,3 +1,7 @@
# $FreeBSD$
+.if ${MK_FDT} != "no"
+SUBDIR+= fdt
+.endif
+
SUBDIR+= uboot
Modified: projects/pseries/boot/Makefile.powerpc
==============================================================================
--- projects/pseries/boot/Makefile.powerpc Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/boot/Makefile.powerpc Thu Jul 7 05:07:25 2011 (r223833)
@@ -1,4 +1,8 @@
# $FreeBSD$
+.if ${MK_FDT} != "no"
+SUBDIR+= fdt
+.endif
+
SUBDIR+= ofw
SUBDIR+= uboot
Modified: projects/pseries/boot/common/Makefile.inc
==============================================================================
--- projects/pseries/boot/common/Makefile.inc Thu Jul 7 01:22:50 2011 (r223832)
+++ projects/pseries/boot/common/Makefile.inc Thu Jul 7 05:07:25 2011 (r223833)
@@ -1,6 +1,6 @@
# $FreeBSD$
-SRCS+= boot.c commands.c console.c devopen.c interp.c
+SRCS+= boot.c commands.c console.c devopen.c disk.c interp.c
SRCS+= interp_backslash.c interp_parse.c ls.c misc.c
SRCS+= module.c panic.c
Copied: projects/pseries/boot/common/disk.c (from r223832, head/sys/boot/common/disk.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/pseries/boot/common/disk.c Thu Jul 7 05:07:25 2011 (r223833, copy of r223832, head/sys/boot/common/disk.c)
@@ -0,0 +1,799 @@
+/*-
+ * Copyright (c) 1998 Michael Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY 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.
+ */
+
+#include
+__FBSDID("$FreeBSD$");
+
+/*
+ * MBR/GPT partitioned disk device handling.
+ *
+ * Ideas and algorithms from:
+ *
+ * - NetBSD libi386/biosdisk.c
+ * - FreeBSD biosboot/disk.c
+ *
+ */
+
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+#include "disk.h"
+
+#ifdef DISK_DEBUG
+# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args)
+#else
+# define DEBUG(fmt, args...)
+#endif
+
+/*
+ * Search for a slice with the following preferences:
+ *
+ * 1: Active FreeBSD slice
+ * 2: Non-active FreeBSD slice
+ * 3: Active Linux slice
+ * 4: non-active Linux slice
+ * 5: Active FAT/FAT32 slice
+ * 6: non-active FAT/FAT32 slice
+ */
+#define PREF_RAWDISK 0
+#define PREF_FBSD_ACT 1
+#define PREF_FBSD 2
+#define PREF_LINUX_ACT 3
+#define PREF_LINUX 4
+#define PREF_DOS_ACT 5
+#define PREF_DOS 6
+#define PREF_NONE 7
+
+#ifdef LOADER_GPT_SUPPORT
+
+struct gpt_part {
+ int gp_index;
+ uuid_t gp_type;
+ uint64_t gp_start;
+ uint64_t gp_end;
+};
+
+static uuid_t efi = GPT_ENT_TYPE_EFI;
+static uuid_t freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
+static uuid_t freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
+static uuid_t freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
+static uuid_t freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
+static uuid_t ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
+
+#endif
+
+#if defined(LOADER_GPT_SUPPORT) || defined(LOADER_MBR_SUPPORT)
+
+/* Given a size in 512 byte sectors, convert it to a human-readable number. */
+static char *
+display_size(uint64_t size)
+{
+ static char buf[80];
+ char unit;
+
+ size /= 2;
+ unit = 'K';
+ if (size >= 10485760000LL) {
+ size /= 1073741824;
+ unit = 'T';
+ } else if (size >= 10240000) {
+ size /= 1048576;
+ unit = 'G';
+ } else if (size >= 10000) {
+ size /= 1024;
+ unit = 'M';
+ }
+ sprintf(buf, "%.6ld%cB", (long)size, unit);
+ return (buf);
+}
+
+#endif
+
+#ifdef LOADER_MBR_SUPPORT
+
+static void
+disk_checkextended(struct disk_devdesc *dev,
+ struct dos_partition *slicetab, int slicenum, int *nslicesp)
+{
+ uint8_t buf[DISK_SECSIZE];
+ struct dos_partition *dp;
+ uint32_t base;
+ int rc, i, start, end;
+
+ dp = &slicetab[slicenum];
+ start = *nslicesp;
+
+ if (dp->dp_size == 0)
+ goto done;
+ if (dp->dp_typ != DOSPTYP_EXT)
+ goto done;
+ rc = dev->d_dev->dv_strategy(dev, F_READ, dp->dp_start, DISK_SECSIZE,
+ (char *) buf, NULL);
+ if (rc)
+ goto done;
+ if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) {
+ DEBUG("no magic in extended table");
+ goto done;
+ }
+ base = dp->dp_start;
+ dp = (struct dos_partition *) &buf[DOSPARTOFF];
+ for (i = 0; i < NDOSPART; i++, dp++) {
+ if (dp->dp_size == 0)
+ continue;
+ if (*nslicesp == NEXTDOSPART)
+ goto done;
+ dp->dp_start += base;
+ bcopy(dp, &slicetab[*nslicesp], sizeof(*dp));
+ (*nslicesp)++;
+ }
+ end = *nslicesp;
+
+ /*
+ * now, recursively check the slices we just added
+ */
+ for (i = start; i < end; i++)
+ disk_checkextended(dev, slicetab, i, nslicesp);
+done:
+ return;
+}
+
+static int
+disk_readslicetab(struct disk_devdesc *dev,
+ struct dos_partition **slicetabp, int *nslicesp)
+{
+ struct dos_partition *slicetab = NULL;
+ int nslices, i;
+ int rc;
+ uint8_t buf[DISK_SECSIZE];
+
+ /*
+ * Find the slice in the DOS slice table.
+ */
+ rc = dev->d_dev->dv_strategy(dev, F_READ, 0, DISK_SECSIZE,
+ (char *) buf, NULL);
+ if (rc) {
+ DEBUG("error reading MBR");
+ return (rc);
+ }
+
+ /*
+ * Check the slice table magic.
+ */
+ if (buf[0x1fe] != 0x55 || buf[0x1ff] != 0xaa) {
+ DEBUG("no slice table/MBR (no magic)");
+ return (rc);
+ }
+
+ /*
+ * copy the partition table, then pick up any extended partitions.
+ */
+ slicetab = malloc(NEXTDOSPART * sizeof(struct dos_partition));
+ bcopy(buf + DOSPARTOFF, slicetab,
+ sizeof(struct dos_partition) * NDOSPART);
+ nslices = NDOSPART; /* extended slices start here */
+ for (i = 0; i < NDOSPART; i++)
+ disk_checkextended(dev, slicetab, i, &nslices);
+
+ *slicetabp = slicetab;
+ *nslicesp = nslices;
+ return (0);
+}
+
+/*
+ * Search for the best MBR slice (typically the first FreeBSD slice).
+ */
+static int
+disk_bestslice(struct dos_partition *slicetab, int nslices)
+{
+ struct dos_partition *dp;
+ int pref, preflevel;
+ int i, prefslice;
+
+ prefslice = 0;
+ preflevel = PREF_NONE;
+
+ dp = &slicetab[0];
+ for (i = 0; i < nslices; i++, dp++) {
+ switch (dp->dp_typ) {
+ case DOSPTYP_386BSD: /* FreeBSD */
+ pref = dp->dp_flag & 0x80 ? PREF_FBSD_ACT : PREF_FBSD;
+ break;
+
+ case DOSPTYP_LINUX:
+ pref = dp->dp_flag & 0x80 ? PREF_LINUX_ACT : PREF_LINUX;
+ break;
+
+ case 0x01: /* DOS/Windows */
+ case 0x04:
+ case 0x06:
+ case 0x0b:
+ case 0x0c:
+ case 0x0e:
+ pref = dp->dp_flag & 0x80 ? PREF_DOS_ACT : PREF_DOS;
+ break;
+
+ default:
+ pref = PREF_NONE;
+ }
+ if (pref < preflevel) {
+ preflevel = pref;
+ prefslice = i + 1;
+ }
+ }
+ return (prefslice);
+}
+
+static int
+disk_openmbr(struct disk_devdesc *dev)
+{
+ struct dos_partition *slicetab = NULL, *dptr;
+ int nslices, sector, slice;
+ int rc;
+ uint8_t buf[DISK_SECSIZE];
+ struct disklabel *lp;
+
+ /*
+ * Following calculations attempt to determine the correct value
+ * for dev->d_offset by looking for the slice and partition specified,
+ * or searching for reasonable defaults.
+ */
+ rc = disk_readslicetab(dev, &slicetab, &nslices);
+ if (rc)
+ return (rc);
+
+ /*
+ * if a slice number was supplied but not found, this is an error.
+ */
+ if (dev->d_slice > 0) {
+ slice = dev->d_slice - 1;
+ if (slice >= nslices) {
+ DEBUG("slice %d not found", slice);
+ rc = EPART;
+ goto out;
+ }
+ }
+
+ /*
+ * Check for the historically bogus MBR found on true dedicated disks
+ */
+ if (slicetab[3].dp_typ == DOSPTYP_386BSD &&
+ slicetab[3].dp_start == 0 && slicetab[3].dp_size == 50000) {
+ sector = 0;
+ goto unsliced;
+ }
+
+ /*
+ * Try to auto-detect the best slice; this should always give
+ * a slice number
+ */
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
From owner-svn-src-projects@FreeBSD.ORG Fri Jul 8 03:16:45 2011
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 89B4B106564A;
Fri, 8 Jul 2011 03:16:45 +0000 (UTC)
(envelope-from linimon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 7A3E48FC16;
Fri, 8 Jul 2011 03:16:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p683Gjrk090526;
Fri, 8 Jul 2011 03:16:45 GMT (envelope-from linimon@svn.freebsd.org)
Received: (from linimon@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p683GjGt090524;
Fri, 8 Jul 2011 03:16:45 GMT (envelope-from linimon@svn.freebsd.org)
Message-Id: <201107080316.p683GjGt090524@svn.freebsd.org>
From: Mark Linimon
Date: Fri, 8 Jul 2011 03:16:45 +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: r223855 - projects/portbuild/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: Fri, 08 Jul 2011 03:16:45 -0000
Author: linimon (doc,ports committer)
Date: Fri Jul 8 03:16:45 2011
New Revision: 223855
URL: http://svn.freebsd.org/changeset/base/223855
Log:
Add Indexes to options to fix things that access archive/.
While here, add a work area for studies.
Modified:
projects/portbuild/conf/apache.conf
Modified: projects/portbuild/conf/apache.conf
==============================================================================
--- projects/portbuild/conf/apache.conf Fri Jul 8 01:35:33 2011 (r223854)
+++ projects/portbuild/conf/apache.conf Fri Jul 8 03:16:45 2011 (r223855)
@@ -18,7 +18,7 @@ Alias /errorlogs/ /var/portbuild/errorlo
Order allow,deny
Allow from all
- Options FollowSymLinks
+ Options FollowSymLinks Indexes
# Added kk 030222
Options +IncludesNoExec
AddHandler server-parsed .shtml
@@ -41,3 +41,10 @@ Alias /ganglia/ "/usr/local/www/ganglia/
addhandler php5-script .php
DirectoryIndex index.php
+
+
+ Order allow,deny
+ Allow from all
+ Options Indexes FollowSymlinks MultiViews
+ AllowOverride None
+
From owner-svn-src-projects@FreeBSD.ORG Fri Jul 8 03:21:29 2011
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 06503106566C;
Fri, 8 Jul 2011 03:21:29 +0000 (UTC)
(envelope-from linimon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id EB3BE8FC0A;
Fri, 8 Jul 2011 03:21:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p683LScA090709;
Fri, 8 Jul 2011 03:21:28 GMT (envelope-from linimon@svn.freebsd.org)
Received: (from linimon@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p683LSUr090707;
Fri, 8 Jul 2011 03:21:28 GMT (envelope-from linimon@svn.freebsd.org)
Message-Id: <201107080321.p683LSUr090707@svn.freebsd.org>
From: Mark Linimon
Date: Fri, 8 Jul 2011 03:21:28 +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: r223856 - projects/portbuild/www
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: Fri, 08 Jul 2011 03:21:29 -0000
Author: linimon (doc,ports committer)
Date: Fri Jul 8 03:21:28 2011
New Revision: 223856
URL: http://svn.freebsd.org/changeset/base/223856
Log:
Remove an obsolete line.
Modified:
projects/portbuild/www/index.html
Modified: projects/portbuild/www/index.html
==============================================================================
--- projects/portbuild/www/index.html Fri Jul 8 03:16:45 2011 (r223855)
+++ projects/portbuild/www/index.html Fri Jul 8 03:21:28 2011 (r223856)
@@ -342,8 +342,6 @@ clean-restricted-list"). NO_CDR
but deleted (using "make clean-cdrom-list") before being
put on a CDROM.
-See also the types of errors detected.
-
Notes on the building process:
From owner-svn-src-projects@FreeBSD.ORG Sat Jul 9 23:03:53 2011
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 4845F106566C;
Sat, 9 Jul 2011 23:03:53 +0000 (UTC)
(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id 386468FC0A;
Sat, 9 Jul 2011 23:03:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p69N3r8U019720;
Sat, 9 Jul 2011 23:03:53 GMT
(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p69N3r4j019718;
Sat, 9 Jul 2011 23:03:53 GMT
(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201107092303.p69N3r4j019718@svn.freebsd.org>
From: Nathan Whitehorn
Date: Sat, 9 Jul 2011 23:03:53 +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: r223898 - projects/pseries/powerpc/pseries
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: Sat, 09 Jul 2011 23:03:53 -0000
Author: nwhitehorn
Date: Sat Jul 9 23:03:52 2011
New Revision: 223898
URL: http://svn.freebsd.org/changeset/base/223898
Log:
Minor style fixes.
Modified:
projects/pseries/powerpc/pseries/mmu_phyp.c
Modified: projects/pseries/powerpc/pseries/mmu_phyp.c
==============================================================================
--- projects/pseries/powerpc/pseries/mmu_phyp.c Sat Jul 9 23:01:54 2011 (r223897)
+++ projects/pseries/powerpc/pseries/mmu_phyp.c Sat Jul 9 23:03:52 2011 (r223898)
@@ -100,8 +100,8 @@ mphyp_bootstrap(mmu_t mmup, vm_offset_t
char buf[8];
uint32_t prop[2];
uint32_t nptlp, shift = 0, slb_encoding = 0;
- phandle_t dev, node, root;
- int idx, len, res;
+ phandle_t dev, node, root;
+ int idx, len, res;
moea64_early_bootstrap(mmup, kernelstart, kernelend);
From owner-svn-src-projects@FreeBSD.ORG Sat Jul 9 23:05:50 2011
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 B8FD8106566C;
Sat, 9 Jul 2011 23:05:50 +0000 (UTC)
(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
by mx1.freebsd.org (Postfix) with ESMTP id A80FE8FC0A;
Sat, 9 Jul 2011 23:05:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p69N5o3S019818;
Sat, 9 Jul 2011 23:05:50 GMT
(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
by svn.freebsd.org (8.14.4/8.14.4/Submit) id p69N5of5019815;
Sat, 9 Jul 2011 23:05:50 GMT
(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201107092305.p69N5of5019815@svn.freebsd.org>
From: Nathan Whitehorn
Date: Sat, 9 Jul 2011 23:05:50 +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: r223899 - in projects/pseries: conf powerpc/pseries
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: Sat, 09 Jul 2011 23:05:50 -0000
Author: nwhitehorn
Date: Sat Jul 9 23:05:50 2011
New Revision: 223899
URL: http://svn.freebsd.org/changeset/base/223899
Log:
Add a console driver for the pSeries hypervisor virtual UART. This is a
total hack (it should become MP safe, actually be part of uart(4), etc.)
but it does work and is *infinitely* faster than the OF console driver
when used inside of QEMU.
Added:
projects/pseries/powerpc/pseries/phyp_console.c
Modified:
projects/pseries/conf/files.powerpc
Modified: projects/pseries/conf/files.powerpc
==============================================================================
--- projects/pseries/conf/files.powerpc Sat Jul 9 23:03:52 2011 (r223898)
+++ projects/pseries/conf/files.powerpc Sat Jul 9 23:05:50 2011 (r223899)
@@ -215,6 +215,7 @@ powerpc/ps3/ps3_syscons.c optional ps3 s
powerpc/ps3/ps3-hvcall.S optional ps3 sc
powerpc/pseries/phyp-hvcall.S optional pseries powerpc64
powerpc/pseries/mmu_phyp.c optional pseries powerpc64
+powerpc/pseries/phyp_console.c optional pseries powerpc64
powerpc/pseries/platform_chrp.c optional pseries
powerpc/pseries/rtas_dev.c optional pseries
powerpc/pseries/rtas_pci.c optional pseries pci
Added: projects/pseries/powerpc/pseries/phyp_console.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/pseries/powerpc/pseries/phyp_console.c Sat Jul 9 23:05:50 2011 (r223899)
@@ -0,0 +1,216 @@
+/*-
+ * Copyright (C) 2011 by Nathan Whitehorn. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 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.
+ */
+
+#include
+__FBSDID("$FreeBSD: projects/pseries/powerpc/phyp/phyp_console.c 214348 2010-10-25 15:41:12Z nwhitehorn $");
+
+#include "opt_comconsole.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+
+#include "phyp-hvcall.h"
+
+static tsw_outwakeup_t phyptty_outwakeup;
+
+static struct ttydevsw phyp_ttydevsw = {
+ .tsw_flags = TF_NOPREFIX,
+ .tsw_outwakeup = phyptty_outwakeup,
+};
+
+static int polltime;
+static cell_t termno;
+static struct callout phyp_callout;
+static union {
+ uint64_t u64[2];
+ char str[16];
+} phyp_inbuf;
+static uint64_t phyp_inbuflen = 0;
+static struct tty *tp = NULL;
+
+#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
+static int alt_break_state;
+#endif
+
+static void phyp_timeout(void *);
+
+static cn_probe_t phyp_cnprobe;
+static cn_init_t phyp_cninit;
+static cn_term_t phyp_cnterm;
+static cn_getc_t phyp_cngetc;
+static cn_putc_t phyp_cnputc;
+
+CONSOLE_DRIVER(phyp);
+
+static void
+cn_drvinit(void *unused)
+{
+ phandle_t dev;
+
+ if (phyp_consdev.cn_pri != CN_DEAD &&
+ phyp_consdev.cn_name[0] != '\0') {
+ dev = OF_finddevice("/vdevice/vty");
+ if (dev == -1)
+ return;
+
+ OF_getprop(dev, "reg", &termno, sizeof(termno));
+ tp = tty_alloc(&phyp_ttydevsw, NULL);
+ tty_init_console(tp, 0);
+ tty_makedev(tp, NULL, "%s", "phypvty");
+
+ polltime = 1;
+
+ callout_init(&phyp_callout, CALLOUT_MPSAFE);
+ callout_reset(&phyp_callout, polltime, phyp_timeout, NULL);
+ }
+}
+
+SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL);
+
+static void
+phyptty_outwakeup(struct tty *tp)
+{
+ int len, err;
+ uint64_t buf[2];
+
+ for (;;) {
+ len = ttydisc_getc(tp, buf, sizeof buf);
+ if (len == 0)
+ break;
+
+ do {
+ err = phyp_hcall(H_PUT_TERM_CHAR, termno,
+ (register_t)len, buf[0], buf[1]);
+ } while (err == H_BUSY);
+ }
+}
+
+static void
+phyp_timeout(void *v)
+{
+ int c;
+
+ tty_lock(tp);
+ while ((c = phyp_cngetc(NULL)) != -1)
+ ttydisc_rint(tp, c, 0);
+ ttydisc_rint_done(tp);
+ tty_unlock(tp);
+
+ callout_reset(&phyp_callout, polltime, phyp_timeout, NULL);
+}
+
+static void
+phyp_cnprobe(struct consdev *cp)
+{
+ phandle_t dev;
+
+ dev = OF_finddevice("/vdevice/vty");
+
+ if (dev == -1) {
+ cp->cn_pri = CN_DEAD;
+ return;
+ }
+
+ OF_getprop(dev, "reg", &termno, sizeof(termno));
+ cp->cn_pri = CN_NORMAL;
+}
+
+static void
+phyp_cninit(struct consdev *cp)
+{
+
+ /* XXX: This is the alias, but that should be good enough */
+ strcpy(cp->cn_name, "phypcons");
+}
+
+static void
+phyp_cnterm(struct consdev *cp)
+{
+}
+
+static int
+phyp_cngetc(struct consdev *cp)
+{
+ int ch, err;
+#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
+ int kdb_brk;
+#endif
+
+ /* XXX: thread safety */
+ if (phyp_inbuflen == 0) {
+ err = phyp_pft_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0,
+ &phyp_inbuflen, &phyp_inbuf.u64[0], &phyp_inbuf.u64[1]);
+ if (err != H_SUCCESS)
+ return (-1);
+ }
+
+ if (phyp_inbuflen == 0)
+ return (-1);
+
+ ch = phyp_inbuf.str[0];
+ phyp_inbuflen--;
+ if (phyp_inbuflen > 0)
+ memcpy(&phyp_inbuf.str[0], &phyp_inbuf.str[1], phyp_inbuflen);
+
+#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
+ if ((kdb_brk = kdb_alt_break(ch, &alt_break_state)) != 0) {
+ switch (kdb_brk) {
+ case KDB_REQ_DEBUGGER:
+ kdb_enter(KDB_WHY_BREAK,
+ "Break sequence on console");
+ break;
+ case KDB_REQ_PANIC:
+ kdb_panic("Panic sequence on console");
+ break;
+ case KDB_REQ_REBOOT:
+ kdb_reboot();
+ break;
+
+ }
+ }
+#endif
+ return (ch);
+}
+
+static void
+phyp_cnputc(struct consdev *cp, int c)
+{
+ uint64_t cbuf;
+
+ cbuf = (uint64_t)c << 56;
+ phyp_hcall(H_PUT_TERM_CHAR, termno, 1UL, cbuf, 0);
+}
+