我正在开发在x86实模式下运行的选项ROM(扩展ROM)的INT 13H磁盘服务例程。 我需要在例程执行时访问位于 DS(DS=CS) 的全局变量,但全局变量变为只读! 只有位于SS(SS!=DS)处的局部变量可以正常访问,但栈的大小不够。 例程中我需要的大小约为 2KB。我的问题是:
- 是否可以将数据存储到例程中的全局变量中?
- 如何在例程中查找/定位 2KB 可用内存?
非常感谢。
int global_var;
void __far int13h_isr(void)
{
int local_var;
__asm
{
push ds
push es
mov bx, cs
mov ds, bx
mov es, bx
};
global_var = 0x22; // global variable can NOT store 0x22 in the routine.
local_var = 0x22; // local variable can store 0x22 correctly.
__asm
{
pop es
pop ds
};
}
最佳答案
INT 13H disk service routine of option rom(expansion rom) Is it possible to store data into global variables in the routine?
数据无法存储到ROM中。如果在加载设备驱动程序之前需要内存,则扩展卡将需要它自己的内存。
How to find/locate 2KB usable memory in the routine?
设备驱动程序及其 ISR 可以分配内存,但 MSDOS 或其他操作系统必须能够在使用任何扩展特定的 INT 13H 调用之前启动并加载设备驱动程序。
关于c - 如何在x86实模式ISR中将数据存储到全局变量中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48010490/