xref: /illumos-gate/usr/src/test/bhyve-tests/tests/inst_emul/payload_imul.S (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
1/*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source.  A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12/*
13 * Copyright 2022 Oxide Computer Company
14 */
15
16#include <sys/asm_linkage.h>
17#include "payload_common.h"
18
19ENTRY(start)
20	/* check that the mmio values we expect are emitted */
21	movw	0x10001234, %ax
22	cmpw	$0x1234, %ax
23	jne		fail
24	movl	0x10001232, %eax
25	cmpl	$0x12341232, %eax
26	jne		fail
27	movq	0x10001230, %rax
28	movq	$0x1236123412321230, %rdx
29	cmpq	%rdx, %rax
30	jne		fail
31
32	/* attempt the imul at 2/4/8 byte widths */
33	movl	$0x2, %eax
34	imulw	0x10001234, %ax
35	cmpw	$0x2468, %ax
36	jne		fail
37
38	movl	$0x2, %eax
39	imull	0x10001232, %eax
40	cmpl	$0x24682464, %eax
41	jne		fail
42
43	movl	$0x10, %eax
44	imulq	0x10001230, %rax
45	movq	$0x2361234123212300, %rcx
46	cmpq	%rcx, %rax
47	jne		fail
48
49	movw    $IOP_TEST_RESULT, %dx
50	movb    $TEST_RESULT_PASS, %al
51	outb    (%dx)
52	hlt
53
54fail:
55	movw    $IOP_TEST_RESULT, %dx
56	movb    $TEST_RESULT_FAIL, %al
57	outb    (%dx)
58	hlt
59SET_SIZE(start)
60