[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] Patch: shel_write() did not call the PureC patcher
On Wed, 2012-03-21 at 12:27 +0100, Jo Even Skarstein wrote:
> Coldfire: Programs compiled with PureC is now patched also when launched
> with XaAES shel_write().
The latest FireTOS beta now exports it's more advanced PureC patcher.
I've made a small change to make use of this in MiNT. Unfortunately I
have currently no place to set up my Firebee so I can't test it myself.
Could someone with a FireBee and the latest FireTOS beta apply this
patch and test it? Thanks :)
Jo Even
--- freemint_orig/sys/memory.c 2012-11-06 20:05:45.533397105 +0100
+++ freemint/sys/memory.c 2013-01-04 22:38:43.287525053 +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))
+ 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