Salut.
Am fost curios sa vad cum se face procedura de initializare a kernelului
dupa ce e incarcat de loader. (ma rog, pentru i386)
M'am uitat prin /usr/src/linux/arch/i386/boot/setup.S, e chiar haios ce e 
pe acolo :) dar la un moment dat mi s'a "rupt filmul" ... Mai precis la

------------------------------------------------------------------------
# Well, that certainly wasn't fun :-(. Hopefully it works, and we don't
# need no steenking BIOS anyway (except for the initial loading :-).
# The BIOS-routine wants lots of unnecessary data, and it's less
# "interesting" anyway. This is how REAL programmers do it.
#
# Well, now's the time to actually move into protected mode. To make
# things as simple as possible, we do no register set-up or anything,
# we let the gnu-compiled 32-bit programs do that. We just jump to
# absolute address 0x1000 (or the loader supplied one),
# in 32-bit protected mode.
#
# Note that the short jump isn't strictly needed, although there are
# reasons why it might be a good idea. It won't hurt in any case.
        movw    $1, %ax                         # protected mode (PE) bit
        lmsw    %ax                             # This is it!
        jmp     flush_instr

flush_instr:
        xorw    %bx, %bx                        # Flag to indicate a boot
        xorl    %esi, %esi                      # Pointer to real-mode code
        movw    %cs, %si
        subw    $DELTA_INITSEG, %si
        shll    $4, %esi                        # Convert to 32-bit pointer
# NOTE: For high loaded big kernels we need a
#       jmpi    0x100000,__KERNEL_CS
#
#       but we yet haven't reloaded the CS register, so the default size
#       of the target offset still is 16 bit.
#       However, using an operand prefix (0x66), the CPU will properly
#       take our 48 bit far pointer. (INTeL 80386 Programmer's Reference
#       Manual, Mixing 16-bit and 32-bit code, page 16-6)

        .byte 0x66, 0xea                        # prefix + jmpi-opcode
code32: .long   0x1000                          # will be set to 0x100000
                                                # for big kernels
        .word   __KERNEL_CS
--------------------------------------------------------------------------

(si e chiar interesant ca vad ca si Linus face wrap la 75 coloane :) )

E clar ca ".byte 0x66, 0xea" e un "jmp far" pe 32 biti si e necesar ca sa 
incarce si registrul %cs. Dar de fapt unde sare kernelul aici? Sa inteleg
ca intr'un modul compilat dintr'o sursa de C ? Dar care? 
Din /usr/src/linux/init/main.c de ex. ? 

Stie cineva? :)

Bogdan Marinca
--
Pentru dezabonare, trimiteti mail la 
[EMAIL PROTECTED] cu subiectul 'unsubscribe rlug'.
REGULI, arhive si alte informatii: http://www.lug.ro/mlist/


Raspunde prin e-mail lui