spufs: spu-side context switch code
PATCH 4/7 spufs: spu-side context switch code
Add the source code that is used to generate spu_save_dump.h and spu_restore_dump.h. Since a full spu tool chain is needed to generate these files, the default remains to use the shipped versions in order to keep the number of tools for building the kernel down.
From: Mark Nutter: <[email protected]>
Signed-off-by Arnd Bergmann <[email protected]>
--
Makefile | 46 +++++++ spu_restore.c | 336 +++++++++++++++++++++++++++++++++++++++++++++++++++++ spu_restore_crt0.S | 116 ++++++++++++++++++ spu_save.c | 203 ++++++++++++++++++++++++++++++++ spu_save_crt0.S | 102 ++++++++++++++++ spu_utils.h | 160 +++++++++++++++++++++++++ 6 files changed, 963 insertions(+)
fs/spufs/Makefile +46 -0
@@ -2,4 +2,50 @@ obj-$(CONFIG_SPU_FS) += spufs.o spufs-y += inode.o file.o context.o switch.o +# Rules to build switch.o with the help of SPU tool chain +SPU_CROSS := spu- +SPU_CC := $(SPU_CROSS)gcc +SPU_AS := $(SPU_CROSS)gcc +SPU_LD := $(SPU_CROSS)ld +SPU_READELF := $(SPU_CROSS)readelf +SPU_CFLAGS := -O2 -Wall -I$(srctree)/include -I$(objtree)/include2 +SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include -I$(objtree)/include2 +SPU_LDFLAGS := -N -Ttext=0x0 + $(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h + +# Compile SPU files + cmd_spu_cc = $(SPU_CC) $(SPU_CFLAGS) -c -o $@ $< +quiet_cmd_spu_cc = SPU_CC $@ +$(obj)/spu_%.o: $(src)/spu_%.c + $(call if_changed,spu_cc) + +# Assemble SPU files + cmd_spu_as = $(SPU_AS) $(SPU_AFLAGS) -o $@ $< +quiet_cmd_spu_as = SPU_AS $@ +$(obj)/spu_%.o: $(src)/spu_%.S + $(call if_changed,spu_as) + +# Link SPU Executables + cmd_spu_ld = $(SPU_LD) $(SPU_LDFLAGS) -o $@ $^ +quiet_cmd_spu_ld = SPU_LD $@ +$(obj)/spu_%: $(obj)/spu_%.o $(obj)/spu_%_crt0.o + $(call if_changed,spu_ld) + +# create C code from ELF executable +cmd_hexdump = ( \ + echo "/*" ; \ + echo " * $@: Copyright (C) 2005 IBM." ; \ + echo " * Hex-dump auto generated from $<.c." ; \ + echo " * Do not edit!" ; \ + echo " */" ; \ + echo "static unsigned int $*_code[] __page_aligned = {" ; \ + $(SPU_READELF) -x1 -x2 $< | \ + grep -v "Hex dump of section" | \ + grep -v "^$$" | \ + $(AWK) -- '{ print "0x"$$2", 0x"$$3", 0x"$$4", 0x"$$5", " }' ; \ + echo "};" ; \ + ) > $@ +quiet_cmd_hexdump = HEXDUMP $@ +$(obj)/%_dump.h: $(obj)/% + $(call if_changed,hexdump)
fs/spufs/spu_restore.c +336 -0
336 lines not on this page · raw message
fs/spufs/spu_restore_crt0.S +116 -0
116 lines not on this page · raw message
fs/spufs/spu_save.c +203 -0
203 lines not on this page · raw message
fs/spufs/spu_save_crt0.S +102 -0
102 lines not on this page · raw message
fs/spufs/spu_utils.h +160 -0
160 lines not on this page · raw message