操作系统启动,分页或无分页时,内存管理的类型是什么? [英] What's the type of memory management when the OS booted,paging or no-paging?

查看:78
本文介绍了操作系统启动,分页或无分页时,内存管理的类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引导OS时,内存管理的类型是什么,分页还是不分页?这就是说cr0寄存器中控制分页开/关的值是多少.我猜想在内核初始化开始时分页是关闭的,否则所有的内存访问都将无效.分页是在内核初始化期间设置的,并且内核空间的所有映射都必须设置为有效.我说的对吗?

When an OS is booted, what's the type of memory management ,paging or no-paging? That's is to say what is the value in the cr0 register that control the on/off of paging.I guess paging is off in the begining of kernel initialization, otherwise, all the memory access will be invalid. Paging is set during the kernel initialization,and all the maps of the kernel space must be set to be valid. Am I right?

推荐答案

我假设启动操作系统时"是指处理器启动时".在这种情况下,它显然取决于处理器的体系结构.

I assume that by "when an OS is booted", you mean "when the processor is powered on". In that case, it obviously depends on the processor's architecture.

对于x86,分页由CR0寄存器中的第31位控制(如果设置了该位,则启用分页).摘自《英特尔软件开发人员手册》 ,第3卷,第8.1.1节.在重置后的处理器状态"中,您可以看到重置后CR0中的值为0x60000010,这意味着分页被禁用.

For the x86, paging is controlled by bit 31 in the CR0 register (if this bit is set, paging is enabled). From Intel's Software Developer Manual, Volume 3, Section 8.1.1. "Processor State After Reset", you can see that the value in CR0 is 0x60000010 after a reset, which means paging is disabled.

如果您想知道是否在内核启动之前就启用了分页,则取决于引导加载程序的工作. Multiboot 规范(例如,由GRUB实现)指示应禁用分页:

If you want to know if paging is enabled just before the kernel is started, it depends on what the bootloader does. The Multiboot specification (implemented by, for example, GRUB) dictates that paging should be disabled:

"CR0"

‘CR0’

位31(PG)必须清除.必须设置位0(PE).其他位都未定义.

Bit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits are all undefined.

这篇关于操作系统启动,分页或无分页时,内存管理的类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆