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

Graeme Russ graeme.russ at gmail.com
Wed Jan 4 11:20:56 CET 2012


On 04/01/12 16:23, Simon Glass wrote:
> 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?

Done, but I still need a rouge #define for the assembler case above

Also, I added an X86_ prefix as per Linux headers and moved the size define
up from patch 7

Regards

Graeme



More information about the U-Boot mailing list