1 | ; $Id: bs3-cmn-KbdRead.asm 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3KbdRead.
|
---|
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 |
|
---|
40 | ;;
|
---|
41 | ; Sends a read command to the keyboard controller and gets the result.
|
---|
42 | ;
|
---|
43 | ; The caller is responsible for making sure the keyboard controller is ready
|
---|
44 | ; for a command (call Bs3KbdWait if unsure).
|
---|
45 | ;
|
---|
46 | ; @returns The value read is returned (in al).
|
---|
47 | ; @param bCmd The read command.
|
---|
48 | ; @uses al (obviously)
|
---|
49 | ;
|
---|
50 | ; @cproto BS3_DECL(uint8_t) Bs3KbdRead_c16(uint8_t bCmd);
|
---|
51 | ;
|
---|
52 | BS3_PROC_BEGIN_CMN Bs3KbdRead, BS3_PBC_NEAR
|
---|
53 | push xBP
|
---|
54 | mov xBP, xSP
|
---|
55 |
|
---|
56 | mov al, [xBP + xCB*2]
|
---|
57 | out 64h, al ; Write the command.
|
---|
58 |
|
---|
59 | .check_status:
|
---|
60 | in al, 64h
|
---|
61 | test al, 1 ; KBD_STAT_OBF
|
---|
62 | jz .check_status
|
---|
63 |
|
---|
64 | in al, 60h ; Read the data.
|
---|
65 |
|
---|
66 | pop xBP
|
---|
67 | BS3_HYBRID_RET
|
---|
68 | BS3_PROC_END_CMN Bs3KbdRead
|
---|
69 |
|
---|
70 | ;
|
---|
71 | ; We may be using the near code in some critical code paths, so don't
|
---|
72 | ; penalize it.
|
---|
73 | ;
|
---|
74 | BS3_CMN_FAR_STUB Bs3KbdRead, 2
|
---|
75 |
|
---|