10#define ZOS_SAVSTACK_H_
41 static LESavStackAsync& getInstance() {
42 static LESavStackAsync instance;
46 void save(
void* new_sp[1]) {
47 std::lock_guard<std::mutex> lock(mutex_);
48 void *old_sp = *__LE_SAVSTACK_ASYNC_ADDR;
49 *__LE_SAVSTACK_ASYNC_ADDR = new_sp;
51 asm(
" lgr %0,4\n" :
"=r"(new_sp[0])::);
52 map_[__LE_SAVSTACK_ASYNC_ADDR] = old_sp;
56 std::lock_guard<std::mutex> lock(mutex_);
57 *__LE_SAVSTACK_ASYNC_ADDR = map_[__LE_SAVSTACK_ASYNC_ADDR];
58 map_.erase(__LE_SAVSTACK_ASYNC_ADDR);
62 std::lock_guard<std::mutex> lock(mutex_);
63 for (
auto it = map_.cbegin();
64 it != map_.cend(); ) {
65 *(it->first) = it->second;
70 LESavStackAsync(
const LESavStackAsync&) =
delete;
71 LESavStackAsync& operator=(
const LESavStackAsync&) =
delete;
72 LESavStackAsync(LESavStackAsync&&) =
delete;
73 LESavStackAsync& operator=(LESavStackAsync&&) =
delete;
76 LESavStackAsync() =
default;
78 std::map<void **, void *> map_;
#define __Z_EXPORT
Definition zos-macros.h:13