VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-wc16-U8DR.asm@ 60009

Last change on this file since 60009 was 58809, checked in by vboxsync, 9 years ago

bs3kit: Watcom intrinsics (no 64-bit division yet) and printf.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1; $Id: bs3-wc16-U8DR.asm 58809 2015-11-21 19:28:49Z vboxsync $
2;; @file
3; BS3Kit - 16-bit Watcom C/C++, 64-bit unsigned integer modulo.
4;
5
6;
7; Copyright (C) 2007-2015 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; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27%include "bs3kit-template-header.mac"
28
29BS3_EXTERN_CMN Bs3UInt64Div
30
31
32;;
33; 64-bit unsigned integer modulo, SS variant.
34;
35; @returns ax:bx:cx:dx reminder.
36; @param ax:bx:cx:dx Dividend.
37; @param [ss:si] Divisor
38;
39; @uses Nothing.
40;
41global $_?U8DR
42$_?U8DR:
43 push es
44 push ss
45 pop es
46 call $_?U8DRE
47 pop es
48 ret
49
50;;
51; 64-bit unsigned integer modulo, ES variant.
52;
53; @returns ax:bx:cx:dx reminder.
54; @param ax:bx:cx:dx Dividend.
55; @param [es:si] Divisor
56;
57; @uses Nothing.
58;
59global $_?U8DRE
60$_?U8DRE:
61 push ds
62 push es
63
64 ;
65 ; Convert to a C __cdecl call - not doing this in assembly.
66 ;
67
68 ; Set up a frame of sorts, allocating 16 bytes for the result buffer.
69 push bp
70 sub sp, 10h
71 mov bp, sp
72
73 ; Pointer to the return buffer.
74 push ss
75 push bp
76 add bp, 10h ; Correct bp.
77
78 ; The divisor.
79 push dword [es:si + 4]
80 push dword [es:si]
81
82 ; The dividend.
83 push dx
84 push cx
85 push bx
86 push ax
87
88 call Bs3UInt64Div
89
90 ; Load the reminder.
91 mov ax, [bp - 10h + 8 + 6]
92 mov bx, [bp - 10h + 8 + 4]
93 mov cx, [bp - 10h + 8 + 2]
94 mov dx, [bp - 10h + 8]
95
96 leave
97 pop es
98 pop ds
99 ret
100
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