| 
 To minimize the code on 68000-kernels, this code should 
be left out of 68000-kernels. xaes000.km is the only sensible XaAES to load with 
these kernels anyway. The same applies to the Aranym- and Milan-kernels, they 
should only look for xaaes.km. None of these systems can be "dual-booted" with 
different CPUs. 
Jo Even 
From: Peter Persson  
Sent: Monday, March 01, 2010 10:20 PM 
Subject: Re: [MiNT] Xaloader patch, take #2 Sorry for spamming, hopefully I'll get this right in the future. 
On 1 mar 2010, at 22.11, Miro Kropacek wrote: + //if (r == 0 && cpu < 20) --- ../xaloader.old/xaloader.c Fri Jul 13 23:33:02 2007 
+++ xaloader.c 
Mon Mar  1 22:17:16 2010 
@@ -10,6 +10,12 @@ 
 #define DEFAULT        "xaaes.km" 
 #define DEFAULT_68000  "xaaes000.km" 
+#define DEFAULT_68000  "xaaes000.km" 
+#define DEFAULT_68010  "xaaes010.km" 
+#define DEFAULT_68020  "xaaes020.km" 
+#define DEFAULT_68030  "xaaes030.km" 
+#define DEFAULT_68040  "xaaes040.km" 
+#define DEFAULT_68060  "xaaes060.km" 
 static void 
 my_strlcpy(char *dst, const char *src, size_t n) 
@@ -57,7 +63,9 @@ 
 } 
 /* 
- * - without an argument try to load xaaes.km from sysdir 
+ * - without an argument: 
+ *   - try to load xaaes.km from sysdir 
+ *   - if xaaes.km is not available, try to load module based on CPU 
type 
  * - with argument: 
  *   - without a path separator try to load this from 
sysdir 
  *   - with path separator go to this dir and load the 
module 
@@ -141,15 +149,43 @@ 
  
else 
  { 
  long 
cpu; 
-  
- name = 
DEFAULT; 
-  
+ char 
temp[384]; 
+ 
  /* if the 
system have a 68000 CPU we use the 68000 compiled 
- * module 
+ * module by 
default 
  */ 
  r = 
Ssystem(S_GETCOOKIE, C__CPU, &cpu); 
  if (r == 
0 && cpu < 20) 
  name = 
DEFAULT_68000; 
+ else 
+ name = 
DEFAULT; 
+  
+ 
my_strlcpy(temp, path, sizeof(path)); 
+ r = 
Dsetpath(temp); 
+ r = 
Dgetpath(temp, 0); 
+  
+ 
my_strlcat(temp, "\\", sizeof(temp)); 
+ 
my_strlcat(temp, name, sizeof(temp)); 
+  
+ fh = 
Fopen(temp, O_RDONLY); 
+ if (fh < 
0) 
+ { 
+ /* default 
kernel module not available, select module based on CPU type */ 
+ r = 
Ssystem(S_GETCOOKIE, C__CPU, &cpu); 
+ if(r == 
0) 
+ { 
+ 
switch(cpu) 
+ { 
+ case 20: name = DEFAULT_68020; break; 
+ case 30: name = DEFAULT_68030; break; 
+ case 40: name = DEFAULT_68040; break; 
+ case 60: name = DEFAULT_68060; break; 
+  
+ default: break; 
+ } 
+ } 
+ } 
+ 
Fclose((int)fh); 
  } 
  /* change 
to the XaAES module directory */ 
 |