From 99f8ce096bc5569adbfea1911dbcda24c28d8d8b Mon Sep 17 00:00:00 2001 From: Ben Summers Date: Fri, 14 Oct 2005 08:50:54 +0000 Subject: Box Backup 0.09 with a few tweeks --- test/raidfile/make-darwin-intercepts.pl | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 test/raidfile/make-darwin-intercepts.pl (limited to 'test/raidfile/make-darwin-intercepts.pl') diff --git a/test/raidfile/make-darwin-intercepts.pl b/test/raidfile/make-darwin-intercepts.pl new file mode 100755 index 00000000..2f19e090 --- /dev/null +++ b/test/raidfile/make-darwin-intercepts.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl +use strict; + +my $out = $ARGV[0]; +die "No out directory specified" unless $out ne ''; + +my @calls = split /[\r\n]+/,<<__E; +lseek SYSCALL_TEST(lseek, 3) +open SYSCALL_TEST(open, 3) +close SYSCALL_TEST(close, 1) +write SYSCALL_TEST(write, 3) +read SYSCALL_TEST(read, 3) +readv SYSCALL_TEST(readv, 3) +__E + +for(@calls) +{ + my ($name,$line) = split / /,$_,2; + + open FL,">$out/intercept-$name.s" or die "Can't open out file"; + print FL <<'__S'; +#include "../../../test/raidfile/Darwin-SYS.h" + +#define SYSCALL_TEST(name, nargs) \ + .globl cerror @\ +LEAF(_TEST_##name) @\ + kernel_trap_args_##nargs @\ + li r0,SYS_##name @\ + sc @\ + b 1f @\ + b 2f @\ +1: BRANCH_EXTERN(cerror) @\ +.text \ +2: nop + +__S + print FL $line,"\n\tblr\n\n"; + + close FL; + + if(system("gcc -c $out/intercept-$name.s -o $out/intercept-$name.o") != 0) + { + die "Assembly failed\n"; + } +} + -- cgit v1.2.3