1 | ; $Id: DosVmOff.asm 82968 2020-02-04 10:35:17Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; 16-bit DOS COM program that powers off the VM.
|
---|
4 | ;
|
---|
5 | ; Build: yasm -f bin -i../../../../../include/ DosVmOff.asm -o DosVmOff.com
|
---|
6 | ;
|
---|
7 |
|
---|
8 | ;
|
---|
9 | ; Copyright (C) 2018-2020 Oracle Corporation
|
---|
10 | ;
|
---|
11 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
13 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | ; General Public License (GPL) as published by the Free Software
|
---|
15 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | ;
|
---|
19 | ; The contents of this file may alternatively be used under the terms
|
---|
20 | ; of the Common Development and Distribution License Version 1.0
|
---|
21 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
22 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
23 | ; CDDL are applicable instead of those of the GPL.
|
---|
24 | ;
|
---|
25 | ; You may elect to license modified versions of this file under the
|
---|
26 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
27 | ;
|
---|
28 |
|
---|
29 |
|
---|
30 |
|
---|
31 | %include "VBox/bios.mac"
|
---|
32 |
|
---|
33 | org 100h
|
---|
34 |
|
---|
35 | segment text
|
---|
36 | main:
|
---|
37 | %if 0
|
---|
38 | ; Setup stack.
|
---|
39 | mov ax, stack
|
---|
40 | mov ss, ax
|
---|
41 | mov sp, top_of_stack
|
---|
42 | %endif
|
---|
43 |
|
---|
44 | ; Do the shutdown thing.
|
---|
45 | mov ax, cs
|
---|
46 | mov ds, ax
|
---|
47 |
|
---|
48 | mov bl, 64
|
---|
49 | mov dx, VBOX_BIOS_SHUTDOWN_PORT
|
---|
50 | mov ax, VBOX_BIOS_OLD_SHUTDOWN_PORT
|
---|
51 | .retry:
|
---|
52 | mov cx, 8
|
---|
53 | mov si, .s_szShutdown
|
---|
54 | rep outsb
|
---|
55 | xchg ax, dx ; alternate between the new (VBox) and old (Bochs) ports.
|
---|
56 | dec bl
|
---|
57 | jnz .retry
|
---|
58 |
|
---|
59 |
|
---|
60 | ; Probably not a VBox VM, exit the program with errorlevel 1.
|
---|
61 | .whatever:
|
---|
62 | mov ax, 04c01h
|
---|
63 | int 021h
|
---|
64 | hlt
|
---|
65 | jmp .whatever
|
---|
66 |
|
---|
67 | .s_szShutdown:
|
---|
68 | db 'Shutdown', 0
|
---|
69 |
|
---|