Shoebill - a Macintosh II + A/UX emulator for OS X

About Mini vMac and all other 68k emulators, including SoftMac, Executor, and MESS.

Moderators: Cat_7, Ronald P. Regensburg

emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by emendelson »

neozeed wrote: I don't know how playable it is on the outside, but it'd be interesting to get some feedback...
Here in rural USA, on a relatively slow cable connection, I can click the "play" arrow, but nothing happens after two or three minutes.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

emendelson wrote:
neozeed wrote: I don't know how playable it is on the outside, but it'd be interesting to get some feedback...
Here in rural USA, on a relatively slow cable connection, I can click the "play" arrow, but nothing happens after two or three minutes.
Oh well thanks for trying.

I guess it just means I need to get better hosting for when I plan on putting something more worthy for A/UX. :mrgreen:
don't do today what you can put off until tomorrow.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

Since I'm not the only one that'll crash out hard from time to time, and need to fsck root after one of those dup alloc errors...

So I cooked up a minimal A/UX disk (20MB uncompressed) that iterates through the scsi bus fsck'king everything.

It's not smart.

but it works!

here is my fsck.dmg.

I just run it like this:

Code: Select all

shoebill.exe rom=macii.rom width=1024 height=768 ram=96 disk5=aux300.dmg disk1=usr-local.dmg disk2=usr-src.dmg disk3=homes.dmg disk4=hfs.dmg disk0=fsck.dmg
This way it's in the disk0 position to be booted up, and the the script will run fsck against disk 6 to disk 1 on each 0 partition... Of course you could edit it so it'll skip disks or whatnot, it's in the /etc/sysinitrc.

For scripting I'd just decompress the recovery image each time, and boot up and let it do it's thing... Although I guess shoebill needs a flag that if you shutdown to close the emu? or to shutdown on reboot.

At least this is quicker and easier than booting from cd and manually running fsck.
don't do today what you can put off until tomorrow.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by emendelson »

neozeed wrote:Since I'm not the only one that'll crash out hard from time to time, and need to fsck root after one of those dup alloc errors...

So I cooked up a minimal A/UX disk (20MB uncompressed) that iterates through the scsi bus fsck'king everything.

I just run it like this:

Code: Select all

shoebill.exe rom=macii.rom width=1024 height=768 ram=96 disk5=aux300.dmg disk1=usr-local.dmg disk2=usr-src.dmg disk3=homes.dmg disk4=hfs.dmg disk0=fsck.dmg
This way it's in the disk0 position to be booted up, and the the script will run fsck against disk 6 to disk 1 on each 0 partition... Of course you could edit it so it'll skip disks or whatnot, it's in the /etc/sysinitrc.

For scripting I'd just decompress the recovery image each time, and boot up and let it do it's thing... Although I guess shoebill needs a flag that if you shutdown to close the emu? or to shutdown on reboot.
And why not automate this? New version of the AUXrunner wrapper:

https://dl.dropboxusercontent.com/u/271 ... r-0.91.zip

It includes (on the assumption that this is OK with neozeed) a copy of fsck.dmg. To use it, enter at a terminal:

Code: Select all

defaults write org.wpdos.auxrunner DoFsck true
The next time you run the wrapper app, it will assign your existing disk0 to disk6, and boot from neozeed's fsck disk.

You don't need to "defaults write" a second time; the wrapper app will automatically reset DoFsck to false.

When fsck has done its job, shut down AU/X and Shoebill. The next time you run the wrapper app, it will boot normally from your boot disk.

Thanks to neozeed and a half-dozen lines of Applescript code, I hope this makes it easier to recover from a hard crash.
Last edited by emendelson on Mon Sep 22, 2014 1:37 pm, edited 2 times in total.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

emendelson wrote: Thanks to neozeed and a half-dozen lines of Applescript code,I hope this makes it easier to recover from a hard crash.
Cool, I knew you'd pickup that slack... :mrgreen: Now Im tempted to hammer in minivmac's 68881...
don't do today what you can put off until tomorrow.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by emendelson »

neozeed wrote:Now I'm tempted to hammer in minivmac's 68881...
While hammering, is there any chance you could also nail in a trap for Cmd-Q that would be active in command-line mode? As things stand, when you run Shoebill in command-line mode, Cmd-Q instantly shuts down Shoebill and AU/X, not whatever application you may be running inside AU/X. This doesn't happen in the GUI version.

I keep getting bitten by this one...
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

emendelson wrote:
neozeed wrote:Now I'm tempted to hammer in minivmac's 68881...
While hammering, is there any chance you could also nail in a trap for Cmd-Q that would be active in command-line mode? As things stand, when you run Shoebill in command-line mode, Cmd-Q instantly shuts down Shoebill and AU/X, not whatever application you may be running inside AU/X. This doesn't happen in the GUI version.

I keep getting bitten by this one...
Oh that one looks easy....

Code: Select all

        switch (event.type) {
            case SDL_QUIT:
                goto quit;
In the sdl_gui the event for command-q should get sent down as SDL_QUIT ... so instead of going to quit... you can make it just break; instead. Of course now the application won't gracefully exit!!!

So you either have to kill -9 it from the terminal, or look at exception.c and re-enable a block..

Code: Select all

    if ((shoe.op >> 12) == 0xa) {
        slog("Atrap: %s\n", atrap_names[shoe.op & 0xfff]?atrap_names[shoe.op & 0xfff]:"???");
And add something like this:

Code: Select all

if((shoe.op )== 41051)   //power off
		exit(0);
This way when you shutdown, it'll send a power off command, and it'll exit right away.

which isn't all that good as I think it's too early and leads to disk corruption.

edit==== it DEFIANTLY leads to disk corruption.

Code: Select all

Atrap: _PowerOff 41051 91
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
Atrap: _NewPtrSys 42270 1310
Atrap: _SlotManager 41070 110
Atrap: _StripAddress 41045 85
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SlotManager 41070 110
Atrap: _SwapMMUMode 41053 93
Atrap: _SwapMMUMode 41053 93
these are the codes after the atrap for powering off.. so clearly its not ready to power off.. I guess it could wait for scsi to finish up? sleep for 10 seconds? or find a better hook to kill shoebill.
Last edited by neozeed on Mon Sep 22, 2014 3:30 pm, edited 1 time in total.
don't do today what you can put off until tomorrow.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by emendelson »

Hmmm.... This looks like progress, but, as you say, it's not complete.

Is it possible for the application to detect the "It is now safe to shut down" message, and shut down by itself?

That, combined, with trapping Cmd-Q, would do the job, I think. And there's no reason that I can think of to keep Shoebill running after the "It is now safe to shut down" message.

Or, in your second alternative, is it possible to run a loop that waits until disk activity stops (for 1 second, maybe) in the various disk images and then exits?
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

emendelson wrote:Hmmm.... This looks like progress, but, as you say, it's not complete.

Is it possible for the application to detect the "It is now safe to shut down" message, and shut down by itself?

That, combined, with trapping Cmd-Q, would do the job, I think. And there's no reason that I can think of to keep Shoebill running after the "It is now safe to shut down" message.

Or, in your second alternative, is it possible to run a loop that waits until disk activity stops (for 1 second, maybe) in the various disk images and then exits?

Or just trap a later atrap...

I've only tested this with 3.0.0 but I shut down and booted cold a dozen times.

exception.c

Code: Select all

int want_to_exit=0;

void throw_illegal_instruction()
{
    ////slog("throw_illegal_instruction(): I'm throwing an illegal instruction exception! (shoe.pc = 0x%08x, op=0x%04x, a7=0x%08x)\n", shoe.orig_pc, shoe.op, shoe.a[7]);
    
    /*if ((shoe.op != 0xf010) && ((shoe.op >> 12) != 0xa))
        //assert(!"illegal");
        dbg_state.running = 0; */
    
    // fetch vector number
    const uint32_t vector_num =
        ((shoe.op>>12) == 0xa) ? 10 :
        (((shoe.op>>12) == 0xf) ? 11 : 4);
    
    throw_frame_zero(shoe.orig_sr, shoe.orig_pc, vector_num);
#if 1
    if ((shoe.op >> 12) == 0xa) {
        //slog("Atrap: %s\n", atrap_names[shoe.op & 0xfff]?atrap_names[shoe.op & 0xfff]:"???");
//printf("Atrap: %s %d %d\n", atrap_names[shoe.op & 0xfff]?atrap_names[shoe.op & 0xfff]:"???",shoe.op,shoe.op&0xfff);
	if((shoe.op )== 41051)   //power off
		want_to_exit=1;
	if(want_to_exit)
		if((shoe.op)== 41045)	//StripAddress
			exit(0);
    }
//    else
//        dbg_state.running = 0;
#endif
    shoe.abort = 1;
}
This is... horrible, including C++ style initializations.

but I guess it kind of worked for me.. Im sure pruten has a far better way of doing this, this is me grepping for 'power' and hoping there was a trap somewhere about the power state.
don't do today what you can put off until tomorrow.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by emendelson »

neozeed wrote:This is... horrible, including C++ style initializations.

but I guess it kind of worked for me.. Im sure pruten has a far better way of doing this, this is me grepping for 'power' and hoping there was a trap somewhere about the power state.
If it works, I'll be very grateful for a copy to use until improvements come along... Could you possibly post an executable of your version?

Meanwhile, I'll try to add it to pruten's code and recompile his version.

And thank you - this will be a real work-saver!
pruten
Tinkerer
Posts: 68
Joined: Thu Feb 27, 2014 3:10 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by pruten »

neozeed wrote:Im sure pruten has a far better way of doing this, this is me grepping for 'power' and hoping there was a trap somewhere about the power state.
I have a more "correct" way of doing it, although it may not be better. The power unit on the Mac II is wired to a pin on VIA2, which the ROM can flip to make the power unit turn off.

https://github.com/pruten/Shoebill/comm ... ccc42dc0c8

I left the exit(0) in _via_poweroff() commented out, though. Also, I haven't really tested it!
pruten
Tinkerer
Posts: 68
Joined: Thu Feb 27, 2014 3:10 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by pruten »

pruten wrote:I have to just sit down and rewrite the whole FPU. When I started, I decided to ignore all the status bits and exceptions (including divide-by-zero), and now the code is rather unmaintainable...
Okay, on second thought, I think I'll just try to refactor the existing code, maybe sacrificing some precision for simplicity. I forgot how complicated this thing was to implement in the first place!

For example, the 6888x actually use 85-bit floats internally, with the extra bits to help reduce error for complicated instructions (e.g. trig funcs). And as per IEEE 754, you can set control bits to force it to round the least significant bits of every FPU operation to 0, +∞, -∞, or the nearest correct value. This has the difficult side-effect that if you use fmovec to load a constant (e.g. pi), it correctly rounds pi according to those settings. Which it can do, because it actually stores those constants in its internal 85 bit format. But that's difficult to emulate if you're just using native 80-bit floats on x86...
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by adespoton »

Hmm; the other constants aren't so much of an issue, but Pi could be, if we're dealing with graphics. Might make sense to store any constants externally, but then you've got messy computation to do as well as predictive stacking, as you'll have to be always checking the values on the stack to see when the constants are called so you can swap in/out the correct value.

Not so difficult if you're on a 64-bit system I'd think, as you could just use two registers whenever you're handling the float operations -- but that's not very portable.
emendelson
Forum All-Star
Posts: 1706
Joined: Tue Oct 14, 2008 12:12 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by emendelson »

OK, thanks to neozeed and pruten, we've now got Cmd-Q operating only inside AU/X to close down an AU/X application (it won't shut down the command-line version), and the Shoebill shuts down when you shut down AU/X.

To summarize, this is the effect of two changes to the code: neozeed's change to sdl.c:

Code: Select all

        switch (event.type) {
            case SDL_QUIT:
                //goto quit;
               break;
and neozeed's new version of core/via.c, with "exit(0)" uncommented.

Well done, and many thanks!

EDIT: And here's a new version of the AUXwrapper, with the new code baked in:

https://dl.dropboxusercontent.com/u/271 ... r-0.92.zip
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

pruten wrote:
pruten wrote:I have to just sit down and rewrite the whole FPU. When I started, I decided to ignore all the status bits and exceptions (including divide-by-zero), and now the code is rather unmaintainable...
Okay, on second thought, I think I'll just try to refactor the existing code, maybe sacrificing some precision for simplicity. I forgot how complicated this thing was to implement in the first place!

For example, the 6888x actually use 85-bit floats internally, with the extra bits to help reduce error for complicated instructions (e.g. trig funcs). And as per IEEE 754, you can set control bits to force it to round the least significant bits of every FPU operation to 0, +∞, -∞, or the nearest correct value. This has the difficult side-effect that if you use fmovec to load a constant (e.g. pi), it correctly rounds pi according to those settings. Which it can do, because it actually stores those constants in its internal 85 bit format. But that's difficult to emulate if you're just using native 80-bit floats on x86...
Well that fdlib gives more platform consistent answers than going native.. They use it in java among other things so that must be good?

I'd be happy with 'close enough' answers...

I've been using phoon to test the FPU, and of course Quake..

I should test both on x86 linux or something first though. And maybe make a null quakeworld client.
don't do today what you can put off until tomorrow.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

nearly 17 hours of uptime!

Code: Select all


Apple Computer A/UX (fluffy)

login: root
Password:

*******************************************************************************
*                                                                             *
*                       W E L C O M E   T O   A / U X                         *
*                                                                             *
*******************************************************************************

TERM = (vt100)
Wed Sep 24 00:20:15 PDT 2014
fluffy.root # uptime
 12:20am  up 16:58,  2 users,  load average: 0.34 0.34 0.32
fluffy.root #
Now I've found that if I don't have the console doing something or the network they go to sleep to never wake again... Also I found a nicer way to not start the GUI and keep the CPU utilization low...
in /etc/inittab

Code: Select all

co::respawn:/etc/getty console co_9600  #co::respawn:/etc/loginrc              #
Spawning getty on the console keeps it textual. If I don't have anything running I get a system load of 0.00 which is nice, and low utilization oh my host.
Image

I tried running this on Windows XP over RDP and it didn't work at all. I'm guessing it is because at heart shoebill is an OpenGL application. I've done some work with SDL 1.2 back a while ago, and it looks like SDL 2.0 is strictly a GPU thing with SDL_Texture & SDL_TEXTUREACCESS_STREAMING... I'll have to see what works for my needs. As much as I'd want to add in libVNC support or xrdp, they are GPL, where unlike SLiRP which is BSD based..

Oh well

In other news, I found another bug in my SLiRP code, so time for more updates... The good news is that it's even faster now!

Code: Select all

D:\temp\>wget http://192.168.0.12:42380/quadra.webmhd.webm
--09:13:36--  http://192.168.0.12:42380/quadra.webmhd.webm
           => `quadra.webmhd.webm'
Connecting to 192.168.0.12:42380... connected.
HTTP request sent, awaiting response... 200 OK
Length: 792,793 [text/plain]

100%[====================================>] 792,793      428.45K/s    ETA 00:00

09:13:38 (428.45 KB/s) - `quadra.webmhd.webm' saved [792793/792793]
I'll just update existing files. Win32 Binary, OS-X Binary, and source code (build.bat/build.sh builds on either now)
don't do today what you can put off until tomorrow.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

Hmm

6:26am up 3:57, 4 users, load average: 3.80 3.79 3.78
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
ae0 1500 10.0.2 10.0.2.15 1851438 0 1850567 0 0
lo0 1536 127 127.0.0.1 4588 0 4588 0 0


on the console I have a billion

Code: Select all

ae0 spurious interrupt
(gdb) bt
#0 0x7788801c in ntdll!RtlExitUserThread ()
from C:\Windows\system32\ntdll.dll
#1 0x75a97285 in KERNEL32!CtrlRoutine ()
from C:\Windows\syswow64\kernel32.dll
#2 0x00000000 in ?? ()
(gdb)


threads

Code: Select all

Thread 25 has target id 'Thread 4652.0xff4'
Thread 18 has target id 'Thread 4652.0x1600'
Thread 14 has target id 'Thread 4652.0x11fc'
Thread 9 has target id 'Thread 4652.0x4c8'
Thread 7 has target id 'Thread 4652.0x10f0'
Thread 6 has target id 'Thread 4652.0x1294'
Thread 5 has target id 'Thread 4652.0x12ac'
Thread 4 has target id 'Thread 4652.0x12fc'
Thread 3 has target id 'Thread 4652.0x12f8'
Thread 2 has target id 'Thread 4652.0x12bc'
Thread 1 has target id 'Thread 4652.0x129c'
and a backtrace of each.

Code: Select all

(gdb) t 1
[Switching to thread 1 (Thread 4652.0x129c)]
#0  0x00424e4a in _do_clut_translation.5196 (ctx=0x2470a30) at video.c:362
362     video.c: No such file or directory.
(gdb) bt
#0  0x00424e4a in _do_clut_translation.5196 (ctx=0x2470a30) at video.c:362
#1  0x0042176b in nubus_video_get_frame (ctx=0x2470a30, just_params=false)
    at video.c:443
#2  0x00437d15 in shoebill_get_video_frame (slotnum=9 ' ', just_params=false)
    at ../intermediates/core_api.post.c:625
#3  0x0043b59d in _display_frame.2355 (win=0x361ef8) at sdl.c:174
#4  0x00438bca in SDL_main (argc=argc@entry=10, argv=argv@entry=0x360170)
    at sdl.c:575
#5  0x0043d29c in console_main (argc=argc@entry=10, argv=argv@entry=0x360170)
    at ../src/main/windows/SDL_windows_main.c:140
#6  0x0043d45d in WinMain@16 (hInst=0x400000, hPrev=0x0,
    szCmdLine=0x7546b7 "rom=macii.rom width=1024 height=768 ram=96 disk0=aux300.
dmg disk1=usr-local.dmg disk2=usr-src.dmg disk3=homes.dmg disk4=hfs.dmg",
    sw=10) at ../src/main/windows/SDL_windows_main.c:177
#7  0x004441ab in main ()

(gdb) t 2
[Switching to thread 2 (Thread 4652.0x12bc)]
#0  0x7784fd91 in ntdll!ZwDelayExecution () from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x7784fd91 in ntdll!ZwDelayExecution () from C:\Windows\system32\ntdll.dll
#1  0x7784fd91 in ntdll!ZwDelayExecution () from C:\Windows\system32\ntdll.dll
#2  0x757a3bd5 in SleepEx () from C:\Windows\syswow64\KernelBase.dll
#3  0x00000000 in ?? ()
(gdb)

(gdb) t 3
[Switching to thread 3 (Thread 4652.0x12f8)]
#0  0x757a3bd5 in SleepEx () from C:\Windows\syswow64\KernelBase.dll
(gdb) bt
#0  0x757a3bd5 in SleepEx () from C:\Windows\syswow64\KernelBase.dll
#1  0x43e3abf0 in ?? ()
#2  0x00000000 in ?? ()
(gdb)

(gdb) t 4
[Switching to thread 4 (Thread 4652.0x12fc)]
#0  0x004265ee in logical_get () at ../intermediates/mem.post.c:563
563     ../intermediates/mem.post.c: No such file or directory.
(gdb) bt
#0  0x004265ee in logical_get () at ../intermediates/mem.post.c:563
#1  0x004293b6 in cpu_step () at ../intermediates/cpu.post.c:3132
#2  0x00439c31 in _cpu_thread (arg=0x0)
    at ../intermediates/core_api.post.c:138
#3  0x0043f6fe in pthread_create_wrapper ()
#4  0x77391287 in msvcrt!_itow_s () from C:\Windows\syswow64\msvcrt.dll
#5  0x77391328 in msvcrt!_endthreadex () from C:\Windows\syswow64\msvcrt.dll
#6  0x759f338a in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\syswow64\kernel32.dll
#7  0x77869f72 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\system32\ntdll.dll
#8  0x77869f45 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\system32\ntdll.dll
#9  0x00000000 in ?? ()
(gdb)

(gdb) t 5
[Switching to thread 5 (Thread 4652.0x12ac)]
#0  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
#1  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
#2  0x757a15f7 in WaitForMultipleObjectsEx ()
   from C:\Windows\syswow64\KernelBase.dll
#3  0x00000002 in ?? ()
#4  0x0924fd58 in ?? ()
#5  0x759f19f8 in WaitForMultipleObjectsEx ()
   from C:\Windows\syswow64\kernel32.dll
#6  0x759f4200 in WaitForMultipleObjects ()
   from C:\Windows\syswow64\kernel32.dll
#7  0x00441c2f in do_sema_b_wait_intern ()
(gdb)

(gdb) t 6
[Switching to thread 6 (Thread 4652.0x1294)]
#0  0x00441bd8 in do_sema_b_wait_intern ()
(gdb) bt
#0  0x00441bd8 in do_sema_b_wait_intern ()
#1  0x004413bf in pthread_mutex_lock_intern.part.2 ()
#2  0x00000278 in ?? ()
#3  0x004461e0 in _video_rom ()
#4  0x00000000 in ?? ()
(gdb)

(gdb) t 7
[Switching to thread 7 (Thread 4652.0x10f0)]
#0  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
#1  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
#2  0x77882f91 in ntdll!RtlMoveMemory () from C:\Windows\system32\ntdll.dll
#3  0x00000001 in ?? ()
#4  0x00000001 in ?? ()
#5  0x00000000 in ?? ()
(gdb)

(gdb) t 9
[Switching to thread 9 (Thread 4652.0x4c8)]
#0  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
#1  0x7785015d in ntdll!ZwWaitForMultipleObjects ()
   from C:\Windows\system32\ntdll.dll
#2  0x757a15f7 in WaitForMultipleObjectsEx ()
   from C:\Windows\syswow64\KernelBase.dll
#3  0x00000007 in ?? ()
#4  0x0a0cfdfc in ?? ()
#5  0x759f19f8 in WaitForMultipleObjectsEx ()
   from C:\Windows\syswow64\kernel32.dll
#6  0x7582086a in USER32!PeekMessageW () from C:\Windows\syswow64\user32.dll
#7  0x75820b69 in USER32!MsgWaitForMultipleObjects ()
   from C:\Windows\syswow64\user32.dll
#8  0x64aa1cab in nvoglv32!DrvValidateVersion ()
   from C:\Windows\SysWOW64\nvoglv32.dll
#9  0x759f338a in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\syswow64\kernel32.dll
#10 0x77869f72 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\system32\ntdll.dll
#11 0x77869f45 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\system32\ntdll.dll
#12 0x00000000 in ?? ()
(gdb)


(gdb) t 14
[Switching to thread 14 (Thread 4652.0x11fc)]
#0  0x7784f8d1 in ntdll!ZwWaitForSingleObject ()
   from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x7784f8d1 in ntdll!ZwWaitForSingleObject ()
   from C:\Windows\system32\ntdll.dll
#1  0x7784f8d1 in ntdll!ZwWaitForSingleObject ()
   from C:\Windows\system32\ntdll.dll
#2  0x757a14ab in WaitForSingleObjectEx ()
   from C:\Windows\syswow64\KernelBase.dll
#3  0x00000350 in ?? ()
#4  0x00000000 in ?? ()
(gdb)

(gdb) t 18
[Switching to thread 18 (Thread 4652.0x1600)]
#0  0x77851f46 in ntdll!ZwWaitForWorkViaWorkerFactory ()
   from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x77851f46 in ntdll!ZwWaitForWorkViaWorkerFactory ()
   from C:\Windows\system32\ntdll.dll
#1  0x77851f46 in ntdll!ZwWaitForWorkViaWorkerFactory ()
   from C:\Windows\system32\ntdll.dll
#2  0x77883392 in ntdll!TpSetTimer () from C:\Windows\system32\ntdll.dll
#3  0x759f338a in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\syswow64\kernel32.dll
#4  0x77869f72 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\system32\ntdll.dll
#5  0x77869f45 in ntdll!RtlInitializeExceptionChain ()
   from C:\Windows\system32\ntdll.dll
#6  0x00000000 in ?? ()
(gdb)

(gdb) t 25
[Switching to thread 25 (Thread 4652.0xff4)]
#0  0x7788801c in ntdll!RtlExitUserThread ()
   from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x7788801c in ntdll!RtlExitUserThread ()
   from C:\Windows\system32\ntdll.dll
#1  0x75a97285 in KERNEL32!CtrlRoutine ()
   from C:\Windows\syswow64\kernel32.dll
#2  0x00000000 in ?? ()
(gdb)
it looks like a race condition...
don't do today what you can put off until tomorrow.
pruten
Tinkerer
Posts: 68
Joined: Thu Feb 27, 2014 3:10 am

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by pruten »

ethernet.c:

Code: Select all

/*
 * If prx and ptx are no longer asserted,
 * then we may clear the nubus interrupt.
 */
if (((ctx->isr & (isr_prx | isr_ptx)) == 0) &&
    ((ctx->cr & cr_stp) == 0))
    _clear_nubus_interrupt(slotnum);
Methinks this might be the culprit. The nubus interrupt is probably staying asserted, even though the chipset has no actual interrupts to report (spurious interrupt).

Maybe this is "more correct"?

Code: Select all

if ((ctx->isr & (isr_prx | isr_ptx)) == 0)
    _clear_nubus_interrupt(slotnum);
Maybe the driver tried to reset the card (asserting cr_stp) while it had outstanding interrupts, which causes this if condition to fail continuously. I haven't stressed the ethernet code even remotely as hard as you, neozeed, so I've never seen this condition yet...
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

pruten wrote:ethernet.c:

Code: Select all

/*
 * If prx and ptx are no longer asserted,
 * then we may clear the nubus interrupt.
 */
if (((ctx->isr & (isr_prx | isr_ptx)) == 0) &&
    ((ctx->cr & cr_stp) == 0))
    _clear_nubus_interrupt(slotnum);
Methinks this might be the culprit. The nubus interrupt is probably staying asserted, even though the chipset has no actual interrupts to report (spurious interrupt).

Maybe this is "more correct"?

Code: Select all

if ((ctx->isr & (isr_prx | isr_ptx)) == 0)
    _clear_nubus_interrupt(slotnum);
Maybe the driver tried to reset the card (asserting cr_stp) while it had outstanding interrupts, which causes this if condition to fail continuously. I haven't stressed the ethernet code even remotely as hard as you, neozeed, so I've never seen this condition yet...
That sounds like a good possibility.

I've been hammering the hell out of Shoebill, 4 disks doing block read/writes and hammering the network as hard as it can cope with it.. And I have to say I did the same thing on a quadra, and a few minutes brought it down, Shoebill is better than the real thing! :mrgreen:

I downloaded a few hundred MB of crap, and had 3 terminals with worms going for hours. So yeah millions of packets. I still have hopes of a quakeworld server!! ..

I've got to say even though Im a really terrible C guy, shoebill is pretty damned solid.

Also I tried the power thing like you suggested, and yeah ... disk corruption. Obviously just calling exit is nasty. It should start a countdown or something, I get the impression that in hardware when it throws the switch the relay isn't instant, that they figured they had so many ms or even seconds.
don't do today what you can put off until tomorrow.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

Image

that looks like it did it! I'm already at 2.2Million packets! And I transfered a few hundred MB without issues!

Also I compiled SIMH's Altair i8080 simulation, and it's about as slow as an Altair.... :mrgreen:

HERE it is, if anyone want's to Zork it out.
Last edited by neozeed on Fri Sep 26, 2014 7:42 am, edited 2 times in total.
don't do today what you can put off until tomorrow.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

I don't know why but I keep on getting these "ethernet: sleeping" errors... And once it goes to sleep it never seems to wake up.

So I made these horrible changes...

Code: Select all

/*
 * How many recv buffers (256-byte buffers) does the
 * given number of bytes require?
 */
/*#define eth_recv_required_bufs(a) ({ \
    const uint32_t sz = (a); \
    (sz >> 8) + ((sz & 0xff) != 0); \
})
*/
#define eth_recv_required_bufs(ff) ({ \
    const uint32_t sz = (ff); \
    (sz >> 8) + ((sz & 0xff) != 0); \
})
And this:

Code: Select all

                printf("ethernet: sleeping\n");
		srand(GetCurrentThreadId()+time(NULL));
                usleep(50+rand()% 100 + 1); // FIXME: use a cond variable here
                pthread_mutex_lock(&ctx->lock);
I'm just banging rocks together, but I'm thinking more recv buffers makes it harder to overflow and get stuck, just as having it wait different amounts of time will stop it from locking on another thread doing the same thing at the same time... Although I haven't seen it locked in a ethernet sleeping condition yet. The weird thing is that I wasn't passing any traffic at all, and the load average should have been 0.00 as I left it idling.

Is it possible the VIA timers are firing at the same time? and waiting the same time and constantly getting caught in eachothers lock?

Code: Select all

fluffy.jsteve $ uptime
  5:42pm  up  2:42,  1 users,  load average: 0.00 0.00 0.00
I guess I'll find out tomorrow, with me basically doing nothing. Kind of funny going from stressing Shoebill so hard, to giving it a break, I guess as long as you are using it interactively it's ok...? Or maybe its me.

---
Well it's tomorrow and it is still running!

Code: Select all

fluffy.jsteve $ uptime
  3:52am  up 12:52,  2 users,  load average: 0.01 0.00 0.00
fluffy.jsteve $ 
So I increased the buffer space, and wrapped both of the usleep's (ethernet.c and via.c) with some kind of variable waiting that is seeded from the current time + thread id. I suspect that somehow ether two(maybe more?) threads are running on VIA.C and they are both trying to access the same lock, and get caught up as they are all waiting the same amount of time, and on an 4 core/8 thread box they can all run at once, so this introduces some jitter that'll stop them from having an identical deadlock (so I hope)..

Now that Ive been up so long, it's time to slam the ethernet, now that it's sat idle.

---edit again
19 hours now.... :mrgreen:
don't do today what you can put off until tomorrow.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

What is better than Shoebill?

Why two shoebills, of course!

Image

I got the pcap thing working on Windows. Linux & BSD shouldn't be so hard. then I want to do a UDP one.

I can't figure out for the life of me how to get the appletalk sharing to start.... But we can ping and ftp eachother, TCP/IP is good, and I see the AppleTalk packets on wireshark.

right now the MAC address is hard coded into the sdl.c driver, and my ethernet address is hard coded into core\ethernet.c .... I have code somewhere to read mac addresses, so I need to integrate that so we can change that on the command line. I saw somewhere that minivmac can run on OS X with BPF, so I should look at that, maybe A/UX can't be alone?

Anyways just a preview is HERE.

If anyone who's used A/UX in the past can give me any tips on setting up Appletalk, I'm all ears.

But this does mean it'll be possible to hook up shoebill with GNS3 (yay) and do other creative things.
don't do today what you can put off until tomorrow.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

neozeed wrote: 19 hours now.... :mrgreen:
After 24 hours it locked again with threads all stuck waiting...

With my pcap adaptation, I've managed to get them to see a cisco router and learn about a phase 2 appletalk network... sharing will *NOT* start.. trying it with 3.0.1 just crashes out with either bus errors, or a cpu fault.... I can't get networking to turn on with A/UX 2.0. Also the pcap machines go to sleep MUCH faster than slirp.

I started to hack minivmac but it's a localtalk hook thing, not the real deal so that pretty much went nowhere once I saw it on wireshark.

I guess the nextstep is BasiliskII since it should have some networking capabilities...

I should see if I can find some network aware programs for system6-7 and if they'll run on A/UX.
don't do today what you can put off until tomorrow.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by Cat_7 »

Some time ago I tried "newconfig appletalk", and set the network to ethertalk.

After trying to set up file sharing shoebill/AUX kept nagging about the name of the machine already being used on the network. Is this a pram issue?

You can enable Appletalk in basilisk for OSX. We have a specific build for that, and a guide:
http://www.emaculation.com/doku.php/app ... heepshaver

Best,
Cat_7
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Shoebill - a Macintosh II + A/UX emulator for OS X

Post by neozeed »

Cat_7 wrote:Some time ago I tried "newconfig appletalk", and set the network to ethertalk.

After trying to set up file sharing shoebill/AUX kept nagging about the name of the machine already being used on the network. Is this a pram issue?

You can enable Appletalk in basilisk for OSX. We have a specific build for that, and a guide:
http://www.emaculation.com/doku.php/app ... heepshaver

Best,
Cat_7
I think the serial port loops on itself so it'll complain about the name. Originally I had pcap set to grab all packets, and it would do the same after you used the network thing to select ethertalk. So I look for the MAC address of itself, and if it is reading it's own packet it'll discard it.. So now you can click share files all you want, nothing happens... but you can turn on program linking... which is totally useless.

In the chooser you can see the local network (I have a virtual cisco WAN going on ) and I see my 3 zones.

My macintosh is a macbook air, so its kind of out of the question for this kind of thing........

But I see that NT can do fileprint for apple let me install that.

I installed NT 4.0, and of course it works.

Image

But on the A/UX side you can hit share all you want, and nothing happens, but program linking comes on... I'm clearly missing something.... I guess the next step is to figure out how to write a pcap format file, and save the packets that come into the VM and packets I'm allowing to see what is wrong....

Oh yeah, a crash...

Code: Select all

Shoebill v0.0.4 - http://github.com/pruten/shoebill - Peter Rutenbar (c) 2014

Ethernet using 0247E:14D75
shoebill install ethernet (coreapi) ethername \Device\NPF_{1A17F8DF-DC65-420E-9A
7A-3F8D22EC0D12}
ethernet.c: Opening pcap device \Device\NPF_{1A17F8DF-DC65-420E-9A7A-3F8D22EC0D1
2}
pcap initalized.
Assertion failed: !"odd PC address (probably a bug)", file ../intermediates/cpu.
post.c, line 3127

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
ethernet: success, req=1 free=54
I need to probably rebase all this stuff.... and I think something is werid in the ethernet receive anyways I wonder if Pruten had issues with blocking on the tap ....

Or I went to enable 24bit mode...

Code: Select all

Assertion failed: !"inst_cas: error: not implemented!", file ../intermediates/cp
u.post.c, line 1485
Ugh. I really need to start again from scratch I guess.

I left the pcap running over night, and one of them locked.

Code: Select all

ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=55
ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=55
ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=56
ethernet: success, req=1 free=55
ethernet: success, req=1 free=54
ethernet: success, req=1 free=53
.....
...
ethernet: success, req=1 free=10
ethernet: success, req=1 free=9
ethernet: success, req=1 free=8
ethernet: success, req=1 free=7
ethernet: success, req=1 free=6
ethernet: success, req=1 free=5
ethernet: success, req=1 free=4
ethernet: success, req=1 free=3
ethernet: success, req=1 free=2
ethernet: success, req=1 free=1
ethernet: success, req=1 free=0
And then it's nap time.

Code: Select all

ethernet: sleeping
ethernet: sleeping
ethernet: sleeping
and then the VM locks.

Now this is interesting, another VM..

Code: Select all

ethernet: sleeping req=1 free=0
ethernet: sleeping req=3 free=1
ethernet: sleeping req=3 free=1
ethernet: sleeping req=3 free=1
ethernet: sleeping req=3 free=1
ethernet: sleeping req=3 free=1
ethernet: success, req=1 free=56
Which is really strange as this shoebill didn't lock up, and instead free'd the buffer queue.
don't do today what you can put off until tomorrow.
Post Reply