[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Fixes



Patrice Mandin wrote:
Speaking of fixes, there is a check in mintlib (or in its crt.o) that
display a message and exit, when you try to run a program,which was not
compiled for your cpu (i.e. running a 020 program on 68000). Well, it
does not work, but I don't remember exactly why.

You are probably speaking of that code in mintlib/main.c, in the function __libc_main()

	/* Check hardware requirements.  */
#ifdef __M68020__
	if (Getcookie (C__CPU, &l) != C_FOUND || l < 20)
		__libc_fatal ("this program requires an m68020 cpu or higher!");
#endif
#ifdef __M68881__
	if (Getcookie (C__FPU, &l) != C_FOUND || l == 0)
		__libc_fatal ("this program requires an fpu!");
#endif

It would be a good idea, but unfortunately a program compiled with -m68020-60 which is run on a 68000 crashes far before that test, in the function _crtinit(), because it is written in C and of course optimized for the target CPU, using specific instructions (it crashes on the instruction "extb.l")

The only reliable solution is to check for the CPU very early in assembler, when no C code has been called yet.

--
Vincent Rivière