Compiling/Building Sheepshaver/Basilisk II for X86, AND X64?

Anything about Mac emulation that does not belong in the above categories.

Moderators: Cat_7, Ronald P. Regensburg

User avatar
lonestar473
Student Driver
Posts: 21
Joined: Tue Apr 03, 2012 6:08 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by lonestar473 »

Well I didn't really change the source code for the driver,
just imported some files from the original code and
had to modify the sources file for the windows DDK,
VisualDDK did most of the hard lifting, I just had to
spend hours in trial and error mode.

All I really did was compile it for x64 - for now
that's the limit of my contribution.
Proper driver signing should be the first step to get this code out of the door.
Well.. from everything I've found - which there is a lot of confusing information-
it seems like only certain certificate authorities are allowed to distribute certificates
suitable for signing kernel-mode code. Some results say VeriSign is the only one but
I think that is no longer the case, though the list is still limited.

Certificates seem to be good for a year, but cost at least $200 USD up to $499
for VeriSign; this is for ones that can sign Kernel-Mode code, Also it seems like
you have to be incorporated or similar to get Kernel-mode signing certificate;
at the very least you have to go through a bunch of background checks and
supply ID, Bills with your(or the company's) address, tax information, etc. Also
you need a domain that is owned by you(or your company that's applying).

I'm unclear on whether you have to get Microsoft's WQHL testing and pass.

There is a discount provider for certificates that is $95 a year, comodo
but thier certs are not approved for kernel mode code.

Research Sources:
http://www.sysprogs.org/signing/
http://stackoverflow.com/questions/2847 ... -windows-7
http://successfulsoftware.net/2008/02/2 ... te-ripoff/
http://forums.comodo.com/code-signing-c ... 728.0.html
http://www.osronline.com/showthread.cfm?link=145563
http://codefromthe70s.org/kernelsigning.aspx
http://www.osronline.com/article.cfm?article=465
http://codesigning.ksoftware.net/
http://blog.ksoftware.net/
http://support.godaddy.com/help/7351/re ... ertificate
http://www.godaddy.com/ssl/code-signing ... icate.aspx
http://www.digicert.com/code-signing/ke ... icates.htm
http://www.symantec.com/verisign/code-s ... thenticode
http://msdn.microsoft.com/en-us/windows ... e/gg487317
http://msdn.microsoft.com/en-us/library/ff548231.aspx
http://msdn.microsoft.com/en-us/library/ff552299.aspx
http://msdn.microsoft.com/en-us/library/ff552289.aspx
http://msdn.microsoft.com/en-us/windows ... 87315.aspx
http://msdn.microsoft.com/en-us/library/ff552275.aspx
http://technet.microsoft.com/en-us/libr ... 10%29.aspx
Source code is maintained at a CVS repository. Currently our member Myrd has access to the code. For the code to be included into the source, it would need to be supplied as patches to the current code, or perhaps (in the case of this stand alone driver) as a separate directory that could be included (with a description of how to build/sign the driver).

You can communicate about the code on the Basilisk/SheepShaver development mailing list, accessible here: https://lists.sourceforge.net/lists/lis ... lisk-devel
I have never used a cvs(besides typing the command into mingw earlier from the
compiling guide); so I know almost nothing about them. From reading some of
the messages on the cvs earlier, I take it patches are usually submitted as
a 'diff' which I assume is a file containing only new/different text in source
code. However I didn't change any source code - yet. Which the drivers for
the network aren't even in the cvs source. Which should be fixed I think.
The source package I got (build 142?) contains driver source
for windows 95/98 real mode(dos) cd drivers, as well as a win9x b2ether
vxd source and windows nt4 b2ether source and the NT5(2k/XP) source.
You must be bold by now ;-) You mean you've given up on cd support? A skeleton driver is available from the disassembled code.... I placed links to all function calls that are in the sys driver, thus hopefully making it possible to reconstruct the driver. You can have that code. (I'll post it here in a new topic).
--Edit--
By the way.. how did you disassemble the code? I mean what tools did you use?
--End Edit--

No, not giving up at all, just need to take a break from it.. you can only sit there and
pull your hair out and feel like your accomplishing nothing for so long before you have
to step away and come back later with a fresh perspective. Also I just really really want
to actually write some code and do something for a change, I feel like I haven't really done
much at all yet; Though I may be too rough on myself, because I have a lot of things
I'm learning or doing for the first time.

Like I said before, I don't feel the classes I took adequately prepared me,
though I didn't finish my degree(yet but I want to); I did take two Visual Basic
and two C++ classes and pass them all. Didn't finish the java class; partly because
of other circumstances and partly because I just had a really hard time with the
teacher's assignment methods. He had some good ideas, but the way he implemented
them was so inefficient and tedious, and he required it for every project. I spent
more time in word than writing code and actually learning. There is a lot more
than that but I don't wanna bore you.
This is a awsome idea! It would work great as long as it adheres to the prefs files format.
HFS is read by cdenable.sys (hint ;-) but also by Apple's boot camp drivers. I know of no free libs for windows.
Yeah, I can't seem to find good documentation on the prefs format and options,
is it listed anywhere or do I just have to use trial and error or crawl the code?

Also build specific options are needed.

--Edit--
Thought I should note I plan on implementing support for each emulator/build in plain text,
with an ini file of sorts, as well as a plain text ini prefs definition for each emulator.

So in theory, anyone can add profile support for additional emulators, or builds.

I also plan to have a in program Wizard/GUI for doing this, as an 'advanced user' feature.
--End Edit--

As for the HFS read/write - I was thinking more disk image creation/management,
sort of like HFV Explorer, but upgraded and integrated and with automated capabilities.

That's why I was hoping for a library of some sort.

As for CD stuff I'm hoping to find a user mode way, but I am not giving up on
the cd driver either, but no matter what it likely won't help with hfv disk images.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by Cat_7 »

I understand the issue about driver signing. Perhaps we can find someone that has that capability...
By the way.. how did you disassemble the code? I mean what tools did you use?
I used the IDA pro 6.1 decompiler that I found somewhere. If you find it, then please use this urgent advice: run it in virtual machine and check for hidden payloads.

I'll store the source code for the driver on the site and ask Myrd about inclusion in the cvs.

-Prefs entries are somewhat different between hosts. I would suggest sticking to the original names for the prefs files to maintain interoperability with other prefs editors (like the BasiliskIIGUI and SheepShaverGUI.)
-some entries are described here: http://www.open.ou.nl/hsp/Engels/SheepS ... ttings.htm
-raw disk creation is done through the "dd" program.

Best,
Cat_7
User avatar
lonestar473
Student Driver
Posts: 21
Joined: Tue Apr 03, 2012 6:08 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by lonestar473 »

Hi, just want to post something, as I know its been a while. I've been occupied with some other stuff. I won't bore you with the details.

I do still want to work on things. I've searched and read a few more times for information to help with the cd driver thing. Still not sure, and driver development is still a ways over my head for now.

But I have thought of a workaround for now, though it has its problems.

As you probably know, if in the prefs file you define cdrom and point it to an iso file it will be mounted and useable in basilisk and sheepshaver. But you have to shut down and change it to get in a different disk. If you unmount it remounts it right back, and if you change the path in the prefs file, it doesn't take effect till a restart.

So I plan to add to my profile manager(which is not in a working state yet) the ability to define iso files for the cd drive, but I've also been thinking about ways to enable switching disks without reloading.

So far I have two possibilities and one of them is only a theory and the other may or may not work, or might take some rewriting.

The first is to create a symbolic link file, and point it to an iso, and put the link file in the prefs, then maybe you could point the link to another iso file, and then eject the disk in the emulator, and then when it remounts it right after, it would be reading a different file.

That would probably be easiest to do with a program, and it might even be that it could only be changed during the split second when the cd is unmounted in the emulator, which would require some sort of detection of the unmounting or being able to unmount it itself.

The other, and probably better idea, is to try to edit the emulator's source code just enough to make it reload the cdrom definition from the prefs file when a disk is unmounted.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by Cat_7 »

Yes, cd changing is an important issue beside cd support in itself.

Your second solution path would indeed be more suitable for a nice solution.

There is also still the networking issue. I have been looking into winpcap to replace the driver for windows (as the 64 bit version requires signing or disabling driver signing). It seems winpcap allows reading and injecting packets from/into the stream in the installed adapter. However, I don't understand enough of the current networking code to plug in the winpcap files and functions.

Best,
Cat_7
User avatar
lonestar473
Student Driver
Posts: 21
Joined: Tue Apr 03, 2012 6:08 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by lonestar473 »

That could work for the networking thing, I believe there was a build of dosbox someone made that used it to enable tcp/ip from windows 3.x/95 running inside it.
User avatar
lonestar473
Student Driver
Posts: 21
Joined: Tue Apr 03, 2012 6:08 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by lonestar473 »

Hey, I just wanted to post something here while I had a moment and it was on my mind.

I am sorry I haven't gotten anything more done. It makes me really sad because there was a lot I wanted to do. :cry:

I have been so busy lately I think my fingers might fall off 8O

I'm building two websites for two different people, as well as setting up and maintaining a few Virtual Private Servers, and managing the host server. I've pulled several all-nighters already and it seems like every time I go to sleep something happens >.<

I will keep working on this stuff here.. just.. no idea when. I went from doing almost nothing to being overwhelmed :P

Thanks Cat for all your help before :mrgreen:
yksoft1
Master Emulator
Posts: 394
Joined: Tue Aug 14, 2007 4:32 pm
Location: People's Republic of China

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by yksoft1 »

I thought that Sheepshaver's JIT code should be rewritten since that is very GCC-dependent, and it will trigger some unknown bug of GCC 4.4 or higher.
User avatar
lonestar473
Student Driver
Posts: 21
Joined: Tue Apr 03, 2012 6:08 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by lonestar473 »

Hello! :smile:

Just wanted to let you know I haven't forgotten completely about all this.

I got into other stuff, and more recently have been busy doing coding on websites for people.

I still really want to help with this stuff, I have no idea on how much time it'll take me to get anything done, can't make any promises, etc. etc.

However! To that end, I have recently bought a 2002 iBook G3 Model A1005 off e-bay, and I already had a 68K LC580 hanging around, so now I have some hardware that can run what we want Sheepshaver and Basilisk II to run, to help with development stuff.

I managed to get OS 9.2.2 running on it (was a lot of work.. probably should have[and still may if I get extra cash] gotten an older one that could run OS 8 & 9.)

I don't have the setup I used to, and I don't really remember much of what I was working on before, but I'm gonna go back through this thread and give myself a refresher, and try to see what can be done.

I probably said this before, but, I have a lot I still need to learn, because a lot of the stuff going on here is way out of the scope of any learning I did in the classes I've taken, or the programming I've done since.

I'm probably going to be doing some other stuff first before I *really* can get back into this, I need to setup my working environment again, and I'd like to setup a webpage to keep public notes and track of stuff I've done, for myself or anyone else in the future. Bit harder to lose something like that than it is to misplace some files in 6TB of storage :razz:

If there is any sort of documentation, or resources that you think would help please by all means link them to me!

Thanks, & take care.
uyjulian
Apple Corer
Posts: 244
Joined: Fri Aug 27, 2010 1:02 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by uyjulian »

lonestar473 wrote:~~SNIP~~
Here's the link to the source code: https://github.com/cebix/macemu
Contains both SheepShaver and BasiliskII.
It doesn't build correctly using clang (the compiler default on Xcode 4) so you will have to use Xcode 3.
To get rid of the errors somebody needs to rewrite the code to not use global registers (https://github.com/cebix/macemu/blob/ma ... en-ops.cpp)
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by adespoton »

Can someone with the right tools and time build a code diagram of this? With that part done, I might actually get around to converting the globals to locals with proper value passing. No guarantees, but if I don't, it'll be that much easier for the next person as well.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by Cat_7 »

Hi,

Some time ago, there was discussions on how to fix these issues.
I believe three solutions were suggested. One of them was to incorporate into the source tree dyngen generated files that were obtained while compiling with a still compatible compiler.

https://github.com/cebix/macemu/issues/21

Best,
Cat_7
uyjulian
Apple Corer
Posts: 244
Joined: Fri Aug 27, 2010 1:02 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by uyjulian »

Cat_7 wrote:Hi,

Some time ago, there was discussions on how to fix these issues.
I believe three solutions were suggested. One of them was to incorporate into the source tree dyngen generated files that were obtained while compiling with a still compatible compiler.

https://github.com/cebix/macemu/issues/21

Best,
Cat_7
That is a different thing.

I think this is the thing that you are looking for:
https://github.com/cebix/macemu/issues/12
User avatar
lonestar473
Student Driver
Posts: 21
Joined: Tue Apr 03, 2012 6:08 am

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by lonestar473 »

Hello Again.

I just wanted to give a little update.

The first couple things I'd like to do is what I was looking into before, the Ethernet and the CD/DVD access in Windows x64.

I had previously managed to get visual studio to compile the ethernet driver for x64. Didn't really change any code.
Problem was, and still is, Windows x64(Vista and up) need signed drivers. These must be signed with a special certificate for signing kernel mode code. (Normal code signing certificates probably will not work.) And they are somewhat costly.

However, we may have a solution, ReactOS seems to offer to sign drivers for open source projects. With some conditions.
http://www.reactos.org/wiki/Driver_Signing

It's a possible avenue at least. In the long run I think a better way or system, that wouldn't need to go through this, might be better.
But I think right now we just want it to work, right?

As far as CD/DVD support goes.. we don't really seem to have any code that works on Windows, aside from Cat_7's decompiled bit. Which I do not have enough understanding of this type of programming to figure out what it's doing right now.

If anyone has any suggestions on documents, or books, or whatever, that I could read/research on I'd appreciate it.
I probably need some understanding of how both Windows & Mac handle CD/DVD drives, and some Windows system level stuff, but I'm not completely sure where or what to look for.

I would like try to figure out what the Mac does to talk to the CD/DVD drive, and then find some way to translate this to Windows. either through API calls and passing some data around, or if we have to, maybe directly reading bytes from the discs themselves(without a driver? hopefully?). It'd be cool to enable disc burning, but right now just reading the disc would be fantastic.

I have an old Macintosh LC580 from '95 with an SCSI CD-ROM and Mac OS 8.1, and a 2002 iBook G3 with an IDE? CD-ROM with Mac OS 9.2.2 & 10.4.11 for testing how physical hardware does stuff.

I don't know how long it'll take or what's involved.

Also I'll need to learn how things work as far as the project itself. Never worked in an open source and/or group project before. Unless someone else added it(didn't see it when I looked) the stuff I did with the ethernet driver is probably only in this thread and nowhere else. Also if the rules or procedures or practices for working with the code and making patches, etc. are posted somewhere a link would be appreciated. (I looked some, admittedly not thoroughly.)

Ok, enough rambling.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by Cat_7 »

Hi, I believe your 64 bit code for the ethernet driver went into to github repository ;-)

Best,
Cat_7
Gelip
Space Cadet
Posts: 1
Joined: Tue Jan 17, 2017 5:30 pm

Re: Compiling/Building Sheepshaver/Basilisk II for X86, AND

Post by Gelip »

Hello.
The driver b2ether64-TestBuild-src_04132012.zip works in host OS WinXP x64, 4GB RAM with SheepShaver_05_05_2010 :smile:
  • Guest OS is Apple Mac OS 9.0.4 ISO - need read only for install
  • Guest OS RAM size - best is 512MB
Internet Explorer 4.5 and sound works OK :-) :
Image Image
Unfortunately, if you turn on the services File Sharing and Web Sharing on Mac OS Guest, and then use the sound system e.g. try access to Control Panels -> Sound or Speech, this makes SheepShaver closes :-(
Also less Guest OS RAM size e.g. 64MB make Visual C++ Runtime Error! while run SheepShaver:
Image
Post Reply