blob: 9f481d3fc1d7f563d16dda680958054473bffb47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#pragma once
#include <shared/types.h>
#include <stdint.h>
struct registers {
/* those are in the order of pushad/popad - so you can load/save this
* struct in (almost) one instruction */
uint32_t edi, esi;
userptr_t ebp, esp;
uint32_t ebx, edx, ecx, eax;
// not part of pushad/popad, but still useful
userptr_t eip;
} __attribute__((__packed__));
// saves a return value according to the SysV ABI
static inline uint64_t regs_savereturn(struct registers *regs, uint64_t value) {
regs->eax = value;
regs->edx = value >> 32;
return value;
}
|