All Projects → WindowsNT → Asm

WindowsNT / Asm

Assembly Tutorial for DOS

Programming Languages

c
50402 projects - #5 most used programming language
assembly
5116 projects
assembler
53 projects

Projects that are alternatives of or similar to Asm

Project-Mendacius
A GUI based virtualisation tool for running Linux on macOS Big Sur (x86 or arm64)
Stars: ✭ 107 (-14.4%)
Mutual labels:  virtualbox, vmware, virtualization
Icebox
Virtual Machine Introspection, Tracing & Debugging
Stars: ✭ 422 (+237.6%)
Mutual labels:  debugging, virtualization, virtualbox
plainvm
plainvm allows you to control multiple virtual machines which are distributed among many hosts through your browser.
Stars: ✭ 37 (-70.4%)
Mutual labels:  virtualbox, vmware, virtual-machine
insaneworks-packer-template
CentOS 7-8 8Stream / AlmaLinux 8 / FreeBSD 12 - 13 x64 + VirtualBox / VMWare for Packer Template + FreeBSD 13 / AlmaLinux 9 + Parallels
Stars: ✭ 38 (-69.6%)
Mutual labels:  virtualbox, vmware, x86-64
X64dbg
An open-source x64/x32 debugger for windows.
Stars: ✭ 37,825 (+30160%)
Mutual labels:  x86, x86-64, x64
ansible virtualization
Ansible Collection: Virtualization roles
Stars: ✭ 31 (-75.2%)
Mutual labels:  virtualbox, vmware, virtualization
Labeless
Labeless is a multipurpose IDA Pro plugin system for labels/comments synchronization with a debugger backend, with complex memory dumping and interactive Python scripting capabilities.
Stars: ✭ 378 (+202.4%)
Mutual labels:  x86, x86-64, x64
Capstone.NET
.NET Core and .NET Framework binding for the Capstone Disassembly Framework
Stars: ✭ 108 (-13.6%)
Mutual labels:  x64, x86-64, x86
Distorm
Powerful Disassembler Library For x86/AMD64
Stars: ✭ 829 (+563.2%)
Mutual labels:  x86, x86-64, x64
Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (+554.4%)
Mutual labels:  x86, x86-64, x64
Reloaded.Assembler
Minimal .NET wrapper around the simple, easy to use Flat Assembler written by Tomasz Grysztar. Supports both x64 and x86 development.
Stars: ✭ 17 (-86.4%)
Mutual labels:  x64, x86-64, x86
Osx Vm Templates
macOS templates for Packer and VeeWee.
Stars: ✭ 1,050 (+740%)
Mutual labels:  vmware, virtualization, virtualbox
uvmm
Virtual machine monitor for L4Re
Stars: ✭ 22 (-82.4%)
Mutual labels:  virtual-machine, x86-64, virtualization
SelfPortal
One for all virtualization abstraction layer.
Stars: ✭ 22 (-82.4%)
Mutual labels:  vmware, virtual-machine, virtualization
CodeDeobfuscator
Code Deobfuscator
Stars: ✭ 45 (-64%)
Mutual labels:  virtual-machine, x86-64, x86
X86 Bare Metal Examples
Dozens of minimal operating systems to learn x86 system programming. Tested on Ubuntu 17.10 host in QEMU 2.10 and real hardware. Userland cheat at: https://github.com/cirosantilli/linux-kernel-module-cheat#userland-assembly ARM baremetal setup at: https://github.com/cirosantilli/linux-kernel-module-cheat#baremetal-setup 学习x86系统编程的数十个最小操作系统。 已在QE…
Stars: ✭ 3,985 (+3088%)
Mutual labels:  x86, x86-64, x64
profiler-api
The portable version of JetBrains profiler API for .NET Framework / .NET Core / .NET / .NET Standard / Mono
Stars: ✭ 21 (-83.2%)
Mutual labels:  x64, x86-64, x86
upstream-institute-virtual-environment
A Vagrant-based image creator for OpenStack Upstream Training sessions
Stars: ✭ 18 (-85.6%)
Mutual labels:  virtualbox, vmware, virtual-machine
Arm now
arm_now is a qemu powered tool that allows instant setup of virtual machines on arm cpu, mips, powerpc, nios2, x86 and more, for reverse, exploit, fuzzing and programming purpose.
Stars: ✭ 719 (+475.2%)
Mutual labels:  x86, x86-64, virtual-machine
Beelzebub
The Lord of Flies - A hobby operating system
Stars: ✭ 24 (-80.8%)
Mutual labels:  x86, x86-64, x64

Assembly Manual

Welcome to my assembly tutorials.

Articles:

Older Articles:

At the moment, the first part is implemented (Real/Protected/Long mode), the Protected Mode Virtualization (working in Bochs), the third part (test SIPI multicore, working on Bochs and VMWare) and the fourth part finished (DMMI). More to follow soon.

Instructions

  1. Edit build.bat to specify flat assembler (FASM) path.
  2. Edit startbochs.bat, startvmware.bat and startvbox.bat to locate the executables of these applications. Bochs is included in the repository.

Build and run, it will automatically start bochs/vmware/virtualbox with the included FreeDOS image. It will create a CD-ROM as D: and you can run it from d:\entry.exe, by default it is automatically run (autoexec.bat)

3rd Party Apps included

  1. DOS32A - http://dos32a.narechk.net/index_en.html
  2. 386SWAT - http://www.sudleyplace.com/swat/
  3. UDIS86 - http://udis86.sourceforge.net/ , including an open watcom C project that is used by VDEBUG and MDEBUG
  4. DPMIONE - http://www.sudleyplace.com/dpmione/
  5. QLINK - http://www.sudleyplace.com/qlink/

Tests performed

  1. Real mode test
  2. Protected mode test with or without paging
  3. Long mode test with paging and PAE
  4. Real mode thread calling
  5. Real mode thread called from protected mode
  6. Real mode thread called from long mode
  7. Protected mode thread called from real mode
  8. Long mode thread called from real mode
  9. VMX is there
  10. Spawn a Virtual Machine in Unrestricted guest mode. Paged Protected Mode guest also there.
  11. Entry /r which installs as TSR the DMMI services
  12. DPMI startup example taken from https://board.flatassembler.net/topic.php?t=7122
  13. DMMIC app runs which demonstrates DMMI, launching real mode, protected mode, long mode and virtualized protected mode threads
  14. DOS32A loads a linear executable created with FASM
  15. VDEBUG Virtualized Debugger (Not fully implemented yet)
  16. MDEBUG Multicore Debugger (Not fully implemented yet)
  17. SWITCHER multitasker (Not fully implemented yet)

DMMI

I've called it DOS Multicore Mode Interface. It is a driver which helps you develop 32 and 64 bit multicore applications for DOS, using int 0xF0. This interrupt is accessible from both real, protected and long mode. Put the function number to AH.

To check for existence, check the vector for INT 0xF0. It should not be pointing to 0 or to an IRET, ES:BX+2 should point to a dword 'dmmi'.

Int 0xF0 provides the following functions to all modes (real, protected, long)

  1. AH = 0, verify existence. Return values, AX = 0xFACE if the driver exists, DL = total CPUs, DH = virtualization support (0 none, 1 PM only, 2 Unrestricted guest). This function is accessible from real, protected and long mode.
  2. AH = 1, begin thread. BL is the CPU index (1 to max-1). The function creates a thread, depending on AL:
    • 0, begin (un)real mode thread. ES:DX = new thread seg:ofs. The thread is run with FS capable of unreal mode addressing, must use RETF to return.
    • 1, begin 32 bit protected mode thread. EDX is the linear address of the thread. The thread must return with RETF.
    • 2, begin 64 bit long mode thread. EDX holds the linear address of the code to start in 64-bit long mode. The thread must terminate with RET.
    • 3, begin virtualized thread. BH contains the virtualization mode (1 for unrestricted guest real mode thread, and 2 for protected mode), and EDX the virtualized linear stack (or in seg:ofs format if unrestricted guest). The thread must return with RETF or VMCALL.
  3. AH = 5, mutex functions. This function is accessible from all modes.
    • AL = 0 => initialize mutex to ES:DI (real) , EDI linear (protected), RDI linear (long).
    • AL = 1 => Lock mutex
    • AL = 2 => Unlock mutex
    • AL = 3 => Wait for mutex
  4. AH = 4, execute real mode interrupt. This function is accessible from all modes. AL is the interrupt number, BP holds the AX value and BX,CX,DX,SI,DI are passed to the interrupt. DS and ES are loaded from the high 16 bits of ESI and EDI.
  5. AH = 9, Switch To Mode.
    • From real mode: AL = 0 (enter unreal), AL = 2 (enter long, ECX = linear address to start. Code must set IDT found at [rax] on entry)
    • From long mode: AL = 0, go back to real, ECX = linear.

Now, if you have more than one CPU, your DOS applications/games can now directly access all 2^64 of memory and all your CPUs, while still being able to call DOS directly.

In order to avoid calling int 0xF0 directly from assembly and to make the driver compatible with higher level languages, an INT 0x21 redirection handler is installed. If you call INT 0x21 from the main thread, INT 0x21 is executed directly. If you call INT 0x21 from protected or long mode thread, then INT 0xF0 function AX = 0x0421 is executed automatically.

Virtualization Debugger

Debugging protected or long mode under DOS is next to impossible. I am now trying to create a simple DEBUG enhancement, called VDEBUG, which should be able to debug any DOS app in virtualization.

Compile it with config.asm VDEBUG = 1. This app does the following:

  • Load the debugee (int 0x21, function 0x4B01)
  • Enter long mode (int 0xf0, function 0x0902)
  • Prepare virtualization structures (int 0xf0, function 0x0801)
  • Launch an unrestricted guest VM
  • In the VM, set the trap flag so each opcode causes a VMEXIT.
  • Jump to the entry point of the debugee
  • When target process calls int 0x21 function 0x4C to terminate, control returns to the command next to the int 0x21 function 0x4B01 call. Check there if under virtual machine. If so, do VMCALL to exit.
  • Go back to real mode and exit.
  • At the moment, the implemented functions are:
    • r - (registers) - shows Control, General, Segment regs, Dissassembly and bytes using UDIS86
    • g - (go) - runs program
    • t - (trace) - traces commands
    • h - (help) - shows help
    • q - (quit) - quits

Multicore Debugger

Debugging protected or long mode under DOS is next to impossible (again). I am now trying to create a simple DEBUG enhancement, called MDEBUG, which should be able to debug any DOS app from another CPU core.

Compile it with config.asm MDEBUG = 1. This app should perform the following:

  • Jump to another core
  • Load the debugee (int 0x21, function 0x4B01)
  • Set the trap flag
  • On exception, HLT the first processor then go to the MDEBUG processor
  • On resume, send resume IPI to the first processor

This project is not yet created, but I hope that it will be here soon!

Switcher

Switcher is a DMMI client that is able to do multitasking in DOS using multiple cores and virtualization. More to follow soon!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].