oudadOS.. My own Operating System Built from Scratch

I am happy to write these lines. It took me a lot of time to understand how operating systems behave. I have been dreaming to make my own operating system from scratch or at least based on Linux kernel. And today I am greatly happy to announce that I finish coding my operating system called “oudadOS” for educational purposes. The aim of writing it is to be used as a learning tool in operating systems classes around the world. I tried to show some concepts that were discussed in some operating systems book in order to fit its educational purposes. It is built with C++ as much as possible along side with Assembly in an object-oriented manner. It is meant to work on Intel 8086 architecture. The name of oudad comes up from the Amazigh language, and it means red deer in English. You can check it out from here: https://github.com/Lekssays/oudadOS . I will be posting some articles about each part of the operating system in my blog. In addition, I made an official website for oudadOS which can be accessed from here: http://oudados.lekssays.com. I will write a documentation for it in the next weeks. It will be posted here: https://lekssays.github.io/oudadOS/ .

Maybe you will notice that some parts are not well done or poorly designed. I tried my best to make it looks better. I believe that it reflects my level because I made a huge effort in making it. I faced many problems and I stopped writing it for weeks because I did not figure out how to implement some parts especially interrupts, multitasking, and GUI. So, please I invite you to raise an issue on the Github repository or make a pull request if you see that some parts should be changed or improved. As I mentioned in the README file, it is a learning experience for me. I am proud that I built it, but this does not mean that it is perfect or good. It reflects my understanding to the topics that I have implemented. For the future improvements, I will try to implement what I mentioned in the README file in the Github repository.

I posted some announcements about building a Moroccan Penetration Testing operating system, but I figured out that our community was not contributing. I was contacted by some friends which really made me happy because they were ready to help. However, I learned that I was not experienced enough to lead such projects. I have been looking for books and articles about building an operating system, and I found that I should first learn about computer architectures. This was a big step in my path to understand how operating systems work. I took computer architectures as a course at Al Akhawayn University in Ifrane, and it helped me a lot to achieve my goal. After that, I started reading about the conception of Linux Kernel. Then, I learned about cross compilers, makefiles, bootloaders, and many other topics.

I agree that building an operating system is not an easy task at all because it needs a good background in what I have discussed before in addition to passion. You cannot build an operating system if you do not master the programming language of your choice. Moreover, there are no clear or complete tutorials about how to build an operating system at least for what I have seen so far in operating systems tutorials or articles. You cannot copy and paste code because such topics are not usually discussed in StackOverflow. Another big issue is that if you found an operating system that is already implemented somewhere, it is hard to understand its logic because each programmer sees things differently. The bible of building an operating system is www.osdev.org , but it provides an abstract understanding of the concepts and sometimes a small implementation of a feature. You should know that OS developers community is hard because they will not help you if they found that you are copying someone else code or if they see that you do not understand even what you are doing. However, they are helpful a lot when it comes to complex problems, and I have faced this when I was implementing interrupts. So, please if you want to build you own operating system make sure that you understand well the theory and the programming language of your choice.

Operating systems design teaches you how to believe. You will notice that a lot of hexadecimal codes are already defined by manufacturers. For instance, the boot magic code 0x1badb002, ports connections for different devices, PCI devices IDs, PCI vendors IDs…They tend to push you just to believe in them.

At this specific moment of my life, I have to acknowledge some people who helped me a lot in achieving this either by supporting me, giving me feedback, or helping me with design decisions. I would like to thank Viktor Engelmann for his series in YouTube “Make your own OS”. He gave me insights about how to build an operating system even if some parts are not well explained because some concepts are hard. I have been following his design for major parts of oudadOS. I would like to thank osdev community for the awesome wiki. I would like to thank Saad Taame for helping me with some design decisions and for giving me feedback when I get stuck in implementing some parts. I would like to thank Dr. Hamid Harroud and Abdelhamid Limami for supporting me to finish this work. I would like to thank also Abdelghafour Mourchid for taking care of the graphical side of the operating system and for the awesome logo.

I hope that the Moroccan community will contribute one day in building a different operating system for penetration testing because it is a great feeling to see that you have built an operating system. It is like your child. You really love it. Maybe some of you will say that there are plenty of penetration testing operating systems. I would argue that by saying that if other developers followed this idea, we would not see BugTraq, ParrotOS, BackBox, DEFT, BlackArch, and many others. I strongly believe that we have the ability to make it and that we need just to believe in it.

oudadOS is made with 148836 in Morocco, and it highly contributes to my ultimate goal which is sharing code, love, and knowledge. I hope that oudadOS will be an added value to the community. I wish it can motivate some of you to contribute to an OS, give you a better understanding of operating systems, or at least give you an overall idea about how operating systems are built.

Ethics, Business, and Computer Science

I am writing this post after a long discussion in class with a professor of computer science here at Al Akhawayn University. I decided to write it to share with the world how I see ethics and business in the context of computer science.

Computer science is first about ethics. It is about sharing the knowledge and the code with the world without expecting something back. Computer science should not be interpreted as a market. It should not be seen as business and money. Computer science is more than that. It is what gathers open source programmers from all around the globe to make an exceptional thing that improves the technology and facilitates human beings’ lives.  I am talking here about Linux as an extraordinary project that changed computing history.

We discussed an idea about the use of those open source projects in a commercial way which was the argument of considering computer science as a business. I did not agree on that idea because people who developed those interesting things are aware of the use since the licensing of their projects is under one of the public licenses that are commonly used in the field. The famous one is GNU Public License with all its versions which establish an ethical contract between the programmer and the user. I did not use the term “client” here because it is not defined in the open source software dictionary.

They argued on the use of Linux today. They claimed that Windows is more used than Linux-based operating systems nowadays. However, they were not aware of the fact that Android is also a Linux-based operating system. In addition, the number of smartphones nowadays is more than the number of computers. Hence, we can conclude that Linux-based operating systems are the famous and widely used ones.

An important point should be mentioned here is that thinking of computer science as a business lowers the quality of the projects. I saw a hackathon made by a Moroccan company here at Al Akhawayn University. It illustrates how people at this happy land think about money more than the quality and ethics. They are selling the illusion to people in the frame of hackathons and under the umbrella of “Entrepreneurs”. They were using those events in order to test their platform for free even if we are neglecting the quality of the platform itself at that point. And the weird question is that no one asked them about their background and their knowledge in the field. Logically, someone who will judge your application should be knowledgeable than you at least at that specific field. Those people are a clear example of using business in computer science which is bad at some extent especially when it comes to incompetent people. Linus Torvalds famous quote applies strongly in this context: “Talking is cheap. Show me the code.”

So, if Linus Torvalds wanted to sell Linux, we would not achieve what we have been achieving. Open source projects taught me to be generous, to like the community, and to help people that I do not know just because they are humans.The important thing is that they are trying to improve people’s lives.

You should just get the point that we are not doing that for fame or money we are doing it for love.

Credits: open-source-world-wallpapers_10169_1024x768.jpg

An Analytical Approach of “On Photography: In Plato’s Cave by Susan Sontag”

On Photography: In Plato’s Cave is one of the solid chapters that explains how photography works and how we see things through it. It is a reference in photography since it explains some concepts that are used today after more than 40 years of publishing the book such us how do we see photographs in a modern and well-developed era in terms of technology.

It started by throwing light on photographs as entities that can make the human being feels that he or she owns the world in a single sheet of paper just by collecting many of them. Collecting photographs is like collecting the world since they represent unique experiences of different people around the globe. They are represented as proofs and testimony with an incredible power of convincing. However, Susan Sontag mentioned that photographs can be seen from another perspective which is the interpretation part. In addition, she mentioned the role of a camera in order to realize and relive our experiences. Moreover, photographs are a path to live some experiences without being a part of them which leads us to construct a nostalgia that combines what we lived and what the others lived.

In my opinion, I strongly liked the chapter because it was written many years ago, and it still explains or even predict some aspects of photography today. And it showed how people behave towards photographs and what effects do photographs on them.

First, I agree on describing photographs as collecting the world. However, we can go beyond that and say that photographs is collecting the relevant parts of the world that interests the photographer. We can argue on that by saying that the uninteresting parts of the world are usually neglected. For instance, trash cans are not usually captured because they do not seem to be interesting to anyone. Psychologically speaking, the human behavior tend to feel comfortable by seeing the good looking things, so the photographer, as a human being, is always looking for interesting things to capture. In addition, he or she tries to present it from different angles and frames, that are not usually seen, to represent it in a more interesting way.

Agouti’s Dust by Mehdi Laziri – Copyright Mehdi Laziri – Unauthorized use is prohibited

Capturing the interesting moments has been for the personal satisfaction and for the history. Nowadays, capturing the moment has evolved with the social networks because of the smartphones which are widely used cameras. So, instead of taking a picture for the the personal satisfaction, another variable has been added to what Susan Sontag discussed which is sharing. It is no longer just about collecting the personal experiences. It becomes about sharing the personal experiences with the world as well.

Second, I agree on the fact that photographs can be interpreted in different ways. We can also add to the statement that photographs can also serve a certain ideology or religion. It can be used also to push human being to take action against an existing political agendas. Photographs are powerful than words. From my experience, I have read many political articles about the war in Syria, but honestly it just push me to construct a sense of solidarity. However, when I saw the picture of the Syrian child who died when he evacuated with his father their country looking for peace, I strongly realized the damage than the war has been causing in Syria. It really pushed me to think and do something to help those people who are dying because of some political agendas between the the major political powers in the world. On the other hand, such photographs by independent photographers show what the mass media hide from the world. It can be seen as an alternative media solution that fill in the gap that mass media created.



Third, I see the part when Susan Sontag talked about photography as a way to make us feel that the world is more available to us as an insight about the filters that most of social network applications are using today. When we take a picture of ourselves, it does not necessary reflects the reality. It represent how we want the reality to appear. It is different than manipulating pictures because it is manipulating reality. Applying filters, on the other hand, reflects how the reality lives in the photographer’s head.


Demir, N. (2015). ALAN KURDI [“As a father, I felt deeply moved by the sight of that young boy on a beach in Turkey.” -David Cameron, former British Prime Minister]. Retrieved February 12, 2017, from http://100photos.time.com/photos/nilufer-demir-alan-kurdi

Laziri, M. (2016, March 20). Agouti’s Dust [Awesome Volunteer Ouissal cleaning a window while sun is beautifully saying hello.]. Retrieved February 12, 2017, from http://yourshot.nationalgeographic.com/photos/7961510/

A Hebrew Female in My Heart – في قلبي انثى عبرية

I just finished reading a book called “A Hebrew Female in My Heart – في قلبي انثى عبرية” which amazed me. Unfortunately, there is no English version of this book. I would love to read it in English in the future. My rating for this book is 5/5. It is written by Dr. Khaoula Hamdi who is a Tunisian author and a professor of information technology which surprised me when I first read this piece of infomation. She has been telling the story of a Hebrew girl between Lebanon and Tunisia, between Judaism, Islam, and Christianity, between war and peace, and between love and religion in 388 pages. If you did not read the book, and you do not want to be spoiled, please stop reading till you finish the book.

This interesting mixture of concepts and the fact that the book shares a real story pushed me to finish it as soon as I can. The way that the author used to describe the events made it more interesting to read.

A Hebrew girl called Nada from a Muslim father and Jewish mother initially lived in Tunisia then moved to Lebanon after the divorce of her parents. Her mother married a Christian man who filled the gap of the father in both Nada and her sister Dina lives.

One day she found two Muslim men on the door in a terrible situation. Ahmed was injured and Hassan his best friend supported him. Nada took care of Ahmed in the garage even if it is prohibited because of the difference between their religions, especially because of the war in south of Lebanon. They felt an unusual feeling with an absolute respect to their religions in the sense of the meeting between people from different genders at that time which would build a great story after.

She faced many consequtive bad events from the death of Rima who was her best friend in the civil war in Qana, Lebanon. Rima saved her life by teaching her Islam in addition to the lessons that Ahmed was giving to both of them, and the injuries that she had in the same war while looking for Rima. In addition to the disappear of her lover Ahmed in one of resistance’s operations which was 4 years long in which Ahmed lost his memory. He lived in a village in this period thiking that he is Christian. Moreover, she was not allowed to live in her mother’s home after she converted to Islam. This path changed her life because of the books that Ahmed gave her and the behavior of Ahmed and Rima which had a critical effect in her life. Moreover, the death of George who was her spirtiual father and her spiritual brother Micheal had a bad effect on her mental health. At the end, she helped all her family members and friends to convert to Islam. She married Ahmed, and they are still living in peace.

I did not mention some events and some other people who played a great role in this story. I strongly encourage you to read it because it pushed me to see things from different angles.

I learned from this book that religion should not be interpreted by judging the behavior of people who believe in it. In addition, the concept of religion itself does not cause the wars. In fact, the political and economic agendas are the main cause of hate.

I learned that media is a “make-up” tool which can make a religion more trustworthy than another. However, this is based on personal opinions or some agendas that those media agencies are serving which makes the media a dangerous tool that affects the public opinion.

I concluded that the religion should be taken as a well-formed set of noble ideas which cannot be interpreted by science because science is not absolute while the religion in it is core can be seen as absolute, so comparing religion with science is not a good path to follow. Religions can be compared to each other based on the concepts that they are promoting without being influenced by a third party which can manipulate the pure opinion of any human being.

I noticed that people from different religions can live in peace if each one of them respects the ideas of the other. This story illustrates this image that media does not promote. It taught me how to respect friendship and how to handle conflict between close friends. In addition, it taught me how to forgive people and take into consideration their special conditions at that specific moment.

Description of my Presentation at OWASP AppSec Africa 2017

I was invited to talk at OWASP AppSec Africa 2017 in Casablanca, Morocco on Wednesday, February 1st, 2017. My presentation was entitled:”How Did I Hack Twitter and WhatsApp for iOS?”. I had the honor to present in front of well-educated people about cyber security. I hope this made a change or opened a path for people who want to pursue their careers in cyber security especially in iOS platform.

In this presentation,  I talked about two of my discoveries as a security researcher in Twitter (2014) and WhatsApp (2015) applications for iOS. The first one was an open authentication flaw which allowed me to hijack the active session in Twitter application. The second one was an encryption problem in WhatsApp which allowed me to steal the conversations and contacts that were in that device. After reporting that vulnerability, WhatsApp applied end-to-end encryption which has been leading to the protection of millions of users. These discoveries were considered as achievements because they were the first Moroccan discoveries in iOS platform.

As an introduction to these discoveries, I talked about iOS security architecture which is a rare field in the Moroccan cyber security community . I threw light on the system vulnerabilities that allowed me to access some important files in the installed applications in addition to an overview of iOS security system. I mentioned also some design patters in operating systems design that differ the system, kernel, and user modes called GDT entries or global descriptor tables entries.

One of the famous bugs in iOS is the lock bypass from the device itself or from a computer. At this point, We have 3 main paths to follow: Ubuntu (or another Linux-based distribution), Mac OS X, or Windows. I tried them all. I noticed that they were dealing with the iDevice in different manner. Ubuntu was trying to access it as a physical hard drive while the others were treating it as an iDevice (trying to connect it with iTunes). For WhatsApp, the bug was in iOS 9. I could access the system files including the files of the applications themselves. At this level, I would like to describe how an iOS application works based of the general files hierarchy in iOS. In other words, I would like to explain the role of “.plist” files in iOS system.

Concerning Twitter’s bug, I threw light on the multiple authentication levels in mobile applications. For instance, the access token method which was the main factor in the bug that I discovered in Twitter. Moreover, I would like to talk briefly about the 3rd parties applications that are used largely today and security risks that treat the users. This bug would lead us to explain more the difference between authorization and authentication. This point would explain in depth the real role of the access token.

As a motivation,  I shared the responses of the two Security Teams of the companies which confirmed the vulnerabilities. In addition, I want to share some tips that I used to find those vulnerabilities which would help the interested security researchers in iOS. They will change their minds because the majority of the security researchers consider iOS as a monster. It is known by it is high security mechanisms. However, it has some flows that might be used to discover serious security issues in some well known applications. I hope that this presentation will throw light on the problematic of authentication in cyber security and bring the question of the password as a good or bad authentication factor to the Moroccan cyber security community.

With love,

Image Copyright: https://www.law.georgetown.edu/continuing-legal-education/programs/cle/cybersecurity/images/shutterstock_165303932.jpg

Steganography: The Art of Hiding Secrets

Steganography is one of the complex fields in computer security. Its complexity comes from the limited resources that explain it because it is rare to find a course about it. However, steganography was always with the human beings. We just do not pay attention to it.

Steganography is the art and science of embedding secret messages in cover message in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message. It is a combination of two Greek words which are steganos that means covered and graphia that means writing.

Historically speaking, it has been always with with human beings. For instance, messages between empires tend to be hide in messengers’ heads. In addition, human beings used invisible ink to write their messages in order to hide them. So, steganography is not related by definition to computer science. It has historic roots, and it played an important role in human communication and security.

If you read this definition, you might be confused about the difference between steganography and cryptography. Basically they have almost the same goal which is protecting a message or information from third parties. However, they have different mechanism to protect the information. Cryptography changes the information to unreadable piece of data which cannot be understood without an encryption key. So, it involves another concept which is keys for encryption and decryption. On the other hand, steganography does not change the format of the information. It just hide it from the third parties. It can be used anywhere and anytime just by telling to the other involved part in the communication process how to read or extract the information.

Technically, steganography conceals the existence of the message. It does not alter the structure of the secret messages , but hides it inside a cover-file so it cannot be seen to make the secret message unseen.  Cryptography tends to hide the contents of a secret message from malicious people. So, the structure of a message is scrambled to make it meaningless and unintelligible unless the decryption key is provided. Thus, cryptography encrypts the message but it can be seen.

In this article, I will mention two applications of steganography in two different filetypes. The first one is audio steganography where we will take an audio file which contains a secret message behind it, and we will try to analyze it. It can be seen as meaningless track, but it has an invisible meaning. It can be used in many application mainly in military and governments’ digital security. The second one is image steganography where we will hide a text file inside a picture. And then, we will do the reverse operation to extract the message.

The process of analyzing a modified audio, image or any filetype is called steganography analysis or steganalysis. Technically, it can be linked to another concept which is reverse engineering. It is the process of extracting a hidden piece of data in a different form of filetype. I made the comparison between steganalysis and reverse engineering because they have a common point which is seeing things from the back-end. In other words, it can be defined as breaking the encapsulation layer that is hidden from the end user.

Let’s take a look at an audio file which is basically a .wav file. You can download it it from here: https://www.dropbox.com/s/n4o3hdp9mfkadqf/WAVFile.wav?dl=0 .

It was a challenge in a CTF. You can find another audio file in one of root-me.org steganography challenges that can be solved with the same technique. If you listen to it, you will just hear some noise which is meaningless for us. However, if you use audacity or another audio analyzer software, you will notice that it is not the case. In my experience, I used an old program called gram. You can download it from here if you want to do the experiment: https://www.dropbox.com/sh/x29xyo2vyjv1e8e/AACSTHW_x2pxHpZ4C9caZWska?dl=0 . The environment in which I am running the experiment is Ubuntu Xenial Xerus with installed wine1.6 to run windows programs in Linux-based environment. When you analyze the audio file, you will see the secret messages which is “HackThis!!” in our case.


So, you can see a hidden message in a meaningless audio file.

For the image part, a steganography challenge was detecting the used program in hiding a text inside an image. It was quite funny image.


The problem was to analyze two identical images. At this level, we will not talk about file signatures and file extensions. I believe I will talk about them in another article because they are involved in other fields. However, at this stage, I used winhex to analyze the Hexadecimal part of the image. You can use a text editor as well like gedit or notepad just to see the image from another perspective. I found a weird signature at the end of the modified image. This is the original image.


And this is the modified one. You can notice “CDN” at the end of the image.


I looked at this “weird” signature, and I found that it is the appropriate signature of a program called Hiderman which can hide a text file into an image. I used the same program to extract the message.

This was just an overview about steganography. I will try to talk about it in more depth in the upcoming articles. I believe it is an important field to know about since it is rarely covered in universities. It can change your way of seeing files as “cute” piece of data. On the other hand, they can contain secret messages or information.

Image Copyright: WonderHowTo http://img.wonderhowto.com/img/05/12/63537824039022/0/introduction-steganography-its-uses.1280×600.jpg

How to Make your localhost Online on Ubuntu?

I was working on a personal project with my friends. It is hosted on a virtual machine running under Ubuntu Xenial Xerus. And we reached the point where we should access it from other computers which are not in the same LAN in order to test it. I tried first to access it from the host which is running under macOS Sierra. However, I faced many problems with VirtualBox and bridged network since I am connected to a complex network infrastructure. It is not like the default configurations, so I succeeded just in make in visible to the host only which is useless in my case.

Then, I tried to access it from its external IP. It worked, but I needed to configure the router to allow NAT. This step was impossible for me because I did not have the necessary credentials.

I read about this issue, and I found an elegant solution.  I found two tools that allow exposing a local server behind a NAT or firewall to the internet. I will talk about the interesting and unlimited one in this post.

This tool is called ngrok. You can download it from here: https://ngrok.com.  In order to configure it follow these steps:

Step 1: Unzip the downloaded file.

Step 2: run the following command on your terminal ./ngrok help for documentation.

Step 3: run the following command on your terminal: ./ngrok http 80 to make http://localhost:80 accessible online. You can change the port depending on where your application is listening. Check if the firewall is allowing traffic on this specific port.

Step 4: You will see a link in the following form *.ngrok.io in your terminal. This is the link that you can share with your friend to access your localhost. It will be like the following figure:


You can also check the request and the connected devices to your localhost from the link: http://localhost:4040.

P.S: This steps were tested on Ubuntu Xenial Xerus running on VirtualBox.

A Letter for  People who Made 2016 an Interesting Year for Me

At this specific moment of my life, I have to write these lines to evaluate my performance in all its aspects and to thank people who made this year interesting for me. The bad ones do not worth wasting time and energy to even thank them.

Before starting to thank people who made my year interesting, I would like to evaluate my performance in all intersections. Academically, it was a good year, yet challenging. I had to deal with many things in parallel which was very difficult for me. However, I managed to deal with that at the end, and the overall performance in this aspect was good. I met my personal satisfaction which is the most important thing for me at this moment. Educationally, I had a good experience with teaching some high school students the basics of web development. It was good because it represented the intersection between two fields that I like. I met new people who had great ideas. I feel happy when someone of them says to me that he or she benefited from what I have been sharing with them. However, I would like to express my deep apology for anyone of them if I overreacted at some moments either in or after the events. In addition, I wrote a paper about iOS Security Architecture, and it was accepted for OWASP AppSec Africa 2017 in Casablanca, Morocco. It was a great honor for me to talk in this international conference by a leading organization in cyber security. Moreover, my level has been improved from last year to 2016 in the context of competitive programming. It was not in the level of my expectations, but I believe it is acceptable at the end. Socially, it was a bad year because I overreacted at discrete moments of this year. I overreacted in some situations that do not deserve even thinking. However, I tried to be more strict at different situation which was a key in saving my academic semester at the end. “Life is binary either you get 0 or 1” is the quote that explains my behavior. It caused some emotional problems to me during this year. Thus, it was a bad year in the emotional context. I learned many things  in the experience that I had which is good at the end.

In this post, I would like to thank people who made this year interesting for me. I would like to thank my parents, brother, and family for the high support that they have been giving to me. I would like to thank Saad Taame for being a great brother, friend, and coach. I learned so many things from you such as precision and thinking before taking any decision. I learned from you things that are not related to computer science. I learned lessons in life which affected somehow my behavior. I would like to thank Abdelghafour Mourchid and Mohammed Khalil Ait Brahim for being great friends and teammates, and for being on my side when I had some hard moments. I would like to thank Najwa Laabid for being such a great friend and advisor. You saved my life at the end of this year. Thank you for all the motivational speeches that you gave me during the hard time. I would like to thank Manal Hamdi for the advices and for being a good friend during the hard moments. I would like to thank Maha Hamdi for accepting my strict behavior and for all the things that I learned from you. I would like to thank Abdelhamid Limami for the great and crazy experiences that we had and for being a real friend when I experienced critical situations. I would like to thank Amine Dehbi, Younes Akherfi, Imad Eddine Sekkal, Amine Essiraj, Abdelilah Azizi, Hicham Drif, Yasmine Bahaji, Yassine Fakirni,  and all my old friends who did not vary with time. I would like to thank the new people that 2016 brought to my life especially Sabrine Lemghari, Omar Salim Moussa, Lamiae Benamar , Kenza Mandri, Houda Lalami, Ahmed Amine Boustani for being awesome, helpful, and great people that I hope I will keep in 2017.

I would like to express my deep apology again if I hurt someone in this year.

I wish you all a happy new year! and keep coding for the ones of you who love it!

Lekssays loves you all!

ARM Architecture with a Focus on Cortex-A Family



ARM Architecture or Advanced RISC Machine has become one of the most used computer architectures in the world due to its low consumption of energy, its high performance in dealing with small and multiple tasks simultaneously, its low cost, and its small size .  It is largely used  in smartphones, tablets, microcomputers, and embedded systems. It has become a strong alternative for supercomputers needed for data centers because it is a power-efficient solution.


If we look around us, we will find that ARM processors are everywhere. They are always with us. However, the real motivation is that ARM processors are the future of technology. The world is going toward a green and clean technology. A technology that has a high performance, but on the other hand it respects environment. These two features are the main goal behind ARM processors. In addition, they widely used in Internet of Things which is growing and changing the view of the world about technology. And one of the growing applications of IoT is smart homes. Thus, the motivation to learn about ARM Architecture can be seen as personal to develop our own projects or global to save the planet.

Development of the ARM Architecture

Overview of the History of ARM:

The origin of ARM Architecture came from the British technology Acorn Computers which developed ARM or Acorn RISC Machine in 1980s. It was a result of success between Acorn Computers an British Broadcasting Corporation. The first ARM version was ARM1 produced in 1985. After that, ARM Holdings transformed it to Advanced RISC Machine. ARM Holdings is a British company founded in 1990. It does not make the processors themselves. Instead, it designs multicore architectures and microprocessors.

Development Road Map:

ARM has several families depending on the the ARM version from ARMv1 to ARMv8-A. The difference in version can depend on the performance, the field of use, or sometimes the manufacturer because as mentioned before ARM Holdings does not produce processors, but they make their design and architecture and give manufacturing licence to companies such as Snapdragon and Qualcomm. For instance, Cortex-M/R/A(32-bit) are under the umbrella of ARMv7 family. In this presentation, we will focus on Cortex-A/A50 family.

ARM Architecture Profiles

ARM Architecture has three main profiles. They differ in the application of the architecture in real life. First, application profile which is implemented in ARMv7-A, for instance, which includes Cortex-A/A50 family that has several features such as MMS (Memory Management Support), high performance at low power which depends on multitasking done by the operating system. Second,  real time profile which is needed in embedded systems. It is implemented in ARMv7-R, for instance, which includes Cortex-R family. It has features such as protected memory and low latency and predictability “real-time” needs. Third, microcontroller profile is implemented in ARMv7-M, for instance, which includes Cortex-M family. It has features such as the deep embedded use, lowest gate entry point, and deterministic/ predictable  behavior as a key element.

Instruction Sets

For ARM Architecture,  Halfword means 16 bits (two bytes), Word means 32 bits (four bytes), and Doubleword means 64 bits (eight bytes). Most ARM architecture implement two instruction sets the 32-bit ARM Instruction Set and 16-bit Thumb instruction set. The Latest ARM cores such as ARMv8-A which includes Cortex-A family introduce a new instruction set called Thumb-2. It provides a mixture of 32-bit and 16-bit instructions. In addition, some new ARM cores like Cortex-A57 supports 64-bit instructions. They maintain code density with increased flexibility. Jazelle-DBX cores can also execute Java bytecode. For ARM instruction set, all instructions are 32-bit long, and they support many execution in a single cycle. They are conditionally executed. For Thumb instruction set, it is a 16-bit instruction set. It is used to optimize code density from C code (65% of ARM code size) in order to improve performance for narrow memory. It is targeted at compiler generation, so it is independent from hand coding. For Thumb-2 instruction set, it is designed to keep ARM performance and combine it with Thumb code density. In addition to 16-bit instruction set, it adds a 32-bit instruction set to implement almost all ARM functionalities.

For data processing, the available operations in ARM Architecture in Cortex-A8 are:


Logical: AND ORR EOR BIC  

Comparisons: CMP CMN TST TEQ  

Data movement: MOV MVN

They interact just with register, so they do not deal with memory. The second operand in ARM uses an additional register called Barrel Shifter before ALU.

Processor Modes

The ARM has seven basic operating modes:

  • User : unprivileged mode under which most tasks run
  • FIQ : entered when a high priority (fast) interrupt is raised
  • IRQ : entered when a low priority (normal) interrupt is raised
  • Supervisor : entered on reset and when a Software Interrupt instruction is executed
  • Abort : used to handle memory access violations
  • Undef : used to handle undefined instructions
  • System : privileged mode using the same registers as user mode
  • Monitor: a secure mode for TrustZone.

ARM Register Set

ARM has 37 registers that are 32-bits long each. Registers R0 through R7 are the same across all CPU modes; they are never banked. Registers R8 through R12 are the same across all CPU modes except FIQ mode. FIQ mode has its own distinct R8 through R12 registers.

R13 and R14 are banked across all privileged CPU modes except system mode. That is, each mode that can be entered because of an exception has its own R13 and R14. These registers generally contain the stack pointer and the return address from function calls, respectively.

R13 is also referred to as SP, the Stack Pointer, R14 is also referred to as LR, the Link Register, and R15 is also referred to as PC, the Program Counter.

The Program Status Register has the following 32 bits.

  • M (bits 0–4) is the processor mode bits.
  • T (bit 5) is the Thumb state bit.
  • F (bit 6) is the FIQ disable bit.
  • I (bit 7) is the IRQ disable bit.
  • A (bit 8) is the imprecise data abort disable bit.
  • E (bit 9) is the data endianness bit.
  • IT (bits 10–15 and 25–26) is the if-then state bits.
  • GE (bits 16–19) is the greater-than-or-equal-to bits.
  • DNM (bits 20–23) is the do not modify bits.
  • J (bit 24) is the Java state bit.
  • Q (bit 27) is the sticky overflow bit.
  • V (bit 28) is the overflow bit.
  • C (bit 29) is the carry/borrow/extend bit.
  • Z (bit 30) is the zero bit.
  • N (bit 31) is the negative/less than bit.

Exception Handling

When an exception occurs, the ARM:

  • Copies CPSR into SPSR_<mode>
  • Sets appropriate CPSR bits
    • Change to ARM state
    • Change to exception mode
    • Disable interrupts (if appropriate)
  • Stores the return address in LR_<mode>
  • Sets PC to vector address

To return, exception handler needs to:

  • Restore CPSR from SPSR_<mode>
  • Restore PC from LR_<mode>

Instruction Pipeline

The ARM7TDMI uses a 3-stage pipeline in order to increase the speed of the flow of instructions to the processor. It allows several operations to happen simultaneously . FETCH is first stage of pipeline where the instruction is fetched from memory. Then, DECODE which is about decoding the registers used in the instruction. Finally, EXECUTE where registers read from Register Bank Shift and ALU operation and write registers back to Register Bank.


ARM Architecture is one of the the most promising technologies that every computer scientists should know about. It is used everywhere around us. In this presentation, we focused on Cortex-A family which is an application profile. It is used in smartphones because of it is low consumption of energy. We choose it because it supports 32-bit and 64-bit architectures which is a new step in ARM architecture’s history. It is the step that allowed famous companies such as Apple and Samsung to support 64-bit operating systems in their mobile phones and also 64-bit operating systems in Raspberry Pi in order to increase its use in building green data centers.


ARM – Architecture Reference Manual http://www.arm.com/.

ARM Architecture A8 Presentation Slides. http://www.arm.com/files/pdf/ARM_Arch_A8.pdf

Cortex-A Series Processors. https://developer.arm.com/products/processors/cortex-a

P. Dutta, Electrical Engineering Teaching Slides, Electrical Engineering and Computer Science Departement, University of Michigan. https://web.eecs.umich.edu/~prabal/teaching/eecs373-f11/readings/ARM_Architecture_Overview.pdf

  1. Stallings, Computer Organization and Architecture: Designing for Performance.

Image copyright: http://www.silicon.co.uk/wp-content/uploads/2011/10/ARM-Cortex-A15.jpg