1 | ; $Id: bs3-cmn-RegSetDrX.asm 76553 2019-01-01 01:45:53Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3RegSetDrX
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2019 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 |
|
---|
29 |
|
---|
30 | BS3_EXTERN_CMN Bs3Panic
|
---|
31 | BS3_EXTERN_CMN Bs3Syscall
|
---|
32 | %if TMPL_BITS == 16
|
---|
33 | BS3_EXTERN_DATA16 g_bBs3CurrentMode
|
---|
34 | %endif
|
---|
35 | TMPL_BEGIN_TEXT
|
---|
36 |
|
---|
37 | ;TONLY16 CPU 386
|
---|
38 |
|
---|
39 | ;;
|
---|
40 | ; @cproto BS3_CMN_PROTO_STUB(void, Bs3RegSetDrX,(uint8_t iReg, RTCCUINTXREG uValue));
|
---|
41 | ;
|
---|
42 | ; @returns Register value.
|
---|
43 | ; @param iRegister The source register
|
---|
44 | ; @param uValue The new Value.
|
---|
45 |
|
---|
46 | ; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
|
---|
47 | ;
|
---|
48 | ; @uses No GPRs.
|
---|
49 | ;
|
---|
50 | BS3_PROC_BEGIN_CMN Bs3RegSetDrX, BS3_PBC_HYBRID_SAFE
|
---|
51 | BS3_CALL_CONV_PROLOG 2
|
---|
52 | push xBP
|
---|
53 | mov xBP, xSP
|
---|
54 | push sSI
|
---|
55 | push xDX
|
---|
56 |
|
---|
57 | mov sSI, [xBP + xCB + cbCurRetAddr + xCB]
|
---|
58 |
|
---|
59 | %if TMPL_BITS == 16
|
---|
60 | ; If V8086 mode we have to go thru a syscall.
|
---|
61 | test byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86
|
---|
62 | jnz .via_system_call
|
---|
63 | cmp byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_RM
|
---|
64 | je .direct_access
|
---|
65 | %endif
|
---|
66 | ; If not in ring-0, we have to make a system call.
|
---|
67 | mov dx, ss
|
---|
68 | and dx, X86_SEL_RPL
|
---|
69 | jnz .via_system_call
|
---|
70 |
|
---|
71 | .direct_access:
|
---|
72 | ; Switch (iRegister)
|
---|
73 | mov dl, [xBP + xCB + cbCurRetAddr]
|
---|
74 | cmp dl, 6
|
---|
75 | jz .set_dr6
|
---|
76 | cmp dl, 7
|
---|
77 | jz .set_dr7
|
---|
78 | cmp dl, 0
|
---|
79 | jz .set_dr0
|
---|
80 | cmp dl, 1
|
---|
81 | jz .set_dr1
|
---|
82 | cmp dl, 2
|
---|
83 | jz .set_dr2
|
---|
84 | cmp dl, 3
|
---|
85 | jz .set_dr3
|
---|
86 | cmp dl, 4
|
---|
87 | jz .set_dr4
|
---|
88 | cmp dl, 5
|
---|
89 | jz .set_dr5
|
---|
90 |
|
---|
91 | call Bs3Panic
|
---|
92 |
|
---|
93 | .set_dr0:
|
---|
94 | mov dr0, sSI
|
---|
95 | jmp .return
|
---|
96 | .set_dr1:
|
---|
97 | mov dr1, sSI
|
---|
98 | jmp .return
|
---|
99 | .set_dr2:
|
---|
100 | mov dr2, sSI
|
---|
101 | jmp .return
|
---|
102 | .set_dr3:
|
---|
103 | mov dr3, sSI
|
---|
104 | jmp .return
|
---|
105 | .set_dr4:
|
---|
106 | mov dr4, sSI
|
---|
107 | jmp .return
|
---|
108 | .set_dr5:
|
---|
109 | mov dr5, sSI
|
---|
110 | jmp .return
|
---|
111 | .set_dr7:
|
---|
112 | mov dr7, sSI
|
---|
113 | jmp .return
|
---|
114 | .set_dr6:
|
---|
115 | mov dr6, sSI
|
---|
116 | jmp .return
|
---|
117 |
|
---|
118 | .via_system_call:
|
---|
119 | mov dl, [xBP + xCB + cbCurRetAddr]
|
---|
120 | push xAX
|
---|
121 | mov xAX, BS3_SYSCALL_SET_DRX
|
---|
122 | call Bs3Syscall
|
---|
123 | pop xAX
|
---|
124 |
|
---|
125 | .return:
|
---|
126 | pop xDX
|
---|
127 | pop sSI
|
---|
128 | pop xBP
|
---|
129 | BS3_CALL_CONV_EPILOG 2
|
---|
130 | BS3_HYBRID_RET
|
---|
131 | BS3_PROC_END_CMN Bs3RegSetDrX
|
---|
132 |
|
---|