VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetDrX.asm@ 97624

Last change on this file since 97624 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1; $Id: bs3-cmn-RegSetDrX.asm 96407 2022-08-22 17:43:14Z vboxsync $
2;; @file
3; BS3Kit - Bs3RegSetDrX
4;
5
6;
7; Copyright (C) 2007-2022 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; The contents of this file may alternatively be used under the terms
26; of the Common Development and Distribution License Version 1.0
27; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28; in the VirtualBox distribution, in which case the provisions of the
29; CDDL are applicable instead of those of the GPL.
30;
31; You may elect to license modified versions of this file under the
32; terms and conditions of either the GPL or the CDDL or both.
33;
34; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35;
36
37%include "bs3kit-template-header.mac"
38
39
40BS3_EXTERN_CMN Bs3Panic
41BS3_EXTERN_CMN Bs3Syscall
42%if TMPL_BITS == 16
43BS3_EXTERN_DATA16 g_bBs3CurrentMode
44%endif
45TMPL_BEGIN_TEXT
46
47;TONLY16 CPU 386
48
49;;
50; @cproto BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(uint8_t iReg, RTCCUINTXREG uValue));
51;
52; @returns Register value.
53; @param iRegister The source register
54; @param uValue The new Value.
55
56; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
57;
58; @uses No GPRs.
59;
60BS3_PROC_BEGIN_CMN Bs3RegSetDrX, BS3_PBC_HYBRID_SAFE
61 BS3_CALL_CONV_PROLOG 2
62 push xBP
63 mov xBP, xSP
64 push sSI
65 push xDX
66
67 mov sSI, [xBP + xCB + cbCurRetAddr + xCB]
68
69%if TMPL_BITS == 16
70 ; If V8086 mode we have to go thru a syscall.
71 test byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
72 jnz .via_system_call
73 cmp byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_RM
74 je .direct_access
75%endif
76 ; If not in ring-0, we have to make a system call.
77 mov dx, ss
78 and dx, X86_SEL_RPL
79 jnz .via_system_call
80
81.direct_access:
82 ; Switch (iRegister)
83 mov dl, [xBP + xCB + cbCurRetAddr]
84 cmp dl, 6
85 jz .set_dr6
86 cmp dl, 7
87 jz .set_dr7
88 cmp dl, 0
89 jz .set_dr0
90 cmp dl, 1
91 jz .set_dr1
92 cmp dl, 2
93 jz .set_dr2
94 cmp dl, 3
95 jz .set_dr3
96 cmp dl, 4
97 jz .set_dr4
98 cmp dl, 5
99 jz .set_dr5
100
101 call Bs3Panic
102
103.set_dr0:
104 mov dr0, sSI
105 jmp .return
106.set_dr1:
107 mov dr1, sSI
108 jmp .return
109.set_dr2:
110 mov dr2, sSI
111 jmp .return
112.set_dr3:
113 mov dr3, sSI
114 jmp .return
115.set_dr4:
116 mov dr4, sSI
117 jmp .return
118.set_dr5:
119 mov dr5, sSI
120 jmp .return
121.set_dr7:
122 mov dr7, sSI
123 jmp .return
124.set_dr6:
125 mov dr6, sSI
126 jmp .return
127
128.via_system_call:
129 mov dl, [xBP + xCB + cbCurRetAddr]
130 push xAX
131 mov xAX, BS3_SYSCALL_SET_DRX
132 call Bs3Syscall
133 pop xAX
134
135.return:
136 pop xDX
137 pop sSI
138 pop xBP
139 BS3_CALL_CONV_EPILOG 2
140 BS3_HYBRID_RET
141BS3_PROC_END_CMN Bs3RegSetDrX
142
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