首页 > 其他分享 >Segmentation 2 -- usage

Segmentation 2 -- usage

时间:2022-11-03 14:25:54浏览次数:59  
标签:flat Segmentation -- segments segmentation address usage model segment

The segmentation mechanism supported by the IA-32 architecture can be used to implement a wide variety of  system designs. These designs range from flat models that make only minimal use of segmentation to protect programs to multi-segmented models that employ segmentation to create a robust operating environment in  which multiple programs and tasks can be executed reliably.

Basic Flat Model

The simplest memory model for a system is the basic “flat model,” in which the operating system and application  programs have access to a continuous, unsegmented address space. To the greatest extent possible, this basic flat model hides the segmentation mechanism of the architecture from both the system designer and the application programmer. To implement a basic flat memory model with the IA-32 architecture, at least two segment descriptors must be  created, one for referencing a code segment and one for referencing a data segment (see Figure 3-2). Both of  these segments, however, are mapped to the entire linear address space: that is, both segment descriptors have  the same base address value of 0 and the same segment limit of 4 GBytes. By setting the segment limit to 4  GBytes, the segmentation mechanism is kept from generating exceptions for out of limit memory references, even if no physical memory resides at a particular address. ROM (EPROM) is generally located at the top of the physical address space, because the processor begins execution at FFFF_FFF0H. RAM (DRAM) is placed at the bottom of the address space because the initial base address for the DS data segment after reset initialization is 0.

Protected Flat Model

The protected flat model is similar to the basic flat model, except the segment limits are set to include only the  range of addresses for which physical memory actually exists (see Figure 3-3). A general-protection exception  (#GP) is then generated on any attempt to access nonexistent memory. This model provides a minimum level of  hardware protection against some kinds of program bugs. More complexity can be added to this protected flat model to provide more protection. For example, for the paging mechanism to provide isolation between user and supervisor code and data, four segments need to be defined: code and data segments at privilege level 3 for the user, and code and data segments at privilege level 0 for the supervisor. Usually these segments all overlay each other and start at address 0 in the linear address space. This flat segmentation model along with a simple paging structure can protect the operating system from applications, and by adding a separate paging structure for each task or process, it can also protect applications from each other. Similar designs are used by several popular multitasking operating systems.  

Multi-Segment Model

A multi-segment model (such as the one shown in Figure 3-4) uses the full capabilities of the segmentation mechanism to provide hardware enforced protection of code, data structures, and programs and tasks. Here, each program (or task) is given its own table of segment descriptors and its own segments. The segments can be completely private to their assigned programs or shared among programs. Access to all segments and to the  execution environments of individual programs running on the system is controlled by hardware.

 

Access checks can be used to protect not only against referencing an address outside the limit of a segment, but also against performing disallowed operations in certain segments. For example, since code segments are designated as read-only segments, hardware can be used to prevent writes into code segments. The access rights information created for segments can also be used to set up protection rings or levels. Protection levels can be used to protect operating-system procedures from unauthorized access by application programs.  

Segmentation in IA-32e Mode

In IA-32e mode of Intel 64 architecture, the effects of segmentation depend on whether the processor is running in compatibility mode or 64-bit mode. In compatibility mode, segmentation functions just as it does using legacy 16-bit or 32-bit protected mode semantics. In 64-bit mode, segmentation is generally (but not completely) disabled, creating a flat 64-bit linear-address  space. The processor treats the segment base of CS, DS, ES, SS as zero, creating a linear address that is equal to the effective address. The FS and GS segments are exceptions. These segment registers (which hold the segment base) can be used as additional base registers in linear address calculations. They facilitate addressing local data and certain operating system data structures.    Note that the processor does not perform segment limit checks at runtime in 64-bit mode.  

标签:flat,Segmentation,--,segments,segmentation,address,usage,model,segment
From: https://www.cnblogs.com/xiangsplayground/p/16854307.html

相关文章

  • RockyLinux9 源码安装LNMP
    本文参考来自https://www.ziruchu.com/art/401在基础上修改了部分路径和版本,感谢原作者的分享。准备工作安装软件dnfinstall-ywgetvimlrzsz关闭防火墙#关闭防......
  • Hadoop学习
    Hadoop介绍 允许用户使用简单的编程模型实现跨机器集群对海量数据进行分布式计算处理 Hadoop核心组件HadoopHDFS(分布式文件存储系统):解决海量数据存储HadoopYARN(......
  • C# 在GridView里面使用a标签下载文件(图片)
    不能使用ajax进行下载文件的操作,具体原因需百度前端页面,在GridView里面使用模板列,模板列放a标签<cimesui:cimesGridViewID="GridView1"runat="server"AutoGenerat......
  • 导航栏下拉列表/vue/scss/html
    效果   scss样式 html 源码<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=......
  • 【解决一个小问题】proto文件中的enum,去掉长长的重复的enum名字
    在proto中定义的enum,通常类型名字都会带上enum的前缀,很丑陋,如何去掉呢?enumDataSourceType{NotUse=0;MySQL=1;ElasticSearch=2;}生成后的代码如下:cons......
  • (笔记)一键安装ROS2与一键卸载ROS2
      一键安装:wgethttp://fishros.com/install-Ofishros&&.fishros 一键卸载:sudoaptremoveros-foxy-*&&sudoaptautoremove......
  • 实验七:基于REST API的SDN北向应用实践
    一、实验目的1.能够编写程序调用OpenDaylightRESTAPI实现特定网络功能;2.能够编写程序调用RyuRESTAPI实现特定网络功能。二、实验环境1.下载虚拟机软件OracleVisua......
  • implict GEMM
    0x00baseofim2colhttps://zhuanlan.zhihu.com/p/4913073280x01baseofimplictGEMMhttps://zhuanlan.zhihu.com/p/372973726sofar,0x00重点看im2col,0x01重点......
  • javascript规范中美元符号$是什么?
    用途:一般用$获取页面中的某一个对象的id。参考:https://www.cnblogs.com/xutao1517588477/p/10582463.html>>拓展:$(function(){}),什么时候执行?https://blog.csdn.net/u0......
  • web服务器15 jsonp格式接口
    概念:浏览器端通过<script>标签的src属性,请求服务器上的数据,同时,服务器返回一个函数的调用。这种请求数据的方式叫做SONP。特点:①JSONP不属于真正的Ajax请求,因为它没有使用......