Changes in / [c916dfc:5fb32c5] in mainline
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/asm.h
rc916dfc r5fb32c5 77 77 } 78 78 79 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024))80 81 79 /** Byte from port 82 80 * … … 89 87 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 90 88 { 91 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 92 uint8_t val; 93 asm volatile ( 94 "inb %w[port], %b[val]\n" 95 : [val] "=a" (val) 96 : [port] "d" (port) 97 ); 98 return val; 99 } else { 100 return (uint8_t) *port; 101 } 89 uint8_t val; 90 91 asm volatile ( 92 "inb %w[port], %b[val]\n" 93 : [val] "=a" (val) 94 : [port] "d" (port) 95 ); 96 97 return val; 102 98 } 103 99 … … 112 108 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 113 109 { 114 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 115 uint16_t val; 116 asm volatile ( 117 "inw %w[port], %w[val]\n" 118 : [val] "=a" (val) 119 : [port] "d" (port) 120 ); 121 return val; 122 } else { 123 return (uint16_t) *port; 124 } 110 uint16_t val; 111 112 asm volatile ( 113 "inw %w[port], %w[val]\n" 114 : [val] "=a" (val) 115 : [port] "d" (port) 116 ); 117 118 return val; 125 119 } 126 120 … … 135 129 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 136 130 { 137 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 138 uint32_t val; 139 asm volatile ( 140 "inl %w[port], %[val]\n" 141 : [val] "=a" (val) 142 : [port] "d" (port) 143 ); 144 return val; 145 } else { 146 return (uint32_t) *port; 147 } 131 uint32_t val; 132 133 asm volatile ( 134 "inl %w[port], %[val]\n" 135 : [val] "=a" (val) 136 : [port] "d" (port) 137 ); 138 139 return val; 148 140 } 149 141 … … 158 150 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val) 159 151 { 160 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 161 asm volatile ( 162 "outb %b[val], %w[port]\n" 163 :: [val] "a" (val), [port] "d" (port) 164 ); 165 } else { 166 *port = val; 167 } 152 asm volatile ( 153 "outb %b[val], %w[port]\n" 154 :: [val] "a" (val), 155 [port] "d" (port) 156 ); 168 157 } 169 158 … … 178 167 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val) 179 168 { 180 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 181 asm volatile ( 182 "outw %w[val], %w[port]\n" 183 :: [val] "a" (val), [port] "d" (port) 184 ); 185 } else { 186 *port = val; 187 } 169 asm volatile ( 170 "outw %w[val], %w[port]\n" 171 :: [val] "a" (val), 172 [port] "d" (port) 173 ); 188 174 } 189 175 … … 198 184 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val) 199 185 { 200 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 201 asm volatile ( 202 "outl %[val], %w[port]\n" 203 :: [val] "a" (val), [port] "d" (port) 204 ); 205 } else { 206 *port = val; 207 } 186 asm volatile ( 187 "outl %[val], %w[port]\n" 188 :: [val] "a" (val), 189 [port] "d" (port) 190 ); 208 191 } 209 192 -
kernel/arch/ia32/include/asm.h
rc916dfc r5fb32c5 101 101 GEN_WRITE_REG(dr7) 102 102 103 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024))104 105 103 /** Byte to port 106 104 * … … 113 111 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val) 114 112 { 115 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 116 asm volatile ( 117 "outb %b[val], %w[port]\n" 118 :: [val] "a" (val), [port] "d" (port) 119 ); 120 } else { 121 *port = val; 122 } 113 asm volatile ( 114 "outb %b[val], %w[port]\n" 115 :: [val] "a" (val), 116 [port] "d" (port) 117 ); 123 118 } 124 119 … … 133 128 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val) 134 129 { 135 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 136 asm volatile ( 137 "outw %w[val], %w[port]\n" 138 :: [val] "a" (val), [port] "d" (port) 139 ); 140 } else { 141 *port = val; 142 } 130 asm volatile ( 131 "outw %w[val], %w[port]\n" 132 :: [val] "a" (val), 133 [port] "d" (port) 134 ); 143 135 } 144 136 … … 153 145 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val) 154 146 { 155 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 156 asm volatile ( 157 "outl %[val], %w[port]\n" 158 :: [val] "a" (val), [port] "d" (port) 159 ); 160 } else { 161 *port = val; 162 } 147 asm volatile ( 148 "outl %[val], %w[port]\n" 149 :: [val] "a" (val), 150 [port] "d" (port) 151 ); 163 152 } 164 153 … … 173 162 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 174 163 { 175 if (((void *)port) < IO_SPACE_BOUNDARY) { 176 uint8_t val; 177 asm volatile ( 178 "inb %w[port], %b[val]\n" 179 : [val] "=a" (val) 180 : [port] "d" (port) 181 ); 182 return val; 183 } else { 184 return (uint8_t) *port; 185 } 164 uint8_t val; 165 166 asm volatile ( 167 "inb %w[port], %b[val]\n" 168 : [val] "=a" (val) 169 : [port] "d" (port) 170 ); 171 172 return val; 186 173 } 187 174 … … 196 183 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 197 184 { 198 if (((void *)port) < IO_SPACE_BOUNDARY) { 199 uint16_t val; 200 asm volatile ( 201 "inw %w[port], %w[val]\n" 202 : [val] "=a" (val) 203 : [port] "d" (port) 204 ); 205 return val; 206 } else { 207 return (uint16_t) *port; 208 } 185 uint16_t val; 186 187 asm volatile ( 188 "inw %w[port], %w[val]\n" 189 : [val] "=a" (val) 190 : [port] "d" (port) 191 ); 192 193 return val; 209 194 } 210 195 … … 219 204 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 220 205 { 221 if (((void *)port) < IO_SPACE_BOUNDARY) { 222 uint32_t val; 223 asm volatile ( 224 "inl %w[port], %[val]\n" 225 : [val] "=a" (val) 226 : [port] "d" (port) 227 ); 228 return val; 229 } else { 230 return (uint32_t) *port; 231 } 206 uint32_t val; 207 208 asm volatile ( 209 "inl %w[port], %[val]\n" 210 : [val] "=a" (val) 211 : [port] "d" (port) 212 ); 213 214 return val; 232 215 } 233 216 -
uspace/app/bdsh/tok.c
rc916dfc r5fb32c5 224 224 wchar_t tok_look_char(tokenizer_t *tok) 225 225 { 226 size_t old_offset = tok->in_offset;227 size_t old_char_offset = tok->in_char_offset;226 unsigned int old_offset = tok->in_offset; 227 unsigned int old_char_offset = tok->in_char_offset; 228 228 wchar_t ret = tok_get_char(tok); 229 229 tok->in_offset = old_offset; -
uspace/app/bdsh/tok.h
rc916dfc r5fb32c5 38 38 typedef struct { 39 39 char *text; 40 size_t byte_start;41 size_t char_start;40 unsigned int byte_start; 41 unsigned int char_start; 42 42 size_t byte_length; 43 43 size_t char_length; … … 47 47 typedef struct { 48 48 char *in; 49 size_t in_offset;50 size_t last_in_offset;51 size_t in_char_offset;52 size_t last_in_char_offset;49 unsigned int in_offset; 50 unsigned int last_in_offset; 51 unsigned int in_char_offset; 52 unsigned int last_in_char_offset; 53 53 54 54 char *outbuf; -
uspace/lib/c/arch/ia32/include/ddi.h
rc916dfc r5fb32c5 41 41 static inline uint8_t pio_read_8(ioport8_t *port) 42 42 { 43 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 44 uint8_t val; 45 asm volatile ( 46 "inb %w1, %b0\n" 47 : "=a" (val) 48 : "d" (port) 49 ); 50 return val; 51 } else { 52 return (uint8_t) *port; 53 } 43 uint8_t val; 44 45 asm volatile ( 46 "inb %w1, %b0\n" 47 : "=a" (val) 48 : "d" (port) 49 ); 50 51 return val; 54 52 } 55 53 56 54 static inline uint16_t pio_read_16(ioport16_t *port) 57 55 { 58 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 59 uint16_t val; 60 asm volatile ( 61 "inw %w1, %w0\n" 62 : "=a" (val) 63 : "d" (port) 64 ); 65 return val; 66 } else { 67 return (uint16_t) *port; 68 } 56 uint16_t val; 57 58 asm volatile ( 59 "inw %w1, %w0\n" 60 : "=a" (val) 61 : "d" (port) 62 ); 63 64 return val; 69 65 } 70 66 71 67 static inline uint32_t pio_read_32(ioport32_t *port) 72 68 { 73 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 74 uint32_t val; 75 asm volatile ( 76 "inl %w1, %0\n" 77 : "=a" (val) 78 : "d" (port) 79 ); 80 return val; 81 } else { 82 return (uint32_t) *port; 83 } 69 uint32_t val; 70 71 asm volatile ( 72 "inl %w1, %0\n" 73 : "=a" (val) 74 : "d" (port) 75 ); 76 77 return val; 84 78 } 85 79 86 80 static inline void pio_write_8(ioport8_t *port, uint8_t val) 87 81 { 88 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 89 asm volatile ( 90 "outb %b0, %w1\n" 91 :: "a" (val), "d" (port) 92 ); 93 } else { 94 *port = val; 95 } 82 asm volatile ( 83 "outb %b0, %w1\n" 84 :: "a" (val), "d" (port) 85 ); 96 86 } 97 87 98 88 static inline void pio_write_16(ioport16_t *port, uint16_t val) 99 89 { 100 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 101 asm volatile ( 102 "outw %w0, %w1\n" 103 :: "a" (val), "d" (port) 104 ); 105 } else { 106 *port = val; 107 } 90 asm volatile ( 91 "outw %w0, %w1\n" 92 :: "a" (val), "d" (port) 93 ); 108 94 } 109 95 110 96 static inline void pio_write_32(ioport32_t *port, uint32_t val) 111 97 { 112 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 113 asm volatile ( 114 "outl %0, %w1\n" 115 :: "a" (val), "d" (port) 116 ); 117 } else { 118 *port = val; 119 } 98 asm volatile ( 99 "outl %0, %w1\n" 100 :: "a" (val), "d" (port) 101 ); 120 102 } 121 103
Note:
See TracChangeset
for help on using the changeset viewer.