Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175914
b: refs/heads/master
c: 390dfd9
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Oct 29, 2009
1 parent fc627e4 commit bfcb8a8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 46 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 877105cc49f6e6ad32e3d63a214e8f537c0339ef
refs/heads/master: 390dfd95c5df1ab3921dd388d11b2aee332c3f2c
61 changes: 30 additions & 31 deletions trunk/arch/mn10300/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
#define KPROBE_HIT_ACTIVE 0x00000001
#define KPROBE_HIT_SS 0x00000002

static struct kprobe *current_kprobe;
static unsigned long current_kprobe_orig_pc;
static unsigned long current_kprobe_next_pc;
static int current_kprobe_ss_flags;
static struct kprobe *cur_kprobe;
static unsigned long cur_kprobe_orig_pc;
static unsigned long cur_kprobe_next_pc;
static int cur_kprobe_ss_flags;
static unsigned long kprobe_status;
static kprobe_opcode_t current_kprobe_ss_buf[MAX_INSN_SIZE + 2];
static unsigned long current_kprobe_bp_addr;
static kprobe_opcode_t cur_kprobe_ss_buf[MAX_INSN_SIZE + 2];
static unsigned long cur_kprobe_bp_addr;

DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;

Expand Down Expand Up @@ -399,26 +399,25 @@ void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
{
unsigned long nextpc;

current_kprobe_orig_pc = regs->pc;
memcpy(current_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE);
regs->pc = (unsigned long) current_kprobe_ss_buf;
cur_kprobe_orig_pc = regs->pc;
memcpy(cur_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE);
regs->pc = (unsigned long) cur_kprobe_ss_buf;

nextpc = find_nextpc(regs, &current_kprobe_ss_flags);
if (current_kprobe_ss_flags & SINGLESTEP_PCREL)
current_kprobe_next_pc =
current_kprobe_orig_pc + (nextpc - regs->pc);
nextpc = find_nextpc(regs, &cur_kprobe_ss_flags);
if (cur_kprobe_ss_flags & SINGLESTEP_PCREL)
cur_kprobe_next_pc = cur_kprobe_orig_pc + (nextpc - regs->pc);
else
current_kprobe_next_pc = nextpc;
cur_kprobe_next_pc = nextpc;

/* branching instructions need special handling */
if (current_kprobe_ss_flags & SINGLESTEP_BRANCH)
if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH)
nextpc = singlestep_branch_setup(regs);

current_kprobe_bp_addr = nextpc;
cur_kprobe_bp_addr = nextpc;

*(u8 *) nextpc = BREAKPOINT_INSTRUCTION;
mn10300_dcache_flush_range2((unsigned) current_kprobe_ss_buf,
sizeof(current_kprobe_ss_buf));
mn10300_dcache_flush_range2((unsigned) cur_kprobe_ss_buf,
sizeof(cur_kprobe_ss_buf));
mn10300_icache_inv();
}

Expand All @@ -440,7 +439,7 @@ static inline int __kprobes kprobe_handler(struct pt_regs *regs)
disarm_kprobe(p, regs);
ret = 1;
} else {
p = current_kprobe;
p = cur_kprobe;
if (p->break_handler && p->break_handler(p, regs))
goto ss_probe;
}
Expand All @@ -464,7 +463,7 @@ static inline int __kprobes kprobe_handler(struct pt_regs *regs)
}

kprobe_status = KPROBE_HIT_ACTIVE;
current_kprobe = p;
cur_kprobe = p;
if (p->pre_handler(p, regs)) {
/* handler has already set things up, so skip ss setup */
return 1;
Expand All @@ -491,8 +490,8 @@ static inline int __kprobes kprobe_handler(struct pt_regs *regs)
static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
{
/* we may need to fixup regs/stack after singlestepping a call insn */
if (current_kprobe_ss_flags & SINGLESTEP_BRANCH) {
regs->pc = current_kprobe_orig_pc;
if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) {
regs->pc = cur_kprobe_orig_pc;
switch (p->ainsn.insn[0]) {
case 0xcd: /* CALL (d16,PC) */
*(unsigned *) regs->sp = regs->mdr = regs->pc + 5;
Expand Down Expand Up @@ -523,19 +522,19 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
}
}

regs->pc = current_kprobe_next_pc;
current_kprobe_bp_addr = 0;
regs->pc = cur_kprobe_next_pc;
cur_kprobe_bp_addr = 0;
}

static inline int __kprobes post_kprobe_handler(struct pt_regs *regs)
{
if (!kprobe_running())
return 0;

if (current_kprobe->post_handler)
current_kprobe->post_handler(current_kprobe, regs, 0);
if (cur_kprobe->post_handler)
cur_kprobe->post_handler(cur_kprobe, regs, 0);

resume_execution(current_kprobe, regs);
resume_execution(cur_kprobe, regs);
reset_current_kprobe();
preempt_enable_no_resched();
return 1;
Expand All @@ -545,12 +544,12 @@ static inline int __kprobes post_kprobe_handler(struct pt_regs *regs)
static inline
int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
{
if (current_kprobe->fault_handler &&
current_kprobe->fault_handler(current_kprobe, regs, trapnr))
if (cur_kprobe->fault_handler &&
cur_kprobe->fault_handler(cur_kprobe, regs, trapnr))
return 1;

if (kprobe_status & KPROBE_HIT_SS) {
resume_execution(current_kprobe, regs);
resume_execution(cur_kprobe, regs);
reset_current_kprobe();
preempt_enable_no_resched();
}
Expand All @@ -567,7 +566,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,

switch (val) {
case DIE_BREAKPOINT:
if (current_kprobe_bp_addr != args->regs->pc) {
if (cur_kprobe_bp_addr != args->regs->pc) {
if (kprobe_handler(args->regs))
return NOTIFY_STOP;
} else {
Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/crypto/padlock-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct aes_ctx {
u32 *D;
};

static DEFINE_PER_CPU(struct cword *, last_cword);
static DEFINE_PER_CPU(struct cword *, paes_last_cword);

/* Tells whether the ACE is capable to generate
the extended key for a given key_len. */
Expand Down Expand Up @@ -152,9 +152,9 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,

ok:
for_each_online_cpu(cpu)
if (&ctx->cword.encrypt == per_cpu(last_cword, cpu) ||
&ctx->cword.decrypt == per_cpu(last_cword, cpu))
per_cpu(last_cword, cpu) = NULL;
if (&ctx->cword.encrypt == per_cpu(paes_last_cword, cpu) ||
&ctx->cword.decrypt == per_cpu(paes_last_cword, cpu))
per_cpu(paes_last_cword, cpu) = NULL;

return 0;
}
Expand All @@ -166,7 +166,7 @@ static inline void padlock_reset_key(struct cword *cword)
{
int cpu = raw_smp_processor_id();

if (cword != per_cpu(last_cword, cpu))
if (cword != per_cpu(paes_last_cword, cpu))
#ifndef CONFIG_X86_64
asm volatile ("pushfl; popfl");
#else
Expand All @@ -176,7 +176,7 @@ static inline void padlock_reset_key(struct cword *cword)

static inline void padlock_store_cword(struct cword *cword)
{
per_cpu(last_cword, raw_smp_processor_id()) = cword;
per_cpu(paes_last_cword, raw_smp_processor_id()) = cword;
}

/*
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/lguest/x86/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static struct lguest_pages *lguest_pages(unsigned int cpu)
(SWITCHER_ADDR + SHARED_SWITCHER_PAGES*PAGE_SIZE))[cpu]);
}

static DEFINE_PER_CPU(struct lg_cpu *, last_cpu);
static DEFINE_PER_CPU(struct lg_cpu *, lg_last_cpu);

/*S:010
* We approach the Switcher.
Expand All @@ -90,8 +90,8 @@ static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
* meanwhile). If that's not the case, we pretend everything in the
* Guest has changed.
*/
if (__get_cpu_var(last_cpu) != cpu || cpu->last_pages != pages) {
__get_cpu_var(last_cpu) = cpu;
if (__get_cpu_var(lg_last_cpu) != cpu || cpu->last_pages != pages) {
__get_cpu_var(lg_last_cpu) = cpu;
cpu->last_pages = pages;
cpu->changed = CHANGED_ALL;
}
Expand Down
8 changes: 3 additions & 5 deletions trunk/drivers/s390/net/netiucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ static inline int iucv_dbf_passes(debug_info_t *dbf_grp, int level)
#define IUCV_DBF_TEXT_(name, level, text...) \
do { \
if (iucv_dbf_passes(iucv_dbf_##name, level)) { \
char* iucv_dbf_txt_buf = \
get_cpu_var(iucv_dbf_txt_buf); \
sprintf(iucv_dbf_txt_buf, text); \
debug_text_event(iucv_dbf_##name, level, \
iucv_dbf_txt_buf); \
char* __buf = get_cpu_var(iucv_dbf_txt_buf); \
sprintf(__buf, text); \
debug_text_event(iucv_dbf_##name, level, __buf); \
put_cpu_var(iucv_dbf_txt_buf); \
} \
} while (0)
Expand Down

0 comments on commit bfcb8a8

Please sign in to comment.