66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
88// You may obtain a copy of the License at
9- //
9+ //
1010// http://www.apache.org/licenses/LICENSE-2.0
11- //
11+ //
1212// Unless required by applicable law or agreed to in writing, software
1313// distributed under the License is distributed on an "AS IS" BASIS,
1414// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,9 +28,12 @@ namespace hw {
2828 static inline uint8_t inb (int port)
2929 {
3030 int ret;
31+ #ifdef ARCH_X86
3132 __asm__ volatile (" xorl %eax,%eax" );
3233 __asm__ volatile (" inb %%dx,%%al" :" =a" (ret):" d" (port));
33-
34+ #else
35+ #warning "inb() not implemented for selected arch"
36+ #endif
3437 return ret;
3538 }
3639
@@ -39,7 +42,11 @@ namespace hw {
3942 @param data : One byte of data to send to @param port
4043 */
4144 static inline void outb (int port, uint8_t data) {
45+ #ifdef ARCH_X86
4246 __asm__ volatile (" outb %%al,%%dx" ::" a" (data), " d" (port));
47+ #else
48+ #warning "outb() not implemented for selected arch"
49+ #endif
4350 }
4451
4552 /* * Receive a word from port.
@@ -48,9 +55,12 @@ namespace hw {
4855 static inline uint16_t inw (int port)
4956 {
5057 int ret;
58+ #ifdef ARCH_X86
5159 __asm__ volatile (" xorl %eax,%eax" );
5260 __asm__ volatile (" inw %%dx,%%ax" :" =a" (ret):" d" (port));
53-
61+ #else
62+ #warning "inw() not implemented for selected arch"
63+ #endif
5464 return ret;
5565 }
5666
@@ -59,9 +69,14 @@ namespace hw {
5969 @param data : One word of data to send to @param port
6070 */
6171 static inline void outw (int port, uint16_t data) {
72+ #ifdef ARCH_X86
6273 __asm__ volatile (" outw %%ax,%%dx" ::" a" (data), " d" (port));
74+ #else
75+ #warning "outw() not implemented for selected arch"
76+ #endif
6377 }
6478
6579} // < namespace hw
6680
6781#endif // HW_IOPORT_HPP
82+
0 commit comments