VirtualBox

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

Last change on this file since 77577 was 76565, checked in by vboxsync, 6 years ago

Devices: Use VBOX_INCLUDED_SRC_ as header guard prefix with scm.

  • 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-2019 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
33extern uint8_t read_byte(uint16_t seg, uint16_t offset);
34extern uint16_t read_word(uint16_t seg, uint16_t offset);
35extern uint32_t read_dword(uint16_t seg, uint16_t offset);
36extern void write_byte(uint16_t seg, uint16_t offset, uint8_t data);
37extern void write_word(uint16_t seg, uint16_t offset, uint16_t data);
38extern void write_dword(uint16_t seg, uint16_t offset, uint32_t data);
39
40void int_enable(void);
41#pragma aux int_enable = "sti" modify exact [] nomemory;
42
43void int_disable(void);
44#pragma aux int_disable = "cli" modify exact [] nomemory;
45
46uint16_t int_query(void);
47#pragma aux int_query = \
48 "pushf" \
49 "pop ax" \
50 value [ax] modify exact [ax] nomemory;
51
52void int_restore(uint16_t old_flags);
53#pragma aux int_restore = \
54 "push ax" \
55 "popf" \
56 parm [ax] modify exact [] nomemory;
57
58void halt(void);
59#pragma aux halt = "hlt" modify exact [] nomemory;
60
61void halt_forever(void);
62#pragma aux halt_forever = \
63 "forever:" \
64 "hlt" \
65 "jmp forever" \
66 modify exact [] nomemory aborts;
67
68void rep_movsw(void __far *d, void __far *s, int nwords);
69#pragma aux rep_movsw = \
70 "push ds" \
71 "mov ds, dx" \
72 "rep movsw" \
73 "pop ds" \
74 parm [es di] [dx si] [cx];
75
76char __far *rep_insb(char __far *buffer, unsigned nbytes, unsigned port);
77#pragma aux rep_insb = ".286" "rep insb" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
78
79char __far *rep_insw(char __far *buffer, unsigned nwords, unsigned port);
80#pragma aux rep_insw = ".286" "rep insw" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
81
82#if VBOX_BIOS_CPU >= 80386
83char __far *rep_insd(char __far *buffer, unsigned ndwords, unsigned port);
84# pragma aux rep_insd = ".386" "rep insd" parm [es di] [cx] [dx] value [es di] modify exact [cx di];
85#endif
86
87char __far *rep_outsb(char __far *buffer, unsigned nbytes, unsigned port);
88#pragma aux rep_outsb = ".286" "rep outs dx,byte ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
89
90char __far *rep_outsw(char __far *buffer, unsigned nwords, unsigned port);
91#pragma aux rep_outsw = ".286" "rep outs dx,word ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
92
93#if VBOX_BIOS_CPU >= 80386
94char __far *rep_outsd(char __far *buffer, unsigned ndwords, unsigned port);
95# pragma aux rep_outsd = ".386" "rep outs dx,dword ptr es:[si]" parm [es si] [cx] [dx] value [es si] modify exact [cx si];
96#endif
97
98uint16_t __far swap_16(uint16_t val);
99#pragma aux swap_16 = "xchg ah,al" parm [ax] value [ax] modify exact [ax] nomemory;
100
101uint32_t __far swap_32(uint32_t val);
102#pragma aux swap_32 = \
103 "xchg ah, al" \
104 "xchg dh, dl" \
105 "xchg ax, dx" \
106 parm [dx ax] value [dx ax] modify exact [dx ax] nomemory;
107
108//@todo: Do CLD elsewhere!
109extern void memsetb(uint16_t seg, uint16_t offset, uint16_t value, uint16_t count);
110#pragma aux memsetb = \
111 "cld" \
112 "jcxz no_copy" \
113 "rep stosb" \
114 "no_copy:" \
115 parm [es] [di] [ax] [cx];
116
117//@todo: Do CLD elsewhere!
118extern void memsetw(uint16_t seg, uint16_t offset, uint16_t value, uint16_t count);
119#pragma aux memsetw = \
120 "cld" \
121 "jcxz no_copy" \
122 "rep stosw" \
123 "no_copy:" \
124 parm [es] [di] [ax] [cx];
125
126//@todo: Do CLD elsewhere!
127extern void memcpyb(uint16_t dseg, uint16_t doffset, uint16_t sseg, uint16_t soffset, uint16_t count);
128#pragma aux memcpyb = \
129 "cld" \
130 "jcxz no_copy" \
131 "push ds" \
132 "mov ds, dx" \
133 "rep movsb" \
134 "pop ds" \
135 "no_copy:" \
136 parm [es] [di] [dx] [si] [cx];
137
138//@todo: Do CLD elsewhere!
139extern void memcpyw(uint16_t dseg, uint16_t doffset, uint16_t sseg, uint16_t soffset, uint16_t count);
140#pragma aux memcpyw = \
141 "cld" \
142 "jcxz no_copy" \
143 "push ds" \
144 "mov ds, dx" \
145 "rep movsw" \
146 "pop ds" \
147 "no_copy:" \
148 parm [es] [di] [dx] [si] [cx];
149
150#endif /* !VBOX_INCLUDED_SRC_Graphics_BIOS_inlines_h */
151
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