On Dec 3, 2012, at 4:17 PM, Mark Cave-Ayland wrote:

On 03/12/12 21:05, Programmingkid wrote:

Compare the formatting of your for() statement above with the others in the file - you should use the existing style in your patch.

I was never a fan of that style, but ok.

In general, writing patches is like repairing holes in a plaster wall - the aim is to blend your patch in with what is already there so it's impossible to work out where the patch begins/ends without reading the SVN log.

Also as per my comment on your last version of the patch, you need to use target_long() as per the existing code in lstore.

Do you mean write_long()? This is what lstore uses. Why use this function as oppose to the code I have now?

Oh sorry - yes, you are correct, it is write_long(). Mainly for two reasons: 1) to preserve style and 2) ensure that cross-compilation works correctly.

Ok, I finally figured out how to include cross.h. Does this code look good?

Index: trunk/openbios-devel/arch/ppc/qemu/init.c
===================================================================
--- trunk/openbios-devel/arch/ppc/qemu/init.c (revision 1075)
+++ trunk/openbios-devel/arch/ppc/qemu/init.c (working copy)
@@ -34,6 +34,7 @@
 #define NO_QEMU_PROTOS
 #include "arch/common/fw_cfg.h"
 #include "arch/ppc/processor.h"
+#include "../../../kernel/cross.h"

 

 #define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"

 

@@ -613,6 +614,24 @@
     fword("finish-device");
 }

 

+
+/* filll  ( addr len num -- ) */
+/* Fills an address in memory with 32-bit values */
+static void filll(void)
+{
+   u32 * location;
+   u32 length, fillNumber, x;
+   
+   fillNumber = POP();
+   length = POP();
+   location = (u32 *) cell2pointer(POP());
+   
+   for(x = 0; x <= length; x++) {
+      write_long(location++, fillNumber);
+   }
+}
+
+
 void
 arch_of_init(void)
 {
@@ -879,4 +898,5 @@

 

     bind_func("platform-boot", boot);
     bind_func("(go)", go);
+    bind_func("filll", filll);
 }