Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for HDD size calculation, new poweroff processing mechanism, fixed PBUF allocation for Ethernet ARP request, new option for SMSTCPIP to save more RAM. #44

Merged
merged 4 commits into from
Mar 4, 2017

Conversation

sp193
Copy link
Contributor

@sp193 sp193 commented Mar 2, 2017

Pull Request checklist

Note: these are not necessarily requirements

  • I reformatted the code with clang-format
  • I checked to make sure my submission worked
  • I am the author of submission or have permission from the original author.

Pull Request description

45e99f0 - Fixed HDD partition size calculation. Originally, our HDD.IRX module used to return the partition size in bytes. Eventually, that got changed to fit the official documentation, which returns in 512-byte sectors.
8cadeb4 - Corrected bug in PBUF allocation for Ethernet ARP requests and changed the SMAP output function to always assume that outgoing PBUFs are always aligned (for performance). Previously, the outgoing PBUFs were occasionally unaligned because of this glitch.
4a9a5a7 - As of the recent PS2SDK commit, poweroff no longer automatically switches off DEV9 as a safety measure. OPL will now deinitialize the GUI before switching off DEV9, before finally switching off the PS2.
13d1347 - Our SMSTCPIP module is based on an ancient version of LWIP, which always uses its own memory heap allocator (even though SYSMEM can fill that requirement). This patch adds and enables a new option (MEM_LIBC_MALLOC), which functions like the official version from the newer versions of LWIP.

… align with the official documentation; size is now in 512-byte HDD sectors).
…changed SMAPSendPacket to assume that all PBUFs are aligned.

etharp_query requests PBUF_LINK from pbuf_alloc(), but does not reveal the Ethernet header.
It is possible that this also writes beyond the end of the PBUF.
…s like the official option from newer LWIP versions.
@ElPatas1
Copy link
Contributor

ElPatas1 commented Mar 4, 2017

Hi SP193, then you fixed the slight problem you mentioned before? all is ok? after this commit is needed update the PS2SDK?

@sp193
Copy link
Contributor Author

sp193 commented Mar 4, 2017

The "slight" problem that I saw, was in ps2ip_mem_realloc(). With its current design, it does not actually function in the same way as the standard realloc() function. Whereby it does not attempt to allocate new memory, if the specified region of memory cannot be resized.

However, it seems like mem_realloc() - the function which ps2ip_mem_realloc() is used to implement, is only used by pbuf_realloc(). pbuf_realloc will only shrink the size of the allocated buffer with mem_realloc(), so I really don't think that ps2ip_mem_realloc() can possibly fail. Hence the only thing that I changed between these two commits, is to add a comment about this. There is actually no problem. :)

There are no accompanying updates to the PS2SDK for this pull request.

@ElPatas1 ElPatas1 merged commit 9640e66 into ps2homebrew:master Mar 4, 2017
@ElPatas1
Copy link
Contributor

ElPatas1 commented Mar 4, 2017

Thank you very much for the explanation and the work, and have a good weekend :)

@sp193
Copy link
Contributor Author

sp193 commented Mar 4, 2017 via email

Jay-Jay-OPL added a commit to Jay-Jay-OPL/OPL-Daily-Builds that referenced this pull request Mar 5, 2017
Fix for HDD size calculation, new poweroff processing mechanism, fixed PBUF allocation for Ethernet ARP request, new option for SMSTCPIP to save more RAM. (ps2homebrew#44)

* Corrected HDD partition size calculation (change in homebrew specs to align with the official documentation; size is now in 512-byte HDD sectors).

* (ingame SMSTCPIP) Fixed pbuf allocation for Ethernet ARP request and changed SMAPSendPacket to assume that all PBUFs are aligned.

etharp_query requests PBUF_LINK from pbuf_alloc(), but does not reveal the Ethernet header.

It is possible that this also writes beyond the end of the PBUF.

* Changed GUI power-off to deinitialize the UI and to switch off DEV9, before power off.

* Added new MEM_LIBC_MALLOC option to mem.c and enabled it. It functions like the official option from newer LWIP versions.
AKuHAK pushed a commit that referenced this pull request Sep 30, 2021
…d PBUF allocation for Ethernet ARP request, new option for SMSTCPIP to save more RAM. (#44)

* Corrected HDD partition size calculation (change in homebrew specs to align with the official documentation; size is now in 512-byte HDD sectors).

* (ingame SMSTCPIP) Fixed pbuf allocation for Ethernet ARP request and changed SMAPSendPacket to assume that all PBUFs are aligned.

etharp_query requests PBUF_LINK from pbuf_alloc(), but does not reveal the Ethernet header.
It is possible that this also writes beyond the end of the PBUF.

* Changed GUI power-off to deinitialize the UI and to switch off DEV9, before power off.

* Added new MEM_LIBC_MALLOC option to mem.c and enabled it. It functions like the official option from newer LWIP versions.
citronalco pushed a commit to citronalco/OPL-Daily-Builds that referenced this pull request Sep 10, 2023
…d PBUF allocation for Ethernet ARP request, new option for SMSTCPIP to save more RAM. (ps2homebrew#44)

* Corrected HDD partition size calculation (change in homebrew specs to align with the official documentation; size is now in 512-byte HDD sectors).

* (ingame SMSTCPIP) Fixed pbuf allocation for Ethernet ARP request and changed SMAPSendPacket to assume that all PBUFs are aligned.

etharp_query requests PBUF_LINK from pbuf_alloc(), but does not reveal the Ethernet header.
It is possible that this also writes beyond the end of the PBUF.

* Changed GUI power-off to deinitialize the UI and to switch off DEV9, before power off.

* Added new MEM_LIBC_MALLOC option to mem.c and enabled it. It functions like the official option from newer LWIP versions.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants