#ifndef UCM_BISTRO_BISTRO_PPC64_H_
#define UCM_BISTRO_BISTRO_PPC64_H_
#include "bistro.h"
#include <ucs/type/status.h>
#include <stdint.h>
#include <stddef.h>
#define UCM_BISTRO_PROLOGUE \
uint64_t toc_save; \
asm volatile ("std 2, %0" : "=m" (toc_save)); \
asm volatile ("nop; nop; nop; nop; nop");
#define UCM_BISTRO_EPILOGUE \
asm volatile ("ld 2, %0" : : "m" (toc_save));
ucs_status_t ucm_bistro_patch_toc(void *func_ptr, void *hook,
ucm_bistro_restore_point_t **rp,
uint64_t toc);
static inline ucs_status_t
ucm_bistro_patch(void *func_ptr, void *hook, const char *symbol,
void **orig_func_p, ucm_bistro_restore_point_t **rp)
{
uint64_t toc;
if (orig_func_p != NULL) {
return UCS_ERR_UNSUPPORTED;
}
asm volatile ("std 2, %0" : "=m" (toc));
return ucm_bistro_patch_toc(func_ptr, hook, rp, toc);
}
#endif