[Mono-list] How can you add an MSIL instruction to mcs and mono?

apwilson@rogers.com apwilson@rogers.com
Tue, 10 Feb 2004 15:13:32 -0500


Hello everyone:
Thanks for the info you guys provided me for my last question.

I am currently attempting to add a new MSIL instruction to Mono for some research I am doing.  I was hoping someone could shed some light on how to do this or direct me to some documentation which would help me do this.

So far:
1) I've modifed mcs to recognize a keyword in a C# file and output MSIL code which conceptually does what I want:  I push a variable onto the "stack" with one instruction and then consume (pop) it with a previously unused instruction.

2) I've modified the disassembler to see the previously unused opcode as my new one.

3) I've attempted, and failed, to get mono to recognize this previously unused opcode and output the appropriate machine specific code. 

So basically I need to modify mono to map an MSIL opcode to machine specific code.  Sounds simple, but I know it isn't.  

Some files I *think* are involved with what I need to do are:
- mono/mini/inssel.brg
- mono/mini/mini.c
- mono/mini/mini-x86.c
- mono/arch/x86/x86-codegen.h

Any information about how mono recognizes MSIL opcodes and translates them into machine specific code or where I could find info about this would be much appreciated.


1