Mail Archives: djgpp/2005/10/06/05:46:36
Hi All!
I'm developing a DJGPP TSR which will be a installable FS to access Ext2
partitions from DOS. I have in place all the code to keep the TSR, hook some
interrupts and such. However, I'm stuck with INT 21h.
I want to hook INT 21h, to provide LFN support and some more functions. The
following is a sample of the actual code I'm using to hook INT 2F,
but it does not work with INT 21h.
Please note before replying: This is a protected mode TSR, which returns to
DOS. The problem is similar to calling system() with INT 21h hooked.
//-------------------------------------------------------------------------
// All memory is LOCKED. No virtual memory.
int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY;
//-------------------------------------------------------------------------
void my_handler(_go32_dpmi_registers *r)
{
if (r->h.ah == OUR_FUNCTION) {
// Do work
return;
}
r->x.cs = oldInt2F.rm_segment;
r->x.ip = oldInt2F.rm_offset;
r->x.ss = r->x.sp = 0;
_go32_dpmi_simulate_fcall_iret(r);
}
//-------------------------------------------------------------------------
void install_handler()
{
_go32_dpmi_get_real_mode_interrupt_vector(0x2F, &oldInt2F);
info.pm_offset = (unsigned long)my_handler;
_go32_dpmi_allocate_real_mode_callback_iret(&info, ®s);
_go32_dpmi_set_real_mode_interrupt_vector(0x2F, &info);
}
I'm aware of the reentrance problem, however, I don't know how to handle it.
It will be very useful to see some sample code which already solves this.
I will not call any INT 21h functions inside my handler, at least I'm not
planning to, so reentrancy should not be a problem for me besides DJGPP
itself calling INT 21h.
Please, I'm in a hurry, since the entire project is stopped until I can
solve this. It will be very useful if you have some links to source code
that already does this or some documentation I can read. I'm not very good
at assembly code, but if you know of a solution in assembly it will be
welcome.
Cheers,
Jose Miguel.
- Raw text -