> John planned to release by tomorrow. If you want this change
> in oprofile 0.5 send your patch quickly please else the 0.5
> tarball will be broken for ppc. Previous message in this thread
> show how we handled it for parisc.
Here is my current patch:
- Add lookup_dcookie syscall number for ppc32/ppc64
- Fix lookup_dcookie on ppc32. The ABI passes long longs as an odd even
register pair. When we call syscall() the long long cookie ends
up in registers r5 and r6 (with r4 being empty). The syscall() function
simply shifts r4-r8 down by one, leaving cookie in r4 and r5. To fix
this we pass it in as two longs.
- Pad 32bit addresses to 64bit when printing. We arent going to want this
on x86 but it makes the output on ppc64 nicer.
- Your patch for op_to_source
- Fix op_start and opcontrol to handle ppc64 kernels. The start address
in System.map is different
- Fix opcontrol to handle 64bit kernel offsets. Im not sure
why opcontrol was using perl where op_start just parsed it with
grep/cut.
Anton
diff -ru oprofile/daemon/opd_cookie.h oprofile_work2/daemon/opd_cookie.h
--- oprofile/daemon/opd_cookie.h 2003-01-19 03:12:35.000000000 +1100
+++ oprofile_work2/daemon/opd_cookie.h 2003-01-28 10:41:32.000000000 +1100
@@ -19,13 +19,23 @@
#define opd_nr_lookup_dcookie 253
#elif defined(__alpha__)
#define opd_nr_lookup_dcookie 406
+#elif defined(__powerpc__)
+#define opd_nr_lookup_dcookie 235
#else
#error Please define lookup_dcookie for your architecture
#endif
+#if defined(__powerpc__) && !defined(__powerpc64__)
+static int lookup_dcookie(u_int64_t cookie, char * buf, size_t size)
+{
+ return syscall(opd_nr_lookup_dcookie, (unsigned long)(cookie >> 32),
+ (unsigned long)(cookie & 0xffffffff), buf, size);
+}
+#else
static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
{
return syscall(opd_nr_lookup_dcookie, cookie, buf, size);
}
+#endif
#endif /* OPD_COOKIE_H */
diff -ru oprofile/pp/format_output.cpp oprofile_work2/pp/format_output.cpp
--- oprofile/pp/format_output.cpp 2002-12-15 03:39:29.000000000 +1100
+++ oprofile_work2/pp/format_output.cpp 2003-01-28 10:42:02.000000000 +1100
@@ -332,7 +332,7 @@
{
ostringstream out;
- out << hex << setw(8) << setfill('0') << f.sample.vma;
+ out << hex << setw(16) << setfill('0') << f.sample.vma;
return out.str();
}
diff -ru oprofile/pp/op_to_source.cpp oprofile_work2/pp/op_to_source.cpp
--- oprofile/pp/op_to_source.cpp 2002-12-15 03:39:29.000000000 +1100
+++ oprofile_work2/pp/op_to_source.cpp 2003-01-28 23:52:01.000000000 +1100
@@ -819,8 +819,9 @@
// do not use the bfd equivalent:
// - it does not skip space at begin
// - we does not need cross architecture compile so the native
- // strtoul must work (assuming unsigned long can contain a vma)
- bfd_vma vma = strtoul(str_vma.c_str(), NULL, 16);
+ // strtoull must work, assuming unsigned long long can contain a vma
+ // and on 32/64 bits box bfd_vma is 64 bits
+ bfd_vma vma = strtoull(str_vma.c_str(), NULL, 16);
return samples->find_symbol(vma);
}
@@ -844,8 +845,9 @@
// do not use the bfd equivalent:
// - it does not skip space at begin
// - we does not need cross architecture compile so the native
- // strtoul must work (assuming unsigned long can contain a vma)
- bfd_vma vma = strtoul(str.c_str(), NULL, 16);
+ // strtoull must work, assuming unsigned long long can contain a vma
+ // and on 32/64 bits box bfd_vma is 64 bits
+ bfd_vma vma = strtoull(str.c_str(), NULL, 16);
sample_entry const * sample = samples->find_sample(vma);
if (sample) {
diff -ru oprofile/utils/op_start_25 oprofile_work2/utils/op_start_25
--- oprofile/utils/op_start_25 2002-12-03 14:53:44.000000000 +1100
+++ oprofile_work2/utils/op_start_25 2003-01-30 14:00:14.000000000 +1100
@@ -141,6 +141,10 @@
return;
fi
tmp1=`nm $VMLINUX | grep ' A _text'`
+ # match start of kernel on ppc64
+ if test -z "$tmp1"; then
+ tmp1=`nm $VMLINUX | grep ' T _stext'`
+ fi
tmp2=`nm $VMLINUX | grep ' A _end'`
if test -z "$tmp1" -o -z "$tmp2"; then
echo "Couldn't determine kernel start/end" >&2
diff -ru oprofile/utils/opcontrol oprofile_work2/utils/opcontrol
--- oprofile/utils/opcontrol 2003-01-15 23:19:21.000000000 +1100
+++ oprofile_work2/utils/opcontrol 2003-01-30 14:01:36.000000000 +1100
@@ -326,9 +326,15 @@
if test ! -z "$KERNEL_RANGE"; then
return;
fi
- range_info=`objdump -h $VMLINUX | grep ".text "`
- tmp1=`perl -le '($a, $b, $c, $d) = @ARGV; printf "%x\n", (hex($d))' $range_info`
- tmp2=`perl -le '($a, $b, $c, $d) = @ARGV; printf "%x\n", (hex($c) + hex($d))' $range_info`
+
+ tmp1=`nm $VMLINUX | grep ' A _text'`
+ # match start of kernel on ppc64
+ if test -z "$tmp1"; then
+ tmp1=`nm $VMLINUX | grep ' T _stext'`
+ fi
+ tmp2=`nm $VMLINUX | grep ' A _end'`
+ tmp1=`echo $tmp1 | cut -d" " -f 1`
+ tmp2=`echo $tmp2 | cut -d" " -f 1`
if test -z "$tmp1" -o -z "$tmp2"; then
echo "Couldn't determine kernel start/end" >&2
|