Changeset 3781092 in mainline for uspace/lib/c
- Timestamp:
- 2011-09-09T18:22:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 40a2af3
- Parents:
- 980671e7 (diff), 5da7199 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib/c
- Files:
-
- 4 deleted
- 22 edited
-
Makefile (modified) (1 diff)
-
arch/abs32le/include/types.h (modified) (1 diff)
-
arch/amd64/include/atomic.h (modified) (5 diffs)
-
arch/amd64/include/types.h (modified) (1 diff)
-
arch/arm32/include/types.h (modified) (1 diff)
-
arch/ia32/include/atomic.h (modified) (5 diffs)
-
arch/ia32/include/types.h (modified) (1 diff)
-
arch/ia64/include/types.h (modified) (1 diff)
-
arch/mips32/include/types.h (modified) (1 diff)
-
arch/mips64/include/types.h (modified) (1 diff)
-
arch/ppc32/include/types.h (modified) (1 diff)
-
arch/sparc64/include/types.h (modified) (1 diff)
-
generic/adt/list.c (modified) (1 diff)
-
generic/async.c (modified) (2 diffs)
-
generic/async_obsolete.c (deleted)
-
generic/io/console.c (modified) (4 diffs)
-
generic/io/screenbuffer.c (deleted)
-
generic/private/async.h (modified) (2 diffs)
-
generic/vfs/vfs.c (modified) (1 diff)
-
include/adt/list.h (modified) (2 diffs)
-
include/async.h (modified) (1 diff)
-
include/async_obsolete.h (deleted)
-
include/io/color.h (modified) (1 diff)
-
include/io/console.h (modified) (3 diffs)
-
include/io/screenbuffer.h (deleted)
-
include/ipc/services.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r980671e7 r3781092 93 93 generic/io/printf_core.c \ 94 94 generic/io/console.c \ 95 generic/io/screenbuffer.c \96 95 generic/malloc.c \ 97 96 generic/sysinfo.c \ 98 97 generic/ipc.c \ 99 98 generic/ns.c \ 100 generic/ns_obsolete.c \101 99 generic/async.c \ 102 generic/async_obsolete.c \103 100 generic/loader.c \ 104 101 generic/getopt.c \ -
uspace/lib/c/arch/abs32le/include/types.h
r980671e7 r3781092 52 52 53 53 typedef uint32_t uintptr_t; 54 typedef int32_t intptr_t; 54 55 typedef uint32_t atomic_count_t; 55 56 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/amd64/include/atomic.h
r980671e7 r3781092 44 44 static inline void atomic_inc(atomic_t *val) 45 45 { 46 #ifdef __PCC__ 47 asm volatile ( 48 "lock incq %0\n" 49 : "+m" (val->count) 50 ); 51 #else 46 52 asm volatile ( 47 53 "lock incq %[count]\n" 48 54 : [count] "+m" (val->count) 49 55 ); 56 #endif 50 57 } 51 58 52 59 static inline void atomic_dec(atomic_t *val) 53 60 { 61 #ifdef __PCC__ 62 asm volatile ( 63 "lock decq %0\n" 64 : "+m" (val->count) 65 ); 66 #else 54 67 asm volatile ( 55 68 "lock decq %[count]\n" 56 69 : [count] "+m" (val->count) 57 70 ); 71 #endif 58 72 } 59 73 … … 62 76 atomic_count_t r = 1; 63 77 78 #ifdef __PCC__ 79 asm volatile ( 80 "lock xaddq %1, %0\n" 81 : "+m" (val->count), 82 "+r" (r) 83 ); 84 #else 64 85 asm volatile ( 65 86 "lock xaddq %[r], %[count]\n" … … 67 88 [r] "+r" (r) 68 89 ); 90 #endif 69 91 70 92 return r; … … 75 97 atomic_count_t r = -1; 76 98 99 #ifdef __PCC__ 100 asm volatile ( 101 "lock xaddq %1, %0\n" 102 : "+m" (val->count), 103 "+r" (r) 104 ); 105 #else 77 106 asm volatile ( 78 107 "lock xaddq %[r], %[count]\n" … … 80 109 [r] "+r" (r) 81 110 ); 111 #endif 82 112 83 113 return r; -
uspace/lib/c/arch/amd64/include/types.h
r980671e7 r3781092 52 52 53 53 typedef uint64_t uintptr_t; 54 typedef int64_t intptr_t; 54 55 typedef uint64_t atomic_count_t; 55 56 typedef int64_t atomic_signed_t; -
uspace/lib/c/arch/arm32/include/types.h
r980671e7 r3781092 53 53 54 54 typedef uint32_t uintptr_t; 55 typedef int32_t intptr_t; 55 56 typedef uint32_t atomic_count_t; 56 57 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/ia32/include/atomic.h
r980671e7 r3781092 42 42 static inline void atomic_inc(atomic_t *val) 43 43 { 44 #ifdef __PCC__ 45 asm volatile ( 46 "lock incl %0\n" 47 : "+m" (val->count) 48 ); 49 #else 44 50 asm volatile ( 45 51 "lock incl %[count]\n" 46 52 : [count] "+m" (val->count) 47 53 ); 54 #endif 48 55 } 49 56 50 57 static inline void atomic_dec(atomic_t *val) 51 58 { 59 #ifdef __PCC__ 60 asm volatile ( 61 "lock decl %0\n" 62 : "+m" (val->count) 63 ); 64 #else 52 65 asm volatile ( 53 66 "lock decl %[count]\n" 54 67 : [count] "+m" (val->count) 55 68 ); 69 #endif 56 70 } 57 71 … … 60 74 atomic_count_t r = 1; 61 75 76 #ifdef __PCC__ 77 asm volatile ( 78 "lock xaddl %1, %0\n" 79 : "+m" (val->count), 80 "+r" (r) 81 ); 82 #else 62 83 asm volatile ( 63 84 "lock xaddl %[r], %[count]\n" … … 65 86 [r] "+r" (r) 66 87 ); 88 #endif 67 89 68 90 return r; … … 73 95 atomic_count_t r = -1; 74 96 97 #ifdef __PCC__ 98 asm volatile ( 99 "lock xaddl %1, %0\n" 100 : "+m" (val->count), 101 "+r" (r) 102 ); 103 #else 75 104 asm volatile ( 76 105 "lock xaddl %[r], %[count]\n" … … 78 107 [r] "+r" (r) 79 108 ); 109 #endif 80 110 81 111 return r; -
uspace/lib/c/arch/ia32/include/types.h
r980671e7 r3781092 52 52 53 53 typedef uint32_t uintptr_t; 54 typedef int32_t intptr_t; 54 55 typedef uint32_t atomic_count_t; 55 56 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/ia64/include/types.h
r980671e7 r3781092 62 62 63 63 typedef uint64_t uintptr_t; 64 typedef int64_t intptr_t; 64 65 typedef uint64_t atomic_count_t; 65 66 typedef int64_t atomic_signed_t; -
uspace/lib/c/arch/mips32/include/types.h
r980671e7 r3781092 53 53 54 54 typedef uint32_t uintptr_t; 55 typedef int32_t intptr_t; 55 56 typedef uint32_t atomic_count_t; 56 57 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/mips64/include/types.h
r980671e7 r3781092 53 53 54 54 typedef uint64_t uintptr_t; 55 typedef int64_t intptr_t; 55 56 typedef uint64_t atomic_count_t; 56 57 typedef int64_t atomic_signed_t; -
uspace/lib/c/arch/ppc32/include/types.h
r980671e7 r3781092 52 52 53 53 typedef uint32_t uintptr_t; 54 typedef int32_t intptr_t; 54 55 typedef uint32_t atomic_count_t; 55 56 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/sparc64/include/types.h
r980671e7 r3781092 52 52 53 53 typedef uint64_t uintptr_t; 54 typedef int64_t intptr_t; 54 55 typedef uint64_t atomic_count_t; 55 56 typedef int64_t atomic_signed_t; -
uspace/lib/c/generic/adt/list.c
r980671e7 r3781092 50 50 * @param list List to look in. 51 51 * 52 * @return true if link is contained in head, false otherwise.52 * @return true if link is contained in list, false otherwise. 53 53 * 54 54 */ -
uspace/lib/c/generic/async.c
r980671e7 r3781092 118 118 #define CONN_HASH_TABLE_BUCKETS 32 119 119 120 /** Session data */ 121 struct async_sess { 122 /** List of inactive exchanges */ 123 list_t exch_list; 124 125 /** Exchange management style */ 126 exch_mgmt_t mgmt; 127 128 /** Session identification */ 129 int phone; 130 131 /** First clone connection argument */ 132 sysarg_t arg1; 133 134 /** Second clone connection argument */ 135 sysarg_t arg2; 136 137 /** Third clone connection argument */ 138 sysarg_t arg3; 139 140 /** Exchange mutex */ 141 fibril_mutex_t mutex; 142 143 /** Number of opened exchanges */ 144 atomic_t refcnt; 145 146 /** Mutex for stateful connections */ 147 fibril_mutex_t remote_state_mtx; 148 149 /** Data for stateful connections */ 150 void *remote_state_data; 151 }; 152 153 /** Exchange data */ 154 struct async_exch { 155 /** Link into list of inactive exchanges */ 156 link_t sess_link; 157 158 /** Link into global list of inactive exchanges */ 159 link_t global_link; 160 161 /** Session pointer */ 162 async_sess_t *sess; 163 164 /** Exchange identification */ 165 int phone; 166 }; 167 120 168 /** Async framework global futex */ 121 169 atomic_t async_futex = FUTEX_INITIALIZER; … … 134 182 ipc_call_t call; 135 183 } msg_t; 184 185 /** Message data */ 186 typedef struct { 187 awaiter_t wdata; 188 189 /** If reply was received. */ 190 bool done; 191 192 /** Pointer to where the answer data is stored. */ 193 ipc_call_t *dataptr; 194 195 sysarg_t retval; 196 } amsg_t; 136 197 137 198 /* Client connection data */ -
uspace/lib/c/generic/io/console.c
r980671e7 r3781092 87 87 { 88 88 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 89 async_ msg_0(exch, CONSOLE_CLEAR);89 async_req_0_0(exch, CONSOLE_CLEAR); 90 90 async_exchange_end(exch); 91 91 } … … 103 103 { 104 104 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 105 async_ msg_1(exch, CONSOLE_SET_STYLE, style);106 async_exchange_end(exch); 107 } 108 109 void console_set_color(console_ctrl_t *ctrl, uint8_t fg_color, uint8_t bg_color,105 async_req_1_0(exch, CONSOLE_SET_STYLE, style); 106 async_exchange_end(exch); 107 } 108 109 void console_set_color(console_ctrl_t *ctrl, uint8_t bgcolor, uint8_t fgcolor, 110 110 uint8_t flags) 111 111 { 112 112 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 113 async_ msg_3(exch, CONSOLE_SET_COLOR, fg_color, bg_color, flags);114 async_exchange_end(exch); 115 } 116 117 void console_set_rgb_color(console_ctrl_t *ctrl, uint32_t fg_color,118 uint32_t bg_color)119 { 120 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 121 async_ msg_2(exch, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);113 async_req_3_0(exch, CONSOLE_SET_COLOR, bgcolor, fgcolor, flags); 114 async_exchange_end(exch); 115 } 116 117 void console_set_rgb_color(console_ctrl_t *ctrl, uint32_t bgcolor, 118 uint32_t fgcolor) 119 { 120 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 121 async_req_2_0(exch, CONSOLE_SET_RGB_COLOR, bgcolor, fgcolor); 122 122 async_exchange_end(exch); 123 123 } … … 126 126 { 127 127 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 128 async_ msg_1(exch, CONSOLE_CURSOR_VISIBILITY, (show != false));128 async_req_1_0(exch, CONSOLE_CURSOR_VISIBILITY, (show != false)); 129 129 async_exchange_end(exch); 130 130 } … … 151 151 { 152 152 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 153 async_ msg_2(exch, CONSOLE_GOTO, col, row);153 async_req_2_0(exch, CONSOLE_GOTO, col, row); 154 154 async_exchange_end(exch); 155 155 } -
uspace/lib/c/generic/private/async.h
r980671e7 r3781092 43 43 #include <bool.h> 44 44 45 /** Session data */46 struct _async_sess {47 /** List of inactive exchanges */48 list_t exch_list;49 50 /** Exchange management style */51 exch_mgmt_t mgmt;52 53 /** Session identification */54 int phone;55 56 /** First clone connection argument */57 sysarg_t arg1;58 59 /** Second clone connection argument */60 sysarg_t arg2;61 62 /** Third clone connection argument */63 sysarg_t arg3;64 65 /** Exchange mutex */66 fibril_mutex_t mutex;67 68 /** Number of opened exchanges */69 atomic_t refcnt;70 71 /** Mutex for stateful connections */72 fibril_mutex_t remote_state_mtx;73 74 /** Data for stateful connections */75 void *remote_state_data;76 };77 78 /** Exchange data */79 struct _async_exch {80 /** Link into list of inactive exchanges */81 link_t sess_link;82 83 /** Link into global list of inactive exchanges */84 link_t global_link;85 86 /** Session pointer */87 async_sess_t *sess;88 89 /** Exchange identification */90 int phone;91 };92 93 45 /** Structures of this type are used to track the timeout events. */ 94 46 typedef struct { … … 129 81 } awaiter_t; 130 82 131 /** Message data */132 typedef struct {133 awaiter_t wdata;134 135 /** If reply was received. */136 bool done;137 138 /** Pointer to where the answer data is stored. */139 ipc_call_t *dataptr;140 141 sysarg_t retval;142 } amsg_t;143 144 83 extern void __async_init(void); 145 84 extern void async_insert_timeout(awaiter_t *); -
uspace/lib/c/generic/vfs/vfs.c
r980671e7 r3781092 654 654 async_exch_t *exch = vfs_exchange_begin(); 655 655 656 req = async_send_ 0(exch, VFS_IN_UNLINK, NULL);656 req = async_send_1(exch, VFS_IN_UNLINK, lflag, NULL); 657 657 rc = async_data_write_start(exch, pa, pa_size); 658 658 if (rc != EOK) { -
uspace/lib/c/include/adt/list.h
r980671e7 r3781092 72 72 73 73 #define assert_link_not_used(link) \ 74 assert(( link)->prev == NULL && (link)->next == NULL)74 assert(((link)->prev == NULL) && ((link)->next == NULL)) 75 75 76 76 /** Initialize doubly-linked circular list link … … 158 158 static inline void list_remove(link_t *link) 159 159 { 160 link->next->prev = link->prev; 161 link->prev->next = link->next; 160 if ((link->prev != NULL) && (link->next != NULL)) { 161 link->next->prev = link->prev; 162 link->prev->next = link->next; 163 } 164 162 165 link_initialize(link); 163 166 } -
uspace/lib/c/include/async.h
r980671e7 r3781092 96 96 97 97 /** Forward declarations */ 98 struct _async_exch;99 struct _async_sess;100 101 typedef struct _async_sess async_sess_t;102 typedef struct _async_exch async_exch_t;98 struct async_exch; 99 struct async_sess; 100 101 typedef struct async_sess async_sess_t; 102 typedef struct async_exch async_exch_t; 103 103 104 104 extern atomic_t threads_in_ipc_wait; -
uspace/lib/c/include/io/color.h
r980671e7 r3781092 44 44 COLOR_MAGENTA = 5, 45 45 COLOR_YELLOW = 6, 46 COLOR_WHITE = 7, 47 48 CATTR_BRIGHT = 8, 49 CATTR_BLINK = 8 46 COLOR_WHITE = 7 50 47 } console_color_t; 48 49 typedef enum { 50 CATTR_NORMAL = 0, 51 CATTR_BRIGHT = 8, 52 CATTR_BLINK = 16 53 } console_color_attr_t; 51 54 52 55 #endif -
uspace/lib/c/include/io/console.h
r980671e7 r3781092 37 37 38 38 #include <sys/time.h> 39 #include <io/keycode.h> 39 40 #include <async.h> 40 41 #include <bool.h> … … 42 43 43 44 typedef enum { 44 CONSOLE_C CAP_NONE = 0,45 CONSOLE_C CAP_STYLE,46 CONSOLE_C CAP_INDEXED,47 CONSOLE_C CAP_RGB45 CONSOLE_CAP_NONE = 0, 46 CONSOLE_CAP_STYLE = 1, 47 CONSOLE_CAP_INDEXED = 2, 48 CONSOLE_CAP_RGB = 4 48 49 } console_caps_t; 49 50 … … 76 77 /** Console event structure. */ 77 78 typedef struct { 79 /** List handle */ 80 link_t link; 81 78 82 /** Press or release event. */ 79 83 kbd_event_type_t type; 80 84 81 85 /** Keycode of the key that was pressed or released. */ 82 unsigned int key;86 keycode_t key; 83 87 84 88 /** Bitmask of modifiers held. */ 85 unsigned int mods;89 keymod_t mods; 86 90 87 91 /** The character that was generated or '\0' for none. */ -
uspace/lib/c/include/ipc/services.h
r980671e7 r3781092 43 43 SERVICE_NONE = 0, 44 44 SERVICE_LOAD = FOURCC('l', 'o', 'a', 'd'), 45 SERVICE_VIDEO = FOURCC('v', 'i', 'd', ' '),46 45 SERVICE_VFS = FOURCC('v', 'f', 's', ' '), 47 46 SERVICE_LOC = FOURCC('l', 'o', 'c', ' '),
Note:
See TracChangeset
for help on using the changeset viewer.
