	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function panfrost_mmu_map_fault_addr
_panfrost_mmu_map_fault_addr:           ## @panfrost_mmu_map_fault_addr
	.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
	movl	%edx, %r14d
	movl	%esi, %r13d
	movq	%rdi, %rbx
	callq	_addr_to_drm_mm_node
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r15
	cmpl	$0, 68(%rax)
	je	LBB0_3
## %bb.4:
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	48(%r15), %rax
	xorl	%edi, %edi
	cmpl	%r13d, (%rax)
	setne	%dil
	callq	_WARN_ON
	movq	_SZ_2M@GOTPCREL(%rip), %rbx
	xorl	%r12d, %r12d
	subl	(%rbx), %r12d
	andl	%r14d, %r12d
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%r12d, -64(%rbp)                ## 4-byte Spill
	sarl	%cl, %r12d
	subl	64(%r15), %r12d
	leaq	32(%r15), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	40(%r15), %r14
	testq	%r14, %r14
	je	LBB0_5
LBB0_11:
	movl	%r13d, -60(%rbp)                ## 4-byte Spill
	movq	24(%r15), %rax
	movq	(%rax), %rbx
	movq	%rbx, %rdi
	callq	_mapping_set_unevictable
	movq	_NUM_FAULT_PAGES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	movslq	%r12d, %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	jle	LBB0_16
## %bb.12:
	movslq	-44(%rbp), %r13                 ## 4-byte Folded Reload
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_shmem_read_mapping_page
	movq	%rax, (%r14,%r12,8)
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	jne	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_14 Depth=1
	incq	%r12
	movq	_NUM_FAULT_PAGES@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	%r13, %rax
	cmpq	%rax, %r12
	jl	LBB0_14
LBB0_16:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	56(%r15), %r12
	movq	_SZ_2M@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movl	%r8d, %eax
	cltd
	idivl	(%rcx)
	movl	%eax, %ecx
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cltd
	idivl	%ecx
	movslq	%eax, %r13
	leaq	(%r12,%r13,8), %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%r14,%rcx,8), %rsi
	movq	%rax, %r14
	movq	_NUM_FAULT_PAGES@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	callq	_sg_alloc_table_from_pages
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_19
## %bb.17:
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %edi
	movl	(%r12,%r13,8), %edx
	movl	4(%r12,%r13,8), %esi
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_dma_map_sg
	testl	%eax, %eax
	je	LBB0_18
## %bb.22:
	movq	%r14, %r8
	movq	%r15, %r14
	addq	$16, %r14
	movq	_IOMMU_WRITE@GOTPCREL(%rip), %rax
	movq	_IOMMU_READ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	48(%r15), %rsi
	movq	_IOMMU_NOEXEC@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	-64(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %edx
	callq	_mmu_map_sg
	movl	$1, (%r15)
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	movl	%r12d, %ecx
	callq	_dev_dbg
	movq	%r14, %rdi
	callq	_drm_gem_object_put_unlocked
	xorl	%ebx, %ebx
	jmp	LBB0_21
LBB0_1:
	movq	_ENOENT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_21
LBB0_3:
	movl	(%rbx), %edi
	movl	64(%r15), %edx
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %edx
	leaq	L_.str(%rip), %rsi
	callq	_dev_WARN
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_5:
	movl	16(%r15), %eax
	cltd
	idivl	(%rbx)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r14
	movq	___GFP_ZERO@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	orl	(%r14), %edx
	movl	%eax, %edi
	movl	$8, %esi
	callq	_kvmalloc_array
	movq	%rax, 56(%r15)
	testq	%rax, %rax
	je	LBB0_6
## %bb.8:
	movl	16(%r15), %edi
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %edi
	movl	(%rbx), %edx
	orl	(%r14), %edx
	movl	$8, %esi
	callq	_kvmalloc_array
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	%rax, %r14
	movq	%rax, 40(%r15)
	movl	$1, 8(%r15)
	jmp	LBB0_11
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	(%r14,%r12,8), %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	jmp	LBB0_19
LBB0_9:
	movq	56(%r15), %rdi
	callq	_kfree
	movq	$0, 56(%r15)
LBB0_6:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_7:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_18:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	%r14, %rdi
	callq	_sg_free_table
LBB0_19:
	leaq	8(%r15), %rdi
	callq	_drm_gem_shmem_put_pages
LBB0_20:
	addq	$16, %r15
	movq	%r15, %rdi
	callq	_drm_gem_object_put_unlocked
LBB0_21:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOENT,4,2                     ## @ENOENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"matching BO is not heap type (GPU VA = %llx)"

	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SZ_2M,4,2                      ## @SZ_2M
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NUM_FAULT_PAGES,4,2            ## @NUM_FAULT_PAGES
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.comm	_IOMMU_WRITE,4,2                ## @IOMMU_WRITE
	.comm	_IOMMU_READ,4,2                 ## @IOMMU_READ
	.comm	_IOMMU_NOEXEC,4,2               ## @IOMMU_NOEXEC
L_.str.1:                               ## @.str.1
	.asciz	"mapped page fault @ AS%d %llx"

	.no_dead_strip	_panfrost_mmu_map_fault_addr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function panfrost_mmu_map_fault_addr
_panfrost_mmu_map_fault_addr:           ; @panfrost_mmu_map_fault_addr
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x22, x2
	mov	x20, x1
	mov	x21, x0
	bl	_addr_to_drm_mm_node
	cbz	x0, LBB0_10
; %bb.1:
	mov	x19, x0
	ldr	w8, [x0, #68]
	cbz	w8, LBB0_11
; %bb.2:
	ldr	x8, [x19, #48]
	ldr	w8, [x8]
	cmp	w8, w20
	cset	w0, ne
	bl	_WARN_ON
Lloh0:
	adrp	x8, _SZ_2M@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SZ_2M@GOTPAGEOFF]
Lloh2:
	ldr	w28, [x8]
Lloh3:
	adrp	x27, _PAGE_SHIFT@GOTPAGE
Lloh4:
	ldr	x27, [x27, _PAGE_SHIFT@GOTPAGEOFF]
	ldr	w25, [x27]
	ldr	w26, [x19, #64]
	add	x23, x19, #32
	mov	x0, x23
	bl	_mutex_lock
	ldr	x24, [x19, #40]
	cbz	x24, LBB0_12
LBB0_3:
	neg	w8, w28
	and	w8, w8, w22
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	asr	w8, w8, w25
	sub	w28, w8, w26
	ldr	x8, [x19, #24]
	ldr	x25, [x8]
	mov	x0, x25
	bl	_mapping_set_unevictable
Lloh5:
	adrp	x27, _NUM_FAULT_PAGES@GOTPAGE
Lloh6:
	ldr	x27, [x27, _NUM_FAULT_PAGES@GOTPAGEOFF]
	ldr	w8, [x27]
	sxtw	x22, w28
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.4:
	mov	x26, x22
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x25
	mov	x1, x26
	bl	_shmem_read_mapping_page
	str	x0, [x24, x26, lsl #3]
	bl	_IS_ERR
	cbnz	x0, LBB0_15
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x26, x26, #1
	ldrsw	x8, [x27]
	add	x8, x8, w28, sxtw
	cmp	x26, x8
	b.lt	LBB0_5
LBB0_7:
	mov	x0, x23
	bl	_mutex_unlock
	ldr	x25, [x19, #56]
Lloh7:
	adrp	x8, _SZ_2M@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SZ_2M@GOTPAGEOFF]
Lloh9:
	ldr	w4, [x8]
Lloh10:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	sdiv	w8, w4, w8
	sdiv	w26, w28, w8
	add	x23, x25, w26, sxtw #3
	add	x1, x24, x22, lsl #3
	ldr	w2, [x27]
Lloh13:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh15:
	ldr	w5, [x8]
	mov	x0, x23
	mov	w3, #0
	bl	_sg_alloc_table_from_pages
	mov	x24, x0
	cbnz	w0, LBB0_20
; %bb.8:
	sxtw	x8, w26
	ldr	w0, [x21]
	add	x8, x25, x8, lsl #3
	ldr	w1, [x8, #4]
	ldr	w2, [x23]
Lloh16:
	adrp	x8, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh18:
	ldr	w3, [x8]
	bl	_dma_map_sg
	cbz	w0, LBB0_19
; %bb.9:
	add	x24, x19, #16
	ldr	x1, [x19, #48]
Lloh19:
	adrp	x8, _IOMMU_WRITE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _IOMMU_WRITE@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	adrp	x9, _IOMMU_READ@GOTPAGE
Lloh23:
	ldr	x9, [x9, _IOMMU_READ@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh25:
	adrp	x9, _IOMMU_NOEXEC@GOTPAGE
Lloh26:
	ldr	x9, [x9, _IOMMU_NOEXEC@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	orr	w3, w8, w9
	mov	x0, x21
	ldr	w22, [sp, #12]                  ; 4-byte Folded Reload
	mov	x2, x22
	mov	x4, x23
	bl	_mmu_map_sg
	mov	w8, #1
	str	w8, [x19]
	ldr	w0, [x21]
Lloh28:
	adrp	x1, l_.str.1@PAGE
Lloh29:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	mov	x3, x22
	bl	_dev_dbg
	mov	x0, x24
	bl	_drm_gem_object_put_unlocked
	mov	w24, #0
	b	LBB0_22
LBB0_10:
Lloh30:
	adrp	x8, _ENOENT@GOTPAGE
Lloh31:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_22
LBB0_11:
	ldr	w0, [x21]
	ldr	w8, [x19, #64]
Lloh33:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh34:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh35:
	ldr	w9, [x9]
	lsl	w2, w8, w9
Lloh36:
	adrp	x1, l_.str@PAGE
Lloh37:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_WARN
Lloh38:
	adrp	x8, _EINVAL@GOTPAGE
Lloh39:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_18
LBB0_12:
	ldr	w8, [x19, #16]
Lloh40:
	adrp	x9, _SZ_2M@GOTPAGE
Lloh41:
	ldr	x9, [x9, _SZ_2M@GOTPAGEOFF]
Lloh42:
	ldr	w9, [x9]
Lloh43:
	adrp	x10, _GFP_KERNEL@GOTPAGE
Lloh44:
	ldr	x10, [x10, _GFP_KERNEL@GOTPAGEOFF]
	sdiv	w0, w8, w9
Lloh45:
	ldr	w8, [x10]
Lloh46:
	adrp	x24, ___GFP_ZERO@GOTPAGE
Lloh47:
	ldr	x24, [x24, ___GFP_ZERO@GOTPAGEOFF]
	ldr	w9, [x24]
	orr	w2, w9, w8
	mov	w1, #8
	bl	_kvmalloc_array
	str	x0, [x19, #56]
	cbz	x0, LBB0_17
; %bb.13:
	ldr	w8, [x19, #16]
	ldr	w9, [x27]
	asr	w0, w8, w9
Lloh48:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh49:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh50:
	ldr	w8, [x8]
	ldr	w9, [x24]
	orr	w2, w9, w8
	mov	w1, #8
	bl	_kvmalloc_array
	cbz	x0, LBB0_16
; %bb.14:
	mov	x24, x0
	str	x0, [x19, #40]
	mov	w8, #1
	str	w8, [x19, #8]
	b	LBB0_3
LBB0_15:
	mov	x0, x23
	bl	_mutex_unlock
	ldr	x0, [x24, x26, lsl #3]
	bl	_PTR_ERR
	mov	x24, x0
	b	LBB0_20
LBB0_16:
	ldr	x0, [x19, #56]
	bl	_kfree
	str	xzr, [x19, #56]
LBB0_17:
	mov	x0, x23
	bl	_mutex_unlock
Lloh51:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh52:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_18:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_21
LBB0_19:
Lloh53:
	adrp	x8, _EINVAL@GOTPAGE
Lloh54:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh55:
	ldr	w8, [x8]
	neg	w24, w8
	mov	x0, x23
	bl	_sg_free_table
LBB0_20:
	add	x0, x19, #8
	bl	_drm_gem_shmem_put_pages
LBB0_21:
	add	x0, x19, #16
	bl	_drm_gem_object_put_unlocked
LBB0_22:
	mov	x0, x24
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGot	Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOENT,4,2                     ; @ENOENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"matching BO is not heap type (GPU VA = %llx)"

	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SZ_2M,4,2                      ; @SZ_2M
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NUM_FAULT_PAGES,4,2            ; @NUM_FAULT_PAGES
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.comm	_IOMMU_WRITE,4,2                ; @IOMMU_WRITE
	.comm	_IOMMU_READ,4,2                 ; @IOMMU_READ
	.comm	_IOMMU_NOEXEC,4,2               ; @IOMMU_NOEXEC
l_.str.1:                               ; @.str.1
	.asciz	"mapped page fault @ AS%d %llx"

	.no_dead_strip	_panfrost_mmu_map_fault_addr
.subsections_via_symbols
