|
From: <bob...@us...> - 2007-07-13 12:56:32
|
Revision: 1137
http://svn.sourceforge.net/hackndev/?rev=1137&view=rev
Author: bobofdoom
Date: 2007-07-13 05:56:30 -0700 (Fri, 13 Jul 2007)
Log Message:
-----------
Cocoboot: Added overflow-buffer as last resort to allocation problem (slapin's idea)
Modified Paths:
--------------
cocoboot/trunk/Changelog
cocoboot/trunk/include/cocoboot.h
cocoboot/trunk/m68k/cocoboot.c
cocoboot/trunk/m68k/mainform.c
Modified: cocoboot/trunk/Changelog
===================================================================
--- cocoboot/trunk/Changelog 2007-07-13 11:32:23 UTC (rev 1136)
+++ cocoboot/trunk/Changelog 2007-07-13 12:56:30 UTC (rev 1137)
@@ -1,3 +1,4 @@
+ - Added overflow-buffer as last resort to allocation problem (slapin's idea)
- Cleaned up treo code (removed all #ifdefs)
- Removed kernel relocation for speed and reliability (suggested by phire)
- Added simple USB console.
Modified: cocoboot/trunk/include/cocoboot.h
===================================================================
--- cocoboot/trunk/include/cocoboot.h 2007-07-13 11:32:23 UTC (rev 1136)
+++ cocoboot/trunk/include/cocoboot.h 2007-07-13 12:56:30 UTC (rev 1137)
@@ -8,6 +8,7 @@
extern ArmGlobals arm_globals;
void lprintf (const char *template, ...);
+void log_clear(void);
UInt32 call_arm(ArmStack *stack, UInt32 func);
UInt32 get_tt_offset();
Modified: cocoboot/trunk/m68k/cocoboot.c
===================================================================
--- cocoboot/trunk/m68k/cocoboot.c 2007-07-13 11:32:23 UTC (rev 1136)
+++ cocoboot/trunk/m68k/cocoboot.c 2007-07-13 12:56:30 UTC (rev 1137)
@@ -94,6 +94,14 @@
}
}
+void log_clear(void)
+{
+ char buf[16];
+ FieldPtr fldP = FrmGetObjectPtr(mainform, FrmGetObjectIndex(mainform, LogField));
+ buf[0] = 0;
+ SetFieldTextFromStr(fldP, buf, true);
+}
+
void lprintf(const char *template, ...)
{
char buf[2048];
Modified: cocoboot/trunk/m68k/mainform.c
===================================================================
--- cocoboot/trunk/m68k/mainform.c 2007-07-13 11:32:23 UTC (rev 1136)
+++ cocoboot/trunk/m68k/mainform.c 2007-07-13 12:56:30 UTC (rev 1137)
@@ -195,14 +195,31 @@
Err err=0;
char loc[32];
UInt32 size = 1000;
+ UInt32 ftr_size;
Int32 vol, bytes;
lprintf("Loading %s... ", name);
vol = search_image(name, loc, sizeof(loc), &size);
if(vol < -1) goto out;
-
- if((err=FtrPtrNew (CREATOR_ID, FEATURE_NUM + n, size, image))) {
- lprintf("FtrPtrNew ");
+
+ ftr_size = size;
+ while (ftr_size) {
+ if(!(err=FtrPtrNew (CREATOR_ID, FEATURE_NUM + n, ftr_size, image))) {
+ break;
+ }
+
+ if (ftr_size == size) {
+ lprintf("alloc error, trying overwrite ram. ");
+ }
+
+ if (ftr_size < 102400)
+ ftr_size = 0;
+ else
+ ftr_size -= 102400;
+ }
+
+ if (!ftr_size) {
+ lprintf("Gave up. Boot ");
goto out;
}
@@ -252,7 +269,7 @@
UInt32 ret;
char *cmdline;
-
+ log_clear();
kernel_size = load_parts(0, "/zImage", &kernel);
if(kernel_size) {
if(use_initrd) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|