Page MenuHomeFreeBSD
Paste P540

rmlock with and without open-coded critical_*()
ActivePublic

Authored by markj on Feb 26 2022, 2:29 PM.
Tags
None
Referenced Files
F37548035: rmlock with and without open-coded critical_*()
Feb 26 2022, 2:29 PM
Subscribers
None
Unpatched (also without get_pcpu() patch):
0xffffffff80bfe8c0 <+0>: push %rbp
0xffffffff80bfe8c1 <+1>: mov %rsp,%rbp
0xffffffff80bfe8c4 <+4>: mov %gs:0x0,%rax
0xffffffff80bfe8cd <+13>: cmpw $0x0,0x13a(%rax)
0xffffffff80bfe8d5 <+21>: jne 0xffffffff80bfe967 <_rm_rlock+167>
0xffffffff80bfe8db <+27>: movl $0x0,0x20(%rsi)
0xffffffff80bfe8e2 <+34>: mov %rax,0x18(%rsi)
0xffffffff80bfe8e6 <+38>: mov %rdi,0x10(%rsi)
0xffffffff80bfe8ea <+42>: testb $0x10,0xa(%rdi)
0xffffffff80bfe8ee <+46>: je 0xffffffff80bfe8f7 <_rm_rlock+55>
0xffffffff80bfe8f0 <+48>: addl $0x1,0x378(%rax)
0xffffffff80bfe8f7 <+55>: addl $0x1,0x4bc(%rax)
0xffffffff80bfe8fe <+62>: movslq 0x6bc(%rax),%rcx
0xffffffff80bfe905 <+69>: mov -0x7e329dd0(,%rcx,8),%r8
0xffffffff80bfe90d <+77>: lea 0x90(%r8),%rcx
0xffffffff80bfe914 <+84>: mov %rcx,0x8(%rsi)
0xffffffff80bfe918 <+88>: mov 0x90(%r8),%rcx
0xffffffff80bfe91f <+95>: mov %rcx,(%rsi)
0xffffffff80bfe922 <+98>: mov %rsi,0x8(%rcx)
0xffffffff80bfe926 <+102>: mov %rsi,0x90(%r8)
0xffffffff80bfe92d <+109>: addl $0x1,0x164(%rax)
0xffffffff80bfe934 <+116>: addl $0xffffffff,0x4bc(%rax)
0xffffffff80bfe93b <+123>: movzbl 0x130(%rax),%r9d
0xffffffff80bfe943 <+131>: mov 0x3c(%r8),%eax
0xffffffff80bfe947 <+135>: mov %rax,%rcx
0xffffffff80bfe94a <+138>: shr $0x3,%rcx
0xffffffff80bfe94e <+142>: and $0x1ffffff8,%ecx
0xffffffff80bfe954 <+148>: mov 0x18(%rdi,%rcx,1),%r8
0xffffffff80bfe959 <+153>: xor %ecx,%ecx
0xffffffff80bfe95b <+155>: bt %rax,%r8
0xffffffff80bfe95f <+159>: setb %cl
0xffffffff80bfe962 <+162>: or %r9d,%ecx
0xffffffff80bfe965 <+165>: jne 0xffffffff80bfe96e <_rm_rlock+174>
0xffffffff80bfe967 <+167>: mov $0x1,%eax
0xffffffff80bfe96c <+172>: pop %rbp
0xffffffff80bfe96d <+173>: ret
0xffffffff80bfe96e <+174>: pop %rbp
0xffffffff80bfe96f <+175>: jmp 0xffffffff80bfe980 <_rm_rlock_hard>
Patched:
0xffffffff80bffeb0 <+0>: push %rbp
0xffffffff80bffeb1 <+1>: mov %rsp,%rbp
0xffffffff80bffeb4 <+4>: push %r15
0xffffffff80bffeb6 <+6>: push %r14
0xffffffff80bffeb8 <+8>: push %r13
0xffffffff80bffeba <+10>: push %r12
0xffffffff80bffebc <+12>: push %rbx
0xffffffff80bffebd <+13>: push %rax
0xffffffff80bffebe <+14>: mov %gs:0x0,%rbx
0xffffffff80bffec7 <+23>: cmpw $0x0,0x13a(%rbx)
0xffffffff80bffecf <+31>: jne 0xffffffff80bfff6e <_rm_rlock+190>
0xffffffff80bffed5 <+37>: mov %edx,%r14d
0xffffffff80bffed8 <+40>: mov %rsi,%r12
0xffffffff80bffedb <+43>: mov %rdi,%r15
0xffffffff80bffede <+46>: movl $0x0,0x20(%rsi)
0xffffffff80bffee5 <+53>: mov %rbx,0x18(%rsi)
0xffffffff80bffee9 <+57>: mov %rdi,0x10(%rsi)
0xffffffff80bffeed <+61>: testb $0x10,0xa(%rdi)
0xffffffff80bffef1 <+65>: je 0xffffffff80bffefa <_rm_rlock+74>
0xffffffff80bffef3 <+67>: addl $0x1,0x378(%rbx)
0xffffffff80bffefa <+74>: addl $0x1,0x4bc(%rbx)
0xffffffff80bfff01 <+81>: mov %gs:0x180,%r13
0xffffffff80bfff0a <+90>: lea 0x90(%r13),%rax
0xffffffff80bfff11 <+97>: mov %rax,0x8(%r12)
0xffffffff80bfff16 <+102>: mov 0x90(%r13),%rax
0xffffffff80bfff1d <+109>: mov %rax,(%r12)
0xffffffff80bfff21 <+113>: mov %r12,0x8(%rax)
0xffffffff80bfff25 <+117>: mov %r12,0x90(%r13)
0xffffffff80bfff2c <+124>: addl $0x1,0x164(%rbx)
0xffffffff80bfff33 <+131>: addl $0xffffffff,0x4bc(%rbx)
0xffffffff80bfff3a <+138>: cmpb $0x0,0x130(%rbx)
0xffffffff80bfff41 <+145>: jne 0xffffffff80bfff82 <_rm_rlock+210>
0xffffffff80bfff43 <+147>: movzbl 0x130(%rbx),%eax
0xffffffff80bfff4a <+154>: mov 0x3c(%r13),%ecx
0xffffffff80bfff4e <+158>: mov %rcx,%rdx
0xffffffff80bfff51 <+161>: shr $0x3,%rdx
0xffffffff80bfff55 <+165>: and $0x1ffffff8,%edx
0xffffffff80bfff5b <+171>: mov 0x18(%r15,%rdx,1),%rdx
0xffffffff80bfff60 <+176>: xor %esi,%esi
0xffffffff80bfff62 <+178>: bt %rcx,%rdx
0xffffffff80bfff66 <+182>: setb %sil
0xffffffff80bfff6a <+186>: or %eax,%esi
0xffffffff80bfff6c <+188>: jne 0xffffffff80bfff89 <_rm_rlock+217>
0xffffffff80bfff6e <+190>: mov $0x1,%eax
0xffffffff80bfff73 <+195>: add $0x8,%rsp
0xffffffff80bfff77 <+199>: pop %rbx
0xffffffff80bfff78 <+200>: pop %r12
0xffffffff80bfff7a <+202>: pop %r13
0xffffffff80bfff7c <+204>: pop %r14
0xffffffff80bfff7e <+206>: pop %r15
0xffffffff80bfff80 <+208>: pop %rbp
0xffffffff80bfff81 <+209>: ret
0xffffffff80bfff82 <+210>: call 0xffffffff80c10fa0 <critical_exit_preempt>
0xffffffff80bfff87 <+215>: jmp 0xffffffff80bfff43 <_rm_rlock+147>
0xffffffff80bfff89 <+217>: mov %r15,%rdi
0xffffffff80bfff8c <+220>: mov %r12,%rsi
0xffffffff80bfff8f <+223>: mov %r14d,%edx
0xffffffff80bfff92 <+226>: add $0x8,%rsp
0xffffffff80bfff96 <+230>: pop %rbx
0xffffffff80bfff97 <+231>: pop %r12
0xffffffff80bfff99 <+233>: pop %r13
0xffffffff80bfff9b <+235>: pop %r14
0xffffffff80bfff9d <+237>: pop %r15
0xffffffff80bfff9f <+239>: pop %rbp
0xffffffff80bfffa0 <+240>: jmp 0xffffffff80bfffe0 <_rm_rlock_hard>