VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c16-SwitchFromV86To16BitAndCallC.asm@ 61533

Last change on this file since 61533 was 60676, checked in by vboxsync, 9 years ago

bs3kit: updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1; $Id: bs3-c16-SwitchFromV86To16BitAndCallC.asm 60676 2016-04-24 11:04:57Z vboxsync $
2;; @file
3; BS3Kit - Bs3SwitchFromV86To16BitAndCallC
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;*********************************************************************************************************************************
28;* Header Files *
29;*********************************************************************************************************************************
30%include "bs3kit-template-header.mac"
31%if TMPL_BITS != 16
32 %error "16-bit only"
33%endif
34
35
36;*********************************************************************************************************************************
37;* External Symbols *
38;*********************************************************************************************************************************
39%ifdef BS3_STRICT
40BS3_EXTERN_DATA16 g_bBs3CurrentMode
41TMPL_BEGIN_TEXT
42BS3_EXTERN_CMN Bs3Panic
43%endif
44BS3_EXTERN_CMN Bs3SwitchTo16Bit
45BS3_EXTERN_CMN Bs3SwitchTo16BitV86
46BS3_EXTERN_CMN Bs3SelRealModeCodeToProtMode
47
48
49;;
50; @cproto BS3_CMN_PROTO_STUB(int, Bs3SwitchFromV86To16BitAndCallC,(FPFNBS3FAR fpfnCall, unsigned cbParams, ...));
51;
52BS3_PROC_BEGIN_CMN Bs3SwitchFromV86To16BitAndCallC, BS3_PBC_HYBRID
53 inc bp
54 push bp
55 mov bp, sp
56
57 ;
58 ; Push the arguments first.
59 ;
60 mov ax, si ; save si
61 mov si, [bp + 2 + cbCurRetAddr + 4]
62%ifdef BS3_STRICT
63 test si, 1
64 jz .cbParams_ok
65 call Bs3Panic
66.cbParams_ok:
67 test byte [g_bBs3CurrentMode], BS3_MODE_CODE_V86
68 jnz .mode_ok
69 call Bs3Panic
70.mode_ok:
71%endif
72
73.push_more:
74 push word [bp + 2 + cbCurRetAddr + 4 + 2 + si - 2]
75 sub si, 2
76 jnz .push_more
77 mov si, ax ; restore si
78
79 ;
80 ; Convert the code segment to a 16-bit prot mode selector
81 ;
82 push word [bp + 2 + cbCurRetAddr + 2]
83 call Bs3SelRealModeCodeToProtMode
84 mov [bp + 2 + cbCurRetAddr + 2], ax
85 add sp, 2
86
87 ;
88 ; Switch mode.
89 ;
90 call Bs3SwitchTo16Bit
91 call far [bp + 2 + cbCurRetAddr]
92 call Bs3SwitchTo16BitV86
93
94 mov sp, bp
95 pop bp
96 dec bp
97 BS3_HYBRID_RET
98BS3_PROC_END_CMN Bs3SwitchFromV86To16BitAndCallC
99
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