xos_change_dynamic_area_no_fail bug

David Mullard David at mullard.net
Tue Feb 19 21:51:56 GMT 2002


I believe this function still has a bug in it.  This is the relevant
extract.

        ;Test for Error_ChDynamNotAllMoved -  return any other error
	       LDR 	   R1, =Error_ChDynamNotAllMoved
	       LDR	    R2, [R0]		      ; get error number in R2 [TV 011221]
	       CMP 	   R2, R1
	       BNE	    %99			          ; return error

	       ; ignore Error_ChDynamNotAllMoved

	       ; valid return
90	     TEQ	    A3, #0			       ; check null pointer
	       STRNE	  R3, [A3]		      ; output R3
	       MOV	    R,  #0			       ; clear error pointer

After execution, OS_ChangeDynamicArea returns the actual amount moved in
R1.  Unfortunately, the function as written assumes it is in R3 - see
STRNE instruction. Obviously copied from the OS_HEAP... function :) I show
a suggested correction below which includes a change to the error return
code check to avoid destroying R1.


        ;Test for Error_ChDynamNotAllMoved -  return any other error
	       LDR     R3, =Error_ChDynamNotAllMoved
	       LDR	    R2, [R0]		      ; get error number in R2 [TV 011221]
	       CMP 	   R2, R3
	       BNE	    %99			          ; return error

	       ; ignore Error_ChDynamNotAllMoved

	       ; valid return
90	     TEQ	    A3, #0			       ; check null pointer
	       STRNE	  R1, [A3]		      ; output R1
	       MOV	    R,  #0			       ; clear error pointer


It won't stand still will it :))  All your work is very much appreciated Tony.

-- 
Dave Mullard <David at mullard.net>




More information about the oslib-user mailing list