Skip to content
Snippets Groups Projects
Commit 7c859457 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

[Continuation] Reformat asm bodies, use semicolon

parent 53fb5c00
No related branches found
No related tags found
1 merge request!420Fix Continuation::setJmp()
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2020-2022 Nicolas Pfeiffer, Florian Schmaus
// Copyright © 2020-2024 Nicolas Pfeiffer, Florian Schmaus
#pragma once
#include <cstdint>
......@@ -19,16 +19,19 @@ class Continuation {
inline __attribute__((always_inline)) Continuation() : ip(nullptr) {
asm volatile(
"mov %%rbp, %0\n\t"
"mov %%rsp, %1\n\t"
: "=rm"(bp), "=rm"(sp)::);
"mov %%rbp, %0;"
"mov %%rsp, %1;"
: "=rm"(bp), "=rm"(sp)
:
:);
};
inline __attribute__((always_inline, noreturn)) void execute(const void *_sp) {
asm("mov %0, %%rsp\n\t"
"mov %1, %%rbp\n\t"
"jmp *%2\n\t" ::"r"(_sp),
"r"(bp), "r"(ip)
asm("mov %0, %%rsp;"
"mov %1, %%rbp;"
"jmp *%2;"
:
: "r"(_sp), "r"(bp), "r"(ip)
: "memory");
__builtin_unreachable();
};
......@@ -45,10 +48,11 @@ class Continuation {
};
inline __attribute__((always_inline, noreturn)) void longJmp(uintptr_t ret) {
asm("mov %0, %%rsp\n\t"
"mov %1, %%rbp\n\t"
"jmp *%2\n\t" ::"r"(sp),
"r"(bp), "r"(ip), "a"(ret)
asm("mov %0, %%rsp;"
"mov %1, %%rbp;"
"jmp *%2;"
:
: "r"(sp), "r"(bp), "r"(ip), "a"(ret)
: "memory");
__builtin_unreachable();
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment