All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Joe Damato <ice799@gmail.com>
Cc: linux-x86_64@vger.kernel.org, linux-newbie@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 12/12] x86: Use struct fields instead of bitmasks
Date: Wed, 29 Oct 2008 12:56:00 +0000	[thread overview]
Message-ID: <49085D60.7050807@goop.org> (raw)
In-Reply-To: <434766d4b5b6c08a3665c19038daaa3c1fa04cb0.1224903713.git.ice799@gmail.com>

Joe Damato wrote:
> Use fields in structs instead of bitmasks for getting/setting descriptor data.
>
> Signed-off-by: Joe Damato <ice799@gmail.com>
> ---
>  drivers/lguest/interrupts_and_traps.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
> index bfb24d9..0d9c065 100644
> --- a/drivers/lguest/interrupts_and_traps.c
> +++ b/drivers/lguest/interrupts_and_traps.c
> @@ -178,7 +178,7 @@ void maybe_do_interrupt(struct lg_cpu *cpu)
>  	 * over them. */
>  	idt = &cpu->arch.idt[FIRST_EXTERNAL_VECTOR+irq];
>  	/* If they don't have a handler (yet?), we just ignore it */
> -	if (idt_present(idt->a, idt->b)) {
> +	if (idt->p) {
>   

No, using an idt_present() accessor is better, but just pass it an idt.

>  		/* OK, mark it no longer pending and deliver it. */
>  		clear_bit(irq, cpu->irqs_pending);
>  		/* set_guest_interrupt() takes the interrupt descriptor and a
> @@ -254,7 +254,7 @@ int deliver_trap(struct lg_cpu *cpu, unsigned int num)
>  
>  	/* Early on the Guest hasn't set the IDT entries (or maybe it put a
>  	 * bogus one in): if we fail here, the Guest will be killed. */
> -	if (!idt_present(cpu->arch.idt[num].a, cpu->arch.idt[num].b))
> +	if (!cpu->arch.idt[num].p)
>  		return 0;
>  	set_guest_interrupt(cpu, desc_lo(cpu->arch.idt[num]),
>  			    desc_hi(cpu->arch.idt[num]), has_err(num));
> @@ -461,7 +461,7 @@ void copy_traps(const struct lg_cpu *cpu, gate_desc *idt,
>  		 * If it can't go direct, we still need to copy the priv. level:
>  		 * they might want to give userspace access to a software
>  		 * interrupt. */
> -		if (idt_type(gidt->a, gidt->b) = 0xF)
> +		if (gidt->type = 0xF)
>   

We should have symbolic names for the IDT types.

    J

WARNING: multiple messages have this Message-ID (diff)
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Joe Damato <ice799@gmail.com>
Cc: linux-x86_64@vger.kernel.org, linux-newbie@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 12/12] x86: Use struct fields instead of bitmasks
Date: Wed, 29 Oct 2008 23:56:00 +1100	[thread overview]
Message-ID: <49085D60.7050807@goop.org> (raw)
In-Reply-To: <434766d4b5b6c08a3665c19038daaa3c1fa04cb0.1224903713.git.ice799@gmail.com>

Joe Damato wrote:
> Use fields in structs instead of bitmasks for getting/setting descriptor data.
>
> Signed-off-by: Joe Damato <ice799@gmail.com>
> ---
>  drivers/lguest/interrupts_and_traps.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
> index bfb24d9..0d9c065 100644
> --- a/drivers/lguest/interrupts_and_traps.c
> +++ b/drivers/lguest/interrupts_and_traps.c
> @@ -178,7 +178,7 @@ void maybe_do_interrupt(struct lg_cpu *cpu)
>  	 * over them. */
>  	idt = &cpu->arch.idt[FIRST_EXTERNAL_VECTOR+irq];
>  	/* If they don't have a handler (yet?), we just ignore it */
> -	if (idt_present(idt->a, idt->b)) {
> +	if (idt->p) {
>   

No, using an idt_present() accessor is better, but just pass it an idt.

>  		/* OK, mark it no longer pending and deliver it. */
>  		clear_bit(irq, cpu->irqs_pending);
>  		/* set_guest_interrupt() takes the interrupt descriptor and a
> @@ -254,7 +254,7 @@ int deliver_trap(struct lg_cpu *cpu, unsigned int num)
>  
>  	/* Early on the Guest hasn't set the IDT entries (or maybe it put a
>  	 * bogus one in): if we fail here, the Guest will be killed. */
> -	if (!idt_present(cpu->arch.idt[num].a, cpu->arch.idt[num].b))
> +	if (!cpu->arch.idt[num].p)
>  		return 0;
>  	set_guest_interrupt(cpu, desc_lo(cpu->arch.idt[num]),
>  			    desc_hi(cpu->arch.idt[num]), has_err(num));
> @@ -461,7 +461,7 @@ void copy_traps(const struct lg_cpu *cpu, gate_desc *idt,
>  		 * If it can't go direct, we still need to copy the priv. level:
>  		 * they might want to give userspace access to a software
>  		 * interrupt. */
> -		if (idt_type(gidt->a, gidt->b) == 0xF)
> +		if (gidt->type == 0xF)
>   

We should have symbolic names for the IDT types.

    J
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

WARNING: multiple messages have this Message-ID (diff)
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Joe Damato <ice799@gmail.com>
Cc: linux-x86_64@vger.kernel.org, linux-newbie@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 12/12] x86: Use struct fields instead of bitmasks
Date: Wed, 29 Oct 2008 23:56:00 +1100	[thread overview]
Message-ID: <49085D60.7050807@goop.org> (raw)
In-Reply-To: <434766d4b5b6c08a3665c19038daaa3c1fa04cb0.1224903713.git.ice799@gmail.com>

Joe Damato wrote:
> Use fields in structs instead of bitmasks for getting/setting descriptor data.
>
> Signed-off-by: Joe Damato <ice799@gmail.com>
> ---
>  drivers/lguest/interrupts_and_traps.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
> index bfb24d9..0d9c065 100644
> --- a/drivers/lguest/interrupts_and_traps.c
> +++ b/drivers/lguest/interrupts_and_traps.c
> @@ -178,7 +178,7 @@ void maybe_do_interrupt(struct lg_cpu *cpu)
>  	 * over them. */
>  	idt = &cpu->arch.idt[FIRST_EXTERNAL_VECTOR+irq];
>  	/* If they don't have a handler (yet?), we just ignore it */
> -	if (idt_present(idt->a, idt->b)) {
> +	if (idt->p) {
>   

No, using an idt_present() accessor is better, but just pass it an idt.

>  		/* OK, mark it no longer pending and deliver it. */
>  		clear_bit(irq, cpu->irqs_pending);
>  		/* set_guest_interrupt() takes the interrupt descriptor and a
> @@ -254,7 +254,7 @@ int deliver_trap(struct lg_cpu *cpu, unsigned int num)
>  
>  	/* Early on the Guest hasn't set the IDT entries (or maybe it put a
>  	 * bogus one in): if we fail here, the Guest will be killed. */
> -	if (!idt_present(cpu->arch.idt[num].a, cpu->arch.idt[num].b))
> +	if (!cpu->arch.idt[num].p)
>  		return 0;
>  	set_guest_interrupt(cpu, desc_lo(cpu->arch.idt[num]),
>  			    desc_hi(cpu->arch.idt[num]), has_err(num));
> @@ -461,7 +461,7 @@ void copy_traps(const struct lg_cpu *cpu, gate_desc *idt,
>  		 * If it can't go direct, we still need to copy the priv. level:
>  		 * they might want to give userspace access to a software
>  		 * interrupt. */
> -		if (idt_type(gidt->a, gidt->b) == 0xF)
> +		if (gidt->type == 0xF)
>   

We should have symbolic names for the IDT types.

    J

  reply	other threads:[~2008-10-29 12:56 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-25  3:15 [PATCH 00/12] x86: Cleanup idt, gdt/ldt/tss structs Joe Damato
2008-10-25  3:15 ` Joe Damato
2008-10-25  3:15 ` Joe Damato
2008-10-25  3:15 ` [PATCH 01/12] x86: Cleanup x86 descriptors, remove a/b fields from structs Joe Damato
2008-10-25  3:15   ` Joe Damato
2008-10-25  3:15   ` [PATCH 02/12] x86: Use new gate_struct for gate_desc Joe Damato
2008-10-25  3:15     ` Joe Damato
2008-10-25  3:15     ` Joe Damato
2008-10-25  3:15     ` [PATCH 03/12] x86: Cleanup usage of struct desc_struct Joe Damato
2008-10-25  3:15       ` Joe Damato
2008-10-25  3:15       ` Joe Damato
2008-10-25  3:15       ` [PATCH 04/12] x86: Add macros for gate_desc Joe Damato
2008-10-25  3:15         ` Joe Damato
2008-10-25  3:15         ` Joe Damato
2008-10-25  3:15         ` [PATCH 05/12] x86: Refactor pack_gate " Joe Damato
2008-10-25  3:15           ` Joe Damato
2008-10-25  3:15           ` Joe Damato
2008-10-25  3:15           ` [PATCH 06/12] x86: Refactor pack_descriptor Joe Damato
2008-10-25  3:15             ` Joe Damato
2008-10-25  3:15             ` Joe Damato
2008-10-25  3:15             ` [PATCH 07/12] x86: Add a static initializer for IDTs Joe Damato
2008-10-25  3:15               ` Joe Damato
2008-10-25  3:15               ` Joe Damato
2008-10-25  3:15               ` [PATCH 08/12] x86: Use static intializer for IDT entries Joe Damato
2008-10-25  3:15                 ` Joe Damato
2008-10-25  3:15                 ` Joe Damato
2008-10-25  3:15                 ` [PATCH 09/12] x86: Add static initiazlier for descriptors Joe Damato
2008-10-25  3:15                   ` Joe Damato
2008-10-25  3:15                   ` Joe Damato
2008-10-25  3:15                   ` [PATCH 10/12] x86: Use static initializers " Joe Damato
2008-10-25  3:15                     ` Joe Damato
2008-10-25  3:15                     ` Joe Damato
2008-10-25  3:15                     ` [PATCH 11/12] x86: Use macros for getting/setting descriptors Joe Damato
2008-10-25  3:15                       ` Joe Damato
2008-10-25  3:15                       ` Joe Damato
2008-10-25  3:15                       ` [PATCH 12/12] x86: Use struct fields instead of bitmasks Joe Damato
2008-10-25  3:15                         ` Joe Damato
2008-10-25  3:15                         ` Joe Damato
2008-10-29 12:56                         ` Jeremy Fitzhardinge [this message]
2008-10-29 12:56                           ` Jeremy Fitzhardinge
2008-10-29 12:56                           ` Jeremy Fitzhardinge
2008-10-29 12:58                   ` [PATCH 09/12] x86: Add static initiazlier for descriptors Jeremy Fitzhardinge
2008-10-29 12:58                     ` Jeremy Fitzhardinge
2008-10-29 12:58                     ` Jeremy Fitzhardinge
2008-10-29 12:54         ` [PATCH 04/12] x86: Add macros for gate_desc Jeremy Fitzhardinge
2008-10-29 12:54           ` Jeremy Fitzhardinge
2008-10-29 12:54           ` Jeremy Fitzhardinge
2008-10-29 12:52       ` [PATCH 03/12] x86: Cleanup usage of struct desc_struct Jeremy Fitzhardinge
2008-10-29 12:52         ` Jeremy Fitzhardinge
2008-10-29 12:52         ` Jeremy Fitzhardinge
2008-10-29 12:53     ` [PATCH 02/12] x86: Use new gate_struct for gate_desc Jeremy Fitzhardinge
2008-10-29 12:53       ` Jeremy Fitzhardinge
2008-10-29 12:53       ` Jeremy Fitzhardinge
2008-10-25  5:40 ` [PATCH 00/12] x86: Cleanup idt, gdt/ldt/tss structs Willy Tarreau
2008-10-25  5:40   ` Willy Tarreau
2008-10-25  5:40   ` Willy Tarreau
2008-10-27 10:57   ` Ingo Molnar
2008-10-27 10:57     ` Ingo Molnar
2008-10-27 10:57     ` Ingo Molnar
2008-10-25  9:39 ` walter harms
2008-10-25  9:39   ` walter harms
2008-10-25  9:39   ` walter harms
2008-10-27 10:55 ` Ingo Molnar
2008-10-27 10:55   ` Ingo Molnar
2008-10-27 14:34   ` H. Peter Anvin
2008-10-27 14:34     ` H. Peter Anvin
2008-10-27 14:34     ` H. Peter Anvin
2008-10-27 21:15   ` Joe Damato
2008-10-27 21:15     ` Joe Damato
2008-10-27 21:15     ` Joe Damato
2008-10-27 23:02     ` Jeremy Fitzhardinge
2008-10-27 23:02       ` Jeremy Fitzhardinge
2008-10-27 23:02       ` Jeremy Fitzhardinge

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=49085D60.7050807@goop.org \
    --to=jeremy@goop.org \
    --cc=ice799@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-newbie@vger.kernel.org \
    --cc=linux-x86_64@vger.kernel.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.