[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] [PATCH] Use FireTOS exported Pure C patcher
- To: mint@lists.fishpool.fi
- Subject: Re: [MiNT] [PATCH] Use FireTOS exported Pure C patcher
- From: Vincent Rivière <vincent.riviere@freesbee.fr>
- Date: Sat, 02 Mar 2013 17:44:54 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=pFftI33bkss4vg9LItxzTmIdnSNLqtei7db6sdQzt+Q=; b=pfADtm6OsFfM4oHOA29eIiipw2EnkXwjW1I9y+g+YBXUn0sPW5/KGNJGnlfTahIIDb sUxvs4+CD1wDli5XfyLPcsvzcYOqKS6w/XVvWO87ijIVGpfgJmDWaF//FPQZcXkf7V6D FXFwh+w1/xnycvZ5p8QH9BVmItX0T5P7RkyfQ2+GYeou4+s8Nndj0DZ23/AbeCKJ1w/E z4mx1Dti2CBHFHg3eqqGIYTMPXfAejblNmP6IWJnwgcyQMlHY8WRBVh5Lc/C+vjOTh9f MpvJj3kNqj7tt56NO2kNsgieppFu65bB7AKo/cKluxzpKze0izclx/dTvMkpofJ64Md8 Z0QA==
- In-reply-to: <CAL4YKD4UM1NUNg2Kgn=S10n5jqvztZWxgD3a8RwY73sgabxTMA@mail.gmail.com>
- List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
- List-id: <mint.lists.fishpool.fi>
- List-owner: <mailto:tjhukkan@fishpool.fi>
- List-post: <mailto:mint@lists.fishpool.fi>
- List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
- List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
- References: <op.wbip36czc60nap@linda-lt.mercatus.local> <1357335908.2002.71.camel@schizonils> <CAL4YKD77vMyY4qQn3nAnhz54Z6_c8Ush=kpD7Bjdjw_dPN+dcg@mail.gmail.com> <1357587776.27599.13.camel@schizonils> <CAL4YKD6zjkCJOC1S3tLLGYn=6WncqaOmSBZqSOb+WgmWf53jJA@mail.gmail.com> <CAL4YKD4UM1NUNg2Kgn=S10n5jqvztZWxgD3a8RwY73sgabxTMA@mail.gmail.com>
- Sender: mint-bounce@lists.fishpool.fi
- User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
On 28/02/2013 10:36, David Gálvez wrote:
I tested also Resource Master, that I think it's compiled also with Pure C.
Resource Master is indeed a good testcase. I found it in the official
FreeMiNT setup for the FireBee. Without any patch, it hangs at startup.
There was a big bug in the patch. get_toscookie() returns 0 on success, so
the internal patcher was still used with new FireTOS (while it probably
crashed with old FireTOS).
Please commit the attached patch.
I tested it with the new FireTOS beta from 03/02/2013, it works fine.
However, even if I double checked that the FireTOS exported routine was
really called, I didn't see any change from the internal FreeMiNT routine.
I even wrote testcases for move.b -(sp) and Line A (posted on the ACP
mailing list), both fails with any patcher. This demonstrate how limited is
the patch solution. Anyway, it's up to FireTOS to improve the patcher, now.
BTW: Is there still a problem with shel_write()?
--
Vincent Rivière
--- freemint-1.18.orig/sys/memory.c 2013-02-08 00:18:13.281250000 +0100
+++ freemint-1.18/sys/memory.c 2013-03-02 17:22:58.398323000 +0100
@@ -13,6 +13,7 @@
# include "memory.h"
# include "global.h"
+# include "cookie.h"
# include "libkern/libkern.h"
# include "mint/basepage.h"
@@ -1622,7 +1623,18 @@
* emulated via illegal instruction handler on ColdFire,
* so they require to be dynamically patched.
*/
- patch_memset_purec(b);
+ static void (*coldfire_purec_patcher)(BASEPAGE*) = NULL;
+
+ if (coldfire_purec_patcher == NULL)
+ {
+ ulong pexe = NULL;
+ if (get_toscookie(0x50455845L, &pexe) == 0 && pexe != NULL)
+ coldfire_purec_patcher = (void (*)(BASEPAGE*))pexe; // Patcher exported from FireTOS.
+ else
+ coldfire_purec_patcher = patch_memset_purec; // Fallback to internal MiNT patcher.
+ }
+
+ coldfire_purec_patcher(b);
}
#endif