	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pmap_demote_DMAP               ## -- Begin function pmap_demote_DMAP
	.p2align	4, 0x90
_pmap_demote_DMAP:                      ## @pmap_demote_DMAP
	.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
	testl	%esi, %esi
	je	LBB0_20
## %bb.1:
	movq	%rdx, %r14
	movl	%esi, %r13d
	movl	%edi, %ebx
	movl	%esi, %edi
	callq	_powerof2
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_KASSERT
	leal	-1(%r13), %eax
	xorl	%edi, %edi
	testl	%ebx, %eax
	sete	%dil
	leaq	L_.str.1(%rip), %rsi
	callq	_KASSERT
	movq	_NBPDP@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jle	LBB0_20
## %bb.2:
	movq	_dmaplimit@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jle	LBB0_20
## %bb.3:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movl	%ebx, %edi
	callq	_PHYS_TO_DMAP
	movl	%eax, %r15d
	movq	_FALSE@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	_kernel_pmap@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_PMAP_LOCK
	movl	(%rbx), %edi
	movl	%r15d, %esi
	callq	_pmap_pdpe
	movq	%rax, %r12
	movl	(%rax), %eax
	movq	_X86_PG_V@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_5
## %bb.4:
	leaq	L_.str.2(%rip), %rdi
	callq	_panic
	movl	(%r12), %eax
LBB0_5:
	movq	_PG_PS@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_9
## %bb.6:
	movl	(%rbx), %edi
	movq	%r12, %rsi
	movl	%r15d, %edx
	callq	_pmap_demote_pdpe
	testl	%eax, %eax
	jne	LBB0_8
## %bb.7:
	leaq	L_.str.3(%rip), %rdi
	callq	_panic
LBB0_8:
	movq	_TRUE@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
LBB0_9:
	movq	_NBPDR@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jle	LBB0_16
## %bb.10:
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_pmap_pdpe_to_pde
	movq	%rax, %rbx
	movl	(%rax), %eax
	movq	_X86_PG_V@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_12
## %bb.11:
	leaq	L_.str.4(%rip), %rdi
	callq	_panic
	movl	(%rbx), %eax
LBB0_12:
	movq	_PG_PS@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_16
## %bb.13:
	movq	_kernel_pmap@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	movl	%r15d, %edx
	callq	_pmap_demote_pde
	testl	%eax, %eax
	jne	LBB0_15
## %bb.14:
	leaq	L_.str.5(%rip), %rdi
	callq	_panic
LBB0_15:
	movq	_TRUE@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
LBB0_16:
	cmpq	$0, -48(%rbp)                   ## 8-byte Folded Reload
	movq	_kernel_pmap@GOTPCREL(%rip), %rbx
	je	LBB0_19
## %bb.17:
	testq	%r14, %r14
	je	LBB0_19
## %bb.18:
	movl	(%rbx), %edi
	movl	%r15d, %esi
	callq	_pmap_invalidate_page
LBB0_19:
	movl	(%rbx), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PMAP_UNLOCK                    ## TAILCALL
LBB0_20:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pmap_demote_DMAP: len is not a power of 2"

L_.str.1:                               ## @.str.1
	.asciz	"pmap_demote_DMAP: base is not a multiple of len"

	.comm	_NBPDP,4,2                      ## @NBPDP
	.comm	_dmaplimit,4,2                  ## @dmaplimit
	.comm	_FALSE,8,3                      ## @FALSE
	.comm	_kernel_pmap,4,2                ## @kernel_pmap
	.comm	_X86_PG_V,4,2                   ## @X86_PG_V
L_.str.2:                               ## @.str.2
	.asciz	"pmap_demote_DMAP: invalid PDPE"

	.comm	_PG_PS,4,2                      ## @PG_PS
L_.str.3:                               ## @.str.3
	.asciz	"pmap_demote_DMAP: PDPE failed"

	.comm	_TRUE,8,3                       ## @TRUE
	.comm	_NBPDR,4,2                      ## @NBPDR
L_.str.4:                               ## @.str.4
	.asciz	"pmap_demote_DMAP: invalid PDE"

L_.str.5:                               ## @.str.5
	.asciz	"pmap_demote_DMAP: PDE failed"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pmap_demote_DMAP               ; -- Begin function pmap_demote_DMAP
	.p2align	2
_pmap_demote_DMAP:                      ; @pmap_demote_DMAP
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	cbz	w1, LBB0_2
; %bb.1:
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	mov	x0, x1
	bl	_powerof2
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
	sub	w8, w21, #1
	tst	w8, w20
	cset	w0, eq
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_KASSERT
Lloh4:
	adrp	x8, _NBPDP@GOTPAGE
Lloh5:
	ldr	x8, [x8, _NBPDP@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
Lloh7:
	adrp	x9, _dmaplimit@GOTPAGE
Lloh8:
	ldr	x9, [x9, _dmaplimit@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	cmp	w8, w21
	ccmp	w9, w20, #4, gt
	b.gt	LBB0_3
LBB0_2:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_3:
	mov	x0, x20
	bl	_PHYS_TO_DMAP
	mov	x20, x0
Lloh10:
	adrp	x8, _FALSE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh12:
	ldr	x24, [x8]
Lloh13:
	adrp	x23, _kernel_pmap@GOTPAGE
Lloh14:
	ldr	x23, [x23, _kernel_pmap@GOTPAGEOFF]
	ldr	w0, [x23]
	bl	_PMAP_LOCK
	ldr	w0, [x23]
	mov	x1, x20
	bl	_pmap_pdpe
	mov	x22, x0
	ldr	w8, [x0]
Lloh15:
	adrp	x25, _X86_PG_V@GOTPAGE
Lloh16:
	ldr	x25, [x25, _X86_PG_V@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	b.ne	LBB0_5
; %bb.4:
Lloh17:
	adrp	x0, l_.str.2@PAGE
Lloh18:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_panic
	ldr	w8, [x22]
LBB0_5:
Lloh19:
	adrp	x26, _PG_PS@GOTPAGE
Lloh20:
	ldr	x26, [x26, _PG_PS@GOTPAGEOFF]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.6:
	ldr	w0, [x23]
	mov	x1, x22
	mov	x2, x20
	bl	_pmap_demote_pdpe
	cbnz	w0, LBB0_8
; %bb.7:
Lloh21:
	adrp	x0, l_.str.3@PAGE
Lloh22:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_panic
LBB0_8:
Lloh23:
	adrp	x8, _TRUE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh25:
	ldr	x24, [x8]
LBB0_9:
Lloh26:
	adrp	x8, _NBPDR@GOTPAGE
Lloh27:
	ldr	x8, [x8, _NBPDR@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	cmp	w8, w21
	b.le	LBB0_16
; %bb.10:
	mov	x0, x22
	mov	x1, x20
	bl	_pmap_pdpe_to_pde
	mov	x21, x0
	ldr	w8, [x0]
	ldr	w9, [x25]
	tst	w9, w8
	b.ne	LBB0_12
; %bb.11:
Lloh29:
	adrp	x0, l_.str.4@PAGE
Lloh30:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_panic
	ldr	w8, [x21]
LBB0_12:
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_16
; %bb.13:
	ldr	w0, [x23]
	mov	x1, x21
	mov	x2, x20
	bl	_pmap_demote_pde
	cbnz	w0, LBB0_15
; %bb.14:
Lloh31:
	adrp	x0, l_.str.5@PAGE
Lloh32:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_panic
LBB0_15:
Lloh33:
	adrp	x8, _TRUE@GOTPAGE
Lloh34:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh35:
	ldr	x24, [x8]
LBB0_16:
	cbz	x19, LBB0_19
; %bb.17:
	cbz	x24, LBB0_19
; %bb.18:
	ldr	w0, [x23]
	mov	x1, x20
	bl	_pmap_invalidate_page
LBB0_19:
	ldr	w0, [x23]
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_PMAP_UNLOCK
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pmap_demote_DMAP: len is not a power of 2"

l_.str.1:                               ; @.str.1
	.asciz	"pmap_demote_DMAP: base is not a multiple of len"

	.comm	_NBPDP,4,2                      ; @NBPDP
	.comm	_dmaplimit,4,2                  ; @dmaplimit
	.comm	_FALSE,8,3                      ; @FALSE
	.comm	_kernel_pmap,4,2                ; @kernel_pmap
	.comm	_X86_PG_V,4,2                   ; @X86_PG_V
l_.str.2:                               ; @.str.2
	.asciz	"pmap_demote_DMAP: invalid PDPE"

	.comm	_PG_PS,4,2                      ; @PG_PS
l_.str.3:                               ; @.str.3
	.asciz	"pmap_demote_DMAP: PDPE failed"

	.comm	_TRUE,8,3                       ; @TRUE
	.comm	_NBPDR,4,2                      ; @NBPDR
l_.str.4:                               ; @.str.4
	.asciz	"pmap_demote_DMAP: invalid PDE"

l_.str.5:                               ; @.str.5
	.asciz	"pmap_demote_DMAP: PDE failed"

.subsections_via_symbols
