public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Andrew Jones <drjones@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [PATCH 7/9] Add halt() and some error codes
Date: Sat, 28 Dec 2013 22:31:03 -0800	[thread overview]
Message-ID: <20131229063103.GF13601@cbox> (raw)
In-Reply-To: <1386175377-23086-8-git-send-email-drjones@redhat.com>

On Wed, Dec 04, 2013 at 05:42:55PM +0100, Andrew Jones wrote:
> Define a halt function that can be implemented by the test framework
> for use on error paths before exit() works. Also add some error codes
> that can be passed to halt() in case the serial isn't working either.
> Then, on register inspection of the halted guest we may be able to
> quickly determine the problem without having to find the halt()
> call-site. The error codes may of course also be used with exit().

Looks good to me.

-Christoffer

> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> 
> ---
> v2:
>  - keep the error numbers more consistent with the standard numbers
> ---
>  lib/errno.h    | 22 ++++++++++++++++++++++
>  lib/libcflat.h |  2 ++
>  2 files changed, 24 insertions(+)
>  create mode 100644 lib/errno.h
> 
> diff --git a/lib/errno.h b/lib/errno.h
> new file mode 100644
> index 0000000000000..f60845cdc61f6
> --- /dev/null
> +++ b/lib/errno.h
> @@ -0,0 +1,22 @@
> +#ifndef _ERRNO_H_
> +#define _ERRNO_H_
> +/*
> + * Define some error codes for the test framework's use. qemu
> + * exits with ((code << 1) | 1) when this framework calls
> + * exit(code), so we reserve codes 64 to 126. 127 is left
> + * for exit(-1).
> + *
> + * (Ab)use the standard E* names for syntax highlighting...
> + * The errno descriptions in [] are for non-standard semantics.
> + */
> +#define EINTR	(64 + 4)	/* [unhandled exception] */
> +#define EIO	(64 + 5)	/* I/O error */
> +#define ENXIO	(64 + 6)	/* No such device or address [no serial] */
> +#define ENOEXEC	(64 + 8)	/* Exec format error [bad flat file] */
> +#define ENOMEM	(64 + 12)	/* Out of memory */
> +#define ENODEV	(64 + 19)	/* No such device */
> +#define EINVAL	(64 + 22)	/* Invalid argument */
> +#define ENOSPC	(64 + 28)	/* No space left on device */
> +#define ERANGE	(64 + 34)	/* Math result not representable
> +				   [divide by zero] */
> +#endif
> diff --git a/lib/libcflat.h b/lib/libcflat.h
> index 140c172e77d54..a1be635ab4ee9 100644
> --- a/lib/libcflat.h
> +++ b/lib/libcflat.h
> @@ -37,6 +37,7 @@ typedef _Bool bool;
>  #define true 1
>  #define false 0
>  
> +extern void halt(int code);
>  extern void exit(int code);
>  
>  extern unsigned long strlen(const char *buf);
> @@ -57,4 +58,5 @@ extern long atol(const char *ptr);
>  #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
>  
>  #define NULL ((void *)0UL)
> +#include "errno.h"
>  #endif
> -- 
> 1.8.1.4
> 

  reply	other threads:[~2013-12-29  6:30 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04 16:42 [PATCH 0/9 v2] kvm-unit-tests/arm: initial drop Andrew Jones
2013-12-04 16:42 ` [PATCH 1/9] remove unused files Andrew Jones
2013-12-04 16:42 ` [PATCH 2/9] makefile and run_tests tweaks Andrew Jones
2013-12-29  6:30   ` Christoffer Dall
2014-01-02 14:30     ` Andrew Jones
2013-12-04 16:42 ` [PATCH 3/9] clean root dir of all x86-ness Andrew Jones
2013-12-29  6:30   ` Christoffer Dall
2014-01-02 15:00     ` Andrew Jones
2014-01-02 17:16       ` Christoffer Dall
2013-12-04 16:42 ` [PATCH 4/9] move x86's simple heap management to common code Andrew Jones
2013-12-29  6:30   ` Christoffer Dall
2014-01-02 15:17     ` Andrew Jones
2014-01-02 17:17       ` Christoffer Dall
2013-12-04 16:42 ` [PATCH 5/9] Introduce libio to common code for io read/write Andrew Jones
2013-12-29  6:30   ` Christoffer Dall
2014-01-02 15:47     ` Andrew Jones
2014-01-02 17:19       ` Christoffer Dall
2014-01-02 18:38         ` Andrew Jones
2013-12-04 16:42 ` [PATCH 6/9] Introduce a simple iomap structure Andrew Jones
2013-12-29  6:30   ` Christoffer Dall
2014-01-02 16:04     ` Andrew Jones
2014-01-02 17:23       ` Christoffer Dall
2014-01-02 18:40         ` Andrew Jones
2014-01-02 21:05           ` Christoffer Dall
2014-01-02 17:32       ` Peter Maydell
2013-12-04 16:42 ` [PATCH 7/9] Add halt() and some error codes Andrew Jones
2013-12-29  6:31   ` Christoffer Dall [this message]
2013-12-04 16:42 ` [PATCH 8/9] Introduce virtio-testdev Andrew Jones
2013-12-29  6:31   ` Christoffer Dall
2014-01-02 16:16     ` Andrew Jones
2014-01-02 17:27       ` Christoffer Dall
2014-01-02 18:41         ` Andrew Jones
2013-12-04 16:42 ` [PATCH 9/9] arm: initial drop Andrew Jones
2013-12-29  6:31   ` Christoffer Dall
2013-12-29  9:18     ` Peter Maydell
2014-01-02 16:54     ` Andrew Jones
2014-01-02 17:40       ` Peter Maydell
2014-01-02 18:09         ` Christoffer Dall
2014-01-02 18:44           ` Andrew Jones
2014-01-02 17:44       ` Christoffer Dall
2014-01-02 18:50         ` Andrew Jones
2014-01-02 19:17           ` Christoffer Dall
2014-01-03 17:52             ` Andrew Jones
2014-01-03 17:55               ` Christoffer Dall

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=20131229063103.GF13601@cbox \
    --to=christoffer.dall@linaro.org \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox