Index: boot/arch/sparc64/loader/Makefile
===================================================================
--- boot/arch/sparc64/loader/Makefile	(revision fb0e6f03f428e14b816f7a37cb110f0b908727d5)
+++ boot/arch/sparc64/loader/Makefile	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -53,5 +53,5 @@
 	../../../generic/printf.c \
 	../../../genarch/ofw.c \
-	ofw.c \
+	ofwarch.c \
 	asm.S \
 	boot.S
@@ -65,5 +65,5 @@
 .PHONY: all clean depend
 
-all: image.boot
+all: image.boot disasm
 
 -include Makefile.depend
@@ -86,2 +86,5 @@
 %.o: %.c
 	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+
+disasm: image.boot
+	$(OBJDUMP) -d image.boot > boot.disasm
Index: boot/arch/sparc64/loader/asm.h
===================================================================
--- boot/arch/sparc64/loader/asm.h	(revision fb0e6f03f428e14b816f7a37cb110f0b908727d5)
+++ boot/arch/sparc64/loader/asm.h	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -27,6 +27,6 @@
  */
 
-#ifndef __ASM_H__
-#define __ASM_H__
+#ifndef BOOT_sparc64_ASM_H_
+#define BOOT_sparc64_ASM_H_
 
 #define PAGE_SIZE 8192
Index: boot/arch/sparc64/loader/boot.S
===================================================================
--- boot/arch/sparc64/loader/boot.S	(revision fb0e6f03f428e14b816f7a37cb110f0b908727d5)
+++ boot/arch/sparc64/loader/boot.S	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -30,4 +30,5 @@
 
 #define PSTATE_IE_BIT	2
+#define PSTATE_AM_BIT	8
 
 .register %g2, #scratch
@@ -56,8 +57,8 @@
 
 	/*
-	 * Disable interrupts.
+	 * Disable interrupts and disable address masking.
 	 */
 	rdpr %pstate, %g2
-	and %g2, ~PSTATE_IE_BIT, %g2	! mask the Interrupt Enable bit
+	and %g2, ~(PSTATE_IE_BIT|PSTATE_AM_BIT), %g2
 	wrpr %g2, 0, %pstate
 
@@ -66,5 +67,5 @@
 	set ofw_cif, %l0
  
-	call init		! initialize OpenFirmware
+	call ofw_init		! initialize OpenFirmware
 	stx %o4, [%l0]
 	
Index: boot/arch/sparc64/loader/main.c
===================================================================
--- boot/arch/sparc64/loader/main.c	(revision fb0e6f03f428e14b816f7a37cb110f0b908727d5)
+++ boot/arch/sparc64/loader/main.c	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -32,4 +32,5 @@
 #include "_components.h"
 #include <ofw.h>
+#include <align.h>
 
 #define KERNEL_VIRTUAL_ADDRESS 0x400000
@@ -44,11 +45,37 @@
 	init_components(components);
 
+	if (!ofw_memmap(&bootinfo.memmap)) {
+		printf("Error: unable to get memory map, halting.\n");
+		halt();
+	}
+	
+	if (bootinfo.memmap.total == 0) {
+		printf("Error: no memory detected, halting.\n");
+		halt();
+	}
+	
+	if (!ofw_screen(&bootinfo.screen)) {
+		printf("Error: unable to get screen properties, halting.\n");
+		halt();
+	}
+	bootinfo.screen.addr = ofw_translate(bootinfo.screen.addr);
+	
+	if (!ofw_keyboard(&bootinfo.keyboard)) {
+		printf("Error: unable to get keyboard properties, halting.\n");
+		halt();
+	}
+	
+	printf("\nDevice statistics\n");
+	printf(" memory: %dM\n", bootinfo.memmap.total>>20);
+	printf(" screen at %P, resolution %dx%d, %d bpp (scanline %d bytes)\n", (uintptr_t) bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);
+	printf(" keyboard at %P (size %d bytes)\n", (uintptr_t) bootinfo.keyboard.addr, bootinfo.keyboard.size);
+
 	printf("\nMemory statistics\n");
-	printf(" kernel entry point at %L\n", KERNEL_VIRTUAL_ADDRESS);
-	printf(" %L: boot info structure\n", &bootinfo);
+	printf(" kernel entry point at %P\n", KERNEL_VIRTUAL_ADDRESS);
+	printf(" %P: boot info structure\n", &bootinfo);
 	
 	unsigned int i;
 	for (i = 0; i < COMPONENTS; i++)
-		printf(" %L: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size);
+		printf(" %P: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size);
 
 	printf("\nCopying components\n");
Index: boot/arch/sparc64/loader/main.h
===================================================================
--- boot/arch/sparc64/loader/main.h	(revision fb0e6f03f428e14b816f7a37cb110f0b908727d5)
+++ boot/arch/sparc64/loader/main.h	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -27,13 +27,8 @@
  */
 
-#ifndef __MAIN_H__
-#define __MAIN_H__
+#ifndef BOOT_sparc64_MAIN_H_
+#define BOOT_sparc64_MAIN_H_
 
-/** Align to the nearest higher address.
- *
- * @param addr  Address or size to be aligned.
- * @param align Size of alignment, must be power of 2.
- */
-#define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))
+#include <ofw.h>
 
 #define TASKMAP_MAX_RECORDS 32
@@ -47,4 +42,7 @@
 	unsigned int cnt;
 	task_t tasks[TASKMAP_MAX_RECORDS];
+	memmap_t memmap;
+	screen_t screen;
+	keyboard_t keyboard;
 } bootinfo_t;
 
Index: boot/arch/sparc64/loader/ofw.c
===================================================================
--- boot/arch/sparc64/loader/ofw.c	(revision fb0e6f03f428e14b816f7a37cb110f0b908727d5)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (C) 2005 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.
- */
- 
-#include <ofw.h>
-#include <printf.h>
-
-void write(const char *str, const int len)
-{
-	int i;
-	
-	for (i = 0; i < len; i++) {
-		if (str[i] == '\n')
-			ofw_write("\r", 1);
-		ofw_write(&str[i], 1);
-	}
-}
-
-int ofw_translate_failed(ofw_arg_t flag)
-{
-	return flag != -1;
-}
Index: boot/arch/sparc64/loader/ofwarch.c
===================================================================
--- boot/arch/sparc64/loader/ofwarch.c	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
+++ boot/arch/sparc64/loader/ofwarch.c	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2005 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.
+ */
+
+/**
+ * @file
+ * @brief	Architecture dependent parts of OpenFirmware interface.
+ */
+
+#include <ofwarch.h>  
+#include <ofw.h>
+#include <printf.h>
+
+void write(const char *str, const int len)
+{
+	int i;
+	
+	for (i = 0; i < len; i++) {
+		if (str[i] == '\n')
+			ofw_write("\r", 1);
+		ofw_write(&str[i], 1);
+	}
+}
+
+int ofw_translate_failed(ofw_arg_t flag)
+{
+	return flag != -1;
+}
+
+int ofw_keyboard(keyboard_t *keyboard)
+{
+	char device_name[BUF_SIZE];
+	uint32_t virtaddr;
+		
+	if (ofw_get_property(ofw_aliases, "keyboard", device_name, sizeof(device_name)) <= 0)
+		return false;
+					
+	phandle device = ofw_find_device(device_name);
+	if (device == -1)
+		return false;
+									
+	if (ofw_get_property(device, "address", &virtaddr, sizeof(virtaddr)) <= 0)
+		return false;
+												
+	if (!(keyboard->addr = ofw_translate((void *) ((uintptr_t) virtaddr))))
+		return false;
+
+	return true;
+}
Index: boot/arch/sparc64/loader/ofwarch.h
===================================================================
--- boot/arch/sparc64/loader/ofwarch.h	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
+++ boot/arch/sparc64/loader/ofwarch.h	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006 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 BOOT_sparc64_OFWARCH_H_
+#define BOOT_sparc64_OFWARCH_H_
+
+#define OFW_ADDRESS_CELLS	2
+#define OFW_SIZE_CELLS		2
+
+#endif
Index: boot/arch/sparc64/loader/types.h
===================================================================
--- boot/arch/sparc64/loader/types.h	(revision fb0e6f03f428e14b816f7a37cb110f0b908727d5)
+++ boot/arch/sparc64/loader/types.h	(revision 63cda71efb0a2f95861470401dbc781d7f284896)
@@ -27,6 +27,6 @@
  */
 
-#ifndef TYPES_H__
-#define TYPES_H__
+#ifndef BOOT_sparc64_TYPES_H_
+#define BOOT_sparc64_TYPES_H_
 
 #include <gentypes.h>
