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

Re: Bug#658914: imvirt: does not know about ARAnyM (m68k Atari emulator)



On Sun, Feb 12, 2012 at 20:08, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Finn Thain <fthain@telegraphics.com.au> writes:
>
>> I don't know what those differences might be but the aranym developers may
>> have some ideas. They may even know how to get the CPU to identify itself.
>
> You could probe for the natfeat instruction.

The userspace program below nicely crashes ARAnyM (0.9.9-1 Ubuntu) with

| Gotcha! Illegal memory access. Atari PC = $800004dc
| If the Full History was enabled you would see the last 20 instructions here.

#include <stdio.h>

asm("\n"
"       .global nf_get_id,nf_call\n"
"nf_get_id:\n"
"       .short  0x7300\n"
"       rts\n"
"nf_call:\n"
"       .short  0x7301\n"
"       rts\n"
"1:     moveq.l #0,%d0\n"
"       rts\n"
"       .section __ex_table,\"a\"\n"
"       .long   nf_get_id,1b\n"
"       .long   nf_call,1b\n"
"       .previous");

int main()
{
        unsigned long id, version;
        char buf[256];

        id = nf_get_id("NF_VERSION");
        if (!id)
                return;
        version = nf_call(id);

        id = nf_get_id("NF_NAME");
        if (!id)
                return;
        nf_call(id, buf, 256);
        buf[255] = 0;

        printf("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
                version & 0xffff);

	return 0;
}

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


Reply to: