VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/BIOS/inlines.h@ 93956

Last change on this file since 93956 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/** @file
2 * Inline routines for Watcom C.
3 */
4
5/*
6 * Copyright (C) 2010-2022 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef VBOX_INCLUDED_SRC_Graphics_BIOS_inlines_h
18#define VBOX_INCLUDED_SRC_Graphics_BIOS_inlines_h
19#ifndef RT_WITHOUT_PRAGMA_ONCE
20# pragma once
21#endif
22
23extern unsigned inp(unsigned port);
24extern unsigned outp(unsigned port, unsigned value);
25extern unsigned inpw(unsigned port);
26extern unsigned outpw(unsigned port, unsigned value);
27#pragma intrinsic(inp,outp,inpw,outpw)
28#define inb(p) inp(p)
29#define outb(p, v) outp(p, v)
30#define inw(p) inpw(p)
31#define outw(p, v) outpw(p, v)
32
33/* Far byte/word/dword access routines. */
34
35inline uint8_t read_byte(uint16_t seg, uint16_t offset)
36{
37 return( *(seg:>(uint8_t *)offset) );
38}
39
40inline void write_byte(uint16_t seg, uint16_t offset, uint8_t data)
41{
42 *(seg:>(uint8_t *)offset) = data;
43}
44
45inline uint16_t read_word(uint16_t seg, uint16_t offset)
46{
47 return( *(seg:>(uint16_t *)offset) );
48}
49
50inline void write_word(uint16_t seg, uint16_t offset, uint16_t data)
51{
52 *(seg:>(uint16_t *)offset) = data;
53}
54
55inline uint32_t read_dword(uint16_t seg, uint16_t offset)
56{
57 return( *(seg:>(uint32_t *)offset) );
58}
59
60inline void write_dword(uint16_t seg, uint16_t offset, uint32_t data)
61{
62 *(seg:>(uint32_t *)offset) = data;
63}
64
65void int_enable(void);
66#pragma aux int_enable = "sti" modify exact [] nomemory;
67
68void int_disable(void);
69#pragma aux int_disable = "cli" modify exact [] nomemory;
70
71uint16_t int_query(void);
72#pragma aux int_query = \
73 "pushf" \
74 "pop ax" \
75 value [ax] modify exact [ax] nomemory;
76
77void int_restore(uint16_t old_flags);
78#pragma aux int_restore = \
79 "push ax" \
80 "popf" \
81 parm [ax] modify exact [] nomemory;
82
83void halt(void);
84#pragma aux halt = "hlt" modify exact [] nomemory;
85
86void halt_forever(void);
87#pragma aux halt_forever = \
88 "forever:" \
89 "hlt" \
90 "jmp forever" \
91 modify exact [] nomemory aborts;
92
93void rep_movsw(void __far *d, void __far *s, int nwords);
94#pragma aux rep_movsw = \
95 "push ds" \
96 "mov ds, dx" \
97 "rep movsw" \
98 "pop ds" \
99 parm [es di] [dx si] [cx];
100
101int repe_cmpsb(void __far *d, void __far *s, int nbytes);
102#pragma aux repe_cmpsb = \
103 "push ds" \
104 "mov ds, dx" \
105 "repe cmpsb" \
106 "pop ds" \
107 "mov ax, 0" \
108 "jz match" \
109 "inc al" \
110 "match:" \
111 parm [es di] [dx si] [cx] value [ax] modify nomemory;
112
113char __far *rep_insb(char __far *buffer, unsigned nbytes, unsigned port);
114#pragma aux rep_insb = ".286" "rep insb" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
115
116char __far *rep_insw(char __far *buffer, unsigned nwords, unsigned port);
117#pragma aux rep_insw = ".286" "rep insw" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
118
119char __far *rep_outsb(char __far *buffer, unsigned nbytes, unsigned port);
120#pragma aux rep_outsb = ".286" "rep outs dx,byte ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
121
122char __far *rep_outsw(char __far *buffer, unsigned nwords, unsigned port);
123#pragma aux rep_outsw = ".286" "rep outs dx,word ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
124
125uint16_t __far swap_16(uint16_t val);
126#pragma aux swap_16 = "xchg ah,al" parm [ax] value [ax] modify exact [ax] nomemory;
127
128uint32_t __far swap_32(uint32_t val);
129#pragma aux swap_32 = \
130 "xchg ah, al" \
131 "xchg dh, dl" \
132 "xchg ax, dx" \
133 parm [dx ax] value [dx ax] modify exact [dx ax] nomemory;
134
135extern void memsetb(uint16_t seg, uint16_t offset, uint16_t value, uint16_t count);
136#pragma aux memsetb = \
137 "jcxz no_copy" \
138 "rep stosb" \
139 "no_copy:" \
140 parm [es] [di] [ax] [cx];
141
142extern void memsetw(uint16_t seg, uint16_t offset, uint16_t value, uint16_t count);
143#pragma aux memsetw = \
144 "jcxz no_copy" \
145 "rep stosw" \
146 "no_copy:" \
147 parm [es] [di] [ax] [cx];
148
149extern void memcpyb(uint16_t dseg, uint16_t doffset, uint16_t sseg, uint16_t soffset, uint16_t count);
150#pragma aux memcpyb = \
151 "jcxz no_copy" \
152 "push ds" \
153 "mov ds, dx" \
154 "rep movsb" \
155 "pop ds" \
156 "no_copy:" \
157 parm [es] [di] [dx] [si] [cx];
158
159extern void memcpyw(uint16_t dseg, uint16_t doffset, uint16_t sseg, uint16_t soffset, uint16_t count);
160#pragma aux memcpyw = \
161 "jcxz no_copy" \
162 "push ds" \
163 "mov ds, dx" \
164 "rep movsw" \
165 "pop ds" \
166 "no_copy:" \
167 parm [es] [di] [dx] [si] [cx];
168
169#endif /* !VBOX_INCLUDED_SRC_Graphics_BIOS_inlines_h */
170
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