Skip to content

Commit

Permalink
sparc: Fix syscall fallback bugs in VDSO.
Browse files Browse the repository at this point in the history
First, the trap number for 32-bit syscalls is 0x10.

Also, only negate the return value when syscall error is indicated by
the carry bit being set.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 18, 2018
1 parent c343db4 commit 776ca15
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arch/sparc/vdso/vclock_gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@
#define TICK_PRIV_BIT (1ULL << 63)
#endif

#ifdef CONFIG_SPARC64
#define SYSCALL_STRING \
"ta 0x6d;" \
"sub %%g0, %%o0, %%o0;" \
"bcs,a 1f;" \
" sub %%g0, %%o0, %%o0;" \
"1:"
#else
#define SYSCALL_STRING \
"ta 0x10;" \
"bcs,a 1f;" \
" sub %%g0, %%o0, %%o0;" \
"1:"
#endif

#define SYSCALL_CLOBBERS \
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
Expand Down
5 changes: 5 additions & 0 deletions tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max
}

*size += sizeof(struct cpu_map_data);
*size = PERF_ALIGN(*size, sizeof(u64));
return zalloc(*size);
}

Expand Down Expand Up @@ -1560,7 +1561,9 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,

return NULL;
}
#if 0
try_again:
#endif
al->map = map_groups__find(mg, al->addr);
if (al->map == NULL) {
/*
Expand All @@ -1572,13 +1575,15 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
* "[vdso]" dso, but for now lets use the old trick of looking
* in the whole kernel symbol list.
*/
#if 0
if (cpumode == PERF_RECORD_MISC_USER && machine &&
mg != &machine->kmaps &&
machine__kernel_ip(machine, al->addr)) {
mg = &machine->kmaps;
load_map = true;
goto try_again;
}
#endif
} else {
/*
* Kernel maps might be changed when loading symbols so loading
Expand Down

0 comments on commit 776ca15

Please sign in to comment.