免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4966 | 回复: 10
打印 上一主题 下一主题

[中断] linux启动后,int 3到底是cpu异常还是bios中断? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-08-23 17:21 |只看该作者 |倒序浏览
还有就是Linux启动后,bios中断不会和cpu异常冲突吗?

论坛徽章:
0
2 [报告]
发表于 2014-08-23 17:23 |只看该作者
这个问题从开始看内核就有了,查了很多资料,有些说Linux启动后不使用任何bios程序,而使用自己专门的中断服务程序。

论坛徽章:
0
3 [报告]
发表于 2014-08-23 17:24 |只看该作者
各位内核大牛,给入门菜鸟解答一下疑问吧

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
4 [报告]
发表于 2014-08-23 18:45 |只看该作者
回复 3# guoyuexiangying

Linux不会使用BIOS的服务,自力更生。自己注册CPU的中断门。建议你找本Linux的书如《Linux情景分析》看看。


   

论坛徽章:
0
5 [报告]
发表于 2014-08-23 19:04 |只看该作者
好的,手头刚好有那本书,会好好看看的。那在linux里写汇编程序就不能用各种Bios中断如int 10h之类的了是吗?回复 4# Tinnal


   

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
6 [报告]
发表于 2014-08-23 20:28 |只看该作者
回复 5# guoyuexiangying

不能用了, int 10h是BIOS 16位模式下的操作,进入32位保护模式就不能再用了。建议用等效的Linux系统调用代替。

4.1 Main Differences Between DOS and Linux Assembly

In DOS assembly, most things get done with the DOS services interrupt int 21h, and the BIOS service interrupts like int 10h and int 16h. In Linux, all these functions are handled by the kernel. Everything gets done with "kernel system calls", and you call the kernel with int 80h. One of the wonderful things about Linux system calls are that there are fewer of them (about 190) than DOS, but they are far more practical (you don't have obsolete crap like functions that load casette BASIC and things left over from DOS 1.0). Linux system calls create files, handle processes and other such useful stuff - no strings attached (mmm, bad pun
Linux is a true, 32-bit protected mode operating system, so this enables us to do real, up-to-date 32-bit assembly. This 32-bit code runs in the flat memory model, which basically means you don't have to worry about segments at all. This makes life a lot easier, because you never need to use a segment override or modify any segment register, and every address is 32 bits long and contains only an offset part. (If this is just a lot of waffling to you, don't worry, just know that it's good and will simplify things for you.)
In 32-bit assembly, you use the extended 32-bit registers EAX, EBX, ECX and so on instead of the normal 16-bit registers AX, BX, CX etc.
DOS is dead. It's 16-bit. It's obsolete. The only people that still write DOS assembly are crazy old hackers that are too attached to their 386s to throw them away. Linux assembly has practical applications (parts of the OS are written in assembler, hardware drivers are often coded in assembler).
完整的文章见:http://docs.cs.up.ac.za/programming/asm/derick_tut/


如果你一定要用BIOS或DOS的功能,可以试试DOSBOX或DOSEMU。
兄弟,都什么年代了,把BIOS和DOS忘了吧。BIOS都被UEFI取缔了。{:3_183:}


   

论坛徽章:
0
7 [报告]
发表于 2014-08-24 15:12 |只看该作者
谢谢这位兄弟啊,不过我是妹子啊。。。

我是在看《一个操作系统的实现》看到作者写的实模式下用了int 15h.

可以再问个问题吗?汇编下为什么可以用各种bios中断?难道bios中断例程没被其他程序覆盖?还在内存某个地方存着吗?回复 6# Tinnal


   

论坛徽章:
0
8 [报告]
发表于 2014-08-24 15:16 |只看该作者
我记得当时在学习汇编的时候,确实用了int 10h来显示字符,难道是在实模式下?

论坛徽章:
7
丑牛
日期:2013-10-18 14:43:21技术图书徽章
日期:2013-11-03 09:58:03辰龙
日期:2014-01-15 22:57:50午马
日期:2014-09-15 07:04:39丑牛
日期:2014-10-16 14:25:222015年亚洲杯之伊朗
日期:2015-03-16 10:24:352015亚冠之城南
日期:2015-05-31 09:52:32
9 [报告]
发表于 2014-08-24 17:39 |只看该作者
那个是windows下的虚拟86模式?
windows为了向下兼容,支持虚拟方式跑实模式的dos程序。

论坛徽章:
9
辰龙
日期:2014-08-18 20:38:42未羊
日期:2014-09-04 08:50:45丑牛
日期:2014-09-06 00:12:55寅虎
日期:2014-12-22 20:50:56摩羯座
日期:2015-01-14 22:28:15巳蛇
日期:2015-01-23 20:39:272015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之青岛
日期:2016-03-13 23:37:1915-16赛季CBA联赛之深圳
日期:2016-03-29 18:52:38
10 [报告]
发表于 2014-08-24 20:16 |只看该作者
回复 8# guoyuexiangying
smalloc说得对。
估计以你的情况来看,你应该不会在真正的msdos里写过程序,如果你是windows下,那个是windows下的虚拟86模式。


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP