Arkady V.Belousov wrote:

Hi!

20-Ноя-2005 16:57 [EMAIL PROTECTED] (Kenneth Davis) wrote to
[EMAIL PROTECTED]:


--- NEW FILE: intwrap.asm ---
reloc_call_int13_handler:
   cli             ; disable other interrupts for now


     INT instruction already disables IFlag.


   stc             ; force error unless BIOS clears


     ?! This is issue of caller to set or reset CFlag.


   push dx         ; store BIOS drive # for error handling usage
   push ds         ; get segment of kernel DATA
   mov  ds, [cs:_DGROUP_]
   pushf           ; simulate int call so returns back here (flags+cs:ip on
stack)
   call far [ds:_UserInt13]


     Bug!!! Here DS register is garbaged, whereas it used by some functions
(for example, INT13/42).

good catch, I rewrote this section several times until I finally tracked down my problem was my usual init-time variables don't match run-time variables [address wise, though the compiler thinks they do, so the UserInt13 initialized wasn't the one used] unless special care is taken. Earlier versions had a different path for ah < 17h versus ah > 17h, which I need to re-add (as the error values returned do not make sense for most functions ah > 17h, but even if not returned, still within same error code group for those less; that or just change it to check on int13/16h )



   pop  ds          ; restore ds
   jc   int13err   ; test if error, if not return to caller
int13iret:
   inc sp          ; clean up stack
   inc sp


   sti             ; ensure int's are renabled
   retf 2          ; return to caller leaving flags asis


     I don't think that this is right way, because caller may disable
interrupts for own purposes, whereas here interrupts enabled.

I'm not sure what is correct here, but I suppose it should simply leave the flag as the user had it (I think I added this after reading a note somewhere in RBIL about a bug in earlier BIOSes that failed to do this).



int13wrap:
%IF XCPU < 186
   push ax         ; preserve registers, setup stack frame
   push bp
   mov  bp, sp
   mov  ax, 13h    ; want to push 0x13 onto stack
   xchg ax, [bp+2] ; so restore pushed ax value and put 0x13 on stack
   pop  bp         ; clean up stack frame (leaving just 0x13 pushed on stack)


        push    bp
        push    bp
        mov     bp,sp
        mov     word [bp+2],13h
        pop     bp


I like it, cleaner and removes the easy to overlook restoration of ax


Thanks for reviewing these patches,
Jeremy





-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Freedos-kernel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to