_nosay 发表于 2016-04-06 14:45

关于int指令的疑问?

本帖最后由 _nosay 于 2016-04-06 14:50 编辑

实模式时,int指令调用的是bios提供的中断服务功能,保护模式时,int指令调用的是arch/i386/kernel/traps.c里面设置的中断服务程序吧?
说明bios所有中断号及参数的官方文档叫什么?http://www.intel.com/搜什么能找到{:qq27:} ?void __init trap_init(void)
{
#ifdef CONFIG_EISA
        if (isa_readl(0x0FFFD9) == 'E'+('I'<<8)+('S'<<16)+('A'<<24))
                EISA_bus = 1;
#endif

        set_trap_gate(0,&divide_error);
        set_trap_gate(1,&debug);
        set_intr_gate(2,&nmi);
        set_system_gate(3,&int3);        /* int3-5 can be called from all */
        set_system_gate(4,&overflow);
        set_system_gate(5,&bounds);
        set_trap_gate(6,&invalid_op);
        set_trap_gate(7,&device_not_available);
        set_trap_gate(8,&double_fault);
        set_trap_gate(9,&coprocessor_segment_overrun);
        set_trap_gate(10,&invalid_TSS);
        set_trap_gate(11,&segment_not_present);
        set_trap_gate(12,&stack_segment);
        set_trap_gate(13,&general_protection);
        set_trap_gate(14,&page_fault);
        set_trap_gate(15,&spurious_interrupt_bug);
        set_trap_gate(16,&coprocessor_error);
        set_trap_gate(17,&alignment_check);
        set_trap_gate(18,&machine_check);
        set_trap_gate(19,&simd_coprocessor_error);

        set_system_gate(SYSCALL_VECTOR,&system_call);

        ...
}

nswcfd 发表于 2016-04-06 17:19

http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

vol 1,Chapter 6,Table 6-1

amarant 发表于 2016-04-07 18:02

用 x86 来学习内核和体系架构是找虐。。x86是一个设计的很差的处理器,只有他的设计者会喜欢这个体系架构

_nosay 发表于 2016-04-08 12:16

回复 3# amarant

都已经被虐了,不早说。。

amarant 发表于 2016-04-08 17:17

回复 4# _nosay


    纯学习目的,可以看看 OpenRISC。这个体系架构的kernel代码非常少,一下就看完了。而且体系架构非常简单,半天就学会了。
如果要考虑工作因素,可以看看 arm64 的,armv8 吸取了很多 MIPS 的设计优势,算比较好的了。但是因为还有一个 aarch32 为了保持对 armv7 的兼容,还是有些容易绕晕人的概念

学习资料,有一本《see mips run linux》的书,几百页的样子,仔细读完肯定会有收获。

amarant 发表于 2016-04-08 17:20

开发平台不一定要在真实硬件上完成,其实模拟器比真实硬件还要更方便调试。openrisc 有一个 or1ksim 挺好的。arm 和 mips 使用 qemu 都是不错的。
我前些天比较闲的时候写了一个脚本搭建整套 kernel 开发环境的,你要有兴趣可以玩玩。
代码托管在
https://github.com/zhizhouzh/clfs-arm64

_nosay 发表于 2016-04-08 18:19

回复 6# amarant

嗯 {:qq13:}。
页: [1]
查看完整版本: 关于int指令的疑问?