• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Fix networking in Basilik II under Linux

rickyzhang

Well-known member
I'm not an expert on Linux device programming. But I really want to fix Basilik II networking for Fedora 20 with 3.15.x kernel. 

So far I think I have fixed sheep_net module (partially). The module can be compiled in modern kernel. I can ping to outside URL and ftp to the server in local network. But I can't do web browsing.

tun/tap is new to me. I fixed tunconfig script and configure script. I'm still reading related material and the fix is work-in-progress.

1. Sheep_net module works but not fully functioning.

https://github.com/rickyzhang82/macemu/commit/168ee7733be7a730c77cb736191fb887c2052388

2. tun/tap

https://github.com/rickyzhang82/macemu/commit/75a397f52fa20ed4a2a945661753d7832a6ca9ea

I have posted my work in emulation forum but it doesn't seem to gain any traction. Please let me know if anyone have some clues on this great stuff. TIA 

 

Gorgonops

Moderator
Staff member
I know this is probably a dumb question, but what's the official source repository for Basilisk II these days? Is it the Sourceforge page?

 

neozeed

Member
Hi there, I've started a rehash of older Basilisk II espeically to fit my networking needs.  To try to avoid all the naming confusion, I'm calling it Cockatrice III.

This isn't the newest source by any long shot, and I'm sure it's full of bugs (actually I know several right off the top of my head) but the major goal has been to improve the networking.

So with this 0.0-1 release I've included SLiRP and PCAP support.  No more tun/tap/bridge crap, instead on OS X, Linux and Windows, you just use a WIRED Ethernet interface, and you can DHCP an address, and even use AppleTalk.

I've done my best to make the SLiRP code more stable, and I've been able to download files over 100MB without issue.  You can even use Internet Explorer 4 and it doesn't crash out in seconds.

So there are of course some limitations, I've gutted the serial port support as I've had issues with the c++ constructor there for some reason and I'm not interested in that right now.  I've also fixed the display to being 8 bit only.  The CPU core is from BasiliskII-0.9, so it is pretty ancient.  Also there is NO JIT, as I'm hoping to start integrating the WinUAE CPU core as it has a solid enough 68030 and 68040 support that can run Linux, NetBSD, AMIX, and the 'Previous' project has been able to boot up NeXTSTEP with it.

I'm not even thinking about a full hardware emulator right now, if you want to run A/UX there is Shoebill which does a pretty good job of it right now.

Anyways give Cockatrice III a shot, and let me know if it fits your needs.

https://sourceforge.net/projects/cockatrice/

 

wthww

Computer Janitor
Staff member
Wow, this is pretty great neozeed; thanks for posting here. I'll be following your efforts closely, as you had me at WinUAE cpu core. Who knew I was such an easy date?

//wthww

 

neozeed

Member
Wow, this is pretty great neozeed; thanks for posting here. I'll be following your efforts closely, as you had me at WinUAE cpu core. Who knew I was such an easy date?

//wthww
Cool!  I'm working out some more stuff with timers, and screen updates for SDL since that's how I drive OS X.. I also found some other weird issues with SLiRP with VIsual C++ .. it's good for something.   I'm at least making some progress.  This old stuff wasn't fast back then, but in the age of 3+ Ghz CPU's it doesn't matter as much.

Im more so amazed this stuff works as well as it does!

 

IPalindromeI

Well-known member
cool beans bro!

I think one goal would to slowly add accuracy to the various emulation. You don't need to be A/UX accurate, but having the emulation be less sloppy and more stable would be great.

 

CC_333

Well-known member
One thing I'd like to see is more accurate disk emulation. Basilisk II and SheepShaver seem to present disks as giant floppy drives, which make for some weird software issues for programs that require "real" disks (usually formatting software and such). Maybe make it switchable between SCSI and IDE for maximum compatibility?

Another thing would be to use real hardware disks when possible. Like, the emulator can use a real HFS formatted disk connected to a real port (either IDE or USB) on the host computer (in addition to image files, of course). Small-ish SD cards would be ideal for this, and with a properly configured SCSI card, it can make diagnosing, formatting, and using SCSI disks possible without a real Mac (early versions of BII did this, but it got lost sometime during the last 9 or so years since those early versions were current).

And proper MMU emulation on SheepShaver would be superb, as it would allow for the full range of PPC Mac OSes, from System 7.1.2 through Mac OS 9.2.2.

And, except maybe the MMU, most of this should be relatively trivial.

c

 

neozeed

Member
One thing I'd like to see is more accurate disk emulation. Basilisk II and SheepShaver seem to present disks as giant floppy drives, which make for some weird software issues for programs that require "real" disks (usually formatting software and such). Maybe make it switchable between SCSI and IDE for maximum compatibility?

Another thing would be to use real hardware disks when possible. Like, the emulator can use a real HFS formatted disk connected to a real port (either IDE or USB) on the host computer (in addition to image files, of course). Small-ish SD cards would be ideal for this, and with a properly configured SCSI card, it can make diagnosing, formatting, and using SCSI disks possible without a real Mac (early versions of BII did this, but it got lost sometime during the last 9 or so years since those early versions were current).

And proper MMU emulation on SheepShaver would be superb, as it would allow for the full range of PPC Mac OSes, from System 7.1.2 through Mac OS 9.2.2.

And, except maybe the MMU, most of this should be relatively trivial.

c
To do disk I'll need to pick a model and just try to emulate enough of that hardware to make the ROM happy... And mess does that now, if you can deal with it's disk formats.  When using Shoebill it can use (command line) partitioned disks, which basillisk can mount.  Ironically the code for mounting disks with partition tables was always there, but it was only being used for CD-ROM's.

I'm trying to get a newer cpu core into this thing, but of course that is a big goal.  I've been trying to make SLiRP more stable with VC++ ... I've also added in the idletimer which works great on VC, but doesn't work great with GCC based stuff.  But it's slowly getting there.

 

IPalindromeI

Well-known member
@CC: i'm pretty sure you can point it at a raw unmounted disk, like /dev/sdb2 or /dev/rsd5c or something

are there any fixes worth backporting?

 
Last edited by a moderator:

neozeed

Member
@CC: i'm pretty sure you can point it at a raw unmounted disk, like /dev/sdb2 or /dev/rsd5c or something

are there any fixes worth backporting?
I think my slirp is more solid. The version I downloaded of basilisk would crash so quickly trying to download stuff.

I can actually use internet explorer. The pcap is also nice to have.

Also it feels like compiling for size gets a faster emu

 

neozeed

Member
probably because of CPU cache
That is what I was figuring I get a .5 or under exe so that helps a bunch with modern processors with multi-megabyte on die l3's.

i'm not sure how much of it was visual C++'s debugger or what but on Windows with winsock it gets very confused with struct socket stuff with a clash from winsock2.h and the slirp stuff.  I also put some minor protection around some stuff I kept seeing come back with NULL addresses. 

From slirp_input to inputting packets into basilisk's ethernet I shoved them into a queue as I noticed I was receiving more packets than I was processing them when I was hammering the interface.  I'm getting 80kb/sec as a max, the same level I managed to get with this code with Shoebill.

 

NJRoadfan

Well-known member
Somehow I managed to get all this working on the same machine. Its not stable by any means, but it did make for a pretty screen shot.

-A2SERVER prepackaged Linux VM running netatalk 2.2.4 and running as an Appletalk router with one zone

-neozeed's custom Basilisk II running OS 8.1. It can see the server, but won't connect (likely WInPcap clashing). It'll work with other physical machines on the network and prints to my HP Laserjet.

-GSport 0.31 running GS/OS 6.0.1 connects to but the A2SERVER Linux VM and Basilisk II shares without a problem

One weird problem. GSport will crash and segfault if its running Appletalk and Basilisk II boots. Something Basilisk II sends over Appletalk is likely causing the problem and its likely WinPcap clashing again.

Appletalking.png

 

neozeed

Member
Somehow I managed to get all this working on the same machine. Its not stable by any means, but it did make for a pretty screen shot.

-A2SERVER prepackaged Linux VM running netatalk 2.2.4 and running as an Appletalk router with one zone

-neozeed's custom Basilisk II running OS 8.1. It can see the server, but won't connect (likely WInPcap clashing). It'll work with other physical machines on the network and prints to my HP Laserjet.

-GSport 0.31 running GS/OS 6.0.1 connects to but the A2SERVER Linux VM and Basilisk II shares without a problem

One weird problem. GSport will crash and segfault if its running Appletalk and Basilisk II boots. Something Basilisk II sends over Appletalk is likely causing the problem and its likely WinPcap clashing again.
Yeah it's a common problem injecting packets this way.  You can 'try' to add in a MS Loopback adapter, and bridge it to your ethernet.  I've been able to do that and use a VMWare NT 4 server with AppleTalk, and communicate with it that way as an all in on.

From what I've found online:

  1. Click the Start menu.
  2. Search for “cmd".
  3. Right-click on “cmd” and select “Run as Administrator”
  4. Enter “hdwwiz.exe”
From that point on it's the same approach as under Vista, i.e.:

  1. In the "Welcome to the Add Hardware Wizard", click Next.
  2. Select "Install the hardware that I manually select from a list (Advanced)" and click Next.
  3. Scroll down and select "Network adapters" and click Next.
  4. Select under Manufacturer "Microsoft" and then under Network Adapter "Microsoft Loopback Adapter" and click Next.

Which worked fine for me in Windows 7.  I haven't bothered with the Windows 8 rabbit hole.

Once you do that, bridge the two connections  (http://windows.microsoft.com/en-hk/windows/create-network-bridge#1TC=windows-7)

reboot, and re-scan the Ethernet interface, and then have Basilisk use the bridge interface.  I don't know how much of it is System 8.0 being crap, the crap emulation but I have major issues with TCP/IP and AppleTalk..  For AppleTalk stuff System 7.1.1 (the only 7 I've tested to be honest) with a IIvi ROM

cpu     3
fpu     true
modelid 38
rom     maciivi.rom
 
md5.exe maciivi.rom
a207e03d7da82ac6ec63359915c17904 maciivi.rom
 

I know it's pokey all around, and watching it in wireshark there are some dramatic pauses here and there.

I've also seen that if you disable the FPU on the 68040 stuff with later ROMs some stuff runs a LOT better.. no doubt FPU bugs in UAE's core.  I need to just buckle down and either inch up from 0.8.10 or try to make the giant leap.  But by default the thing asserts all 040's have a FPU so it's not a setting you can change (right now) as a user.

 

neozeed

Member
I think I found out what was holding back transfer speeds, although the catch about trying to run all these things on the same machine is that whenever my machine wanted to arp for anything, after the incoming arp totally seems to kill the Mac's network.

 
Top