user-cr: powerpc support etc
cover user-cr: powerpc support etc
Patch 1 is an obvious fix, I think.
The rest is an assortment of hacks I've employed to get this building and working on powerpc.
Nathan Lynch (4):
fix rename fallout
restart: (build fix hack) define sa_family_t and struct linger
mktree: initial powerpc support hacks
makefile hack for powerpc
Makefile | 5 +++- clone_ppc32.S | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ powerpc_asm.h | 46 +++++++++++++++++++++++++++++++++ restart.c | 31 ++++++++++++++++++++++ 4 files changed, 160 insertions(+), 1 deletions(-) create mode 100644 clone_ppc32.S create mode 100644 powerpc_asm.h
A message that is not in the archive (sent off-list or not yet received): 1253093271-16357-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
PATCH 1/4 fix rename fallout
mktree was renamed to restart; update Makefile accordingly.
--- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -44,7 +44,7 @@ all: $(PROGS) ckptinfo: ckptinfo_types.o -mktree: CFLAGS += -D__REENTRANT -pthread +restart: CFLAGS += -D__REENTRANT -pthread ckptinfo_types.o: ckptinfo_types.c @echo $(CC) -c $(CFLAGS) $<
Signature · 1 line
1.6.0.6
PATCH 2/4 restart: (build fix hack) define sa_family_t and struct linger
In reply to a message not in the archiverestart.c doesn't build against exported kernel headers:
$ make CPPFLAGS=-I$PWD/../linux-2.6.git/usr/include
cc -g -Wall -Wstrict-prototypes -Wno-trigraphs -I../linux/include -I../linux/arch//include -DCHECKPOINT_DEBUG -D__REENTRANT -pthread -I/home/nathanl/devel/user-cr.git/../linux-2.6.git/usr/include restart.c clone_ppc32.o -o restart
In file included from /home/nathanl/devel/user-cr.git/../linux-2.6.git/usr/include/linux/checkpoint_hdr.h:16,
from restart.c:42:
/home/nathanl/devel/user-cr.git/../linux-2.6.git/usr/include/linux/un.h:7: error: expected specifier-qualifier-list before ‘sa_family_t’
In file included from restart.c:42:
/home/nathanl/devel/user-cr.git/../linux-2.6.git/usr/include/linux/checkpoint_hdr.h:407: error: field ‘linger’ has incomplete type
make: *** [restart] Error 1I am not sure what the right fix is. This is not it.
--- restart.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
restart.c +7 -0
@@ -10,6 +10,13 @@#define _GNU_SOURCE +/* Hacks ahoy */ +typedef unsigned short sa_family_t ; +struct linger { +int l_onoff;/* Linger active */ +int l_linger;/* How long to linger for */ +}; +#include <stdio.h> #include <stdlib.h> #include <string.h>
Signature · 6 lines
1.6.0.6 _______________________________________________ Containers mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/containers
PATCH 3/4 mktree: initial powerpc support hacks
In reply to a message not in the archive--- clone_ppc32.S | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ powerpc_asm.h | 46 +++++++++++++++++++++++++++++++++ restart.c | 24 +++++++++++++++++ 3 files changed, 149 insertions(+), 0 deletions(-) create mode 100644 clone_ppc32.S create mode 100644 powerpc_asm.h
clone_ppc32.S new file +79 -0
@@ -0,0 +1,79 @@ +#include <asm/unistd.h> +#include "powerpc_asm.h" + +/* int [r3] clone_with_pids(int (*fn)(void *arg) [r3], + * void *child_stack [r4], + * int flags [r5], + * void *arg [r6], + * void *parent_tid [r7], + * void *tls [r8], + * void *child_tid [r9], + * struct target_pid_set *setp [r10]); + * Creates a child task with the pids specified by setp. + * Returns to parent only, child execution and exit is handled here. + * On error, returns negated errno. On success, returns the pid of the child + * created. + */ + + .text + .globl __clone_with_pids +__clone_with_pids: + + /* No argument validation. */ + + /* Set up parent's stack frame. */ + stwu r1,-32(r1) + + /* Save non-volatiles (r28-r31) which we plan to use. */ + stmw r28,16(r1) + + /* Set up child's stack frame. */ + clrrwi r4,r4,4 + li r0,0 + stw r0,-16(r4) + + /* Save fn, stack pointer, flags, and arg across system call. */ + mr r28,r3 + mr r29,r4 + mr r30,r5 + mr r31,r6 + + /* Set up arguments for system call. Stack pointer is already in r4. */ + mr r3,r5 /* flags */ + mr r5,r7 /* parent_tid */ + mr r6,r8 /* tls */ + mr r7,r9 /* child_tid */ + mr r8,r10 /* setp */ + + /* Do the system call */ + li r0,__NR_clone_with_pids + sc + + /* Parent or child? */ + cmpwi cr1,r3,0 + crandc 4*cr1+eq,4*cr1+eq,4*cr0+so + bne cr1,parent + + /* Child. Call fn. */ + mtctr r28 + mr r3,r31 + bctrl + + /* Assume result of fn in r3 and exit. */ + li r0,__NR_exit + sc + +parent: + /* Restore non-volatiles. */ + lmw r28,16(r1) + + addi r1,r1,32 + + /* Return to caller on success. */ + bnslr + + /* Handle error. Negate the return value to signal an error + * to the caller, which must set errno. + */ + neg r3,r3 + blr
powerpc_asm.h new file +46 -0
46 lines not on this page · raw message
restart.c +24 -0
@@ -1951,6 +1951,30 @@ int clone_with_pids(int (*fn)(void *), void *child_stack, int flags,return retval; } +#elif defined(__powerpc__) && defined(__NR_clone_with_pids) + +extern int __clone_with_pids (int (*fn)(void *arg),void *child_stack,int flags, +void *arg,void *parent_tid,void *tls, +void *child_tid,struct target_pid_set *setp); + +static int clone_with_pids (int (*fn)(void *),void *child_stack,int flags, +struct target_pid_set *target_pids,void *arg) +{ +void *parent_tid =NULL ; +void *tls =NULL ; +void *child_tid =NULL ; +pid_t newpid; + + newpid =__clone_with_pids (fn, child_stack, flags, arg, parent_tid, + tls, child_tid, target_pids); + +if (newpid <0 ) { + errno = -newpid; +return -1 ; + } + +return newpid; +}#else /* !defined(__NR_clone_with_pids) */ /* on other architectures fallback to regular clone(2) */
Signature · 1 line
1.6.0.6
PATCH 4/4 makefile hack for powerpc
In reply to a message not in the archiveAdd an explict restart target which links clone_ppc32.o into the restart executable.
Ideas on how to handle this in a mergeable form are welcome.
--- Makefile | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +3 -0
@@ -45,6 +45,9 @@ all: $(PROGS) ckptinfo: ckptinfo_types.o restart: CFLAGS += -D__REENTRANT -pthread +# powerpc hack +restart: restart.c clone_ppc32.o + $(CC) $(CFLAGS) $(CPPFLAGS) $^ -o $@ ckptinfo_types.o: ckptinfo_types.c @echo $(CC) -c $(CFLAGS) $<
Signature · 1 line
1.6.0.6
got them .. thanks.
Quoted 19 lines · Nathan Lynch
Patch 1 is an obvious fix, I think.
The rest is an assortment of hacks I've employed to get this building and working on powerpc.
Nathan Lynch (4):
fix rename fallout
restart: (build fix hack) definesa_family_tand struct linger
mktree: initial powerpc support hacks
makefile hack for powerpcMakefile | 5 +++- clone_ppc32.S | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ powerpc_asm.h | 46 +++++++++++++++++++++++++++++++++ restart.c | 31 ++++++++++++++++++++++ 4 files changed, 160 insertions(+), 1 deletions(-) create mode 100644 clone_ppc32.S create mode 100644 powerpc_asm.h