c - 调用8259A的时钟中断0x20中断时,跳转到0xf000:fff0
问题描述
我正在尝试编写一个微内核。当我想从内核跳转到第一个进程时,时钟中断有问题。当代码仍在内核中时, i sti
and int 0x20
and 代码确实会跳转到时钟处理程序。使用iret
返回第一个进程后,我尝试int 0x20
在进程中,但它没有跳转到时钟处理程序和 f000:fff0。仅供参考:eflags 在过程中间是 0x1212。我在 bochs 中刺激 x86 机器。
我想知道它无法跳转到时钟处理程序的原因。
如果需要更多细节,请告诉我。感谢您提前回复。
%include "const.inc"
extern cstart ;function
extern gdtPos ;global variable
extern idtPos ;global variable
extern dispPos ;global variable
extern PCBready ;global variable
extern intReEnterFlag ;global variable
extern tss ;global variable
global LABEL_TOPOFSTACK
global halt
[SECTION .bss]
LABEL_STACK_KERNEL: resb 2*1024
LABEL_TOPOFSTACK:
[SECTION .text]
global _start
_start:
mov esp,LABEL_TOPOFSTACK ;LABEL_TOPSTACK=0x32800 ss=0x10
mov dword [dispPos],0x00 ;label dispPos is 0x32800
mov dword [intReEnterFlag],0x00
sgdt [gdtPos];label gdtPos is 0x32c20
call cstart
lgdt [gdtPos]
lidt [idtPos] ;label idtPos is 0x32804
jmp MACRO_SelectorFlatC:csinit
csinit: ;0x08:0x3043a
;start the first process, recover the first process field
mov ax,MACRO_SelectorTSS
ltr ax
mov esp,[PCBready]
lldt [esp+MACRO_P_PCBSel]
lea eax,[esp+MACRO_P_STACKTOP]
mov dword [tss+MACRO_T_ESP0],eax
dec dword [intReEnterFlag]
pop gs
pop fs
pop es
pop ds
popad
;sti
;hlt
add esp,4
iretd
halt:
int 0x20
hlt
ret
#include "type.h"
#include "const.h"
#include "intVector.h"
#include "important.h"
#include "process.h"
#include "prototype.h"
#include "task.h"
#include "global.h"
void halt();
PUBLIC void TestA() { //0x05:0x30d01
halt();
int i = 0;
while (1) {
dispPos = 0;
dispStr("A");
dispInt(i++);
dispStr(".");
}
}
解决方案
推荐阅读
- mysql - 选择和子选择 UPDATE Mysql 案例学科 x 技术
- hibernate - Kotlin、Micronaut 和 Hibernate 自定义 bean 验证器从未被调用
- linux - 循环遍历不同的文本文件
- ssas - MDX 中是否会自动创建关卡?或者我是否在 BIDS 中有设置
- javascript - 从包含时区的字符串创建时刻日期时忽略时区
- python - 使用 bbox 参数从图像中去除水印
- reactjs - 反应中的嵌套动态表单字段
- ios - 如何在科尔多瓦上删除 ios 地理定位身份验证请求消息
- c# - C# Composition - 不完全确定我是否正确实施
- javascript - 根据另一个数组中的值替换数组的值