OpenBIOS
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1996 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1995 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1994 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1993 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1992 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1991 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1990 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1989 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1988 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1987 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1986 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1985 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1984 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1983 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1982 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1981 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1980 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1979 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1978 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1977 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1976 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1975 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1974 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1973 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1972 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1971 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1970 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1969 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1968 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1967 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1966 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1965 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1964 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1963 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1962 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1961 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1960 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1959 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1958 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1957 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1956 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1955 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1954 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1953 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1952 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1951 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1950 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1949 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1948 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1947 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1946 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1945 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1944 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1943 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1942 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1941 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1940 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1939 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1938 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1937 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1936 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1935 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1934 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1933 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1932 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1931 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1930 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1929 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1928 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1927 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1926 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1925 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1924 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1923 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1922 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1921 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1920 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1919 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1918 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1917 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1916 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1915 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1914 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1913 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1912 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1911 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1910 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1909 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1908 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1907 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1906 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1905 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1904 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
August 2011
- 19 participants
- 88 discussions
> Hi Nick,
>
> Thanks again for testing this. The issue with Solaris not detecting the
> disks is a known one - the following guide should point you in the right
> direction:
>
> http://virtuallyfun.blogspot.com/2010/10/formatting-disks-for-solaris.html
>
> Also don't forget the "set scsi_options" part from Artyom's SPARC/QEMU
> howto here: http://tyom.blogspot.com/2009/12/solaris-under-qemu-how-to.html
>
> I think it may actually be possible to come up with a patch for OpenBIOS
> so that the scsi_options change isn't required - let me know how you get
> on with the above links, and if it all seems to work I'll look at
> creating the patch for you.
>
>
Okay, I got passed the issue with formatting the root filesystem.
Apparently there are some limitations on the C/H/S parameters you use
for the disk that correspond with how UFS wants to format a new
filesystem. I'm not sure what exactly those limitations are at this
point, but, by adjusting a couple of the C/H/S settings when using
format to set up the disk I was able to get it to work correctly. So, I
now have Solaris 9 installed on qemu-system-sparc with OpenBIOS! I'll
probably go back to Solaris 8 as that one has a free binary license
while Solaris 9 is a commercial license, IIRC. I do own a Solaris 9
commercial license, but I like the free idea, better.
Anyway, now I'm on to an issue with networking - I've used the following
two qemu network parameter combinations:
-net nic -net tap,ifname=tap0
-net nic -net user
In the first instance, tap0 was configured on my Linux box and added to
my bridge br0. In both cases the Solaris system is unable to obtain a
DHCP address - the DHCP client times out. Not sure if I should be using
a different parameter set, or if this is another area that needs some
work either for OpenBIOS or qemu?
-Nick
--------
This e-mail may contain confidential and privileged material for the sole use of the intended recipient. If this email is not intended for you, or you are not responsible for the delivery of this message to the intended recipient, please note that this message may contain SEAKR Engineering (SEAKR) Privileged/Proprietary Information. In such a case, you are strictly prohibited from downloading, photocopying, distributing or otherwise using this message, its contents or attachments in any way. If you have received this message in error, please notify us immediately by replying to this e-mail and delete the message from your mailbox. Information contained in this message that does not relate to the business of SEAKR is neither endorsed by nor attributable to SEAKR.
8
34
Detect source path from switch-arch call path. Always use absolute
paths. Fix bootstrap.c so that for absolute paths, in addition to
include directives (-I), the bare path is checked.
Signed-off-by: Blue Swirl <blauwirbel(a)gmail.com>
---
The motivation is to integrate OpenBIOS to QEMU build system.
---
Makefile | 3 +-
Makefile.target | 3 +-
config/scripts/switch-arch | 107 ++++++++++++++++++++++---------------------
kernel/bootstrap.c | 53 +++++++++++++--------
4 files changed, 91 insertions(+), 75 deletions(-)
diff --git a/Makefile b/Makefile
index 74e462c..d7c0422 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,4 @@
-ODIRS=$(wildcard obj-*)
-TARGETS=$(subst obj-,,$(ODIRS))
+include config.mak
all: requirements info build
diff --git a/Makefile.target b/Makefile.target
index 934b95a..ecb9ad4 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -3,10 +3,11 @@
# (C) 2004-2009 by the OpenBIOS team
#
+include ../config.mak
include config.mak
ODIR := .
-SRCDIR := ..
+
HOSTCC := gcc
HOSTCFLAGS+= -O2 -g -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch
index 1e630da..883de42 100755
--- a/config/scripts/switch-arch
+++ b/config/scripts/switch-arch
@@ -117,21 +117,18 @@ config_set_boolean()
echo "<option name=\"$option\" type=\"boolean\" value=\"true\" />"
}
-if ! test -f utils/dist/debian/rules; then
- echo "switch-arch must be run from the top-level source directory" >&2
- exit 1
-fi
-# This is needed because viewvc messes with the permissions of executables:
-chmod 755 utils/dist/debian/rules
-chmod 755 config/scripts/switch-arch
-chmod 755 config/scripts/reldir
+SRCDIR=`dirname "$0"`/../..
+BUILDDIR=`pwd`
+
+# make source path absolute
+SRCDIR=`cd "$SRCDIR"; pwd`
if test "x$HOSTARCH" = "x"; then
archname
fi
-VERSION=`head VERSION`
+VERSION=`head $SRCDIR/VERSION`
echo "Configuring OpenBIOS on $HOSTARCH for $*"
@@ -156,8 +153,8 @@ done
arch_list=""
for target in $target_list; do
arch=`echo $target | sed s/.*-//g`
- if ! test -f config/examples/${arch}_config.xml; then
- echo "Cannot find config/examples/${arch}_config.xml" >&2
+ if ! test -f $SRCDIR/config/examples/${arch}_config.xml; then
+ echo "Cannot find $SRCDIR/config/examples/${arch}_config.xml" >&2
exit 1
fi
if ! echo $arch_list | grep -q "$arch"; then
@@ -268,7 +265,8 @@ for ARCH in $arch_list; do
cross="yes"
fi
crosscflags $HOSTARCH $ARCH
- OBJDIR=obj-$ARCH
+ OBJDIR=$BUILDDIR/obj-$ARCH
+ ODIRS="$ODIRS $OBJDIR"
printf "Initializing build tree $OBJDIR..."
rm -rf "$OBJDIR"
@@ -293,9 +291,9 @@ for ARCH in $arch_list; do
mkdir -p $OBJDIR/host/include
mkdir -p $OBJDIR/host/kernel
mkdir -p $OBJDIR/forth
- ln -s ../../../include/arch/$BASEARCH $OBJDIR/target/include/asm
+ ln -s $SRCDIR/include/arch/$BASEARCH $OBJDIR/target/include/asm
#compile the host binary with target settings instead
- #ln -s ../../../include/arch/$HOSTARCH $OBJDIR/host/include/asm
+ #ln -s $SRCDIR/include/arch/$HOSTARCH $OBJDIR/host/include/asm
if [ "$mol" = "yes" ]; then
printf "\nUsing MOL path $MOLPATH...\n"
mkdir -p $OBJDIR/target/arch/ppc/mol
@@ -323,73 +321,78 @@ for ARCH in $arch_list; do
fi
echo "ok."
- cd $OBJDIR
- SRCDIR=..
- ODIR=.
-
- printf "Creating target Makefile..."
- echo "ARCH=$ARCH" > $ODIR/config.mak
+ printf "Creating target config.mak..."
+ echo "ARCH=$ARCH" > $OBJDIR/config.mak
if [ "$cross" = "yes" ]; then
- echo "TARGET=$TARGET" >> $ODIR/config.mak
+ echo "TARGET=$TARGET" >> $OBJDIR/config.mak
fi
- echo "CFLAGS=$CFLAGS" >> $ODIR/config.mak
- echo "AS_FLAGS=$AS_FLAGS" >> $ODIR/config.mak
- echo "HOSTARCH?=$HOSTARCH" >> $ODIR/config.mak
- echo "CROSSCFLAGS=$CROSSCFLAGS" >> $ODIR/config.mak
- echo "VERSION=\"$VERSION\"" >> $ODIR/config.mak
-
- ln -s $SRCDIR/config/xml/rules.xml $ODIR/rules.xml
- echo "<?xml version=\"1.0\"?><config>" > $ODIR/config.xml
+ echo "CFLAGS=$CFLAGS" >> $OBJDIR/config.mak
+ echo "AS_FLAGS=$AS_FLAGS" >> $OBJDIR/config.mak
+ echo "HOSTARCH?=$HOSTARCH" >> $OBJDIR/config.mak
+ echo "CROSSCFLAGS=$CROSSCFLAGS" >> $OBJDIR/config.mak
+ echo "VERSION=\"$VERSION\"" >> $OBJDIR/config.mak
+ echo "ok."
+
+ printf "Creating target rules.mak..."
+ ln -s $SRCDIR/config/xml/rules.xml $OBJDIR/rules.xml
+ echo "<?xml version=\"1.0\"?><config>" > $OBJDIR/config.xml
# Generic
- config_set_boolean CONFIG_$ARCH >> $ODIR/config.xml
+ config_set_boolean CONFIG_$ARCH >> $OBJDIR/config.xml
if [ "$BASEARCH" != "$ARCH" ]; then
- config_set_boolean CONFIG_$BASEARCH >> $ODIR/config.xml
+ config_set_boolean CONFIG_$BASEARCH >> $OBJDIR/config.xml
fi
if [ "$mol" = "yes" ]; then
- config_set_boolean CONFIG_MOL >> $ODIR/config.xml
+ config_set_boolean CONFIG_MOL >> $OBJDIR/config.xml
fi
if [ "$briq" = "yes" ]; then
- config_set_boolean CONFIG_BRIQ >> $ODIR/config.xml
+ config_set_boolean CONFIG_BRIQ >> $OBJDIR/config.xml
fi
if [ "$pearpc" = "yes" ]; then
- config_set_boolean CONFIG_PEARPC >> $ODIR/config.xml
+ config_set_boolean CONFIG_PEARPC >> $OBJDIR/config.xml
fi
if [ "$qemu" = "yes" ]; then
- config_set_boolean CONFIG_QEMU >> $ODIR/config.xml
+ config_set_boolean CONFIG_QEMU >> $OBJDIR/config.xml
fi
if [ "$xbox" = "yes" ]; then
- config_set_boolean CONFIG_XBOX >> $ODIR/config.xml
+ config_set_boolean CONFIG_XBOX >> $OBJDIR/config.xml
fi
if [ "$targetbigendian" = "yes" ]; then
- config_set_boolean CONFIG_BIG_ENDIAN >> $ODIR/config.xml
+ config_set_boolean CONFIG_BIG_ENDIAN >> $OBJDIR/config.xml
else
- config_set_boolean CONFIG_LITTLE_ENDIAN >> $ODIR/config.xml
+ config_set_boolean CONFIG_LITTLE_ENDIAN >> $OBJDIR/config.xml
fi
# Kernel binaries
if [ "$plain" = "yes" ]; then
- config_set_boolean CONFIG_IMAGE_ELF >> $ODIR/config.xml
+ config_set_boolean CONFIG_IMAGE_ELF >> $OBJDIR/config.xml
fi
if [ "$builtin" = "yes" ]; then
- config_set_boolean CONFIG_IMAGE_ELF_EMBEDDED >> $ODIR/config.xml
+ config_set_boolean CONFIG_IMAGE_ELF_EMBEDDED >> $OBJDIR/config.xml
fi
# Build hosted Unix binary?
if [ "$unix" = "yes" ]; then
- config_set_boolean CONFIG_HOST_UNIX >> $ODIR/config.xml
- #config_set_boolean CONFIG_UNIX_QT >> $ODIR/config.xml
- #config_set_boolean CONFIG_PLUGINS >> $ODIR/config.xml
+ config_set_boolean CONFIG_HOST_UNIX >> $OBJDIR/config.xml
+ #config_set_boolean CONFIG_UNIX_QT >> $OBJDIR/config.xml
+ #config_set_boolean CONFIG_PLUGINS >> $OBJDIR/config.xml
fi
- cat $SRCDIR/config/examples/${ARCH}_config.xml >> $ODIR/config.xml
+ cat $SRCDIR/config/examples/${ARCH}_config.xml >> $OBJDIR/config.xml
- echo "</config>" >> $ODIR/config.xml
- ln -s ../Makefile.target $ODIR/Makefile
- xsltproc $SRCDIR/config/xml/xinclude.xsl $SRCDIR/build.xml >
$ODIR/build-full.xml
- xsltproc $SRCDIR/config/xml/makefile.xsl $ODIR/build-full.xml >
$ODIR/rules.mak
+ cd $OBJDIR
+ echo "</config>" >> $OBJDIR/config.xml
+ ln -s $SRCDIR/Makefile.target $OBJDIR/Makefile
+ xsltproc $SRCDIR/config/xml/xinclude.xsl $SRCDIR/build.xml >
$OBJDIR/build-full.xml
+ xsltproc $SRCDIR/config/xml/makefile.xsl $OBJDIR/build-full.xml >
$OBJDIR/rules.mak
echo "ok."
printf "Creating config files..."
- xsltproc $SRCDIR/config/xml/config-c.xsl $ODIR/config.xml >
$ODIR/host/include/autoconf.h
- xsltproc $SRCDIR/config/xml/config-c.xsl $ODIR/config.xml >
$ODIR/target/include/autoconf.h
- xsltproc $SRCDIR/config/xml/config-forth.xsl $ODIR/config.xml >
$ODIR/forth/config.fs
+ xsltproc $SRCDIR/config/xml/config-c.xsl $OBJDIR/config.xml >
$OBJDIR/host/include/autoconf.h
+ xsltproc $SRCDIR/config/xml/config-c.xsl $OBJDIR/config.xml >
$OBJDIR/target/include/autoconf.h
+ xsltproc $SRCDIR/config/xml/config-forth.xsl $OBJDIR/config.xml >
$OBJDIR/forth/config.fs
echo "ok."
- cd $SRCDIR
+ cd $BUILDDIR
done
+
+ln -s $SRCDIR/Makefile $BUILDDIR
+
+echo "SRCDIR=$SRCDIR" > $BUILDDIR/config.mak
+echo "ODIRS=$ODIRS" >> $BUILDDIR/config.mak
+echo "TARGETS=$arch_list" >> $BUILDDIR/config.mak
diff --git a/kernel/bootstrap.c b/kernel/bootstrap.c
index 546ffee..59f504f 100644
--- a/kernel/bootstrap.c
+++ b/kernel/bootstrap.c
@@ -499,6 +499,25 @@ static void add_includepath(char *path)
newpath->next = NULL;
}
+static FILE *try_path(const char *file)
+{
+ FILE *ret;
+
+ ret = fopen(file, "r");
+ if (ret != NULL) {
+#ifdef CONFIG_DEBUG_INTERPRETER
+ printk("Including '%s'\n", file);
+#endif
+ srcfilenames[cursrc] = strdup(file);
+ srclines[cursrc] = 1;
+ srcfiles[cursrc++] = ret;
+
+ if (depfile) {
+ fprintf(depfile, " %s", file);
+ }
+ }
+ return ret;
+}
static FILE *fopen_include(const char *fil)
{
@@ -506,28 +525,22 @@ static FILE *fopen_include(const char *fil)
FILE *ret;
include *incl = &includes;
- while (incl) {
- snprintf(fullpath, sizeof(fullpath), "%s/%s", incl->path, fil);
-
- ret = fopen(fullpath, "r");
- if (ret != NULL) {
+ while (incl) {
+ snprintf(fullpath, sizeof(fullpath), "%s/%s", incl->path, fil);
-#ifdef CONFIG_DEBUG_INTERPRETER
- printk("Including '%s'\n", name );
-#endif
- srcfilenames[cursrc] = strdup(fil);
- srclines [ cursrc ] = 1;
- srcfiles [ cursrc++ ] = ret;
-
- if (depfile) {
- fprintf(depfile, " %s", fullpath);
- }
-
- return ret;
- }
+ ret = try_path(fullpath);
+ if (ret) {
+ return ret;
+ }
- incl = incl->next;
- }
+ incl = incl->next;
+ }
+ if (fil[0] == '/') {
+ ret = try_path(fil);
+ if (ret) {
+ return ret;
+ }
+ }
return NULL;
}
--
1.6.2.4
1
0
Instead of traditional debugging printf statements, which
have the bad habit of suffering from bit rot, introduce
tracepoints based on similar system in QEMU.
Only stderr (printk) and simpletrace (output via fw_cfg
device to QEMU) back ends are supported.
Signed-off-by: Blue Swirl <blauwirbel(a)gmail.com>
---
Default trace method should be stderr, this should be equivalent to
current DPRINTF/printk.
Simpletrace method feeds the tracepoint data to QEMU trace system via
fw_cfg. Each tracepoint can be controlled run time with QEMU trace
series monitor commands. Use of simpletrace needs a patch to QEMU.
All tracepoints are controlled by editing 'trace-events' file instead
of .c or *_config.xml files.
I've only tested Sparc64.
---
config/examples/amd64_config.xml | 3 +-
config/examples/ppc64_config.xml | 3 +-
config/examples/ppc_config.xml | 3 +-
config/examples/sparc32_config.xml | 3 +-
config/examples/sparc64_config.xml | 3 +-
config/scripts/tracetool | 692 ++++++++++++++++++++++++++++++++++++
drivers/esp.c | 3 +-
drivers/fw_cfg.c | 22 ++
drivers/ide.c | 6 +-
include/arch/common/fw_cfg.h | 9 +-
include/libopenbios/simpletrace.h | 31 ++
libopenbios/build.xml | 33 ++
libopenbios/simpletrace.c | 76 ++++
trace-events | 3 +
14 files changed, 879 insertions(+), 11 deletions(-)
create mode 100644 config/scripts/tracetool
create mode 100644 include/libopenbios/simpletrace.h
create mode 100644 libopenbios/simpletrace.c
create mode 100644 trace-events
diff --git a/config/examples/amd64_config.xml b/config/examples/amd64_config.xml
index 33d4267..ba3838b 100644
--- a/config/examples/amd64_config.xml
+++ b/config/examples/amd64_config.xml
@@ -14,7 +14,8 @@
<option name="CONFIG_SERIAL_PORT" type="boolean" value="true"/>
<option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/>
<option name="CONFIG_DEBUG_CONSOLE_VGA" type="boolean" value="true"/>
-
+ <option name="CONFIG_TRACE_SIMPLETRACE" type="boolean" value="false"/>
+ <option name="CONFIG_TRACE_STDERR" type="boolean" value="true"/>
<!-- Module Configuration -->
<option name="CONFIG_CMDLINE" type="boolean" value="true"/>
diff --git a/config/examples/ppc64_config.xml b/config/examples/ppc64_config.xml
index 5f79c21..bca5cc5 100644
--- a/config/examples/ppc64_config.xml
+++ b/config/examples/ppc64_config.xml
@@ -12,7 +12,8 @@
<option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/>
<option name="CONFIG_DEBUG_CONSOLE_VGA" type="boolean" value="true"/>
<option name="CONFIG_DEBUG_OFMEM" type="boolean" value="false"/>
-
+ <option name="CONFIG_TRACE_SIMPLETRACE" type="boolean" value="false"/>
+ <option name="CONFIG_TRACE_STDERR" type="boolean" value="true"/>
<!-- Module Configuration -->
<option name="CONFIG_CMDLINE" type="boolean" value="true"/>
diff --git a/config/examples/ppc_config.xml b/config/examples/ppc_config.xml
index 352cb57..a338d56 100644
--- a/config/examples/ppc_config.xml
+++ b/config/examples/ppc_config.xml
@@ -12,7 +12,8 @@
<option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/>
<option name="CONFIG_DEBUG_CONSOLE_VGA" type="boolean" value="true"/>
<option name="CONFIG_DEBUG_OFMEM" type="boolean" value="false"/>
-
+ <option name="CONFIG_TRACE_SIMPLETRACE" type="boolean" value="false"/>
+ <option name="CONFIG_TRACE_STDERR" type="boolean" value="true"/>
<!-- Module Configuration -->
<option name="CONFIG_CMDLINE" type="boolean" value="true"/>
diff --git a/config/examples/sparc32_config.xml
b/config/examples/sparc32_config.xml
index f2d6afc..2b449cc 100644
--- a/config/examples/sparc32_config.xml
+++ b/config/examples/sparc32_config.xml
@@ -19,7 +19,8 @@
<option name="CONFIG_SERIAL_PORT" type="integer" value="0"/>
<option name="CONFIG_SERIAL_SPEED" type="integer" value="9600"/>
<option name="CONFIG_DEBUG_OFMEM" type="boolean" value="false"/>
-
+ <option name="CONFIG_TRACE_SIMPLETRACE" type="boolean" value="true"/>
+ <option name="CONFIG_TRACE_STDERR" type="boolean" value="false"/>
<!-- Module Configuration -->
<option name="CONFIG_CMDLINE" type="boolean" value="true"/>
diff --git a/config/examples/sparc64_config.xml
b/config/examples/sparc64_config.xml
index a4e1336..40fb7a6 100644
--- a/config/examples/sparc64_config.xml
+++ b/config/examples/sparc64_config.xml
@@ -16,7 +16,8 @@
<option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/>
<option name="CONFIG_DEBUG_CONSOLE_VGA" type="boolean" value="true"/>
<option name="CONFIG_DEBUG_OFMEM" type="boolean" value="false"/>
-
+ <option name="CONFIG_TRACE_SIMPLETRACE" type="boolean" value="true"/>
+ <option name="CONFIG_TRACE_STDERR" type="boolean" value="false"/>
<!-- Module Configuration -->
<option name="CONFIG_CMDLINE" type="boolean" value="true"/>
diff --git a/config/scripts/tracetool b/config/scripts/tracetool
new file mode 100644
index 0000000..5c0534f
--- /dev/null
+++ b/config/scripts/tracetool
@@ -0,0 +1,692 @@
+#!/bin/sh
+#
+# Code generator for trace events
+#
+# Copyright IBM, Corp. 2010
+#
+# This work is licensed under the terms of the GNU GPL, version 2. See
+# the COPYING file in the top-level directory.
+
+# Disable pathname expansion, makes processing text with '*' characters simpler
+set -f
+
+usage()
+{
+ cat >&2 <<EOF
+usage: $0 [--nop | --simple | --stderr | --ust | --dtrace] [-h | -c | -d | -g]
+Generate tracing code for a file on stdin.
+
+Backends:
+ --nop Tracing disabled
+ --simple Simple built-in backend
+ --stderr Stderr built-in backend
+ --ust LTTng User Space Tracing backend
+ --dtrace DTrace/SystemTAP backend
+
+Output formats:
+ -h Generate .h file
+ -c Generate .c file
+ -d Generate .d file (DTrace only)
+ -g Generate guest trace .c file
+ --stap Generate .stp file (DTrace with SystemTAP only)
+
+Options:
+ --binary [path] Full path to QEMU binary
+ --target-arch [arch] QEMU emulator target arch
+ --target-type [type] QEMU emulator target type ('system' or 'user')
+ --probe-prefix [prefix] Prefix for dtrace probe names
+ (default: qemu-\$targettype-\$targetarch)
+ --guest-trace Generate guest trace function
+
+EOF
+ exit 1
+}
+
+# Get the name of a trace event
+get_name()
+{
+ echo ${1%%\(*}
+}
+
+# Get the argument list of a trace event, including types and names
+get_args()
+{
+ local args
+ args=${1#*\(}
+ args=${args%%\)*}
+ echo "$args"
+}
+
+# Get the argument name list of a trace event
+get_argnames()
+{
+ local nfields field name sep
+ nfields=0
+ sep="$2"
+ for field in $(get_args "$1"); do
+ nfields=$((nfields + 1))
+
+ # Drop pointer star
+ field=${field#\*}
+
+ # Only argument names have commas at the end
+ name=${field%,}
+ test "$field" = "$name" && continue
+
+ printf "%s%s " $name $sep
+ done
+
+ # Last argument name
+ if [ "$nfields" -gt 1 ]
+ then
+ printf "%s" "$name"
+ fi
+}
+
+# Get the number of arguments to a trace event
+get_argc()
+{
+ local name argc
+ argc=0
+ for name in $(get_argnames "$1", ","); do
+ argc=$((argc + 1))
+ done
+ echo $argc
+}
+
+# Get the format string for a trace event
+get_fmt()
+{
+ local fmt
+ fmt=${1#*\"}
+ fmt=${fmt%\"*}
+ echo "$fmt"
+}
+
+# Get the state of a trace event
+get_state()
+{
+ local str disable state
+ str=$(get_name "$1")
+ disable=${str##disable }
+ if [ "$disable" = "$str" ] ; then
+ state=1
+ else
+ state=0
+ fi
+ echo "$state"
+}
+
+linetoh_begin_nop()
+{
+ return
+}
+
+linetoh_nop()
+{
+ local name args
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+
+ # Define an empty function for the trace event
+ cat <<EOF
+static inline void trace_$name($args)
+{
+}
+EOF
+}
+
+linetoh_end_nop()
+{
+ return
+}
+
+linetoc_begin_nop()
+{
+ return
+}
+
+linetoc_nop()
+{
+ # No need for function definitions in nop backend
+ return
+}
+
+linetoc_end_nop()
+{
+ return
+}
+
+linetoh_begin_simple()
+{
+ cat <<EOF
+#include "libopenbios/simpletrace.h"
+EOF
+
+ simple_event_num=0
+}
+
+cast_args_to_uint64_t()
+{
+ local arg
+ for arg in $(get_argnames "$1", ","); do
+ printf "%s" "(uint64_t)(uintptr_t)$arg"
+ done
+}
+
+linetoh_simple()
+{
+ local name args argc trace_args state
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argc=$(get_argc "$1")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ]; then
+ name=${name##disable }
+ fi
+
+ trace_args="$simple_event_num"
+ if [ "$argc" -gt 0 ]
+ then
+ trace_args="$trace_args, $(cast_args_to_uint64_t "$1")"
+ fi
+
+ cat <<EOF
+static inline void trace_$name($args)
+{
+ trace$argc($trace_args);
+}
+EOF
+
+ simple_event_num=$((simple_event_num + 1))
+}
+
+linetoh_end_simple()
+{
+ cat <<EOF
+#define NR_TRACE_EVENTS $simple_event_num
+extern TraceEvent trace_list[NR_TRACE_EVENTS];
+EOF
+}
+
+linetoc_begin_simple()
+{
+ cat <<EOF
+#include "trace.h"
+
+TraceEvent trace_list[] = {
+EOF
+ simple_event_num=0
+
+}
+
+linetoc_simple()
+{
+ local name state
+ name=$(get_name "$1")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ] ; then
+ name=${name##disable }
+ fi
+ cat <<EOF
+{.tp_name = "$name", .state=$state},
+EOF
+ simple_event_num=$((simple_event_num + 1))
+}
+
+linetoc_end_simple()
+{
+ cat <<EOF
+};
+EOF
+}
+
+#STDERR
+linetoh_begin_stderr()
+{
+ cat <<EOF
+#include "libc/vsprintf.h"
+EOF
+}
+
+linetoh_stderr()
+{
+ local name args argnames argc fmt
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1" ",")
+ argc=$(get_argc "$1")
+ fmt=$(get_fmt "$1")
+
+ if [ "$argc" -gt 0 ]; then
+ argnames=", $argnames"
+ fi
+
+ cat <<EOF
+static inline void trace_$name($args)
+{
+ printk("$name $fmt\n" $argnames);
+}
+EOF
+}
+
+linetoh_end_stderr()
+{
+return
+}
+
+linetoc_begin_stderr()
+{
+return
+}
+
+linetoc_stderr()
+{
+return
+}
+
+linetoc_end_stderr()
+{
+return
+}
+#END OF STDERR
+
+# Clean up after UST headers which pollute the namespace
+ust_clean_namespace() {
+ cat <<EOF
+#undef mutex_lock
+#undef mutex_unlock
+#undef inline
+#undef wmb
+EOF
+}
+
+linetoh_begin_ust()
+{
+ echo "#include <ust/tracepoint.h>"
+ ust_clean_namespace
+}
+
+linetoh_ust()
+{
+ local name args argnames
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1", ",")
+
+ cat <<EOF
+DECLARE_TRACE(ust_$name, TP_PROTO($args), TP_ARGS($argnames));
+#define trace_$name trace_ust_$name
+EOF
+}
+
+linetoh_end_ust()
+{
+ return
+}
+
+linetoc_begin_ust()
+{
+ cat <<EOF
+#include <ust/marker.h>
+$(ust_clean_namespace)
+#include "trace.h"
+EOF
+}
+
+linetoc_ust()
+{
+ local name args argnames fmt
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1", ",")
+ [ -z "$argnames" ] || argnames=", $argnames"
+ fmt=$(get_fmt "$1")
+
+ cat <<EOF
+DEFINE_TRACE(ust_$name);
+
+static void ust_${name}_probe($args)
+{
+ trace_mark(ust, $name, "$fmt"$argnames);
+}
+EOF
+
+ # Collect names for later
+ names="$names $name"
+}
+
+linetoc_end_ust()
+{
+ cat <<EOF
+static void __attribute__((constructor)) trace_init(void)
+{
+EOF
+
+ for name in $names; do
+ cat <<EOF
+ register_trace_ust_$name(ust_${name}_probe);
+EOF
+ done
+
+ echo "}"
+}
+
+linetoh_begin_dtrace()
+{
+ cat <<EOF
+#include "trace-dtrace.h"
+EOF
+}
+
+linetoh_dtrace()
+{
+ local name args argnames state nameupper
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ argnames=$(get_argnames "$1", ",")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ] ; then
+ name=${name##disable }
+ fi
+
+ nameupper=`echo $name | tr '[:lower:]' '[:upper:]'`
+
+ # Define an empty function for the trace event
+ cat <<EOF
+static inline void trace_$name($args) {
+ if (QEMU_${nameupper}_ENABLED()) {
+ QEMU_${nameupper}($argnames);
+ }
+}
+EOF
+}
+
+linetoh_end_dtrace()
+{
+ return
+}
+
+linetoc_begin_dtrace()
+{
+ return
+}
+
+linetoc_dtrace()
+{
+ # No need for function definitions in dtrace backend
+ return
+}
+
+linetoc_end_dtrace()
+{
+ return
+}
+
+linetod_begin_dtrace()
+{
+ cat <<EOF
+provider qemu {
+EOF
+}
+
+linetod_dtrace()
+{
+ local name args state
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ] ; then
+ name=${name##disable }
+ fi
+
+ # DTrace provider syntax expects foo() for empty
+ # params, not foo(void)
+ if [ "$args" = "void" ]; then
+ args=""
+ fi
+
+ # Define prototype for probe arguments
+ cat <<EOF
+ probe $name($args);
+EOF
+}
+
+linetod_end_dtrace()
+{
+ cat <<EOF
+};
+EOF
+}
+
+linetostap_begin_dtrace()
+{
+ return
+}
+
+linetostap_dtrace()
+{
+ local i arg name args arglist state
+ name=$(get_name "$1")
+ args=$(get_args "$1")
+ arglist=$(get_argnames "$1", "")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ] ; then
+ name=${name##disable }
+ fi
+
+ # Define prototype for probe arguments
+ cat <<EOF
+probe $probeprefix.$name = process("$binary").mark("$name")
+{
+EOF
+
+ i=1
+ for arg in $arglist
+ do
+ # 'limit' is a reserved keyword
+ if [ "$arg" = "limit" ]; then
+ arg="_limit"
+ fi
+ cat <<EOF
+ $arg = \$arg$i;
+EOF
+ i="$((i+1))"
+ done
+
+ cat <<EOF
+}
+EOF
+}
+
+linetostap_end_dtrace()
+{
+ return
+}
+
+linetog_begin_all()
+{
+ id=0
+ cat <<EOF
+#include "trace.h"
+#include "guest-trace.h"
+
+void guest_trace(uint64_t event_id, uint64_t arg1, uint64_t arg2,
+ uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)
+
+{
+ switch (event_id) {
+EOF
+}
+
+linetog_all()
+{
+ local name args argc arg
+ name=$(get_name "$1")
+ argc=$(get_argc "$1")
+ fieldno=1
+ args=
+ for arg in $(get_argnames "$1", ","); do
+ args="${args}arg$fieldno"
+ [ "$fieldno" = "$argc" ] || args="$args, "
+ fieldno="$((fieldno + 1))"
+ done
+ cat <<EOF
+ case $id:
+ trace_$name($args);
+ break;
+EOF
+ id="$((id + 1))"
+}
+
+linetog_end_all()
+{
+ cat <<EOF
+ default:
+ break;
+ }
+}
+EOF
+}
+
+# Process stdin by calling begin, line, and end functions for the backend
+convert()
+{
+ local begin process_line end str disable
+ begin="lineto$1_begin_$backend"
+ process_line="lineto$1_$backend"
+ end="lineto$1_end_$backend"
+
+ "$begin"
+
+ while read -r str; do
+ # Skip comments and empty lines
+ test -z "${str%%#*}" && continue
+
+ # Process the line. The nop backend handles disabled lines.
+ disable=${str%%disable *}
+ echo
+ if test -z "$disable"; then
+ # Pass the disabled state as an arg for the simple
+ # or DTrace backends which handle it dynamically.
+ # For all other backends, call lineto$1_nop()
+ if [ $backend = "simple" -o "$backend" = "dtrace" ]; then
+ "$process_line" "$str"
+ else
+ "lineto$1_nop" "${str##disable }"
+ fi
+ else
+ "$process_line" "$str"
+ fi
+ done
+
+ echo
+ "$end"
+}
+
+tracetoh()
+{
+ cat <<EOF
+#ifndef TRACE_H
+#define TRACE_H
+
+/* This file is autogenerated by tracetool, do not edit. */
+
+EOF
+ convert h
+ echo "#endif /* TRACE_H */"
+}
+
+tracetoc()
+{
+ echo "/* This file is autogenerated by tracetool, do not edit. */"
+ convert c
+}
+
+tracetog()
+{
+ echo "/* This file is autogenerated by tracetool, do not edit. */"
+ backend=all
+ convert g
+}
+
+tracetod()
+{
+ if [ $backend != "dtrace" ]; then
+ echo "DTrace probe generator not applicable to $backend backend"
+ exit 1
+ fi
+ echo "/* This file is autogenerated by tracetool, do not edit. */"
+ convert d
+}
+
+tracetostap()
+{
+ if [ $backend != "dtrace" ]; then
+ echo "SystemTAP tapset generator not applicable to $backend backend"
+ exit 1
+ fi
+ if [ -z "$binary" ]; then
+ echo "--binary is required for SystemTAP tapset generator"
+ exit 1
+ fi
+ if [ -z "$probeprefix" -a -z "$targettype" ]; then
+ echo "--target-type is required for SystemTAP tapset generator"
+ exit 1
+ fi
+ if [ -z "$probeprefix" -a -z "$targetarch" ]; then
+ echo "--target-arch is required for SystemTAP tapset generator"
+ exit 1
+ fi
+ if [ -z "$probeprefix" ]; then
+ probeprefix="qemu.$targettype.$targetarch";
+ fi
+ echo "/* This file is autogenerated by tracetool, do not edit. */"
+ convert stap
+}
+
+
+backend=
+output=
+binary=
+targettype=
+targetarch=
+probeprefix=
+guesttrace=
+
+
+until [ -z "$1" ]
+do
+ case "$1" in
+ "--nop" | "--simple" | "--stderr" | "--ust" | "--dtrace")
backend="${1#--}" ;;
+
+ "--binary") shift ; binary="$1" ;;
+ "--target-arch") shift ; targetarch="$1" ;;
+ "--target-type") shift ; targettype="$1" ;;
+ "--probe-prefix") shift ; probeprefix="$1" ;;
+ "--guest-trace") guesttrace="yes" ;;
+
+ "-h" | "-c" | "-d" | "-g") output="${1#-}" ;;
+ "--stap") output="${1#--}" ;;
+
+ "--check-backend") exit 0 ;; # used by ./configure to test for backend
+
+ "--list-backends") # used by ./configure to list available backends
+ echo "nop simple stderr ust dtrace"
+ exit 0
+ ;;
+
+ *)
+ usage;;
+ esac
+ shift
+done
+
+if [ "$backend" = "" -o "$output" = "" ]; then
+ usage
+fi
+
+gen="traceto$output"
+"$gen"
+
+exit 0
diff --git a/drivers/esp.c b/drivers/esp.c
index 41e0394..0ab1893 100644
--- a/drivers/esp.c
+++ b/drivers/esp.c
@@ -25,6 +25,7 @@
#include "asm/dma.h"
#include "esp.h"
#include "libopenbios/ofmem.h"
+#include "trace.h"
#define BUFSIZE 4096
@@ -106,7 +107,7 @@ do_command(esp_private_t *esp, sd_private_t *sd,
int cmdlen, int replylen)
// Clear interrupts to avoid guests seeing spurious interrupts
(void)esp->ll->regs[ESP_INTRPT];
- DPRINTF("do_command: id %d, cmd[0] 0x%x, status 0x%x\n", sd->id,
esp->buffer[0], status);
+ trace_esp_do_command(sd->id, esp->buffer[0], status);
/* Target didn't want all command data? */
if ((status & ESP_STAT_TCNT) != ESP_STAT_TCNT) {
diff --git a/drivers/fw_cfg.c b/drivers/fw_cfg.c
index 4027570..caaab3b 100644
--- a/drivers/fw_cfg.c
+++ b/drivers/fw_cfg.c
@@ -18,6 +18,17 @@ fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes)
for (i = 0; i < nbytes; i++)
buf[i] = *fw_cfg_data;
}
+
+void
+fw_cfg_write(uint16_t cmd, char *buf, unsigned int nbytes)
+{
+ unsigned int i;
+
+ *fw_cfg_cmd = cmd;
+ for (i = 0; i < nbytes; i++) {
+ *fw_cfg_data = buf[i];
+ }
+}
#else
// XXX depends on PCI bus location, should be removed
void
@@ -29,6 +40,17 @@ fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes)
for (i = 0; i < nbytes; i++)
buf[i] = inb(CONFIG_FW_CFG_ADDR + 1);
}
+
+void
+fw_cfg_write(uint16_t cmd, char *buf, unsigned int nbytes)
+{
+ unsigned int i;
+
+ outw(cmd, CONFIG_FW_CFG_ADDR);
+ for (i = 0; i < nbytes; i++) {
+ outb(buf[i], CONFIG_FW_CFG_ADDR + 1);
+ }
+}
#endif
uint64_t
diff --git a/drivers/ide.c b/drivers/ide.c
index 0d09bcd..e4f68f4 100644
--- a/drivers/ide.c
+++ b/drivers/ide.c
@@ -23,6 +23,7 @@
#include "ide.h"
#include "hdreg.h"
#include "timer.h"
+#include "trace.h"
#ifdef CONFIG_DEBUG_IDE
#define IDE_DPRINTF(fmt, args...) \
@@ -161,7 +162,7 @@ ob_ide_pio_insw(struct ide_drive *drive, unsigned
int offset,
struct ide_channel *chan = drive->channel;
if (len & 1) {
- IDE_DPRINTF("%d: command not word aligned\n", drive->nr);
+ trace_ob_ide_pio_insw(drive->nr);
return;
}
@@ -1193,8 +1194,7 @@ ob_ide_read_blocks(int *idx)
unsigned char *dest = (unsigned char *)cell2pointer(POP());
struct ide_drive *drive = *(struct ide_drive **)idx;
- IDE_DPRINTF("ob_ide_read_blocks %lx block=%ld n=%ld\n",
- (unsigned long)dest, (unsigned long)blk, (long)n);
+ trace_ob_ide_read_blocks((unsigned long)dest, (unsigned
long)blk, (long)n);
while (n) {
int len = n;
diff --git a/include/arch/common/fw_cfg.h b/include/arch/common/fw_cfg.h
index b0a23cd..1448961 100644
--- a/include/arch/common/fw_cfg.h
+++ b/include/arch/common/fw_cfg.h
@@ -1,6 +1,9 @@
#ifndef FW_CFG_H
#define FW_CFG_H
+#define FW_CFG_WRITE_CHANNEL 0x4000
+#define FW_CFG_ARCH_LOCAL 0x8000
+
#define FW_CFG_SIGNATURE 0x00
#define FW_CFG_ID 0x01
#define FW_CFG_UUID 0x02
@@ -30,10 +33,11 @@
#define FW_CFG_FILE_FIRST 0x20
#define FW_CFG_FILE_SLOTS 0x10
+
+#define FW_CFG_GUEST_TRACE (FW_CFG_WRITE_CHANNEL |
(FW_CFG_FILE_FIRST+FW_CFG_FILE_SLOTS))
+
#define FW_CFG_MAX_ENTRY (FW_CFG_FILE_FIRST+FW_CFG_FILE_SLOTS)
-#define FW_CFG_WRITE_CHANNEL 0x4000
-#define FW_CFG_ARCH_LOCAL 0x8000
#define FW_CFG_ENTRY_MASK ~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)
#define FW_CFG_PPC_WIDTH (FW_CFG_ARCH_LOCAL + 0x00)
@@ -78,6 +82,7 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
#ifndef NO_OPENBIOS_PROTOS
void fw_cfg_read(uint16_t cmd, char *buf, unsigned int nbytes);
+void fw_cfg_write(uint16_t cmd, char *buf, unsigned int nbytes);
uint64_t fw_cfg_read_i64(uint16_t cmd);
uint32_t fw_cfg_read_i32(uint16_t cmd);
uint16_t fw_cfg_read_i16(uint16_t cmd);
diff --git a/include/libopenbios/simpletrace.h
b/include/libopenbios/simpletrace.h
new file mode 100644
index 0000000..aa98ee3
--- /dev/null
+++ b/include/libopenbios/simpletrace.h
@@ -0,0 +1,31 @@
+/*
+ * Simple trace backend
+ *
+ * Copyright IBM, Corp. 2010
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef SIMPLETRACE_H
+#define SIMPLETRACE_H
+
+#include "asm/types.h"
+
+typedef uint64_t TraceEventID;
+
+typedef struct {
+ const char *tp_name;
+ int state;
+} TraceEvent;
+
+void trace0(TraceEventID event);
+void trace1(TraceEventID event, uint64_t x1);
+void trace2(TraceEventID event, uint64_t x1, uint64_t x2);
+void trace3(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3);
+void trace4(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t
x3, uint64_t x4);
+void trace5(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t
x3, uint64_t x4, uint64_t x5);
+void trace6(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t
x3, uint64_t x4, uint64_t x5, uint64_t x6);
+
+#endif /* SIMPLETRACE_H */
diff --git a/libopenbios/build.xml b/libopenbios/build.xml
index 04e3800..b16cd35 100644
--- a/libopenbios/build.xml
+++ b/libopenbios/build.xml
@@ -19,6 +19,39 @@
<object source="linuxbios_info.c" condition="LINUXBIOS"/>
<object source="ofmem_common.c" condition="OFMEM"/>
<object source="xcoff_load.c" condition="LOADER_XCOFF"/>
+ <object source="simpletrace.c" condition="TRACE_SIMPLETRACE"/>
+ <executable name="target/include/trace.h" condition="TRACE_SIMPLETRACE">
+ <rule><![CDATA[ $(ODIR)/target/include/trace.h-timestamp
+
+$(ODIR)/target/include/trace.h-timestamp: $(SRCDIR)/trace-events
+ $(call quiet-command,sh $(SRCDIR)/config/scripts/tracetool --simple
-h < $< > $@," GEN trace.h")
+ @cmp -s $@ $(ODIR)/target/include/trace.h || cp $@
$(ODIR)/target/include/trace.h]]></rule>
+ </executable>
+ <executable name="target/libopenbios/trace.c" condition="TRACE_SIMPLETRACE">
+ <rule><![CDATA[ $(ODIR)/target/libopenbios/trace.c-timestamp
+
+$(ODIR)/target/libopenbios/trace.c-timestamp: $(SRCDIR)/trace-events
+ $(call quiet-command,sh $(SRCDIR)/config/scripts/tracetool --simple
-c < $< > $@," GEN trace.c")
+ @cmp -s $@ $(ODIR)/target/libopenbios/trace.c || cp $@
$(ODIR)/target/libopenbios/trace.c]]></rule>
+ </executable>
+ <executable name="target/include/trace.h" condition="TRACE_STDERR">
+ <rule><![CDATA[ $(ODIR)/target/include/trace.h-timestamp
+
+$(ODIR)/target/include/trace.h-timestamp: $(SRCDIR)/trace-events
+ $(call quiet-command,sh $(SRCDIR)/config/scripts/tracetool --stderr
-h < $< > $@," GEN trace.h")
+ @cmp -s $@ $(ODIR)/target/include/trace.h || cp $@
$(ODIR)/target/include/trace.h]]></rule>
+ </executable>
+ <executable name="target/libopenbios/trace.c" condition="TRACE_STDERR">
+ <rule><![CDATA[ $(ODIR)/target/libopenbios/trace.c-timestamp
+
+$(ODIR)/target/libopenbios/trace.c-timestamp: $(SRCDIR)/trace-events
+ $(call quiet-command,sh $(SRCDIR)/config/scripts/tracetool --stderr
-c < $< > $@," GEN trace.c")
+ @cmp -s $@ $(ODIR)/target/libopenbios/trace.c || cp $@
$(ODIR)/target/libopenbios/trace.c]]></rule>
+ </executable>
+ <executable name="target/libopenbios/trace.o">
+ <rule><![CDATA[ $(ODIR)/target/libopenbios/trace.c
$(ODIR)/target/include/trace.h
+ $(call quiet-command,$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o
$@ $<, " CC $(TARGET_DIR)$@")]]></rule>
+ </executable>
</library>
<dictionary name="openbios" target="forth">
diff --git a/libopenbios/simpletrace.c b/libopenbios/simpletrace.c
new file mode 100644
index 0000000..8795b81
--- /dev/null
+++ b/libopenbios/simpletrace.c
@@ -0,0 +1,76 @@
+/*
+ * Simple trace backend
+ *
+ * Copyright IBM, Corp. 2010
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#include "libopenbios/simpletrace.h"
+#include "trace.h"
+#include "libc/byteorder.h"
+#define NO_QEMU_PROTOS
+#include "arch/common/fw_cfg.h"
+
+/** Trace buffer entry, without timestamp */
+typedef struct {
+ uint64_t event;
+ uint64_t x1;
+ uint64_t x2;
+ uint64_t x3;
+ uint64_t x4;
+ uint64_t x5;
+ uint64_t x6;
+} TraceRecord;
+
+static void trace(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3,
+ uint64_t x4, uint64_t x5, uint64_t x6)
+{
+ TraceRecord tmp = (TraceRecord){
+ .event = __cpu_to_le64(event),
+ .x1 = __cpu_to_le64(x1),
+ .x2 = __cpu_to_le64(x2),
+ .x3 = __cpu_to_le64(x3),
+ .x4 = __cpu_to_le64(x4),
+ .x5 = __cpu_to_le64(x5),
+ .x6 = __cpu_to_le64(x6),
+ };
+ fw_cfg_write(FW_CFG_GUEST_TRACE, (char *)&tmp, sizeof(tmp));
+}
+
+void trace0(TraceEventID event)
+{
+ trace(event, 0, 0, 0, 0, 0, 0);
+}
+
+void trace1(TraceEventID event, uint64_t x1)
+{
+ trace(event, x1, 0, 0, 0, 0, 0);
+}
+
+void trace2(TraceEventID event, uint64_t x1, uint64_t x2)
+{
+ trace(event, x1, x2, 0, 0, 0, 0);
+}
+
+void trace3(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3)
+{
+ trace(event, x1, x2, x3, 0, 0, 0);
+}
+
+void trace4(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t
x3, uint64_t x4)
+{
+ trace(event, x1, x2, x3, x4, 0, 0);
+}
+
+void trace5(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t
x3, uint64_t x4, uint64_t x5)
+{
+ trace(event, x1, x2, x3, x4, x5, 0);
+}
+
+void trace6(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t
x3, uint64_t x4, uint64_t x5, uint64_t x6)
+{
+ trace(event, x1, x2, x3, x4, x5, x6);
+}
diff --git a/trace-events b/trace-events
new file mode 100644
index 0000000..0fbb853
--- /dev/null
+++ b/trace-events
@@ -0,0 +1,3 @@
+esp_do_command(int id, int cmd, int status) "id %d, cmd[0] 0x%x, status 0x%x"
+ob_ide_pio_insw(int drive) "%d: command not word aligned"
+ob_ide_read_blocks(unsigned long dest, unsigned long blk, long n)
"%lx block=%ld n=%ld"
--
1.6.2.4
1
0
I've got FCode routines living as a dropin in a 4.x OBP. The dropin is
fine, does its job supporting the card, but I need to install it in a
new server and no one can find the original. Is there a way to extract
the dropin so I can move it?
Once I get it, I know I can install the binary image using "add-dropin
/location/"
Can I also stick it in the card's PROM? Then I wouldn't have it add it
as a drop-in to each system I want to use the card in. How would I do that?
Thanks!
Dave
2
1
Re: [OpenBIOS] [PATCH 7/10] Apple local variables implementation in Forth
by Mark Cave-Ayland Aug. 24, 2011
by Mark Cave-Ayland Aug. 24, 2011
Aug. 24, 2011
On 10/08/11 16:43, William Hahne wrote:
> Very interesting. I think this needs someone with quite strong
> Forth-fu (Stefan) to review this one. Also I can't see any related
> documentation with this patch related to locals support?
>
>
> This is an Apple specific thing. See
> http://www.openfirmware.info/How_Local_Variables_in_Forth_Work_---_Using_Ap…
Right I understand this, but I'm fairly sure there is an official spec
for Forth local variables somewhere. For something to be committed, I'd
expect the commit reference to contain a link to the source
specification and comments in the code giving an indication as to what
the level of implementation actually is (I absolutely understand that it
can be impractical to implement everything within the time available).
ATB,
Mark.
--
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
Sirius Labs: http://www.siriusit.co.uk/labs
3
6
Aug. 24, 2011
William,
Am 22.08.2011 um 05:14 schrieb William Hahne:
> This is a forth word that is required by BootX. It just fills some
> specified memory address and length with 32 bit integers. It is a
> non-standard addition and therefore isn't documented. Thanks to Segher
> Boessenkool for the corrected for loop.
This is still missing a Signed-off-by line!
Compare QEMU's http://wiki.qemu.org/Contribute/SubmitAPatch
I'd like to compile-test and commit the patch(es), but I cannot
copy&paste this from my mailer (leading spaces get stripped).
Best use git-am compatible email format or please supply me with the
patch as an attachment or download. Thanks!
Andreas
$ git am ../mac_10.eml
Applying: Adding filll Forth primitive (v2)
error: ppc/qemu/init.c (working copy): does not exist in index
Patch failed at 0001 Adding filll Forth primitive (v2)
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
> Index: arch/ppc/qemu/init.c
> ===================================================================
> --- arch/ppc/qemu/init.c (revision 1047)
> +++ arch/ppc/qemu/init.c (working copy)
> @@ -539,6 +539,7 @@
> }
>
> static void go(void);
> +static void filll(void);
>
> static void
> go(void)
> @@ -551,6 +552,23 @@
> call_elf(0, 0, addr);
> }
>
> +/* This is an Apple specific word that fills a specified location
> and length
> + of memory with 32bit integers.
> +
> + ( dest count value -- ) */
> +static void
> +filll(void)
> +{
> + uint32_t value = POP();
> + int count = POP();
> + uint32_t *dest = (uint32_t*)cell2pointer(POP());
> +
> + int i;
> + for (i = count; i > 0; i -= sizeof(uint32_t)) {
> + *dest++ = value;
> + }
> +}
> +
> static void kvm_of_init(void)
> {
> char hypercall[4 * 4];
> @@ -879,4 +897,5 @@
>
> bind_func("platform-boot", boot);
> bind_func("(go)", go);
> + bind_func("filll", filll);
> }
>
> --
> OpenBIOS http://openbios.org/
> Mailinglist: http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
2
1
Aug. 24, 2011
One detail William.
Documentation clearly state that drivers, even if present on the partition map, ARE NOT PARTITIONS.
(I.M. Vol. 2, and a document I've forgot the name that describes the boot process extensively, present on Apple Support archives -even describes how Rhapsody boots-)
Have you checked the count does not include _FREE and _VOID in BootX?
El 22/08/2011, a las 03:15, William Hahne escribió:
> Updated commit message:
>
> Currently every entry in the Apple Partition Map is counted as a
> partition. This behavior prevents BootX from finding the boot
> partition since BootX will only check the first few partitions before
> giving up. This patch skips over entries that do not specify
> partitions such as void entries and drivers. While documentation
> doesn't say specifically that these partitions should be skipped, it
> can be inferred from BootX behavior as well as how the documentation
> doesn't refer to drivers as partitions.
>
> --
> OpenBIOS http://openbios.org/
> Mailinglist: http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
1
0
Aug. 24, 2011
APPLE_VOID partition is just a partition entry holder, so you don't have to resize the partition table but it occupies no space on disk.
APPLE_FREE however, indicates free space on disk.
This is, if my memory don't fail, on Inside Macintosh books, Volume 2 or 4.
Sorry no link I have the books in paper :p
El 10/08/2011, a las 16:28, William Hahne escribió:
>
>
> On Wed, Aug 10, 2011 at 5:50 AM, Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk> wrote:
> On 09/08/11 22:54, William Hahne wrote:
>
> The void partitions can be occasionally found on Mac OS discs (10.2 for
> example.) Previously mac-parts would just stop at the first void
> partition meaning it would never try to boot from the HFS partition.
>
> Index: packages/mac-parts.c
> ===================================================================
> --- packages/mac-parts.c (revision 1041)
> +++ packages/mac-parts.c (working copy)
> @@ -165,9 +165,12 @@
> for (parnum = 1; parnum <= __be32_to_cpu(par.pmMapBlkCnt); parnum++) {
> SEEK( bs * parnum );
> READ( &par, sizeof(par) );
> - if( __be16_to_cpu(par.pmSig) != DESC_PART_SIGNATURE ||
> - !__be32_to_cpu(par.pmPartBlkCnt) )
> + if( __be16_to_cpu(par.pmSig) != DESC_PART_SIGNATURE) {
> break;
> + }
> + if ( !__be32_to_cpu(par.pmPartBlkCnt) ) {
> + continue; /* Just a void partition, ignore it. */
> + }
> DPRINTF("found partition type: %s with status %x\n", par.pmPartType,
> __be32_to_cpu(par.pmPartStatus));
>
> Same as my comment for patch 2/10.
>
>
> This was also found through testing although I would assume it is documented. If you have a 10.2 disc (or I would assume most other early Mac OS X discs) lying around you can look at the partition table and see the void partitions.
>
> William Hahne
>
>
> ATB,
>
> Mark.
>
> --
> Mark Cave-Ayland - Senior Technical Architect
> PostgreSQL - PostGIS
> Sirius Corporation plc - control through freedom
> http://www.siriusit.co.uk
> t: +44 870 608 0063
>
> Sirius Labs: http://www.siriusit.co.uk/labs
>
> --
> OpenBIOS http://openbios.org/
> Mailinglist: http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
>
>
>
>
> --
> OpenBIOS http://openbios.org/
> Mailinglist: http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
2
2
On Tue, Aug 23, 2011 at 2:54 PM, Blue Swirl <blauwirbel(a)gmail.com> wrote:
> On Tue, Aug 23, 2011 at 2:45 PM, Stefan Hajnoczi <stefanha(a)gmail.com> wrote:
>> On Tue, Aug 23, 2011 at 3:34 PM, Blue Swirl <blauwirbel(a)gmail.com> wrote:
>>> On Tue, Aug 23, 2011 at 5:35 AM, Stefan Hajnoczi <stefanha(a)gmail.com> wrote:
>>>> On Mon, Aug 22, 2011 at 9:59 PM, Blue Swirl <blauwirbel(a)gmail.com> wrote:
>>>>> On Mon, Aug 22, 2011 at 8:23 PM, Stefan Hajnoczi <stefanha(a)gmail.com> wrote:
>>>>>> On Mon, Aug 22, 2011 at 7:14 PM, Blue Swirl <blauwirbel(a)gmail.com> wrote:
>>>>>>> OpenBIOS uses traditional DPRINTFs for debugging. I was considering
>>>>>>> replacing those with tracepoints, which would output to serial device
>>>>>>> or whatever DPRINTFs are using currently. This would not be extremely
>>>>>>> useful by itself, except maybe that configuration for debugging would
>>>>>>> be concentrated to single 'trace-events' file, but this would not be a
>>>>>>> major improvement over current XML configuration.
>>>>>>>
>>>>>>> But developing this further, maybe OpenBIOS could also pass the
>>>>>>> tracepoint data back to QEMU? Then all tracepoint data would be
>>>>>>> synchronized, coherent and all gathered to single place.
>>>>>>>
>>>>>>> The implementation could be that fw_cfg would be used to pass
>>>>>>> simpletrace style data. An offset should be added to event IDs and
>>>>>>> data would then be output as usual. On OpenBIOS side, the
>>>>>>> implementation would be pretty similar to current QEMU tracepoints but
>>>>>>> in place of file output there would be fw_cfg output.
>>>>>>>
>>>>>>> Syntax for trace-events file should be augmented with include
>>>>>>> directive, so that QEMU knows also OpenBIOS tracepoints. I think the
>>>>>>> only change to simpletrace.py would be to parse this directive.
>>>>>>>
>>>>>>> Controlling OpenBIOS tracepoints from QEMU monitor would be cool too.
>>>>>>>
>>>>>>> Going even further, other targets like kernels could use something
>>>>>>> similar, probably not using fw_cfg though.
>>>>>>>
>>>>>>> What do you think?
>>>>>>
>>>>>> Dhaval showed me a demo of unified host/guest Linux tracing last week.
>>>>>> He is doing something similar except using a hypercall to pass a
>>>>>> string to the host kernel. In his case kvm.ko handles the hypercall
>>>>>> and qemu is not involved.
>>>>>
>>>>> So the events flow directly from guest kernel to host kernel?
>>>>
>>>> Yes.
>>>
>>> How is that used then, with dmesg?
>>
>> When the host processes the trace hypercall it simply forwards the
>> trace event on to host Linux's trace. It currently logs the string
>> from the guest and prefixes it with the guest program counter, I
>> believe. You can dump out the trace using the usual Linux ftrace
>> debugfs files.
>>
>> But the longer term goal, I believe, is to really integrate guest and
>> host tracing so that host userspace (e.g. perf(1)) can pull out trace
>> events from the guest and just sees them tagged as belonging to a
>> particular qemu-kvm process.
>>
>>>
>>>>>> One issue with QEMU tracing is that trace call sites are static. You
>>>>>> need to compile in a trace_*() call, which means that there are two
>>>>>> choices for how to tunnel OpenBIOS trace events:
>>>>>>
>>>>>> 1. Define a tunnel trace event:
>>>>>> openbios_event(uint64_t event_id, uint64_t arg1, uint64_t arg2, ...)
>>>>>>
>>>>>> QEMU only has one trace event to tunnel OpenBIOS trace events. Then
>>>>>> the host is unable to pretty-print OpenBIOS traces automatically and
>>>>>> the max arguments becomes 6 - 1 (for the openbios_event tunnel event
>>>>>> id).
>>>>>>
>>>>>> 2. Generate a switch statement to demultiplex trace events:
>>>>>> void hypercall(uint64_t event_id, uint64_t arg1, ...)
>>>>>> {
>>>>>> /* This is auto-generated by tracetool */
>>>>>> switch (event_id) {
>>>>>> case TRACE_EVENT_OPENBIOS_FOO:
>>>>>> trace_openbios_foo(arg1, arg2, arg3);
>>>>>> break;
>>>>>> case TRACE_EVENT_OPENBIOS_BAR:
>>>>>> trace_openbios_bar(arg1);
>>>>>> break;
>>>>>> ...
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> With this approach the user can toggle trace events at runtime and it
>>>>>> works out much nicer.
>>>>>
>>>>> Maybe I'm missing something, but why would we have to multiplex
>>>>> anything? Since the trace IDs are 64 bits, we can easily allocate a
>>>>> static range (starting from 0x8000000000000000) to non-native events
>>>>> so that QEMU IDs and OpenBIOS IDs do not overlap. QEMU would add this
>>>>> offset to IDs coming from fw_cfg. Then QEMU would just pass the data
>>>>> (8*64 bit words) to tracing back end. There obviously something needs
>>>>> to be changed so that OpenBIOS messages can be generated. For
>>>>> simpletrace this should be easy, for stderr and other back ends that
>>>>> may be more complicated.
>>>>
>>>> I meant that the interface generated by tracetool is a header file
>>>> with trace_*() functions. If you want to support any tracing backend
>>>> then you need to use this interface and cannot call simpletrace.c
>>>> trace0(), trace1(), ... directly.
>>>>
>>>> Are you thinking of only supporting the simple trace backend?
>>>
>>> That would be simplest, then fw_cfg.c (or some intermediate entity)
>>> could just call trace6().
>>>
>>> But stderr would be useful too. I think that could be done by adding
>>> code to read trace-events file to grab the format string. Then a
>>> modified vfprintf would parse it but instead of va_arg(args, type) it
>>> would just grab the uint64_t arg. Your approach would be much simpler.
>>
>> I see. I think we should avoid introducing dependencies on specific
>> trace backends, so I would go for the generated switch statement
>> above. That way you can even use DTrace/SystemTap or other backends.
>> Also if we called traceX() directly we'd have to duplicate the logic
>> to check whether the trace event is enabled/disabled, so it becomes a
>> bit messy.
>
> I see. I'll try the switch approach then.
Here's a work in progress version for the guest tracepoints. Both QEMU
and OpenBIOS compile (stderr and simpletrace backends), but because of
the recent breakage, I couldn't test the patches. At least the event
from OpenBIOS is visible to QEMU monitor:
esp_do_command [Event ID 322] : state 1
QEMU must be configured with
'--with-guest-trace-file=/src/openbios-devel/trace-events'.
There's some danger of namespace collisions. One way to avoid those
would be that the event names could be prefixed, with prefix given
during configure time.
1
0
On Tue, Aug 23, 2011 at 2:45 PM, Stefan Hajnoczi <stefanha(a)gmail.com> wrote:
> On Tue, Aug 23, 2011 at 3:34 PM, Blue Swirl <blauwirbel(a)gmail.com> wrote:
>> On Tue, Aug 23, 2011 at 5:35 AM, Stefan Hajnoczi <stefanha(a)gmail.com> wrote:
>>> On Mon, Aug 22, 2011 at 9:59 PM, Blue Swirl <blauwirbel(a)gmail.com> wrote:
>>>> On Mon, Aug 22, 2011 at 8:23 PM, Stefan Hajnoczi <stefanha(a)gmail.com> wrote:
>>>>> On Mon, Aug 22, 2011 at 7:14 PM, Blue Swirl <blauwirbel(a)gmail.com> wrote:
>>>>>> OpenBIOS uses traditional DPRINTFs for debugging. I was considering
>>>>>> replacing those with tracepoints, which would output to serial device
>>>>>> or whatever DPRINTFs are using currently. This would not be extremely
>>>>>> useful by itself, except maybe that configuration for debugging would
>>>>>> be concentrated to single 'trace-events' file, but this would not be a
>>>>>> major improvement over current XML configuration.
>>>>>>
>>>>>> But developing this further, maybe OpenBIOS could also pass the
>>>>>> tracepoint data back to QEMU? Then all tracepoint data would be
>>>>>> synchronized, coherent and all gathered to single place.
>>>>>>
>>>>>> The implementation could be that fw_cfg would be used to pass
>>>>>> simpletrace style data. An offset should be added to event IDs and
>>>>>> data would then be output as usual. On OpenBIOS side, the
>>>>>> implementation would be pretty similar to current QEMU tracepoints but
>>>>>> in place of file output there would be fw_cfg output.
>>>>>>
>>>>>> Syntax for trace-events file should be augmented with include
>>>>>> directive, so that QEMU knows also OpenBIOS tracepoints. I think the
>>>>>> only change to simpletrace.py would be to parse this directive.
>>>>>>
>>>>>> Controlling OpenBIOS tracepoints from QEMU monitor would be cool too.
>>>>>>
>>>>>> Going even further, other targets like kernels could use something
>>>>>> similar, probably not using fw_cfg though.
>>>>>>
>>>>>> What do you think?
>>>>>
>>>>> Dhaval showed me a demo of unified host/guest Linux tracing last week.
>>>>> He is doing something similar except using a hypercall to pass a
>>>>> string to the host kernel. In his case kvm.ko handles the hypercall
>>>>> and qemu is not involved.
>>>>
>>>> So the events flow directly from guest kernel to host kernel?
>>>
>>> Yes.
>>
>> How is that used then, with dmesg?
>
> When the host processes the trace hypercall it simply forwards the
> trace event on to host Linux's trace. It currently logs the string
> from the guest and prefixes it with the guest program counter, I
> believe. You can dump out the trace using the usual Linux ftrace
> debugfs files.
>
> But the longer term goal, I believe, is to really integrate guest and
> host tracing so that host userspace (e.g. perf(1)) can pull out trace
> events from the guest and just sees them tagged as belonging to a
> particular qemu-kvm process.
>
>>
>>>>> One issue with QEMU tracing is that trace call sites are static. You
>>>>> need to compile in a trace_*() call, which means that there are two
>>>>> choices for how to tunnel OpenBIOS trace events:
>>>>>
>>>>> 1. Define a tunnel trace event:
>>>>> openbios_event(uint64_t event_id, uint64_t arg1, uint64_t arg2, ...)
>>>>>
>>>>> QEMU only has one trace event to tunnel OpenBIOS trace events. Then
>>>>> the host is unable to pretty-print OpenBIOS traces automatically and
>>>>> the max arguments becomes 6 - 1 (for the openbios_event tunnel event
>>>>> id).
>>>>>
>>>>> 2. Generate a switch statement to demultiplex trace events:
>>>>> void hypercall(uint64_t event_id, uint64_t arg1, ...)
>>>>> {
>>>>> /* This is auto-generated by tracetool */
>>>>> switch (event_id) {
>>>>> case TRACE_EVENT_OPENBIOS_FOO:
>>>>> trace_openbios_foo(arg1, arg2, arg3);
>>>>> break;
>>>>> case TRACE_EVENT_OPENBIOS_BAR:
>>>>> trace_openbios_bar(arg1);
>>>>> break;
>>>>> ...
>>>>> }
>>>>> }
>>>>>
>>>>> With this approach the user can toggle trace events at runtime and it
>>>>> works out much nicer.
>>>>
>>>> Maybe I'm missing something, but why would we have to multiplex
>>>> anything? Since the trace IDs are 64 bits, we can easily allocate a
>>>> static range (starting from 0x8000000000000000) to non-native events
>>>> so that QEMU IDs and OpenBIOS IDs do not overlap. QEMU would add this
>>>> offset to IDs coming from fw_cfg. Then QEMU would just pass the data
>>>> (8*64 bit words) to tracing back end. There obviously something needs
>>>> to be changed so that OpenBIOS messages can be generated. For
>>>> simpletrace this should be easy, for stderr and other back ends that
>>>> may be more complicated.
>>>
>>> I meant that the interface generated by tracetool is a header file
>>> with trace_*() functions. If you want to support any tracing backend
>>> then you need to use this interface and cannot call simpletrace.c
>>> trace0(), trace1(), ... directly.
>>>
>>> Are you thinking of only supporting the simple trace backend?
>>
>> That would be simplest, then fw_cfg.c (or some intermediate entity)
>> could just call trace6().
>>
>> But stderr would be useful too. I think that could be done by adding
>> code to read trace-events file to grab the format string. Then a
>> modified vfprintf would parse it but instead of va_arg(args, type) it
>> would just grab the uint64_t arg. Your approach would be much simpler.
>
> I see. I think we should avoid introducing dependencies on specific
> trace backends, so I would go for the generated switch statement
> above. That way you can even use DTrace/SystemTap or other backends.
> Also if we called traceX() directly we'd have to duplicate the logic
> to check whether the trace event is enabled/disabled, so it becomes a
> bit messy.
I see. I'll try the switch approach then.
1
0