From mint-bounce@lists.fishpool.fi Sun May 31 06:28:01 2009 Message-ID: <4A225A61.9000901@freesbee.fr> Date: Sun, 31 May 2009 12:22:25 +0200 From: =?ISO-8859-1?Q?Vincent_Rivi=E8re?= User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: mint Subject: [MiNT] CPU detection broken Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Antivirus: avast! (VPS 090530-0, 30/05/2009), Outbound message X-Antivirus-Status: Clean X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: vincent.riviere@freesbee.fr Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.sparemint.org id n4VARtMV020006 Hello. The current MiNTLib has a mechanism for detecting if the actual CPU (from cookies) is compatible with the program being run. If it is not the case, it tries to display a message like "this program requires an m68020 cpu or higher!". But it does not work. If I compile a "Hello, World!" with -m68020-60 then I run it on a plain ST, I get 4 bombs instead of the expected message :-( Basically, the CPU check occurs *after* using special CPU features, so it crashes before reaching the test (actually, with an extb.l instruction generated inside parseargs()). The only solution is to use only assembly instructions compatible with all CPUs (including ColdFire) before the CPU check. Since GCC cannot produce such code, it has to be written manually in assembly. Fortunately, it is not complicated. So I propose to write a check_cpu() function fully in compatible assembly, and to call it form crt0.S as soon as possible. It will probably require to rewrite the Getcookie() and get_sysvar() functions in assembler, too. I'm going to make a patch for that. If someone has a better idea, please tell it. -- Vincent Rivière