[U-Boot] [PATCH 03/17] x86: Remove GDR related magic numbers

Simon Glass sjg at chromium.org
Wed Jan 4 06:23:21 CET 2012


Hi Graeme,

On Sun, Jan 1, 2012 at 8:09 PM, Graeme Russ <graeme.russ at gmail.com> wrote:
>
> Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
> ---
>  arch/x86/cpu/start.S             |    3 ++-
>  arch/x86/include/asm/processor.h |    6 +++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
> index f87633b..7f9b6a7 100644
> --- a/arch/x86/cpu/start.S
> +++ b/arch/x86/cpu/start.S
> @@ -29,6 +29,7 @@
>  #include <config.h>
>  #include <version.h>
>  #include <asm/global_data.h>
> +#include <asm/processor.h>
>  #include <asm/processor-flags.h>
>  #include <generated/asm-offsets.h>
>
> @@ -58,7 +59,7 @@ _start:
>        /* This is the 32-bit cold-reset entry point */
>
>        /* Load the segement registes to match the gdt loaded in start16.S */
> -       movl    $0x18, %eax
> +       movl    $(GDT_ENTRY_32BIT_DS * 8), %eax
>        movw    %ax, %fs
>        movw    %ax, %ds
>        movw    %ax, %gs
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 1e5dccd..203c63a 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -24,9 +24,13 @@
>  #ifndef __ASM_PROCESSOR_H_
>  #define __ASM_PROCESSOR_H_ 1
>
> -#define GDT_ENTRY_32BIT_CS     2
> +#define GDT_ENTRY_NULL         0
> +#define GDT_ENTRY_UNUSED       (GDT_ENTRY_NULL + 1)
> +#define GDT_ENTRY_32BIT_CS     (GDT_ENTRY_UNUSED + 1)
>  #define GDT_ENTRY_32BIT_DS     (GDT_ENTRY_32BIT_CS + 1)
>  #define GDT_ENTRY_16BIT_CS     (GDT_ENTRY_32BIT_DS + 1)
>  #define GDT_ENTRY_16BIT_DS     (GDT_ENTRY_16BIT_CS + 1)

>
> +#define GDT_NUM_ENTRIES                (GDT_ENTRY_16BIT_DS + 1)
> +

Ick - any reason not to use an enum here?

Regards,
Simon

>  #endif
> --
> 1.7.5.2.317.g391b14
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list