7 ms·
HelloSilicon – An introduction to assembly on Apple Silicon Macs
- moonchild 4y agoThis tutorial seems to perform syscalls directly. That is inadvisable on macos, as the kernel interface is unstable. You should call through libc instead.
- andai 4y agoUnstable per major macOS version? Don't those break a substantial fraction of working software anyway?
- my123 4y agomacOS has a lot of work spent on it to ensure backwards compatibility between releases for software. The situation would have been _far_, _far_ worse otherwise.
- duped 4y agoNowhere to the degree as Windows or Linux. MacOS updates are very fragile and almost guaranteed to break software.
- my123 4y agoLinux on the desktop has far less backwards compatibility than macOS I'd argue. Yes the kernel <-> user space ABI is stable, but anything above that tends to be very messy on Linux.
- fragmede 4y agoIt depends on what you use on their respective OSes. If you use your MacBook as an expensive Chrome/Slack/Netflix machine, I'd agree it's straight forwards to upgrade macOS. However there is a large range of very expensive professional apps that are pretty much guaranteed not to work on major version updates before the vendor also releases an upgrade, if they ever do. Avid for example. Or Ableton. There's a huge library of 32-bit x86 VST plugins that are now locked away from newer macOS versions due to it dropping 32-bit support. A lot of hardware didn't get new drivers either, and macOS went and changed that around a few versions back. These are professional products, with many thousands of dollars invested into them, so the upgrade cost is often impossibly high. Hell, I forget the name of the movie, but it was cut on a version of Final Cut Pro (not X) that was five years old when the movie was cut. That editor held onto that their ancient un-upgradeable machine for dear life because that was the workflow they lived and breathed.
- my123 4y agoFor 32-bit, interestingly Apple still maintains a very bare minimum (_not_ covering Mac GUI apps). This has two customers today: - on x86 Macs only: older iOS Simulators - on x86 and arm64 Macs: x86_32 code segments (no syscall emu), for Wine to be able to run 32-bit x86 applications. I think that the fragile base class problem might be what made Apple get rid of 32-bit x86 app compatibility at the end. > A lot of hardware didn't get new drivers either, and macOS went and changed that around too Yeah. KM drivers aren't exactly the most stable thing from release to release ever on macOS. And Apple has been steadily getting rid of those. The player that actually cares the most about backwards compatibility on the desktop to an insane extent is Microsoft. 32-bit Windows editions (that are able to run 16-bit apps) are only gone in Windows 11. Apple still spends a lot of effort on it but not to the same extent at all.
- kitsunesoba 4y agoWindows is better than average but still has considerable holes in backwards compatibility that are particularly visible in games (and ironically, some of the worst are Microsoft's own games under the "Games for Windows" banner e.g. Fable 3), but I've seen a number of other random things break or stop working totally as expected when new versions of Windows come out.
- lokar 4y agoI’m not sure it’s fair to cite breaks due to hardware arch changes as evidence that the OS is bad at backwards compatibility. If anything apple has been better then average for compatibility across hw platforms, offering translation
- fragmede 4y agoThe breaks I mentioned are just whilst on Intel though. The change to Apple Silicon assuredly broke an ton of stuff but I'm not even counting those.
- duped 4y agoDAW developers have historically advised users not to upgrade MacOS versions until it is explicitly supported and professionals in the space resist updates at all costs.
- msla 4y agoNot in my experience. I've been using the same window manager and the same applications since before my current distro existed.
- pjmlp 4y agoI bet compiled from source, while what is being discussed here is binary compatibility.
- msla 4y agoNo, I use the distro packages, and have for quite a while now. Binary compatibility matters less on Linux, true; what people are actually interested in on the desktop is usually UI compatibility, as in keeping the same look and feel and workflow. That's something Linux is a lot better at than either MacOS or MS Windows, both of which force you into new UIs with the shift of fashions and corporate buzzwords.
- pjmlp 4y agoIt is still not what is being discussed here, as binary compatibility across OS versions.
- jraph 4y agoCompatibility through source availability (with the right to adapt) is a good strategy though. I've used Linux and explicitly chosen open source software since 2004. There's not a single program I'd like to run that does not work today. I've never been bitten by any such compatibility issue. Binary compatibility is crap though. You are likely to have issues if you try to use a package you found outside of your distribution's repositories for the specific release you use. I guess AppImage and things like this will improve this sad state of affair.
- KerrAvon 4y agoI’ve been using the same window manager on Mac OS X since 2001. It’s not really relevant to this discussion.
- KerrAvon 4y agoThis is absolutely not true.
- werdnapk 4y agoMacOS software is notoriously bad for backward compatibility. Windows is king in this department.
- Gigachad 4y agoThey usually give a very long notice when things are going so it would only be abandonware that breaks.
- thewebcount 4y agoAgreed. I work on macOS professional apps in the video space and use professional apps in the audio space, and I can only think of 1 plug-in so far that isn’t working correctly on Apple Silicon machines. It looks like there’s an update on the website, but I haven’t had a chance to download it. It’s over 2 years since the first AS machines were released to the public (and probably 2.5 to 3 years since the dev kits were released). For products I work on, we’ve done OpenGL to Metal, 32-bit to 64-bit, Intel to Apple Silicon. Sure it would be great to never have to change existing code, but it can be done. And most of the audio plug-ins I use are from pretty small vendors who seem to have made the same switches (admittedly, not much OpenGL/Metal use in audio plug-ins).
- KerrAvon 4y agoNo, they do not. Where is this trope coming from? Catalina decimating gaming because of the removal of 32-bit support? Apple doesn’t guarantee syscall compatibility between minor versions, either. You must dynamically link libsystem instead.
- pmalynin 4y agolibsystem is what you want to use, not libc per se
- moonchild 4y agoDepends on priorities. Libc is likely to be better documented and work across oses with less or no hassle.
- pourred 4y agoAFAIK there's no "libc" on macOS. libSystem is "libc".
- stephencanon 4y agolibc (under the name libsystem_c.dylib) is one of several components that make up libSystem. But none of these dylibs (including libSystem itself) actually exist in the installed image as dylibs: they’re part of the dyld shared cache.
- KerrAvon 4y agoWe’re talking about the developer experience, not the implementation. Assuming the IDE doesn’t do it for them, they’re going link against libsystem.
- deleted 4y ago[deleted]
- thewebcount 4y agoThis is really neat! My first thought when I read about Perry’s project was that it would be nice to have a macOS translation of the book, so thanks for doing this!
- NelsonMinar 4y agoThe book this is based on is quite good. Stephen Smith's "Programming with 64-Bit ARM Assembly Language". https://www.goodreads.com/en/book/show/53671067 https://www.goodreads.com/en/book/show/53671067
- TheBrokenRail 4y agoSo what's the difference between ARM and Apple Silicon? It's a little odd seeing it treated as its own unique architecture (for instance with people specifically porting software or writing guides about Apple Silicon rather than ARM in general) when it's just ARM64. Which already has a lot of stuff already ported to it and is quite extensively documented. Am I missing something? Did Apple do something crazy non-standard when making their chips which make them behave differently?
- galad87 4y agoThe differences are listed in the linked page.
- jws 4y agoThe Apple ABI has requirements not present in the generic ARM. https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms https://developer.apple.com/documentation/xcode/writing-arm6...
- andsoitis 4y agoApple diverges from standard 64-bit ARM architecture in specific ways: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms https://developer.apple.com/documentation/xcode/writing-arm6...
- sounds 4y agoI mean, that page only describes ABI differences. I was thinking I would find ARM architecture differences in the silicon. I understand that the ABI is considered part of the specification for 64-bit ARM silicon.
- masklinn 4y ago> I mean, that page only describes ABI differences. It explains how Apple constrains users, and thus the difference between general ARM and Apple Silicon. Which was the question. > I was thinking I would find ARM architecture differences in the silicon. Could you explain what you mean exactly? It's an ARM implementation so it has to implement the ISA. Apple's implementation has a few interesting bits, like a TSO mode (for x86 emulation), and actually has custom ISA extensions (AMX, memory compression, APRR/GXF) which nobody else would be allowed according to Hector Martin.
- snvzz 4y agoThe opposite of accessible. Gated behind an expensive purchase.
- rwaksmunski 4y ago$900 on sale for m1 laptop. $600 for used. This is less than a day's labor for this crowd.
- dagmx 4y agoWhile I agree in spirit that the relative cost of the Mac isn’t a bad value proposition, I’d definitely mention that wages vary dramatically by locale. While 100/hr is reasonable for many devs in Silicon Valley, it is fairly high for others.
- rwaksmunski 4y agoI'm in central Europe at $80/h ...
- dagmx 4y agoGreat for you but that doesn’t really change the point. $80/hr is still very high for a lot of the world.
- stephc_int13 4y agoI am tired of seeing this marketing bullshit working so well. Apple Silicon? This is ARM ISA and architecture, also known as aarch64.
- wtallis 4y agoThe repo is all about the Apple-specific bits of doing aarch64 assembly programming for Apple's hardware and OS. Most of the comments already in this thread are about the ways Apple differs from standard aarch64. You may not like that Apple has created their own brand around their implementation of aarch64, but that's hardly reason to pretend that there is not a meaningful distinction to be made.
- stephc_int13 4y agoThe problem I have with that is that this company is known for its disrespect of standards. Some techies are already confused about the nature of the ISA and architecture. Pretty soon, people will forget that iOS and macOS are running on ARM, like many many other devices. For once they have the ability to adopt a standard and even push it forward with the incredible engineering of their hardware teams, but they seems to choose, again, the other route.
- saagarjha 4y agoApple designed much of aarch64.
- inkyoto 4y agoYou are barking up the wrong tree. The ABI compatibility is never expected nor is taken for granted, for it is an internal implementation aspect of an operating system. An ISA does not equate to an ABI either. Blaming Apple for devising or augmenting an aarch64 ABI is akin to blaming IBM for using the XCOFF and the AIX ABI on their POWER platforms rather than using the SysV ELF ABI on the same POWER platform that Linux is a signatory to. Incompatible ABI's used to be a common place across different UNIX flavours from different vendor running on the same ISA. DEC Ultrix running on MIPS used an ABI distinct from that of SGI Irix running on the same MIPS ISA. For many years the ABI was not even recognised as a thing and was rather very loosely based on the original PDP-11 ABI (e.g. the result is either in the zeroeth register of the CPU however it was actully named, or on the stack if the result was too big to fit in, input parameters either in the first 4-5 registers or on the stack etc). It took years of bickering amongst UNIX vendors until the SysV ELF ABI was finaliased and adopted across all modern UNIX implementations (sans Mach-O on Darwin and XCOFF on AIX). Linux went all in with the ELF ABI as it was well positioned to get away from a zoo of legacy ABI's it historically had to support on different hardware plaftorms (a.out, COFF, ECOFF and whatever else there was out there) even at the cost of the performance loss on the 32-bit x86. Whereas all BSD's (Free, Net and Open) just baulked at it and stuck with the historical BSD ABI for several more years to renege later on.
- benreesman 4y agoThe endless digressions about the evil of Apple were tiresome ten years ago. Yes, there is indeed a compelling case to be made that Apple is a force against rather than for software freedom. With that said, last I checked few if any people are compelled to purchase or use an Apple device. Reasonable people could decide they don’t want to buy Apple products, but then you’re done: you didn’t buy one! :)