Search code examples
assemblyx86nasmx86-emulation

Running nasm program on ARM linux


I am trying to teach myself assembly programming with NASM. However I only have a Chromebook with ARM processor. I have xubuntu running on it with crunton. However how can I setup a x86 emulation environment to get myself started? I also want to be able to use insight debugger.


Solution

  • Try bochs or qemu.

    If you're only on a chromebook probably without a lot of RAM, you probably just want to run a very minimal Linux system inside your emulated x86 environment. Not a full xubuntu GUI install inside the emulated x86 environment.

    For learning x86, you should start with 32 or 64bit ASM, either for functions you call from C, or as a standalone program. (Either really standalone, where you don't link with the C standard runtime or library, and write your own _start in asm, and make your own system calls, or just write main in asm and end your program with a ret from main.)

    bochs has a built-in debugger, but using it would be more appropriate for debugging the kernel, or boot-loader. IDK anything about the Insight debugger, but if it can remote-debug, running an ARM binary of it natively, connected to the target you want to debug, might make sense.

    You could write x86 asm that you boot directly (instead of a Linux image), but then you'd only have BIOS calls available, and the CPU would start in 16bit real mode with segmented memory and all that crap that's basically useless to learn except for writing bootloaders.