ref: 1024de144473fe71b7b8bf85954e112a612c42b1
parent: 3c43e88a5a33a27365f381d82af451fa997d682a
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Jun 19 12:57:19 EDT 2020
libc: Rename ppc32 to ppc This name is more extended and it creates less problems when interacting with other toolchains.
--- /dev/null
+++ b/include/bits/ppc/arch/cdefs.h
@@ -1,0 +1,30 @@
+#ifdef _NEED_SIZET
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+#undef _NEED_SIZET
+#endif
+
+#ifdef _NEED_PTRDIFFT
+#ifndef _PTRDIFFT
+typedef long ptrdiff_t;
+#define _PTRDIFFT
+#endif
+#undef _NEED_PTRDIFFT
+#endif
+
+#ifdef _NEED_NULL
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+#undef _NEED_NULL
+#endif
+
+#ifdef _NEED_WCHART
+#ifndef _WCHART
+typedef int wchar_t;
+#define _WCHART
+#endif
+#undef _NEED_WCHART
+#endif
--- /dev/null
+++ b/include/bits/ppc/arch/limits.h
@@ -1,0 +1,18 @@
+#define CHAR_BIT 8
+#define SCHAR_MAX 0x7F
+#define SCHAR_MIN (-SCHAR_MAX - 1)
+#define CHAR_MAX 0x7F
+#define CHAR_MIN (-CHAR_MAX - 1)
+#define UCHAR_MAX 0xFF
+#define SHRT_MAX 0x7FFF
+#define SHRT_MIN (-SHRT_MAX - 1)
+#define USHRT_MAX 0xFFFF
+#define INT_MAX 0x7FFFFFFF
+#define INT_MIN (-INT_MAX - 1)
+#define UINT_MAX 0xFFFFFFFF
+#define LONG_MAX 0x7FFFFFFF
+#define LONG_MIN (-LONG_MAX - 1)
+#define ULONG_MAX 0xFFFFFFFF
+#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LLONG_MIN (-LLONG_MAX - 1)
+#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- /dev/null
+++ b/include/bits/ppc/arch/stdint.h
@@ -1,0 +1,96 @@
+#define INT8_MAX 0x7F
+#define INT8_MIN (-INT8_MAX - 1)
+#define UINT8_MAX 0xFF
+
+#define INT16_MAX 0x7FFF
+#define INT16_MIN (-INT16_MAX - 1)
+#define UINT16_MAX 0xFFFF
+
+#define INT32_MAX 0x7FFFFFFF
+#define INT32_MIN (-INT32_MAX - 1)
+#define UINT32_MAX 0xFFFFFFFF
+
+#define INT64_MAX 0x7FFFFFFFFFFFFFFF
+#define INT64_MIN (-INT64_MAX - 1)
+#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
+
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INT_FAST8_MIN INT32_MIN
+#define INT_FAST8_MAX INT32_MAX
+#define UINT_FAST8_MAX UINT32_MAX
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST16_MAX INT32_MAX
+#define UINT_FAST16_MAX UINT32_MAX
+
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+
+#define SIZE_MAX UINT32_MAX
+
+typedef signed char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef long long int64_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef signed char int8_least_t;
+typedef short int16_least_t;
+typedef int int32_least_t;
+typedef long long int64_least_t;
+
+typedef unsigned char uint8_least_t;
+typedef unsigned short uint16_least_t;
+typedef unsigned int uint32_least_t;
+typedef unsigned long long uint64_least_t;
+
+typedef int int8_fast_t;
+typedef int int16_fast_t;
+typedef int int32_fast_t;
+typedef long long int64_fast_t;
+
+typedef unsigned int uint8_fast_t;
+typedef unsigned int uint16_fast_t;
+typedef unsigned int uint32_fast_t;
+typedef unsigned long long uint64_fast_t;
+
+typedef long intptr_t;
+typedef unsigned long uintptr_t;
+
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
--- /dev/null
+++ b/include/bits/ppc/arch/stdio.h
@@ -1,0 +1,10 @@
+#define BUFSIZ 512
+#define FILENAME_MAX 256
+#define FOPEN_MAX 16
+
+#define TMP_MAX 25
+#define L_tmpnam 256
+
+#define _TMPNAME "/tmp/tmp.0000000"
+
+typedef int fpos_t;
--- /dev/null
+++ b/include/bits/ppc/arch/stdlib.h
@@ -1,0 +1,4 @@
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+#define _ALIGNTYPE long double
--- /dev/null
+++ b/include/bits/ppc/arch/string.h
@@ -1,0 +1,1 @@
+#define __NUMCHARS 128
--- /dev/null
+++ b/include/bits/ppc/arch/time.h
@@ -1,0 +1,3 @@
+#define _MAXYEAR 9999
+
+typedef long int time_t;
--- a/include/bits/ppc32/arch/cdefs.h
+++ /dev/null
@@ -1,30 +1,0 @@
-#ifdef _NEED_SIZET
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-#undef _NEED_SIZET
-#endif
-
-#ifdef _NEED_PTRDIFFT
-#ifndef _PTRDIFFT
-typedef long ptrdiff_t;
-#define _PTRDIFFT
-#endif
-#undef _NEED_PTRDIFFT
-#endif
-
-#ifdef _NEED_NULL
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-#undef _NEED_NULL
-#endif
-
-#ifdef _NEED_WCHART
-#ifndef _WCHART
-typedef int wchar_t;
-#define _WCHART
-#endif
-#undef _NEED_WCHART
-#endif
--- a/include/bits/ppc32/arch/limits.h
+++ /dev/null
@@ -1,18 +1,0 @@
-#define CHAR_BIT 8
-#define SCHAR_MAX 0x7F
-#define SCHAR_MIN (-SCHAR_MAX - 1)
-#define CHAR_MAX 0x7F
-#define CHAR_MIN (-CHAR_MAX - 1)
-#define UCHAR_MAX 0xFF
-#define SHRT_MAX 0x7FFF
-#define SHRT_MIN (-SHRT_MAX - 1)
-#define USHRT_MAX 0xFFFF
-#define INT_MAX 0x7FFFFFFF
-#define INT_MIN (-INT_MAX - 1)
-#define UINT_MAX 0xFFFFFFFF
-#define LONG_MAX 0x7FFFFFFF
-#define LONG_MIN (-LONG_MAX - 1)
-#define ULONG_MAX 0xFFFFFFFF
-#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LLONG_MIN (-LLONG_MAX - 1)
-#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- a/include/bits/ppc32/arch/stdint.h
+++ /dev/null
@@ -1,96 +1,0 @@
-#define INT8_MAX 0x7F
-#define INT8_MIN (-INT8_MAX - 1)
-#define UINT8_MAX 0xFF
-
-#define INT16_MAX 0x7FFF
-#define INT16_MIN (-INT16_MAX - 1)
-#define UINT16_MAX 0xFFFF
-
-#define INT32_MAX 0x7FFFFFFF
-#define INT32_MIN (-INT32_MAX - 1)
-#define UINT32_MAX 0xFFFFFFFF
-
-#define INT64_MAX 0x7FFFFFFFFFFFFFFF
-#define INT64_MIN (-INT64_MAX - 1)
-#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
-
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-
-#define INT_LEAST64_MIN INT64_MIN
-#define INT_LEAST64_MAX INT64_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-#define INT_FAST8_MIN INT32_MIN
-#define INT_FAST8_MAX INT32_MAX
-#define UINT_FAST8_MAX UINT32_MAX
-
-#define INT_FAST16_MIN INT32_MIN
-#define INT_FAST16_MAX INT32_MAX
-#define UINT_FAST16_MAX UINT32_MAX
-
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-#define UINTPTR_MAX UINT32_MAX
-
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-#define PTRDIFF_MIN INT32_MIN
-#define PTRDIFF_MAX INT32_MAX
-
-#define SIZE_MAX UINT32_MAX
-
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char int8_least_t;
-typedef short int16_least_t;
-typedef int int32_least_t;
-typedef long long int64_least_t;
-
-typedef unsigned char uint8_least_t;
-typedef unsigned short uint16_least_t;
-typedef unsigned int uint32_least_t;
-typedef unsigned long long uint64_least_t;
-
-typedef int int8_fast_t;
-typedef int int16_fast_t;
-typedef int int32_fast_t;
-typedef long long int64_fast_t;
-
-typedef unsigned int uint8_fast_t;
-typedef unsigned int uint16_fast_t;
-typedef unsigned int uint32_fast_t;
-typedef unsigned long long uint64_fast_t;
-
-typedef long intptr_t;
-typedef unsigned long uintptr_t;
-
-typedef long long intmax_t;
-typedef unsigned long long uintmax_t;
--- a/include/bits/ppc32/arch/stdio.h
+++ /dev/null
@@ -1,10 +1,0 @@
-#define BUFSIZ 512
-#define FILENAME_MAX 256
-#define FOPEN_MAX 16
-
-#define TMP_MAX 25
-#define L_tmpnam 256
-
-#define _TMPNAME "/tmp/tmp.0000000"
-
-typedef int fpos_t;
--- a/include/bits/ppc32/arch/stdlib.h
+++ /dev/null
@@ -1,4 +1,0 @@
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-#define _ALIGNTYPE long double
--- a/include/bits/ppc32/arch/string.h
+++ /dev/null
@@ -1,1 +1,0 @@
-#define __NUMCHARS 128
--- a/include/bits/ppc32/arch/time.h
+++ /dev/null
@@ -1,3 +1,0 @@
-#define _MAXYEAR 9999
-
-typedef long int time_t;
--- a/src/libc/arch/Makefile
+++ b/src/libc/arch/Makefile
@@ -8,7 +8,7 @@
arm32\
arm64\
i386\
- ppc32\
+ ppc\
all:
+@cd $(ARCH) && $(MAKE)
--- /dev/null
+++ b/src/libc/arch/ppc/Makefile
@@ -1,0 +1,30 @@
+.POSIX:
+PROJECTDIR =../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+OBJS =\
+ longjmp.$O\
+ setjmp.$O\
+ memchr.$O\
+ memcmp.$O\
+ memcpy.$O\
+ memmove.$O\
+ memset.$O\
+
+DIRS = linux
+
+all: $(LIBC) $(SYS)
+
+$(LIBC): $(OBJS)
+ $(MKLST)
+
+$(SYS): FORCE
+ +@cd $@ && $(MAKE)
+
+dep: inc-dep
+
+dep clean:
+ $(FORALL)
+
+include deps.mk
--- /dev/null
+++ b/src/libc/arch/ppc/crt-posix.s
@@ -1,0 +1,11 @@
+ .comm _environ,4,4
+
+ .text
+ .globl _start
+_start:
+ stwu 1,-16(1)
+ lis 14,_environ@h
+ ori 14,14,_environ@l
+ stw 5,0(14)
+ bl main
+ b exit
--- /dev/null
+++ b/src/libc/arch/ppc/deps.mk
@@ -1,0 +1,7 @@
+#deps
+./linux/_getheap.o: ./linux/../../linux/_getheap.c
+./memchr.o: ./../../string/memchr.c
+./memcmp.o: ./../../string/memcmp.c
+./memcpy.o: ./../../string/memcpy.c
+./memmove.o: ./../../string/memmove.c
+./memset.o: ./../../string/memset.c
--- /dev/null
+++ b/src/libc/arch/ppc/linux/Makefile
@@ -1,0 +1,43 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../../rules.mk
+
+GENOBJS =\
+ _Exit.$O\
+ _read.$O\
+ _write.$O\
+ _open.$O\
+ _close.$O\
+ _waitpid.$O\
+ _create.$O\
+ _link.$O\
+ _unlink.$O\
+ _getpid.$O\
+ _brk.$O\
+
+GENSRC = $(GENOBJS:.$O=.s)
+
+OBJS = \
+ $(GENOBJS)\
+ _cerrno.$O\
+ _getheap.$O\
+
+# Rules
+
+all: $(LIBC) $(CRT)
+
+$(LIBC): $(OBJS)
+ $(MKLST)
+
+crt.$O: ../crt-posix.s
+
+$(GENSRC): syscall.lst
+ gensys.sh $(@:.s=)
+
+dep: inc-dep
+
+clean:
+ rm -f $(GENSRC)
+
+include deps.mk
--- /dev/null
+++ b/src/libc/arch/ppc/linux/_cerrno.s
@@ -1,0 +1,13 @@
+ .file "_cerrno.s"
+ .globl _cerrno
+_cerrno:
+ cmpwi 0,0
+ bne err
+ blr
+err:
+ lis 14,errno@h
+ ori 14,14,errno@l
+ stw 3,0(14)
+ xor 3,3,3
+ addi 3,3,-1
+ blr
--- /dev/null
+++ b/src/libc/arch/ppc/linux/_getheap.c
@@ -1,0 +1,1 @@
+#include "../../linux/_getheap.c"
--- /dev/null
+++ b/src/libc/arch/ppc/linux/crt.s
@@ -1,0 +1,1 @@
+ .include "../crt-posix.s"
--- /dev/null
+++ b/src/libc/arch/ppc/linux/deps.mk
@@ -1,0 +1,2 @@
+#deps
+./_getheap.o: ./../../linux/_getheap.c
--- /dev/null
+++ b/src/libc/arch/ppc/linux/gensys.sh
@@ -1,0 +1,17 @@
+#!/bin/sh
+
+awk '! /^#/ && $2 == "'$1'" {
+ syscall=$2
+ fname=$2".s"
+
+ printf ("\t.file\t" \
+ "\"%s\"\n" \
+ "\t.globl\t%s\n" \
+ "%s:\n",
+ fname, syscall, syscall)
+
+ printf ("\tli\t0,%d\n" \
+ "\tsc\n" \
+ "\tmfcr\t0\n" \
+ "\tb\t_cerrno\n", $1)
+} ' syscall.lst >$1.s
--- /dev/null
+++ b/src/libc/arch/ppc/linux/syscall.lst
@@ -1,0 +1,12 @@
+#number name
+1 _Exit
+3 _read
+4 _write
+5 _open
+6 _close
+7 _waitpid
+8 _creat
+9 _link
+10 _unlink
+20 _getpid
+45 _brk
--- /dev/null
+++ b/src/libc/arch/ppc/longjmp.s
@@ -1,0 +1,62 @@
+ .file "longjmp.s"
+ .text
+ .global longjmp
+
+longjmp:
+ /* 0) move old return address into r0 */
+ lwz 0,0(3)
+ /* 1) put it into link reg */
+ mtlr 0
+ /* 2 ) restore stack ptr */
+ lwz 1,4(3)
+ /* 3) restore control reg */
+ lwz 0,8(3)
+ mtcr 0
+ /* 4) restore r14-r31 */
+ lwz 14,12(3)
+ lwz 15,16(3)
+ lwz 16,20(3)
+ lwz 17,24(3)
+ lwz 18,28(3)
+ lwz 19,32(3)
+ lwz 20,36(3)
+ lwz 21,40(3)
+ lwz 22,44(3)
+ lwz 23,48(3)
+ lwz 24,52(3)
+ lwz 25,56(3)
+ lwz 26,60(3)
+ lwz 27,64(3)
+ lwz 28,68(3)
+ lwz 29,72(3)
+ lwz 30,76(3)
+ lwz 31,80(3)
+ lfd 14,88(3)
+ lfd 15,96(3)
+ lfd 16,104(3)
+ lfd 17,112(3)
+ lfd 18,120(3)
+ lfd 19,128(3)
+ lfd 20,136(3)
+ lfd 21,144(3)
+ lfd 22,152(3)
+ lfd 23,160(3)
+ lfd 24,168(3)
+ lfd 25,176(3)
+ lfd 26,184(3)
+ lfd 27,192(3)
+ lfd 28,200(3)
+ lfd 29,208(3)
+ lfd 30,216(3)
+ lfd 31,224(3)
+
+ /* 5) put val into return reg r3 */
+ mr 3,4
+
+ /* 6) check if return value is 0, make it 1 in that case */
+ cmpwi cr7,4,0
+ bne cr7,1f
+ li 3, 1
+1:
+ blr
+
--- /dev/null
+++ b/src/libc/arch/ppc/memchr.c
@@ -1,0 +1,1 @@
+#include "../../string/memchr.c"
--- /dev/null
+++ b/src/libc/arch/ppc/memcmp.c
@@ -1,0 +1,1 @@
+#include "../../string/memcmp.c"
--- /dev/null
+++ b/src/libc/arch/ppc/memcpy.c
@@ -1,0 +1,1 @@
+#include "../../string/memcpy.c"
--- /dev/null
+++ b/src/libc/arch/ppc/memmove.c
@@ -1,0 +1,1 @@
+#include "../../string/memmove.c"
--- /dev/null
+++ b/src/libc/arch/ppc/memset.c
@@ -1,0 +1,1 @@
+#include "../../string/memset.c"
--- /dev/null
+++ b/src/libc/arch/ppc/setjmp.s
@@ -1,0 +1,56 @@
+ .file "setjmp.s"
+ .text
+ .global setjmp
+
+setjmp:
+ /* 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg) */
+ mflr 0
+ stw 0,0(3)
+ /* 1) store reg1 (SP) */
+ stw 1, 4(3)
+ /* 2) store cr */
+ mfcr 0
+ stw 0,8(3)
+ /* 3) store r14-31 */
+ stw 14,12(3)
+ stw 15,16(3)
+ stw 16,20(3)
+ stw 17,24(3)
+ stw 18,28(3)
+ stw 19,32(3)
+ stw 20,36(3)
+ stw 21,40(3)
+ stw 22,44(3)
+ stw 23,48(3)
+ stw 24,52(3)
+ stw 25,56(3)
+ stw 26,60(3)
+ stw 27,64(3)
+ stw 28,68(3)
+ stw 29,72(3)
+ stw 30,76(3)
+ stw 31,80(3)
+ stfd 14,88(3)
+ stfd 15,96(3)
+ stfd 16,104(3)
+ stfd 17,112(3)
+ stfd 18,120(3)
+ stfd 19,128(3)
+ stfd 20,136(3)
+ stfd 21,144(3)
+ stfd 22,152(3)
+ stfd 23,160(3)
+ stfd 24,168(3)
+ stfd 25,176(3)
+ stfd 26,184(3)
+ stfd 27,192(3)
+ stfd 28,200(3)
+ stfd 29,208(3)
+ stfd 30,216(3)
+ stfd 31,224(3)
+
+ /* 4) set return value to 0 */
+ li 3,0
+
+ /* 5) return */
+ blr
--- a/src/libc/arch/ppc32/Makefile
+++ /dev/null
@@ -1,30 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../rules.mk
-
-OBJS =\
- longjmp.$O\
- setjmp.$O\
- memchr.$O\
- memcmp.$O\
- memcpy.$O\
- memmove.$O\
- memset.$O\
-
-DIRS = linux
-
-all: $(LIBC) $(SYS)
-
-$(LIBC): $(OBJS)
- $(MKLST)
-
-$(SYS): FORCE
- +@cd $@ && $(MAKE)
-
-dep: inc-dep
-
-dep clean:
- $(FORALL)
-
-include deps.mk
--- a/src/libc/arch/ppc32/crt-posix.s
+++ /dev/null
@@ -1,11 +1,0 @@
- .comm _environ,4,4
-
- .text
- .globl _start
-_start:
- stwu 1,-16(1)
- lis 14,_environ@h
- ori 14,14,_environ@l
- stw 5,0(14)
- bl main
- b exit
--- a/src/libc/arch/ppc32/deps.mk
+++ /dev/null
@@ -1,7 +1,0 @@
-#deps
-./linux/_getheap.o: ./linux/../../linux/_getheap.c
-./memchr.o: ./../../string/memchr.c
-./memcmp.o: ./../../string/memcmp.c
-./memcpy.o: ./../../string/memcpy.c
-./memmove.o: ./../../string/memmove.c
-./memset.o: ./../../string/memset.c
--- a/src/libc/arch/ppc32/linux/Makefile
+++ /dev/null
@@ -1,43 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../../rules.mk
-
-GENOBJS =\
- _Exit.$O\
- _read.$O\
- _write.$O\
- _open.$O\
- _close.$O\
- _waitpid.$O\
- _create.$O\
- _link.$O\
- _unlink.$O\
- _getpid.$O\
- _brk.$O\
-
-GENSRC = $(GENOBJS:.$O=.s)
-
-OBJS = \
- $(GENOBJS)\
- _cerrno.$O\
- _getheap.$O\
-
-# Rules
-
-all: $(LIBC) $(CRT)
-
-$(LIBC): $(OBJS)
- $(MKLST)
-
-crt.$O: ../crt-posix.s
-
-$(GENSRC): syscall.lst
- gensys.sh $(@:.s=)
-
-dep: inc-dep
-
-clean:
- rm -f $(GENSRC)
-
-include deps.mk
--- a/src/libc/arch/ppc32/linux/_cerrno.s
+++ /dev/null
@@ -1,13 +1,0 @@
- .file "_cerrno.s"
- .globl _cerrno
-_cerrno:
- cmpwi 0,0
- bne err
- blr
-err:
- lis 14,errno@h
- ori 14,14,errno@l
- stw 3,0(14)
- xor 3,3,3
- addi 3,3,-1
- blr
--- a/src/libc/arch/ppc32/linux/_getheap.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../linux/_getheap.c"
--- a/src/libc/arch/ppc32/linux/crt.s
+++ /dev/null
@@ -1,1 +1,0 @@
- .include "../crt-posix.s"
--- a/src/libc/arch/ppc32/linux/deps.mk
+++ /dev/null
@@ -1,2 +1,0 @@
-#deps
-./_getheap.o: ./../../linux/_getheap.c
--- a/src/libc/arch/ppc32/linux/gensys.sh
+++ /dev/null
@@ -1,17 +1,0 @@
-#!/bin/sh
-
-awk '! /^#/ && $2 == "'$1'" {
- syscall=$2
- fname=$2".s"
-
- printf ("\t.file\t" \
- "\"%s\"\n" \
- "\t.globl\t%s\n" \
- "%s:\n",
- fname, syscall, syscall)
-
- printf ("\tli\t0,%d\n" \
- "\tsc\n" \
- "\tmfcr\t0\n" \
- "\tb\t_cerrno\n", $1)
-} ' syscall.lst >$1.s
--- a/src/libc/arch/ppc32/linux/syscall.lst
+++ /dev/null
@@ -1,12 +1,0 @@
-#number name
-1 _Exit
-3 _read
-4 _write
-5 _open
-6 _close
-7 _waitpid
-8 _creat
-9 _link
-10 _unlink
-20 _getpid
-45 _brk
--- a/src/libc/arch/ppc32/longjmp.s
+++ /dev/null
@@ -1,62 +1,0 @@
- .file "longjmp.s"
- .text
- .global longjmp
-
-longjmp:
- /* 0) move old return address into r0 */
- lwz 0,0(3)
- /* 1) put it into link reg */
- mtlr 0
- /* 2 ) restore stack ptr */
- lwz 1,4(3)
- /* 3) restore control reg */
- lwz 0,8(3)
- mtcr 0
- /* 4) restore r14-r31 */
- lwz 14,12(3)
- lwz 15,16(3)
- lwz 16,20(3)
- lwz 17,24(3)
- lwz 18,28(3)
- lwz 19,32(3)
- lwz 20,36(3)
- lwz 21,40(3)
- lwz 22,44(3)
- lwz 23,48(3)
- lwz 24,52(3)
- lwz 25,56(3)
- lwz 26,60(3)
- lwz 27,64(3)
- lwz 28,68(3)
- lwz 29,72(3)
- lwz 30,76(3)
- lwz 31,80(3)
- lfd 14,88(3)
- lfd 15,96(3)
- lfd 16,104(3)
- lfd 17,112(3)
- lfd 18,120(3)
- lfd 19,128(3)
- lfd 20,136(3)
- lfd 21,144(3)
- lfd 22,152(3)
- lfd 23,160(3)
- lfd 24,168(3)
- lfd 25,176(3)
- lfd 26,184(3)
- lfd 27,192(3)
- lfd 28,200(3)
- lfd 29,208(3)
- lfd 30,216(3)
- lfd 31,224(3)
-
- /* 5) put val into return reg r3 */
- mr 3,4
-
- /* 6) check if return value is 0, make it 1 in that case */
- cmpwi cr7,4,0
- bne cr7,1f
- li 3, 1
-1:
- blr
-
--- a/src/libc/arch/ppc32/memchr.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../string/memchr.c"
--- a/src/libc/arch/ppc32/memcmp.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../string/memcmp.c"
--- a/src/libc/arch/ppc32/memcpy.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../string/memcpy.c"
--- a/src/libc/arch/ppc32/memmove.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../string/memmove.c"
--- a/src/libc/arch/ppc32/memset.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../string/memset.c"
--- a/src/libc/arch/ppc32/setjmp.s
+++ /dev/null
@@ -1,56 +1,0 @@
- .file "setjmp.s"
- .text
- .global setjmp
-
-setjmp:
- /* 0) store IP int 0, then into the jmpbuf pointed to by r3 (first arg) */
- mflr 0
- stw 0,0(3)
- /* 1) store reg1 (SP) */
- stw 1, 4(3)
- /* 2) store cr */
- mfcr 0
- stw 0,8(3)
- /* 3) store r14-31 */
- stw 14,12(3)
- stw 15,16(3)
- stw 16,20(3)
- stw 17,24(3)
- stw 18,28(3)
- stw 19,32(3)
- stw 20,36(3)
- stw 21,40(3)
- stw 22,44(3)
- stw 23,48(3)
- stw 24,52(3)
- stw 25,56(3)
- stw 26,60(3)
- stw 27,64(3)
- stw 28,68(3)
- stw 29,72(3)
- stw 30,76(3)
- stw 31,80(3)
- stfd 14,88(3)
- stfd 15,96(3)
- stfd 16,104(3)
- stfd 17,112(3)
- stfd 18,120(3)
- stfd 19,128(3)
- stfd 20,136(3)
- stfd 21,144(3)
- stfd 22,152(3)
- stfd 23,160(3)
- stfd 24,168(3)
- stfd 25,176(3)
- stfd 26,184(3)
- stfd 27,192(3)
- stfd 28,200(3)
- stfd 29,208(3)
- stfd 30,216(3)
- stfd 31,224(3)
-
- /* 4) set return value to 0 */
- li 3,0
-
- /* 5) return */
- blr
--- /dev/null
+++ b/src/libcrt/ppc/Makefile
@@ -1,0 +1,11 @@
+.POSIX:
+PROJECTDIR=../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = dummy.o
+TARGET = $(LIBCDIR)/libcrt.a
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ mklib -o $@ $?
--- a/src/libcrt/ppc32/Makefile
+++ /dev/null
@@ -1,11 +1,0 @@
-.POSIX:
-PROJECTDIR=../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-OBJS = dummy.o
-TARGET = $(LIBCDIR)/libcrt.a
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS)
- mklib -o $@ $?