	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocxl_link_remove_pe            ## -- Begin function ocxl_link_remove_pe
	.p2align	4, 0x90
_ocxl_link_remove_pe:                   ## @ocxl_link_remove_pe
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_SPA_PASID_MAX@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_10
LBB0_2:
	movl	%esi, %ebx
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %r12
	movq	_SPA_PE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	andl	%esi, %r15d
	movslq	%r15d, %r13
	movq	8(%r12), %r14
	movq	%r12, %rdi
	callq	_mutex_lock
	leaq	(%r13,%r13,2), %r13
	movl	8(%r14,%r13,4), %edi
	callq	_be32_to_cpu
	movq	_SPA_PE_VALID@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_3
## %bb.4:
	leaq	(%r14,%r13,4), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_current@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	8(%r12), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	4(%r14,%r13,4), %edi
	callq	_be32_to_cpu
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	(%r14,%r13,4), %edi
	callq	_be32_to_cpu
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%ebx, %edx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%eax, %r8d
	callq	_trace_ocxl_context_remove
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	xorl	%esi, %esi
	movl	$12, %edx
	callq	_memset
	xorl	%eax, %eax
	callq	_mb
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movl	%r15d, %esi
	callq	_pnv_ocxl_spa_remove_pe_from_cache
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_WARN_ON
	leaq	4(%r12), %rdi
	movl	%r15d, %esi
	callq	_radix_tree_delete
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r15
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.7:
	callq	_mm_context_remove_copro
	movq	(%r15), %rdi
	callq	_mmdrop
LBB0_8:
	movq	_rcu@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_kfree_rcu
	jmp	LBB0_9
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_9
LBB0_5:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_WARN
LBB0_9:
	movq	%r12, %rdi
	callq	_mutex_unlock
LBB0_10:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SPA_PASID_MAX,4,2              ## @SPA_PASID_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SPA_PE_MASK,4,2                ## @SPA_PE_MASK
	.comm	_SPA_PE_VALID,4,2               ## @SPA_PE_VALID
	.comm	_current,8,3                    ## @current
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Couldn't find pe data when removing PE\n"

	.comm	_rcu,4,2                        ## @rcu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocxl_link_remove_pe            ; -- Begin function ocxl_link_remove_pe
	.p2align	2
_ocxl_link_remove_pe:                   ; @ocxl_link_remove_pe
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
Lloh0:
	adrp	x8, _SPA_PASID_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SPA_PASID_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ge	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_10
LBB0_2:
	mov	x21, x1
	mov	x20, x0
	ldr	x19, [x0, #8]
Lloh6:
	adrp	x8, _SPA_PE_MASK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SPA_PE_MASK@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	and	w22, w8, w1
	ldr	x23, [x19, #8]
	mov	x0, x19
	bl	_mutex_lock
	mov	w8, #12
	smaddl	x8, w22, w8, x23
	ldr	w0, [x8, #8]
	bl	_be32_to_cpu
Lloh9:
	adrp	x8, _SPA_PE_VALID@GOTPAGE
Lloh10:
	ldr	x8, [x8, _SPA_PE_VALID@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_7
; %bb.3:
	sxtw	x22, w22
	mov	w8, #12
	madd	x23, x22, x8, x23
Lloh12:
	adrp	x8, _current@GOTPAGE
Lloh13:
	ldr	x8, [x8, _current@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	ldr	w24, [x8]
	ldr	x25, [x19, #8]
	ldr	w0, [x23, #4]
	bl	_be32_to_cpu
	mov	x26, x0
	ldr	w0, [x23]
	bl	_be32_to_cpu
	mov	x4, x0
	mov	x0, x24
	mov	x1, x25
	mov	x2, x21
	mov	x3, x26
	bl	_trace_ocxl_context_remove
	mov	x0, x23
	mov	w1, #0
	mov	w2, #12
	bl	_memset
	bl	_mb
	ldr	w0, [x20]
	mov	x1, x22
	bl	_pnv_ocxl_spa_remove_pe_from_cache
	mov	x20, x0
	bl	_WARN_ON
	add	x0, x19, #4
	mov	x1, x22
	bl	_radix_tree_delete
	cbz	x0, LBB0_8
; %bb.4:
	mov	x21, x0
	ldr	x0, [x0]
	cbz	x0, LBB0_6
; %bb.5:
	bl	_mm_context_remove_copro
	ldr	x0, [x21]
	bl	_mmdrop
LBB0_6:
Lloh15:
	adrp	x8, _rcu@GOTPAGE
Lloh16:
	ldr	x8, [x8, _rcu@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_kfree_rcu
	b	LBB0_9
LBB0_7:
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_9
LBB0_8:
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_WARN
LBB0_9:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_10:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_SPA_PASID_MAX,4,2              ; @SPA_PASID_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SPA_PE_MASK,4,2                ; @SPA_PE_MASK
	.comm	_SPA_PE_VALID,4,2               ; @SPA_PE_VALID
	.comm	_current,8,3                    ; @current
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Couldn't find pe data when removing PE\n"

	.comm	_rcu,4,2                        ; @rcu
.subsections_via_symbols
