summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/registers.h
blob: e365e2c4d89838b2194fd97b070823efdf09a9ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
#include <shared/types.h>
#include <stdint.h>

struct registers {
	uint64_t edi, esi;
	userptr_t ebp, esp;
	uint64_t ebx, edx, ecx, eax;

	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; // TODO check ABI
	return value;
}