linxu start 0x10000



   linux的内核映象的入口为startup_32,由引导扇区setup.s的一个跳转指令“ljmp 0x100000”进入,为什么不用是符号跳转“ljmp startup_32”而要用物理地址跳转?这是因为编译后startup_32的虚拟地址是0xC0100000,而实际物理地址是0x100000,而此时页式映射机制还没有开启,所以没办法根据其虚拟地址找到实际的物理地址。从startup_32开始的汇编代码在arch/i386/kernel/head.S中。

/*

* linux/arch/i386/head.S -- the 32-bit startup code.

*

* Copyright (C) 1991, 1992 Linus Torvalds

*

* Enhanced CPU detection and feature setting code by Mike Jagdis

* and Martin Mares, November 1997.

*/

.text

#include <linux/config.h>

#include <linux/threads.h>

#include <linux/linkage.h>

#include <asm/segment.h>

#include <asm/page.h>

#include <asm/pgtable.h>

#include <asm/desc.h>

#define OLD_CL_MAGIC_ADDR 0x90020

#define OLD_CL_MAGIC   0xA33F

#define OLD_CL_BASE_ADDR 0x90000

#define OLD_CL_OFFSET   0x90022

#define NEW_CL_POINTER   0x228 /* Relative to real mode data */

/*

* References to members of the boot_cpu_data structure.

*/

#define CPU_PARAMS SYMBOL_NAME(boot_cpu_data)

#define X86   CPU_PARAMS+0

#define X86_VENDOR CPU_PARAMS+1

#define X86_MODEL CPU_PARAMS+2

#define X86_MASK CPU_PARAMS+3

#define X86_HARD_MATH CPU_PARAMS+6

#define X86_CPUID CPU_PARAMS+8

#define X86_C

#linux内核学习
评论 (1) 转载 阅读全文

   linux的内核映象的入口为startup_32,由引导扇区setup.s的一个跳转指令“ljmp 0x100000”进入,为什么不用是符号跳转“ljmp startup_32”而要用物理地址跳转?这是因为编译后startup_32的虚拟地址是0xC0100000,而实际物理地址是0x100000,而此时页式映射机制还没有开启,所以没办法根据其虚拟地址找到实际的物理地址。从startup_32开始的汇编代码在arch/i386/kernel/head.S中。

/*

* linux/arch/i386/head.S -- the 32-bit startup code.

*

* Copyright (C) 1991, 1992 Linus Torvalds

*

* Enhanced CPU detection and feature setting code by Mike Jagdis

* and Martin Mares, November 1997.

*/

.text

#include <linux/config.h>

#include <linux/threads.h>

#include <linux/linkage.h>

#include <asm/segment.h>

#include <asm/page.h>

#include <asm/pgtable.h>

#include <asm/desc.h>

#define OLD_CL_MAGIC_ADDR 0x90020

#define OLD_CL_MAGIC   0xA33F

#define OLD_CL_BASE_ADDR 0x90000

#define OLD_CL_OFFSET   0x90022

#define NEW_CL_POINTER   0x228 /* Relative to real mode data */

/*

* References to members of the boot_cpu_data structure.

*/

#define CPU_PARAMS SYMBOL_NAME(boot_cpu_data)

#define X86   CPU_PARAMS+0

#define X86_VENDOR CPU_PARAMS+1

#define X86_MODEL CPU_PARAMS+2

#define X86_MASK CPU_PARAMS+3

#define X86_HARD_MATH CPU_PARAMS+6

#define X86_CPUID CPU_PARAMS+8

#define X86_C

#linux内核学习
评论 (1) 转载 阅读全文

你可能感兴趣的:(linxu start 0x10000)