从给定的物理地址和有效地址中查找段地址 [英] Find Segment address from given physical and effective address

查看:39
本文介绍了从给定的物理地址和有效地址中查找段地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从给定数据中找到段地址?

物理地址 = 0x119B,有效地址 = 0x10AB

公式是什么?

解决方案

x86 16 位实模式中的有效地址只是 20 位 segment:offset 地址.给你的问题是确定一个段值,当与有效地址 0x10AB 结合产生一个物理(线性)地址 0x119B 时.

物理地址可以从 segment:offset 对使用公式 physaddr=(segment<<4)+offsetphysaddr=(段*0x10)+偏移量.稍微修改一下公式:

<块引用>

physaddr = (segment*0x10)+offsetphysaddr-offset = 段*0x10(physaddr-offset)/0x10 = 段段 = (physaddr-offset)/0x10

既然我们知道段的公式是segment = (physaddr-offset)/0x10,我们可以执行计算来找到您问题的答案:

<块引用>

segment = (0x119B-0x10AB)/0x10段 = 0xF0/0x10段 = 0xF

我们可以通过将它代入物理地址的原始方程来检查这个结果并得到:

<块引用>

physaddr = (0xF*0x10)+0x10AB = 0x119B.

how to find a segment address from given data?

Physical address = 0x119B, Effective address = 0x10AB

what could be the formula?

解决方案

The effective address in x86 16-bit real mode is just the offset portion of a 20-bit segment:offset address. The question you have been given is to determine a segment value when combined with the effective address 0x10AB yields a physical (linear) address of 0x119B.

The physical address can be computed from a segment:offset pair with the formula physaddr=(segment<<4)+offset or physaddr=(segment*0x10)+offset. Reworking the formula a bit:

physaddr = (segment*0x10)+offset
physaddr-offset = segment*0x10
(physaddr-offset)/0x10 = segment
segment = (physaddr-offset)/0x10

Now that we know the formula for segment is segment = (physaddr-offset)/0x10 we can perform the calculation to find the answer for your question:

segment = (0x119B-0x10AB)/0x10
segment = 0xF0/0x10
segment = 0xF

We can check this result by plugging it into the original equation for physical address and get:

physaddr = (0xF*0x10)+0x10AB = 0x119B.

这篇关于从给定的物理地址和有效地址中查找段地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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