Skip to contentSkip to conversation

Installing kernel 2.4

DISCUSSION Anil kumar 16 participants 31 messages Nov 7, 2000 – Nov 9, 2000

lore
Share & tools
lore

Anil kumar

author
#0 lore raw

Hi ,
I installed Red Hat 7.0, I am able to find the
linux-2.2.16 in /usr/src

These are the following steps I did to install
kernel 2.4:

cd /usr/src
#rm -r linux

   # rm -rf linux-2.2.16
   #tar -xvf  linux-2.4.0-test9.tar

#cd /usr/src
#ls
linux
redhat
#mv linux linux-2.4.0-test9
#ln -s linux-2.4.0-test9 linux

#ls
linux->linux-2.4.0-test9
linux-2.4.0-test9
redhat

#cd /usr/src/linux
#make xconfig
I just save & exit without changing the
configuration.
#make dep
#make clean
#make bzImage
#make modules
#make modules_install

I find that System.map is mapped to 2.4.0, ie.. new System-2.4.0-test9.map is created

#cd /boot
#ls
#vmlinuz->vmlinuz-2.4.0-test9
#cd /usr/src/linux/arch/i386/boot
#cp bzImage /boot/vmlinuz

#vi /etc/lilo.conf
changed image from image = /boot/vmlinuz-2.2.16-22
to
image = /boot/vmlinuz-2.4.0-test9

#lilo
linux
dos

when I boot linux

The system hangs after messages:
loading linux......
uncompressing linux, booting linux kernel OK.

The System hangs here.

Please let me know where I am wrong

with regards,
Anil

__________________________________________________
Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place.
http://shopping.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 38 lines · Anil kumar

Hi ,
I installed Red Hat 7.0, I am able to find the
linux-2.2.16 in /usr/src

These are the following steps I did to install
kernel 2.4:

cd /usr/src
#rm -r linux

   # rm -rf linux-2.2.16
   #tar -xvf  linux-2.4.0-test9.tar

#cd /usr/src
#ls
linux
redhat
#mv linux linux-2.4.0-test9
#ln -s linux-2.4.0-test9 linux

#ls
linux->linux-2.4.0-test9
linux-2.4.0-test9
redhat

#cd /usr/src/linux
#make xconfig
I just save & exit without changing the
configuration.
#make dep
#make clean
#make bzImage
#make modules
#make modules_install

I find that System.map is mapped to 2.4.0, ie.. new System-2.4.0-test9.map is created

Quoted 8 lines

#cd /boot
#ls
#vmlinuz->vmlinuz-2.4.0-test9
#cd /usr/src/linux/arch/i386/boot
#cp bzImage /boot/vmlinuz

#vi /etc/lilo.conf
changed image from image = /boot/vmlinuz-2.2.16-22

How about making this line match the name of the copied kernel (you copied it as
/boot/vmlinuz so thi should be image = /boot/vmlinuz

Jeff

Quoted 20 lines

to
image = /boot/vmlinuz-2.4.0-test9

#lilo
linux
dos

when I boot linux

The system hangs after messages:
loading linux......
uncompressing linux, booting linux kernel OK.

The System hangs here.

Please let me know where I am wrong

with regards,
Anil

Quoted 8 lines

__________________________________________________
Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place.
http://shopping.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Anil kumar
Quoted 7 lines · Anil kumar

The system hangs after messages:
loading linux......
uncompressing linux, booting linux kernel OK.

The System hangs here.

Please let me know where I am wrong

Hi Anil,

The only serious mistake you did was using test9 kernel when test11-pre1 (or at least test10) was available. So, redo everything you have done with test11-pre1 and if you still cannot boot then send a message to this list with details like your CPUs, motherboard etc. etc.

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 7 lines · Tigran Aivazian
Quoted 6 lines · Anil kumar

The system hangs after messages:
loading linux......
uncompressing linux, booting linux kernel OK.

The System hangs here.

Quoted 8 lines
Quoted 1 line

Please let me know where I am wrong

Hi Anil,

The only serious mistake you did was using test9 kernel when test11-pre1 (or at least test10) was available. So, redo everything you have done with test11-pre1 and if you still cannot boot then send a message to this list with details like your CPUs, motherboard etc. etc.

Have you chosen the right cpu type in the configuration?

/Martin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw

So how come NetWare and NT can detect this at run time, and we have to use a .config option to specifiy it? Come on guys.....

Jeff

Quoted 19 lines · Martin Josefsson
Quoted 7 lines · Tigran Aivazian
Quoted 6 lines · Anil kumar

The system hangs after messages:
loading linux......
uncompressing linux, booting linux kernel OK.

The System hangs here.

Quoted 8 lines
Quoted 1 line

Please let me know where I am wrong

Hi Anil,

The only serious mistake you did was using test9 kernel when test11-pre1 (or at least test10) was available. So, redo everything you have done with test11-pre1 and if you still cannot boot then send a message to this list with details like your CPUs, motherboard etc. etc.

Quoted 8 lines

Have you chosen the right cpu type in the configuration?

/Martin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#5 lore raw
Quoted 2 lines · Jeff V. Merkey

So how come NetWare and NT can detect this at run time, and we have to use a .config option to specifiy it? Come on guys.....

Then run a kernel compiled for i386 and suffer the poorer code quality that comes with not using newer instructions and including the workarounds for ancient hardware.

-ben

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#6 lore raw

There are tests for all this in the feature flags for intel and non-intel CPUs like AMD -- including MTRR settings. All of this could be dynamic. Here's some code that does this, and it's similiar to NetWare. It detexts CPU type, feature flags, special instructions, etc. All of this on x86 could be dynamically detected.

:-)

;************************************************************************* ;
; check current processor type and state
; ;*************************************************************************

public DetectProcessorInformation
DetectProcessorInformation proc near

    mov   ax, cs
    mov   ds, ax
    mov   es, ax

pushf
call get_cpuid
call get_fpuid
call print
popf
ret

DetectProcessorInformation endp

get_cpuid proc near

check_8086:

pushf
pop ax
mov cx, ax
and ax, 0fffh
push ax
popf
pushf
pop ax
and ax, 0f000h
cmp ax, 0f000h ; flag bits 12-15 are always set on an 8086
mov CPU_TYPE, 0 ; 8086 detected
je end_get_cpuid

check_80286:
or cx, 0f000h
push cx
popf
pushf
pop ax
and ax, 0f000h ; flag bits 12-15 are always clear on 80286 in
real mode
mov CPU_TYPE, 2 ; 80286 processor
jz end_get_cpuid

check_80386:

    mov     bx, sp
    and     sp, not 3
    OPND32
    pushf
    OPND32
    pop ax
    OPND32
    mov      cx, ax
    OPND32   35h, 40000h
    OPND32
    push     ax
    OPND32
    popf
    OPND32
    pushf
    OPND32
    pop      ax
    OPND32
    xor      ax, cx       ; AC bit won't toggle, 80386 detected
    mov      sp, bx
    mov      CPU_TYPE, 3  ; 80386 detected
    jz       end_get_cpuid

    and      sp, not 3
    OPND32
    push     cx
    OPND32
    popf
    mov      sp, bx     ; restore stack

check_80486:

    mov      CPU_TYPE, 4     ; default to 80486

    OPND32
    mov      ax, cx
    OPND32   35h, 200000h      ; xor ID bit
    OPND32
    push ax
    OPND32
    popf
    OPND32
    pushf
    OPND32
    pop      ax
    OPND32
    xor      ax, cx           ; cant toggle ID bit
    je       end_get_cpuid

check_vendor:
mov ID_FLAG, 1
OPND32
xor ax, ax
CPUID
OPND32
mov word ptr VENDOR_ID, bx
OPND32
mov word ptr VENDOR_ID[+4], dx
OPND32
mov word ptr VENDOR_ID[+8], cx
mov si, offset VENDOR_ID
mov di, offset intel_id
mov cx, length intel_id

compare:

    repe    cmpsb
    or      cx, cx
    jnz     end_get_cpuid

intel_processor:
mov INTEL_PROC, 1

cpuid_data:
OPND32
cmp ax, 1

jl end_get_cpuid
OPND32
xor ax, ax
OPND32
inc ax
CPUID
mov byte ptr ds:STEPPING, al
and STEPPING, STEPPING_MASK

and al, MODEL_MASK
shr al, MODEL_SHIFT
mov byte ptr ds:CPU_MODEL, al

and ax, FAMILY_MASK
shr ax, FAMILY_SHIFT
mov byte ptr ds:CPU_TYPE, al

mov dword ptr FEATURE_FLAGS, edx

end_get_cpuid:
ret

get_cpuid endp

get_fpuid proc near

fninit
mov word ptr ds:FP_STATUS, 5a5ah

fnstsw word ptr ds:FP_STATUS
mov ax, word ptr ds:FP_STATUS
cmp al, 0

mov FPU_TYPE, 0
jne end_get_fpuid

check_control_word:

    fnstcw   word ptr ds:FP_STATUS
    mov      ax, word ptr ds:FP_STATUS
    and      ax, 103fh
    cmp      ax, 3fh
    mov      FPU_TYPE, 0
    jne      end_get_fpuid
    mov      FPU_TYPE, 1

check_infinity:
cmp CPU_TYPE, 3
jne end_get_fpuid
fld1
fldz
fdiv
fld st
fchs
fcompp
fstsw word ptr ds:FP_STATUS
mov ax, word ptr ds:FP_STATUS
mov FPU_TYPE, 2

sahf
jz end_get_fpuid
mov FPU_TYPE, 3
end_get_fpuid:
ret
get_fpuid endp

print proc near
cmp ID_FLAG, 1
je print_cpuid_data

if (VERBOSE)
mov dx, offset id_msg
call OutputMessage
endif

print_86:
cmp CPU_TYPE, 0
jne print_286

if (VERBOSE)
mov dx, offset c8086
call OutputMessage
endif
cmp FPU_TYPE, 0
je end_print

if (VERBOSE)
mov dx, offset fp_8087
call OutputMessage
endif
jmp end_print

print_286:
cmp CPU_TYPE, 2
jne print_386
if (VERBOSE)
mov dx, offset c286
call OutputMessage
endif
cmp FPU_TYPE, 0
je end_print
if (VERBOSE)
mov dx, offset fp_80287
call OutputMessage
endif
jmp end_print

print_386:
cmp CPU_TYPE, 3
jne print_486
if (VERBOSE)
mov dx, offset c386
call OutputMessage
endif

    cmp      FPU_TYPE, 0
    je       end_print
    cmp      FPU_TYPE, 2
    jne      print_387

if (VERBOSE)
mov dx, offset fp_80287
call OutputMessage
endif
jmp end_print

print_387:
if (VERBOSE)
mov dx, offset fp_80387
call OutputMessage
endif
jmp end_print

print_486:
cmp FPU_TYPE, 0
je print_Intel486sx
if (VERBOSE)
mov dx, offset c486
call OutputMessage
endif
jmp end_print

print_Intel486sx:
if (VERBOSE)
mov dx, offset c486nfp
call OutputMessage
endif
jmp end_print

print_cpuid_data:

cmp_vendor:
cmp INTEL_PROC, 1
jne not_GenuineIntel

cmp CPU_TYPE, 4
jne check_Pentium
if (VERBOSE)
mov dx, offset Intel486_msg
call OutputMessage
endif
jmp print_family

check_Pentium:
cmp CPU_TYPE, 5
jne check_PentiumPro
if (VERBOSE)
mov dx, offset Pentium_msg
call OutputMessage
endif
jmp print_family

check_PentiumPro:
cmp CPU_TYPE, 6
jne print_features
if (VERBOSE)
mov dx, offset PentiumPro_msg
call OutputMessage
endif

print_family:

IF VERBOSE
mov dx, offset family_msg
call OutputMessage
ENDIF

    mov      al, byte ptr ds:CPU_TYPE
    mov      byte ptr dataCR, al
    add      byte ptr dataCR, 30h

IF VERBOSE
mov dx, offset dataCR
call OutputMessage
ENDIF

print_model:

IF VERBOSE
mov dx, offset model_msg
call OutputMessage
ENDIF

    mov      al, byte ptr ds:CPU_MODEL
    mov      byte ptr dataCR, al
    add      byte ptr dataCR, 30h

IF VERBOSE
mov dx, offset dataCR
call OutputMessage
ENDIF

print_features:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, FPU_FLAG
    jz       check_mce

if (VERBOSE)
mov dx, offset fpu_msg
call OutputMessage
ENDIF

check_mce:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, MCE_FLAG
    jz       check_wc

IF VERBOSE
mov dx, offset mce_msg
call OutputMessage
ENDIF

check_CMPXCHG8B:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, CMPXCHG8B_FLAG
    jz       check_4MB_paging

IF VERBOSE
mov dx, offset cmp_msg
call OutputMessage
ENDIF

chekc_io_break:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 4
    jz       check_4MB_paging

IF VERBOSE
mov dx, offset io_break_msg
call OutputMessage
ENDIF

    ;	Enable Debugging Extensions bit in CR4
    CR4_TO_ECX
    or	ecx, 08h
    ECX_TO_CR4

if (VERBOSE)
mov dx, offset io_break_enable
call OutputMessage
endif

check_4MB_paging:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 08h
    jz       check_PageExtend

IF VERBOSE
mov dx, offset page_4MB_msg
call OutputMessage
ENDIF

; Enable page size extension bit in CR4
CR4_TO_ECX
or ecx, 10h
ECX_TO_CR4

if (VERBOSE)
mov dx, offset p4mb_enable
call OutputMessage
endif

check_PageExtend:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 40h
    jz       check_wc

;; DEBUG DEBUG DEBUG !!!

    ;	Enable page address extension bit in CR4

    ;; CR4_TO_ECX
    ;; or	     ecx, 20h
    ;; ECX_TO_CR4

check_wc:

    mov      dx, word ptr ds:FEATURE_FLAGS
    test     dx, 1000h ; MTRR support flag
    jz       end_print

if (VERBOSE)
mov dx, offset wc_enable
call OutputMessage
endif
jmp end_print

not_GenuineIntel:
if (VERBOSE)
mov dx, offset not_Intel
call OutputMessage
endif

end_print:
ret
print endp

Quoted 10 lines · [email protected] wrote:
Quoted 2 lines · Jeff V. Merkey

So how come NetWare and NT can detect this at run time, and we have to use a .config option to specifiy it? Come on guys.....

Then run a kernel compiled for i386 and suffer the poorer code quality that comes with not using newer instructions and including the workarounds for ancient hardware.

Quoted 6 lines

-ben

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw

Jeff, the problem is not detecting the CPU type at runtime, the problem is trying to re-compile the code to take advantage of that CPU at runtime.

depending on what CPU you have the kernel (and compiler) can use different commands/opmizations/etc, if you want to do this on boot you have two options.

1. re-compile the kernel

2. change all the CPU specific places from inline code to function calls into a table that get changed at boot to point at the correct calls.

doing #2 will cost you so much performance that you would be better off just compiling for a 386 and not going through the autodetect hassle in the first place.

David Lang

Quoted 476 lines · Jeff V. Merkey

Date: Tue, 07 Nov 2000 16:10:58 -0700
From: Jeff V. Merkey <[email protected]>
To: [email protected]
Cc: Martin Josefsson <[email protected]>,
Tigran Aivazian <[email protected]>, Anil kumar <[email protected]>, [email protected]
Subject: Re: Installing kernel 2.4

There are tests for all this in the feature flags for intel and non-intel CPUs like AMD -- including MTRR settings. All of this could be dynamic. Here's some code that does this, and it's similiar to NetWare. It detexts CPU type, feature flags, special instructions, etc. All of this on x86 could be dynamically detected.

:-)

;************************************************************************* ;
; check current processor type and state
; ;*************************************************************************

public DetectProcessorInformation
DetectProcessorInformation proc near

    mov   ax, cs
    mov   ds, ax
    mov   es, ax

pushf
call get_cpuid
call get_fpuid
call print
popf
ret

DetectProcessorInformation endp

get_cpuid proc near

check_8086:

pushf
pop ax
mov cx, ax
and ax, 0fffh
push ax
popf
pushf
pop ax
and ax, 0f000h
cmp ax, 0f000h ; flag bits 12-15 are always set on an 8086
mov CPU_TYPE, 0 ; 8086 detected
je end_get_cpuid

check_80286:
or cx, 0f000h
push cx
popf
pushf
pop ax
and ax, 0f000h ; flag bits 12-15 are always clear on 80286 in
real mode
mov CPU_TYPE, 2 ; 80286 processor
jz end_get_cpuid

check_80386:

    mov     bx, sp
    and     sp, not 3
    OPND32
    pushf
    OPND32
    pop ax
    OPND32
    mov      cx, ax
    OPND32   35h, 40000h
    OPND32
    push     ax
    OPND32
    popf
    OPND32
    pushf
    OPND32
    pop      ax
    OPND32
    xor      ax, cx       ; AC bit won't toggle, 80386 detected
    mov      sp, bx
    mov      CPU_TYPE, 3  ; 80386 detected
    jz       end_get_cpuid

    and      sp, not 3
    OPND32
    push     cx
    OPND32
    popf
    mov      sp, bx     ; restore stack

check_80486:

    mov      CPU_TYPE, 4     ; default to 80486

    OPND32
    mov      ax, cx
    OPND32   35h, 200000h      ; xor ID bit
    OPND32
    push ax
    OPND32
    popf
    OPND32
    pushf
    OPND32
    pop      ax
    OPND32
    xor      ax, cx           ; cant toggle ID bit
    je       end_get_cpuid

check_vendor:
mov ID_FLAG, 1
OPND32
xor ax, ax
CPUID
OPND32
mov word ptr VENDOR_ID, bx
OPND32
mov word ptr VENDOR_ID[+4], dx
OPND32
mov word ptr VENDOR_ID[+8], cx
mov si, offset VENDOR_ID
mov di, offset intel_id
mov cx, length intel_id

compare:

    repe    cmpsb
    or      cx, cx
    jnz     end_get_cpuid

intel_processor:
mov INTEL_PROC, 1

cpuid_data:
OPND32
cmp ax, 1

jl end_get_cpuid
OPND32
xor ax, ax
OPND32
inc ax
CPUID
mov byte ptr ds:STEPPING, al
and STEPPING, STEPPING_MASK

and al, MODEL_MASK
shr al, MODEL_SHIFT
mov byte ptr ds:CPU_MODEL, al

and ax, FAMILY_MASK
shr ax, FAMILY_SHIFT
mov byte ptr ds:CPU_TYPE, al

mov dword ptr FEATURE_FLAGS, edx

end_get_cpuid:
ret

get_cpuid endp

get_fpuid proc near

fninit
mov word ptr ds:FP_STATUS, 5a5ah

fnstsw word ptr ds:FP_STATUS
mov ax, word ptr ds:FP_STATUS
cmp al, 0

mov FPU_TYPE, 0
jne end_get_fpuid

check_control_word:

    fnstcw   word ptr ds:FP_STATUS
    mov      ax, word ptr ds:FP_STATUS
    and      ax, 103fh
    cmp      ax, 3fh
    mov      FPU_TYPE, 0
    jne      end_get_fpuid
    mov      FPU_TYPE, 1

check_infinity:
cmp CPU_TYPE, 3
jne end_get_fpuid
fld1
fldz
fdiv
fld st
fchs
fcompp
fstsw word ptr ds:FP_STATUS
mov ax, word ptr ds:FP_STATUS
mov FPU_TYPE, 2

sahf
jz end_get_fpuid
mov FPU_TYPE, 3
end_get_fpuid:
ret
get_fpuid endp

print proc near
cmp ID_FLAG, 1
je print_cpuid_data

if (VERBOSE)
mov dx, offset id_msg
call OutputMessage
endif

print_86:
cmp CPU_TYPE, 0
jne print_286

if (VERBOSE)
mov dx, offset c8086
call OutputMessage
endif
cmp FPU_TYPE, 0
je end_print

if (VERBOSE)
mov dx, offset fp_8087
call OutputMessage
endif
jmp end_print

print_286:
cmp CPU_TYPE, 2
jne print_386
if (VERBOSE)
mov dx, offset c286
call OutputMessage
endif
cmp FPU_TYPE, 0
je end_print
if (VERBOSE)
mov dx, offset fp_80287
call OutputMessage
endif
jmp end_print

print_386:
cmp CPU_TYPE, 3
jne print_486
if (VERBOSE)
mov dx, offset c386
call OutputMessage
endif

    cmp      FPU_TYPE, 0
    je       end_print
    cmp      FPU_TYPE, 2
    jne      print_387

if (VERBOSE)
mov dx, offset fp_80287
call OutputMessage
endif
jmp end_print

print_387:
if (VERBOSE)
mov dx, offset fp_80387
call OutputMessage
endif
jmp end_print

print_486:
cmp FPU_TYPE, 0
je print_Intel486sx
if (VERBOSE)
mov dx, offset c486
call OutputMessage
endif
jmp end_print

print_Intel486sx:
if (VERBOSE)
mov dx, offset c486nfp
call OutputMessage
endif
jmp end_print

print_cpuid_data:

cmp_vendor:
cmp INTEL_PROC, 1
jne not_GenuineIntel

cmp CPU_TYPE, 4
jne check_Pentium
if (VERBOSE)
mov dx, offset Intel486_msg
call OutputMessage
endif
jmp print_family

check_Pentium:
cmp CPU_TYPE, 5
jne check_PentiumPro
if (VERBOSE)
mov dx, offset Pentium_msg
call OutputMessage
endif
jmp print_family

check_PentiumPro:
cmp CPU_TYPE, 6
jne print_features
if (VERBOSE)
mov dx, offset PentiumPro_msg
call OutputMessage
endif

print_family:

IF VERBOSE
mov dx, offset family_msg
call OutputMessage
ENDIF

    mov      al, byte ptr ds:CPU_TYPE
    mov      byte ptr dataCR, al
    add      byte ptr dataCR, 30h

IF VERBOSE
mov dx, offset dataCR
call OutputMessage
ENDIF

print_model:

IF VERBOSE
mov dx, offset model_msg
call OutputMessage
ENDIF

    mov      al, byte ptr ds:CPU_MODEL
    mov      byte ptr dataCR, al
    add      byte ptr dataCR, 30h

IF VERBOSE
mov dx, offset dataCR
call OutputMessage
ENDIF

print_features:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, FPU_FLAG
    jz       check_mce

if (VERBOSE)
mov dx, offset fpu_msg
call OutputMessage
ENDIF

check_mce:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, MCE_FLAG
    jz       check_wc

IF VERBOSE
mov dx, offset mce_msg
call OutputMessage
ENDIF

check_CMPXCHG8B:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, CMPXCHG8B_FLAG
    jz       check_4MB_paging

IF VERBOSE
mov dx, offset cmp_msg
call OutputMessage
ENDIF

chekc_io_break:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 4
    jz       check_4MB_paging

IF VERBOSE
mov dx, offset io_break_msg
call OutputMessage
ENDIF

    ;	Enable Debugging Extensions bit in CR4
    CR4_TO_ECX
    or	ecx, 08h
    ECX_TO_CR4

if (VERBOSE)
mov dx, offset io_break_enable
call OutputMessage
endif

check_4MB_paging:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 08h
    jz       check_PageExtend

IF VERBOSE
mov dx, offset page_4MB_msg
call OutputMessage
ENDIF

; Enable page size extension bit in CR4
CR4_TO_ECX
or ecx, 10h
ECX_TO_CR4

if (VERBOSE)
mov dx, offset p4mb_enable
call OutputMessage
endif

check_PageExtend:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 40h
    jz       check_wc

;; DEBUG DEBUG DEBUG !!!

    ;	Enable page address extension bit in CR4

    ;; CR4_TO_ECX
    ;; or	     ecx, 20h
    ;; ECX_TO_CR4

check_wc:

    mov      dx, word ptr ds:FEATURE_FLAGS
    test     dx, 1000h ; MTRR support flag
    jz       end_print

if (VERBOSE)
mov dx, offset wc_enable
call OutputMessage
endif
jmp end_print

not_GenuineIntel:
if (VERBOSE)
mov dx, offset not_Intel
call OutputMessage
endif

end_print:
ret
print endp

Quoted 12 lines · [email protected] wrote:
Quoted 2 lines · Jeff V. Merkey

So how come NetWare and NT can detect this at run time, and we have to use a .config option to specifiy it? Come on guys.....

Then run a kernel compiled for i386 and suffer the poorer code quality that comes with not using newer instructions and including the workarounds for ancient hardware.

-ben

Quoted 9 lines
Quoted 4 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#8 lore raw
Quoted 4 lines · David Lang

Jeff, the problem is not detecting the CPU type at runtime, the problem is trying to re-compile the code to take advantage of that CPU at runtime.

Quoted 8 lines

depending on what CPU you have the kernel (and compiler) can use different commands/opmizations/etc, if you want to do this on boot you have two options.

1. re-compile the kernel

2. change all the CPU specific places from inline code to function calls into a table that get changed at boot to point at the correct calls.

The macros would be a problem. Some of the options, like MTRR, should be auto-detected.

Jeff

Quoted 494 lines

doing #2 will cost you so much performance that you would be better off just compiling for a 386 and not going through the autodetect hassle in the first place.

David Lang

Quoted 485 lines · Jeff V. Merkey

Date: Tue, 07 Nov 2000 16:10:58 -0700
From: Jeff V. Merkey <[email protected]>
To: [email protected]
Cc: Martin Josefsson <[email protected]>,
Tigran Aivazian <[email protected]>, Anil kumar <[email protected]>, [email protected]
Subject: Re: Installing kernel 2.4

There are tests for all this in the feature flags for intel and non-intel CPUs like AMD -- including MTRR settings. All of this could be dynamic. Here's some code that does this, and it's similiar to NetWare. It detexts CPU type, feature flags, special instructions, etc. All of this on x86 could be dynamically detected.

:-)

;************************************************************************* ;
; check current processor type and state
; ;*************************************************************************

public DetectProcessorInformation
DetectProcessorInformation proc near

    mov   ax, cs
    mov   ds, ax
    mov   es, ax

pushf
call get_cpuid
call get_fpuid
call print
popf
ret

DetectProcessorInformation endp

get_cpuid proc near

check_8086:

pushf
pop ax
mov cx, ax
and ax, 0fffh
push ax
popf
pushf
pop ax
and ax, 0f000h
cmp ax, 0f000h ; flag bits 12-15 are always set on an 8086
mov CPU_TYPE, 0 ; 8086 detected
je end_get_cpuid

check_80286:
or cx, 0f000h
push cx
popf
pushf
pop ax
and ax, 0f000h ; flag bits 12-15 are always clear on 80286 in
real mode
mov CPU_TYPE, 2 ; 80286 processor
jz end_get_cpuid

check_80386:

    mov     bx, sp
    and     sp, not 3
    OPND32
    pushf
    OPND32
    pop ax
    OPND32
    mov      cx, ax
    OPND32   35h, 40000h
    OPND32
    push     ax
    OPND32
    popf
    OPND32
    pushf
    OPND32
    pop      ax
    OPND32
    xor      ax, cx       ; AC bit won't toggle, 80386 detected
    mov      sp, bx
    mov      CPU_TYPE, 3  ; 80386 detected
    jz       end_get_cpuid

    and      sp, not 3
    OPND32
    push     cx
    OPND32
    popf
    mov      sp, bx     ; restore stack

check_80486:

    mov      CPU_TYPE, 4     ; default to 80486

    OPND32
    mov      ax, cx
    OPND32   35h, 200000h      ; xor ID bit
    OPND32
    push ax
    OPND32
    popf
    OPND32
    pushf
    OPND32
    pop      ax
    OPND32
    xor      ax, cx           ; cant toggle ID bit
    je       end_get_cpuid

check_vendor:
mov ID_FLAG, 1
OPND32
xor ax, ax
CPUID
OPND32
mov word ptr VENDOR_ID, bx
OPND32
mov word ptr VENDOR_ID[+4], dx
OPND32
mov word ptr VENDOR_ID[+8], cx
mov si, offset VENDOR_ID
mov di, offset intel_id
mov cx, length intel_id

compare:

    repe    cmpsb
    or      cx, cx
    jnz     end_get_cpuid

intel_processor:
mov INTEL_PROC, 1

cpuid_data:
OPND32
cmp ax, 1

jl end_get_cpuid
OPND32
xor ax, ax
OPND32
inc ax
CPUID
mov byte ptr ds:STEPPING, al
and STEPPING, STEPPING_MASK

and al, MODEL_MASK
shr al, MODEL_SHIFT
mov byte ptr ds:CPU_MODEL, al

and ax, FAMILY_MASK
shr ax, FAMILY_SHIFT
mov byte ptr ds:CPU_TYPE, al

mov dword ptr FEATURE_FLAGS, edx

end_get_cpuid:
ret

get_cpuid endp

get_fpuid proc near

fninit
mov word ptr ds:FP_STATUS, 5a5ah

fnstsw word ptr ds:FP_STATUS
mov ax, word ptr ds:FP_STATUS
cmp al, 0

mov FPU_TYPE, 0
jne end_get_fpuid

check_control_word:

    fnstcw   word ptr ds:FP_STATUS
    mov      ax, word ptr ds:FP_STATUS
    and      ax, 103fh
    cmp      ax, 3fh
    mov      FPU_TYPE, 0
    jne      end_get_fpuid
    mov      FPU_TYPE, 1

check_infinity:
cmp CPU_TYPE, 3
jne end_get_fpuid
fld1
fldz
fdiv
fld st
fchs
fcompp
fstsw word ptr ds:FP_STATUS
mov ax, word ptr ds:FP_STATUS
mov FPU_TYPE, 2

sahf
jz end_get_fpuid
mov FPU_TYPE, 3
end_get_fpuid:
ret
get_fpuid endp

print proc near
cmp ID_FLAG, 1
je print_cpuid_data

if (VERBOSE)
mov dx, offset id_msg
call OutputMessage
endif

print_86:
cmp CPU_TYPE, 0
jne print_286

if (VERBOSE)
mov dx, offset c8086
call OutputMessage
endif
cmp FPU_TYPE, 0
je end_print

if (VERBOSE)
mov dx, offset fp_8087
call OutputMessage
endif
jmp end_print

print_286:
cmp CPU_TYPE, 2
jne print_386
if (VERBOSE)
mov dx, offset c286
call OutputMessage
endif
cmp FPU_TYPE, 0
je end_print
if (VERBOSE)
mov dx, offset fp_80287
call OutputMessage
endif
jmp end_print

print_386:
cmp CPU_TYPE, 3
jne print_486
if (VERBOSE)
mov dx, offset c386
call OutputMessage
endif

    cmp      FPU_TYPE, 0
    je       end_print
    cmp      FPU_TYPE, 2
    jne      print_387

if (VERBOSE)
mov dx, offset fp_80287
call OutputMessage
endif
jmp end_print

print_387:
if (VERBOSE)
mov dx, offset fp_80387
call OutputMessage
endif
jmp end_print

print_486:
cmp FPU_TYPE, 0
je print_Intel486sx
if (VERBOSE)
mov dx, offset c486
call OutputMessage
endif
jmp end_print

print_Intel486sx:
if (VERBOSE)
mov dx, offset c486nfp
call OutputMessage
endif
jmp end_print

print_cpuid_data:

cmp_vendor:
cmp INTEL_PROC, 1
jne not_GenuineIntel

cmp CPU_TYPE, 4
jne check_Pentium
if (VERBOSE)
mov dx, offset Intel486_msg
call OutputMessage
endif
jmp print_family

check_Pentium:
cmp CPU_TYPE, 5
jne check_PentiumPro
if (VERBOSE)
mov dx, offset Pentium_msg
call OutputMessage
endif
jmp print_family

check_PentiumPro:
cmp CPU_TYPE, 6
jne print_features
if (VERBOSE)
mov dx, offset PentiumPro_msg
call OutputMessage
endif

print_family:

IF VERBOSE
mov dx, offset family_msg
call OutputMessage
ENDIF

    mov      al, byte ptr ds:CPU_TYPE
    mov      byte ptr dataCR, al
    add      byte ptr dataCR, 30h

IF VERBOSE
mov dx, offset dataCR
call OutputMessage
ENDIF

print_model:

IF VERBOSE
mov dx, offset model_msg
call OutputMessage
ENDIF

    mov      al, byte ptr ds:CPU_MODEL
    mov      byte ptr dataCR, al
    add      byte ptr dataCR, 30h

IF VERBOSE
mov dx, offset dataCR
call OutputMessage
ENDIF

print_features:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, FPU_FLAG
    jz       check_mce

if (VERBOSE)
mov dx, offset fpu_msg
call OutputMessage
ENDIF

check_mce:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, MCE_FLAG
    jz       check_wc

IF VERBOSE
mov dx, offset mce_msg
call OutputMessage
ENDIF

check_CMPXCHG8B:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, CMPXCHG8B_FLAG
    jz       check_4MB_paging

IF VERBOSE
mov dx, offset cmp_msg
call OutputMessage
ENDIF

chekc_io_break:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 4
    jz       check_4MB_paging

IF VERBOSE
mov dx, offset io_break_msg
call OutputMessage
ENDIF

; Enable Debugging Extensions bit in CR4
CR4_TO_ECX
or ecx, 08h
ECX_TO_CR4

if (VERBOSE)
mov dx, offset io_break_enable
call OutputMessage
endif

check_4MB_paging:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 08h
    jz       check_PageExtend

IF VERBOSE
mov dx, offset page_4MB_msg
call OutputMessage
ENDIF

; Enable page size extension bit in CR4
CR4_TO_ECX
or ecx, 10h
ECX_TO_CR4

if (VERBOSE)
mov dx, offset p4mb_enable
call OutputMessage
endif

check_PageExtend:

    mov      ax, word ptr ds:FEATURE_FLAGS
    test     ax, 40h
    jz       check_wc

;; DEBUG DEBUG DEBUG !!!
; Enable page address extension bit in CR4

;; CR4_TO_ECX
;; or ecx, 20h
;; ECX_TO_CR4

check_wc:

    mov      dx, word ptr ds:FEATURE_FLAGS
    test     dx, 1000h ; MTRR support flag
    jz       end_print

if (VERBOSE)
mov dx, offset wc_enable
call OutputMessage
endif
jmp end_print

not_GenuineIntel:
if (VERBOSE)
mov dx, offset not_Intel
call OutputMessage
endif

end_print:
ret
print endp

Quoted 10 lines · [email protected] wrote:
Quoted 2 lines · Jeff V. Merkey

So how come NetWare and NT can detect this at run time, and we have to use a .config option to specifiy it? Come on guys.....

Then run a kernel compiled for i386 and suffer the poorer code quality that comes with not using newer instructions and including the workarounds for ancient hardware.

Quoted 6 lines

-ben

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#9 lore raw
In reply to David Lang
Quoted 3 lines · David Lang

depending on what CPU you have the kernel (and compiler) can use different commands/opmizations/etc, if you want to do this on boot you have two options.

Wouldn't it be possible to compile the parts of the kernel needed to uncompress and to detect the cpu with lower optimizations and then abort with an error message?

"Error: Kernel needs a PIII" sounds much better than just stoping dead.

c'ya
sven

Signature · 7 lines
The Internet treats censorship as a routing problem, and routes around it.
(John Gilmore on http://www.cygnus.com/~gnu/)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#10 lore raw
Quoted 7 lines · Sven Koch
Quoted 3 lines · David Lang

depending on what CPU you have the kernel (and compiler) can use different commands/opmizations/etc, if you want to do this on boot you have two options.

Quoted 5 lines

Wouldn't it be possible to compile the parts of the kernel needed to uncompress and to detect the cpu with lower optimizations and then abort with an error message?

"Error: Kernel needs a PIII" sounds much better than just stoping dead.

I agree... maybe we can solve this simply by giving the CPU detection
module the -march=i386 flag hardcoded, or editing the bootstrap, or something like that...

Jeff

Signature · 8 lines
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#11 lore raw

It seems to me that kernel/cpu matching can be broken into two relatively simple parts.

1 - Put a cpu "signature" in the kernel image indicating cpu requirements; and 2 - Have the bootloader (lilo) detect cpu type and match it against the cpu "signature".

The bootloader would then load the kernel, or could give an informative diagnostic.

David

Quoted 13 lines · Jeff Garzik
Quoted 4 lines · Sven Koch
Quoted 1 line · David Lang

depending on what CPU you have the kernel (and compiler) can use

different

Quoted 7 lines
Quoted 2 lines

commands/opmizations/etc, if you want to do this on boot you have two options.

Wouldn't it be possible to compile the parts of the kernel needed to uncompress and to detect the cpu with lower optimizations and then abort with an error message?

Quoted 7 lines
Quoted 1 line

"Error: Kernel needs a PIII" sounds much better than just stoping dead.

I agree... maybe we can solve this simply by giving the CPU detection
module the -march=i386 flag hardcoded, or editing the bootstrap, or something like that...

Jeff

--------------------------------------------------------

David Relson                   Osage Software Systems, Inc.
[email protected]       514 W. Keech Ave.
www.osagesoftware.com          Ann Arbor, MI 48103
voice: 734.821.8800            fax: 734.821.8800

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#12 lore raw
In reply to Sven Koch
Quoted 11 lines · David Relson

It seems to me that kernel/cpu matching can be broken into two relatively simple parts.

1 - Put a cpu "signature" in the kernel image indicating cpu requirements; and 2 - Have the bootloader (lilo) detect cpu type and match it against the cpu "signature".

The bootloader would then load the kernel, or could give an informative diagnostic.

The PE model uses flags to identify CPU type and capbilities and create a table in the RVA section header that describes all the segments, i.e.

#define IMAGE_SIZEOF_FILE_HEADER 20

#define IMAGE_FILE_MACHINE_UNKNOWN 0
#define IMAGE_FILE_MACHINE_I860 0x14d
#define IMAGE_FILE_MACHINE_I386 0x14c
#define IMAGE_FILE_MACHINE_R3000 0x162
#define IMAGE_FILE_MACHINE_R4000 0x166
#define IMAGE_FILE_MACHINE_R10000 0x168
#define IMAGE_FILE_MACHINE_ALPHA 0x184
#define IMAGE_FILE_MACHINE_POWERPC 0x1F0

typedef struct _IMAGE_DATA_DIRECTORY

{
	DWORD	VirtualAddress;
	DWORD	Size;
} IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;

#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16

/* Optional coff header - used by NT to provide additional information. */
typedef struct _IMAGE_OPTIONAL_HEADER

{
	/*
	 * Standard fields.
	 */

	WORD	Magic;
	BYTE	MajorLinkerVersion;
	BYTE	MinorLinkerVersion;
	DWORD	SizeOfCode;
	DWORD	SizeOfInitializedData;
	DWORD	SizeOfUninitializedData;
	DWORD	AddressOfEntryPoint;
	DWORD	BaseOfCode;
	DWORD	BaseOfData;

	/*
	 * NT additional fields.
	 */

	DWORD	ImageBase;
	DWORD	SectionAlignment;
	DWORD	FileAlignment;
	WORD	MajorOperatingSystemVersion;
	WORD	MinorOperatingSystemVersion;
	WORD	MajorImageVersion;
	WORD	MinorImageVersion;
	WORD	MajorSubsystemVersion;
	WORD	MinorSubsystemVersion;
	DWORD	Reserved1;
	DWORD	SizeOfImage;
	DWORD	SizeOfHeaders;
	DWORD	CheckSum;
	WORD	Subsystem;
	WORD	DllCharacteristics;
	DWORD	SizeOfStackReserve;
	DWORD	SizeOfStackCommit;
	DWORD	SizeOfHeapReserve;
	DWORD	SizeOfHeapCommit;
	DWORD	LoaderFlags;
	DWORD	NumberOfRvaAndSizes;
	IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
} IMAGE_OPTIONAL_HEADER,*PIMAGE_OPTIONAL_HEADER;

/* These are indexes into the DataDirectory array */
#define IMAGE_FILE_EXPORT_DIRECTORY 0
#define IMAGE_FILE_IMPORT_DIRECTORY 1
#define IMAGE_FILE_RESOURCE_DIRECTORY 2
#define IMAGE_FILE_EXCEPTION_DIRECTORY 3
#define IMAGE_FILE_SECURITY_DIRECTORY 4
#define IMAGE_FILE_BASE_RELOCATION_TABLE 5
#define IMAGE_FILE_DEBUG_DIRECTORY 6
#define IMAGE_FILE_DESCRIPTION_STRING 7
#define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
#define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
#define IMAGE_FILE_CALLBACK_DIRECTORY 10

/* Directory Entries, indices into the DataDirectory array */

#define IMAGE_DIRECTORY_ENTRY_EXPORT 0
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
#define IMAGE_DIRECTORY_ENTRY_TLS 9
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
#define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */

/* Subsystem Values */

#define IMAGE_SUBSYSTEM_UNKNOWN 0
#define IMAGE_SUBSYSTEM_NATIVE 1
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
#define IMAGE_SUBSYSTEM_OS2_CUI 5
#define IMAGE_SUBSYSTEM_POSIX_CUI 7

typedef struct _IMAGE_NT_HEADERS {
	DWORD			Signature;
	IMAGE_FILE_HEADER	FileHeader;
	IMAGE_OPTIONAL_HEADER	OptionalHeader;
} IMAGE_NT_HEADERS,*PIMAGE_NT_HEADERS;

/* Section header format */

#define IMAGE_SIZEOF_SHORT_NAME 8

typedef struct _IMAGE_SECTION_HEADER {
	BYTE	Name[IMAGE_SIZEOF_SHORT_NAME];
	union {
		DWORD	PhysicalAddress;
		DWORD	VirtualSize;
	} Misc;
	DWORD	VirtualAddress;
	DWORD	SizeOfRawData;
	DWORD	PointerToRawData;
	DWORD	PointerToRelocations;
	DWORD	PointerToLinenumbers;
	WORD	NumberOfRelocations;
	WORD	NumberOfLinenumbers;
	DWORD	Characteristics;
} IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;

#define IMAGE_SIZEOF_SECTION_HEADER 40

/* These defines are for the Characteristics bitfield. */
/* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
/* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
/* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
/* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
/* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
/* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */

#define IMAGE_SCN_CNT_CODE 0x00000020
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080

#define IMAGE_SCN_LNK_OTHER 0x00000100
#define IMAGE_SCN_LNK_INFO 0x00000200
#define IMAGE_SCN_LNK_OVERLAY 0x00000400
#define IMAGE_SCN_LNK_REMOVE 0x00000800
#define IMAGE_SCN_LNK_COMDAT 0x00001000

/* 0x00002000 - Reserved */
/* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
#define IMAGE_SCN_MEM_FARDATA 0x00008000

/* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
#define IMAGE_SCN_MEM_16BIT 0x00020000
#define IMAGE_SCN_MEM_LOCKED 0x00040000
#define IMAGE_SCN_MEM_PRELOAD 0x00080000

#define IMAGE_SCN_ALIGN_1BYTES 0x00100000
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
/* 0x00800000 - Unused */

#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000

#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
#define IMAGE_SCN_MEM_SHARED 0x10000000
#define IMAGE_SCN_MEM_EXECUTE 0x20000000
#define IMAGE_SCN_MEM_READ 0x40000000
#define IMAGE_SCN_MEM_WRITE 0x80000000

/* Import name entry */

typedef struct _IMAGE_IMPORT_BY_NAME {
	WORD	Hint;
	BYTE	Name[1];
} IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;

/* Import thunk */

typedef struct _IMAGE_THUNK_DATA {
    union
    {
       LPBYTE	ForwarderString;
       LPDWORD	Function;
       DWORD	Ordinal;
       PIMAGE_IMPORT_BY_NAME	AddressOfData;
    } u1;
} IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;

/* Import module directory */

typedef struct _IMAGE_IMPORT_DESCRIPTOR {
	union
	{
	   DWORD Characteristics; /* 0 for terminating null import descriptor 

*/
PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT
*/
} u;
DWORD TimeDateStamp; /* 0 if not bound,
* -1 if bound, and real date\time stamp
* in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
* (new BIND)
* otherwise date/time stamp of DLL bound to
* (Old BIND)
*/
DWORD ForwarderChain; /* -1 if no forwarders */
DWORD Name;
/* RVA to IAT (if bound this IAT has actual addresses) */ PIMAGE_THUNK_DATA FirstThunk;
} IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;

#define IMAGE_ORDINAL_FLAG 0x80000000
#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG)
!= 0)
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)

/* Export module directory */

typedef struct _IMAGE_EXPORT_DIRECTORY {
	DWORD	Characteristics;
	DWORD	TimeDateStamp;
	WORD	MajorVersion;
	WORD	MinorVersion;
	DWORD	Name;
	DWORD	Base;
	DWORD	NumberOfFunctions;
	DWORD	NumberOfNames;
	LPDWORD	*AddressOfFunctions;
	LPDWORD	*AddressOfNames;
	LPWORD	*AddressOfNameOrdinals;

/* u_char ModuleName[1]; */
} IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;

/*
* Resource directory stuff
*/

typedef struct _IMAGE_RESOURCE_DIRECTORY {
	DWORD	Characteristics;
	DWORD	TimeDateStamp;
	WORD	MajorVersion;
	WORD	MinorVersion;
	WORD	NumberOfNamedEntries;
	WORD	NumberOfIdEntries;
	/*  IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
} IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;

#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000

typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
	union {
		struct {
//		   DWORD NameOffset:31;
//		   DWORD NameIsString:1;
// fix jmerkey!
		   DWORD NameOffset;
		} s;
		DWORD   Name;
		WORD    Id;
	} u1;
	union {
		DWORD   OffsetToData;
		struct {
//		   DWORD   OffsetToDirectory:31;
//		   DWORD   DataIsDirectory:1;
//  fix jmerkey!
//
		   DWORD  OffsetToDirectory;
		} s;
	} u2;
} IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;

typedef struct tagImportDirectory {
DWORD RVAFunctionNameList;
DWORD UseLess1;
DWORD UseLess2;
DWORD RVAModuleName;
DWORD RVAFunctionAddressList;
} IMAGE_IMPORT_MODULE_DIRECTORY, *PIMAGE_IMPORT_MODULE_DIRECTORY;

typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
	WORD	Length;
	CHAR	NameString[1];
} IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
	WORD	Length;
	WCHAR	NameString[1];
} IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
	DWORD	OffsetToData;
	DWORD	Size;
	DWORD	CodePage;
	DWORD	Reserved;
} IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;

typedef struct _IMAGE_BASE_RELOCATION

{
	DWORD	VirtualAddress;
	DWORD	SizeOfBlock;
	WORD	TypeOffset[1];
} IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
	DWORD	Characteristics;
	DWORD	TimeDateStamp;
	WORD	MajorVersion;
	WORD	MinorVersion;
	DWORD	GlobalFlagsClear;
	DWORD	GlobalFlagsSet;
	DWORD	CriticalSectionDefaultTimeout;
	DWORD	DeCommitFreeBlockThreshold;
	DWORD	DeCommitTotalFreeThreshold;
	LPVOID	LockPrefixTable;
	DWORD	MaximumAllocationSize;
	DWORD	VirtualMemoryThreshold;
	DWORD	ProcessHeapFlags;
	DWORD	Reserved[4];
} IMAGE_LOAD_CONFIG_DIRECTORY,*PIMAGE_LOAD_CONFIG_DIRECTORY;

typedef VOID (*PIMAGE_TLS_CALLBACK)(
LPVOID DllHandle,DWORD Reason,LPVOID Reserved
);

typedef struct _IMAGE_TLS_DIRECTORY {
	DWORD	StartAddressOfRawData;
	DWORD	EndAddressOfRawData;
	LPDWORD	AddressOfIndex;
	PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
	DWORD	SizeOfZeroFill;
	DWORD	Characteristics;
} IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;

/*
* The IMAGE_DEBUG_DIRECTORY data directory points to an array of
* these structures.
*/

typedef struct _IMAGE_DEBUG_DIRECTORY {
	DWORD	Characteristics;
	DWORD	TimeDateStamp;
	WORD	MajorVersion;
	WORD	MinorVersion;
	DWORD	Type;
	DWORD	SizeOfData;
	DWORD	AddressOfRawData;
	DWORD	PointerToRawData;
} IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY;

/*
* The type field above can take these (plus a few other
* irrelevant) values.
*/
#define IMAGE_DEBUG_TYPE_UNKNOWN 0
#define IMAGE_DEBUG_TYPE_COFF 1
#define IMAGE_DEBUG_TYPE_CODEVIEW 2
#define IMAGE_DEBUG_TYPE_FPO 3
#define IMAGE_DEBUG_TYPE_MISC 4
#define IMAGE_DEBUG_TYPE_EXCEPTION 5
#define IMAGE_DEBUG_TYPE_FIXUP 6
#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8

#define IMAGE_REL_BASED_ABSOLUTE 0
#define IMAGE_REL_BASED_HIGH 1
#define IMAGE_REL_BASED_LOW 2
#define IMAGE_REL_BASED_HIGHLOW 3
#define IMAGE_REL_BASED_HIGHADJ 4
#define IMAGE_REL_BASED_MIPS_JMPADDR 5

/*
* This is the structure that appears at the very start of a .DBG file. */

typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
	WORD	Signature;
	WORD	Flags;
	WORD	Machine;
	WORD	Characteristics;
	DWORD	TimeDateStamp;
	DWORD	CheckSum;
	DWORD	ImageBase;
	DWORD	SizeOfImage;
	DWORD	NumberOfSections;
	DWORD	ExportedNamesSize;
	DWORD	DebugDirectorySize;
	DWORD	Reserved[3 ];
} IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;

#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944

#define IMAGE_LIBRARY_PROCESS_INIT 1
#define IMAGE_LIBRARY_PROCESS_TERM 8
#define IMAGE_LIBRARY_THREAD_INIT 4
#define IMAGE_LIBRARY_THREAD_TERM 2

#define IMAGE_LOADER_FLAGS_BREAK_ON_LOAD 1
#define IMAGE_LOADER_FLAGS_DEBUG_ON_LOAD 2

#define IMAGE_SYM_UNDEFINED (short) 0
#define IMAGE_SYM_ABSOLUTE (short) -1
#define IMAGE_SYM_DEBUG (short) -2

//
// Type (derived) values.
//

#define IMAGE_SYM_DTYPE_NULL                0       // no derived type.
#define IMAGE_SYM_DTYPE_POINTER             1       // pointer.
#define IMAGE_SYM_DTYPE_FUNCTION            2       // function.
#define IMAGE_SYM_DTYPE_ARRAY               3       // array.

//
// Storage classes.
//

#define IMAGE_SYM_CLASS_END_OF_FUNCTION     (BYTE )-1
#define IMAGE_SYM_CLASS_NULL                0x0000
#define IMAGE_SYM_CLASS_AUTOMATIC           0x0001
#define IMAGE_SYM_CLASS_EXTERNAL            0x0002
#define IMAGE_SYM_CLASS_STATIC              0x0003
#define IMAGE_SYM_CLASS_REGISTER            0x0004
#define IMAGE_SYM_CLASS_EXTERNAL_DEF        0x0005
#define IMAGE_SYM_CLASS_LABEL               0x0006
#define IMAGE_SYM_CLASS_UNDEFINED_LABEL     0x0007
#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT    0x0008
#define IMAGE_SYM_CLASS_ARGUMENT            0x0009
#define IMAGE_SYM_CLASS_STRUCT_TAG          0x000A
#define IMAGE_SYM_CLASS_MEMBER_OF_UNION     0x000B
#define IMAGE_SYM_CLASS_UNION_TAG           0x000C
#define IMAGE_SYM_CLASS_TYPE_DEFINITION     0x000D
#define IMAGE_SYM_CLASS_UNDEFINED_STATIC    0x000E
#define IMAGE_SYM_CLASS_ENUM_TAG            0x000F
#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM      0x0010
#define IMAGE_SYM_CLASS_REGISTER_PARAM      0x0011
#define IMAGE_SYM_CLASS_BIT_FIELD           0x0012

#define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044 //

#define IMAGE_SYM_CLASS_BLOCK               0x0064
#define IMAGE_SYM_CLASS_FUNCTION            0x0065
#define IMAGE_SYM_CLASS_END_OF_STRUCT       0x0066
#define IMAGE_SYM_CLASS_FILE                0x0067

// new
#define IMAGE_SYM_CLASS_SECTION 0x0068
#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069

As you can see, theirs is quite complete and well thought out. Thanks to Mr. Bill Gates for the wonderful source code license and the freedom to use residulas in MANOS for whatever we please.

Extend ELF to use the ELF-LPE format (a new term for what we will invent
- the ELF Linux Portable Executable Format). This would also allow us to combine Sparc, Alpha, x86 segments into a single executable so the customer won't have to recompile the kernel every time they want to change something. SMP, non-SMP coud be handled the same as well.

Jeff

Quoted 30 lines

David

Quoted 13 lines · Jeff Garzik
Quoted 4 lines · Sven Koch
Quoted 1 line · David Lang

depending on what CPU you have the kernel (and compiler) can use

different

Quoted 7 lines
Quoted 2 lines

commands/opmizations/etc, if you want to do this on boot you have two options.

Wouldn't it be possible to compile the parts of the kernel needed to uncompress and to detect the cpu with lower optimizations and then abort with an error message?

Quoted 7 lines
Quoted 1 line

"Error: Kernel needs a PIII" sounds much better than just stoping dead.

I agree... maybe we can solve this simply by giving the CPU detection
module the -march=i386 flag hardcoded, or editing the bootstrap, or something like that...

Jeff

--------------------------------------------------------

David Relson                   Osage Software Systems, Inc.
[email protected]       514 W. Keech Ave.
www.osagesoftware.com          Ann Arbor, MI 48103
voice: 734.821.8800            fax: 734.821.8800
Quoted 4 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#13 lore raw
In reply to Sven Koch
Quoted 1 line · Jeff Merkey

The PE model uses flags to identify CPU type and capbilities

So does ELF.

Signature · 8 lines
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#14 lore raw
In reply to Sven Koch
Quoted 5 lines · Jeff Garzik
Quoted 1 line · Jeff Merkey

The PE model uses flags to identify CPU type and capbilities

So does ELF.

Jeff,

Can we also combine mutiple segments from different processors or is it a one-sy two-sy king of affair? If so, we're there, it just becomes a linking option.

I am building the RPM for Ute Linux with 2.4.0-10 and right now, I have to do what RedHat does, and create the /config "directory from hell" with two dosen .config files and create multiple RPMs for each kernel (i.e. i586, .i686). It's too convoluted and customers hate it.

8)

Jeff

Quoted 6 lines

--

Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#15 lore raw
In reply to Jeff V. Merkey
Quoted 5 lines

There are tests for all this in the feature flags for intel and non-intel CPUs like AMD -- including MTRR settings. All of this could be dynamic. Here's some code that does this, and it's similiar to NetWare. It detexts CPU type, feature flags, special instructions, etc. All of this on x86 could be dynamically detected.

Detection isnt the issue, its optimisations. Our 386 kernel build is the detect all run on any one.

Quoted 3 lines
    mov      sp, bx
    mov      CPU_TYPE, 3  ; 80386 detected
    jz       end_get_cpuid

This is wrong btw. You don;t check for Cyrix with CPUID disabled or the NexGen or pre CPUID Cyrix...

Quoted 4 lines

check_CMPXCHG8B:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, CMPXCHG8B_FLAG
    jz       check_4MB_paging

This needs a few other bits of interesting checking for non intel chips

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#16 lore raw
Quoted 10 lines · Alan Cox
Quoted 6 lines

There are tests for all this in the feature flags for intel and non-intel CPUs like AMD -- including MTRR settings. All of this could be dynamic. Here's some code that does this, and it's similiar to NetWare. It detexts CPU type, feature flags, special instructions, etc. All of this on x86 could be dynamically detected.

Detection isnt the issue, its optimisations. Our 386 kernel build is the detect all run on any one.

Quoted 6 lines
Quoted 3 lines
    mov      sp, bx
    mov      CPU_TYPE, 3  ; 80386 detected
    jz       end_get_cpuid

This is wrong btw. You don;t check for Cyrix with CPUID disabled or the NexGen or pre CPUID Cyrix...

Thanks Alan, I'll fix immediately.

Jeff

Quoted 7 lines
Quoted 5 lines

check_CMPXCHG8B:

    mov      ax, word ptr ds:FEATURE_FLAGS
    and      ax, CMPXCHG8B_FLAG
    jz       check_4MB_paging

This needs a few other bits of interesting checking for non intel chips

I'll grab the code in linux and port.

8)

Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#17 lore raw
Quoted 1 line

I'll grab the code in linux and port.

You are welcome

Make sure you get a pretty current 2.2.x tree however. The ultra deep magic for detecting NexGen processors is recent. It took a long time before I found someone who knew how it worked 8)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#18 lore raw
Quoted 8 lines · Alan Cox
Quoted 2 lines

I'll grab the code in linux and port.

You are welcome

Make sure you get a pretty current 2.2.x tree however. The ultra deep magic for detecting NexGen processors is recent. It took a long time before I found someone who knew how it worked 8)

I'll get on it. Alan, if ELF can do this now, it would be good idea to do this with the mutiple images. Sounds like it's just a link option and a few more smarts in the lilo and boot loader to make it work.

8)

Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#19 lore raw
In reply to [email protected]
Quoted 5 lines · Jeff Merkey

here are tests for all this in the feature flags for intel and non-intel CPUs like AMD -- including MTRR settings. All of this could be dynamic. Here's some code that does this, and it's similiar to NetWare. It detexts CPU type, feature flags, special instructions, etc. All of this on x86 could be dynamically detected.

Jeff, I think you miss the point that 100% dynamic detection comes with a penalty over the current system.

Using CONFIG_M586 enables us to compile with Pentium-specific instructions, and eliminate any code specific to 386's or 486's. This includes inlining Pentium-specific code into drivers and the core kernel where possible, for the maximum possible performance. Your scheme doesn't work because of all the inlined code, nor does it support maximum performance code on all processors without massive code bloat...

You do bring up a good point though. Users compile their own kernels to get the advantages I describe above. Vendors, on the other hand, must compile one-size-fits-all generic kernels. Your expertise and assistance would definitely benefit this case.

One change I would like to make in 2.5.x along these lines -- the Alpha AXP port allow one to define either CONFIG_ALPHA_GENERIC -- support all processors/machines -- or CONFIG_ALPHA_$MYMACHINE. It would be nice to follow that model for x86 too. Currently, when I select CONFIG_M586, I get code for 686, etc. There is no way to simply say "Pentium and nothing else".

Jeff

Signature · 8 lines
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#20 lore raw
In reply to [email protected]
Quoted 18 lines · Jeff Garzik
Quoted 5 lines · Jeff Merkey

here are tests for all this in the feature flags for intel and non-intel CPUs like AMD -- including MTRR settings. All of this could be dynamic. Here's some code that does this, and it's similiar to NetWare. It detexts CPU type, feature flags, special instructions, etc. All of this on x86 could be dynamically detected.

Jeff, I think you miss the point that 100% dynamic detection comes with a penalty over the current system.

Using CONFIG_M586 enables us to compile with Pentium-specific instructions, and eliminate any code specific to 386's or 486's. This includes inlining Pentium-specific code into drivers and the core kernel where possible, for the maximum possible performance. Your scheme doesn't work because of all the inlined code, nor does it support maximum performance code on all processors without massive code bloat...

Quoted 5 lines

You do bring up a good point though. Users compile their own kernels to get the advantages I describe above. Vendors, on the other hand, must compile one-size-fits-all generic kernels. Your expertise and assistance would definitely benefit this case.

We need a format that allow multiple executable segments to be combined in a single executable and the loader have enough smarts to grab the right one based on architecture. two options:

1. extend gcc to support this or rearragne linux into segments based on code type
2. Use PE.

Jeff

Quoted 7 lines

One change I would like to make in 2.5.x along these lines -- the Alpha AXP port allow one to define either CONFIG_ALPHA_GENERIC -- support all processors/machines -- or CONFIG_ALPHA_$MYMACHINE. It would be nice to follow that model for x86 too. Currently, when I select CONFIG_M586, I get code for 686, etc. There is no way to simply say "Pentium and nothing else".

Quoted 7 lines

Jeff

--

Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#21 lore raw
Quoted 3 lines

We need a format that allow multiple executable segments to be combined in a single executable and the loader have enough smarts to grab the right one based on architecture. two options:

ELF can do that just fine

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#22 lore raw
In reply to Jeff V. Merkey

On Tue, 7 Nov 2000, Jeff V. Merkey wrote:

(Please forgive this snippage making Jeff look less literate than he is, even after several beers.)

Quoted 1 line

We need a format that allow

[..]

Quoted 1 line

the right one based on architecture.

Oh, we already have that. It's called source code.

Matthew.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#23 lore raw
In reply to [email protected]
Quoted 7 lines · Jeff V. Merkey

We need a format that allow multiple executable segments to be combined in a single executable and the loader have enough smarts to grab the right one based on architecture. two options:

1. extend gcc to support this or rearragne linux into segments based on code type
2. Use PE.

The kernel isn't going non-ELF. Too painful, for dubious advantages, namely:

The current gcc toolchain already supports what you suggest.

I understand that some people have even put some thought into a bootloader that dynamically links your kernel on bootup, so this idea isn't new. It's a good idea though.

Jeff

Signature · 8 lines
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#24 lore raw
In reply to [email protected]
Quoted 6 lines · Jeff Garzik
Quoted 4 lines · Jeff V. Merkey

We need a format that allow multiple executable segments to be combined in a single executable and the loader have enough smarts to grab the right one based on architecture. two options:

Quoted 7 lines
Quoted 3 lines

1. extend gcc to support this or rearragne linux into segments based on code type
2. Use PE.

The kernel isn't going non-ELF. Too painful, for dubious advantages, namely:

perhaps we should extend ELF. After all, where linux goes, gcc follows....

Jeff

Quoted 6 lines

The current gcc toolchain already supports what you suggest.

I understand that some people have even put some thought into a bootloader that dynamically links your kernel on bootup, so this idea isn't new. It's a good idea though.

Quoted 7 lines

Jeff

--

Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#25 lore raw
In reply to [email protected]
Quoted 10 lines · Jeff Garzik
Quoted 7 lines · Jeff V. Merkey

We need a format that allow multiple executable segments to be combined in a single executable and the loader have enough smarts to grab the right one based on architecture. two options:

1. extend gcc to support this or rearragne linux into segments based on code type
2. Use PE.

Quoted 9 lines

The kernel isn't going non-ELF. Too painful, for dubious advantages, namely:

The current gcc toolchain already supports what you suggest.

I understand that some people have even put some thought into a bootloader that dynamically links your kernel on bootup, so this idea isn't new. It's a good idea though.

Yes, I have been working on it on and off for a while ("off" due to various professional and personal issues taking higher priority for some time...)

-hpa

Signature · 7 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#26 lore raw
In reply to [email protected]
Quoted 16 lines · H. Peter Anvin
Quoted 15 lines · Jeff Garzik
Quoted 7 lines · Jeff V. Merkey

We need a format that allow multiple executable segments to be combined in a single executable and the loader have enough smarts to grab the right one based on architecture. two options:

1. extend gcc to support this or rearragne linux into segments based on code type
2. Use PE.

The kernel isn't going non-ELF. Too painful, for dubious advantages, namely:

The current gcc toolchain already supports what you suggest.

Quoted 8 lines
Quoted 4 lines

I understand that some people have even put some thought into a bootloader that dynamically links your kernel on bootup, so this idea isn't new. It's a good idea though.

Yes, I have been working on it on and off for a while ("off" due to various professional and personal issues taking higher priority for some time...)

Keep truckin' H. Peter, this is something that's needed.

:-)

Jeff

Quoted 11 lines

-hpa

Signature · 7 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#27 lore raw
In reply to [email protected]
Quoted 6 lines · Jeff V. Merkey
Quoted 3 lines

The kernel isn't going non-ELF. Too painful, for dubious advantages, namely:

perhaps we should extend ELF. After all, where linux goes, gcc follows....

I would like to see some features added to ELF. Resource binding support would be nice, i.e. bitmaps used internally by GUI apps and such, so that they can be shared between processes if they are in a shared lib, and so that the app can reload faster if the resources are cached. I suspect this is what allows netscape to restart in < 2 sec under Windows or OS/2, versus ~5 sec under Linux on the same system.

Executable signing or at least a CRC (optional, of course) would be nice too. Version strings would be helpful in some cases as well (like bad programs that don't/can't support the -v|-V|--version options, or for automated retrieval of the information)

Sorry if these features are supported already.

Signature · 6 lines
Mark McClelland
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#28 lore raw
Quoted 3 lines

I would like to see some features added to ELF. Resource binding support would be nice, i.e. bitmaps used internally by GUI apps and such, so that they can be shared between processes if they are in a shared lib,

You can do shared mappings of almost anything anyway. In fact most of the shared library loading is done in user space via mmap.

There are good reasons for not putting resources into the program itself too, one of which is customisability.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#29 lore raw
In reply to Martin Josefsson
Quoted 4 lines · On Tue, 07 Nov 2000 23:32:46 Jeff V. Merkey wrote:

So how come NetWare and NT can detect this at run time, and we have to use a .config option to specifiy it? Come on guys.....

If you can get NT to boot on a 486, perhaps that shows that NT does not use any optimization...so does not worry about what is it running on, just prints the name...

Signature · 7 lines
Juan Antonio Magallon Lacarta                                 #> cd /pub
mailto:[email protected]                                     #> more beer

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#30 lore raw
In reply to Martin Josefsson
Quoted 2 lines · Jeff V. Merkey

So how come NetWare and NT can detect this at run time, and we have to use a .config option to specifiy it? Come on guys.....

Linux detects this as well -

However this is not about detection, but optimizations.

Optimizations e.g. for xeon could keep a K6/2 from booting!

It should probably default to something safe like 386 though...

jjs

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/