sh: fix build
Hi Folks
A few trivial changes to the sh arch support to get everything to build.
Everything links OK but although we can welcome the world with open arms
few of the other test program run correctly ...
--
Daniel Thompson (STMicroelectronics) <daniel.thompson@st.com>
1000 Aztec West, Almondsbury, Bristol, BS32 4SQ. 01454 462659
If a car is a horseless carriage then is a motorcycle a horseless horse?
diff --git a/usr/include/arch/sh/klibc/archstat.h b/usr/include/arch/sh/klibc/archstat.h
index f4c65ea..4f39181 100644
--- a/usr/include/arch/sh/klibc/archstat.h
+++ b/usr/include/arch/sh/klibc/archstat.h
@@ -8,7 +8,7 @@
/* This matches struct stat64 in glibc2.1, hence the absolutely
* insane amounts of padding around dev_t's.
*/
-struct stat64 {
+struct stat {
__stdev64 (st_dev);
unsigned char __pad0[4];
diff --git a/usr/klibc/arch/sh/syscall.S b/usr/klibc/arch/sh/syscall.S
index 41a0486..f5f85cc 100644
--- a/usr/klibc/arch/sh/syscall.S
+++ b/usr/klibc/arch/sh/syscall.S
@@ -10,10 +10,10 @@
.section ".text.syscall","ax"
.align 2
- .globl ___syscall_common
- .type ___syscall_common,@function
-___syscall_common:
- mov.l @(sp),r0
+ .globl __syscall_common
+ .type __syscall_common,@function
+__syscall_common:
+ mov.l @(0,sp),r0
mov.l @(4,sp),r1
trapa #0x15
mov.l 1f,r0
@@ -32,4 +32,4 @@
1: .long -4096 /* Errno limit */
2: .long errno
- .size ___syscall_common,.-___syscall_common
+ .size __syscall_common,.-__syscall_common
diff --git a/usr/klibc/arch/sh/sysstub.ph b/usr/klibc/arch/sh/sysstub.ph
index ce04b73..0ff46dd 100644
--- a/usr/klibc/arch/sh/sysstub.ph
+++ b/usr/klibc/arch/sh/sysstub.ph
@@ -15,18 +15,22 @@
print OUT "\t.type\t${fname},\#function\n";
print OUT "\t.globl\t${fname}\n";
print OUT "\t.align\t2\n";
+ print OUT "\t.import __syscall_common\n";
print OUT "${fname}:\n";
- print OUT "\tbra\t__syscall_common\n";
- print OUT "#if __NR_${sname} >= 128\n";
print OUT "\t mov.l\t1f, r3\n";
+ print OUT "\t jmp\t\@r3\n";
+ print OUT "#if __NR_${sname} >= 128\n";
+ print OUT "\t mov.l\t2f, r3\n";
print OUT "#else\n";
print OUT "\t mov\t# __NR_${sname}, r3\n";
print OUT "#endif\n";
print OUT "\t.size ${fname},.-${fname}\n";
print OUT "\n";
- print OUT "#if __NR_${sname} >= 128\n";
print OUT "\t.align\t2\n";
- print OUT "1:\t.long\t__NR_${sname}\n";
+ print OUT "\t.import\t__syscall_common\n";
+ print OUT "1:\t.long\t__syscall_common\n";
+ print OUT "#if __NR_${sname} >= 128\n";
+ print OUT "2:\t.long\t__NR_${sname}\n";
print OUT "#endif\n";
close(OUT);
}