blob: 5c4a6a359141a2b7f94080cf6acc3724a67b106b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __SYSDEP_X86_64_SIGCONTEXT_H
8#define __SYSDEP_X86_64_SIGCONTEXT_H
9
Al Viroad694df2011-08-18 20:02:39 +010010#include <generated/user_constants.h>
11
12#define SC_OFFSET(sc, field) \
13 *((unsigned long *) &(((char *) (sc))[HOST_##field]))
14#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2)
15#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR)
16#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO)
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Jeff Dikef0c4cad2007-10-16 01:27:18 -070018#define GET_FAULTINFO_FROM_SC(fi, sc) \
Bodo Stroesserc5784552005-05-05 16:15:31 -070019 { \
20 (fi).cr2 = SC_CR2(sc); \
21 (fi).error_code = SC_ERR(sc); \
22 (fi).trap_no = SC_TRAPNO(sc); \
23 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Al Viro248b74c2011-08-18 20:05:09 +010025#define GET_FAULTINFO_FROM_MC(fi, mc) \
26 { \
27 (fi).cr2 = (mc)->gregs[REG_CR2]; \
28 (fi).error_code = (mc)->gregs[REG_ERR]; \
29 (fi).trap_no = (mc)->gregs[REG_TRAPNO]; \
30 }
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#endif