1 | ; $Id: bs3-cpu-basic-2-template.mac 60657 2016-04-22 15:57:22Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - bs3-cpu-basic-2 assembly template.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2016 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 | %include "bs3kit-template-header.mac" ; setup environment
|
---|
29 |
|
---|
30 |
|
---|
31 | ;*********************************************************************************************************************************
|
---|
32 | ;* External Symbols *
|
---|
33 | ;*********************************************************************************************************************************
|
---|
34 | %undef Bs3Printf
|
---|
35 | BS3_EXTERN_CMN Bs3Printf
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | TMPL_BEGIN_TEXT
|
---|
40 |
|
---|
41 | ;
|
---|
42 | ; Code that is instantiated for every possible CPU mode
|
---|
43 | ;
|
---|
44 | %ifdef BS3_INSTANTIATING_MODE
|
---|
45 |
|
---|
46 | %if 0 ; Will be doing the testing in C, I think.
|
---|
47 | BS3_PROC_BEGIN_MODE bs3CpuBasic2_iret, BS3_PBC_FAR
|
---|
48 | BS3_CALL_CONV_PROLOG 1
|
---|
49 | push xBP
|
---|
50 | mov xBP, xSP
|
---|
51 | sub xSP, 20h
|
---|
52 |
|
---|
53 | %if TMPL_BITS == 64
|
---|
54 | %if TMPL_BITS == 16
|
---|
55 | xor ax, ax
|
---|
56 | mov al, [xBP + xCB*2]
|
---|
57 | push ax
|
---|
58 | push cs
|
---|
59 | push .szMsg wrt BS3TEXT16
|
---|
60 | call Bs3Printf
|
---|
61 | add sp, 6
|
---|
62 | %else
|
---|
63 | movzx xDX, byte [xBP + xCB*2]
|
---|
64 | push xDX
|
---|
65 | push .szMsg wrt FLAT
|
---|
66 | BS3_CALL Bs3Printf, 2
|
---|
67 | add xSP, xCB * 2
|
---|
68 | %endif
|
---|
69 | %endif
|
---|
70 |
|
---|
71 | ; Return
|
---|
72 | xor al, al
|
---|
73 | ;mov al, TMPL_MODE ; remove me
|
---|
74 |
|
---|
75 |
|
---|
76 | mov xSP, xBP
|
---|
77 | pop xBP
|
---|
78 | BS3_CALL_CONV_EPILOG 1
|
---|
79 | ret
|
---|
80 | .szMsg: db 'hello world %#x!', 13, 10, 0
|
---|
81 |
|
---|
82 | BS3_PROC_END_MODE bs3CpuBasic2_iret
|
---|
83 | %endif
|
---|
84 |
|
---|
85 | %endif ; BS3_INSTANTIATING_MODE
|
---|
86 |
|
---|
87 |
|
---|
88 | ;
|
---|
89 | ; Test code snippets containing code which differs between 16-bit, 32-bit
|
---|
90 | ; and 64-bit CPUs modes.
|
---|
91 | ;
|
---|
92 | %ifdef BS3_INSTANTIATING_CMN
|
---|
93 |
|
---|
94 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_sidt_bx_ud2, BS3_PBC_NEAR
|
---|
95 | sidt [xBX]
|
---|
96 | .again: ud2
|
---|
97 | jmp .again
|
---|
98 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_sidt_bx_ud2) == 3)
|
---|
99 | BS3_PROC_END_CMN bs3CpuBasic2_sidt_bx_ud2
|
---|
100 |
|
---|
101 |
|
---|
102 | BS3_PROC_BEGIN_CMN bs3CpuBasic2_lidt_bx_ud2, BS3_PBC_NEAR
|
---|
103 | lidt [xBX]
|
---|
104 | .again: ud2
|
---|
105 | jmp .again
|
---|
106 | AssertCompile(.again - BS3_CMN_NM(bs3CpuBasic2_lidt_bx_ud2) == 3)
|
---|
107 | BS3_PROC_END_CMN bs3CpuBasic2_lidt_bx_ud2
|
---|
108 |
|
---|
109 | %endif ; BS3_INSTANTIATING_CMN
|
---|
110 |
|
---|
111 | %include "bs3kit-template-footer.mac" ; reset environment
|
---|
112 |
|
---|