Patchwork Woriking configuration for AMD SimNow

login
register
about
Submitter Patrick Georgi
Date 2009-10-08 14:03:11
Message ID <1255010591.5054.8.camel@tetris>
Download mbox | patch
Permalink /patch/366/
State Not Applicable
Headers show

Comments

Patrick Georgi - 2009-10-08 14:03:11
Am Donnerstag, den 08.10.2009, 15:51 +0200 schrieb Schwarz, Konrad:
> Unfortunately no.  The simulation clock freezes after 7.33 (simulated) seconds but does not display a triple fault message.  No VGA screen comes up.
Seems to be a different issue.

I attached the change from 4697 for you to try against the older tree.


Regards,
Patrick Georgi

Patch

Index: src/boot/selfboot.c
===================================================================
--- src/boot/selfboot.c	(Revision 4696)
+++ src/boot/selfboot.c	(Revision 4697)
@@ -423,14 +423,13 @@ 
 {
 	struct segment *ptr;
 	
-	unsigned long required_bounce_size = lb_end - lb_start;
+	unsigned long bounce_high = lb_end;
 	for(ptr = head->next; ptr != head; ptr = ptr->next) {
 		if (!overlaps_coreboot(ptr)) continue;
-		unsigned long bounce = ptr->s_dstaddr + ptr->s_memsz - lb_start;
-		if (bounce > required_bounce_size)
-			required_bounce_size = bounce;
+		if (ptr->s_dstaddr + ptr->s_memsz > bounce_high)
+			bounce_high = ptr->s_dstaddr + ptr->s_memsz;
 	}
-	get_bounce_buffer(mem, required_bounce_size);
+	get_bounce_buffer(mem, bounce_high - lb_start);
 	if (!bounce_buffer) {
 		printk_err("Could not find a bounce buffer...\n");
 		return 0;
@@ -502,6 +501,24 @@ 
 				/* Zero the extra bytes */
 				memset(middle, 0, end - middle);
 			}
+			/* Copy the data that's outside the area that shadows coreboot_ram */
+			printk_debug("dest %lx, end %lx, bouncebuffer %lx\n", dest, end, bounce_buffer);
+			if ((unsigned long)end > bounce_buffer) {
+				if ((unsigned long)dest < bounce_buffer) {
+					unsigned long from = dest;
+					unsigned long to = lb_start-(bounce_buffer-(unsigned long)dest);
+					unsigned long amount = bounce_buffer-(unsigned long)dest;
+					printk_debug("move prefix around: from %lx, to %lx, amount: %lx\n", from, to, amount);
+					memcpy(to, from, amount);
+				}
+				if ((unsigned long)end > bounce_buffer + (lb_end - lb_start)) {
+					unsigned long from = bounce_buffer + (lb_end - lb_start);
+					unsigned long to = lb_end;
+					unsigned long amount = end - from;
+					printk_debug("move suffix around: from %lx, to %lx, amount: %lx\n", from, to, amount);
+					memcpy(to, from, amount);
+				}
+			}
 		}
 	}
 	return 1;