LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 696|回复: 0

PDP-11/40 一问(续)

[复制链接]
发表于 2004-8-22 13:47:53 | 显示全部楼层 |阅读模式
PDP-11/40 使用 KD11-A 处理器。这种处理器有许多寻址方式,其中有一种是对 PC(程序计数器)的相对寻址。这种寻址方式是:

  1. RELATIVE ADDRESSING - Relative addressing specifies the operand
  2. address relative to the instruction location. This is accomplished by
  3. using the PC as an index register. The PC is considered as a base
  4. address. The offset, the distance between the location of the operand
  5. and the PC, is held in the index word of the instruction. PAL-11
  6. assembles instructions of the form

  7. OPR A

  8. (where A has not been assigne as a name of a general register) as an
  9. instruction word with the address field

  10. +-----------------------+
  11. |     6     |     7     |
  12. +---+---+---+---+---+---+
  13. ADDRESS FIELD-RELATIVE MODE

  14. followed by an index word of the form

  15. +----------------------------+
  16. | A-ADDRESS OF THIS WORD * 2 |
  17. +----------------------------+
复制代码


在 UNIX 源代码中有这样的代码:

  1. 0851 gword:
  2. 0852    mov      PS,-(sp)
  3. 0853    bis      $340,PS
  4. 0854    mov      nofault,-(sp)
  5. 0855    mov      $err,nofault
  6. 0856    mfpi     (r1)
  7. 0857    mov      (sp)+,r0
  8. 0858    br       1f
复制代码


很明显,0852 行的目的是将 PS(处理器状态)压入堆栈。PS 的值在别处指明,是 177776。处理器状态似乎应该在这个地址中。然而基于上面对寻址方式的描述,程序会将相对于 pc 距离为 177776 的内存中的内容压入堆栈。请问这是怎么回事?
还有一点,在 UNIX 汇编中,像 nofault 这样的标识符出现在代码中是否代表该标识符所在位置的地址?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表