From: kettenis Date: Wed, 14 Apr 2021 16:06:15 +0000 (+0000) Subject: Unify pivot.h; brings powerpc/powerpc64 support to the usr.bin/lastcomm X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bd23ff4a4cf3e26b0319dcdf7fc35f32133e6eb7;p=openbsd Unify pivot.h; brings powerpc/powerpc64 support to the usr.bin/lastcomm regress test. ok bluhm@ --- diff --git a/regress/sys/kern/stackpivot/pivot.h b/regress/sys/kern/stackpivot/pivot.h index 46a35611119..eec535278ee 100644 --- a/regress/sys/kern/stackpivot/pivot.h +++ b/regress/sys/kern/stackpivot/pivot.h @@ -1,7 +1,7 @@ #ifndef REGRESS_PIVOT_H #define REGRESS_PIVOT_H -static void pivot(size_t *newstack) { +static void pivot(void *newstack) { #if defined(__aarch64__) asm("mov sp, %0; ldr lr, [sp]; ret;" ::"r"(newstack)); #elif defined(__amd64__) diff --git a/regress/usr.bin/lastcomm/pivot.h b/regress/usr.bin/lastcomm/pivot.h index 5cd1c4ef78d..eec535278ee 100644 --- a/regress/usr.bin/lastcomm/pivot.h +++ b/regress/usr.bin/lastcomm/pivot.h @@ -1,5 +1,3 @@ -/* $OpenBSD: pivot.h,v 1.1 2019/09/10 19:01:24 bluhm Exp $ */ - #ifndef REGRESS_PIVOT_H #define REGRESS_PIVOT_H @@ -12,6 +10,10 @@ static void pivot(void *newstack) { asm("mov %0, %%esp; retl;" ::"r"(newstack)); #elif defined(__mips64__) asm("move $sp, %0; ld $ra, 0($sp); jr $ra;" ::"r"(newstack)); +#elif defined(__powerpc64__) + asm("mr %%r1, %0; ld %%r3, 0(%%r1); mtlr %%r3; blr;" ::"r"(newstack)); +#elif defined(__powerpc__) + asm("mr %%r1, %0; lwz %%r3, 0(%%r1); mtlr %%r3; blr;" ::"r"(newstack)); #endif }