	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rk_iommu_map_iova
_rk_iommu_map_iova:                     ## @rk_iommu_map_iova
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	_SPAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r9, %rax
	orq	%rsi, %rax
	shrq	$32, %rax
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movq	%r9, -88(%rbp)                  ## 8-byte Spill
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	je	LBB0_1
## %bb.2:
	movq	%r9, %rax
	xorl	%edx, %edx
	divq	%rsi
	movq	%rax, %r12
	jmp	LBB0_3
LBB0_1:
	movl	%r9d, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %r12d
LBB0_3:
	movq	%r15, %rdi
	callq	_assert_spin_locked
	testl	%r12d, %r12d
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	je	LBB0_7
## %bb.4:
	movl	16(%rbp), %r13d
	movl	%r12d, %r15d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rbx,%r12,4), %edi
	callq	_rk_pte_is_page_valid
	testq	%rax, %rax
	jne	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%r14, %rdi
	movl	%r13d, %esi
	callq	_rk_mk_pte
	movl	%eax, (%rbx,%r12,4)
	movq	_SPAGE_SIZE@GOTPCREL(%rip), %rax
	addq	(%rax), %r14
	incq	%r12
	cmpq	%r15, %r12
	jne	LBB0_5
LBB0_7:
	movq	%r14, -72(%rbp)
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_rk_table_flush
	movq	%rbx, %rdi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	callq	_rk_iommu_zap_iova_first_last
	xorl	%eax, %eax
	jmp	LBB0_9
LBB0_8:
	movq	%r14, -72(%rbp)
	movq	_SPAGE_SIZE@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	imull	%r12d, %ecx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_rk_iommu_unmap_iova
	movl	(%r14), %eax
	imull	%r12d, %eax
	addl	-48(%rbp), %eax                 ## 4-byte Folded Reload
	movl	%eax, -52(%rbp)
	movl	(%rbx,%r12,4), %edi
	callq	_rk_pte_page_address
	movq	%rax, -96(%rbp)
	leaq	L_.str(%rip), %rdi
	leaq	-52(%rbp), %rsi
	leaq	-96(%rbp), %rdx
	leaq	-72(%rbp), %rcx
	movl	%r13d, %r8d
	callq	_pr_err
	movq	_EADDRINUSE@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SPAGE_SIZE,8,3                 ## @SPAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"iova: %pad already mapped to %pa cannot remap to phys: %pa prot: %#x\n"

	.comm	_EADDRINUSE,4,2                 ## @EADDRINUSE
	.no_dead_strip	_rk_iommu_map_iova
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rk_iommu_map_iova
_rk_iommu_map_iova:                     ; @rk_iommu_map_iova
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x6
	mov	x21, x5
	mov	x25, x4
	mov	x23, x3
	mov	x20, x2
	mov	x24, x1
	mov	x22, x0
Lloh0:
	adrp	x27, _SPAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x27, [x27, _SPAGE_SIZE@GOTPAGEOFF]
	ldr	x8, [x27]
	udiv	x26, x5, x8
	bl	_assert_spin_locked
	str	w20, [sp, #4]                   ; 4-byte Folded Spill
	cbz	w26, LBB0_4
; %bb.1:
	mov	x28, #0
	and	x20, x26, #0xffffffff
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x24, x28, lsl #2]
	bl	_rk_pte_is_page_valid
	cbnz	x0, LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x0, x25
	mov	x1, x19
	bl	_rk_mk_pte
	str	w0, [x24, x28, lsl #2]
	ldr	x8, [x27]
	add	x25, x25, x8
	add	x28, x28, #1
	cmp	x28, x20
	b.ne	LBB0_2
LBB0_4:
	str	x25, [sp, #16]
	mov	x0, x22
	ldr	w1, [sp, #4]                    ; 4-byte Folded Reload
	mov	x2, x26
	bl	_rk_table_flush
	mov	x0, x22
	mov	x1, x23
	mov	x2, x21
	bl	_rk_iommu_zap_iova_first_last
	mov	w0, #0
	b	LBB0_6
LBB0_5:
	str	x25, [sp, #16]
	ldr	w8, [x27]
	mul	w3, w28, w8
	mov	x0, x22
	mov	x1, x24
	ldr	w2, [sp, #4]                    ; 4-byte Folded Reload
	bl	_rk_iommu_unmap_iova
	ldr	w8, [x27]
	madd	w8, w28, w8, w23
	str	w8, [sp, #28]
	ldr	w0, [x24, x28, lsl #2]
	bl	_rk_pte_page_address
	str	x0, [sp, #8]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	add	x1, sp, #28
	add	x2, sp, #8
	add	x3, sp, #16
	mov	x4, x19
	bl	_pr_err
Lloh4:
	adrp	x8, _EADDRINUSE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EADDRINUSE@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_SPAGE_SIZE,8,3                 ; @SPAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"iova: %pad already mapped to %pa cannot remap to phys: %pa prot: %#x\n"

	.comm	_EADDRINUSE,4,2                 ; @EADDRINUSE
	.no_dead_strip	_rk_iommu_map_iova
.subsections_via_symbols
