![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-15 01:35 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS开发编程 & 发展交流 (开发室) » Question about hooking interrupts under DJGPP. |
| Printable Version 1,638 / 1 |
| Floor1 surface | Posted 2003-06-12 00:00 |
| 初级用户 Posts 1 Credits 109 | |
|
How do you use __dpmi_set_protected_mode_interrupt_vector? It seems you also have to lock memory? Is it very cumbersome?
What is the difference between this function and __go32_dpmi_chain_protected_mode_interrupt_vector? My program has two interrupts, and using the chain function causes problems. Could some expert please give me a few pointers! Thanks! |
|
| Floor2 ATLaS | Posted 2003-07-09 00:00 |
| 初级用户 Posts 29 Credits 169 | |
|
I suggest using functions like _go32_xxx to handle interrupt ISRs written in C. The DJGPP FAQ explains it very clearly.
As for chain, it should be avoided, because it will call the old ISR. If there are real mode instructions in it, a mode switch will occur, which greatly affects efficiency. The variables in the ISR and the code segment of the ISR itself should both be locked. Usually there are macros like these: #define END_FUNCTION(x) void x##_end(){} #define LOCK_VARIABLE(x) _go32_dpmi_lock_data((void *)&x, (long)sizeof(x)); #define LOCK_FUNCTION(x) _go32_dpmi_lock_code(x, (long)x##_end - (long)x); ... void my_isr(void) { ... outp(0x20, 0x20); } END_FUNCTION(my_isr); ... Interrupt initialization part: _go32_dpmi_seginfo OldISR, NewISR; LOCK_FUNCTION(my_isr); LOCK_VARIABLE(my_variable); ... _go32_dpmi_get_protected_mode_interrupt_vector(IRQNum, &OldISR); NewISR.pm_offset = (int)my_isr; NewISR.pm_selector = _go32_my_cs(); _go32_dpmi_set_protected_mode_interrupt_vector(IRQNum,&NewISR); //also set the interrupt mask, outp(0x21, inp(0x21) & xxH); ... // main loop here ... _go32_dpmi_set_protected_mode_interrupt_vector(IRQNum, &OldISR); You should avoid mode switching as much as possible, so avoid directly or indirectly calling DOS/BIOS functions. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |