Skip to contentSkip to conversation

IA64 update for klibc-0.148

PATCH Applied Hannes Reinecke 2 participants 2 messages Jul 15, 2004

lore
Share & tools
lore
#0 lore raw

Hi all,

these two patches
- update the ia64 port of klibc and
- adds the missing perl scripts for syscall stub generation on ia64

So with it the new klibc should be finally working on ia64. Kudos go to [email protected] for the ia64 asm hackery.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux AG				S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de
klibc/arch/ia64/vfork.S renamed from klibc/arch/ia64/vfork.S.orig +2 -2
@@ -27,8 +27,8 @@
 	mov	out0=CLONE_VM|CLONE_VFORK|SIGCHLD
 	mov     out1=0
 	;;
-	__IA64_BREAK      // Do the syscall
-	
+	break 0x100000      // Do the syscall
+	;; 
 	addl	r15=0,r1
 	cmp.eq  p7,p6 = -1,r10
 	;;
klibc/arch/ia64/pipe.c renamed from klibc/arch/ia64/pipe.c.orig +1 -1
@@ -27,7 +27,7 @@
 	long _retval;
 	__asm __volatile (__IA64_BREAK
 			  : "=r" (_r8), "=r" (_r10), "=r" (_r15),
-			    "=r" (_out0)
+			  "=r" (_out0), "=r" (_r9)
 			  : "2" (_r15), "3" (_out0)
 			  : "memory" ASM_CLOBBERS);
 	if (_r10 == -1) {
klibc/arch/ia64/include/klibc/archsys.h renamed from klibc/arch/ia64/include/klibc/archsys.h.orig +7 -7
@@ -26,7 +26,7 @@
                errno = (_retval);                                       \
                _retval = -1;                                            \
        }                                                                \
-       return _retval;                                                  \
+       return (type)_retval;                                                  \
 }
 
 #define _syscall1(type,name,type1,arg1)                                 \
@@ -48,7 +48,7 @@
                errno = (_retval);                                       \
                _retval = -1;                                            \
        }                                                                \
-       return _retval;                                                  \
+       return (type)_retval;                                                  \
 }
 
 #define _syscall2(type,name,type1,arg1,type2,arg2)                      \
@@ -70,7 +70,7 @@
                errno = (_retval);                                       \
                _retval = -1;                                            \
        }                                                                \
-       return _retval;                                                  \
+       return (type)_retval;                                                  \
 }
 
 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)           \
@@ -92,7 +92,7 @@
                errno = (_retval);                                       \
                _retval = -1;                                            \
        }                                                                \
-       return _retval;                                                  \
+       return (type)_retval;                                                  \
 }
 
 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
@@ -114,7 +114,7 @@
                errno = (_retval);                                       \
                _retval = -1;                                            \
        }                                                                \
-       return _retval;                                                  \
+       return (type)_retval;                                                  \
 }
 
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
@@ -136,7 +136,7 @@
                errno = (_retval);                                       \
                _retval = -1;                                            \
        }                                                                \
-       return _retval;                                                  \
+       return (type)_retval;                                                  \
 }
 
 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
@@ -158,7 +158,7 @@
                errno = (_retval);                                       \
                _retval = -1;                                            \
        }                                                                \
-       return _retval;                                                  \
+       return (type)_retval;                                                  \
 }
   
 
klibc/arch/ia64/Makefile.inc +1 -0
@@ -11,6 +11,7 @@
 	arch/$(ARCH)/vfork.o \
 	arch/$(ARCH)/setjmp.o \
 	arch/$(ARCH)/pipe.o \
+	arch/$(ARCH)/syscall.o \
 	libgcc/__divdi3.o \
 	libgcc/__divsi3.o \
 	libgcc/__udivdi3.o \
klibc/arch/ia64/syscall.S +19 -0
@@ -0,0 +1,19 @@
+#
+# arch/ia64/syscall.S
+#
+
+#include <asm/unistd.h>
+	
+	.text
+	.align	32
+	.proc	__syscall_error
+	.globl	__syscall_error
+__syscall_error:
+	addl	r2 = @ltoffx(errno),gp
+	ld8.mov	r3 = [r2],errno
+	;;
+	st4	[r3] = r8
+	mov	r8 = -1
+	br.ret.sptk.many b0
+	.size	__syscall_error, .-__syscall_error
+	.endp	__syscall_error
klibc/arch/ia64/sysstub.ph +29 -0
@@ -0,0 +1,29 @@
+# -*- perl -*-
+#
+# arch/ia64/sysstub.ph
+#
+# Script to generate system call stubs
+#
+
+sub make_sysstub($$$$@) {
+    my($fname, $type, $sname, $stype, @args) = @_;
+
+    open(OUT, '>', "syscalls/${fname}.S");
+    print OUT "#include <asm/unistd.h>\n";
+    print OUT "\n";
+    print OUT "\t.text\n";
+    print OUT "\t.align 32\n";
+    print OUT "\t.proc ${fname}\n";
+    print OUT "\t.globl ${fname}\n";
+    print OUT "${fname}:\n";
+    print OUT "\tmov\tr15 = __NR_${sname}\n";
+    print OUT "\tbreak __BREAK_SYSCALL\n";
+    print OUT "\tcmp.eq p6,p0 = -1,r10\n";
+    print OUT "(p6)\tbr.few __syscall_error\n";
+    print OUT "\tbr.ret.sptk.many b0\n";
+    print OUT "\t.size\t${fname},.-${fname}\n";
+    print OUT "\t.endp\t${fname}\n";
+    close(OUT);
+}
+
+1;
#1 lore raw
Quoted 9 lines · Hannes Reinecke

Hi all,

these two patches
- update the ia64 port of klibc and
- adds the missing perl scripts for syscall stub generation on ia64

So with it the new klibc should be finally working on ia64. Kudos go to [email protected] for the ia64 asm hackery.

Thanks, applied!

-hpa

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel