Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=05169237b55058a3993fb4804d00b65dfa3e4a0c
Commit:     05169237b55058a3993fb4804d00b65dfa3e4a0c
Parent:     3d5134ee8341bffc4f539049abb9e90d469b448d
Author:     Benjamin Herrenschmidt <[EMAIL PROTECTED]>
AuthorDate: Mon Jun 4 15:15:37 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Thu Jun 14 22:29:56 2007 +1000

    [POWERPC] spufs: Add support for SPU single stepping
    
    This patch adds support for SPU single stepping. The single
    step bit is set in the SPU when the current process is
    being single-stepped via ptrace. The spu then stops and
    returns with a specific flag set and the syscall exit code
    will generate the SIGTRAP.
    
    Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
    Acked-by: Jeremy Kerr <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/spufs/run.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/run.c 
b/arch/powerpc/platforms/cell/spufs/run.c
index 5762660..6625ed2 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -142,8 +142,12 @@ static int spu_run_init(struct spu_context *ctx, u32 * npc)
                        runcntl = SPU_RUNCNTL_RUNNABLE;
                ctx->ops->runcntl_write(ctx, runcntl);
        } else {
+               unsigned long mode = SPU_PRIVCNTL_MODE_NORMAL;
                spu_start_tick(ctx);
                ctx->ops->npc_write(ctx, *npc);
+               if (test_thread_flag(TIF_SINGLESTEP))
+                       mode = SPU_PRIVCNTL_MODE_SINGLE_STEP;
+               out_be64(&ctx->spu->priv2->spu_privcntl_RW, mode);
                ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
        }
 
@@ -334,7 +338,8 @@ long spufs_run_spu(struct file *file, struct spu_context 
*ctx,
                ret = spu_process_events(ctx);
 
        } while (!ret && !(status & (SPU_STATUS_STOPPED_BY_STOP |
-                                     SPU_STATUS_STOPPED_BY_HALT)));
+                                     SPU_STATUS_STOPPED_BY_HALT |
+                                      SPU_STATUS_SINGLE_STEP)));
 
        ctx->ops->master_stop(ctx);
        ret = spu_run_fini(ctx, npc, &status);
@@ -344,10 +349,15 @@ out2:
        if ((ret == 0) ||
            ((ret == -ERESTARTSYS) &&
             ((status & SPU_STATUS_STOPPED_BY_HALT) ||
+             (status & SPU_STATUS_SINGLE_STEP) ||
              ((status & SPU_STATUS_STOPPED_BY_STOP) &&
               (status >> SPU_STOP_STATUS_SHIFT != 0x2104)))))
                ret = status;
 
+       /* Note: we don't need to force_sig SIGTRAP on single-step
+        * since we have TIF_SINGLESTEP set, thus the kernel will do
+        * it upon return from the syscall anyawy
+        */
        if ((status & SPU_STATUS_STOPPED_BY_STOP)
            && (status >> SPU_STOP_STATUS_SHIFT) == 0x3fff) {
                force_sig(SIGTRAP, current);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to