Explorar o código

Added powerpc-specific mmap syscall, 'cause we're special.

David Schleef %!s(int64=24) %!d(string=hai) anos
pai
achega
5b7f7988af

+ 1 - 1
libc/sysdeps/linux/powerpc/Makefile

@@ -39,7 +39,7 @@ endif
 SSRC=longjmp.S setjmp.S vfork.S
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
 
-CSRC=
+CSRC=_mmap.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
 OBJS=$(SOBJS) $(MOBJ) $(COBJS)

+ 41 - 0
libc/sysdeps/linux/powerpc/_mmap.c

@@ -0,0 +1,41 @@
+
+#include <unistd.h>
+#include <sys/mman.h>
+
+
+void * mmap(void *start, size_t length, int prot, int flags, int fd,
+	off_t offset)
+{
+	unsigned long __sc_ret, __sc_err;
+	register unsigned long __sc_0 __asm__ ("r0");
+	register unsigned long __sc_3 __asm__ ("r3");
+	register unsigned long __sc_4 __asm__ ("r4");
+	register unsigned long __sc_5 __asm__ ("r5");
+	register unsigned long __sc_6 __asm__ ("r6");
+	register unsigned long __sc_7 __asm__ ("r7");
+	register unsigned long __sc_8 __asm__ ("r8");
+
+	__sc_3 = (unsigned long) start;
+	__sc_4 = (unsigned long) length;
+	__sc_5 = (unsigned long) prot;
+	__sc_6 = (unsigned long) flags;
+	__sc_7 = (unsigned long) fd;
+	__sc_8 = (unsigned long) offset;
+	__sc_0 = __NR_mmap;
+	__asm__ __volatile__
+		("sc		\n\t"
+		 "mfcr %1	"
+		: "=&r" (__sc_3), "=&r" (__sc_0)
+		: "0"   (__sc_3), "1"   (__sc_0),
+		  "r"   (__sc_4),
+		  "r"   (__sc_5),
+		  "r"   (__sc_6),
+		  "r"   (__sc_7),
+		  "r"   (__sc_8)
+		: __syscall_clobbers);
+	__sc_ret = __sc_3;
+	__sc_err = __sc_0;
+
+	__syscall_return (void *);
+}
+

+ 3 - 2
libc/sysdeps/linux/powerpc/bits/termios.h

@@ -25,15 +25,16 @@ typedef unsigned char	cc_t;
 typedef unsigned int	speed_t;
 typedef unsigned int	tcflag_t;
 
-#define NCCS 32
+/* note: this is fixed to be the same as the kernel, not glibc */
+#define NCCS 19
 struct termios
   {
     tcflag_t c_iflag;		/* input mode flags */
     tcflag_t c_oflag;		/* output mode flags */
     tcflag_t c_cflag;		/* control mode flags */
     tcflag_t c_lflag;		/* local mode flags */
-    cc_t c_line;			/* line discipline */
     cc_t c_cc[NCCS];		/* control characters */
+    cc_t c_line;			/* line discipline */
     speed_t c_ispeed;		/* input speed */
     speed_t c_ospeed;		/* output speed */
   };

+ 3 - 3
libc/sysdeps/linux/powerpc/bits/types.h

@@ -58,12 +58,12 @@ __extension__ typedef unsigned long long int __uint64_t;
 #endif
 typedef __quad_t *__qaddr_t;
 
-typedef __u_quad_t __dev_t;		/* Type of device numbers.  */
+typedef __u_int __dev_t;		/* Type of device numbers.  */
 typedef __u_int __uid_t;		/* Type of user identifications.  */
 typedef __u_int __gid_t;		/* Type of group identifications.  */
-typedef __u_long __ino_t;		/* Type of file serial numbers.  */
+typedef __u_int __ino_t;		/* Type of file serial numbers.  */
 typedef __u_int __mode_t;		/* Type of file attribute bitmasks.  */
-typedef __u_int __nlink_t; 		/* Type of file link counts.  */
+typedef __u_short __nlink_t; 		/* Type of file link counts.  */
 typedef long int __off_t;		/* Type of file sizes and offsets.  */
 typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
 typedef int __pid_t;			/* Type of process identifications.  */