All of lore.kernel.org
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: qemu-devel@nongnu.org
Cc: arrowd@freebsd.org, kevans@freebsd.org,
	richard.henderson@linaro.org, f4bug@amsat.org, def@freebsd.org,
	Warner Losh <imp@bsdimp.com>
Subject: [PATCH for 7.0 2/5] h.i386: Simple hello-world test for i386
Date: Sat, 27 Nov 2021 13:18:43 -0700	[thread overview]
Message-ID: <20211127201846.64187-3-imp@bsdimp.com> (raw)
In-Reply-To: <20211127201846.64187-1-imp@bsdimp.com>

A simple, tiny, statically linked i386 'hello world' test. It uses two
system calls (write and exit) and provides a basic sanity check to make
sure that the arm bsd-user binary can interpret FreeBSD 32-bit i386
binaries.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 tests/bsd-user-smoke/h.i386.S | 39 +++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 tests/bsd-user-smoke/h.i386.S

diff --git a/tests/bsd-user-smoke/h.i386.S b/tests/bsd-user-smoke/h.i386.S
new file mode 100644
index 00000000000..0af5a709f15
--- /dev/null
+++ b/tests/bsd-user-smoke/h.i386.S
@@ -0,0 +1,39 @@
+# Copyright (c) 2021 Warner Losh
+# SPDX-License-Identifier: BSD-2-Clause
+
+#include <sys/syscall.h>
+#define STDOUT_FILENO	1
+
+	.text
+	.file	"hello.s"
+	.globl	qemu_start                            # -- Begin function qemu_start
+	.p2align	4, 0x90
+	.type	qemu_start,@function
+qemu_start:                                   # @qemu_start
+# %bb.0:                                # %entry
+	pushl	%ebp
+	movl	%esp, %ebp
+
+	# write(1, .L.str, sizeof(.L.str) - 1)
+	pushl	$(.L.strEnd - .L.str - 1)
+	pushl	$.L.str
+	pushl	$STDOUT_FILENO
+	pushl	%eax			# dummy return address
+	movl	$SYS_write, %eax
+	int	$0x80
+	addl	$16, %esp		# 3 args + 1 dummy
+
+	# _exit(0)
+	pushl	$0
+	pushl	%eax			# dummy return address
+	movl	$SYS_exit, %eax
+	int	$0x80
+.Lfunc_end0:
+	.size	qemu_start, .Lfunc_end0-qemu_start
+                                        # -- End function
+	.type	.L.str,@object                  # @.str
+	.section	.rodata.str1.1,"aMS",@progbits,1
+.L.str:
+	.asciz	"Hello World\n"
+.L.strEnd:
+	.size .L.str, .L.strEnd - .L.str
-- 
2.33.0



  parent reply	other threads:[~2021-11-27 20:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 1/5] h.armv7: Simple hello-world test for armv7 Warner Losh
2021-11-27 20:18 ` Warner Losh [this message]
2021-11-27 20:18 ` [PATCH for 7.0 3/5] h.amd64: Simple hello-world test for x86_64 Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 4/5] smoke-bsd-user: A test script to run all the FreeBSD binaries Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 5/5] bsd-user-smoke: Add to build Warner Losh
2022-01-04 23:25   ` Philippe Mathieu-Daudé
2022-01-04 23:28     ` Warner Losh
2021-12-03 23:46 ` [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
2022-01-04 17:20   ` Alex Bennée
2022-01-04 17:39     ` Warner Losh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211127201846.64187-3-imp@bsdimp.com \
    --to=imp@bsdimp.com \
    --cc=arrowd@freebsd.org \
    --cc=def@freebsd.org \
    --cc=f4bug@amsat.org \
    --cc=kevans@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.