flat assembler
Message board for the users of flat assembler.
Index
> DOS > TSR with resident uninstaller |
Author |
|
ACP 03 Aug 2014, 20:01
Aren't you forgetting that DOS has no memory protection and is no re-entrant OS even if you consider INDOS flag? There are billions of ways to actually make the system hang or break it's internal structures...
Basically after freeing memory (using int 21h function 49h) you should return from interrupt ASAP assuming you are calling free memory from your ISR. Nevertheless you shouldn't call int 21h from your timer ISR because you will break something without proper checks Secondly if you really need more memory why not get away with help of DOS Extender, DPMI or VCPI or XMS/EMS? |
|||
03 Aug 2014, 20:01 |
|
axlucas 10 Aug 2014, 01:03
During the execution of your unloading function, if interrupts are disabled (which probably is the case), you could say that it's rather safe to free the memory, but you shouldn't do it by calling int 21h. Instead, first disable whatever triggers your ISR, so that nobody jumps to the free memory area later; then set up registers as if you were going to call the free memory function of int 21h, finally, execute a far jump to int 21h vector. This will free the memory block, but none of your code is left to be executed. When the function ends, IRET will take it back to wherever your ISR was called from and you're done.
I don't have a lot of experience doing this, though, so anybody finding a bug in my idea, please do correct me. |
|||
10 Aug 2014, 01:03 |
|
baldr 10 Aug 2014, 16:41
axlucas,
Unfortunately, that may resume execution of interrupted code with corrupted registers. |
|||
10 Aug 2014, 16:41 |
|
axlucas 11 Aug 2014, 00:06
Baldr: You're right! I forgot about that. But now I am thinking this: if the TSR is designed by somebody knowning that they are going to call this particular function, they could choose the registers carefully so that the same are used as for the DOS function. That way, there shouldn't be a problem!
|
|||
11 Aug 2014, 00:06 |
|
ACP 11 Aug 2014, 09:59
axlucas
I think you are missing the fact that SeproMan talks about the case of hooking timer interrupt which complicates in DOS compatible systems such cases a lot. There was a good reason why DOS Idle interrupt has been added to the OS in the first place and why Indos flag has been available for so long in DOS (although MS did not document it at the begging). |
|||
11 Aug 2014, 09:59 |
|
sinsi 11 Aug 2014, 10:10
Your TSR should have a command line switch like /unload
This lets you tell the resident part to unhook any INTs (if it can), free any extra memory and return a code. If the code is OK then you can safely free the (inactive) resident part's memory. |
|||
11 Aug 2014, 10:10 |
|
ACP 13 Aug 2014, 18:14
If I understand the original question correctly this is more race condition issue here since instead of DOS Idle INT, timer interrupt is being used. To make long story short: using timer interrupt for calling DOS function and (re)allocating memory without appropriate precaution taken is always a bad idea.
|
|||
13 Aug 2014, 18:14 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.