git: 9front

Download patch

ref: 8817d2dea4fdfbada26f69d0349b38addc0d6ced
parent: 308ce1e4fbf0f948dbf0ce07168f18b8c3cbdcb1
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Jun 29 13:18:43 EDT 2012

scram: cleanup

--- a/sys/src/cmd/scram.c
+++ b/sys/src/cmd/scram.c
@@ -3,8 +3,9 @@
 #include <libc.h>
 #include <aml.h>
 
+int fd, iofd;
 struct Ureg u;
-int fd, iofd, PM1A_CNT_BLK, PM1B_CNT_BLK, SLP_TYPa, SLP_TYPb;
+ulong PM1A_CNT_BLK, PM1B_CNT_BLK, SLP_TYPa, SLP_TYPb;
 
 typedef struct Tbl Tbl;
 struct Tbl {
@@ -30,7 +31,7 @@
 	free(p);
 }
 
-static uint
+static ulong
 get32(uchar *p){
 	return p[3]<<24 | p[2]<<16 | p[1]<<8 | p[0];
 }
@@ -63,7 +64,7 @@
 			break;
 		if(n != sizeof(*t))
 			return -1;
-		l = *(ulong*)(t->len);
+		l = get32(t->len);
 		if(l < sizeof(*t))
 			return -1;
 		t = realloc(t, l);
@@ -96,7 +97,7 @@
 void
 outw(long addr, short val)
 {
-	char buf[2];
+	uchar buf[2];
 	
 	buf[0] = val;
 	buf[1] = val >> 8;
--