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的内核映象的入口为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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值