如何修复“不允许使用 LOCK 前缀(op1=0x53,attr=0x0,mod=0x0,nnn=0)”?

发布于 2024-12-23 10:17:27 字数 961 浏览 6 评论 0原文

我的简单代码:

  [ORG 0x7C00]
  MOV       AH,0x02     ;Using the function of reading floppy
  MOV       AL,0x01     ;The number of sectors to be read is 1.
  MOV       CH,0x00     ;Only read 0 track
  MOV       CL,0x03     ;Only read the third sector
  MOV       DH,0x00     ;Only read the 0 head
  MOV       DL,0x00     ;Using driver 0
  INT       13H

  JMP $ ;Just for loop forever


  TIMES 510 - ($ - $$) db 0 ;This is for 1 sector(512 bytes)
  DW 0xAA55 ;This is for the end of boot sector

在我运行 bochsdbg 之后。

它显示:

  (0) Breakpoint 1, 0x00007c00 in ?? ()
  Next at t=12943079
  (0) [0x00007c00] 0000:7c00 (unk. ctxt): mov ah, 0x02              ; b402
  <bochs:3> c
  00012943849i[FDD  ] read() on floppy image returns 0
  00012989063i[CPU0 ] LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)

我认为 INT 13 应该返回 CF=1 的错误状态,而不是因该错误消息而停止。

发生了什么事?如何修复它?

谢谢~

My simple code:

  [ORG 0x7C00]
  MOV       AH,0x02     ;Using the function of reading floppy
  MOV       AL,0x01     ;The number of sectors to be read is 1.
  MOV       CH,0x00     ;Only read 0 track
  MOV       CL,0x03     ;Only read the third sector
  MOV       DH,0x00     ;Only read the 0 head
  MOV       DL,0x00     ;Using driver 0
  INT       13H

  JMP $ ;Just for loop forever


  TIMES 510 - ($ - $) db 0 ;This is for 1 sector(512 bytes)
  DW 0xAA55 ;This is for the end of boot sector

After I run by bochsdbg.

It shows:

  (0) Breakpoint 1, 0x00007c00 in ?? ()
  Next at t=12943079
  (0) [0x00007c00] 0000:7c00 (unk. ctxt): mov ah, 0x02              ; b402
  <bochs:3> c
  00012943849i[FDD  ] read() on floppy image returns 0
  00012989063i[CPU0 ] LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)

I think INT 13 should return error status with CF=1 not stop by that error message.

What's happened? How to fixed it?

Thank you~

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空气里的味道 2024-12-30 10:17:27

您的问题可能是由您的代码崩溃和/或执行“未知”代码(例如,数据恰好看起来像无效指令)引起的。

要解决该问题,您需要修复代码中的错误。最可能的错误是没有告诉 BIOS 在哪里加载扇区(ES:BX 应该包含您希望 BIOS 加载扇区的地址),并且因为您在使用“加载扇区”之前没有设置 ES:BX “BIOS 功能你可能会丢弃一些重要的东西(比如你自己的代码或堆栈,或者可能是 IVT)。

其他错误包括没有设置有效的堆栈和没有检查错误(并且没有重试);但这些错误不太可能导致您当前的问题。

Your problem is probably caused by your code crashing and/or executing "unknown" code (e.g. data that happens to look like an invalid instruction).

To fix the problem you need to fix the bugs in your code. The most likely bug is not telling the BIOS where to load the sector (ES:BX should contain the address you want the BIOS to load the sector), and because you don't set ES:BX before using the "load sector/s" BIOS function you probably trash something important (like your own code or stack, or maybe the IVT).

Other bugs include not setting up a valid stack and not checking for errors (and not retrying); but these bugs are much less likely to cause your current problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文