On 10/22/2013 10:14 AM, Christian Menard wrote:

    On October 21st, 2013, 12:20 p.m. UTC, *Andreas Sandberg* wrote:

        It seems like the diff doesn't apply cleanly in RB. It happens from 
time to time, it's kinda crap.

        I think you probably don't want to add the 'default: Inst::INT(Ib);' to 
the SE-mode case, just using 'Inst::INT(Ib)' as the default when FullSystemInt 
!= 0 should suffice. I'd be very surprised if taking an interrupt in SE mode is 
going to do anything sensible.

        I think you should be able to do 'limm t1, imm, dataSize=8' instead of 
clearing t1 first.

        Also, are you sure the long mode test is correct? Isn't it supposed to 
be something like this:
        andi t0, t5, 0x1, flags=(EZF,)
        br rom_label("longModeSoftInterrupt"), flags=(nCEZF,)

        IIRC, the least significant bit of the handy m5 reg is 0 for long mode 
and 1 for the the legacy modes.

You are right about 'default: Inst::INT(Ib);', I just put it into the wrong 
block.

I thought about using 'limm t1, imm, dataSize=8' too. But I'm not sure how the 
byte sized immediate is treated. I think it will be sign extended this way.

You're right, it seems like the immediate is sign extended in the decode. It seems like the "right" way to solve it in that case is this (stolen from OUT_I_R):

       .adjust_imm trimImm(8)
        limm t1, imm, dataSize=8

The .adjust_imm statement masks out the lower 8 bits of the immediate when the macro instruction is created, which means that the limm statement will load 0 into the high 56 bits of t1.

The long mode test is correct. It does not check the IIRC but the 3 bits left 
of it. They represent the submode, in 64-bit mode these bits are 0. But just 
checking the least significant bit should do the same trick. But in the 'br' 
instruction ypu have to check for the 'CEZF', because the result of the 'andi' 
is 0 in long mode.

I might be wrong here, but I really don't think that's the case. For example, X86FaultBase::invoke() only checks the mode field (the least significant bit) when selecting which interrupt delivery entry point to use. If I understand the x86 modes correctly, you would be in LongMode and submode CompatabilityMode (submode 1) when running 32-bit code on a 64-bit kernel. In this case, you probably want to run the long-mode code. Your code would run the legacy mode interrupt code in that case, which I believe to be wrong.

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

Reply via email to