VirtualBox

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

Last change on this file since 89825 was 86686, checked in by vboxsync, 4 years ago

BIOS: Only use the .8086 directive when assembling using WASM; MASM no longer understands it and errors out.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1; $Id: __I4M.asm 86686 2020-10-23 13:13:34Z vboxsync $
2;; @file
3; Compiler support routines.
4;
5
6;
7; Copyright (C) 2012-2020 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17
18
19;*******************************************************************************
20;* Exported Symbols *
21;*******************************************************************************
22public __I4M
23
24if VBOX_BIOS_CPU lt 80386
25extrn NeedToImplementOn8086__I4M:near
26endif
27
28; MASM (ML.EXE) is used for PXE and no longer understands the .8086 directive.
29; WASM is used for the BIOS and understands it just fine.
30ifdef __WASM__
31 .8086
32endif
33
34_TEXT segment public 'CODE' use16
35 assume cs:_TEXT
36
37;;
38; 32-bit signed multiplication.
39;
40; @param dx:ax Factor 1.
41; @param cx:bx Factor 2.
42; @returns dx:ax Result.
43; cx, es may be modified; di is preserved
44;
45__I4M:
46 pushf
47if VBOX_BIOS_CPU ge 80386
48 .386
49 push eax
50 push edx
51 push ecx
52 push ebx
53
54 rol eax, 16
55 mov ax, dx
56 ror eax, 16
57 xor edx, edx
58
59 shr ecx, 16
60 mov cx, bx
61
62 imul ecx ; eax * ecx -> edx:eax
63
64 pop ebx
65 pop ecx
66
67 pop edx
68 ror eax, 16
69 mov dx, ax
70 add sp, 2
71 pop ax
72 rol eax, 16
73ifdef __WASM__
74 .8086
75endif
76
77else
78 call NeedToImplementOn8086__I4M
79endif
80
81 popf
82 ret
83
84
85_TEXT ends
86 end
87
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