Thanks to the people who offered to review and test (and Jurgen for 
having already done so).

To patch the existing driver during boot, try the following:

    - Boot with the debugger loaded, and break in early (-kd).
    - When the debugger loads, set a breakpoint to fire when the xnf
      driver is attached:
[0]> ::bp xnf`xnf_attach
[0]> :c

    - When the breakpoint fires, we need to patch xnf_getcapab():
[0]> xnf_getcapab::dis
xnf`xnf_getcapab:               pushq  %rbp
xnf`xnf_getcapab+1:             movq   %rsp,%rbp
xnf`xnf_getcapab+4:             subq   $0x20,%rsp
xnf`xnf_getcapab+8:             movq   %rdi,-0x8(%rbp)
xnf`xnf_getcapab+0xc:           movq   %rsi,-0x10(%rbp)
xnf`xnf_getcapab+0x10:          movq   %rdx,-0x18(%rbp)
xnf`xnf_getcapab+0x14:          cmpl   $0x1,%esi
xnf`xnf_getcapab+0x17:          jne    +0x14    <xnf`xnf_getcapab+0x2d>
xnf`xnf_getcapab+0x19:          cmpl   $0x0,0x48(%rdi)
xnf`xnf_getcapab+0x1d:          jne    +0x6     <xnf`xnf_getcapab+0x25>
xnf`xnf_getcapab+0x1f:          xorl   %eax,%eax
xnf`xnf_getcapab+0x21:          movl   %eax,(%rdx)
xnf`xnf_getcapab+0x23:          jmp    +0xd     <xnf`xnf_getcapab+0x32>
xnf`xnf_getcapab+0x25:          movl   $0x4,(%rdx)
                                           ^ this needs to be a 2
xnf`xnf_getcapab+0x2b:          jmp    +0x5     <xnf`xnf_getcapab+0x32>
xnf`xnf_getcapab+0x2d:          cmpl   $0x2,%esi
xnf`xnf_getcapab+0x30:          jne    +0x7     <xnf`xnf_getcapab+0x39>
xnf`xnf_getcapab+0x32:          movl   $0x1,%eax
xnf`xnf_getcapab+0x37:          jmp    +0x2     <xnf`xnf_getcapab+0x3b>
xnf`xnf_getcapab+0x39:          xorl   %eax,%eax
xnf`xnf_getcapab+0x3b:          leave
xnf`xnf_getcapab+0x3c:          ret

    - do the patching:
[0]> xnf_getcapab+0x25/3 B
xnf`xnf_getcapab+0x25:          c7      2       4
[0]> xnf_getcapab+0x27/B
xnf`xnf_getcapab+0x27:          4
[0]> xnf_getcapab+0x27/v 2
xnf`xnf_getcapab+0x27:          0x4     =       0x2

    - check that it worked:
[0]> xnf_getcapab+0x25::dis -n 1
xnf`xnf_getcapab+0x23:          jmp    +0xd     <xnf`xnf_getcapab+0x32>
xnf`xnf_getcapab+0x25:          movl   $0x2,(%rdx)
xnf`xnf_getcapab+0x2b:          jmp    +0x5     <xnf`xnf_getcapab+0x32>
[0]> :c

      - Everything should come up normally, with the exception that
        checksum offload should work properly.

Don't forget to get rid of the /etc/system tunable for 
xnf_checksum_offload before you do this!

dme.


_______________________________________________
xen-discuss mailing list
[email protected]

Reply via email to