Hi,

a while ago I wrote some code implementing x86s 'int' and 'int3' instructions 
(review request: http://reviews.gem5.org/r/1939/). These instructions are used 
to trigger software interrupts. 
This feature is used by many operating systems to trigger system calls. Of 
course amd64 introduced the new syscall instruction which does things faster. 
But it is not always so easy to port your os to use this instruction. So in my 
opinion not supporting 'int' and 'int3' is a big problem and prevents gem5 
from supporting other OSes than Linux (In my case it's Fiasco.OC 
http://os.inf.tu-dresden.de/fiasco/)

In the meantime I rewrote the instruction implementation. It now jumps to the 
interrupt handling code in 'arch/x86/isa/insts/romutil.py' which is already 
used for hardware interrupts. But my Problem is to actual call this code. In 
the Decoder (x86/isa/decoder/one_byte_opcodes.isa) you can find this:

>> 0x5: decode FullSystemInt default int_Ib() {
>>              0: decode IMMEDIATE {
>>                      // Really only the LSB matters, but the decoder
>>                      // will sign extend it, and there's no easy way to
>>                      // specify only checking the first byte.
>>                      0xffffffffffffff80:
>>                              SyscallInst::int80('xc->syscall(Rax)',
>>                                      IsSyscall, IsNonSpeculative, 
IsSerializeAfter);
>>                      }
>>              }

As far as I understand it, it checks whether 'int 80' is used. 'int 80' 
triggers a system call in Linux. So it checks for a system call and calls a 
handling routine. I think this is only needed in system emulation mode. Is 
this correct?

For now I just replaced the code with a call of INT_IB(). But this breaks with 
the syscall handling in SE mode.

So my question is how to do it better? Is there a way to determine whether we 
are in SE or FS mode in the decoder and decide what is to be done based on the 
current mode?

Thanks
Christian
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to