English Amiga Board

Go Back   English Amiga Board > Support > support.WinUAE

Thread Tools
Old 16 April 2022, 12:17   #1
Not a Rebel anymore
Phantasm's Avatar
Join Date: Apr 2005
Location: UK
Age: 49
Posts: 406
Native code (eg bsdsocket.library) and multi-tasking

A quick question for Toni. How does executing native x86 code (such as the emulated bsdsocket.library calls) function with regard to multi-tasking in WinUAE? Is it possible for multi-tasking context switches to take place during a blocking call to bsdsocket.library for example?

If the Amiga OS just sees these calls as a single 680x0 instruction which causes the native code to be triggered then I would assume no context switching is possible until the native code has completed but that doesn't seem to be the case because we don't see any indication of that happening with regard to things freezing.

I am interested to know how this works and if there are any limitations around this.
Phantasm is offline  
Old 16 April 2022, 17:13   #2
Toni Wilen
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 47
Posts: 25,403
bsdsocket uses host-side threads that handle all the blocking winsocket calls.

Also if bsdsocket native code needs to call for example exec (or any uae expansion that has native part), it returns back to 68k side by hijacking original Amiga task that called bsdsocket function and uses it to call exec/Wait or similar functions (Amiga side memory allocation, exec messages etc). When function returns it restores context (registers) and continues normally.

Amiga task -> bsdsocket library function -> native trap -> native code -> back to m68k side and call exec/wait -> back to native code -> bsdsocket library call returns is one example.

It is quite flexible system, any Amiga side library LVO can be called as long as base address is known and it can be called from any task (does not require process). Recursive calling is not possible.
Toni Wilen is offline  
Old 19 April 2022, 10:12   #3
Not a Rebel anymore
Phantasm's Avatar
Join Date: Apr 2005
Location: UK
Age: 49
Posts: 406
thanks for the explanation
Phantasm 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
Cannot select bsdsocket.library? floppyrobby support.WinUAE 6 24 October 2020 16:17
"Multi-tasking ready" games. vext01 Retrogaming General Discussion 19 15 May 2019 09:52
Bsdsocket.Library Emufr3ak Coders. Asm / Hardware 5 25 December 2016 11:20
Crosscompiling with bsdsocket.library ciVic Coders. General 6 05 January 2016 11:56
winuae bsdsocket.library clauddio support.WinUAE 5 21 July 2015 21:47

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 15:21.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Page generated in 0.06347 seconds with 15 queries