Bug in "*_no_fail" functions

Marco Baye Marco.Baye at tu-clausthal.de
Thu Dec 20 21:26:33 GMT 2001


Hi!

I just found a bug in the OS Lib functions
  os_change_dynamic_area_no_fail(),
  xos_change_dynamic_area_no_fail(),
  osheap_resize_no_fail() and
  xosheap_resize_no_fail().

After they kept delivering exactly those errors they should
suppress, I checked the executable file. Here's the result:

In xos_change_dynamic_area_no_fail():

0000A770   SWI   XOS_ChangeDynamicArea
0000A774   BVC   &0000A784
0000A778   LDR   R1,&0000A794; get error number of error to suppress
0000A77C   CMP   R0,R1
0000A780   BNE   &0000A790
...
0000A794 : &000001C1; error number

In xosheap_resize_no_fail():

0000A720   MOV   R0,#5; "resize" reason code
0000A724   SWI   XOS_Heap
0000A728   BVC   &0000A73C
0000A72C   LDR   R1,&0000A74C; get error number of error to suppress
0000A730   CMP   R0,R1
0000A734   BNE   &0000A748
0000A738   RSB   R3,R3,#0; adjust return value (thanks!)
0000A73C   TEQ   R2,#0
0000A740   STRNE R3,[R2,#0]
0000A744   MOV   R0,#0
0000A748   MOVS  PC,R12

0000A74C : 00000187; error number for "Can't shrink heap any further"

In both cases, the CMP instruction compares the fixed error number
to the returned *error block pointer* instead of to the error
number in the returned error block.
So there's just a "LDR R0, [R0]" instruction missing in each case.

I dowloaded and installed the latest release of OS Lib a few days
ago, and I subscribed to this list just half an hour ago. So please
forgive me if this topic has already been discussed at length
before.

Cu,

Marco Baye

-- 
ntalk://Marco@dionin.esw-heim.tu-clausthal.de
65816 Cross assembler    (RISC OS,DOS/Win,Unix/Linux,AmigaOS,OS/2)
ntalk, CBM drive access  (RISC OS)
Mouse driver, boot maker (C-128)
=> http://home.pages.de/~mac_bacon/ <=

... Last Christmas I got a computer for my Girlfriend - Good Trade !



More information about the oslib-user mailing list