	.file	"extr_mem.c_nvkm_mem_new_host.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	nvkm_mem_new_host, @function
nvkm_mem_new_host:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movsx	rsi, esi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	ebp, ecx
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 56
	.cfi_def_cfa_offset 112
	mov	rax, QWORD PTR 16[rdi]
	mov	DWORD PTR 36[rsp], r9d
	mov	QWORD PTR 40[rsp], r8
	mov	eax, DWORD PTR [rax+rsi*4]
	test	DWORD PTR NVKM_MEM_COHERENT[rip], eax
	je	.L2
	mov	r15d, DWORD PTR NVKM_MEM_TARGET_HOST[rip]
	test	DWORD PTR NVKM_MEM_UNCACHED[rip], eax
	jne	.L2
	cmp	DWORD PTR PAGE_SHIFT[rip], edx
	je	.L4
.L29:
	mov	r15d, DWORD PTR EINVAL[rip]
	neg	r15d
.L1:
	add	rsp, 56
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r15d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	cmp	DWORD PTR PAGE_SHIFT[rip], edx
	mov	r15d, DWORD PTR NVKM_MEM_TARGET_NCOH[rip]
	jne	.L29
.L4:
	mov	rax, QWORD PTR 8[rbx]
	mov	esi, DWORD PTR GFP_KERNEL[rip]
	mov	edi, 40
	mov	r12, QWORD PTR 40[rsp]
	mov	r13d, DWORD PTR ENOSYS[rip]
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR [rsp], rax
	mov	eax, DWORD PTR GFP_USER[rip]
	mov	DWORD PTR 28[rsp], eax
	mov	eax, DWORD PTR __GFP_ZERO[rip]
	mov	DWORD PTR 32[rsp], eax
	call	kzalloc@PLT
	mov	r14, rax
	test	rax, rax
	je	.L28
	mov	DWORD PTR [rax], r15d
	lea	r11, 24[rax]
	lea	rdx, 36[rsp]
	mov	ecx, DWORD PTR [r12]
	mov	QWORD PTR 32[rax], rbx
	mov	rax, QWORD PTR 112[rsp]
	mov	edi, r13d
	xor	r9d, r9d
	mov	QWORD PTR 16[rsp], r11
	lea	r13, 40[rsp]
	mov	r8, QWORD PTR 8[r12]
	neg	edi
	mov	QWORD PTR [rax], r11
	mov	rsi, r13
	push	0
	.cfi_def_cfa_offset 120
	push	0
	.cfi_def_cfa_offset 128
	mov	QWORD PTR 24[rsp], rdx
	call	nvif_unpack@PLT
	mov	r15d, eax
	pop	rax
	.cfi_def_cfa_offset 120
	pop	rdx
	.cfi_def_cfa_offset 112
	test	r15d, r15d
	mov	rdx, QWORD PTR 8[rsp]
	mov	r11, QWORD PTR 16[rsp]
	jne	.L7
	cmp	QWORD PTR 8[r12], 0
	mov	rsi, r11
	je	.L8
	lea	rdi, nvkm_mem_dma[rip]
	call	nvkm_memory_ctor@PLT
	mov	rax, QWORD PTR 8[r12]
	mov	QWORD PTR 16[r14], rax
.L9:
	mov	esi, DWORD PTR PAGE_SIZE[rip]
	mov	edi, ebp
	call	IS_ALIGNED@PLT
	test	eax, eax
	je	.L29
	mov	ecx, DWORD PTR PAGE_SHIFT[rip]
	sar	ebp, cl
	mov	DWORD PTR 4[r14], ebp
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L7:
	mov	ecx, DWORD PTR [r12]
	mov	edi, r15d
	mov	rsi, r13
	mov	QWORD PTR 8[rsp], r11
	call	nvif_unvers@PLT
	mov	r11, QWORD PTR 8[rsp]
	test	eax, eax
	mov	r15d, eax
	jne	.L31
	mov	rsi, r11
	lea	rdi, nvkm_mem_dma[rip]
	call	nvkm_memory_ctor@PLT
	mov	esi, DWORD PTR PAGE_SIZE[rip]
	mov	edi, ebp
	call	ALIGN@PLT
	mov	ecx, DWORD PTR PAGE_SHIFT[rip]
	mov	edx, DWORD PTR GFP_KERNEL[rip]
	mov	esi, 8
	sar	eax, cl
	mov	edi, eax
	mov	ebp, eax
	call	kvmalloc_array@PLT
	mov	QWORD PTR 8[r14], rax
	test	rax, rax
	je	.L28
	mov	edx, DWORD PTR GFP_KERNEL[rip]
	mov	esi, 4
	mov	edi, ebp
	call	kvmalloc_array@PLT
	mov	QWORD PTR 16[r14], rax
	test	rax, rax
	je	.L28
	mov	eax, DWORD PTR 28[rsp]
	or	eax, DWORD PTR 32[rsp]
	cmp	DWORD PTR [rbx], 32
	jle	.L14
	or	eax, DWORD PTR GFP_HIGHUSER[rip]
.L15:
	mov	DWORD PTR 4[r14], 0
	test	ebp, ebp
	je	.L1
	mov	DWORD PTR 8[rsp], r15d
	mov	r13d, eax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L17:
	movsx	rdx, DWORD PTR 4[r14]
	mov	rax, QWORD PTR 16[r14]
	mov	rsi, r15
	mov	r8d, DWORD PTR DMA_BIDIRECTIONAL[rip]
	mov	ecx, DWORD PTR PAGE_SIZE[rip]
	lea	r12, [rax+rdx*4]
	mov	rax, QWORD PTR 8[rbx]
	xor	edx, edx
	mov	rdi, QWORD PTR [rax]
	call	dma_map_page@PLT
	mov	rdi, QWORD PTR [rsp]
	mov	DWORD PTR [r12], eax
	mov	rax, QWORD PTR 16[r14]
	movsx	rdx, DWORD PTR 4[r14]
	mov	esi, DWORD PTR [rax+rdx*4]
	call	dma_mapping_error@PLT
	test	rax, rax
	jne	.L32
	movsx	rcx, DWORD PTR 4[r14]
	mov	rdx, QWORD PTR 8[r14]
	mov	rax, rcx
	mov	QWORD PTR [rdx+rcx*8], r15
	add	eax, 1
	mov	DWORD PTR 4[r14], eax
	sub	ebp, 1
	je	.L33
.L19:
	mov	edi, r13d
	call	alloc_page@PLT
	mov	r15, rax
	test	rax, rax
	jne	.L17
	.p2align 4,,10
	.p2align 3
.L28:
	mov	r15d, DWORD PTR ENOMEM[rip]
	neg	r15d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L31:
	mov	rdi, r14
	call	kfree@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L8:
	lea	rdi, nvkm_mem_sgl[rip]
	call	nvkm_memory_ctor@PLT
	mov	eax, DWORD PTR [r12]
	mov	DWORD PTR 28[r14], eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L14:
	or	eax, DWORD PTR GFP_DMA32[rip]
	jmp	.L15
.L32:
	mov	rdi, r15
	call	__free_page@PLT
	jmp	.L28
.L33:
	mov	r15d, DWORD PTR 8[rsp]
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	nvkm_mem_new_host, .-nvkm_mem_new_host
	.comm	nvkm_mem_sgl,4,4
	.comm	nvkm_mem_dma,4,4
	.comm	__GFP_ZERO,4,4
	.comm	PAGE_SIZE,4,4
	.comm	PAGE_SHIFT,4,4
	.comm	NVKM_MEM_UNCACHED,4,4
	.comm	NVKM_MEM_TARGET_NCOH,4,4
	.comm	NVKM_MEM_TARGET_HOST,4,4
	.comm	NVKM_MEM_COHERENT,4,4
	.comm	GFP_USER,4,4
	.comm	GFP_KERNEL,4,4
	.comm	GFP_HIGHUSER,4,4
	.comm	GFP_DMA32,4,4
	.comm	ENOSYS,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	DMA_BIDIRECTIONAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_mem.c_nvkm_mem_new_host.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	nvkm_mem_new_host, %function
nvkm_mem_new_host:
	@ args = 12, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	ip, [r0, #8]
	mov	r5, r0
	ldr	r0, .L35
	ldr	r1, [ip, r1, lsl #2]
	ldr	r0, [r0]
	mov	r7, r3
	tst	r1, r0
	sub	sp, sp, #36
	beq	.L2
	ldr	r3, .L35+4
	ldr	r3, [r3]
	tst	r1, r3
	beq	.L31
.L2:
	ldr	r3, .L35+8
	ldr	r9, .L35+12
	ldr	fp, [r3]
	ldr	r3, [r9]
	cmp	r3, r2
	beq	.L4
.L29:
	ldr	r3, .L35+16
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L1:
	mov	r0, r4
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L31:
	ldr	r3, .L35+20
	ldr	r9, .L35+12
	ldr	fp, [r3]
	ldr	r3, [r9]
	cmp	r3, r2
	bne	.L29
.L4:
	ldr	lr, [r5, #4]
	ldr	r2, .L35+24
	ldr	r3, .L35+28
	ldr	r10, .L35+32
	ldr	ip, .L35+36
	ldr	lr, [lr]
	ldr	r2, [r2]
	ldr	r3, [r3]
	mov	r0, #28
	ldr	r1, [r10]
	ldr	r4, [ip]
	ldr	r8, [sp, #72]
	str	lr, [sp, #20]
	str	r2, [sp, #24]
	str	r3, [sp, #28]
	bl	kzalloc
	subs	r6, r0, #0
	beq	.L28
	mov	r3, #0
	str	fp, [r6]
	str	r5, [r6, #24]
	str	r3, [sp, #12]
	str	r3, [sp, #8]
	str	r3, [sp, #4]
	ldr	r3, [r8, #4]
	ldr	r2, [sp, #80]
	str	r3, [sp]
	add	fp, r6, #16
	ldr	r3, [r8]
	rsb	r0, r4, #0
	str	fp, [r2]
	add	r1, sp, #72
	add	r2, sp, #76
	bl	nvif_unpack
	subs	r4, r0, #0
	bne	.L7
	ldr	r3, [r8, #4]
	mov	r1, fp
	cmp	r3, #0
	beq	.L8
	ldr	r0, .L35+40
	bl	nvkm_memory_ctor
	ldr	r3, [r8, #4]
	str	r3, [r6, #12]
.L9:
	ldr	r3, .L35+44
	mov	r0, r7
	ldr	r1, [r3]
	bl	IS_ALIGNED
	cmp	r0, #0
	beq	.L29
	ldr	r3, [r9]
	asr	r7, r7, r3
	str	r7, [r6, #4]
	b	.L1
.L7:
	ldr	r3, [r8]
	add	r2, sp, #76
	add	r1, sp, #72
	bl	nvif_unvers
	subs	r4, r0, #0
	bne	.L32
	mov	r1, fp
	ldr	r0, .L35+40
	bl	nvkm_memory_ctor
	ldr	r3, .L35+44
	mov	r0, r7
	ldr	r1, [r3]
	bl	ALIGN
	ldr	r3, [r9]
	mov	r1, #4
	asr	r8, r0, r3
	mov	r0, r8
	ldr	r2, [r10]
	bl	kvmalloc_array
	cmp	r0, #0
	str	r0, [r6, #8]
	beq	.L28
	mov	r1, #4
	mov	r0, r8
	ldr	r2, [r10]
	bl	kvmalloc_array
	cmp	r0, #0
	str	r0, [r6, #12]
	beq	.L28
	ldr	r2, [r5]
	ldr	r3, [sp, #24]
	cmp	r2, #32
	ldrgt	r2, .L35+48
	ldrle	r2, .L35+52
	ldr	r1, [sp, #28]
	ldr	r2, [r2]
	orr	r3, r3, r1
	orr	r3, r3, r2
	mov	r2, r3
	mov	r3, #0
	cmp	r8, r3
	str	r3, [r6, #4]
	beq	.L1
	mov	r10, r2
	ldr	fp, .L35+56
	str	r4, [sp, #24]
	b	.L19
.L17:
	ldr	r3, [r5, #4]
	ldr	r2, [fp]
	ldr	r0, [r3]
	ldr	r3, .L35+44
	ldr	r9, [r6, #4]
	ldr	r4, [r6, #12]
	ldr	r3, [r3]
	mov	r1, r7
	str	r2, [sp]
	mov	r2, #0
	bl	dma_map_page
	str	r0, [r4, r9, lsl #2]
	ldr	r2, [r6, #4]
	ldr	r3, [r6, #12]
	ldr	r0, [sp, #20]
	ldr	r1, [r3, r2, lsl #2]
	bl	dma_mapping_error
	cmp	r0, #0
	bne	.L33
	ldr	r3, [r6, #4]
	ldr	r1, [r6, #8]
	add	r2, r3, #1
	subs	r8, r8, #1
	str	r7, [r1, r3, lsl #2]
	str	r2, [r6, #4]
	beq	.L34
.L19:
	mov	r0, r10
	bl	alloc_page
	subs	r7, r0, #0
	bne	.L17
.L28:
	ldr	r3, .L35+60
	ldr	r4, [r3]
	rsb	r4, r4, #0
	mov	r0, r4
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L32:
	mov	r0, r6
	bl	kfree
	b	.L1
.L8:
	ldr	r0, .L35+64
	bl	nvkm_memory_ctor
	ldr	r3, [r8]
	str	r3, [r6, #20]
	b	.L9
.L33:
	mov	r0, r7
	bl	__free_page
	b	.L28
.L34:
	ldr	r4, [sp, #24]
	b	.L1
.L36:
	.align	2
.L35:
	.word	NVKM_MEM_COHERENT
	.word	NVKM_MEM_UNCACHED
	.word	NVKM_MEM_TARGET_NCOH
	.word	PAGE_SHIFT
	.word	EINVAL
	.word	NVKM_MEM_TARGET_HOST
	.word	GFP_USER
	.word	__GFP_ZERO
	.word	GFP_KERNEL
	.word	ENOSYS
	.word	nvkm_mem_dma
	.word	PAGE_SIZE
	.word	GFP_HIGHUSER
	.word	GFP_DMA32
	.word	DMA_BIDIRECTIONAL
	.word	ENOMEM
	.word	nvkm_mem_sgl
	.size	nvkm_mem_new_host, .-nvkm_mem_new_host
	.comm	nvkm_mem_sgl,4,4
	.comm	nvkm_mem_dma,4,4
	.comm	__GFP_ZERO,4,4
	.comm	PAGE_SIZE,4,4
	.comm	PAGE_SHIFT,4,4
	.comm	NVKM_MEM_UNCACHED,4,4
	.comm	NVKM_MEM_TARGET_NCOH,4,4
	.comm	NVKM_MEM_TARGET_HOST,4,4
	.comm	NVKM_MEM_COHERENT,4,4
	.comm	GFP_USER,4,4
	.comm	GFP_KERNEL,4,4
	.comm	GFP_HIGHUSER,4,4
	.comm	GFP_DMA32,4,4
	.comm	ENOSYS,4,4
	.comm	ENOMEM,4,4
	.comm	EINVAL,4,4
	.comm	DMA_BIDIRECTIONAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
