Skip to content

Commit

Permalink
bugfix: asix_ioctl() should return 0 for unsupported features
Browse files Browse the repository at this point in the history
Previously returned uninitialized stack value.  This broke ifmtu() and likely other functions on ASIX-based boards.
  • Loading branch information
tomlogic committed Jan 29, 2016
1 parent ef9c6af commit 18114a8
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions Lib/Rabbit4000/tcpip/ASIX.LIB
Expand Up @@ -1318,6 +1318,7 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
ld hl, PD_NETWORK_MODE
cp hl, de
jp eq, .asix_ioctl_networkmode
clr hl
jp .asix_ioctl_return

.asix_ioctl_hasfeature:
Expand Down Expand Up @@ -1356,7 +1357,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
clr hl
inc hl
.asix_hasfeaturedone:
ld (sp+@sp+retval),hl
jp .asix_ioctl_return

.asix_ioctl_initialize:
Expand All @@ -1372,7 +1372,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
push hl
asix_internal_call(asix_resetinterface)
add sp,6
ld (sp+@sp+retval),hl

jp .asix_ioctl_return

Expand All @@ -1383,7 +1382,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
push hl
asix_internal_call(asix_havelink)
add sp,2
ld (sp+@sp+retval),hl
jp .asix_ioctl_return

.asix_ioctl_power:
Expand All @@ -1404,14 +1402,12 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
asix_internal_call(asix_powerdown)
.asix_ioctl_powerdone:
add sp,2
ld (sp+@sp+retval),hl
jp .asix_ioctl_return

.asix_ioctl_pstatus:
ld hl,(sp+@sp+nic)
ld hl,(hl+[_ASIXConfig]+pwrstate)
ld h,0
ld (sp+@sp+retval),hl
jp .asix_ioctl_return

.asix_ioctl_sethwa:
Expand All @@ -1426,7 +1422,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
asix_internal_call(ne2k_sethwaddr)
add sp,4
clr hl
ld (sp+@sp+retval),hl
jp .asix_ioctl_return

.asix_ioctl_gethwa:
Expand All @@ -1443,7 +1438,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
inc hl
ld (hl),d
ld hl,sizeof(nic->hwa)
ld (sp+@sp+retval),hl
jp .asix_ioctl_return

#ifdef USE_MULTICAST
Expand All @@ -1462,7 +1456,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
push hl
asix_internal_call(ne2k_addmulticast)
add sp,6
ld (sp+@sp+retval),hl
jp .asix_ioctl_return

.asix_ioctl_removemulticast:
Expand All @@ -1475,7 +1468,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
push hl
asix_internal_call(ne2k_removemulticast)
add sp,4
ld (sp+@sp+retval),hl
jp .asix_ioctl_return
#endif
.asix_ioctl_readreg:
Expand All @@ -1488,7 +1480,6 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
push hl
asix_internal_call(asix_prt_readreg)
add sp,4
ld (sp+@sp+retval),hl
jp .asix_ioctl_return
.asix_ioctl_networkmode:
;case PD_NETWORK_MODE
Expand All @@ -1503,11 +1494,10 @@ asix_external_func int asix_ioctl(_ASIXConfig * nic, int cmd, ...)
push hl
asix_internal_call(asix_networkmode)
add sp, 6
ld (sp+@sp+retval), hl
jp .asix_ioctl_return
;}
.asix_ioctl_return:
ld hl,(sp+@sp+retval)
.asix_ioctl_return: ; return value is in HL
ld (sp+@sp+retval), hl
#endasm
return retval;
}
Expand Down

0 comments on commit 18114a8

Please sign in to comment.