	.file	"extr_zalloc.c_zone_replenish_thread.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	zone_replenish_thread, @function
zone_replenish_thread:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	lea	r15, vm_pageout_garbage_collect[rip]
	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
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	lea	r14, 48[rbx]
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	lea	r13, 4[rsp]
	call	current_thread@PLT
	mov	edx, DWORD PTR TH_OPT_VMPRIV[rip]
	or	DWORD PTR [rax], edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L6:
	mov	r9d, DWORD PTR VM_KERN_MEMORY_ZONE[rip]
	xor	ecx, ecx
	mov	r8d, ebp
	mov	edx, r12d
	mov	edi, DWORD PTR zone_map[rip]
	mov	rsi, r13
	call	kernel_memory_allocate@PLT
	cmp	QWORD PTR KERN_SUCCESS[rip], rax
	je	.L19
	cmp	QWORD PTR KERN_RESOURCE_SHORTAGE[rip], rax
	je	.L21
	cmp	QWORD PTR KERN_NO_SPACE[rip], rax
	je	.L22
.L8:
	mov	rdi, rbx
	call	lock_zone@PLT
	mov	edi, DWORD PTR [rbx]
	call	assert@PLT
	mov	eax, DWORD PTR 16[rbx]
	mov	edx, DWORD PTR 4[rbx]
	mov	esi, DWORD PTR 8[rbx]
	add	DWORD PTR zone_replenish_loops[rip], 1
	imul	edx, eax
	imul	eax, DWORD PTR 12[rbx]
	sub	esi, eax
	cmp	edx, esi
	jg	.L11
.L2:
	mov	rax, QWORD PTR FALSE[rip]
	mov	rdi, rbx
	mov	QWORD PTR 56[rbx], rax
	call	thread_wakeup@PLT
	mov	esi, DWORD PTR THREAD_UNINT[rip]
	mov	rdi, r14
	call	assert_wait@PLT
	mov	rdi, rbx
	call	unlock_zone@PLT
	mov	edi, DWORD PTR THREAD_CONTINUE_NULL[rip]
	call	thread_block@PLT
	add	DWORD PTR zone_replenish_wakeups[rip], 1
.L12:
	mov	rdi, rbx
	call	lock_zone@PLT
	mov	edi, DWORD PTR [rbx]
	call	assert@PLT
	mov	rax, QWORD PTR TRUE[rip]
	xor	edi, edi
	mov	QWORD PTR 56[rbx], rax
	mov	eax, DWORD PTR 4[rbx]
	test	eax, eax
	setne	dil
	call	assert@PLT
	mov	eax, DWORD PTR 16[rbx]
	mov	edx, DWORD PTR 12[rbx]
	mov	ecx, DWORD PTR 8[rbx]
	imul	edx, eax
	imul	eax, DWORD PTR 4[rbx]
	sub	ecx, edx
	cmp	ecx, eax
	jge	.L2
.L11:
	mov	rax, QWORD PTR FALSE[rip]
	xor	edi, edi
	cmp	QWORD PTR 24[rbx], rax
	sete	dil
	call	assert@PLT
	mov	rax, QWORD PTR FALSE[rip]
	xor	edi, edi
	cmp	QWORD PTR 32[rbx], rax
	sete	dil
	call	assert@PLT
	mov	rax, QWORD PTR TRUE[rip]
	xor	edi, edi
	cmp	QWORD PTR 40[rbx], rax
	sete	dil
	call	assert@PLT
	mov	rdi, rbx
	call	unlock_zone@PLT
	xor	eax, eax
	mov	ebp, DWORD PTR KMA_KOBJECT[rip]
	or	ebp, DWORD PTR KMA_NOPAGEWAIT[rip]
	call	vm_pool_low@PLT
	test	rax, rax
	jne	.L23
	mov	r12d, DWORD PTR 72[rbx]
.L4:
	cmp	QWORD PTR 64[rbx], 0
	je	.L5
	or	ebp, DWORD PTR KMA_NOENCRYPT[rip]
.L5:
	xor	eax, eax
	call	is_zone_map_nearing_exhaustion@PLT
	test	rax, rax
	je	.L6
	mov	rdi, r15
	call	thread_wakeup@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L23:
	mov	edi, DWORD PTR 16[rbx]
	call	round_page@PLT
	mov	r12d, eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L19:
	mov	esi, DWORD PTR 4[rsp]
	mov	edx, r12d
	mov	rdi, rbx
	call	zcram@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L21:
	xor	eax, eax
	call	VM_PAGE_WAIT@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	mov	r9d, DWORD PTR VM_KERN_MEMORY_ZONE[rip]
	xor	ecx, ecx
	mov	r8d, ebp
	mov	edx, r12d
	mov	edi, DWORD PTR kernel_map[rip]
	mov	rsi, r13
	call	kernel_memory_allocate@PLT
	cmp	QWORD PTR KERN_SUCCESS[rip], rax
	je	.L19
	imul	ecx, DWORD PTR NSEC_PER_USEC[rip], 100
	mov	esi, DWORD PTR THREAD_UNINT[rip]
	mov	rdi, r14
	mov	edx, 1
	call	assert_wait_timeout@PLT
	mov	edi, DWORD PTR THREAD_CONTINUE_NULL[rip]
	call	thread_block@PLT
	jmp	.L8
	.cfi_endproc
.LFE0:
	.size	zone_replenish_thread, .-zone_replenish_thread
	.comm	zone_replenish_wakeups,4,4
	.comm	zone_replenish_loops,4,4
	.comm	zone_map,4,4
	.comm	vm_pageout_garbage_collect,4,4
	.comm	kernel_map,4,4
	.comm	VM_KERN_MEMORY_ZONE,4,4
	.comm	TRUE,8,8
	.comm	TH_OPT_VMPRIV,4,4
	.comm	THREAD_UNINT,4,4
	.comm	THREAD_CONTINUE_NULL,4,4
	.comm	NSEC_PER_USEC,4,4
	.comm	KMA_NOPAGEWAIT,4,4
	.comm	KMA_NOENCRYPT,4,4
	.comm	KMA_KOBJECT,4,4
	.comm	KERN_SUCCESS,8,8
	.comm	KERN_RESOURCE_SHORTAGE,8,8
	.comm	KERN_NO_SPACE,8,8
	.comm	FALSE,8,8
	.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_zalloc.c_zone_replenish_thread.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	zone_replenish_thread, %function
zone_replenish_thread:
	@ Volatile: function does not return.
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r7, fp, lr}
	ldr	r3, .L27
	sub	sp, sp, #28
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	mov	r4, r0
	bl	current_thread
	ldr	r1, .L27+4
	ldr	r2, [r0]
	ldr	r1, [r1]
	add	r3, r4, #32
	orr	r2, r2, r1
	ldr	r10, .L27+8
	ldr	r7, .L27+12
	ldr	fp, .L27+16
	ldr	r9, .L27+20
	ldr	r8, .L27+24
	str	r2, [r0]
	str	r3, [sp, #12]
	b	.L12
.L6:
	ldr	r3, [fp]
	ldr	r0, .L27+28
	str	r3, [sp, #4]
	str	r5, [sp]
	mov	r3, #0
	mov	r2, r6
	ldr	r0, [r0]
	add	r1, sp, #16
	bl	kernel_memory_allocate
	ldr	r3, .L27+32
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L22
	ldr	r3, .L27+36
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L24
	ldr	r3, .L27+40
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L25
.L8:
	mov	r0, r4
	bl	lock_zone
	ldr	r0, [r4]
	bl	assert
	ldr	r3, [r4, #16]
	ldr	r1, [r4, #12]
	ldr	r2, [r4, #4]
	mul	r0, r1, r3
	mul	r3, r2, r3
	ldr	r1, [r4, #8]
	ldr	r2, [r9]
	sub	r1, r1, r0
	cmp	r3, r1
	add	r3, r2, #1
	str	r3, [r9]
	bgt	.L11
.L2:
	ldr	r3, [r7]
	mov	r0, r4
	str	r3, [r4, #36]
	bl	thread_wakeup
	ldr	r3, .L27+44
	ldr	r0, [sp, #12]
	ldr	r1, [r3]
	bl	assert_wait
	mov	r0, r4
	bl	unlock_zone
	ldr	r3, .L27+48
	ldr	r0, [r3]
	bl	thread_block
	ldr	r3, [r8]
	add	r3, r3, #1
	str	r3, [r8]
.L12:
	mov	r0, r4
	bl	lock_zone
	ldr	r0, [r4]
	bl	assert
	ldr	r0, [r4, #4]
	ldr	r3, [r10]
	subs	r0, r0, #0
	movne	r0, #1
	str	r3, [r4, #36]
	bl	assert
	ldr	r3, [r4, #16]
	ldr	r2, [r4, #12]
	ldr	r0, [r4, #4]
	mul	r1, r2, r3
	mul	r3, r0, r3
	ldr	r2, [r4, #8]
	sub	r2, r2, r1
	cmp	r2, r3
	bge	.L2
.L11:
	ldr	r3, [r7]
	ldr	r0, [r4, #20]
	sub	r0, r0, r3
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	ldr	r3, [r7]
	ldr	r0, [r4, #24]
	sub	r0, r0, r3
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	ldr	r3, [r10]
	ldr	r0, [r4, #28]
	sub	r0, r0, r3
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	mov	r0, r4
	bl	unlock_zone
	ldr	r3, .L27+52
	ldr	r5, [r3]
	ldr	r3, .L27+56
	ldr	r3, [r3]
	orr	r5, r5, r3
	bl	vm_pool_low
	cmp	r0, #0
	ldreq	r6, [r4, #44]
	bne	.L26
.L4:
	ldr	r3, [r4, #40]
	cmp	r3, #0
	ldrne	r3, .L27+60
	ldrne	r3, [r3]
	orrne	r5, r5, r3
	bl	is_zone_map_nearing_exhaustion
	cmp	r0, #0
	beq	.L6
	ldr	r0, .L27+64
	bl	thread_wakeup
	b	.L6
.L26:
	ldr	r0, [r4, #16]
	bl	round_page
	mov	r6, r0
	b	.L4
.L22:
	mov	r2, r6
	mov	r0, r4
	ldr	r1, [sp, #16]
	bl	zcram
	b	.L8
.L24:
	bl	VM_PAGE_WAIT
	b	.L8
.L25:
	ldr	r3, [fp]
	ldr	r0, .L27+68
	str	r3, [sp, #4]
	str	r5, [sp]
	mov	r3, #0
	mov	r2, r6
	ldr	r0, [r0]
	add	r1, sp, #16
	bl	kernel_memory_allocate
	ldr	r3, .L27+32
	ldr	r3, [r3]
	cmp	r3, r0
	beq	.L22
	ldr	r3, .L27+72
	ldr	r1, .L27+44
	ldr	r3, [r3]
	mov	r2, #1
	add	r3, r3, r3, lsl #2
	add	r3, r3, r3, lsl #2
	ldr	r1, [r1]
	ldr	r0, [sp, #12]
	lsl	r3, r3, #2
	bl	assert_wait_timeout
	ldr	r3, .L27+48
	ldr	r0, [r3]
	bl	thread_block
	b	.L8
.L28:
	.align	2
.L27:
	.word	.LC0
	.word	TH_OPT_VMPRIV
	.word	TRUE
	.word	FALSE
	.word	VM_KERN_MEMORY_ZONE
	.word	zone_replenish_loops
	.word	zone_replenish_wakeups
	.word	zone_map
	.word	KERN_SUCCESS
	.word	KERN_RESOURCE_SHORTAGE
	.word	KERN_NO_SPACE
	.word	THREAD_UNINT
	.word	THREAD_CONTINUE_NULL
	.word	KMA_KOBJECT
	.word	KMA_NOPAGEWAIT
	.word	KMA_NOENCRYPT
	.word	vm_pageout_garbage_collect
	.word	kernel_map
	.word	NSEC_PER_USEC
	.size	zone_replenish_thread, .-zone_replenish_thread
	.comm	zone_replenish_wakeups,4,4
	.comm	zone_replenish_loops,4,4
	.comm	zone_map,4,4
	.comm	vm_pageout_garbage_collect,4,4
	.comm	kernel_map,4,4
	.comm	VM_KERN_MEMORY_ZONE,4,4
	.comm	TRUE,4,4
	.comm	TH_OPT_VMPRIV,4,4
	.comm	THREAD_UNINT,4,4
	.comm	THREAD_CONTINUE_NULL,4,4
	.comm	NSEC_PER_USEC,4,4
	.comm	KMA_NOPAGEWAIT,4,4
	.comm	KMA_NOENCRYPT,4,4
	.comm	KMA_KOBJECT,4,4
	.comm	KERN_SUCCESS,4,4
	.comm	KERN_RESOURCE_SHORTAGE,4,4
	.comm	KERN_NO_SPACE,4,4
	.comm	FALSE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
