ref: 1de991f3053e77706b920dc579c4affffd2d68f0
parent: 0c1934dabb9e1f81b8c7c2099f138e17dc772aca
author: zerous Naveen Narayanan <[email protected]>
date: Mon Apr 20 17:33:54 EDT 2020
libc: Implement the following syscalls for ppc32 Exit read write open close waitpid creat link unlink getpid
--- a/src/libc/arch/ppc32/linux/Makefile
+++ b/src/libc/arch/ppc32/linux/Makefile
@@ -3,12 +3,23 @@
include $(PROJECTDIR)/scripts/rules.mk
include ../../../rules.mk
-GENOBJS =
+GENOBJS =\
+ _Exit.$O\
+ _read.$O\
+ _write.$O\
+ _open.$O\
+ _close.$O\
+ _waitpid.$O\
+ _create.$O\
+ _link.$O\
+ _unlink.$O\
+ _getpid.$O\
GENSRC = $(GENOBJS:.$O=.s)
OBJS = \
$(GENOBJS)\
+ _cerrno.$O\
# Rules
--- /dev/null
+++ b/src/libc/arch/ppc32/linux/_cerrno.s
@@ -1,0 +1,12 @@
+ .file "_cerrno.s"
+ .globl _cerrno
+_cerrno:
+ cmpwi 0,0
+ bne err
+ blr
+err:
+ lis 0,errno@h
+ ori 0,0,errno@l
+ stw 3,0(0)
+ addi 3,3,-1
+ blr
--- /dev/null
+++ b/src/libc/arch/ppc32/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/ppc32/linux/syscall.lst
@@ -1,0 +1,11 @@
+#number name
+1 _Exit
+3 _read
+4 _write
+5 _open
+6 _close
+7 _waitpid
+8 _creat
+9 _link
+10 _unlink
+20 _getpid