English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 12 August 2022, 15:41   #1
koobo
Registered User
 
koobo's Avatar
 
Join Date: Sep 2019
Location: Finland
Posts: 371
Shell detachment trick crashes on OS4

Hi,

Based on a crash report by @samo79 and with his assistance we discovered that HippoPlayer crashes when exiting on OS4 on a certain spot in the code.

It uses a "detachment" trick which was employed by some applications back in the day. It goes as follows:
  • 1st code hunk cuts the segment list upon starting so that only the 1st hunk remains. It then creates a new process from the 2nd hunk and exits.
  • The 1st segment is unloaded by OS.
  • User sees in the shell that the app returned immediately and is now running. Handy!
  • When exiting, the application unloads the remaining segments by itself. App exits without memory leaks.
The last step is a bit questionable since the app does an UnloadSeg and then continues running the code that was just possibly deallocated from memory. The remaining code closes the DOS library and exits, not much else. This part is then protected by Forbid to make it safe. Works fine on the classic OS! On OS4 the UnloadSeg call crashes.

Two questions:
  • Just as an exercise, is something like this possible on OS4?
  • How do I detect OS4 so that I can skip this technique during runtime? Check if the exec version is 50 or higher?

Also, I know next to nothing about OS4
koobo is offline  
Old 12 August 2022, 15:54   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,062
jmp _LVOUnLoadSeg(a6) (or equivalent) must be the last instruction in the bootstrap code, you cannot close libs etc. after unloading, for obvious reasons.
If you stick with this, app should work on OS4. Unless they deliberately broke this feature (and a number of apps with it, eg. asm-one&co is using it).
a/b is offline  
Old 12 August 2022, 19:52   #3
koobo
Registered User
 
koobo's Avatar
 
Join Date: Sep 2019
Location: Finland
Posts: 371
Thanks! I heard that with this fix there's no total crash every time at exit anymore.
koobo is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear background color for Shell window- Shell-StartUp fc.studio support.Apps 13 25 March 2022 18:52
help with Amiga Shell - quiting shell windows properly lost_lemming support.Apps 2 03 January 2021 19:37
notepad++ trick jotd Coders. Asm / Hardware 3 30 March 2020 18:29
OS4 update - A late xmas present from the OS4 team Paul News 1 28 December 2004 20:48
CLi & Shell CRASHES !!!! THX1138 support.Apps 2 23 January 2003 12:06

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:20.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06966 seconds with 13 queries