	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function via_lock_all_dma_pages
_via_lock_all_dma_pages:                ## @via_lock_all_dma_pages
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	(%rsi), %edi
	callq	_VIA_PFN
	movq	%rax, %r15
	movl	(%rbx), %eax
	movl	8(%rbx), %ecx
	imull	4(%rbx), %ecx
	leal	(%rax,%rcx), %edi
	decl	%edi
	callq	_VIA_PFN
	subq	%r15, %rax
	leaq	1(%rax), %rdi
	movq	%rdi, (%r14)
	shll	$3, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_vzalloc
	movq	%rax, 24(%r14)
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	_current@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	(%rax), %rdi
	callq	_down_read
	movq	(%r12), %rdi
	movq	(%rdi), %rsi
	movslq	(%rbx), %rdx
	movl	(%r14), %ecx
	movq	8(%r14), %rax
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rbx
	xorl	%r8d, %r8d
	cmpq	(%rbx), %rax
	sete	%r8b
	xorl	%ebx, %ebx
	xorl	%r9d, %r9d
	pushq	$0
	pushq	24(%r14)
	callq	_get_user_pages
	addq	$16, %rsp
	movl	%eax, %r15d
	movq	(%r12), %rax
	movq	(%rax), %rdi
	callq	_up_read
	movslq	%r15d, %rax
	cmpq	%rax, (%r14)
	jne	LBB0_4
## %bb.7:
	movq	_dr_via_pages_locked@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 16(%r14)
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG
	jmp	LBB0_8
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_4:
	testl	%r15d, %r15d
	js	LBB0_5
## %bb.6:
	movq	_dr_via_pages_locked@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 16(%r14)
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_8:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	%r15d, %ebx
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_current,8,3                    ## @current
	.comm	_DMA_FROM_DEVICE,8,3            ## @DMA_FROM_DEVICE
	.comm	_dr_via_pages_locked,8,3        ## @dr_via_pages_locked
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"DMA pages locked\n"

	.no_dead_strip	_via_lock_all_dma_pages
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function via_lock_all_dma_pages
_via_lock_all_dma_pages:                ; @via_lock_all_dma_pages
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	w0, [x1]
	bl	_VIA_PFN
	mov	x21, x0
	ldp	w8, w9, [x20]
	ldr	w10, [x20, #8]
	madd	w8, w10, w9, w8
	sub	w0, w8, #1
	bl	_VIA_PFN
	sub	x8, x0, x21
	add	x8, x8, #1
	str	x8, [x19]
	lsl	w0, w8, #3
	bl	_vzalloc
	str	x0, [x19, #24]
	cbz	x0, LBB0_3
; %bb.1:
Lloh0:
	adrp	x21, _current@GOTPAGE
Lloh1:
	ldr	x21, [x21, _current@GOTPAGEOFF]
	ldr	x8, [x21]
	ldr	x0, [x8]
	bl	_down_read
	ldr	x0, [x21]
	ldr	x1, [x0]
	ldrsw	x2, [x20]
	ldr	w3, [x19]
	ldr	x8, [x19, #8]
Lloh2:
	adrp	x9, _DMA_FROM_DEVICE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w4, eq
	ldr	x6, [x19, #24]
	mov	w5, #0
	mov	x7, #0
	bl	_get_user_pages
	mov	x20, x0
	ldr	x8, [x21]
	ldr	x0, [x8]
	bl	_up_read
	ldr	x8, [x19]
	cmp	x8, w20, sxtw
	b.ne	LBB0_4
; %bb.2:
Lloh5:
	adrp	x8, _dr_via_pages_locked@GOTPAGE
Lloh6:
	ldr	x8, [x8, _dr_via_pages_locked@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	str	x8, [x19, #16]
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG
	mov	w20, #0
	b	LBB0_7
LBB0_3:
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:
	tbnz	w20, #31, LBB0_7
; %bb.5:
Lloh12:
	adrp	x8, _dr_via_pages_locked@GOTPAGE
Lloh13:
	ldr	x8, [x8, _dr_via_pages_locked@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	str	x8, [x19, #16]
Lloh15:
	adrp	x8, _EINVAL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_7:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_current,8,3                    ; @current
	.comm	_DMA_FROM_DEVICE,8,3            ; @DMA_FROM_DEVICE
	.comm	_dr_via_pages_locked,8,3        ; @dr_via_pages_locked
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"DMA pages locked\n"

	.no_dead_strip	_via_lock_all_dma_pages
.subsections_via_symbols
