	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nouveau_dmem_migrate_to_ram
_nouveau_dmem_migrate_to_ram:           ## @nouveau_dmem_migrate_to_ram
	.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
	subq	$80, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	12(%rdi), %edi
	callq	_page_to_dmem
	movq	%rax, %r15
	movq	8(%rax), %r14
	movq	$0, -56(%rbp)
	movq	$0, -48(%rbp)
	movl	$0, -36(%rbp)
	leaq	-56(%rbp), %rax
	movq	%rax, -104(%rbp)
	leaq	-48(%rbp), %rax
	movq	%rax, -96(%rbp)
	movl	$0, -88(%rbp)
	movq	(%rbx), %rax
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r12
	movq	(%r12), %rcx
	addq	%rax, %rcx
	movq	%rcx, -80(%rbp)
	movq	%rax, -72(%rbp)
	movl	8(%rbx), %eax
	movl	%eax, -64(%rbp)
	leaq	-104(%rbp), %rdi
	callq	_migrate_vma_setup
	testq	%rax, %rax
	js	LBB0_1
## %bb.2:
	cmpl	$0, -88(%rbp)
	je	LBB0_3
## %bb.4:
	leaq	-104(%rbp), %rdx
	leaq	-36(%rbp), %rcx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_nouveau_dmem_fault_copy_one
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_7
## %bb.5:
	cmpq	$0, -48(%rbp)
	je	LBB0_7
## %bb.6:
	movl	(%r15), %edi
	leaq	-112(%rbp), %r15
	xorl	%esi, %esi
	movq	%r15, %rdx
	callq	_nouveau_fence_new
	leaq	-104(%rbp), %rdi
	callq	_migrate_vma_pages
	movq	%r15, %rdi
	callq	_nouveau_dmem_fence_done
	movq	(%r14), %rax
	movl	(%rax), %edi
	movl	-36(%rbp), %esi
	movq	(%r12), %rdx
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_dma_unmap_page
LBB0_7:
	leaq	-104(%rbp), %rdi
	callq	_migrate_vma_finalize
	jmp	LBB0_8
LBB0_1:
	movq	_VM_FAULT_SIGBUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	jmp	LBB0_8
LBB0_3:
	xorl	%ebx, %ebx
LBB0_8:
	movq	%rbx, %rax
	addq	$80, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_VM_FAULT_SIGBUS,8,3            ## @VM_FAULT_SIGBUS
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.no_dead_strip	_nouveau_dmem_migrate_to_ram
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nouveau_dmem_migrate_to_ram
_nouveau_dmem_migrate_to_ram:           ; @nouveau_dmem_migrate_to_ram
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	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
	mov	x20, x0
	ldr	w0, [x0, #12]
	bl	_page_to_dmem
	mov	x21, x0
	ldr	x19, [x0, #8]
	stur	xzr, [x29, #-48]
	str	xzr, [sp, #56]
	str	wzr, [sp, #52]
	sub	x8, x29, #48
	add	x9, sp, #56
	stp	x8, x9, [sp]
	str	wzr, [sp, #16]
	ldr	x8, [x20]
Lloh0:
	adrp	x22, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _PAGE_SIZE@GOTPAGEOFF]
	ldr	x9, [x22]
	add	x9, x9, x8
	stp	x9, x8, [sp, #24]
	ldr	w8, [x20, #8]
	str	w8, [sp, #40]
	mov	x0, sp
	bl	_migrate_vma_setup
	tbnz	x0, #63, LBB0_5
; %bb.1:
	ldr	w8, [sp, #16]
	cbz	w8, LBB0_6
; %bb.2:
	mov	x2, sp
	add	x3, sp, #52
	mov	x0, x19
	mov	x1, x20
	bl	_nouveau_dmem_fault_copy_one
	mov	x20, x0
	ldr	x8, [sp, #56]
	cmp	x0, #0
	ccmp	x8, #0, #4, eq
	b.eq	LBB0_4
; %bb.3:
	ldr	w0, [x21]
	sub	x2, x29, #40
	mov	w1, #0
	bl	_nouveau_fence_new
	mov	x0, sp
	bl	_migrate_vma_pages
	sub	x0, x29, #40
	bl	_nouveau_dmem_fence_done
	ldr	x8, [x19]
	ldr	w0, [x8]
	ldr	w1, [sp, #52]
	ldr	x2, [x22]
Lloh2:
	adrp	x8, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	bl	_dma_unmap_page
LBB0_4:
	mov	x0, sp
	bl	_migrate_vma_finalize
	b	LBB0_7
LBB0_5:
Lloh5:
	adrp	x8, _VM_FAULT_SIGBUS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _VM_FAULT_SIGBUS@GOTPAGEOFF]
Lloh7:
	ldr	x20, [x8]
	b	LBB0_7
LBB0_6:
	mov	x20, #0
LBB0_7:
	mov	x0, x20
	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
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_VM_FAULT_SIGBUS,8,3            ; @VM_FAULT_SIGBUS
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.no_dead_strip	_nouveau_dmem_migrate_to_ram
.subsections_via_symbols
