	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_xen_hvm_set_callback           ## -- Begin function xen_hvm_set_callback
	.p2align	4, 0x90
_xen_hvm_set_callback:                  ## @xen_hvm_set_callback
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_xen_vector_callback_enabled@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	je	LBB0_1
LBB0_16:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	%rdi, %r14
	movq	_DOMID_SELF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -32(%rbp)
	movq	_HVM_PARAM_CALLBACK_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -36(%rbp)
	movq	_XENFEAT_hvm_callback_vector@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_xen_feature
	testq	%rax, %rax
	je	LBB0_10
## %bb.2:
	xorl	%edi, %edi
	callq	_set_percpu_callback
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movq	_IDT_EVTCHN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_HVM_CALLBACK_VECTOR
	jmp	LBB0_5
LBB0_3:
	movq	_xen_evtchn_needs_ack@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movl	$1, %eax
LBB0_5:
	movl	%eax, -40(%rbp)
	movq	_HVMOP_set_param@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-40(%rbp), %rsi
	callq	_HYPERVISOR_hvm_op
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movl	%eax, %ebx
	movq	_xen_evtchn_needs_ack@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_9
## %bb.8:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_panic
LBB0_9:
	leaq	L_.str.1(%rip), %rdi
	movl	%ebx, %esi
	callq	_printf
LBB0_10:
	movl	$0, (%r15)
	testq	%r14, %r14
	je	LBB0_16
## %bb.11:
	movq	%r14, %rdi
	callq	_pci_get_irq
	cmpl	$15, %eax
	jg	LBB0_13
## %bb.12:
	movl	%eax, %edi
	callq	_HVM_CALLBACK_GSI
	jmp	LBB0_14
LBB0_6:
	movl	$1, (%r15)
	jmp	LBB0_16
LBB0_13:
	movq	%r14, %rdi
	callq	_pci_get_slot
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_pci_get_intpin
	leaq	-1(%rax), %rsi
	movq	%rbx, %rdi
	callq	_HVM_CALLBACK_PCI_INTX
LBB0_14:
	movl	%eax, -40(%rbp)
	movq	_HVMOP_set_param@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-40(%rbp), %rsi
	callq	_HYPERVISOR_hvm_op
	testl	%eax, %eax
	je	LBB0_16
## %bb.15:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_panic
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_xen_vector_callback_enabled,4,2 ## @xen_vector_callback_enabled
	.comm	_DOMID_SELF,4,2                 ## @DOMID_SELF
	.comm	_HVM_PARAM_CALLBACK_IRQ,4,2     ## @HVM_PARAM_CALLBACK_IRQ
	.comm	_XENFEAT_hvm_callback_vector,4,2 ## @XENFEAT_hvm_callback_vector
	.comm	_xen_evtchn_needs_ack,4,2       ## @xen_evtchn_needs_ack
	.comm	_IDT_EVTCHN,4,2                 ## @IDT_EVTCHN
	.comm	_HVMOP_set_param,4,2            ## @HVMOP_set_param
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unable to setup fake HVM param: %d"

L_.str.1:                               ## @.str.1
	.asciz	"Xen HVM callback vector registration failed (%d). Falling back to emulated device interrupt\n"

L_.str.2:                               ## @.str.2
	.asciz	"Can't set evtchn callback"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_xen_hvm_set_callback           ; -- Begin function xen_hvm_set_callback
	.p2align	2
_xen_hvm_set_callback:                  ; @xen_hvm_set_callback
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
Lloh0:
	adrp	x22, _xen_vector_callback_enabled@GOTPAGE
Lloh1:
	ldr	x22, [x22, _xen_vector_callback_enabled@GOTPAGEOFF]
	ldr	w8, [x22]
	cbz	w8, LBB0_2
LBB0_1:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_2:
	mov	x19, x0
Lloh2:
	adrp	x8, _DOMID_SELF@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DOMID_SELF@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _HVM_PARAM_CALLBACK_IRQ@GOTPAGE
Lloh6:
	ldr	x9, [x9, _HVM_PARAM_CALLBACK_IRQ@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	stp	w9, w8, [sp, #20]
Lloh8:
	adrp	x8, _XENFEAT_hvm_callback_vector@GOTPAGE
Lloh9:
	ldr	x8, [x8, _XENFEAT_hvm_callback_vector@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	bl	_xen_feature
Lloh11:
	adrp	x21, _HVMOP_set_param@GOTPAGE
Lloh12:
	ldr	x21, [x21, _HVMOP_set_param@GOTPAGEOFF]
	cbz	x0, LBB0_10
; %bb.3:
	mov	w0, #0
	bl	_set_percpu_callback
Lloh13:
	adrp	x23, _xen_evtchn_needs_ack@GOTPAGE
Lloh14:
	ldr	x23, [x23, _xen_evtchn_needs_ack@GOTPAGEOFF]
	cbz	w0, LBB0_5
; %bb.4:
Lloh15:
	adrp	x8, _IDT_EVTCHN@GOTPAGE
Lloh16:
	ldr	x8, [x8, _IDT_EVTCHN@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	bl	_HVM_CALLBACK_VECTOR
	b	LBB0_6
LBB0_5:
	mov	w0, #1
	str	w0, [x23]
LBB0_6:
	str	w0, [sp, #16]
	ldr	w0, [x21]
	add	x1, sp, #16
	bl	_HYPERVISOR_hvm_op
	cbz	w0, LBB0_13
; %bb.7:
	mov	x20, x0
	ldr	w8, [x23]
	cbz	w8, LBB0_9
; %bb.8:
	str	x20, [sp]
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	bl	_panic
LBB0_9:
Lloh20:
	adrp	x0, l_.str.1@PAGE
Lloh21:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_printf
LBB0_10:
	str	wzr, [x22]
	cbz	x19, LBB0_1
; %bb.11:
	mov	x0, x19
	bl	_pci_get_irq
	cmp	w0, #15
	b.gt	LBB0_14
; %bb.12:
	bl	_HVM_CALLBACK_GSI
	b	LBB0_15
LBB0_13:
	mov	w8, #1
	str	w8, [x22]
	b	LBB0_1
LBB0_14:
	mov	x0, x19
	bl	_pci_get_slot
	mov	x20, x0
	mov	x0, x19
	bl	_pci_get_intpin
	sub	x1, x0, #1
	mov	x0, x20
	bl	_HVM_CALLBACK_PCI_INTX
LBB0_15:
	str	w0, [sp, #16]
	ldr	w0, [x21]
	add	x1, sp, #16
	bl	_HYPERVISOR_hvm_op
	cbz	w0, LBB0_1
; %bb.16:
Lloh22:
	adrp	x0, l_.str.2@PAGE
Lloh23:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_panic
	b	LBB0_1
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_xen_vector_callback_enabled,4,2 ; @xen_vector_callback_enabled
	.comm	_DOMID_SELF,4,2                 ; @DOMID_SELF
	.comm	_HVM_PARAM_CALLBACK_IRQ,4,2     ; @HVM_PARAM_CALLBACK_IRQ
	.comm	_XENFEAT_hvm_callback_vector,4,2 ; @XENFEAT_hvm_callback_vector
	.comm	_xen_evtchn_needs_ack,4,2       ; @xen_evtchn_needs_ack
	.comm	_IDT_EVTCHN,4,2                 ; @IDT_EVTCHN
	.comm	_HVMOP_set_param,4,2            ; @HVMOP_set_param
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unable to setup fake HVM param: %d"

l_.str.1:                               ; @.str.1
	.asciz	"Xen HVM callback vector registration failed (%d). Falling back to emulated device interrupt\n"

l_.str.2:                               ; @.str.2
	.asciz	"Can't set evtchn callback"

.subsections_via_symbols
