	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kfd_reserved_mem_mmap          ## -- Begin function kfd_reserved_mem_mmap
	.p2align	4, 0x90
_kfd_reserved_mem_mmap:                 ## @kfd_reserved_mem_mmap
	.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	(%rdx), %rax
	subq	8(%rdx), %rax
	movq	_KFD_CWSR_TBA_TMA_SIZE@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_1
## %bb.2:
	movq	%rdx, %rbx
	callq	_kfd_get_process_device_data
	testq	%rax, %rax
	je	LBB0_3
## %bb.5:
	movq	%rax, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movq	___GFP_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r15d
	orl	(%rax), %r15d
	movq	(%r12), %rdi
	callq	_get_order
	movl	%r15d, %edi
	movl	%eax, %esi
	callq	___get_free_pages
	movq	%rax, (%r14)
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movq	_VM_IO@GOTPCREL(%rip), %rcx
	movq	_VM_DONTCOPY@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movq	_VM_DONTEXPAND@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movq	_VM_NORESERVE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movq	_VM_DONTDUMP@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movq	_VM_PFNMAP@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	orl	%edx, 16(%rbx)
	movq	8(%rbx), %r14
	movq	%rax, %rdi
	callq	___pa
	movl	%eax, %edi
	callq	_PFN_DOWN
	movq	(%r12), %rcx
	movl	20(%rbx), %r8d
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	%eax, %edx
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_remap_pfn_range                ## TAILCALL
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_4:
	xorl	%eax, %eax
	subl	(%rcx), %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_KFD_CWSR_TBA_TMA_SIZE,8,3      ## @KFD_CWSR_TBA_TMA_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Incorrect CWSR mapping size.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
L_.str.1:                               ## @.str.1
	.asciz	"Error allocating per process CWSR buffer.\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_VM_IO,4,2                      ## @VM_IO
	.comm	_VM_DONTCOPY,4,2                ## @VM_DONTCOPY
	.comm	_VM_DONTEXPAND,4,2              ## @VM_DONTEXPAND
	.comm	_VM_NORESERVE,4,2               ## @VM_NORESERVE
	.comm	_VM_DONTDUMP,4,2                ## @VM_DONTDUMP
	.comm	_VM_PFNMAP,4,2                  ## @VM_PFNMAP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kfd_reserved_mem_mmap          ; -- Begin function kfd_reserved_mem_mmap
	.p2align	2
_kfd_reserved_mem_mmap:                 ; @kfd_reserved_mem_mmap
	.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
	ldp	x8, x9, [x2]
Lloh0:
	adrp	x22, _KFD_CWSR_TBA_TMA_SIZE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _KFD_CWSR_TBA_TMA_SIZE@GOTPAGEOFF]
	ldr	x10, [x22]
	sub	x8, x8, x9
	cmp	x8, x10
	b.ne	LBB0_4
; %bb.1:
	mov	x19, x2
	bl	_kfd_get_process_device_data
	cbz	x0, LBB0_5
; %bb.2:
	mov	x20, x0
Lloh2:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, ___GFP_ZERO@GOTPAGE
Lloh6:
	ldr	x9, [x9, ___GFP_ZERO@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w21, w9, w8
	ldr	x0, [x22]
	bl	_get_order
	mov	x1, x0
	mov	x0, x21
	bl	___get_free_pages
	str	x0, [x20]
	cbz	x0, LBB0_7
; %bb.3:
Lloh8:
	adrp	x8, _VM_IO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _VM_IO@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _VM_DONTCOPY@GOTPAGE
Lloh12:
	ldr	x9, [x9, _VM_DONTCOPY@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh14:
	adrp	x9, _VM_DONTEXPAND@GOTPAGE
Lloh15:
	ldr	x9, [x9, _VM_DONTEXPAND@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh17:
	adrp	x9, _VM_NORESERVE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _VM_NORESERVE@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh20:
	adrp	x9, _VM_DONTDUMP@GOTPAGE
Lloh21:
	ldr	x9, [x9, _VM_DONTDUMP@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh23:
	adrp	x9, _VM_PFNMAP@GOTPAGE
Lloh24:
	ldr	x9, [x9, _VM_PFNMAP@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	orr	w8, w8, w9
	ldr	w9, [x19, #16]
	orr	w8, w8, w9
	str	w8, [x19, #16]
	ldr	x20, [x19, #8]
	bl	___pa
	bl	_PFN_DOWN
	mov	x2, x0
	ldr	x3, [x22]
	ldr	w4, [x19, #20]
	mov	x0, x19
	mov	x1, 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
	b	_remap_pfn_range
LBB0_4:
Lloh26:
	adrp	x0, l_.str@PAGE
Lloh27:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
LBB0_5:
Lloh28:
	adrp	x8, _EINVAL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w0, w8
	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
LBB0_7:
Lloh30:
	adrp	x0, l_.str.1@PAGE
Lloh31:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
Lloh32:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh33:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_KFD_CWSR_TBA_TMA_SIZE,8,3      ; @KFD_CWSR_TBA_TMA_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Incorrect CWSR mapping size.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
l_.str.1:                               ; @.str.1
	.asciz	"Error allocating per process CWSR buffer.\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_VM_IO,4,2                      ; @VM_IO
	.comm	_VM_DONTCOPY,4,2                ; @VM_DONTCOPY
	.comm	_VM_DONTEXPAND,4,2              ; @VM_DONTEXPAND
	.comm	_VM_NORESERVE,4,2               ; @VM_NORESERVE
	.comm	_VM_DONTDUMP,4,2                ; @VM_DONTDUMP
	.comm	_VM_PFNMAP,4,2                  ; @VM_PFNMAP
.subsections_via_symbols
