Calm Down: It’s Only Assembly Language

Based on [Ben Jojo’s] title — x86 Assembly Doesn’t have to be Scary — we assume that normal programmers fear assembly. Most hackers don’t mind it, but we also don’t often have an excuse to program assembly for desktop computers.

In fact, the post is really well suited for the typical hacker because it focuses the on real mode of an x86 processor after it boots. What makes this tutorial a little more interesting than the usual lecture is that it has interactive areas, where a VM runs your code in the browser after assembling with NASM.

Continue reading “Calm Down: It’s Only Assembly Language”

x86 emulation running DOS on ESP8266

PC-XT Emulator On ESP8266

Do you remember the simpler times when you had a DOS command line, a handful of commands, and you talked to the hardware through a few BIOS and DOS interrupts? Okay, maybe it was a little limited, but nostalgia doesn’t care. Now [mcuhacker] is working on bringing some of those memories back by getting a PC-XT emulator running on an ESP8266.

For the x86 CPU emulator, he ported Fake86 which is written in C, and created an Arduino IDE environment for it. The MS-DOS 3.3 bootdisk image is stored in flash and is accessed as the A: drive. There’s no keyboard yet but he has 640×200 CGA working with 80×25 characters on a 3.5″ TFT display with the help of a low pass filter circuit. In the video below he shows it booting to the point where it asks for the date.

Continue reading “PC-XT Emulator On ESP8266”

Learn To Reverse Engineer X86_64 Binaries

Opening up things, see how they work, and make them do what you want are just the basic needs of the average hacker. In some cases, a screwdriver and multimeter will do the job, but in other cases a binary blob of random software is all we have to work with. Trying to understand an unknown binary executable is an exciting way to discover a system’s internal functionality.

While the basic principles of software reverse engineering are universal across most platforms, the details can naturally vary for different architectures. In the case of the x86 architecture, [Leonora Tindall] felt that most tutorials on the subject focus mostly on 32-bit and not so much on the 64-bit specifics. Determined to change that, she ended up with an extensive introduction tutorial for reverse engineering x86_64 binaries starting at the very basics, then gradually moving forward using crackme examples. Covering simple string analysis and digging through disassembled binaries to circumvent fictional security, the tutorial later introduces the Radare2 framework.

All example source code is provided in the accompanying GitHub repository, although it is advised to avoid looking at them to keep it more interesting and challenging. And in case you are looking for more challenges later on, or generally prefer a closer connection to the hardware, these MSP430 based capture the flag online challenges might be worth to look at next.

386 Too Much Horsepower? Try A 186, In An FPGA!

Typically when we hear the term “System-on-Chip” bandied around, our mind jumps straight to modern ARM-based processors that drive smartphones and embedded devices around us. Coming a little bit more out of left field is [Jamie]’s 80186 core, that runs on Intel FPGAs.

[Jamie] ran the core through a few vintage PC benchmarks.
[Jamie] has implemented the entire set of 80186 instructions in Verilog, and included some of the undocumented instructions too. This sort of attention to detail is important – real world parts don’t always meet the original specifications on paper, and programmers can come to rely on this. The key to compatibility is understanding how things perform in the real world, not just on the spec sheet.

Not content to simply simulate a CPU, all the necessary peripherals for a complete working system have been worked into the design as well. There’s RAM, a UART, as well as CGA graphics and a PS/2 controller that is necessary if you’d like to actually use any sort of human input device.

[Jamie] has released the code under a GPL licence, and it’s available at GitHub. It’s a good basis if you want to play around with what was once a commercial CPU at a logic level. The development guide is also available if you need to really drill down into the details. It’s a cool project, and makes a great contrast to [Jamie]’s previous work – the Oldland 32-bit core.

 

 

Write Your Own X86 Bootloader

What if you want to make a very lean machine and do without any operating system? Or maybe you want to try to write your own OS, even just for the challenge or fun? Maybe you were reading up on a cool OS architecture and thought to yourself, “I can write that!”. Well, before diving into your code, you’d first have to write something called a bootloader.

A bootloader is code that runs early on in a PC’s, Mac’s, Raspberry Pi’s or microcontroller’s boot sequence, before anything like an operating system is up. Often its job is to set up minimal hardware, such as RAM, and then load the OS or your embedded code.

[Alex Parker] has written a three-part series of clear blog posts that make writing the bootloader part easy, at least for x86 machines. And the nice thing is that you don’t need an x86 to get started. He does it on a Mac using the QEMU processor emulator, though he also talks about doing it under Windows and Linux.

In the first part of the series, the bootloader leaves you in the x86’s real mode, with 16-bit instructions and access to one megabyte of memory — think pre-80286 days, or 1982 for those of us who were computing back then. To prove it works, he uses BIOS calls to display “Hello world!”. This also shows that through the BIOS, you have a set of peripherals you can work with.

In the second part, he shows how to set up 32-bit protected mode and a Global Descriptor Table, making access to a large amount of memory easier.

In the first two parts, the code is written in assembly, so in the third part he finishes the series by showing how to load C++ code into memory and execute it. That C++ code would of course be your application, which we’ll leave to your imagination.

It’s reasonably rare to write bootloader code for a desktop computer — much less so for microcontrollers. For instance, [Dmitry Grinberg] wrote his own bootloader so that he could have encrypted ROM images for his AVR on USB. And we’ve talked about [Lady Ada]’s guide to burning Arduino bootloaders. But if you want to get down to the bare metal on your x86, the bootloader is the place to start. And it’s not so bad.

Find Instructions Hidden In Your CPU


There was a time when owning a computer meant you probably knew most or all of the instructions it could execute. Your modern PC, though, has a lot of instructions, many of them meant for specialized operating system, encryption, or digital signal processing features.

There are known undocumented instructions in a lot of x86-class CPUs, too. What’s more, these days your x86 CPU might really be a virtual machine running on a different processor, or your CPU could have a defect or a bug. Maybe you want to run sandsifter–a program that searches for erroneous or undocumented instructions. Who knows what is lurking in your CPU?

Continue reading “Find Instructions Hidden In Your CPU”

First Thoughts On The New UP Core

I normally stay away from talking about x86 single-board computers because I don’t have a lot to say about them. They’re too expensive, and run too hot, to be interesting. Enter the new UP Core funding now on Kickstarter.

The UP Core is just 56.5 mm × 66 mm (2.2 in × 2.6 in) and powered by a 64-bit Quad Core Intel Atom clocked at either 1.44 GHz or 1.92 GHz. It will ship with either 2 GB or 4 GB of RAM, and either 32 GB or 64 GB of eMMC. The board has a USB 3 port, HDMI, DSI/eDP, and two MIPI-CSI ports supporting either a 2 MP or 8 MP camera. It has both WiFi 802.11 b/g/n and Bluetooth LE built-in.

In other words it’s powerful enough to serve as a desktop PC running Linux, Android, or a full Windows 10 installation. The cheapest UP Core configuration—with 1 GB memory and 16 GB eMMC—is €69, or around $75. Continue reading “First Thoughts On The New UP Core”