1/*
2 * Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _KERNEL_ARCH_X86_64_IFRAME_H
6#define _KERNEL_ARCH_X86_64_IFRAME_H
7
8
9struct iframe {
10	uint64 type;
11	void* fpu;
12	uint64 r15;
13	uint64 r14;
14	uint64 r13;
15	uint64 r12;
16	uint64 r11;
17	uint64 r10;
18	uint64 r9;
19	uint64 r8;
20	uint64 bp;
21	uint64 si;
22	uint64 di;
23	uint64 dx;
24	uint64 cx;
25	uint64 bx;
26	uint64 ax;
27	uint64 orig_rax;
28	uint64 vector;
29	uint64 error_code;
30	uint64 ip;
31	uint64 cs;
32	uint64 flags;
33
34	// SP and SS are unconditionally present on x86_64, make both names
35	// available.
36	union {
37		uint64 sp;
38		uint64 user_sp;
39	};
40	union {
41		uint64 ss;
42		uint64 user_ss;
43	};
44} _PACKED;
45
46#define IFRAME_IS_USER(f)	(((f)->cs & DPL_USER) == DPL_USER)
47
48
49#endif	/* _KERNEL_ARCH_X86_64_IFRAME_H */
50