LinuxÒÁµéÔ°ÂÛ̳'s Archiver

middleware ·¢±íÓÚ 2006-3-15 09:20

LinuxµÄ16-bit to 32-bitÌø×ª

Linux kernelµÄsetup.SÖÐÏò0x100000,__BOOT_CSÌø×ªÓõÄÊÇÊÖдµÄ»úÆ÷Âë¡£¡¶×Ô¼º¶¯ÊÖд²Ù×÷ϵͳ¡·ÀïÃæ½âÊÍ˵£ºÕâÊÇÒòΪµ±Ç°´úÂë´¦ÔÚ.code16ÖУ¬Èç¹ûÓÃÆÕͨд·¨»ã±àÆ÷»á½«__BOOT_CS½Ø¶Ï¡£

ÎҲ鿴ÁËÒ»ÏÂGRUBµÄ´úÂ룬ÄÇÀïÃæÓÃ.code16ºÍ.code32µÄÅäºÏ×öµÃºÜºÃ£¬ÎÞÐèÊÖд»úÆ÷Âë¡£Linux kernel setup.SÖеÄ×ö·¨ÊDz»ÊÇÓÐЩ²»ºÏʱÒËÁË£¿

[B]LinuxµÄ×ö·¨£º [/B]
# jump to startup_32 in arch/i386/boot/compressed/head.S
#
# NOTE: For high loaded big kernels we need a
# jmpi 0x100000,__BOOT_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 __BOOT_CS



[B]GRUBµÄ×ö·¨£º [/B]
DATA32 ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg

.code32
protcseg:

Ò³: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.