From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Thomas Leonard <talex5@gmail.com>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com,
Dave.Scott@eu.citrix.com, anil@recoil.org
Subject: Re: [PATCH ARM v3 4/7] mini-os: moved events code under arch
Date: Wed, 11 Jun 2014 21:04:04 +0200 [thread overview]
Message-ID: <20140611190404.GJ6816@type.mobile.lan> (raw)
In-Reply-To: <1402482618-15269-5-git-send-email-talex5@gmail.com>
Thomas Leonard, le Wed 11 Jun 2014 11:30:15 +0100, a écrit :
> From: Karim Raslan <karim.allah.ahmed@gmail.com>
>
> This is all code motion, except that we now initialise
> the ev_actions array before calling the arch-specific code
> to make it more robust against future changes.
>
> Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
> [talex5@gmail.com: separated from big ARM commit]
> Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> extras/mini-os/arch/x86/events.c | 31 +++++++++++++++++++++++++++++++
> extras/mini-os/events.c | 24 ++++--------------------
> extras/mini-os/include/events.h | 3 +++
> 3 files changed, 38 insertions(+), 20 deletions(-)
> create mode 100644 extras/mini-os/arch/x86/events.c
>
> diff --git a/extras/mini-os/arch/x86/events.c b/extras/mini-os/arch/x86/events.c
> new file mode 100644
> index 0000000..e420a98
> --- /dev/null
> +++ b/extras/mini-os/arch/x86/events.c
> @@ -0,0 +1,31 @@
> +#include <mini-os/os.h>
> +#include <mini-os/mm.h>
> +#include <mini-os/events.h>
> +
> +#if defined(__x86_64__)
> +char irqstack[2 * STACK_SIZE];
> +
> +static struct pda
> +{
> + int irqcount; /* offset 0 (used in x86_64.S) */
> + char *irqstackptr; /* 8 */
> +} cpu0_pda;
> +#endif
> +
> +void arch_init_events(void)
> +{
> +#if defined(__x86_64__)
> + asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
> + wrmsrl(0xc0000101, &cpu0_pda); /* 0xc0000101 is MSR_GS_BASE */
> + cpu0_pda.irqcount = -1;
> + cpu0_pda.irqstackptr = (void*) (((unsigned long)irqstack + 2 * STACK_SIZE)
> + & ~(STACK_SIZE - 1));
> +#endif
> +}
> +
> +void arch_fini_events(void)
> +{
> +#if defined(__x86_64__)
> + wrmsrl(0xc0000101, NULL); /* 0xc0000101 is MSR_GS_BASE */
> +#endif
> +}
> diff --git a/extras/mini-os/events.c b/extras/mini-os/events.c
> index 2da9b01..d60630b 100644
> --- a/extras/mini-os/events.c
> +++ b/extras/mini-os/events.c
> @@ -167,44 +167,28 @@ evtchn_port_t bind_pirq(uint32_t pirq, int will_share,
> return op.port;
> }
>
> -#if defined(__x86_64__)
> -char irqstack[2 * STACK_SIZE];
> -
> -static struct pda
> -{
> - int irqcount; /* offset 0 (used in x86_64.S) */
> - char *irqstackptr; /* 8 */
> -} cpu0_pda;
> -#endif
> -
> /*
> * Initially all events are without a handler and disabled
> */
> void init_events(void)
> {
> int i;
> -#if defined(__x86_64__)
> - asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
> - wrmsrl(0xc0000101, &cpu0_pda); /* 0xc0000101 is MSR_GS_BASE */
> - cpu0_pda.irqcount = -1;
> - cpu0_pda.irqstackptr = (void*) (((unsigned long)irqstack + 2 * STACK_SIZE)
> - & ~(STACK_SIZE - 1));
> -#endif
> +
> /* initialize event handler */
> for ( i = 0; i < NR_EVS; i++ )
> {
> ev_actions[i].handler = default_handler;
> mask_evtchn(i);
> }
> +
> + arch_init_events();
> }
>
> void fini_events(void)
> {
> /* Dealloc all events */
> unbind_all_ports();
> -#if defined(__x86_64__)
> - wrmsrl(0xc0000101, NULL); /* 0xc0000101 is MSR_GS_BASE */
> -#endif
> + arch_fini_events();
> }
>
> void default_handler(evtchn_port_t port, struct pt_regs *regs, void *ignore)
> diff --git a/extras/mini-os/include/events.h b/extras/mini-os/include/events.h
> index 0e9d3a7..0452d21 100644
> --- a/extras/mini-os/include/events.h
> +++ b/extras/mini-os/include/events.h
> @@ -25,6 +25,9 @@
> typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *);
>
> /* prototypes */
> +void arch_init_events(void);
> +void arch_fini_events(void);
> +
> int do_event(evtchn_port_t port, struct pt_regs *regs);
> evtchn_port_t bind_virq(uint32_t virq, evtchn_handler_t handler, void *data);
> evtchn_port_t bind_pirq(uint32_t pirq, int will_share, evtchn_handler_t handler, void *data);
> --
> 2.0.0
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
--
Samuel
<N> un driver qui fait quoi, alors ?
<y> ben pour les bips
<s> pour passer les oops en morse
-+- #ens-mim - vive les rapports de bug -+-
next prev parent reply other threads:[~2014-06-11 20:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-11 10:30 [PATCH ARM v3 0/7] mini-os: initial ARM support Thomas Leonard
2014-06-11 10:30 ` [PATCH ARM v3 1/7] mini-os: build fixes Thomas Leonard
2014-06-11 19:02 ` Samuel Thibault
2014-06-11 10:30 ` [PATCH ARM v3 2/7] mini-os: fixed shutdown thread Thomas Leonard
2014-06-12 9:52 ` Ian Campbell
2014-06-12 9:54 ` Samuel Thibault
2014-06-16 12:48 ` Thomas Leonard
2014-06-16 12:55 ` Ian Campbell
2014-06-11 10:30 ` [PATCH ARM v3 3/7] mini-os: tidied up code Thomas Leonard
2014-06-11 10:30 ` [PATCH ARM v3 4/7] mini-os: moved events code under arch Thomas Leonard
2014-06-11 19:04 ` Samuel Thibault [this message]
2014-06-11 10:30 ` [PATCH ARM v3 5/7] mini-os: switched initial C entry point to arch_init Thomas Leonard
2014-06-11 19:09 ` Samuel Thibault
2014-06-11 10:30 ` [PATCH ARM v3 6/7] mini-os: don't include queue.h if there's no libc Thomas Leonard
2014-06-11 19:10 ` Samuel Thibault
2014-06-11 10:30 ` [PATCH ARM v3 7/7] mini-os: initial ARM support Thomas Leonard
2014-06-11 19:24 ` Samuel Thibault
2014-06-12 7:41 ` Ian Campbell
2014-06-12 7:44 ` Samuel Thibault
2014-06-12 7:53 ` Ian Campbell
2014-06-17 13:47 ` Thomas Leonard
2014-06-17 22:53 ` Samuel Thibault
2014-06-18 7:55 ` Thomas Leonard
2014-06-18 8:21 ` Samuel Thibault
2014-06-12 10:31 ` [PATCH ARM v3 0/7] " Ian Campbell
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=20140611190404.GJ6816@type.mobile.lan \
--to=samuel.thibault@ens-lyon.org \
--cc=Dave.Scott@eu.citrix.com \
--cc=anil@recoil.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=talex5@gmail.com \
--cc=xen-devel@lists.xenproject.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.