1 | ; $Id: DosVmOff.asm 96407 2022-08-22 17:43:14Z 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-2022 Oracle and/or its affiliates.
|
---|
10 | ;
|
---|
11 | ; This file is part of VirtualBox base platform packages, as
|
---|
12 | ; available from https://www.virtualbox.org.
|
---|
13 | ;
|
---|
14 | ; This program is free software; you can redistribute it and/or
|
---|
15 | ; modify it under the terms of the GNU General Public License
|
---|
16 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
17 | ; License.
|
---|
18 | ;
|
---|
19 | ; This program is distributed in the hope that it will be useful, but
|
---|
20 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | ; General Public License for more details.
|
---|
23 | ;
|
---|
24 | ; You should have received a copy of the GNU General Public License
|
---|
25 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | ;
|
---|
27 | ; The contents of this file may alternatively be used under the terms
|
---|
28 | ; of the Common Development and Distribution License Version 1.0
|
---|
29 | ; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
30 | ; in the VirtualBox distribution, in which case the provisions of the
|
---|
31 | ; CDDL are applicable instead of those of the GPL.
|
---|
32 | ;
|
---|
33 | ; You may elect to license modified versions of this file under the
|
---|
34 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
35 | ;
|
---|
36 | ; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
37 | ;
|
---|
38 |
|
---|
39 |
|
---|
40 |
|
---|
41 | %include "VBox/bios.mac"
|
---|
42 |
|
---|
43 | org 100h
|
---|
44 |
|
---|
45 | segment text
|
---|
46 | main:
|
---|
47 | %if 0
|
---|
48 | ; Setup stack.
|
---|
49 | mov ax, stack
|
---|
50 | mov ss, ax
|
---|
51 | mov sp, top_of_stack
|
---|
52 | %endif
|
---|
53 |
|
---|
54 | ; Do the shutdown thing.
|
---|
55 | mov ax, cs
|
---|
56 | mov ds, ax
|
---|
57 |
|
---|
58 | mov bl, 64
|
---|
59 | mov dx, VBOX_BIOS_SHUTDOWN_PORT
|
---|
60 | mov ax, VBOX_BIOS_OLD_SHUTDOWN_PORT
|
---|
61 | .retry:
|
---|
62 | mov cx, 8
|
---|
63 | mov si, .s_szShutdown
|
---|
64 | rep outsb
|
---|
65 | xchg ax, dx ; alternate between the new (VBox) and old (Bochs) ports.
|
---|
66 | dec bl
|
---|
67 | jnz .retry
|
---|
68 |
|
---|
69 |
|
---|
70 | ; Probably not a VBox VM, exit the program with errorlevel 1.
|
---|
71 | .whatever:
|
---|
72 | mov ax, 04c01h
|
---|
73 | int 021h
|
---|
74 | hlt
|
---|
75 | jmp .whatever
|
---|
76 |
|
---|
77 | .s_szShutdown:
|
---|
78 | db 'Shutdown', 0
|
---|
79 |
|
---|