MIT6.828 boot.S文件分析

MIT6.828 boot.S文件分析
摘要由CSDN通过智能技术生成
#include <inc/mmu.h>

# Start the CPU: switch to 32-bit protected mode, jump into C.
# The BIOS loads this code from the first sector of the hard disk into
# memory at physical address 0x7c00 and starts executing in real mode
# with %cs=0 %ip=7c00.
启动CPU,切换到32位保护模式,跳转到C代码
BIOS从硬盘的第一个扇区加载这个代码到
物理内存地址为0x7c00的地方,cs=0,ip=7c00

下面的3条.set指令类似于宏定义
内核代码段选择子
.set PROT_MODE_CSEG, 0x8         # kernel code segment selector
内核数据段选择子
.set PROT_MODE_DSEG, 0x10        # kernel data segment selector
保护模式使能标志
.set CR0_PE_ON,      0x1         # protected mode enable flag

定义一个全局名字start
.globl start
start:
CPU刚启动为16位模式
  .code16                     # Assemble for 16-bit mode
关中断
  cli                         # Disable interrupts
清方向标志
  cld                         # String operations increment

  # Set up the important data segment registers (DS, ES, SS).
设置重要的数据段寄存器
ax清零
  xorw    %ax,%ax             # Segment number zero
ds清零
  
  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值