diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build/mk/OptionalObsoleteFiles.inc | 2 | ||||
-rw-r--r-- | tools/regression/README | 1 | ||||
-rw-r--r-- | tools/regression/filemon/Makefile | 2 | ||||
-rw-r--r-- | tools/regression/ia64/emulated/brl.t | 99 | ||||
-rw-r--r-- | tools/regression/ia64/emulated/test.c | 172 | ||||
-rw-r--r-- | tools/regression/ia64/unaligned/test.c | 204 | ||||
-rw-r--r-- | tools/regression/ia64/unaligned/unaligned.t | 99 | ||||
-rw-r--r-- | tools/tools/gdb_regofs/ia64.c | 213 |
8 files changed, 1 insertions, 791 deletions
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 69543e6..8259b2b 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -1283,8 +1283,6 @@ OLD_FILES+=usr/include/gcc/4.2/pmmintrin.h OLD_FILES+=usr/include/gcc/4.2/tmmintrin.h OLD_FILES+=usr/include/gcc/4.2/wmmintrin.h OLD_FILES+=usr/include/gcc/4.2/xmmintrin.h -.elif ${TARGET_ARCH} == "ia64" -OLD_FILES+=usr/include/gcc/4.2/ia64intrin.h .elif ${TARGET_ARCH} == "arm" OLD_FILES+=usr/include/gcc/4.2/mmintrin.h .elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64" diff --git a/tools/regression/README b/tools/regression/README index 87e4ab3..a2de372 100644 --- a/tools/regression/README +++ b/tools/regression/README @@ -77,7 +77,6 @@ this file. acct Exercise the integer to float conversion used in acct(5) geom Some tests and an out-of-kernel simulator for the GEOM code -ia64 ia64 specific regression tests nfsmmap Some tests to exercise some tricky cases in NFS and mmap p1003_1b Exercise 1003.1B scheduler pipe Pipe code regression test diff --git a/tools/regression/filemon/Makefile b/tools/regression/filemon/Makefile index 6ee88f4..3911d33 100644 --- a/tools/regression/filemon/Makefile +++ b/tools/regression/filemon/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" +.if ${MACHINE_ARCH} == "amd64" BI_BITS= .endif diff --git a/tools/regression/ia64/emulated/brl.t b/tools/regression/ia64/emulated/brl.t deleted file mode 100644 index c47989c..0000000 --- a/tools/regression/ia64/emulated/brl.t +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env perl -w -# -# Copyright (c) 2006 Marcel Moolenaar -# 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 THE AUTHOR 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$ - -my $srcdir = `dirname $0`; -chomp $srcdir; - -my @types = ("Call", "Cond"); -my @preds = ("False", "True"); -my %variant_mapping = ( - "Call" => "", - "Cond" => "Backward Forward" -); - -sub run ($$$$) { - local ($nr, $type, $pred, $var) = @_; - local $test = "${type}_${pred}_${var}"; - local $tmpfile = "/tmp/" . $$ . "_$test"; - local $st; - - $st = system("cc -o $tmpfile -DTYPE=$type -DPRED=$pred -DVAR=$var -Wall -O1 -g $srcdir/test.c"); - if ($st != 0) { - print "not ok $nr $test # compiling $test\n"; - } - else { - $st = system($tmpfile); - if ($st == 0) { - print "ok $nr $test\n"; - } - elsif ($st == 256) { - print "not ok $nr $test # invalid combination\n"; - } - elsif ($st == 512) { - print "not ok $nr $test # long branch failure\n"; - } - else { - print "not ok $nr $test # signalled (exit status $st)\n"; - return; # Preserve the executable - } - } - unlink $tmpfile; -} - -# -# We can only test the long brach emulation on the Merced processor. -# Check for that and skip these tests if it's not... -# -$_ = `sysctl -n hw.model`; -if (! /^Merced$/) { - print "1..0 # SKIP This test can only be run on the Merced\n"; - exit 0; -} - -# -# Get the total number of tests we're going to perform. -# -my $count = 0; -foreach $type (@types) { - my @variants = split(/ /, $variant_mapping{$type}); - $count += @preds * @variants; -} - -print "1..$count\n"; - -my $nr=0; -foreach $type (@types) { - my @variants = split(/ /, $variant_mapping{$type}); - foreach $pred (@preds) { - foreach $var (@variants) { - run ++$nr, $type, $pred, $var; - } - } -} - -exit 0; diff --git a/tools/regression/ia64/emulated/test.c b/tools/regression/ia64/emulated/test.c deleted file mode 100644 index 35d4b05..0000000 --- a/tools/regression/ia64/emulated/test.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2006 Marcel Moolenaar - * 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 THE AUTHOR 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 <sys/mman.h> -#include <stdio.h> -#include <string.h> - -/* Supported long branch types */ -#define Call 1 -#define Cond 2 - -/* Supported predicates */ -#define False 1 -#define True 2 - -/* Supported variations */ -#define Backward 1 -#define Forward 2 - -#if TYPE == 0 || PRED == 0 || VAR == 0 -#error Define TYPE, PRED and/or VAR -#endif - -union bundle { - unsigned char bytes[16]; - long double _align; -}; - -/* - * Machine code of a bundle containing a long branch. The predicate of the - * long branch is the result of the compare in the first slot. - * The assembly of the bundle is: - * { .mlx - * cmp.eq p0,p15= <PREDICATE>,r0 - * (p15) brl.few <TARGET> ;; - * } - * the predicate is written to bit 18:1 - * The branch target is written to bits 100:20, 48:39 and 123:1 - */ -unsigned char mc_brl_cond[16] = { - 0x05, 0x00, 0x00, 0x00, 0x0f, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, - 0x00, 0x00, 0x00, 0xc0 -}; - -/* - * Machine code of the epilogue of a typical function returning an integer. - * The assembly of the epilogue is: - * { .mib - * nop.m 0 - * addl r8 = <RETVAL>, r0 - * br.ret.sptk.few b0 ;; - * } - * The return value is written to bits 59:7, 73:9, 68:5, and 82:1. - */ -unsigned char mc_epilogue[16] = { - 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x48, 0x80, - 0x00, 0x00, 0x84, 0x00 -}; - -void -mc_patch(union bundle *b, unsigned long val, int start, int len) -{ - unsigned long mask; - int bit, byte, run; - - byte = start >> 3; - bit = start & 7; - while (len) { - run = ((len > (8 - bit)) ? (8 - bit) : len); - mask = (1UL << run) - 1UL; - b->bytes[byte] |= (val & mask) << bit; - val >>= run; - len -= run; - byte++; - bit = 0; - } -} - -void -assemble_brl_cond(union bundle *b, int pred, unsigned long tgt) -{ - unsigned long iprel; - - iprel = tgt - (unsigned long)b; - memcpy(b->bytes, mc_brl_cond, sizeof(mc_brl_cond)); - mc_patch(b, pred ? 1 : 0, 18, 1); - mc_patch(b, iprel >> 4, 100, 20); - mc_patch(b, iprel >> 24, 48, 39); - mc_patch(b, iprel >> 63, 123, 1); -} - -void -assemble_epilogue(union bundle *b, int retval) -{ - memcpy(b->bytes, mc_epilogue, sizeof(mc_epilogue)); - mc_patch(b, retval, 59, 7); - mc_patch(b, retval >> 7, 73, 9); - mc_patch(b, retval >> 16, 68, 5); - mc_patch(b, retval >> 21, 82, 1); -} - -int -doit(void *addr) -{ - asm("mov b6 = %0; br.sptk b6;;" :: "r"(addr)); - return 1; -} - -int -test_cond(int pred, union bundle *src, union bundle *dst) -{ - assemble_epilogue(dst, pred ? 0 : 2); - assemble_brl_cond(src, pred ? 1 : 0, (unsigned long)dst); - assemble_epilogue(src + 1, !pred ? 0 : 2); - return doit(src); -} - -int -main() -{ - static union bundle blob_low[2]; - union bundle *blob_high; - void *addr; - - addr = (void *)0x7FFFFFFF00000000L; - blob_high = mmap(addr, 32, PROT_EXEC | PROT_READ | PROT_WRITE, - MAP_ANON, -1, 0L); - if (blob_high != addr) - printf("NOTICE: blob_high is at %p, not at %p\n", blob_high, - addr); - -#if TYPE == Call - return (test_call(blob_high, blob_low)); -#elif TYPE == Cond - #if VAR == Forward - return (test_cond(PRED - 1, blob_low, blob_high)); - #elif VAR == Backward - return (test_cond(PRED - 1, blob_high, blob_low)); - #else - return (1); - #endif -#else - return (1); -#endif -} diff --git a/tools/regression/ia64/unaligned/test.c b/tools/regression/ia64/unaligned/test.c deleted file mode 100644 index 869c864..0000000 --- a/tools/regression/ia64/unaligned/test.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2005 Marcel Moolenaar - * 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 THE AUTHOR 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 <machine/float.h> -#include <string.h> - -/* Memory accesses. */ -#define Load 0x01 -#define Store 0x02 - -/* Data type. */ -#define Integer 0x11 -#define FloatingPoint 0x12 - -/* Data size. */ -#define Small 0x21 -#define Medium 0x22 -#define Large 0x23 - -/* Post increment. */ -#define NoPostInc 0x31 -#define MinConstPostInc 0x32 -#define PlusConstPostInc 0x33 -#define ScratchRegPostInc 0x34 -#define PreservedRegPostInc 0x35 - -#if ACCESS == 0 || TYPE == 0 || SIZE == 0 || POSTINC == 0 -#error define ACCESS, TYPE, SIZE and/or POSTINC -#endif - -#if TYPE == Integer -# define REG "r8" -# if SIZE == Small -# define DATA_TYPE short -# define DATA_VALUE 0x1234 -# define LD "ld2" -# define ST "st2" -# elif SIZE == Medium -# define DATA_TYPE int -# define DATA_VALUE 0x12345678 -# define LD "ld4" -# define ST "st4" -# elif SIZE == Large -# define DATA_TYPE long -# define DATA_VALUE 0x1234567890ABCDEF -# define LD "ld8" -# define ST "st8" -# endif -#elif TYPE == FloatingPoint -# define REG "f6" -# if SIZE == Small -# define DATA_TYPE float -# define DATA_VALUE FLT_MIN -# define LD "ldfs" -# define ST "stfs" -# elif SIZE == Medium -# define DATA_TYPE double -# define DATA_VALUE DBL_MIN -# define LD "ldfd" -# define ST "stfd" -# elif SIZE == Large -# define DATA_TYPE long double -# define DATA_VALUE LDBL_MIN -# define LD "ldfe" -# define ST "stfe" -# endif -#endif - -struct { - DATA_TYPE aligned; - char _; - char misaligned[sizeof(DATA_TYPE)]; -} data; - -DATA_TYPE *aligned = &data.aligned; -DATA_TYPE *misaligned = (DATA_TYPE *)data.misaligned; -DATA_TYPE value = DATA_VALUE; - -void -block_copy(void *dst, void *src, size_t sz) -{ - - memcpy(dst, src, sz); -} - -int -main() -{ - - /* Set PSR.ac. */ - asm volatile("sum 8"); - -#if ACCESS == Load - /* - * LOAD - */ - block_copy(misaligned, &value, sizeof(DATA_TYPE)); - -# if POSTINC == NoPostInc - /* Misaligned load. */ - *aligned = *misaligned; -# elif POSTINC == MinConstPostInc - asm volatile( - "ld8 r2=%0;;" - LD " " REG "=[r2],%2;;" - "st8 %0=r2;" ST " %1=" REG ";;" - : "=m"(misaligned), "=m"(*aligned) - : "i"(-sizeof(DATA_TYPE)) - : REG, "r2", "memory"); -# elif POSTINC == PlusConstPostInc - asm volatile( - "ld8 r2=%0;;" - LD " " REG "=[r2],%2;;" - "st8 %0=r2;" ST " %1=" REG ";;" - : "=m"(misaligned), "=m"(*aligned) - : "i"(sizeof(DATA_TYPE)) - : REG, "r2", "memory"); -# elif POSTINC == ScratchRegPostInc - asm volatile( - "ld8 r2=%0; mov r3=%2;;" - LD " " REG "=[r2],r3;;" - "st8 %0=r2;" ST " %1=" REG ";;" - : "=m"(misaligned), "=m"(*aligned) - : "i"(sizeof(DATA_TYPE)) - : REG, "r2", "r3", "memory"); -# elif POSTINC == PreservedRegPostInc - asm volatile( - "ld8 r2=%0; mov r4=%2;;" - LD " " REG "=[r2],r4;;" - "st8 %0=r2;" ST " %1=" REG ";;" - : "=m"(misaligned), "=m"(*aligned) - : "i"(sizeof(DATA_TYPE)) - : REG, "r2", "r4", "memory"); -# endif - -#elif ACCESS == Store - /* - * STORE - */ - -# if POSTINC == NoPostInc - /* Misaligned store. */ - *misaligned = value; -# elif POSTINC == MinConstPostInc - asm volatile( - "ld8 r2=%0;" LD " " REG "=%1;;" - ST " [r2]=" REG ",%2;;" - "st8 %0=r2;;" - : "=m"(misaligned) - : "m"(value), "i"(-sizeof(DATA_TYPE)) - : REG, "r2", "memory"); -# elif POSTINC == PlusConstPostInc - asm volatile( - "ld8 r2=%0;" LD " " REG "=%1;;" - ST " [r2]=" REG ",%2;;" - "st8 %0=r2;;" - : "=m"(misaligned) - : "m"(value), "i"(sizeof(DATA_TYPE)) - : REG, "r2", "memory"); -# elif POSTINC == ScratchRegPostInc || POSTINC == PreservedRegPostInc - return (1); -# endif - - block_copy(aligned, data.misaligned, sizeof(DATA_TYPE)); -#endif - - if (*aligned != value) - return (2); - -#if POSTINC == NoPostInc - return (0); -#elif POSTINC == MinConstPostInc - return (((char *)misaligned == data.misaligned - sizeof(DATA_TYPE)) - ? 0 : 4); -#else - return (((char *)misaligned == data.misaligned + sizeof(DATA_TYPE)) - ? 0 : 4); -#endif -} diff --git a/tools/regression/ia64/unaligned/unaligned.t b/tools/regression/ia64/unaligned/unaligned.t deleted file mode 100644 index 5d061bd..0000000 --- a/tools/regression/ia64/unaligned/unaligned.t +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env perl -w -# -# Copyright (c) 2005 Marcel Moolenaar -# 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 THE AUTHOR 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$ - -my $srcdir = `dirname $0`; -chomp $srcdir; - -my @accesses = ("Load", "Store"); -my @types = ("Integer", "FloatingPoint"); -my @sizes = ("Small", "Medium", "Large"); -my @postincs = ("NoPostInc", "MinConstPostInc", "PlusConstPostInc", - "ScratchRegPostInc", "PreservedRegPostInc"); - -sub run ($$$$$) { - local ($nr, $access, $type, $size, $postinc) = @_; - local $test = "${access}_${type}_${size}_${postinc}"; - local $tmpfile = "/tmp/" . $$ . "_$test"; - local $st; - - $st = system("cc -o $tmpfile -DACCESS=$access -DTYPE=$type -DSIZE=$size -DPOSTINC=$postinc -Wall -O -g $srcdir/test.c"); - if ($st != 0) { - print "not ok $nr $test # compiling $test\n"; - } - else { - $st = system($tmpfile); - if ($st == 0) { - print "ok $nr $test\n"; - } - elsif ($st == 256) { - print "not ok $nr $test # invalid combination\n"; - } - elsif ($st == 512) { - print "not ok $nr $test # value mismatch\n"; - } - elsif ($st == 1024) { - print "not ok $nr $test # post increment mismatch\n"; - } - else { - print "not ok $nr $test # signalled (exit status $st)\n"; - return; # Preserve the executable - } - } - unlink $tmpfile; -} - -system("sysctl debug.unaligned_test=1"); -if (`sysctl -n debug.unaligned_test` != "1") { - print "1..0 # SKIP The debug.unaligned_test sysctl could not be set\n"; - exit 0; -} - -my $count = @accesses * @types * @sizes * @postincs; - -# There's no register based post inc. for stores. -$count -= 12; - -print "1..$count\n"; - -my $nr=0; -foreach $access (@accesses) { - foreach $postinc (@postincs) { - $_ = "$access $postinc"; - if (! /Store.+RegPostInc/) { - foreach $type (@types) { - foreach $size (@sizes) { - run ++$nr, $access, $type, $size, $postinc; - } - } - } - } -} - -system("sysctl debug.unaligned_test=0"); - -exit 0; diff --git a/tools/tools/gdb_regofs/ia64.c b/tools/tools/gdb_regofs/ia64.c deleted file mode 100644 index 59e0055..0000000 --- a/tools/tools/gdb_regofs/ia64.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2004 Marcel Moolenaar - * 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 THE AUTHOR 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 <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stddef.h> -#include <machine/reg.h> - -#define PRESERVED(x) offsetof(struct reg, r_preserved) \ - + offsetof(struct _callee_saved, x) -#define SCRATCH(x) offsetof(struct reg, r_scratch) \ - + offsetof(struct _caller_saved, x) -#define SPECIAL(x) offsetof(struct reg, r_special) \ - + offsetof(struct _special, x) - -#define HIGH_FP(x) offsetof(struct fpreg, fpr_high) \ - + offsetof(struct _high_fp, x) -#define PRESERVED_FP(x) offsetof(struct fpreg, fpr_preserved) \ - + offsetof(struct _callee_saved_fp, x) -#define SCRATCH_FP(x) offsetof(struct fpreg, fpr_scratch) \ - + offsetof(struct _caller_saved_fp, x) - -static int regofs[] = { - /* - * General registers (0-127) - */ - -1, /* gr0 */ - SPECIAL(gp), - SCRATCH(gr2), SCRATCH(gr3), - PRESERVED(gr4), PRESERVED(gr5), PRESERVED(gr6), PRESERVED(gr7), - SCRATCH(gr8), SCRATCH(gr9), SCRATCH(gr10), SCRATCH(gr11), - SPECIAL(sp), SPECIAL(tp), - SCRATCH(gr14), SCRATCH(gr15), SCRATCH(gr16), SCRATCH(gr17), - SCRATCH(gr18), SCRATCH(gr19), SCRATCH(gr20), SCRATCH(gr21), - SCRATCH(gr22), SCRATCH(gr23), SCRATCH(gr24), SCRATCH(gr25), - SCRATCH(gr26), SCRATCH(gr27), SCRATCH(gr28), SCRATCH(gr29), - SCRATCH(gr30), SCRATCH(gr31), - /* - * gr32 through gr127 are not directly available as they are - * stacked registers. - */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr32-gr39 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr40-gr47 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr48-gr55 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr56-gr63 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr64-gr71 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr72-gr79 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr80-gr87 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr88-gr95 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr96-gr103 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr104-gr111 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr112-gr119 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* gr120-gr127 */ - /* - * Floating-point registers (128-255) - */ - -1, /* fr0: constant 0.0 */ - -1, /* fr1: constant 1.0 */ - PRESERVED_FP(fr2), PRESERVED_FP(fr3), - PRESERVED_FP(fr4), PRESERVED_FP(fr5), - SCRATCH_FP(fr6), SCRATCH_FP(fr7), - SCRATCH_FP(fr8), SCRATCH_FP(fr9), - SCRATCH_FP(fr10), SCRATCH_FP(fr11), - SCRATCH_FP(fr12), SCRATCH_FP(fr13), - SCRATCH_FP(fr14), SCRATCH_FP(fr15), - PRESERVED_FP(fr16), PRESERVED_FP(fr17), - PRESERVED_FP(fr18), PRESERVED_FP(fr19), - PRESERVED_FP(fr20), PRESERVED_FP(fr21), - PRESERVED_FP(fr22), PRESERVED_FP(fr23), - PRESERVED_FP(fr24), PRESERVED_FP(fr25), - PRESERVED_FP(fr26), PRESERVED_FP(fr27), - PRESERVED_FP(fr28), PRESERVED_FP(fr29), - PRESERVED_FP(fr30), PRESERVED_FP(fr31), - HIGH_FP(fr32), HIGH_FP(fr33), HIGH_FP(fr34), HIGH_FP(fr35), - HIGH_FP(fr36), HIGH_FP(fr37), HIGH_FP(fr38), HIGH_FP(fr39), - HIGH_FP(fr40), HIGH_FP(fr41), HIGH_FP(fr42), HIGH_FP(fr43), - HIGH_FP(fr44), HIGH_FP(fr45), HIGH_FP(fr46), HIGH_FP(fr47), - HIGH_FP(fr48), HIGH_FP(fr49), HIGH_FP(fr50), HIGH_FP(fr51), - HIGH_FP(fr52), HIGH_FP(fr53), HIGH_FP(fr54), HIGH_FP(fr55), - HIGH_FP(fr56), HIGH_FP(fr57), HIGH_FP(fr58), HIGH_FP(fr59), - HIGH_FP(fr60), HIGH_FP(fr61), HIGH_FP(fr62), HIGH_FP(fr63), - HIGH_FP(fr64), HIGH_FP(fr65), HIGH_FP(fr66), HIGH_FP(fr67), - HIGH_FP(fr68), HIGH_FP(fr69), HIGH_FP(fr70), HIGH_FP(fr71), - HIGH_FP(fr72), HIGH_FP(fr73), HIGH_FP(fr74), HIGH_FP(fr75), - HIGH_FP(fr76), HIGH_FP(fr77), HIGH_FP(fr78), HIGH_FP(fr79), - HIGH_FP(fr80), HIGH_FP(fr81), HIGH_FP(fr82), HIGH_FP(fr83), - HIGH_FP(fr84), HIGH_FP(fr85), HIGH_FP(fr86), HIGH_FP(fr87), - HIGH_FP(fr88), HIGH_FP(fr89), HIGH_FP(fr90), HIGH_FP(fr91), - HIGH_FP(fr92), HIGH_FP(fr93), HIGH_FP(fr94), HIGH_FP(fr95), - HIGH_FP(fr96), HIGH_FP(fr97), HIGH_FP(fr98), HIGH_FP(fr99), - HIGH_FP(fr100), HIGH_FP(fr101), HIGH_FP(fr102), HIGH_FP(fr103), - HIGH_FP(fr104), HIGH_FP(fr105), HIGH_FP(fr106), HIGH_FP(fr107), - HIGH_FP(fr108), HIGH_FP(fr109), HIGH_FP(fr110), HIGH_FP(fr111), - HIGH_FP(fr112), HIGH_FP(fr113), HIGH_FP(fr114), HIGH_FP(fr115), - HIGH_FP(fr116), HIGH_FP(fr117), HIGH_FP(fr118), HIGH_FP(fr119), - HIGH_FP(fr120), HIGH_FP(fr121), HIGH_FP(fr122), HIGH_FP(fr123), - HIGH_FP(fr124), HIGH_FP(fr125), HIGH_FP(fr126), HIGH_FP(fr127), - /* - * Predicate registers (256-319) - * These are not individually available. Predicates are - * in the pr register. - */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr0-pr7 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr8-pr15 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr16-pr23 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr24-pr31 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr32-pr39 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr40-pr47 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr48-pr55 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* pr56-pr63 */ - /* - * Branch registers (320-327) - */ - SPECIAL(rp), - PRESERVED(br1), PRESERVED(br2), PRESERVED(br3), PRESERVED(br4), - PRESERVED(br5), - SCRATCH(br6), SCRATCH(br7), - /* - * Misc other registers (328-333) - */ - -1, -1, - SPECIAL(pr), - SPECIAL(iip), - SPECIAL(psr), - SPECIAL(cfm), - /* - * Application registers (334-461) - */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar.k0-ar.k7 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar8-ar15 (reserved) */ - SPECIAL(rsc), /* ar.rsc */ - SPECIAL(ndirty), /* ar.bsp !!YEDI!! */ - SPECIAL(bspstore), /* ar.bspstore */ - SPECIAL(rnat), /* ar.rnat */ - -1, /* ar20 (reserved) */ - -1, /* ar.fcr */ - -1, -1, /* ar22-ar23 (reserved) */ - -1, /* ar.eflag */ - SCRATCH(csd), /* ar.csd */ - SCRATCH(ssd), /* ar.ssd */ - -1, /* ar.cflg */ - -1, /* ar.fsr */ - -1, /* ar.fir */ - -1, /* ar.fdr */ - -1, /* ar31 (reserved) */ - SCRATCH(ccv), /* ar.ccv */ - -1, -1, -1, /* ar33-ar35 (reserved) */ - SPECIAL(unat), /* ar.unat */ - -1, -1, -1, /* ar37-ar39 (reserved) */ - SPECIAL(fpsr), /* ar.fpsr */ - -1, -1, -1, /* ar41-ar43 (reserved) */ - -1, /* ar.itc */ - -1, -1, -1, /* ar45-ar47 (reserved) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar48-ar55 (ignored) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar56-ar63 (ignored) */ - SPECIAL(pfs), /* ar.pfs */ - PRESERVED(lc), /* ar.lc */ - -1, /* ar.ec */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar67-ar74 (reserved) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar75-ar82 (reserved) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar83-ar90 (reserved) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar91-ar98 (reserved) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar99-ar106 (reserved) */ - -1, -1, -1, -1, -1, /* ar107-ar111 (reserved) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar112-ar119 (ignored) */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ar120-ar127 (ignored) */ -}; - -int -main() -{ - int elem, nelems; - - nelems = sizeof(regofs)/sizeof(regofs[0]); - printf("static int reg_offset[%d] = {", nelems); - for (elem = 0; elem < nelems; elem++) { - if ((elem & 7) == 0) - printf("\n "); - printf("%4d", regofs[elem]); - if (elem < nelems - 1) - putchar(','); - if ((elem & 7) != 7) - putchar(' '); - else - printf("\t/* Regs %d-%d. */", elem - 7, elem); - } - printf("\n};"); - return (0); -} |