From mint-bounce@lists.fishpool.fi Mon Mar 1 13:23:04 2010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type:subject :date:message-id:to:mime-version:x-mailer; bh=yxm421A2Xj8AdT9ABNgRJ4ZgXCk/87CLm+4nSf2+b1E=; b=chaccQwt3Qum0DwcbAG9Gv5UbtlYNFaAr19vSvpo1bn3jtlRT4fDTMg5cuudrHgTXc OzQYI2QkulmNZo0V3TS5Qzl+OHFEIBS2c/g3h7YRzoEhJ5OevaVO04Lby+ho6tHixCaw +bgQakUBoId5BeTfizQrYWpW6TweY2vsaIuKM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:subject:date:message-id:to:mime-version:x-mailer; b=t7/00/tYPd40kfAoI0mj5sl+Qx107idN2kqqp7eUdsYxCPCwMEiJZ5lH/zDG37Fm6p aEHxrW5ifGoQNJAUzULLhzFrWmWSpmaXrJ1egMsK98acBaY9gNgkZk5lw27cUwFDuP+T FHyMXourqiCa8JCKX1DBoNJa3WV4Ks729Upl0= From: Peter Persson Content-Type: multipart/mixed; boundary=Apple-Mail-8--749939403 Subject: [MiNT] Patch for xaloader.prg Date: Mon, 1 Mar 2010 19:19:12 +0100 Message-Id: <72454075-6FA5-46CA-A174-A3AE573771A6@gmail.com> To: mint Mailing-List Mime-Version: 1.0 (Apple Message framework v1077) X-Mailer: Apple Mail (2.1077) X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: pep.fishmoose@gmail.com Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: --Apple-Mail-8--749939403 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, I've made a small patch for Xaloader.prg. I think this change could be = useful to anyone who dual boots their CT60 machine (i.e. 030 and 060 = mode). Previous default behavior was: - if CPU !=3D 68000, load xaaes.km - if CPU =3D=3D 68000, load xaaes000.km My change: - if available, load xaaes.km - if not available, load kernel module based on CPU type (xaaes000.km, = xaaes010.km, xaaes020.km, xaaes030.km, xaaes040.km or xaaes060.km). Apart from this change, it should behave like before. I attached a DIFF = (thanks Patrice!). best regards -- PeP= --Apple-Mail-8--749939403 Content-Disposition: attachment; filename=xaloader_pep.diff Content-Type: application/octet-stream; name="xaloader_pep.diff" Content-Transfer-Encoding: 7bit --- ../xaloader.old/xaloader.c Fri Jul 13 23:33:02 2007 +++ xaloader.c Mon Mar 1 19:07:30 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,42 @@ else { long cpu; + char temp[384]; + + /* see if default kernel module is available */ name = DEFAULT; - /* if the system have a 68000 CPU we use the 68000 compiled - * module - */ - r = Ssystem(S_GETCOOKIE, C__CPU, &cpu); - if (r == 0 && cpu < 20) - name = DEFAULT_68000; + 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 0: + case 8: name = DEFAULT_68000; break; + case 10: + case 12: name = DEFAULT_68010; break; + 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 */ --Apple-Mail-8--749939403--