changeset 151:b18d52f11ade

Cleaned up some of the storage key code
author Jonathan Pevarnek <pevarnj@gmail.com>
date Wed, 02 Nov 2011 21:33:56 -0400
parents e72f984619c7
children 54ccc4f06e6b
files include/os/storageKeys.h src/os/storageKeys.c
diffstat 2 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/include/os/storageKeys.h	Wed Nov 02 09:55:09 2011 -0400
+++ b/include/os/storageKeys.h	Wed Nov 02 21:33:56 2011 -0400
@@ -4,5 +4,6 @@
 #define PROGSK 0xC
 
 void setStorageKey(intptr_t blockPtr, u8 key, u8 fBit);
+void init_storage_keys(u64 memsize);
 
 #endif
--- a/src/os/storageKeys.c	Wed Nov 02 09:55:09 2011 -0400
+++ b/src/os/storageKeys.c	Wed Nov 02 21:33:56 2011 -0400
@@ -2,32 +2,32 @@
 #include <os/memLayout.h>
 #include <string.h>
 
-static struct {
-	u32 _zero0;
-	u16 _zero1;
-	u8 _zero2;
-	u8 key:4,
-		 f:1, //true if storage key applies for reading also
-		 r:1,
-		 c:1,
-		 _zero3:1;
-} StorageKey;
 
 void setStorageKey(intptr_t blockPtr, u8 key, u8 fBit)
 {
-	StorageKey.key = key;
-	StorageKey.f = fBit;
+	struct {
+		u32 _zero0;
+		u16 _zero1;
+		u8 _zero2;
+		u8 key:4,
+			 f:1, //true if storage key applies for reading also
+			 r:1,
+			 c:1,
+			 _zero3:1;
+	} storageKey;
+	memset(&storageKey, 0, sizeof(storageKey));
+	storageKey.key = key;
+	storageKey.f = fBit;
 	asm volatile(
 			"sske %0,%1\n"
 			: /* no output */
-			: "d" (StorageKey),
+			: "d" (storageKey),
 			  "a" (blockPtr)
 	);
 }
 
 void init_storage_keys(u64 memsize)
 {
-	memset(&StorageKey, 0, sizeof(StorageKey));
 	intptr_t ptr = 0x0;
 	u8 key;
 	for(ptr = 0x0; ptr < memsize; ptr += BLOCKSIZE) {