ARM MMU Support For ReactOS

Here you can discuss ReactOS related topics.

Moderator: Moderator Team

BlackRabbit
Posts: 128
Joined: Sat Dec 22, 2012 7:36 am

ARM MMU Support For ReactOS

Post by BlackRabbit »

I had an enjoyable and lively discussion with some fellow ReactOSer's last night. During that discussion, the matter of whether ARM could support ReactOS was broached, yet again.

There was also a couple of emails in the ROS-Dev mailing list about this topic.

Some in the past have casually implied that ReactOS will not port to ARM because ARM does not have an MMU.

This is simply false.

If you take two computer scientists, turn back the clock to 1970, and ask them to make it so that an OS can utilize the hard disk as a secondary memory, which hardware-enforced boundaries between processes, and with the ability to share memory (efficiently) between processes, and with write-protections, etc....I have no doubt that such computer scientist will ultimately arrive at more or less the same design, as exemplified by the iAPX 386, and other "protected-mode" CPU's. I am not saying that there is only one way to do it (VAX processors did not implement at two-level virtual-memory paging scheme), but certainly, there will be striking resemblances in the fundamentals (VAX uses a bit to say whether virtual address is kernel address or user-space address, with all kernel-mode addresses mapping to same physical page, etc). The reasons is that any pre-emptive, multi-threaded demand-paged OS will have certain hardware requirements whose essentials are almost theoretically-invariant The means that any CPU supporting such an OS must provide those hardware features. The fact that Linux is such an OS, and has been running on ARM for quite a while, should be indication that there ARM CPU's do, in fact, have MMU's.

Also, it is not true that Windows CE was some gimp-like OS that was able to run on ARM because it was stripped down. Windows CE is a fully-preemptive, multi-threaded OS with demand paging, just like Big Windows. The creators of Windows CE did create some artificial restrictions relative to Big Windows, such as the maximum number of processes, maximum virtual-memory size for a process, etc. But these were software restrictions, not hardware restrictions.

Finally, it has been stated that Windows Phone 8 utilizes the Windows NT core. If this is true, (I see no reason why not), then there you have it. A Windows-like OS is running on ARM, even with the availability of hardware-specific primitives like QueryPerformanceCounter.

That said, you should know that there have been ARM processors capable of running ReactOS since the year 2000. In case you are wondering, the ARM CPU in the Raspberry Pi is very much capable or running ReactOS.

Z98
Release Engineer
Posts: 3379
Joined: Tue May 02, 2006 8:16 pm
Contact:

Re: ARM MMU Support For ReactOS

Post by Z98 »

No developer has ever claimed that ARM does not have an MMU. What was stated was that between ARMv4, v5, and v7 processors examined by the ARM team, only the v7 had a MMU that had instructions needed to perform some required synchronization operations. Before you make such claims, get the basic points straight first.

BlackRabbit
Posts: 128
Joined: Sat Dec 22, 2012 7:36 am

Re: ARM MMU Support For ReactOS

Post by BlackRabbit »

Z98 wrote:No developer has ever claimed that ARM does not have an MMU.
I never said, "developer". I said fellow ReactOS'ers. Here is one email message from the ROS-dev list (author's removed - does not really matter):
My Microsoft Outlook Old Mail Folder wrote:> Before you put too much hope on it, ReactOS needs a Memory Managing
> Unit (basically, virtual memory support), which is present only on
> ARMv7. Raspberry Pi has an ARM11 CPU, which only implements ARMv6.
> (yeah, don't be confused with all those numberings...)
Ehm... the Raspberry Pi does have a MMU. This can already be seen because it runs full scale Linux which requires a MMU as well (unlike µLinux). MMU support for ARM was introduced at least with ARM9 (see http://en.wikipedia.org/wiki/ARM9E ).
Z98 wrote:What was stated was that between ARMv4, v5, and v7 processors examined by the ARM team, only the v7 had a MMU that had instructions needed to perform some required synchronization operations.
That is not what is in the email message above, and that is not what was stated last night in chat. In any case, I would like to know what these synchronization operations are.
Z98 wrote:Before you make such claims, get the basic points straight first.
That is some excellent advice. Based on your previous replies to my post, you really need to do the same.

Z98
Release Engineer
Posts: 3379
Joined: Tue May 02, 2006 8:16 pm
Contact:

Re: ARM MMU Support For ReactOS

Post by Z98 »

Alright, one ReactOS developer misunderstood the situation and made an incorrect claim. I was the one that corrected that claim in that same email thread.

PascalDragon
Posts: 123
Joined: Wed Aug 04, 2010 7:34 pm

Re: ARM MMU Support For ReactOS

Post by PascalDragon »

BlackRabbit wrote:Some in the past have casually implied that ReactOS will not port to ARM because ARM does not have an MMU.

This is simply false.
1. There are ARM CPUs which don't have a MMU
2. Considering that the ROS ARM team already managed to boot ReactOS a bit on a iPod it's false to state that ReactOS will not port to ARM, because a rudimentary port already exists...
BlackRabbit wrote:
Z98 wrote:What was stated was that between ARMv4, v5, and v7 processors examined by the ARM team, only the v7 had a MMU that had instructions needed to perform some required synchronization operations.
That is not what is in the email message above, and that is not what was stated last night in chat. In any case, I would like to know what these synchronization operations are.
I also remember that this was said about ARM requirements, but I can't find the source of it anymore... (maybe it was on the forum?)

Regards,
Sven
Free Pascal compiler developer

BlackRabbit
Posts: 128
Joined: Sat Dec 22, 2012 7:36 am

Re: ARM MMU Support For ReactOS

Post by BlackRabbit »

PascalDragon wrote:1. There are ARM CPUs which don't have a MMU
Yeah, sure, like there are some Pentium processors that don't support SSE, etc. What surprised me in the claims about ARM was that Microsoft had been running a dual-level demand-paged OS on major ARM cores at least since 2000. Even in the early versions of Windows Embedded (basically Visual Studio for embedded engineers, as you know), the base CPU for Windows CE was an ARMv4. In other words, demand-paging/isolation/etc. does run on ARMv4. In fact, I remember an article by Microsoft telling the embedded developer how to turn it off if they so chose.
PascalDragon wrote:I also remember that this was said about ARM requirements, but I can't find the source of it anymore... (maybe it was on the forum?)
That is because you were the one who corrected our friend and comrade on the ROS-Dev mailing list. :twisted: Here is the message:
Z98 wrote:Guys, we have a wiki page: http://www.reactos.org/wiki/ARM_Port

The ARM team explicitly states that the ARMv4 and ARMv5 MMUs are incompatible with ROS. They used an ARMv7 chip but do not mention if ARMv6's MMU is of the same type as v4 and v5. Check that first before you expend any more time/effort into this.
Our Friend & Comrade wrote:>> Before you put too much hope on it, ReactOS needs a Memory Managing
>> Unit (basically, virtual memory support), which is present only on
>> ARMv7. Raspberry Pi has an ARM11 CPU, which only implements ARMv6.
>> (yeah, don't be confused with all those numberings...)
PascalDragon wrote: > Ehm... the Raspberry Pi does have a MMU. This can already be seen
> because it runs full scale Linux which requires a MMU as well (unlike
> µLinux). MMU support for ARM was introduced at least with ARM9 (see
> http://en.wikipedia.org/wiki/ARM9E ).
I nit-pick at things like this because the confusion is costly.

Right now, there are 1000's and 1000's of CEO's all around the world who think that ARM CPU's are fundamentally incapable of running Win32 applications, even though Windows RT is little more than Windows 8 recompiled for ARM with a thick layer of fat on top to lock-down the platform. Microsoft, and others, have played to their ignorance by mumbling something like...."CPU architectures are different", which the CEO's ultimately parrot to their friends, who parrot their friends, and so on. This makes Intel very happy, of course, because it buys them time while they get their Haswell house in-order, and it also works for Microsoft because it relieves Microsoft of having to explain, constantly, to its own customers, why it is deliberately avoiding allowing third-party Win32 applications to run on cheap sub-$100USD ARM tablets, etc.

This is why I have been saying that, the moment someone sees 100,000's of Win32 application running on sub-$100USD ARM-based tablets, there will be disruption in the market, not because any real new technology has been created, but because all the false-information that clutters the minds of these CEO's will suddenly be eradicated, and it will become clear:

ARM can very well run native Win32 applications written in C/C++.

jihao1234567
Posts: 31
Joined: Wed Mar 18, 2009 7:53 am

Re: ARM MMU Support For ReactOS

Post by jihao1234567 »

If anyone wants to run Win32-x86 applications on the ARM platform without modification, he or she will pay a great amount of time and effort to do this because Windows uses several x86-specific features (for example, Win32 subsystem uses the FS segment register to access some thread-related information, and some important system features like SEH rely on this, but on the ARM platform there does not exist a FS register). I never doubt that ReactOS could be ported to ARM platform, however that will be a hard work - and millions of legacy x86 applications need be ported to ARM too( most of them are private or old commercial products, that means the original developers might not have interest on porting them ) if we still want to benefit from them. In consideration of such factors, why Microsoft won't port Big Windows to cheap ARM SoCs could be realized easily - they just feel that is uneconomic, so instead they released the Windows RT to the market, and we saw the result. However, If ReactOS developers want to do that( porting Big Windows/ReactOS to ARM ), a new programming model will be built and is not compatible with Microsoft's products( they did not have one yet, Windows RT is different with Big Windows because of the different APIs ), that means ReactOSers should build a new incompatible software ecosystem. It is hard to predict such an attempt will success or not, and at same time we also lose the most valuable point of ReactOS - compatibility with Windows.

BlackRabbit
Posts: 128
Joined: Sat Dec 22, 2012 7:36 am

Re: ARM MMU Support For ReactOS

Post by BlackRabbit »

I will address some of your points:
jihao1234567 wrote:why Microsoft won't port Big Windows to cheap ARM SoCs could be realized easily
Microsoft has already ported Big Windows to cheap ARM SoC's.

If you remove the layer of fat that they added to get Windows RT, you will get Windows 8, and in particular, the Windows NT kernel. A hacker got around the layer of fat and started running native Win32 apps on it.
jihao1234567 wrote: If ReactOS developers want to do that( porting Big Windows/ReactOS to ARM ), a new programming model will be built and is not compatible with Microsoft's products
I have no idea why someone would deliberately do this. It is not necessary.

I also noticed that a lot of people keep saying "The app will need to be ported." These applications are not written in assembly language (I know that you know that). They are written in C. Given the style of coding that a typical Win32 programmer uses, it's not that hard, IMO. As far as the Win32 API is concerned, there is not very much to port, really. I have compiled several, very large Win32 applications, including two that use MFC, for ARM, and watched them run on an ARMv4 CPU, natively. I did this almost 10 years ago. The port was, relative to the original development of the application, trivial. And that was with Windows CE. I can take a typical Win32 application right now, fire-up Visual Studio 2008 (or Visual Studio 2005, or even earlier), compile it for an ARMv4 CPU, watch it run, then take a picture, and post it here, so everyone can see a Win32 application running an old, year-2000-era ARM CPU.

Better yet, here are some images of emulators that are running Win32 applications on Windows CE, which, as I have mentioned numerous times, is a full-fledged, multi-threaded, pre-emptive, demand-paged operating system with full support for an MMU.

And since we are on the subject, I should mention that, almost 10 years ago, after I finished "porting" my Win32 application from x86_32 to ARM, I went to get a snack, walked outside in the forest where I lived, came back, went to Visual Studio, switched the CPU type from ARMv4 to MIPS, hit the rebuild button, and...WOW...all that porting...I had a Win32 application ready to run on a MIPS device. I did not try, but I am almost certain that if I had switched the CPU type to SH3, hit the build button, I would have ported to two different CPU's in a matter of 20 minutes.

jihao1234567
Posts: 31
Joined: Wed Mar 18, 2009 7:53 am

Re: ARM MMU Support For ReactOS

Post by jihao1234567 »

BlackRabbit wrote:If you remove the layer of fat that they added to get Windows RT, you will get Windows 8, and in particular, the Windows NT kernel. A hacker got around the layer of fat and started running native Win32 apps on it.
Yes, you could run desktop apps on Windows RT, but in a hacking way. That behavior will not be supported by Microsoft, so should ReactOS developers follow those undocumented and unofficial behaviors? Windows RT is the first generation Windows on ARM platform and Microsoft could modify the underlayer structure in next years without noticing app developers if they could keep WinRT API's behavior unchanged. If that really happened, what should ReactOS developers do that day? Because of this uncertainty, to some extent I do not agree that Windows RT is Big Windows even now it is actually.
BlackRabbit wrote:I also noticed that a lot of people keep saying "The app will need to be ported." These applications are not written in assembly language (I know that you know that). They are written in C. Given the style of coding that a typical Win32 programmer uses, it's not that hard, IMO. As far as the Win32 API is concerned, there is not very much to port, really. I have compiled several, very large Win32 applications, including two that use MFC, for ARM, and watched them run on an ARMv4 CPU, natively. I did this almost 10 years ago. The port was, relative to the original development of the application, trivial. And that was with Windows CE. I can take a typical Win32 application right now, fire-up Visual Studio 2008 (or Visual Studio 2005, or even earlier), compile it for an ARMv4 CPU, watch it run, then take a picture, and post it here, so everyone can see a Win32 application running an old, year-2000-era ARM CPU.
As I said above, I never doubt that some apps could be ported to ARM in a way that not so complicated, but obviously not all apps. If programs are written in C/Pascal/D/any compilable language with Win32 API, and use these techniques only( e.g. without using any undocumented or platform-specific features ), that is not difficult to port them to ARM. But a lot of legacy apps could not be ported in a way that just recompile it because of various reasons( cannot contact original author, or original code in lacks of maintain, or using some x86-specific features, etc. ), so should ReactOS' ARM port still support these apps with keeping binary-compatible?

PascalDragon
Posts: 123
Joined: Wed Aug 04, 2010 7:34 pm

Re: ARM MMU Support For ReactOS

Post by PascalDragon »

BlackRabbit wrote:
PascalDragon wrote:1. There are ARM CPUs which don't have a MMU
Yeah, sure, like there are some Pentium processors that don't support SSE, etc.
I don't think that one can compare the lack of a MMU to the lack of a SIMD instruction set. The former normally means that you can only run more restricted/adjusted versions of an OS (e.g. μLinux) while the latter normally means only reduced performance (if the OS is itself using SIMD instructions).
BlackRabbit wrote:
PascalDragon wrote:I also remember that this was said about ARM requirements, but I can't find the source of it anymore... (maybe it was on the forum?)
That is because you were the one who corrected our friend and comrade on the ROS-Dev mailing list. :twisted: Here is the message:
I know that it was me who did the correction, but nevertheless I also remember the statement regarding that ARMv6 (or maybe ARMv5) and lower lack some synchronization instructions which are needed by NT...
BlackRabbit wrote:And since we are on the subject, I should mention that, almost 10 years ago, after I finished "porting" my Win32 application from x86_32 to ARM, I went to get a snack, walked outside in the forest where I lived, came back, went to Visual Studio, switched the CPU type from ARMv4 to MIPS, hit the rebuild button, and...WOW...all that porting...I had a Win32 application ready to run on a MIPS device. I did not try, but I am almost certain that if I had switched the CPU type to SH3, hit the build button, I would have ported to two different CPU's in a matter of 20 minutes.
I just noticed the day before yesterday that the headers we use in Free Pascal for WinCE which were automatically converted from C headers back then still contain the "_MIPS_", "SHX" and "PPC" defines :) I already played with the thought to install NT 4 on MIPS and PowerPC emulators and port Free Pascal just for the fun of it ;)
jihao1234567 wrote:Yes, you could run desktop apps on Windows RT, but in a hacking way. That behavior will not be supported by Microsoft, so should ReactOS developers follow those undocumented and unofficial behaviors?
Why should we artificially restrict ReactOS? It might be undocumented and unofficial for Microsoft, but this does not mean that we need to follow every decision made by them.

Regards,
Sven
Free Pascal compiler developer

jihao1234567
Posts: 31
Joined: Wed Mar 18, 2009 7:53 am

Re: ARM MMU Support For ReactOS

Post by jihao1234567 »

PascalDragon wrote:Why should we artificially restrict ReactOS? It might be undocumented and unofficial for Microsoft, but this does not mean that we need to follow every decision made by them.
Question is, if we do not follow them, we should develop a custom mechanism to support desktop apps on ARM, that means we have to break the compatibility with Windows because Windows itself do not have such a mechanism on ARM( documented and official-support ), it only has the public WinRT API.

mrugiero
Posts: 482
Joined: Sun Feb 14, 2010 9:12 am

Re: ARM MMU Support For ReactOS

Post by mrugiero »

jihao1234567 wrote:
PascalDragon wrote:Why should we artificially restrict ReactOS? It might be undocumented and unofficial for Microsoft, but this does not mean that we need to follow every decision made by them.
Question is, if we do not follow them, we should develop a custom mechanism to support desktop apps on ARM, that means we have to break the compatibility with Windows because Windows itself do not have such a mechanism on ARM( documented and official-support ), it only has the public WinRT API.
As far as I know, the Windows tried to mimick here is the one that currently runs only in x86 derivatives. And such mechanism would be probably at the C preprocessor level, so it wouldn't touch the final binary code of the x86 builds, which means compatibility is not broken. Of course, that ARM build will not work the same way Windows Mobile works at the API level, IIRC its API is more like Metro than Win32, but instead will expose a Win32 API (which at the same time, allows apps to only require recompiling in the best case to run on ARM).

jihao1234567
Posts: 31
Joined: Wed Mar 18, 2009 7:53 am

Re: ARM MMU Support For ReactOS

Post by jihao1234567 »

mrugiero wrote:
jihao1234567 wrote:
PascalDragon wrote:Why should we artificially restrict ReactOS? It might be undocumented and unofficial for Microsoft, but this does not mean that we need to follow every decision made by them.
Question is, if we do not follow them, we should develop a custom mechanism to support desktop apps on ARM, that means we have to break the compatibility with Windows because Windows itself do not have such a mechanism on ARM( documented and official-support ), it only has the public WinRT API.
As far as I know, the Windows tried to mimick here is the one that currently runs only in x86 derivatives. And such mechanism would be probably at the C preprocessor level, so it wouldn't touch the final binary code of the x86 builds, which means compatibility is not broken. Of course, that ARM build will not work the same way Windows Mobile works at the API level, IIRC its API is more like Metro than Win32, but instead will expose a Win32 API (which at the same time, allows apps to only require recompiling in the best case to run on ARM).
That is what I worried about. On the ARM platform, Microsoft decided not using Win32 API, instead they invented WinRT API. And now Microsoft do not show any interest on exposing Win32 API to the ARM platform. If we exposes Win32 API to ARM platform, that will generate binary incompatibility with Windows on ARM.

User avatar
EmuandCo
Developer
Posts: 4428
Joined: Sun Nov 28, 2004 7:52 pm
Location: Germany, Bavaria, Steinfeld
Contact:

Re: ARM MMU Support For ReactOS

Post by EmuandCo »

WinRT uses the Win32 API. At least internally
ReactOS is still in alpha stage, meaning it is not feature-complete and is recommended only for evaluation and testing purposes.

jihao1234567
Posts: 31
Joined: Wed Mar 18, 2009 7:53 am

Re: ARM MMU Support For ReactOS

Post by jihao1234567 »

EmuandCo wrote:WinRT uses the Win32 API. At least internally
But they did not expose it. Could we use that?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests