	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel ## -- Begin function amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel
	.p2align	4, 0x90
_amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel: ## @amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movq	%rdx, %r13
	movq	%rsi, %r14
	movq	16(%rsi), %r15
	movl	(%r15), %edi
	callq	_amdgpu_ttm_tt_get_usermm
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_pr_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_2:
	movq	(%r14), %rdi
	callq	_mutex_lock
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_amdgpu_bo_reserve
	testl	%eax, %eax
	je	LBB0_5
## %bb.3:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_pr_err
	jmp	LBB0_4
LBB0_5:
	movq	_AMDGPU_GEM_DOMAIN_GTT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_amdgpu_bo_pin
	testl	%eax, %eax
	je	LBB0_8
## %bb.6:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_pr_err
	jmp	LBB0_7
LBB0_8:
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_amdgpu_bo_kmap
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_pr_err
	movq	%r15, %rdi
	callq	_amdgpu_bo_unpin
LBB0_7:
	movq	%r15, %rdi
	callq	_amdgpu_bo_unreserve
LBB0_4:
	movq	(%r14), %rdi
	callq	_mutex_unlock
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	(%r14), %rax
	movl	4(%rax), %esi
	movq	%r15, %rdi
	callq	_amdgpu_amdkfd_remove_eviction_fence
	leaq	8(%r14), %rdi
	callq	_list_del_init
	testq	%r12, %r12
	je	LBB0_12
## %bb.11:
	movq	%r15, %rdi
	callq	_amdgpu_bo_size
	movl	%eax, (%r12)
LBB0_12:
	movq	%r15, %rdi
	callq	_amdgpu_bo_unreserve
	movq	(%r14), %rdi
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"userptr can't be mapped to kernel\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Failed to reserve bo. ret %d\n"

	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ## @AMDGPU_GEM_DOMAIN_GTT
L_.str.2:                               ## @.str.2
	.asciz	"Failed to pin bo. ret %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to map bo to kernel. ret %d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel ; -- Begin function amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel
	.p2align	2
_amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel: ; @amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x21, x3
	mov	x23, x2
	mov	x19, x1
	ldr	x20, [x1, #16]
	ldr	w0, [x20]
	bl	_amdgpu_ttm_tt_get_usermm
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_10
LBB0_2:
	ldr	x0, [x19]
	bl	_mutex_lock
	mov	x0, x20
	mov	w1, #1
	bl	_amdgpu_bo_reserve
	cbz	w0, LBB0_4
; %bb.3:
	mov	x22, x0
	str	x22, [sp]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
	b	LBB0_9
LBB0_4:
Lloh7:
	adrp	x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_amdgpu_bo_pin
	cbz	w0, LBB0_6
; %bb.5:
	mov	x22, x0
	str	x22, [sp]
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_err
	b	LBB0_8
LBB0_6:
	mov	x0, x20
	mov	x1, x23
	bl	_amdgpu_bo_kmap
	cbz	w0, LBB0_11
; %bb.7:
	mov	x22, x0
	str	x22, [sp]
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_err
	mov	x0, x20
	bl	_amdgpu_bo_unpin
LBB0_8:
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	mov	x0, x20
	bl	_amdgpu_bo_unreserve
LBB0_9:
	ldr	x0, [x19]
	bl	_mutex_unlock
LBB0_10:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_11:
	mov	x22, x19
	ldr	x8, [x22], #8
	ldr	w1, [x8, #4]
	mov	x0, x20
	bl	_amdgpu_amdkfd_remove_eviction_fence
	mov	x0, x22
	bl	_list_del_init
	cbz	x21, LBB0_13
; %bb.12:
	mov	x0, x20
	bl	_amdgpu_bo_size
	str	w0, [x21]
LBB0_13:
	mov	x0, x20
	bl	_amdgpu_bo_unreserve
	ldr	x0, [x19]
	bl	_mutex_unlock
	mov	w22, #0
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"userptr can't be mapped to kernel\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Failed to reserve bo. ret %d\n"

	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ; @AMDGPU_GEM_DOMAIN_GTT
l_.str.2:                               ; @.str.2
	.asciz	"Failed to pin bo. ret %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to map bo to kernel. ret %d\n"

.subsections_via_symbols
