VirtualBox

source: vbox/trunk/src/VBox/Devices/BiosCommonCode/__I4M.asm@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 22 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1; $Id: __I4M.asm 98103 2023-01-17 14:15:46Z vboxsync $
2;; @file
3; Compiler support routines.
4;
5
6;
7; Copyright (C) 2012-2023 Oracle and/or its affiliates.
8;
9; This file is part of VirtualBox base platform packages, as
10; available from https://www.virtualbox.org.
11;
12; This program is free software; you can redistribute it and/or
13; modify it under the terms of the GNU General Public License
14; as published by the Free Software Foundation, in version 3 of the
15; License.
16;
17; This program is distributed in the hope that it will be useful, but
18; WITHOUT ANY WARRANTY; without even the implied warranty of
19; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20; General Public License for more details.
21;
22; You should have received a copy of the GNU General Public License
23; along with this program; if not, see <https://www.gnu.org/licenses>.
24;
25; SPDX-License-Identifier: GPL-3.0-only
26;
27
28
29;*******************************************************************************
30;* Exported Symbols *
31;*******************************************************************************
32public __I4M
33
34if VBOX_BIOS_CPU lt 80386
35extrn NeedToImplementOn8086__I4M:near
36endif
37
38; MASM (ML.EXE) is used for PXE and no longer understands the .8086 directive.
39; WASM is used for the BIOS and understands it just fine.
40ifdef __WASM__
41 .8086
42endif
43
44_TEXT segment public 'CODE' use16
45 assume cs:_TEXT
46
47;;
48; 32-bit signed multiplication.
49;
50; @param dx:ax Factor 1.
51; @param cx:bx Factor 2.
52; @returns dx:ax Result.
53; cx, es may be modified; di is preserved
54;
55__I4M:
56 pushf
57if VBOX_BIOS_CPU ge 80386
58 .386
59 push eax
60 push edx
61 push ecx
62 push ebx
63
64 rol eax, 16
65 mov ax, dx
66 ror eax, 16
67 xor edx, edx
68
69 shr ecx, 16
70 mov cx, bx
71
72 imul ecx ; eax * ecx -> edx:eax
73
74 pop ebx
75 pop ecx
76
77 pop edx
78 ror eax, 16
79 mov dx, ax
80 add sp, 2
81 pop ax
82 rol eax, 16
83ifdef __WASM__
84 .8086
85endif
86
87else
88 call NeedToImplementOn8086__I4M
89endif
90
91 popf
92 ret
93
94
95_TEXT ends
96 end
97
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette