[Mono-devel-list] Mini: cpu-pentium.md
Varga Zoltan
vargaz at freemail.hu
Sun Mar 28 12:31:10 EST 2004
Hi,
Answers below...
> -----Original Message-----
> From: mono-devel-list-admin at lists.ximian.com
> [mailto:mono-devel-list-admin at lists.ximian.com]On Behalf
Of ext
> Willibald Krenn
> Sent: Tuesday, March 23, 2004 4:08 PM
> To: mono-devel-list at lists.ximian.com
> Subject: [Mono-devel-list] Mini: cpu-pentium.md
>
>
>
> Hi!
>
> In the process of doing an AMD64 port of mini, I'm
investigating the
> cpu-pentium.md file. Unfortunately some questions arised when
> looking at
> the first few CIL-Instructions in detail:
>
> - It says that 'len' is required.
> Then why e.g. Conv.U4 does not have a length assigned
(would be the
> same as Conv.I4 - namely 2 - AFAIK?)
If the length is not specified, it defaults to 0. But
lengths are only
checked if the given opcode is encountered during
compilation. Some
opcodes, like CONV_U4 are transformed into other opcodes in the
.brg files, so they do not show up during code generation.
Some of
these opcodes are mistakenly left in the CPU description
files, they
could probably be removed.
>
> - CEE_JMP's length is - according to the file - 32 Bytes.
> How was that figure obtained?
> I did some calcs too and came out with following:
>
> # mono_arch_instrument_epilog:
> # Sub = 3
> # FST = 3
> # SUB = 3
> # FST = 3
> # Push = 5
> # Call = 5
> # Add = 3
> # FLD = 3
> # Add = 3
> #
> # lea = 4
> # 3x pop = 3
> # leave = 1
> # jmp imm32 = 5
>
> That would give a total of 44 bytes?
>
As I said above, opcode lengths are only checked during code
generation, so if the actual length is greater than the max
length,
you will get an assertion. In this case, the max length is
wrong, but
nobody ran into this particular case yet.
> - CEE_DIV hast a length of 15, but only does a
> x86_cdq (code);
> x86_div_reg (code, ins->sreg2, TRUE);
> which would give a length of 1 + 2 == 3
>
The length field is an upper bound on the maximum length, so
it is
sometimes set to a big value out of laziness.
Zoltan
More information about the Mono-devel-list
mailing list