Index: kernel/arch/abs32le/include/arch/types.h
===================================================================
--- kernel/arch/abs32le/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/abs32le/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,28 +36,8 @@
 #define KERN_abs32le_TYPES_H_
 
-#include <arch/common.h>
-
-#define ATOMIC_COUNT_MIN  UINT32_MIN
-#define ATOMIC_COUNT_MAX  UINT32_MAX
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/amd64/include/arch/types.h
===================================================================
--- kernel/arch/amd64/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/amd64/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,25 +36,8 @@
 #define KERN_amd64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/arm32/include/arch/types.h
===================================================================
--- kernel/arch/arm32/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/arm32/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -37,6 +37,4 @@
 #define KERN_arm32_TYPES_H_
 
-#include <arch/common.h>
-
 #ifndef DOXYGEN
 	#define ATTRIBUTE_PACKED __attribute__((packed))
@@ -45,23 +43,8 @@
 #endif
 
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ia32/include/arch/types.h
===================================================================
--- kernel/arch/ia32/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/ia32/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,25 +36,8 @@
 #define KERN_ia32_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ia64/include/arch/types.h
===================================================================
--- kernel/arch/ia64/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/ia64/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,17 +36,5 @@
 #define KERN_ia64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
@@ -55,9 +43,4 @@
 } __attribute__((may_alias)) fncptr_t;
 
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
 #endif
 
Index: kernel/arch/ia64/src/interrupt.c
===================================================================
--- kernel/arch/ia64/src/interrupt.c	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/ia64/src/interrupt.c	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -142,10 +142,10 @@
 	    istate->cr_isr.value, istate->cr_ipsr.value);
 	
-	printf("cr.iip=%#0" PRIx64 ", #%u\t(%s)\n",
+	printf("cr.iip=%#0" PRIxPTR ", #%u\t(%s)\n",
 	    istate->cr_iip, istate->cr_isr.ei,
 	    symtab_fmt_name_lookup(istate->cr_iip));
-	printf("cr.iipa=%#0" PRIx64 "\t(%s)\n", istate->cr_iipa,
+	printf("cr.iipa=%#0" PRIxPTR "\t(%s)\n", istate->cr_iipa,
 	    symtab_fmt_name_lookup(istate->cr_iipa));
-	printf("cr.ifa=%#0" PRIx64 "\t(%s)\n", istate->cr_ifa,
+	printf("cr.ifa=%#0" PRIxPTR "\t(%s)\n", istate->cr_ifa,
 	    symtab_fmt_name_lookup(istate->cr_ifa));
 }
Index: kernel/arch/mips32/include/arch/types.h
===================================================================
--- kernel/arch/mips32/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/mips32/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,25 +36,8 @@
 #define KERN_mips32_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/ppc32/include/arch/types.h
===================================================================
--- kernel/arch/ppc32/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/ppc32/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,25 +36,8 @@
 #define KERN_ppc32_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint32_t size_t;
-typedef int32_t ssize_t;
-
-typedef uint32_t uintptr_t;
-typedef uint32_t pfn_t;
-
-typedef uint32_t ipl_t;
-
-typedef uint32_t sysarg_t;
-typedef int32_t native_t;
-typedef uint32_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId32  /**< Format for native_t. */
-#define PRIun  PRIu32  /**< Format for sysarg_t. */
-#define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu32  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/riscv64/include/arch/types.h
===================================================================
--- kernel/arch/riscv64/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/riscv64/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,25 +36,8 @@
 #define KERN_riscv64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
 } fncptr_t;
-
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
 
 #endif
Index: kernel/arch/sparc64/include/arch/asm.h
===================================================================
--- kernel/arch/sparc64/include/arch/asm.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/sparc64/include/arch/asm.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -350,5 +350,5 @@
 	
 	pstate.value = pstate_read();
-	pstate.ie = ((pstate_reg_t) ipl).ie;
+	pstate.ie = ((pstate_reg_t)(uint64_t) ipl).ie;
 	pstate_write(pstate.value);
 }
Index: kernel/arch/sparc64/include/arch/barrier.h
===================================================================
--- kernel/arch/sparc64/include/arch/barrier.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/sparc64/include/arch/barrier.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -37,10 +37,4 @@
 
 #include <trace.h>
-
-#ifdef KERNEL
-#include <arch/common.h>
-#else
-#include <libarch/common.h>
-#endif
 
 /*
@@ -88,5 +82,5 @@
 NO_TRACE static inline void flush_pipeline(void)
 {
-	uint64_t pc;
+	unsigned long pc;
 	
 	/*
Index: kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -72,5 +72,5 @@
 struct pte;
 
-extern void tsb_invalidate(struct as *as, uintptr_t page, uint64_t pages);
+extern void tsb_invalidate(struct as *as, uintptr_t page, size_t pages);
 extern void itsb_pte_copy(struct pte *t);
 extern void dtsb_pte_copy(struct pte *t, bool ro);
Index: kernel/arch/sparc64/include/arch/types.h
===================================================================
--- kernel/arch/sparc64/include/arch/types.h	(revision a4fb8d60ffb2469744f8d1f6fad67fae13d69fcd)
+++ kernel/arch/sparc64/include/arch/types.h	(revision 002fd5f375765c45f5e59bbc374e1418520abddf)
@@ -36,17 +36,5 @@
 #define KERN_sparc64_TYPES_H_
 
-#include <arch/common.h>
-
-typedef uint64_t size_t;
-typedef int64_t ssize_t;
-
-typedef uint64_t uintptr_t;
-typedef uint64_t pfn_t;
-
-typedef uint64_t ipl_t;
-
-typedef uint64_t sysarg_t;
-typedef int64_t native_t;
-typedef uint64_t atomic_count_t;
+#include <_bits/all.h>
 
 typedef struct {
@@ -55,9 +43,4 @@
 typedef uint8_t asi_t;
 
-#define PRIdn  PRId64  /**< Format for native_t. */
-#define PRIun  PRIu64  /**< Format for sysarg_t. */
-#define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
-#define PRIua  PRIu64  /**< Format for atomic_count_t. */
-
 #endif
 
