汇编程序如何运行中断 [英] how assemblers run interrupts

查看:125
本文介绍了汇编程序如何运行中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi :)
我听说我们不能直接使用中断服务
在OS(Windows,Linux)中,我们必须使用系统调用,那么nasm和tasm等汇编程序如何在OS中运行中断服务?

例子:

MOV BH,00
MOV AH,0EH
MOV AL,41H
MOV BL,07H
INT 10H

hi :)
i have heard we can not use interrupt services directly
in OSes(windows,Linux)and we have to use system calls,so how assemblers like nasm and tasm run the interrupt services in OS?

example :

MOV BH,00
MOV AH,0EH
MOV AL,41H
MOV BL,07H
INT 10H

推荐答案

如今,可以使用特殊的调试寄存器:
http://ftp.utcluj.ro/pub/users/nedevschi/PMP/protected86/protgemode/translate_cdebugreg.html [ ^ ]

您可以在其中一个调试寄存器中设置断点地址,并设置相应的标志以使其生效.对于较旧的处理器,另一种方法是使用INT3.

这里是更多信息的另一个链接:
http://www.logix.cz/michal/doc/i386/chp12-03.htm [^ ]

祝你好运!
Nowadays there are special debug registers that can be used:
http://ftp.utcluj.ro/pub/users/nedevschi/PMP/protected86/protgemode/translate_cdebugreg.html[^]

You set the breakpoint address in one of the debug registers and set the corresponding flags to make it effective. Another way, for older processors would be to use INT 3.

Here another link for more info:
http://www.logix.cz/michal/doc/i386/chp12-03.htm[^]

Good luck!


您发布的代码是实模式16位汇编器.那些日子,直接调用中断是完全可以的,您甚至可以使用C,Pascal和Basic之类的语言(取决于所使用的编译器)来执行中断.
顺便说一句,汇编器本身不调用任何中断,它们只是生成调用中断所需的机器代码.在运行时,由CPU执行代码,当遇到中断指令时,将触发该中断.

在现代保护模式开发中,您仍然可以(以某种方式)调用中断,但是您需要在内核模式下运行.如果您认真学习汇编语言,建议您阅读一本更新的书.不要浪费太多时间研究16位汇编,在这种情况下,您不妨去学习PDP-11指令集.
The code you posted is real mode 16 bit assembler. Those days, it was perfectly okay to invoke interrupts directly, and you could even do it from languages like C, Pascal and Basic (depending on the compiler you used).

Btw, the assemblers themselves do not invoke any interrupts, they just generate the required machine code for calling an interrupt. At run time, it''s the CPU that executes the code and when it encounters an interrupt instruction, the interrupt is fired.

In modern day protected mode development, you can still call interrupts (in a fashion), but you need to be running in kernel mode. If you are serious about learning assembly language, I would advise you to get a more updated book. Don''t waste too much time studying 16 bit assembly, you might as well go learn the PDP-11 instruction set in that case.


他们不能.
例如,Windows不允许这样的呼叫(请 Google 表示保护模式").
:)
They cannot.
Windows, for instance, won''t allow such a call (please, Google for ''protected mode'').
:)


这篇关于汇编程序如何运行中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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