1. 25 9月, 2014 1 次提交
    • A
      sparc: bpf_jit: fix loads from negative offsets · 35607b02
      Alexei Starovoitov 提交于
      - fix BPF_LD|ABS|IND from negative offsets:
        make sure to sign extend lower 32 bits in 64-bit register
        before calling C helpers from JITed code, otherwise 'int k'
        argument of bpf_internal_load_pointer_neg_helper() function
        will be added as large unsigned integer, causing packet size
        check to trigger and abort the program.
      
        It's worth noting that JITed code for 'A = A op K' will affect
        upper 32 bits differently depending whether K is simm13 or not.
        Since small constants are sign extended, whereas large constants
        are stored in temp register and zero extended.
        That is ok and we don't have to pay a penalty of sign extension
        for every sethi, since all classic BPF instructions have 32-bit
        semantics and we only need to set correct upper bits when
        transitioning from JITed code into C.
      
      - though instructions 'A &= 0' and 'A *= 0' are odd, JIT compiler
        should not optimize them out
      Signed-off-by: NAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      35607b02
  2. 18 4月, 2012 2 次提交
    • D
      net: filter: Fix some more small issues in sparc JIT. · 584c5e2a
      David S. Miller 提交于
      Fix mixed space and tabs.
      
      Put bpf_jit_load_*[] externs into bpf_jit.h
      
      "while(0)" --> "while (0)"
      "COND (X)" --> "COND(X)"
      Document branch offset calculations, and bpf_error's return
      sequence.
      
      Document the reason we need to emit three nops between the
      %y register write and the divide instruction.
      
      Remove erroneous trailing semicolons from emit_read_y() and
      emit_write_y().
      
      Based upon feedback from Sam Ravnborg.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      584c5e2a
    • D
      net: filter: Fix some minor issues in sparc JIT. · 7b56f76e
      David S. Miller 提交于
      Correct conventions comments.  %o4 and %o5 were swapped,
      %g3 was not documented.
      
      Use r_TMP instead of r_SKB_DATA + r_OFF where possible in
      assembler stubs.
      
      Correct discussion of %o4 and %o5 in one of bpf_jit_compile()'s
      comments.
      
      Based upon feedback from Richard Mortimer.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7b56f76e
  3. 17 4月, 2012 1 次提交