projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Suggestion from Godmar Back.
[pintos-anon]
/
src
/
threads
/
io.h
diff --git
a/src/threads/io.h
b/src/threads/io.h
index b6d1e4ba2afc46869ad3687bcbc4831199c68d83..b4932995294b684c3a7c822b24224ae91b5a3953 100644
(file)
--- a/
src/threads/io.h
+++ b/
src/threads/io.h
@@
-38,8
+38,8
@@
* the copyright notices, if any, listed below.
*/
* the copyright notices, if any, listed below.
*/
-#ifndef
HEADER
_IO_H
-#define
HEADER_IO_H 1
+#ifndef
THREADS
_IO_H
+#define
THREADS_IO_H
#include <stddef.h>
#include <stdint.h>
#include <stddef.h>
#include <stdint.h>
@@
-48,6
+48,7
@@
static inline uint8_t
inb (uint16_t port)
{
static inline uint8_t
inb (uint16_t port)
{
+ /* See [IA32-v2a] "IN". */
uint8_t data;
asm volatile ("inb %w1,%0" : "=a" (data) : "d" (port));
return data;
uint8_t data;
asm volatile ("inb %w1,%0" : "=a" (data) : "d" (port));
return data;
@@
-58,6
+59,7
@@
inb (uint16_t port)
static inline void
insb (uint16_t port, void *addr, size_t cnt)
{
static inline void
insb (uint16_t port, void *addr, size_t cnt)
{
+ /* See [IA32-v2a] "INS". */
asm volatile ("cld; repne; insb"
: "=D" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
asm volatile ("cld; repne; insb"
: "=D" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
@@
-69,6
+71,7
@@
static inline uint16_t
inw (uint16_t port)
{
uint16_t data;
inw (uint16_t port)
{
uint16_t data;
+ /* See [IA32-v2a] "IN". */
asm volatile ("inw %w1,%0" : "=a" (data) : "d" (port));
return data;
}
asm volatile ("inw %w1,%0" : "=a" (data) : "d" (port));
return data;
}
@@
-78,6
+81,7
@@
inw (uint16_t port)
static inline void
insw (uint16_t port, void *addr, size_t cnt)
{
static inline void
insw (uint16_t port, void *addr, size_t cnt)
{
+ /* See [IA32-v2a] "INS". */
asm volatile ("cld; repne; insw"
: "=D" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
asm volatile ("cld; repne; insw"
: "=D" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
@@
-88,6
+92,7
@@
insw (uint16_t port, void *addr, size_t cnt)
static inline uint32_t
inl (uint16_t port)
{
static inline uint32_t
inl (uint16_t port)
{
+ /* See [IA32-v2a] "IN". */
uint32_t data;
asm volatile ("inl %w1,%0" : "=a" (data) : "d" (port));
return data;
uint32_t data;
asm volatile ("inl %w1,%0" : "=a" (data) : "d" (port));
return data;
@@
-98,6
+103,7
@@
inl (uint16_t port)
static inline void
insl (uint16_t port, void *addr, size_t cnt)
{
static inline void
insl (uint16_t port, void *addr, size_t cnt)
{
+ /* See [IA32-v2a] "INS". */
asm volatile ("cld; repne; insl"
: "=D" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
asm volatile ("cld; repne; insl"
: "=D" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
@@
-108,6
+114,7
@@
insl (uint16_t port, void *addr, size_t cnt)
static inline void
outb (uint16_t port, uint8_t data)
{
static inline void
outb (uint16_t port, uint8_t data)
{
+ /* See [IA32-v2b] "OUT". */
asm volatile ("outb %0,%w1" : : "a" (data), "d" (port));
}
asm volatile ("outb %0,%w1" : : "a" (data), "d" (port));
}
@@
-116,6
+123,7
@@
outb (uint16_t port, uint8_t data)
static inline void
outsb (uint16_t port, const void *addr, size_t cnt)
{
static inline void
outsb (uint16_t port, const void *addr, size_t cnt)
{
+ /* See [IA32-v2b] "OUTS". */
asm volatile ("cld; repne; outsb"
: "=S" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
asm volatile ("cld; repne; outsb"
: "=S" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
@@
-126,6
+134,7
@@
outsb (uint16_t port, const void *addr, size_t cnt)
static inline void
outw (uint16_t port, uint16_t data)
{
static inline void
outw (uint16_t port, uint16_t data)
{
+ /* See [IA32-v2b] "OUT". */
asm volatile ("outw %0,%w1" : : "a" (data), "d" (port));
}
asm volatile ("outw %0,%w1" : : "a" (data), "d" (port));
}
@@
-134,6
+143,7
@@
outw (uint16_t port, uint16_t data)
static inline void
outsw (uint16_t port, const void *addr, size_t cnt)
{
static inline void
outsw (uint16_t port, const void *addr, size_t cnt)
{
+ /* See [IA32-v2b] "OUTS". */
asm volatile ("cld; repne; outsw"
: "=S" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
asm volatile ("cld; repne; outsw"
: "=S" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
@@
-144,6
+154,7
@@
outsw (uint16_t port, const void *addr, size_t cnt)
static inline void
outl (uint16_t port, uint32_t data)
{
static inline void
outl (uint16_t port, uint32_t data)
{
+ /* See [IA32-v2b] "OUT". */
asm volatile ("outl %0,%w1" : : "a" (data), "d" (port));
}
asm volatile ("outl %0,%w1" : : "a" (data), "d" (port));
}
@@
-152,10
+163,11
@@
outl (uint16_t port, uint32_t data)
static inline void
outsl (uint16_t port, const void *addr, size_t cnt)
{
static inline void
outsl (uint16_t port, const void *addr, size_t cnt)
{
+ /* See [IA32-v2b] "OUTS". */
asm volatile ("cld; repne; outsl"
: "=S" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
: "cc");
}
asm volatile ("cld; repne; outsl"
: "=S" (addr), "=c" (cnt)
: "d" (port), "0" (addr), "1" (cnt)
: "cc");
}
-#endif /* io.h */
+#endif /*
threads/
io.h */