Index: kernel/arch/sparc64/include/asm.h
===================================================================
--- kernel/arch/sparc64/include/asm.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/asm.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -36,10 +36,9 @@
 #define KERN_sparc64_ASM_H_
 
-#include <arch.h>
-#include <typedefs.h>
+#include <arch/arch.h>
 #include <arch/types.h>
+#include <align.h>
 #include <arch/register.h>
 #include <config.h>
-#include <time/clock.h>
 #include <arch/stack.h>
 
Index: kernel/arch/sparc64/include/atomic.h
===================================================================
--- kernel/arch/sparc64/include/atomic.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/atomic.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -38,5 +38,4 @@
 #include <arch/barrier.h>
 #include <arch/types.h>
-#include <typedefs.h>
 
 /** Atomic add operation.
Index: kernel/arch/sparc64/include/boot/boot.h
===================================================================
--- kernel/arch/sparc64/include/boot/boot.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/boot/boot.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -44,5 +44,4 @@
 #include <config.h>
 #include <arch/types.h>
-#include <typedefs.h>
 #include <genarch/ofw/ofw_tree.h>
 
Index: kernel/arch/sparc64/include/cpu.h
===================================================================
--- kernel/arch/sparc64/include/cpu.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/cpu.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -38,4 +38,5 @@
 #include <arch/types.h>
 #include <arch/register.h>
+#include <arch/asm.h>
 
 #define MANUF_FUJITSU		0x04
Index: kernel/arch/sparc64/include/drivers/tick.h
===================================================================
--- kernel/arch/sparc64/include/drivers/tick.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/drivers/tick.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -36,5 +36,5 @@
 #define KERN_sparc64_TICK_H_
 
-#include <typedefs.h>
+#include <arch/interrupt.h>
 
 extern void tick_init(void);
Index: kernel/arch/sparc64/include/drivers/z8530.h
===================================================================
--- kernel/arch/sparc64/include/drivers/z8530.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/drivers/z8530.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -37,5 +37,4 @@
 
 #include <arch/types.h>
-#include <typedefs.h>
 #include <arch/drivers/kbd.h>
 
Index: kernel/arch/sparc64/include/interrupt.h
===================================================================
--- kernel/arch/sparc64/include/interrupt.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/interrupt.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -37,5 +37,4 @@
 #define KERN_sparc64_INTERRUPT_H_
 
-#include <typedefs.h>
 #include <arch/types.h>
 #include <arch/regdef.h>
@@ -51,9 +50,9 @@
 };		
 
-struct istate {
+typedef struct {
 	uint64_t	tnpc;
 	uint64_t	tpc;
 	uint64_t	tstate;
-};
+} istate_t;
 
 static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
@@ -72,7 +71,4 @@
 }
 
-
-extern void interrupt_register(int n, const char *name, iroutine f);
-
 #endif
 
Index: kernel/arch/sparc64/include/mm/as.h
===================================================================
--- kernel/arch/sparc64/include/mm/as.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/mm/as.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -36,7 +36,5 @@
 #define KERN_sparc64_AS_H_
 
-#ifdef CONFIG_TSB
-#include <arch/mm/tsb.h>
-#endif
+#include <arch/mm/tte.h>
 
 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH	1
@@ -47,14 +45,42 @@
 #define USER_ADDRESS_SPACE_END_ARCH		(unsigned long) 0xffffffffffffffff
 
-#define USTACK_ADDRESS_ARCH	(0xffffffffffffffffULL-(PAGE_SIZE-1))
+#define USTACK_ADDRESS_ARCH	(0xffffffffffffffffULL - (PAGE_SIZE - 1))
+
+#ifdef CONFIG_TSB
+
+/** TSB Tag Target register. */
+typedef union tsb_tag_target {
+	uint64_t value;
+	struct {
+		unsigned invalid : 1;	/**< Invalidated by software. */
+		unsigned : 2;
+		unsigned context : 13;	/**< Software ASID. */
+		unsigned : 6;
+		uint64_t va_tag : 42;	/**< Virtual address bits <63:22>. */
+	} __attribute__ ((packed));
+} tsb_tag_target_t;
+
+/** TSB entry. */
+typedef struct tsb_entry {
+	tsb_tag_target_t tag;
+	tte_data_t data;
+} __attribute__ ((packed)) tsb_entry_t;
 
 typedef struct {
-#ifdef CONFIG_TSB
 	tsb_entry_t *itsb;
 	tsb_entry_t *dtsb;
-#endif /* CONFIG_TSB */
 } as_arch_t;
 
+#else
+
+typedef struct {
+} as_arch_t;
+
+#endif /* CONFIG_TSB */
+
+#include <genarch/mm/as_ht.h>
+
 #ifdef CONFIG_TSB
+#	include <arch/mm/tsb.h>
 #	define as_invalidate_translation_cache(as, page, cnt)	tsb_invalidate(as, page, cnt)
 #else
Index: kernel/arch/sparc64/include/mm/memory_init.h
===================================================================
--- kernel/arch/sparc64/include/mm/memory_init.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/mm/memory_init.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -36,5 +36,5 @@
 #define KERN_sparc64_MEMORY_INIT_H_
 
-#include <typedefs.h>
+#include <arch/types.h>
 
 extern size_t get_memory_size(void);
Index: kernel/arch/sparc64/include/mm/mmu.h
===================================================================
--- kernel/arch/sparc64/include/mm/mmu.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/mm/mmu.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -80,8 +80,7 @@
 #include <arch/barrier.h>
 #include <arch/types.h>
-#include <typedefs.h>
 
 /** LSU Control Register. */
-union lsu_cr_reg {
+typedef union {
 	uint64_t value;
 	struct {
@@ -101,6 +100,5 @@
 		
 	} __attribute__ ((packed));
-};
-typedef union lsu_cr_reg lsu_cr_reg_t;
+} lsu_cr_reg_t;
 
 #endif /* !def __ASM__ */
Index: kernel/arch/sparc64/include/mm/page.h
===================================================================
--- kernel/arch/sparc64/include/mm/page.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/mm/page.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -47,7 +47,7 @@
 #ifndef __ASM__
 
-#include <mm/page.h>
-#include <arch/types.h>
-#include <genarch/mm/page_ht.h>
+//#include <arch/types.h>
+//#include <genarch/mm/page_ht.h>
+#include <arch/interrupt.h>
 
 extern uintptr_t physmem_base;
@@ -56,5 +56,5 @@
 #define PA2KA(x)	(((uintptr_t) (x)) - physmem_base)
 
-union page_address {
+typedef union {
 	uintptr_t address;
 	struct {
@@ -62,7 +62,5 @@
 		unsigned offset : 13;		/**< Offset. */
 	} __attribute__ ((packed));
-};
-
-typedef union page_address page_address_t;
+} page_address_t;
 
 extern void page_arch_init(void);
Index: kernel/arch/sparc64/include/mm/tlb.h
===================================================================
--- kernel/arch/sparc64/include/mm/tlb.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/mm/tlb.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -77,5 +77,4 @@
 #include <arch/barrier.h>
 #include <arch/types.h>
-#include <typedefs.h>
 
 union tlb_context_reg {
Index: kernel/arch/sparc64/include/mm/tsb.h
===================================================================
--- kernel/arch/sparc64/include/mm/tsb.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/mm/tsb.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -55,28 +55,8 @@
 #include <arch/mm/mmu.h>
 #include <arch/types.h>
-#include <typedefs.h>
-
-/** TSB Tag Target register. */
-union tsb_tag_target {
-	uint64_t value;
-	struct {
-		unsigned invalid : 1;	/**< Invalidated by software. */
-		unsigned : 2;
-		unsigned context : 13;	/**< Software ASID. */
-		unsigned : 6;
-		uint64_t va_tag : 42;	/**< Virtual address bits <63:22>. */
-	} __attribute__ ((packed));
-};
-typedef union tsb_tag_target tsb_tag_target_t;
-
-/** TSB entry. */
-struct tsb_entry {
-	tsb_tag_target_t tag;
-	tte_data_t data;
-} __attribute__ ((packed));
-typedef struct tsb_entry tsb_entry_t;
+#include <mm/as.h>
 
 /** TSB Base register. */
-union tsb_base_reg {
+typedef union tsb_base_reg {
 	uint64_t value;
 	struct {
@@ -91,6 +71,5 @@
 					 * 512 * 2^size. */
 	} __attribute__ ((packed));
-};
-typedef union tsb_base_reg tsb_base_reg_t;
+} tsb_base_reg_t;
 
 /** Read ITSB Base register.
Index: kernel/arch/sparc64/include/sparc64.h
===================================================================
--- kernel/arch/sparc64/include/sparc64.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
+++ kernel/arch/sparc64/include/sparc64.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2005 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.
+ */
+
+/** @addtogroup sparc64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_sparc64_SPARC64_H_
+#define KERN_sparc64_SPARC64_H_
+
+#include <interrupt.h>
+
+extern void interrupt_register(int n, const char *name, iroutine f);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/sparc64/include/syscall.h
===================================================================
--- kernel/arch/sparc64/include/syscall.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/syscall.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -36,6 +36,6 @@
 #define KERN_sparc64_SYSCALL_H_
 
-#include <typedefs.h>
 #include <arch/types.h>
+#include <arch/interrupt.h>
 
 extern unative_t syscall(int n, istate_t *istate, unative_t a1, unative_t a2, unative_t a3, unative_t a4);
Index: kernel/arch/sparc64/include/trap/exception.h
===================================================================
--- kernel/arch/sparc64/include/trap/exception.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/trap/exception.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -59,5 +59,5 @@
 #ifndef __ASM__
 
-#include <typedefs.h>
+#include <arch/interrupt.h>
 
 extern void dump_istate(istate_t *istate);
Index: kernel/arch/sparc64/include/trap/interrupt.h
===================================================================
--- kernel/arch/sparc64/include/trap/interrupt.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/trap/interrupt.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -106,4 +106,7 @@
 
 #ifndef __ASM__
+
+#include <arch/interrupt.h>
+
 extern void interrupt(int n, istate_t *istate);
 #endif /* !def __ASM__ */
Index: kernel/arch/sparc64/include/types.h
===================================================================
--- kernel/arch/sparc64/include/types.h	(revision 0f3fc9b4dfadc676e3337514570c32d8d8c9b162)
+++ kernel/arch/sparc64/include/types.h	(revision 0c1a5d8afc92defd6f72d5e63c28c60152e3d46b)
@@ -36,5 +36,7 @@
 #define KERN_sparc64_TYPES_H_
 
-#define NULL	0
+#define NULL 0
+#define false 0
+#define true 1
 
 typedef signed char int8_t;
@@ -48,4 +50,8 @@
 typedef unsigned long uint64_t;
 
+typedef uint64_t size_t;
+typedef uint64_t count_t;
+typedef uint64_t index_t;
+
 typedef uint64_t uintptr_t;
 typedef uint64_t pfn_t;
@@ -56,6 +62,10 @@
 typedef int64_t native_t;
 
-typedef struct pte pte_t;
+typedef uint8_t bool;
+typedef uint64_t task_id_t;
+typedef uint32_t context_id_t;
 
+typedef int32_t inr_t;
+typedef int32_t devno_t;
 typedef uint8_t asi_t;
 
