Index: kernel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/amd64/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -85,7 +85,7 @@
 endif
 
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag \
-	arch/$(KARCH)/include/arch/kseg_struct.ag \
-	arch/$(KARCH)/include/arch/boot/memmap_struct.ag
+ARCH_AUTOCHECK_HEADERS = \
+	arch/$(KARCH)/include/arch/istate_struct.h \
+	arch/$(KARCH)/include/arch/context_struct.h \
+	arch/$(KARCH)/include/arch/kseg_struct.h \
+	arch/$(KARCH)/include/arch/boot/memmap_struct.h
Index: kernel/arch/amd64/include/arch/boot/memmap_struct.ag
===================================================================
--- kernel/arch/amd64/include/arch/boot/memmap_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../ia32/include/arch/boot/memmap_struct.ag
Index: kernel/arch/amd64/include/arch/boot/memmap_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/boot/memmap_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/amd64/include/arch/boot/memmap_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,48 @@
+/* Copyright (c) 2016 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
+#define KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
+
+#define E820MEMMAP_OFFSET_BASE_ADDRESS  0x00
+#define E820MEMMAP_OFFSET_SIZE          0x08
+#define E820MEMMAP_OFFSET_TYPE          0x10
+#define E820MEMMAP_SIZE                 0x14
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+typedef struct e820memmap {
+	uint64_t base_address;
+	uint64_t size;
+	uint32_t type;
+} __attribute__((packed)) e820memmap_t;
+
+#endif
+#endif
+
Index: kernel/arch/amd64/include/arch/context_struct.ag
===================================================================
--- kernel/arch/amd64/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                #
-                # We include only registers that must be preserved
-                # during function call.
-                #
-
-                {
-                        name : sp,
-                        type : uint64_t
-                },
-                {
-                        name : pc,
-                        type : uint64_t
-                },
-
-                {
-                        name : rbx,
-                        type : uint64_t
-                },
-                {
-                        name : rbp,
-                        type : uint64_t
-                },
-
-                {
-                        name : r12,
-                        type : uint64_t
-                },
-                {
-                        name : r13,
-                        type : uint64_t
-                },
-                {
-                        name : r14,
-                        type : uint64_t
-                },
-                {
-                        name : r15,
-                        type : uint64_t
-                },
-                {
-                        name : tp,
-                        type : uint64_t
-                },
-
-                {
-                        name : ipl,
-                        type : ipl_t
-                }
-        ]
-}
Index: kernel/arch/amd64/include/arch/context_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/amd64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,65 @@
+/* Copyright (c) 2014 Jakub Jermar
+ * All rights preserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#define CONTEXT_OFFSET_SP   0x00
+#define CONTEXT_OFFSET_PC   0x08
+#define CONTEXT_OFFSET_RBX  0x10
+#define CONTEXT_OFFSET_RBP  0x18
+#define CONTEXT_OFFSET_R12  0x20
+#define CONTEXT_OFFSET_R13  0x28
+#define CONTEXT_OFFSET_R14  0x30
+#define CONTEXT_OFFSET_R15  0x38
+#define CONTEXT_OFFSET_TP   0x40
+#define CONTEXT_OFFSET_IPL  0x48
+#define CONTEXT_SIZE        0x50
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+typedef struct context {
+	/* We include only registers that must be preserved
+	 * during function call.
+	 */
+	uint64_t sp;
+	uint64_t pc;
+	uint64_t rbx;
+	uint64_t rbp;
+	uint64_t r12;
+	uint64_t r13;
+	uint64_t r14;
+	uint64_t r15;
+	uint64_t tp;
+	ipl_t ipl;
+} context_t;
+
+#endif
+#endif
+
Index: kernel/arch/amd64/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/amd64/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,150 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        negative-guard: KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard: KERNEL,
-                        include : <stdint.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : rax,
-                        type : uint64_t
-                },
-                {
-                        name : rbx,
-                        type : uint64_t
-                },
-                {
-                        name : rcx,
-                        type : uint64_t
-                },
-                {
-                        name : rdx,
-                        type : uint64_t
-                },
-                {
-                        name : rsi,
-                        type : uint64_t
-                },
-                {
-                        name : rdi,
-                        type : uint64_t
-                },
-                {
-                        name : rbp,
-                        type : uint64_t
-                },
-                {
-                        name : r8,
-                        type : uint64_t
-                },
-                {
-                        name : r9,
-                        type : uint64_t
-                },
-                {
-                        name : r10,
-                        type : uint64_t
-                },
-                {
-                        name : r11,
-                        type : uint64_t
-                },
-                {
-                        name : r12,
-                        type : uint64_t
-                },
-                {
-                        name : r13,
-                        type : uint64_t
-                },
-                {
-                        name : r14,
-                        type : uint64_t
-                },
-                {
-                        name : r15,
-                        type : uint64_t
-                },
-                {
-                        # align rbp_frame on multiple of 16
-                        name : alignment,
-                        type : uint64_t
-                },
-                {
-                        # imitation of frame pointer linkage
-                        name : rbp_frame,
-                        type : uint64_t
-                },
-                {
-                        # imitation of frame address linkage
-                        name : rip_frame,
-                        type : uint64_t
-                },
-                {
-                        # real or fake error word
-                        name : error_word,
-                        type : uint64_t
-                },
-                {
-                        name : rip,
-                        type : uint64_t
-                },
-                {
-                        name : cs,
-                        type : uint64_t
-                },
-                {
-                        name : rflags,
-                        type : uint64_t
-                },
-                {
-                        # only if istate_t is from uspace
-                        name : rsp,
-                        type : uint64_t
-                },
-                {
-                        # only if istate_t is from uspace
-                        name : ss,
-                        type : uint64_t
-                }
-        ]
-}
Index: kernel/arch/amd64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/amd64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,96 @@
+/* Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#define ISTATE_OFFSET_RAX         0x00
+#define ISTATE_OFFSET_RBX         0x08
+#define ISTATE_OFFSET_RCX         0x10
+#define ISTATE_OFFSET_RDX         0x18
+#define ISTATE_OFFSET_RSI         0x20
+#define ISTATE_OFFSET_RDI         0x28
+#define ISTATE_OFFSET_RBP         0x30
+#define ISTATE_OFFSET_R8          0x38
+#define ISTATE_OFFSET_R9          0x40
+#define ISTATE_OFFSET_R10         0x48
+#define ISTATE_OFFSET_R11         0x50
+#define ISTATE_OFFSET_R12         0x58
+#define ISTATE_OFFSET_R13         0x60
+#define ISTATE_OFFSET_R14         0x68
+#define ISTATE_OFFSET_R15         0x70
+#define ISTATE_OFFSET_ALIGNMENT   0x78
+#define ISTATE_OFFSET_RBP_FRAME   0x80
+#define ISTATE_OFFSET_RIP_FRAME   0x88
+#define ISTATE_OFFSET_ERROR_WORD  0x90
+#define ISTATE_OFFSET_RIP         0x98
+#define ISTATE_OFFSET_CS          0xa0
+#define ISTATE_OFFSET_RFLAGS      0xa8
+#define ISTATE_OFFSET_RSP         0xb0
+#define ISTATE_OFFSET_SS          0xb8
+#define ISTATE_SIZE               0xc0
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+typedef struct istate {
+	uint64_t rax;
+	uint64_t rbx;
+	uint64_t rcx;
+	uint64_t rdx;
+	uint64_t rsi;
+	uint64_t rdi;
+	uint64_t rbp;
+	uint64_t r8;
+	uint64_t r9;
+	uint64_t r10;
+	uint64_t r11;
+	uint64_t r12;
+	uint64_t r13;
+	uint64_t r14;
+	uint64_t r15;
+	/* align rbp_frame on multiple of 16 */
+	uint64_t alignment;
+	/* imitation of frame pointer linkage */
+	uint64_t rbp_frame;
+	/* imitation of frame address linkage */
+	uint64_t rip_frame;
+	/* real or fake error word */
+	uint64_t error_word;
+	uint64_t rip;
+	uint64_t cs;
+	uint64_t rflags;
+	/* only if istate_t is from uspace */
+	uint64_t rsp;
+	/* only if istate_t is from uspace */
+	uint64_t ss;
+} istate_t;
+
+#endif
+#endif
+
Index: kernel/arch/amd64/include/arch/kseg_struct.ag
===================================================================
--- kernel/arch/amd64/include/arch/kseg_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-# Copyright (c) 2016 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : kseg,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : ustack_rsp,
-                        type : uint64_t
-                },
-                {
-                        name : kstack_rsp,
-                        type : uint64_t
-                },
-                {
-                        name : fsbase,
-                        type : uint64_t
-                }
-        ]
-}
Index: kernel/arch/amd64/include/arch/kseg_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/kseg_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/amd64/include/arch/kseg_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,48 @@
+/* Copyright (c) 2016 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_KSEG_STRUCT_H_
+#define KERN_ARCH_KSEG_STRUCT_H_
+
+#define KSEG_OFFSET_USTACK_RSP  0x00
+#define KSEG_OFFSET_KSTACK_RSP  0x08
+#define KSEG_OFFSET_FSBASE      0x10
+#define KSEG_SIZE               0x18
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+typedef struct kseg {
+	uint64_t ustack_rsp;
+	uint64_t kstack_rsp;
+	uint64_t fsbase;
+} kseg_t;
+
+#endif
+#endif
+
Index: kernel/arch/arm32/Makefile.inc
===================================================================
--- kernel/arch/arm32/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/arm32/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -96,7 +96,2 @@
 	ARCH_SOURCES += genarch/src/drivers/pl050/pl050.c
 endif
-
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag
-
Index: kernel/arch/arm32/include/arch/context_struct.ag
===================================================================
--- kernel/arch/arm32/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                },
-        ],
-
-        #
-        # Thread context containing registers that must be preserved across
-        # function calls.
-        #
-        members : [
-                {
-                        name : cpu_mode,
-                        type : uint32_t
-                },
-                {
-                        name : sp,
-                        type : uintptr_t
-                },
-                {
-                        name : pc,
-                        type : uintptr_t
-                },
-
-                {
-                        name : r4,
-                        type : uint32_t
-                },
-                {
-                        name : r5,
-                        type : uint32_t
-                },
-                {
-                        name : r6,
-                        type : uint32_t
-                },
-                {
-                        name : r7,
-                        type : uint32_t
-                },
-                {
-                        name : r8,
-                        type : uint32_t
-                },
-                {
-                        name : r9,
-                        type : uint32_t
-                },
-                {
-                        name : r10,
-                        type : uint32_t
-                },
-                {
-                        # r11
-                        name : fp,
-                        type : uint32_t
-                },
-
-                {
-                        name : ipl,
-                        type : ipl_t
-                }
-        ]
-}
-
Index: kernel/arch/arm32/include/arch/context_struct.h
===================================================================
--- kernel/arch/arm32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/arm32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#include <typedefs.h>
+
+// XXX: This struct must match assembly code in src/context.S
+
+/* Thread context containing registers that must be preserved across
+ * function calls.
+ */
+typedef struct context {
+	uint32_t cpu_mode;
+	uintptr_t sp;
+	uintptr_t pc;
+	uint32_t r4;
+	uint32_t r5;
+	uint32_t r6;
+	uint32_t r7;
+	uint32_t r8;
+	uint32_t r9;
+	uint32_t r10;
+	/* r11 */
+	uint32_t fp;
+	ipl_t ipl;
+} context_t;
+
+#endif
+
Index: kernel/arch/arm32/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/arm32/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stdint.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : dummy,
-                        type : uint32_t
-                },
-                {
-                        name : spsr,
-                        type : uint32_t
-                },
-                {
-                        name : sp,
-                        type : uint32_t
-                },
-                {
-                        name : lr,
-                        type : uint32_t
-                },
-
-                {
-                        name : r0,
-                        type : uint32_t
-                },
-                {
-                        name : r1,
-                        type : uint32_t
-                },
-                {
-                        name : r2,
-                        type : uint32_t
-                },
-                {
-                        name : r3,
-                        type : uint32_t
-                },
-                {
-                        name : r4,
-                        type : uint32_t
-                },
-                {
-                        name : r5,
-                        type : uint32_t
-                },
-                {
-                        name : r6,
-                        type : uint32_t
-                },
-                {
-                        name : r7,
-                        type : uint32_t
-                },
-                {
-                        name : r8,
-                        type : uint32_t
-                },
-                {
-                        name : r9,
-                        type : uint32_t
-                },
-                {
-                        name : r10,
-                        type : uint32_t
-                },
-                {
-                        name : fp,
-                        type : uint32_t
-                },
-                {
-                        name : r12,
-                        type : uint32_t
-                },
-
-                {
-                        name : pc,
-                        type : uint32_t
-                }
-        ]
-}
-
Index: kernel/arch/arm32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/arm32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/arm32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#include <stdint.h>
+
+// XXX: Must match assembly code in src/exc_handler.S
+
+typedef struct istate {
+	uint32_t dummy;
+	uint32_t spsr;
+	uint32_t sp;
+	uint32_t lr;
+	uint32_t r0;
+	uint32_t r1;
+	uint32_t r2;
+	uint32_t r3;
+	uint32_t r4;
+	uint32_t r5;
+	uint32_t r6;
+	uint32_t r7;
+	uint32_t r8;
+	uint32_t r9;
+	uint32_t r10;
+	uint32_t fp;
+	uint32_t r12;
+	uint32_t pc;
+} istate_t;
+
+#endif
+
Index: kernel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/ia32/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -102,7 +102,7 @@
 	arch/$(KARCH)/src/syscall.c
 
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag \
-	arch/$(KARCH)/include/arch/boot/memmap_struct.ag
+ARCH_AUTOCHECK_HEADERS = \
+	arch/$(KARCH)/include/arch/istate_struct.h \
+	arch/$(KARCH)/include/arch/context_struct.h \
+	arch/$(KARCH)/include/arch/boot/memmap_struct.h
 
Index: kernel/arch/ia32/include/arch/boot/memmap_struct.ag
===================================================================
--- kernel/arch/ia32/include/arch/boot/memmap_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-# Copyright (c) 2016 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : e820memmap,
-        packed : true,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                },
-        ],
-
-        members : [
-                {
-                        name : base_address,
-                        type : uint64_t
-                },
-                {
-                        name : size,
-                        type : uint64_t
-                },
-                {
-                        name : type,
-                        type : uint32_t
-                }
-        ]
-}
Index: kernel/arch/ia32/include/arch/boot/memmap_struct.h
===================================================================
--- kernel/arch/ia32/include/arch/boot/memmap_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ia32/include/arch/boot/memmap_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,49 @@
+/* Copyright (c) 2014 Jakub Jermar
+ * All rights preserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
+#define KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
+
+#define E820MEMMAP_OFFSET_BASE_ADDRESS  0x00
+#define E820MEMMAP_OFFSET_SIZE          0x08
+#define E820MEMMAP_OFFSET_TYPE          0x10
+#define E820MEMMAP_SIZE                 0x14
+
+#define E820MEMMAP_SIZE_SIZE            0x08
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+typedef struct e820memmap {
+	uint64_t base_address;
+	uint64_t size;
+	uint32_t type;
+} __attribute__((packed)) e820memmap_t;
+
+#endif
+#endif
Index: kernel/arch/ia32/include/arch/context_struct.ag
===================================================================
--- kernel/arch/ia32/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                #
-                # Only save registers that must be preserved across function
-                # calls.
-                #
-
-                {
-                        name : sp,
-                        type : uint32_t
-                },
-                {
-                        name : pc,
-                        type : uint32_t
-                },
-                {
-                        name : ebx,
-                        type : uint32_t
-                },
-                {
-                        name : esi,
-                        type : uint32_t
-                },
-                {
-                        name : edi,
-                        type : uint32_t
-                },
-                {
-                        name : ebp,
-                        type : uint32_t
-                },
-                {
-                        name : tp,
-                        type : uint32_t
-                },
-
-                {
-                        name : ipl,
-                        type : ipl_t
-                }
-        ]
-}
Index: kernel/arch/ia32/include/arch/context_struct.h
===================================================================
--- kernel/arch/ia32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ia32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,59 @@
+/* Copyright (c) 2014 Jakub Jermar
+ * All rights preserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#define CONTEXT_OFFSET_SP   0x00
+#define CONTEXT_OFFSET_PC   0x04
+#define CONTEXT_OFFSET_EBX  0x08
+#define CONTEXT_OFFSET_ESI  0x0c
+#define CONTEXT_OFFSET_EDI  0x10
+#define CONTEXT_OFFSET_EBP  0x14
+#define CONTEXT_OFFSET_TP   0x18
+#define CONTEXT_OFFSET_IPL  0x1c
+#define CONTEXT_SIZE        0x20
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+/* Only save registers that must be preserved across function calls. */
+typedef struct context {
+	uint32_t sp;
+	uint32_t pc;
+	uint32_t ebx;
+	uint32_t esi;
+	uint32_t edi;
+	uint32_t ebp;
+	uint32_t tp;
+	ipl_t ipl;
+} context_t;
+
+#endif
+#endif
+
Index: kernel/arch/ia32/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/ia32/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        negative-guard: KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard: KERNEL,
-                        include : <stdint.h>
-                }
-        ],
-
-        members : [
-
-                #
-                # The strange order of the GPRs is given by the requirement to use the
-                # istate structure for both regular interrupts and exceptions as well
-                # as for syscall handlers which use this order as an optimization.
-                #
-
-                {
-                        name : edx,
-                        type : uint32_t
-                },
-                {
-                        name : ecx,
-                        type : uint32_t
-                },
-                {
-                        name : ebx,
-                        type : uint32_t
-                },
-                {
-                        name : esi,
-                        type : uint32_t
-                },
-                {
-                        name : edi,
-                        type : uint32_t
-                },
-                {
-                        name : ebp,
-                        type : uint32_t
-                },
-                {
-                        name : eax,
-                        type : uint32_t
-                },
-
-                {
-                        # imitation of frame pointer linkage
-                        name : ebp_frame,
-                        type : uint32_t
-                },
-                {
-                        # imitation of return address linkage
-                        name : eip_frame,
-                        type : uint32_t
-                },
-
-                {
-                        name : gs,
-                        type : uint32_t
-                },
-                {
-                        name : fs,
-                        type : uint32_t
-                },
-                {
-                        name : es,
-                        type : uint32_t
-                },
-                {
-                        name : ds,
-                        type : uint32_t
-                },
-
-                {
-                        # real or fake error word
-                        name : error_word,
-                        type : uint32_t
-                },
-                {
-                        name : eip,
-                        type : uint32_t
-                },
-                {
-                        name : cs,
-                        type : uint32_t
-                },
-                {
-                        name : eflags,
-                        type : uint32_t
-                },
-                {
-                        # only if istate_t is from uspace
-                        name : esp,
-                        type : uint32_t
-                },
-                {
-                        # only if istate_t is from uspace
-                        name : ss,
-                        type : uint32_t
-                }
-        ]
-}
Index: kernel/arch/ia32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/ia32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ia32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,109 @@
+/* Copyright (c) 2014 Jakub Jermar
+ * All rights preserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#define ISTATE_OFFSET_EDX 0
+#define ISTATE_SIZE_EDX 4
+#define ISTATE_OFFSET_ECX 4
+#define ISTATE_SIZE_ECX 4
+#define ISTATE_OFFSET_EBX 8
+#define ISTATE_SIZE_EBX 4
+#define ISTATE_OFFSET_ESI 12
+#define ISTATE_SIZE_ESI 4
+#define ISTATE_OFFSET_EDI 16
+#define ISTATE_SIZE_EDI 4
+#define ISTATE_OFFSET_EBP 20
+#define ISTATE_SIZE_EBP 4
+#define ISTATE_OFFSET_EAX 24
+#define ISTATE_SIZE_EAX 4
+#define ISTATE_OFFSET_EBP_FRAME 28
+#define ISTATE_SIZE_EBP_FRAME 4
+#define ISTATE_OFFSET_EIP_FRAME 32
+#define ISTATE_SIZE_EIP_FRAME 4
+#define ISTATE_OFFSET_GS 36
+#define ISTATE_SIZE_GS 4
+#define ISTATE_OFFSET_FS 40
+#define ISTATE_SIZE_FS 4
+#define ISTATE_OFFSET_ES 44
+#define ISTATE_SIZE_ES 4
+#define ISTATE_OFFSET_DS 48
+#define ISTATE_SIZE_DS 4
+#define ISTATE_OFFSET_ERROR_WORD 52
+#define ISTATE_SIZE_ERROR_WORD 4
+#define ISTATE_OFFSET_EIP 56
+#define ISTATE_SIZE_EIP 4
+#define ISTATE_OFFSET_CS 60
+#define ISTATE_SIZE_CS 4
+#define ISTATE_OFFSET_EFLAGS 64
+#define ISTATE_SIZE_EFLAGS 4
+#define ISTATE_OFFSET_ESP 68
+#define ISTATE_SIZE_ESP 4
+#define ISTATE_OFFSET_SS 72
+#define ISTATE_SIZE_SS 4
+#define ISTATE_SIZE 76
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+/*
+ * The strange order of the GPRs is given by the requirement to use the
+ * istate structure for both regular interrupts and exceptions as well
+ * as for syscall handlers which use this order as an optimization.
+ */
+typedef struct istate {
+	uint32_t edx;
+	uint32_t ecx;
+	uint32_t ebx;
+	uint32_t esi;
+	uint32_t edi;
+	uint32_t ebp;
+	uint32_t eax;
+	/* imitation of frame pointer linkage */
+	uint32_t ebp_frame;
+	/* imitation of return address linkage */
+	uint32_t eip_frame;
+	uint32_t gs;
+	uint32_t fs;
+	uint32_t es;
+	uint32_t ds;
+	/* real or fake error word */
+	uint32_t error_word;
+	uint32_t eip;
+	uint32_t cs;
+	uint32_t eflags;
+	/* only if istate_t is from uspace */
+	uint32_t esp;
+	/* only if istate_t is from uspace */
+	uint32_t ss;
+} istate_t;
+
+#endif
+#endif
+
Index: kernel/arch/ia64/Makefile.inc
===================================================================
--- kernel/arch/ia64/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/ia64/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -72,6 +72,6 @@
 endif
 
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag
+ARCH_AUTOCHECK_HEADERS = \
+	arch/$(KARCH)/include/arch/istate_struct.h \
+	arch/$(KARCH)/include/arch/context_struct.h
 
Index: kernel/arch/ia64/include/arch/context_struct.ag
===================================================================
--- kernel/arch/ia64/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,235 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        #
-        # Only save registers that must be preserved across function calls.
-        #
-        members : [
-                #
-                # Application registers
-                #
-                {
-                        name : ar_pfs,
-                        type : uint64_t
-                },
-                {
-                        name : ar_unat_caller,
-                        type : uint64_t
-                },
-                {
-                        name : ar_unat_callee,
-                        type : uint64_t
-                },
-                {
-                        name : ar_rsc,
-                        type : uint64_t
-                },
-                {
-                        # ar_bsp
-                        name : bsp,
-                        type : uint64_t
-                },
-                {
-                        name : ar_rnat,
-                        type : uint64_t
-                },
-                {
-                        name : ar_lc,
-                        type : uint64_t
-                },
-
-
-                #
-                # General registers
-                #
-                {
-                        name : r1,
-                        type : uint64_t
-                },
-                {
-                        name : r4,
-                        type : uint64_t
-                },
-                {
-                        name : r5,
-                        type : uint64_t
-                },
-                {
-                        name : r6,
-                        type : uint64_t
-                },
-                {
-                        name : r7,
-                        type : uint64_t
-                },
-                {
-                        # r12
-                        name : sp,
-                        type : uint64_t
-                },
-                {
-                        name : r13,
-                        type : uint64_t
-                },
-
-
-                #
-                # Branch registers
-                #
-                {
-                        # b0
-                        name : pc,
-                        type : uint64_t
-                },
-                {
-                        name : b1,
-                        type : uint64_t
-                },
-                {
-                        name : b2,
-                        type : uint64_t
-                },
-                {
-                        name : b3,
-                        type : uint64_t
-                },
-                {
-                        name : b4,
-                        type : uint64_t
-                },
-                {
-                        name : b5,
-                        type : uint64_t
-                },
-
-
-                #
-                # Predicate registers
-                #
-                {
-                        name : pr,
-                        type : uint64_t
-                },
-
-                {
-                        name : f2,
-                        type : uint128_t
-                },
-                {
-                        name : f3,
-                        type : uint128_t
-                },
-                {
-                        name : f4,
-                        type : uint128_t
-                },
-                {
-                        name : f5,
-                        type : uint128_t
-                },
-
-                {
-                        name : f16,
-                        type : uint128_t
-                },
-                {
-                        name : f17,
-                        type : uint128_t
-                },
-                {
-                        name : f18,
-                        type : uint128_t
-                },
-                {
-                        name : f19,
-                        type : uint128_t
-                },
-                {
-                        name : f20,
-                        type : uint128_t
-                },
-                {
-                        name : f21,
-                        type : uint128_t
-                },
-                {
-                        name : f22,
-                        type : uint128_t
-                },
-                {
-                        name : f23,
-                        type : uint128_t
-                },
-                {
-                        name : f24,
-                        type : uint128_t
-                },
-                {
-                        name : f25,
-                        type : uint128_t
-                },
-                {
-                        name : f26,
-                        type : uint128_t
-                },
-                {
-                        name : f27,
-                        type : uint128_t
-                },
-                {
-                        name : f28,
-                        type : uint128_t
-                },
-                {
-                        name : f29,
-                        type : uint128_t
-                },
-                {
-                        name : f30,
-                        type : uint128_t
-                },
-                {
-                        name : f31,
-                        type : uint128_t
-                },
-
-                {
-                        name : ipl,
-                        type: ipl_t
-                }
-        ]
-}
-
Index: kernel/arch/ia64/include/arch/context_struct.h
===================================================================
--- kernel/arch/ia64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ia64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,138 @@
+/* Copyright (c) 2014 Jakub Jermar
+ * All rights preserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#define CONTEXT_OFFSET_AR_PFS          0x00
+#define CONTEXT_OFFSET_AR_UNAT_CALLER  0x08
+#define CONTEXT_OFFSET_AR_UNAT_CALLEE  0x10
+#define CONTEXT_OFFSET_AR_RSC          0x18
+#define CONTEXT_OFFSET_BSP             0x20
+#define CONTEXT_OFFSET_AR_RNAT         0x28
+#define CONTEXT_OFFSET_AR_LC           0x30
+#define CONTEXT_OFFSET_R1              0x38
+#define CONTEXT_OFFSET_R4              0x40
+#define CONTEXT_OFFSET_R5              0x48
+#define CONTEXT_OFFSET_R6              0x50
+#define CONTEXT_OFFSET_R7              0x58
+#define CONTEXT_OFFSET_SP              0x60
+#define CONTEXT_OFFSET_R13             0x68
+#define CONTEXT_OFFSET_PC              0x70
+#define CONTEXT_OFFSET_B1              0x78
+#define CONTEXT_OFFSET_B2              0x80
+#define CONTEXT_OFFSET_B3              0x88
+#define CONTEXT_OFFSET_B4              0x90
+#define CONTEXT_OFFSET_B5              0x98
+#define CONTEXT_OFFSET_PR              0xa0
+#define CONTEXT_OFFSET_F2              0xb0
+#define CONTEXT_OFFSET_F3              0xc0
+#define CONTEXT_OFFSET_F4              0xd0
+#define CONTEXT_OFFSET_F5              0xe0
+#define CONTEXT_OFFSET_F16             0xf0
+#define CONTEXT_OFFSET_F17             0x100
+#define CONTEXT_OFFSET_F18             0x110
+#define CONTEXT_OFFSET_F19             0x120
+#define CONTEXT_OFFSET_F20             0x130
+#define CONTEXT_OFFSET_F21             0x140
+#define CONTEXT_OFFSET_F22             0x150
+#define CONTEXT_OFFSET_F23             0x160
+#define CONTEXT_OFFSET_F24             0x170
+#define CONTEXT_OFFSET_F25             0x180
+#define CONTEXT_OFFSET_F26             0x190
+#define CONTEXT_OFFSET_F27             0x1a0
+#define CONTEXT_OFFSET_F28             0x1b0
+#define CONTEXT_OFFSET_F29             0x1c0
+#define CONTEXT_OFFSET_F30             0x1d0
+#define CONTEXT_OFFSET_F31             0x1e0
+#define CONTEXT_OFFSET_IPL             0x1f0
+#define CONTEXT_SIZE                   0x200
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+// Only save registers that must be preserved across function calls.
+typedef struct context {
+	// Application registers.
+	uint64_t ar_pfs;
+	uint64_t ar_unat_caller;
+	uint64_t ar_unat_callee;
+	uint64_t ar_rsc;
+	// ar_bsp
+	uint64_t bsp;
+	uint64_t ar_rnat;
+	uint64_t ar_lc;
+
+	// General registers.
+	uint64_t r1;
+	uint64_t r4;
+	uint64_t r5;
+	uint64_t r6;
+	uint64_t r7;
+	// r12
+	uint64_t sp;
+	uint64_t r13;
+
+	// Branch registers.
+	// b0
+	uint64_t pc;
+	uint64_t b1;
+	uint64_t b2;
+	uint64_t b3;
+	uint64_t b4;
+	uint64_t b5;
+
+	// Predicate registers.
+	uint64_t pr;
+	uint128_t f2;
+	uint128_t f3;
+	uint128_t f4;
+	uint128_t f5;
+	uint128_t f16;
+	uint128_t f17;
+	uint128_t f18;
+	uint128_t f19;
+	uint128_t f20;
+	uint128_t f21;
+	uint128_t f22;
+	uint128_t f23;
+	uint128_t f24;
+	uint128_t f25;
+	uint128_t f26;
+	uint128_t f27;
+	uint128_t f28;
+	uint128_t f29;
+	uint128_t f30;
+	uint128_t f31;
+
+	ipl_t ipl;
+} context_t;
+
+#endif /* __ASSEMBLER__ */
+#endif
+
Index: kernel/arch/ia64/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/ia64/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,267 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        guard : KERNEL,
-                        include : <arch/register.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stdint.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <libarch/register.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : f2,
-                        type : uint128_t
-                },
-                {
-                        name : f3,
-                        type : uint128_t
-                },
-                {
-                        name : f4,
-                        type : uint128_t
-                },
-                {
-                        name : f5,
-                        type : uint128_t
-                },
-                {
-                        name : f6,
-                        type : uint128_t
-                },
-                {
-                        name : f7,
-                        type : uint128_t
-                },
-                {
-                        name : f8,
-                        type : uint128_t
-                },
-                {
-                        name : f9,
-                        type : uint128_t
-                },
-                {
-                        name : f10,
-                        type : uint128_t
-                },
-                {
-                        name : f11,
-                        type : uint128_t
-                },
-                {
-                        name : f12,
-                        type : uint128_t
-                },
-                {
-                        name : f13,
-                        type : uint128_t
-                },
-                {
-                        name : f14,
-                        type : uint128_t
-                },
-                {
-                        name : f15,
-                        type : uint128_t
-                },
-                {
-                        name : f16,
-                        type : uint128_t
-                },
-                {
-                        name : f17,
-                        type : uint128_t
-                },
-                {
-                        name : f18,
-                        type : uint128_t
-                },
-                {
-                        name : f19,
-                        type : uint128_t
-                },
-                {
-                        name : f20,
-                        type : uint128_t
-                },
-                {
-                        name : f21,
-                        type : uint128_t
-                },
-                {
-                        name : f22,
-                        type : uint128_t
-                },
-                {
-                        name : f23,
-                        type : uint128_t
-                },
-                {
-                        name : f24,
-                        type : uint128_t
-                },
-                {
-                        name : f25,
-                        type : uint128_t
-                },
-                {
-                        name : f26,
-                        type : uint128_t
-                },
-                {
-                        name : f27,
-                        type : uint128_t
-                },
-                {
-                        name : f28,
-                        type : uint128_t
-                },
-                {
-                        name : f29,
-                        type : uint128_t
-                },
-                {
-                        name : f30,
-                        type : uint128_t
-                },
-                {
-                        name : f31,
-                        type : uint128_t
-                },
-
-                {
-                        name : ar_bsp,
-                        type : uintptr_t
-                },
-                {
-                        name : ar_bspstore,
-                        type : uintptr_t
-                },
-                {
-                        name : ar_bspstore_new,
-                        type : uintptr_t
-                },
-                {
-                        name : ar_rnat,
-                        type : uint64_t
-                },
-                {
-                        name : ar_ifs,
-                        type : uint64_t
-                },
-                {
-                        name : ar_pfs,
-                        type : uint64_t
-                },
-                {
-                        name : ar_rsc,
-                        type : uint64_t
-                },
-                {
-                        name : cr_ifa,
-                        type : uintptr_t
-                },
-                {
-                        name : cr_isr,
-                        type : cr_isr_t
-                },
-                {
-                        name : cr_iipa,
-                        type : uintptr_t
-                },
-                {
-                        name : cr_ipsr,
-                        type : psr_t
-                },
-                {
-                        name : cr_iip,
-                        type : uintptr_t
-                },
-                {
-                        name : pr,
-                        type : uint64_t
-                },
-                {
-                        name : sp,
-                        type : uintptr_t
-                },
-
-                #
-                # The following variables are defined only for break_instruction
-                # handler.
-                #
-                {
-                        name : in0,
-                        type : uint64_t
-                },
-                {
-                        name : in1,
-                        type : uint64_t
-                },
-                {
-                        name : in2,
-                        type : uint64_t
-                },
-                {
-                        name : in3,
-                        type : uint64_t
-                },
-                {
-                        name : in4,
-                        type : uint64_t
-                },
-                {
-                        name : in5,
-                        type : uint64_t
-                },
-                {
-                        name : in6,
-                        type : uint64_t
-                }
-        ]
-}
-
Index: kernel/arch/ia64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/ia64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ia64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,155 @@
+/* Copyright (c) 2014 Jakub Jermar
+ * All rights preserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#define ISTATE_OFFSET_F2                0x000
+#define ISTATE_OFFSET_F3                0x010
+#define ISTATE_OFFSET_F4                0x020
+#define ISTATE_OFFSET_F5                0x030
+#define ISTATE_OFFSET_F6                0x040
+#define ISTATE_OFFSET_F7                0x050
+#define ISTATE_OFFSET_F8                0x060
+#define ISTATE_OFFSET_F9                0x070
+#define ISTATE_OFFSET_F10               0x080
+#define ISTATE_OFFSET_F11               0x090
+#define ISTATE_OFFSET_F12               0x0a0
+#define ISTATE_OFFSET_F13               0x0b0
+#define ISTATE_OFFSET_F14               0x0c0
+#define ISTATE_OFFSET_F15               0x0d0
+#define ISTATE_OFFSET_F16               0x0e0
+#define ISTATE_OFFSET_F17               0x0f0
+#define ISTATE_OFFSET_F18               0x100
+#define ISTATE_OFFSET_F19               0x110
+#define ISTATE_OFFSET_F20               0x120
+#define ISTATE_OFFSET_F21               0x130
+#define ISTATE_OFFSET_F22               0x140
+#define ISTATE_OFFSET_F23               0x150
+#define ISTATE_OFFSET_F24               0x160
+#define ISTATE_OFFSET_F25               0x170
+#define ISTATE_OFFSET_F26               0x180
+#define ISTATE_OFFSET_F27               0x190
+#define ISTATE_OFFSET_F28               0x1a0
+#define ISTATE_OFFSET_F29               0x1b0
+#define ISTATE_OFFSET_F30               0x1c0
+#define ISTATE_OFFSET_F31               0x1d0
+#define ISTATE_OFFSET_AR_BSP            0x1e0
+#define ISTATE_OFFSET_AR_BSPSTORE       0x1e8
+#define ISTATE_OFFSET_AR_BSPSTORE_NEW   0x1f0
+#define ISTATE_OFFSET_AR_RNAT           0x1f8
+#define ISTATE_OFFSET_AR_IFS            0x200
+#define ISTATE_OFFSET_AR_PFS            0x208
+#define ISTATE_OFFSET_AR_RSC            0x210
+#define ISTATE_OFFSET_CR_IFA            0x218
+#define ISTATE_OFFSET_CR_ISR            0x220
+#define ISTATE_OFFSET_CR_IIPA           0x228
+#define ISTATE_OFFSET_CR_IPSR           0x230
+#define ISTATE_OFFSET_CR_IIP            0x238
+#define ISTATE_OFFSET_PR                0x240
+#define ISTATE_OFFSET_SP                0x248
+#define ISTATE_OFFSET_IN0               0x250
+#define ISTATE_OFFSET_IN1               0x258
+#define ISTATE_OFFSET_IN2               0x260
+#define ISTATE_OFFSET_IN3               0x268
+#define ISTATE_OFFSET_IN4               0x270
+#define ISTATE_OFFSET_IN5               0x278
+#define ISTATE_OFFSET_IN6               0x280
+#define ISTATE_SIZE                     0x290
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+#ifdef KERNEL
+#include <typedefs.h>
+#include <arch/register.h>
+#else
+#include <stddef.h>
+#include <libarch/register.h>
+#endif
+
+typedef struct istate {
+	uint128_t f2;
+	uint128_t f3;
+	uint128_t f4;
+	uint128_t f5;
+	uint128_t f6;
+	uint128_t f7;
+	uint128_t f8;
+	uint128_t f9;
+	uint128_t f10;
+	uint128_t f11;
+	uint128_t f12;
+	uint128_t f13;
+	uint128_t f14;
+	uint128_t f15;
+	uint128_t f16;
+	uint128_t f17;
+	uint128_t f18;
+	uint128_t f19;
+	uint128_t f20;
+	uint128_t f21;
+	uint128_t f22;
+	uint128_t f23;
+	uint128_t f24;
+	uint128_t f25;
+	uint128_t f26;
+	uint128_t f27;
+	uint128_t f28;
+	uint128_t f29;
+	uint128_t f30;
+	uint128_t f31;
+	uintptr_t ar_bsp;
+	uintptr_t ar_bspstore;
+	uintptr_t ar_bspstore_new;
+	uint64_t ar_rnat;
+	uint64_t ar_ifs;
+	uint64_t ar_pfs;
+	uint64_t ar_rsc;
+	uintptr_t cr_ifa;
+	cr_isr_t cr_isr;
+	uintptr_t cr_iipa;
+	psr_t cr_ipsr;
+	uintptr_t cr_iip;
+	uint64_t pr;
+	uintptr_t sp;
+
+	// The following variables are defined only for break_instruction
+	// handler.
+	uint64_t in0;
+	uint64_t in1;
+	uint64_t in2;
+	uint64_t in3;
+	uint64_t in4;
+	uint64_t in5;
+	uint64_t in6;
+} istate_t;
+
+#endif
+#endif
+
Index: kernel/arch/mips32/Makefile.inc
===================================================================
--- kernel/arch/mips32/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/mips32/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -88,6 +88,6 @@
 endif
 
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag \
-	arch/$(KARCH)/include/arch/fpu_context_struct.ag
+ARCH_AUTOCHECK_HEADERS = \
+	arch/$(KARCH)/include/arch/istate_struct.h \
+	arch/$(KARCH)/include/arch/context_struct.h \
+	arch/$(KARCH)/include/arch/fpu_context_struct.h
Index: kernel/arch/mips32/include/arch/context_struct.ag
===================================================================
--- kernel/arch/mips32/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                #
-                # Only save registers that must be preserved across function
-                # calls.
-                #
-                {
-                        name : sp,
-                        type : uint32_t
-                },
-                {
-                        name : pc,
-                        type : uint32_t
-                },
-
-                {
-                        name : s0,
-                        type : uint32_t
-                },
-                {
-                        name : s1,
-                        type : uint32_t
-                },
-                {
-                        name : s2,
-                        type : uint32_t
-                },
-                {
-                        name : s3,
-                        type : uint32_t
-                },
-                {
-                        name : s4,
-                        type : uint32_t
-                },
-                {
-                        name : s5,
-                        type : uint32_t
-                },
-                {
-                        name : s6,
-                        type : uint32_t
-                },
-                {
-                        name : s7,
-                        type : uint32_t
-                },
-                {
-                        name : s8,
-                        type : uint32_t
-                },
-                {
-                        name : gp,
-                        type : uint32_t
-                },
-
-                {
-                        name : ipl,
-                        type : ipl_t
-                }
-        ]
-}
Index: kernel/arch/mips32/include/arch/context_struct.h
===================================================================
--- kernel/arch/mips32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/mips32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#define CONTEXT_OFFSET_SP  0x00
+#define CONTEXT_OFFSET_PC  0x04
+#define CONTEXT_OFFSET_S0  0x08
+#define CONTEXT_OFFSET_S1  0x0c
+#define CONTEXT_OFFSET_S2  0x10
+#define CONTEXT_OFFSET_S3  0x14
+#define CONTEXT_OFFSET_S4  0x18
+#define CONTEXT_OFFSET_S5  0x1c
+#define CONTEXT_OFFSET_S6  0x20
+#define CONTEXT_OFFSET_S7  0x24
+#define CONTEXT_OFFSET_S8  0x28
+#define CONTEXT_OFFSET_GP  0x2c
+#define CONTEXT_OFFSET_IPL 0x30
+#define CONTEXT_SIZE       0x34
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+typedef struct context {
+	/* Only save registers that must be preserved across function calls. */
+	uint32_t sp;
+	uint32_t pc;
+	uint32_t s0;
+	uint32_t s1;
+	uint32_t s2;
+	uint32_t s3;
+	uint32_t s4;
+	uint32_t s5;
+	uint32_t s6;
+	uint32_t s7;
+	uint32_t s8;
+	uint32_t gp;
+	ipl_t ipl;
+} context_t;
+
+#endif
+#endif
+
Index: kernel/arch/mips32/include/arch/fpu_context_struct.ag
===================================================================
--- kernel/arch/mips32/include/arch/fpu_context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : fpu_context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : dregs,
-                        type : sysarg_t,
-                        elements: 32
-                },
-                {
-                        name : cregs,
-                        type : sysarg_t,
-                        elements : 32
-                }
-        ]
-}
Index: kernel/arch/mips32/include/arch/fpu_context_struct.h
===================================================================
--- kernel/arch/mips32/include/arch/fpu_context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/mips32/include/arch/fpu_context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_FPU_CONTEXT_STRUCT_H_
+#define KERN_ARCH_FPU_CONTEXT_STRUCT_H_
+
+#define FPU_CONTEXT_OFFSET_DREGS  0
+#define FPU_CONTEXT_OFFSET_CREGS  128
+#define FPU_CONTEXT_SIZE          256
+
+#define FPU_CONTEXT_SIZE_DREGS 128
+#define FPU_CONTEXT_SIZE_CREGS 128
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+typedef struct fpu_context {
+	sysarg_t dregs[32];
+	sysarg_t cregs[32];
+} fpu_context_t;
+
+#endif
+#endif
+
Index: kernel/arch/mips32/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/mips32/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,211 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stdint.h>
-                }
-        ],
-
-        members : [
-                #
-                # The first seven registers are arranged so that the istate structure
-                # can be used both for exception handlers and for the syscall handler.
-                #
-                {
-                        # arg1
-                        name : a0,
-                        type : uint32_t
-                },
-                {
-                        # arg2
-                        name : a1,
-                        type : uint32_t
-                },
-                {
-                        # arg3
-                        name : a2,
-                        type : uint32_t
-                },
-                {
-                        # arg4
-                        name : a3,
-                        type : uint32_t
-                },
-                {
-                        # arg5
-                        name : t0,
-                        type : uint32_t
-                },
-                {
-                        # arg6
-                        name : t1,
-                        type : uint32_t
-                },
-                {
-                        # arg7
-                        name : v0,
-                        type : uint32_t
-                },
-                {
-                        name : v1,
-                        type : uint32_t
-                },
-                {
-                        name : at,
-                        type : uint32_t
-                },
-                {
-                        name : t2,
-                        type : uint32_t
-                },
-                {
-                        name : t3,
-                        type : uint32_t
-                },
-                {
-                        name : t4,
-                        type : uint32_t
-                },
-                {
-                        name : t5,
-                        type : uint32_t
-                },
-                {
-                        name : t6,
-                        type : uint32_t
-                },
-                {
-                        name : t7,
-                        type : uint32_t
-                },
-                {
-                        name : s0,
-                        type : uint32_t
-                },
-                {
-                        name : s1,
-                        type : uint32_t
-                },
-                {
-                        name : s2,
-                        type : uint32_t
-                },
-                {
-                        name : s3,
-                        type : uint32_t
-                },
-                {
-                        name : s4,
-                        type : uint32_t
-                },
-                {
-                        name : s5,
-                        type : uint32_t
-                },
-                {
-                        name : s6,
-                        type : uint32_t
-                },
-                {
-                        name : s7,
-                        type : uint32_t
-                },
-                {
-                        name : t8,
-                        type : uint32_t
-                },
-                {
-                        name : t9,
-                        type : uint32_t
-                },
-                {
-                        name : kt0,
-                        type : uint32_t
-                },
-                {
-                        # We use it as thread-local pointer
-                        name : kt1,
-                        type : uint32_t
-                },
-                {
-                        name : gp,
-                        type : uint32_t
-                },
-                {
-                        name : sp,
-                        type : uint32_t
-                },
-                {
-                        name : s8,
-                        type : uint32_t
-                },
-                {
-                        name : ra,
-                        type : uint32_t
-                },
-
-                {
-                        name : lo,
-                        type : uint32_t
-                },
-                {
-                        name : hi,
-                        type : uint32_t
-                },
-
-                {
-                        # cp0_status
-                        name : status,
-                        type : uint32_t
-                },
-                {
-                        # cp0_epc
-                        name : epc,
-                        type : uint32_t
-                },
-
-                {
-                        # to make sizeof(istate_t) a multiple of 8 */
-                        name : alignment,
-                        type : uint32_t
-                }
-
-        ]
-}
Index: kernel/arch/mips32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/mips32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/mips32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#define ISTATE_OFFSET_A0         0x00
+#define ISTATE_OFFSET_A1         0x04
+#define ISTATE_OFFSET_A2         0x08
+#define ISTATE_OFFSET_A3         0x0c
+#define ISTATE_OFFSET_T0         0x10
+#define ISTATE_OFFSET_T1         0x14
+#define ISTATE_OFFSET_V0         0x18
+#define ISTATE_OFFSET_V1         0x1c
+#define ISTATE_OFFSET_AT         0x20
+#define ISTATE_OFFSET_T2         0x24
+#define ISTATE_OFFSET_T3         0x28
+#define ISTATE_OFFSET_T4         0x2c
+#define ISTATE_OFFSET_T5         0x30
+#define ISTATE_OFFSET_T6         0x34
+#define ISTATE_OFFSET_T7         0x38
+#define ISTATE_OFFSET_S0         0x3c
+#define ISTATE_OFFSET_S1         0x40
+#define ISTATE_OFFSET_S2         0x44
+#define ISTATE_OFFSET_S3         0x48
+#define ISTATE_OFFSET_S4         0x4c
+#define ISTATE_OFFSET_S5         0x50
+#define ISTATE_OFFSET_S6         0x54
+#define ISTATE_OFFSET_S7         0x58
+#define ISTATE_OFFSET_T8         0x5c
+#define ISTATE_OFFSET_T9         0x60
+#define ISTATE_OFFSET_KT0        0x64
+#define ISTATE_OFFSET_KT1        0x68
+#define ISTATE_OFFSET_GP         0x6c
+#define ISTATE_OFFSET_SP         0x70
+#define ISTATE_OFFSET_S8         0x74
+#define ISTATE_OFFSET_RA         0x78
+#define ISTATE_OFFSET_LO         0x7c
+#define ISTATE_OFFSET_HI         0x80
+#define ISTATE_OFFSET_STATUS     0x84
+#define ISTATE_OFFSET_EPC        0x88
+#define ISTATE_OFFSET_ALIGNMENT  0x8c
+#define ISTATE_SIZE              0x90
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+#ifdef KERNEL
+#include <typedefs.h>
+#else
+#include <stddef.h>
+#endif
+
+typedef struct istate {
+	/*
+	 * The first seven registers are arranged so that the istate structure
+	 * can be used both for exception handlers and for the syscall handler.
+	 */
+
+	uint32_t a0;  // arg1
+	uint32_t a1;  // arg2
+	uint32_t a2;  // arg3
+	uint32_t a3;  // arg4
+	uint32_t t0;  // arg5
+	uint32_t t1;  // arg6
+	uint32_t v0;  // arg7
+	uint32_t v1;
+	uint32_t at;
+	uint32_t t2;
+	uint32_t t3;
+	uint32_t t4;
+	uint32_t t5;
+	uint32_t t6;
+	uint32_t t7;
+	uint32_t s0;
+	uint32_t s1;
+	uint32_t s2;
+	uint32_t s3;
+	uint32_t s4;
+	uint32_t s5;
+	uint32_t s6;
+	uint32_t s7;
+	uint32_t t8;
+	uint32_t t9;
+	uint32_t kt0;
+	/* We use it as thread-local pointer */
+	uint32_t kt1;
+	uint32_t gp;
+	uint32_t sp;
+	uint32_t s8;
+	uint32_t ra;
+	uint32_t lo;
+	uint32_t hi;
+	/* cp0_status */
+	uint32_t status;
+	/* cp0_epc */
+	uint32_t epc;
+	/* to make sizeof(istate_t) a multiple of 8 */
+	uint32_t alignment;
+} istate_t;
+
+#endif
+#endif
+
Index: kernel/arch/ppc32/Makefile.inc
===================================================================
--- kernel/arch/ppc32/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/ppc32/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -59,7 +59,7 @@
 	arch/$(KARCH)/src/drivers/pic.c
 
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag \
-	arch/$(KARCH)/include/arch/fpu_context_struct.ag
+ARCH_AUTOCHECK_HEADERS = \
+	arch/$(KARCH)/include/arch/istate_struct.h \
+	arch/$(KARCH)/include/arch/context_struct.h \
+	arch/$(KARCH)/include/arch/fpu_context_struct.h
 
Index: kernel/arch/ppc32/include/arch/context_struct.ag
===================================================================
--- kernel/arch/ppc32/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : sp,
-                        type : uint32_t
-                },
-                {
-                        name : pc,
-                        type : uint32_t
-                },
-
-                {
-                        name : r2,
-                        type : uint32_t
-                },
-                {
-                        name : r13,
-                        type : uint32_t
-                },
-                {
-                        name : r14,
-                        type : uint32_t
-                },
-                {
-                        name : r15,
-                        type : uint32_t
-                },
-                {
-                        name : r16,
-                        type : uint32_t
-                },
-                {
-                        name : r17,
-                        type : uint32_t
-                },
-                {
-                        name : r18,
-                        type : uint32_t
-                },
-                {
-                        name : r19,
-                        type : uint32_t
-                },
-                {
-                        name : r20,
-                        type : uint32_t
-                },
-                {
-                        name : r21,
-                        type : uint32_t
-                },
-                {
-                        name : r22,
-                        type : uint32_t
-                },
-                {
-                        name : r23,
-                        type : uint32_t
-                },
-                {
-                        name : r24,
-                        type : uint32_t
-                },
-                {
-                        name : r25,
-                        type : uint32_t
-                },
-                {
-                        name : r26,
-                        type : uint32_t
-                },
-                {
-                        name : r27,
-                        type : uint32_t
-                },
-                {
-                        name : r28,
-                        type : uint32_t
-                },
-                {
-                        name : r29,
-                        type : uint32_t
-                },
-                {
-                        name : r30,
-                        type : uint32_t
-                },
-                {
-                        name : r31,
-                        type : uint32_t
-                },
-
-                {
-                        name : cr,
-                        type : uint32_t
-                },
-
-                {
-                        name : ipl,
-                        type : ipl_t
-                }
-        ]
-}
-
Index: kernel/arch/ppc32/include/arch/context_struct.h
===================================================================
--- kernel/arch/ppc32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ppc32/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#define CONTEXT_OFFSET_SP   0x00
+#define CONTEXT_OFFSET_PC   0x04
+#define CONTEXT_OFFSET_R2   0x08
+#define CONTEXT_OFFSET_R13  0x0c
+#define CONTEXT_OFFSET_R14  0x10
+#define CONTEXT_OFFSET_R15  0x14
+#define CONTEXT_OFFSET_R16  0x18
+#define CONTEXT_OFFSET_R17  0x1c
+#define CONTEXT_OFFSET_R18  0x20
+#define CONTEXT_OFFSET_R19  0x24
+#define CONTEXT_OFFSET_R20  0x28
+#define CONTEXT_OFFSET_R21  0x2c
+#define CONTEXT_OFFSET_R22  0x30
+#define CONTEXT_OFFSET_R23  0x34
+#define CONTEXT_OFFSET_R24  0x38
+#define CONTEXT_OFFSET_R25  0x3c
+#define CONTEXT_OFFSET_R26  0x40
+#define CONTEXT_OFFSET_R27  0x44
+#define CONTEXT_OFFSET_R28  0x48
+#define CONTEXT_OFFSET_R29  0x4c
+#define CONTEXT_OFFSET_R30  0x50
+#define CONTEXT_OFFSET_R31  0x54
+#define CONTEXT_OFFSET_CR   0x58
+#define CONTEXT_OFFSET_IPL  0x5c
+#define CONTEXT_SIZE        0x60
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+typedef struct context {
+	uint32_t sp;
+	uint32_t pc;
+	uint32_t r2;
+	uint32_t r13;
+	uint32_t r14;
+	uint32_t r15;
+	uint32_t r16;
+	uint32_t r17;
+	uint32_t r18;
+	uint32_t r19;
+	uint32_t r20;
+	uint32_t r21;
+	uint32_t r22;
+	uint32_t r23;
+	uint32_t r24;
+	uint32_t r25;
+	uint32_t r26;
+	uint32_t r27;
+	uint32_t r28;
+	uint32_t r29;
+	uint32_t r30;
+	uint32_t r31;
+	uint32_t cr;
+	ipl_t ipl;
+} context_t;
+
+#endif
+#endif
+
Index: kernel/arch/ppc32/include/arch/fpu_context_struct.ag
===================================================================
--- kernel/arch/ppc32/include/arch/fpu_context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : fpu_context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : fr0,
-                        type : uint64_t
-                },
-                {
-                        name : fr1,
-                        type : uint64_t
-                },
-                {
-                        name : fr2,
-                        type : uint64_t
-                },
-                {
-                        name : fr3,
-                        type : uint64_t
-                },
-                {
-                        name : fr4,
-                        type : uint64_t
-                },
-                {
-                        name : fr5,
-                        type : uint64_t
-                },
-                {
-                        name : fr6,
-                        type : uint64_t
-                },
-                {
-                        name : fr7,
-                        type : uint64_t
-                },
-                {
-                        name : fr8,
-                        type : uint64_t
-                },
-                {
-                        name : fr9,
-                        type : uint64_t
-                },
-                {
-                        name : fr10,
-                        type : uint64_t
-                },
-                {
-                        name : fr11,
-                        type : uint64_t
-                },
-                {
-                        name : fr12,
-                        type : uint64_t
-                },
-                {
-                        name : fr13,
-                        type : uint64_t
-                },
-                {
-                        name : fr14,
-                        type : uint64_t
-                },
-                {
-                        name : fr15,
-                        type : uint64_t
-                },
-                {
-                        name : fr16,
-                        type : uint64_t
-                },
-                {
-                        name : fr17,
-                        type : uint64_t
-                },
-                {
-                        name : fr18,
-                        type : uint64_t
-                },
-                {
-                        name : fr19,
-                        type : uint64_t
-                },
-                {
-                        name : fr20,
-                        type : uint64_t
-                },
-                {
-                        name : fr21,
-                        type : uint64_t
-                },
-                {
-                        name : fr22,
-                        type : uint64_t
-                },
-                {
-                        name : fr23,
-                        type : uint64_t
-                },
-                {
-                        name : fr24,
-                        type : uint64_t
-                },
-                {
-                        name : fr25,
-                        type : uint64_t
-                },
-                {
-                        name : fr26,
-                        type : uint64_t
-                },
-                {
-                        name : fr27,
-                        type : uint64_t
-                },
-                {
-                        name : fr28,
-                        type : uint64_t
-                },
-                {
-                        name : fr29,
-                        type : uint64_t
-                },
-                {
-                        name : fr30,
-                        type : uint64_t
-                },
-                {
-                        name : fr31,
-                        type : uint64_t
-                },
-                {
-                        name : fpscr,
-                        type : uint64_t
-                }
-
-        ]
-}
-
Index: kernel/arch/ppc32/include/arch/fpu_context_struct.h
===================================================================
--- kernel/arch/ppc32/include/arch/fpu_context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ppc32/include/arch/fpu_context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_FPU_CONTEXT_STRUCT_H_
+#define KERN_ARCH_FPU_CONTEXT_STRUCT_H_
+
+#define FPU_CONTEXT_OFFSET_FR0    0x00
+#define FPU_CONTEXT_OFFSET_FR1    0x08
+#define FPU_CONTEXT_OFFSET_FR2    0x10
+#define FPU_CONTEXT_OFFSET_FR3    0x18
+#define FPU_CONTEXT_OFFSET_FR4    0x20
+#define FPU_CONTEXT_OFFSET_FR5    0x28
+#define FPU_CONTEXT_OFFSET_FR6    0x30
+#define FPU_CONTEXT_OFFSET_FR7    0x38
+#define FPU_CONTEXT_OFFSET_FR8    0x40
+#define FPU_CONTEXT_OFFSET_FR9    0x48
+#define FPU_CONTEXT_OFFSET_FR10   0x50
+#define FPU_CONTEXT_OFFSET_FR11   0x58
+#define FPU_CONTEXT_OFFSET_FR12   0x60
+#define FPU_CONTEXT_OFFSET_FR13   0x68
+#define FPU_CONTEXT_OFFSET_FR14   0x70
+#define FPU_CONTEXT_OFFSET_FR15   0x78
+#define FPU_CONTEXT_OFFSET_FR16   0x80
+#define FPU_CONTEXT_OFFSET_FR17   0x88
+#define FPU_CONTEXT_OFFSET_FR18   0x90
+#define FPU_CONTEXT_OFFSET_FR19   0x98
+#define FPU_CONTEXT_OFFSET_FR20   0xa0
+#define FPU_CONTEXT_OFFSET_FR21   0xa8
+#define FPU_CONTEXT_OFFSET_FR22   0xb0
+#define FPU_CONTEXT_OFFSET_FR23   0xb8
+#define FPU_CONTEXT_OFFSET_FR24   0xc0
+#define FPU_CONTEXT_OFFSET_FR25   0xc8
+#define FPU_CONTEXT_OFFSET_FR26   0xd0
+#define FPU_CONTEXT_OFFSET_FR27   0xd8
+#define FPU_CONTEXT_OFFSET_FR28   0xe0
+#define FPU_CONTEXT_OFFSET_FR29   0xe8
+#define FPU_CONTEXT_OFFSET_FR30   0xf0
+#define FPU_CONTEXT_OFFSET_FR31   0xf8
+#define FPU_CONTEXT_OFFSET_FPSCR  0x100
+#define FPU_CONTEXT_SIZE          0x108
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+typedef struct fpu_context {
+	uint64_t fr0;
+	uint64_t fr1;
+	uint64_t fr2;
+	uint64_t fr3;
+	uint64_t fr4;
+	uint64_t fr5;
+	uint64_t fr6;
+	uint64_t fr7;
+	uint64_t fr8;
+	uint64_t fr9;
+	uint64_t fr10;
+	uint64_t fr11;
+	uint64_t fr12;
+	uint64_t fr13;
+	uint64_t fr14;
+	uint64_t fr15;
+	uint64_t fr16;
+	uint64_t fr17;
+	uint64_t fr18;
+	uint64_t fr19;
+	uint64_t fr20;
+	uint64_t fr21;
+	uint64_t fr22;
+	uint64_t fr23;
+	uint64_t fr24;
+	uint64_t fr25;
+	uint64_t fr26;
+	uint64_t fr27;
+	uint64_t fr28;
+	uint64_t fr29;
+	uint64_t fr30;
+	uint64_t fr31;
+	uint64_t fpscr;
+} fpu_context_t;
+
+#endif
+#endif
+
Index: kernel/arch/ppc32/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/ppc32/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,216 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stdint.h>
-                }
-        ],
-
-        members : [
-                {
-                        # imitation of frame pointer linkage
-                        name : sp_frame,
-                        type : uint32_t
-                },
-                {
-                        # imitation of return adress linkage
-                        name : lr_frame,
-                        type : uint32_t
-                },
-                {
-                        name : r0,
-                        type : uint32_t
-                },
-                {
-                        name : r2,
-                        type : uint32_t
-                },
-                {
-                        name : r3,
-                        type : uint32_t
-                },
-                {
-                        name : r4,
-                        type : uint32_t
-                },
-                {
-                        name : r5,
-                        type : uint32_t
-                },
-                {
-                        name : r6,
-                        type : uint32_t
-                },
-                {
-                        name : r7,
-                        type : uint32_t
-                },
-                {
-                        name : r8,
-                        type : uint32_t
-                },
-                {
-                        name : r9,
-                        type : uint32_t
-                },
-                {
-                        name : r10,
-                        type : uint32_t
-                },
-                {
-                        name : r11,
-                        type : uint32_t
-                },
-                {
-                        name : r13,
-                        type : uint32_t
-                },
-                {
-                        name : r14,
-                        type : uint32_t
-                },
-                {
-                        name : r15,
-                        type : uint32_t
-                },
-                {
-                        name : r16,
-                        type : uint32_t
-                },
-                {
-                        name : r17,
-                        type : uint32_t
-                },
-                {
-                        name : r18,
-                        type : uint32_t
-                },
-                {
-                        name : r19,
-                        type : uint32_t
-                },
-                {
-                        name : r20,
-                        type : uint32_t
-                },
-                {
-                        name : r21,
-                        type : uint32_t
-                },
-                {
-                        name : r22,
-                        type : uint32_t
-                },
-                {
-                        name : r23,
-                        type : uint32_t
-                },
-                {
-                        name : r24,
-                        type : uint32_t
-                },
-                {
-                        name : r25,
-                        type : uint32_t
-                },
-                {
-                        name : r26,
-                        type : uint32_t
-                },
-                {
-                        name : r27,
-                        type : uint32_t
-                },
-                {
-                        name : r28,
-                        type : uint32_t
-                },
-                {
-                        name : r29,
-                        type : uint32_t
-                },
-                {
-                        name : r30,
-                        type : uint32_t
-                },
-                {
-                        name : r31,
-                        type : uint32_t
-                },
-                {
-                        name : cr,
-                        type : uint32_t
-                },
-                {
-                        name : pc,
-                        type : uint32_t
-                },
-                {
-                        name : srr1,
-                        type : uint32_t
-                },
-                {
-                        name : lr,
-                        type : uint32_t
-                },
-                {
-                        name : ctr,
-                        type : uint32_t
-                },
-                {
-                        name : xer,
-                        type : uint32_t
-                },
-                {
-                        name : dar,
-                        type : uint32_t
-                },
-                {
-                        name : r12,
-                        type : uint32_t
-                },
-                {
-                        name : sp,
-                        type : uint32_t
-                }
-
-        ]
-}
-
Index: kernel/arch/ppc32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/ppc32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/ppc32/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#define ISTATE_OFFSET_SP_FRAME  0x00
+#define ISTATE_OFFSET_LR_FRAME  0x04
+#define ISTATE_OFFSET_R0        0x08
+#define ISTATE_OFFSET_R2        0x0c
+#define ISTATE_OFFSET_R3        0x10
+#define ISTATE_OFFSET_R4        0x14
+#define ISTATE_OFFSET_R5        0x18
+#define ISTATE_OFFSET_R6        0x1c
+#define ISTATE_OFFSET_R7        0x20
+#define ISTATE_OFFSET_R8        0x24
+#define ISTATE_OFFSET_R9        0x28
+#define ISTATE_OFFSET_R10       0x2c
+#define ISTATE_OFFSET_R11       0x30
+#define ISTATE_OFFSET_R13       0x34
+#define ISTATE_OFFSET_R14       0x38
+#define ISTATE_OFFSET_R15       0x3c
+#define ISTATE_OFFSET_R16       0x40
+#define ISTATE_OFFSET_R17       0x44
+#define ISTATE_OFFSET_R18       0x48
+#define ISTATE_OFFSET_R19       0x4c
+#define ISTATE_OFFSET_R20       0x50
+#define ISTATE_OFFSET_R21       0x54
+#define ISTATE_OFFSET_R22       0x58
+#define ISTATE_OFFSET_R23       0x5c
+#define ISTATE_OFFSET_R24       0x60
+#define ISTATE_OFFSET_R25       0x64
+#define ISTATE_OFFSET_R26       0x68
+#define ISTATE_OFFSET_R27       0x6c
+#define ISTATE_OFFSET_R28       0x70
+#define ISTATE_OFFSET_R29       0x74
+#define ISTATE_OFFSET_R30       0x78
+#define ISTATE_OFFSET_R31       0x7c
+#define ISTATE_OFFSET_CR        0x80
+#define ISTATE_OFFSET_PC        0x84
+#define ISTATE_OFFSET_SRR1      0x88
+#define ISTATE_OFFSET_LR        0x8c
+#define ISTATE_OFFSET_CTR       0x90
+#define ISTATE_OFFSET_XER       0x94
+#define ISTATE_OFFSET_DAR       0x98
+#define ISTATE_OFFSET_R12       0x9c
+#define ISTATE_OFFSET_SP        0xa0
+#define ISTATE_SIZE             0xa4
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+#ifdef KERNEL
+#include <typedefs.h>
+#else
+#include <stddef.h>
+#endif
+
+typedef struct istate {
+	/* imitation of frame pointer linkage */
+	uint32_t sp_frame;
+	/* imitation of return adress linkage */
+	uint32_t lr_frame;
+	uint32_t r0;
+	uint32_t r2;
+	uint32_t r3;
+	uint32_t r4;
+	uint32_t r5;
+	uint32_t r6;
+	uint32_t r7;
+	uint32_t r8;
+	uint32_t r9;
+	uint32_t r10;
+	uint32_t r11;
+	uint32_t r13;
+	uint32_t r14;
+	uint32_t r15;
+	uint32_t r16;
+	uint32_t r17;
+	uint32_t r18;
+	uint32_t r19;
+	uint32_t r20;
+	uint32_t r21;
+	uint32_t r22;
+	uint32_t r23;
+	uint32_t r24;
+	uint32_t r25;
+	uint32_t r26;
+	uint32_t r27;
+	uint32_t r28;
+	uint32_t r29;
+	uint32_t r30;
+	uint32_t r31;
+	uint32_t cr;
+	uint32_t pc;
+	uint32_t srr1;
+	uint32_t lr;
+	uint32_t ctr;
+	uint32_t xer;
+	uint32_t dar;
+	uint32_t r12;
+	uint32_t sp;
+} istate_t;
+
+#endif
+#endif
+
Index: kernel/arch/riscv64/Makefile.inc
===================================================================
--- kernel/arch/riscv64/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/riscv64/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -54,5 +54,5 @@
 	arch/$(KARCH)/src/mm/tlb.c
 
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag
+ARCH_AUTOCHECK_HEADERS = \
+	arch/$(KARCH)/include/arch/istate_struct.h \
+	arch/$(KARCH)/include/arch/context_struct.h
Index: kernel/arch/riscv64/include/arch/context_struct.ag
===================================================================
--- kernel/arch/riscv64/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-#
-# Copyright (c) 2016 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        members : [
-                #
-                # Only save registers that must be preserved across function
-                # calls.
-                #
-
-                {
-                        name : sp,
-                        type : uint64_t
-                },
-                {
-                        name : pc,
-                        type : uint64_t
-                },
-
-                {
-                        name : gp,
-                        type : uint64_t
-                },
-                {
-                        name : tp,
-                        type : uint64_t
-                },
-                {
-                        name : s0,
-                        type : uint64_t
-                },
-                {
-                        name : s1,
-                        type : uint64_t
-                },
-                {
-                        name : s2,
-                        type : uint64_t
-                },
-                {
-                        name : s3,
-                        type : uint64_t
-                },
-                {
-                        name : s4,
-                        type : uint64_t
-                },
-                {
-                        name : s5,
-                        type : uint64_t
-                },
-                {
-                        name : s6,
-                        type : uint64_t
-                },
-                {
-                        name : s7,
-                        type : uint64_t
-                },
-                {
-                        name : s8,
-                        type : uint64_t
-                },
-                {
-                        name : s9,
-                        type : uint64_t
-                },
-                {
-                        name : s10,
-                        type : uint64_t
-                },
-                {
-                        name : s11,
-                        type : uint64_t
-                },
-
-                {
-                        name : ipl,
-                        type : ipl_t
-                }
-        ]
-}
Index: kernel/arch/riscv64/include/arch/context_struct.h
===================================================================
--- kernel/arch/riscv64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/riscv64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#define CONTEXT_OFFSET_SP   0x00
+#define CONTEXT_OFFSET_PC   0x08
+#define CONTEXT_OFFSET_GP   0x10
+#define CONTEXT_OFFSET_TP   0x18
+#define CONTEXT_OFFSET_S0   0x20
+#define CONTEXT_OFFSET_S1   0x28
+#define CONTEXT_OFFSET_S2   0x30
+#define CONTEXT_OFFSET_S3   0x38
+#define CONTEXT_OFFSET_S4   0x40
+#define CONTEXT_OFFSET_S5   0x48
+#define CONTEXT_OFFSET_S6   0x50
+#define CONTEXT_OFFSET_S7   0x58
+#define CONTEXT_OFFSET_S8   0x60
+#define CONTEXT_OFFSET_S9   0x68
+#define CONTEXT_OFFSET_S10  0x70
+#define CONTEXT_OFFSET_S11  0x78
+#define CONTEXT_OFFSET_IPL  0x80
+#define CONTEXT_SIZE        0x88
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+typedef struct context {
+	uint64_t sp;
+	uint64_t pc;
+	uint64_t gp;
+	uint64_t tp;
+	uint64_t s0;
+	uint64_t s1;
+	uint64_t s2;
+	uint64_t s3;
+	uint64_t s4;
+	uint64_t s5;
+	uint64_t s6;
+	uint64_t s7;
+	uint64_t s8;
+	uint64_t s9;
+	uint64_t s10;
+	uint64_t s11;
+	ipl_t ipl;
+} context_t;
+
+#endif
+#endif
+
Index: kernel/arch/riscv64/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/riscv64/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-#
-# Copyright (c) 2016 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stdint.h>
-                }
-        ],
-
-        members : [
-                {
-                        name : zero,
-                        type : uint64_t
-                },
-                {
-                        name : ra,
-                        type : uint64_t
-                },
-                {
-                        name : sp,
-                        type : uint64_t
-                },
-                {
-                        name : x3,
-                        type : uint64_t
-                },
-                {
-                        name : x4,
-                        type : uint64_t
-                },
-                {
-                        name : x5,
-                        type : uint64_t
-                },
-                {
-                        name : x6,
-                        type : uint64_t
-                },
-                {
-                        name : x7,
-                        type : uint64_t
-                },
-                {
-                        name : x8,
-                        type : uint64_t
-                },
-                {
-                        name : x9,
-                        type : uint64_t
-                },
-                {
-                        name : x10,
-                        type : uint64_t
-                },
-                {
-                        name : x11,
-                        type : uint64_t
-                },
-                {
-                        name : x12,
-                        type : uint64_t
-                },
-                {
-                        name : x13,
-                        type : uint64_t
-                },
-                {
-                        name : x14,
-                        type : uint64_t
-                },
-                {
-                        name : x15,
-                        type : uint64_t
-                },
-                {
-                        name : x16,
-                        type : uint64_t
-                },
-                {
-                        name : x17,
-                        type : uint64_t
-                },
-                {
-                        name : x18,
-                        type : uint64_t
-                },
-                {
-                        name : x19,
-                        type : uint64_t
-                },
-                {
-                        name : x20,
-                        type : uint64_t
-                },
-                {
-                        name : x21,
-                        type : uint64_t
-                },
-                {
-                        name : x22,
-                        type : uint64_t
-                },
-                {
-                        name : x23,
-                        type : uint64_t
-                },
-                {
-                        name : x24,
-                        type : uint64_t
-                },
-                {
-                        name : x25,
-                        type : uint64_t
-                },
-                {
-                        name : x26,
-                        type : uint64_t
-                },
-                {
-                        name : x27,
-                        type : uint64_t
-                },
-                {
-                        name : x28,
-                        type : uint64_t
-                },
-                {
-                        name : x29,
-                        type : uint64_t
-                },
-                {
-                        name : x30,
-                        type : uint64_t
-                },
-                {
-                        name : x31,
-                        type : uint64_t
-                },
-                {
-                        name : pc,
-                        type : uint64_t
-                },
-        ]
-}
Index: kernel/arch/riscv64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/riscv64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/riscv64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2016 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#define ISTATE_OFFSET_ZERO  0x00
+#define ISTATE_OFFSET_RA    0x08
+#define ISTATE_OFFSET_SP    0x10
+#define ISTATE_OFFSET_X3    0x18
+#define ISTATE_OFFSET_X4    0x20
+#define ISTATE_OFFSET_X5    0x28
+#define ISTATE_OFFSET_X6    0x30
+#define ISTATE_OFFSET_X7    0x38
+#define ISTATE_OFFSET_X8    0x40
+#define ISTATE_OFFSET_X9    0x48
+#define ISTATE_OFFSET_X10   0x50
+#define ISTATE_OFFSET_X11   0x58
+#define ISTATE_OFFSET_X12   0x60
+#define ISTATE_OFFSET_X13   0x68
+#define ISTATE_OFFSET_X14   0x70
+#define ISTATE_OFFSET_X15   0x78
+#define ISTATE_OFFSET_X16   0x80
+#define ISTATE_OFFSET_X17   0x88
+#define ISTATE_OFFSET_X18   0x90
+#define ISTATE_OFFSET_X19   0x98
+#define ISTATE_OFFSET_X20   0xa0
+#define ISTATE_OFFSET_X21   0xa8
+#define ISTATE_OFFSET_X22   0xb0
+#define ISTATE_OFFSET_X23   0xb8
+#define ISTATE_OFFSET_X24   0xc0
+#define ISTATE_OFFSET_X25   0xc8
+#define ISTATE_OFFSET_X26   0xd0
+#define ISTATE_OFFSET_X27   0xd8
+#define ISTATE_OFFSET_X28   0xe0
+#define ISTATE_OFFSET_X29   0xe8
+#define ISTATE_OFFSET_X30   0xf0
+#define ISTATE_OFFSET_X31   0xf8
+#define ISTATE_OFFSET_PC    0x100
+#define ISTATE_SIZE         0x108
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+#ifdef KERNEL
+#include <typedefs.h>
+#else
+#include <stddef.h>
+#endif
+
+typedef struct istate {
+	uint64_t zero;
+	uint64_t ra;
+	uint64_t sp;
+	uint64_t x3;
+	uint64_t x4;
+	uint64_t x5;
+	uint64_t x6;
+	uint64_t x7;
+	uint64_t x8;
+	uint64_t x9;
+	uint64_t x10;
+	uint64_t x11;
+	uint64_t x12;
+	uint64_t x13;
+	uint64_t x14;
+	uint64_t x15;
+	uint64_t x16;
+	uint64_t x17;
+	uint64_t x18;
+	uint64_t x19;
+	uint64_t x20;
+	uint64_t x21;
+	uint64_t x22;
+	uint64_t x23;
+	uint64_t x24;
+	uint64_t x25;
+	uint64_t x26;
+	uint64_t x27;
+	uint64_t x28;
+	uint64_t x29;
+	uint64_t x30;
+	uint64_t x31;
+	uint64_t pc;
+} istate_t;
+
+#endif
+#endif
+
Index: kernel/arch/sparc64/Makefile.inc
===================================================================
--- kernel/arch/sparc64/Makefile.inc	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ kernel/arch/sparc64/Makefile.inc	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -110,6 +110,6 @@
 endif
 
-ARCH_AUTOGENS_AG = \
-	arch/$(KARCH)/include/arch/istate_struct.ag \
-	arch/$(KARCH)/include/arch/context_struct.ag
+ARCH_AUTOCHECK_HEADERS = \
+	arch/$(KARCH)/include/arch/istate_struct.h \
+	arch/$(KARCH)/include/arch/context_struct.h
 
Index: kernel/arch/sparc64/include/arch/context_struct.ag
===================================================================
--- kernel/arch/sparc64/include/arch/context_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : context,
-
-        includes : [
-                {
-                        include : <typedefs.h>
-                }
-        ],
-
-        #
-        # Save only registers that must be preserved across function calls.
-        #
-        members : [
-                {
-                        # %o6
-                        name : sp,
-                        type : uintptr_t
-                },
-                {
-                        # %o7
-                        name : pc,
-                        type : uintptr_t
-                },
-                {
-                        name : i0,
-                        type : uint64_t
-                },
-                {
-                        name : i1,
-                        type : uint64_t
-                },
-                {
-                        name : i2,
-                        type : uint64_t
-                },
-                {
-                        name : i3,
-                        type : uint64_t
-                },
-                {
-                        name : i4,
-                        type : uint64_t
-                },
-                {
-                        name : i5,
-                        type : uint64_t
-                },
-                {
-                        # %i6
-                        name : fp,
-                        type : uintptr_t
-                },
-                {
-                        name : i7,
-                        type : uintptr_t
-                },
-                {
-                        name : l0,
-                        type : uint64_t
-                },
-                {
-                        name : l1,
-                        type : uint64_t
-                },
-                {
-                        name : l2,
-                        type : uint64_t
-                },
-                {
-                        name : l3,
-                        type : uint64_t
-                },
-                {
-                        name : l4,
-                        type : uint64_t
-                },
-                {
-                        name : l5,
-                        type : uint64_t
-                },
-                {
-                        name : l6,
-                        type : uint64_t
-                },
-                {
-                        name : l7,
-                        type : uint64_t
-                },
-                {
-                        name : ipl,
-                        type : ipl_t
-                }
-        ]
-}
-
Index: kernel/arch/sparc64/include/arch/context_struct.h
===================================================================
--- kernel/arch/sparc64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/sparc64/include/arch/context_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
+#define KERN_ARCH_CONTEXT_STRUCT_H_
+
+#define CONTEXT_OFFSET_SP   0x00
+#define CONTEXT_OFFSET_PC   0x08
+#define CONTEXT_OFFSET_I0   0x10
+#define CONTEXT_OFFSET_I1   0x18
+#define CONTEXT_OFFSET_I2   0x20
+#define CONTEXT_OFFSET_I3   0x28
+#define CONTEXT_OFFSET_I4   0x30
+#define CONTEXT_OFFSET_I5   0x38
+#define CONTEXT_OFFSET_FP   0x40
+#define CONTEXT_OFFSET_I7   0x48
+#define CONTEXT_OFFSET_L0   0x50
+#define CONTEXT_OFFSET_L1   0x58
+#define CONTEXT_OFFSET_L2   0x60
+#define CONTEXT_OFFSET_L3   0x68
+#define CONTEXT_OFFSET_L4   0x70
+#define CONTEXT_OFFSET_L5   0x78
+#define CONTEXT_OFFSET_L6   0x80
+#define CONTEXT_OFFSET_L7   0x88
+#define CONTEXT_OFFSET_IPL  0x90
+#define CONTEXT_SIZE        0x98
+
+#ifndef __ASSEMBLER__
+
+#include <typedefs.h>
+
+typedef struct context {
+	uintptr_t sp;  // %o6
+	uintptr_t pc;  // %o7
+	uint64_t i0;
+	uint64_t i1;
+	uint64_t i2;
+	uint64_t i3;
+	uint64_t i4;
+	uint64_t i5;
+	uintptr_t fp;  // %i6
+	uintptr_t i7;
+	uint64_t l0;
+	uint64_t l1;
+	uint64_t l2;
+	uint64_t l3;
+	uint64_t l4;
+	uint64_t l5;
+	uint64_t l6;
+	uint64_t l7;
+	ipl_t ipl;
+} context_t;
+
+#endif
+#endif
+
Index: kernel/arch/sparc64/include/arch/istate_struct.ag
===================================================================
--- kernel/arch/sparc64/include/arch/istate_struct.ag	(revision 18b6a8849d630cc3bca153fb21bd225eebb16f4c)
+++ 	(revision )
@@ -1,204 +1,0 @@
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-{
-        name : istate,
-
-        includes : [
-                {
-                        guard : KERNEL,
-                        include : <typedefs.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stddef.h>
-                },
-                {
-                        negative-guard : KERNEL,
-                        include : <stdint.h>
-                }
-        ],
-
-        members : [
-
-                #
-                # Window save area for locals and inputs. Required by ABI.
-                # Before using these, make sure that the corresponding register
-                # window has been spilled into memory, otherwise l0-l7 and
-                # i0-i7 will have undefined values.
-                #
-                {
-                        name : l0,
-                        type : uint64_t,
-                },
-                {
-                        name : l1,
-                        type : uint64_t,
-                },
-                {
-                        name : l2,
-                        type : uint64_t,
-                },
-                {
-                        name : l3,
-                        type : uint64_t,
-                },
-                {
-                        name : l4,
-                        type : uint64_t,
-                },
-                {
-                        name : l5,
-                        type : uint64_t,
-                },
-                {
-                        name : l6,
-                        type : uint64_t,
-                },
-                {
-                        name : l7,
-                        type : uint64_t,
-                },
-                {
-                        name : i0,
-                        type : uint64_t,
-                },
-                {
-                        name : i1,
-                        type : uint64_t,
-                },
-                {
-                        name : i2,
-                        type : uint64_t,
-                },
-                {
-                        name : i3,
-                        type : uint64_t,
-                },
-                {
-                        name : i4,
-                        type : uint64_t,
-                },
-                {
-                        name : i5,
-                        type : uint64_t,
-                },
-                {
-                        name : i6,
-                        type : uint64_t,
-                },
-                {
-                        name : i7,
-                        type : uint64_t,
-                },
-
-                #
-                # Six mandatory argument slots, required by the ABI, plus an
-                # optional argument slot for the 7th argument used by our
-                # syscalls. Since the preemptible handler is always passing
-                # integral arguments, undef_arg[0] - undef_arg[5] are always
-                # undefined.
-                #
-                {
-                        name : undef_arg,
-                        type : uint64_t,
-                        elements : 6,
-                },
-                {
-                        name : arg6,
-                        type : uint64_t,
-                },
-
-                #
-                # From this point onwards, the istate layout is not dicated by
-                # the ABI. The only requirement is the stack alignment.
-                #
-
-                {
-                        name : tnpc,
-                        type : uint64_t
-                },
-                {
-                        name : tpc,
-                        type : uint64_t
-                },
-                {
-                        name : tstate,
-                        type : uint64_t
-                },
-                {
-                        name : y,
-                        type : uint64_t,
-                },
-
-                #
-                # At the moment, these are defined only when needed by the
-                # preemptible handler, so consider them undefined for now.
-                #
-                {
-                        name : o0,
-                        type : uint64_t,
-                },
-                {
-                        name : o1,
-                        type : uint64_t,
-                },
-                {
-                        name : o2,
-                        type : uint64_t,
-                },
-                {
-                        name : o3,
-                        type : uint64_t,
-                },
-                {
-                        name : o4,
-                        type : uint64_t,
-                },
-                {
-                        name : o5,
-                        type : uint64_t,
-                },
-                {
-                        name : o6,
-                        type : uint64_t,
-                },
-                {
-                        name : o7,
-                        type : uint64_t,
-                },
-
-                #
-                # I/DTLB Tag Access register or zero for non-MMU traps.
-                #
-                {
-                        name : tlb_tag_access,
-                        type : uint64_t
-                }
-        ]
-}
-
Index: kernel/arch/sparc64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/sparc64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
+++ kernel/arch/sparc64/include/arch/istate_struct.h	(revision a2eb85d1f769e96dbee6ec14eb7ea648264737db)
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2014 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KERN_ARCH_ISTATE_STRUCT_H_
+#define KERN_ARCH_ISTATE_STRUCT_H_
+
+#define ISTATE_OFFSET_L0              0x00
+#define ISTATE_OFFSET_L1              0x08
+#define ISTATE_OFFSET_L2              0x10
+#define ISTATE_OFFSET_L3              0x18
+#define ISTATE_OFFSET_L4              0x20
+#define ISTATE_OFFSET_L5              0x28
+#define ISTATE_OFFSET_L6              0x30
+#define ISTATE_OFFSET_L7              0x38
+#define ISTATE_OFFSET_I0              0x40
+#define ISTATE_OFFSET_I1              0x48
+#define ISTATE_OFFSET_I2              0x50
+#define ISTATE_OFFSET_I3              0x58
+#define ISTATE_OFFSET_I4              0x60
+#define ISTATE_OFFSET_I5              0x68
+#define ISTATE_OFFSET_I6              0x70
+#define ISTATE_OFFSET_I7              0x78
+#define ISTATE_OFFSET_UNDEF_ARG       0x80
+#define ISTATE_OFFSET_ARG6            0xb0
+#define ISTATE_OFFSET_TNPC            0xb8
+#define ISTATE_OFFSET_TPC             0xc0
+#define ISTATE_OFFSET_TSTATE          0xc8
+#define ISTATE_OFFSET_Y               0xd0
+#define ISTATE_OFFSET_O0              0xd8
+#define ISTATE_OFFSET_O1              0xe0
+#define ISTATE_OFFSET_O2              0xe8
+#define ISTATE_OFFSET_O3              0xf0
+#define ISTATE_OFFSET_O4              0xf8
+#define ISTATE_OFFSET_O5              0x100
+#define ISTATE_OFFSET_O6              0x108
+#define ISTATE_OFFSET_O7              0x110
+#define ISTATE_OFFSET_TLB_TAG_ACCESS  0x118
+#define ISTATE_SIZE                   0x120
+
+#ifndef __ASSEMBLER__
+
+#include <stdint.h>
+
+#ifdef KERNEL
+#include <typedefs.h>
+#else
+#include <stddef.h>
+#endif
+
+typedef struct istate {
+	/*
+	 * Window save area for locals and inputs. Required by ABI.
+	 * Before using these, make sure that the corresponding register
+	 * window has been spilled into memory, otherwise l0-l7 and
+	 * i0-i7 will have undefined values.
+	 */
+	uint64_t l0;
+	uint64_t l1;
+	uint64_t l2;
+	uint64_t l3;
+	uint64_t l4;
+	uint64_t l5;
+	uint64_t l6;
+	uint64_t l7;
+	uint64_t i0;
+	uint64_t i1;
+	uint64_t i2;
+	uint64_t i3;
+	uint64_t i4;
+	uint64_t i5;
+	uint64_t i6;
+	uint64_t i7;
+
+	/*
+	 * Six mandatory argument slots, required by the ABI, plus an
+	 * optional argument slot for the 7th argument used by our
+	 * syscalls. Since the preemptible handler is always passing
+	 * integral arguments, undef_arg[0] - undef_arg[5] are always
+	 * undefined.
+	 */
+	uint64_t undef_arg[6];
+	uint64_t arg6;
+
+	/*
+	 * From this point onwards, the istate layout is not dicated by
+	 * the ABI. The only requirement is the stack alignment.
+	 */
+	uint64_t tnpc;
+	uint64_t tpc;
+	uint64_t tstate;
+	uint64_t y;
+
+	/*
+	 * At the moment, these are defined only when needed by the
+	 * preemptible handler, so consider them undefined for now.
+	 */
+	uint64_t o0;
+	uint64_t o1;
+	uint64_t o2;
+	uint64_t o3;
+	uint64_t o4;
+	uint64_t o5;
+	uint64_t o6;
+	uint64_t o7;
+
+	/*
+	 * I/DTLB Tag Access register or zero for non-MMU traps.
+	 */
+	uint64_t tlb_tag_access;
+} istate_t;
+
+#endif
+#endif
+
