Changeset b1f51f0 in mainline
- Timestamp:
- 2006-06-02T16:09:18Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b917098
- Parents:
- a116ef22
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
console/console.c
ra116ef22 rb1f51f0 42 42 #include <sys/mman.h> 43 43 44 #define CONSOLE_COUNT 1245 44 #define MAX_KEYREQUESTS_BUFFERED 32 46 45 … … 119 118 120 119 if (console == active_console) { 121 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, ' ', scr->position_y, scr->position_x, NULL, NULL);120 nsend_call_3(fb_info.phone, FB_PUTCHAR, ' ', scr->position_y, scr->position_x); 122 121 } 123 122 … … 127 126 default: 128 127 if (console == active_console) { 129 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, key, scr->position_y, scr->position_x, NULL, NULL);128 nsend_call_3(fb_info.phone, FB_PUTCHAR, key, scr->position_y, scr->position_x); 130 129 } 131 130 … … 139 138 scr->position_y = scr->size_y - 1; 140 139 screenbuffer_clear_line(scr, scr->top_line++); 141 ipc_call_async(fb_info.phone, FB_SCROLL, 1, NULL, NULL); 140 if (console == active_console) 141 nsend_call(fb_info.phone, FB_SCROLL, 1); 142 142 } 143 143 … … 145 145 146 146 if (console == active_console) 147 ipc_call_async_2(fb_info.phone, FB_CURSOR_GOTO, scr->position_y, scr->position_x, NULL, NULL);147 send_call_2(fb_info.phone, FB_CURSOR_GOTO, scr->position_y, scr->position_x); 148 148 149 149 } … … 193 193 conn = &connections[active_console]; 194 194 195 ipc_call_async(fb_info.phone, FB_CURSOR_VISIBILITY, 0, NULL, NULL);195 nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 0); 196 196 197 197 if (interbuffer) { … … 202 202 sync_send_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL, NULL); 203 203 } else { 204 205 ipc_call_async_2(fb_info.phone, FB_CLEAR, 0, 0, NULL, NULL); 204 nsend_call(fb_info.phone, FB_CLEAR, 0); 206 205 207 206 … … 210 209 d = get_field_at(&(conn->screenbuffer),i, j)->character; 211 210 if (d && d != ' ') 212 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, d, j, i, NULL, NULL);211 nsend_call_3(fb_info.phone, FB_PUTCHAR, d, j, i); 213 212 } 214 213 215 214 } 216 ipc_call_async_2(fb_info.phone, FB_CURSOR_GOTO, conn->screenbuffer.position_y, conn->screenbuffer.position_x, NULL, NULL);217 ipc_call_async_2(fb_info.phone, FB_SET_STYLE, conn->screenbuffer.style.fg_color, \218 conn->screenbuffer.style.bg_color , NULL, NULL);219 ipc_call_async(fb_info.phone, FB_CURSOR_VISIBILITY, 1, NULL, NULL);215 nsend_call_2(fb_info.phone, FB_CURSOR_GOTO, conn->screenbuffer.position_y, conn->screenbuffer.position_x); 216 nsend_call_2(fb_info.phone, FB_SET_STYLE, conn->screenbuffer.style.fg_color, \ 217 conn->screenbuffer.style.bg_color); 218 send_call(fb_info.phone, FB_CURSOR_VISIBILITY, 1); 220 219 221 220 break; … … 241 240 242 241 /** Default thread for new connections */ 243 void client_connection(ipc_callid_t iid, ipc_call_t *icall)242 static void client_connection(ipc_callid_t iid, ipc_call_t *icall) 244 243 { 245 244 ipc_callid_t callid; … … 273 272 /* Send message to fb */ 274 273 if (consnum == active_console) { 275 ipc_call_async_2(fb_info.phone, FB_CLEAR, 0, 0, NULL, NULL);274 send_call(fb_info.phone, FB_CLEAR, 0); 276 275 } 277 276 … … 331 330 332 331 ipc_call_sync_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols)); 333 ipc_call_async_2(fb_info.phone, FB_SET_STYLE, DEFAULT_FOREGROUND_COLOR, DEFAULT_BACKGROUND_COLOR, NULL, NULL);334 ipc_call_sync(fb_info.phone, FB_CURSOR_VISIBILITY, 1, NULL);332 nsend_call_2(fb_info.phone, FB_SET_STYLE, DEFAULT_FOREGROUND_COLOR, DEFAULT_BACKGROUND_COLOR); 333 nsend_call(fb_info.phone, FB_CURSOR_VISIBILITY, 1); 335 334 336 335 /* Init virtual consoles */ … … 362 361 async_new_connection(phonehash, 0, NULL, keyboard_events); 363 362 364 ipc_call_async_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0, NULL, NULL); 365 363 nsend_call_2(fb_info.phone, FB_CURSOR_GOTO, 0, 0); 364 365 /* Register at NS */ 366 366 if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) { 367 367 return -1; -
console/console.h
ra116ef22 rb1f51f0 30 30 #define __CONSOLE_H__ 31 31 32 #define CONSOLE_COUNT 12 33 32 34 #define CONSOLE_GETCHAR 1026 33 35 #define CONSOLE_PUTCHAR 1027 -
init/init.c
ra116ef22 rb1f51f0 160 160 IPC_GET_ARG1(*data), IPC_GET_ARG2(*data)); 161 161 } 162 static void test_async_ipc(void)163 {164 ipc_call_t data;165 int i;166 167 printf("Sending ping\n");168 ipc_call_async_2(PHONE_NS, NS_PING, 1, 0xbeefbee2,169 "Pong1", got_answer);170 ipc_call_async_2(PHONE_NS, NS_PING, 2, 0xbeefbee4,171 "Pong2", got_answer);172 ipc_call_async_2(PHONE_NS, NS_PING, 3, 0xbeefbee4,173 "Pong3", got_answer);174 ipc_call_async_2(PHONE_NS, NS_PING, 4, 0xbeefbee4,175 "Pong4", got_answer);176 ipc_call_async_2(PHONE_NS, NS_PING, 5, 0xbeefbee4,177 "Pong5", got_answer);178 ipc_call_async_2(PHONE_NS, NS_PING, 6, 0xbeefbee4,179 "Pong6", got_answer);180 printf("Waiting forever...\n");181 for (i=0; i<100;i++)182 printf(".");183 printf("\n");184 ipc_wait_for_call(&data);185 printf("Received call???\n");186 }187 162 188 163 … … 190 165 { 191 166 printf("Pong\n"); 192 }193 static void test_advanced_ipc(void)194 {195 int res;196 ipcarg_t phonead;197 ipc_callid_t callid;198 ipc_call_t data;199 int i;200 201 printf("Asking 0 to connect to me...\n");202 res = ipc_connect_to_me(0, 1, 2, &phonead);203 printf("Result: %d - phonead: %llu\n", res, phonead);204 for (i=0; i < 100; i++) {205 printf("----------------\n");206 ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov",207 got_answer_2);208 callid = ipc_wait_for_call(&data);209 printf("Received ping\n");210 ipc_answer_fast(callid, 0, 0, 0);211 }212 // callid = ipc_wait_for_call(&data, NULL);213 167 } 214 168 … … 226 180 printf("Retval: %d - received: %X\n", res, result); 227 181 228 }229 230 static void test_hangup(void)231 {232 int phoneid;233 ipc_call_t data;234 ipc_callid_t callid;235 int i;236 237 printf("Starting connect...\n");238 phoneid = ipc_connect_me_to(PHONE_NS, 10, 20);239 printf("Phoneid: %d, pinging\n", phoneid);240 ipc_call_async_2(PHONE_NS, NS_PING, 1, 0xbeefbee2,241 "Pong1", got_answer);242 printf("Hangin up\n");243 ipc_hangup(phoneid);244 printf("Connecting\n");245 phoneid = ipc_connect_me_to(PHONE_NS, 10, 20);246 printf("Newphid: %d\n", phoneid);247 for (i=0; i < 1000; i++) {248 if ((callid=ipc_trywait_for_call(&data)))249 printf("callid: %d\n");250 }251 printf("New new phoneid: %d\n", ipc_connect_me_to(PHONE_NS, 10, 20));252 }253 254 static void test_slam(void)255 {256 int i;257 ipc_call_t data;258 ipc_callid_t callid;259 260 printf("ping");261 ipc_call_async_2(PHONE_NS, NS_PING, 1, 0xbeefbee2,262 "Pong1", got_answer);263 printf("slam");264 ipc_call_async_2(PHONE_NS, NS_HANGUP, 1, 0xbeefbee2,265 "Hang", got_answer);266 printf("ping2\n");267 ipc_call_async_2(PHONE_NS, NS_PING, 1, 0xbeefbee2,268 "Ping2", got_answer);269 270 for (i=0; i < 1000; i++) {271 if ((callid=ipc_trywait_for_call(&data)))272 printf("callid: %d\n");273 }274 ipc_call_async_2(PHONE_NS, NS_PING, 1, 0xbeefbee2,275 "Pong1", got_answer);276 printf("Closing file\n");277 ipc_hangup(PHONE_NS);278 ipc_call_async_2(PHONE_NS, NS_PING, 1, 0xbeefbee2,279 "Pong1", got_answer);280 ipc_wait_for_call(&data);281 182 } 282 183 -
kbd/generic/kbd.c
ra116ef22 rb1f51f0 101 101 break; 102 102 } 103 ipc_call_async(phoneid, KBD_PUSHCHAR, arg1, NULL, NULL);103 send_call(phoneid, KBD_PUSHCHAR, arg1); 104 104 } 105 105 -
libc/generic/async.c
ra116ef22 rb1f51f0 607 607 msg->wdata.active = 1; /* We may sleep in next method, but it 608 608 * will use it's own mechanism */ 609 ipc_call_async_2(phoneid,method,arg1,arg2,msg,reply_received );609 ipc_call_async_2(phoneid,method,arg1,arg2,msg,reply_received,1); 610 610 611 611 return (aid_t) msg; -
libc/generic/io/stream.c
ra116ef22 rb1f51f0 78 78 79 79 for (i = 0; i < count; i++) 80 ipc_call_async_2(console_phone, CONSOLE_PUTCHAR, ((const char *)buf)[i], 0, NULL, NULL);80 send_call(console_phone, CONSOLE_PUTCHAR, ((const char *)buf)[i]); 81 81 82 82 return count; -
libc/generic/ipc.c
ra116ef22 rb1f51f0 134 134 135 135 /** Epilogue of ipc_async_send functions */ 136 static inline void ipc_finish_async(ipc_callid_t callid, int phoneid, async_call_t *call) 136 static inline void ipc_finish_async(ipc_callid_t callid, int phoneid, 137 async_call_t *call, int can_preempt) 137 138 { 138 139 if (callid == IPC_CALLRET_FATAL) { … … 149 150 150 151 call->u.msg.phoneid = phoneid; 151 152 call->ptid = psthread_get_id(); 152 153 153 futex_down(&async_futex); 154 154 list_append(&call->list, &queued_calls); 155 155 156 psthread_schedule_next_adv(PS_TO_MANAGER); 157 /* Async futex unlocked by previous call */ 156 if (can_preempt) { 157 call->ptid = psthread_get_id(); 158 psthread_schedule_next_adv(PS_TO_MANAGER); 159 /* Async futex unlocked by previous call */ 160 } else { 161 call->ptid = 0; 162 futex_up(&async_futex); 163 } 158 164 return; 159 165 } … … 172 178 void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1, 173 179 ipcarg_t arg2, void *private, 174 ipc_async_callback_t callback )180 ipc_async_callback_t callback, int can_preempt) 175 181 { 176 182 async_call_t *call; … … 191 197 IPC_SET_ARG2(call->u.msg.data, arg2); 192 198 } 193 ipc_finish_async(callid, phoneid, call );199 ipc_finish_async(callid, phoneid, call, can_preempt); 194 200 } 195 201 … … 201 207 void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1, 202 208 ipcarg_t arg2, ipcarg_t arg3, void *private, 203 ipc_async_callback_t callback )209 ipc_async_callback_t callback, int can_preempt) 204 210 { 205 211 async_call_t *call; … … 219 225 callid = _ipc_call_async(phoneid, &call->u.msg.data); 220 226 221 ipc_finish_async(callid, phoneid, call );227 ipc_finish_async(callid, phoneid, call, can_preempt); 222 228 } 223 229 … … 277 283 278 284 futex_up(&async_futex); 279 psthread_add_ready(call->ptid); 285 if (call->ptid) 286 psthread_add_ready(call->ptid); 280 287 281 288 if (callid == IPC_CALLRET_FATAL) { … … 431 438 } 432 439 433 434 /** Open shared memory connection over specified phoneid 435 * 436 * 437 * Allocate as_area, notify the other side about our intention 438 * to open the connection 439 * 440 * @return Connection id identifying this connection 441 */ 442 //int ipc_dgr_open(int pohoneid, size_t bufsize) 443 //{ 444 /* Find new file descriptor in local descriptor table */ 445 /* Create AS_area, initialize structures */ 446 /* Send AS to other side, handle error states */ 447 448 //} 449 /* 450 void ipc_dgr_close(int cid) 451 { 452 } 453 454 void * ipc_dgr_alloc(int cid, size_t size) 455 { 456 } 457 458 void ipc_dgr_free(int cid, void *area) 459 { 460 461 } 462 463 int ipc_dgr_send(int cid, void *area) 464 { 465 } 466 467 468 int ipc_dgr_send_data(int cid, void *data, size_t size) 469 { 470 } 471 472 */ 440 /* Primitive functions for simple communication */ 441 void send_call_3(int phoneid, ipcarg_t method, ipcarg_t arg1, 442 ipcarg_t arg2, ipcarg_t arg3) 443 { 444 ipc_call_async_3(phoneid, method, arg1, arg2, arg3, NULL, NULL, 1); 445 } 446 447 void send_call_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2) 448 { 449 ipc_call_async_2(phoneid, method, arg1, arg2, NULL, NULL, 1); 450 } 451 452 void nsend_call_3(int phoneid, ipcarg_t method, ipcarg_t arg1, 453 ipcarg_t arg2, ipcarg_t arg3) 454 { 455 ipc_call_async_3(phoneid, method, arg1, arg2, arg3, NULL, NULL, 0); 456 } 457 458 void nsend_call_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2) 459 { 460 ipc_call_async_2(phoneid, method, arg1, arg2, NULL, NULL, 0); 461 } 462 -
libc/generic/mmap.c
ra116ef22 rb1f51f0 41 41 // if (! ((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE))) 42 42 // return NULL; 43 //if (! (flags & MAP_ANONYMOUS))44 //return NULL;43 if (! (flags & MAP_ANONYMOUS)) 44 return NULL; 45 45 46 46 return as_area_create(start, length, prot); -
libc/include/ipc/ipc.h
ra116ef22 rb1f51f0 67 67 extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call); 68 68 69 #define ipc_call_async(phoneid,method,arg1,private, callback ) (ipc_call_async_2(phoneid, method, arg1, 0, private, callback))69 #define ipc_call_async(phoneid,method,arg1,private, callback,can_preempt) (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt)) 70 70 extern void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1, 71 71 ipcarg_t arg2, void *private, 72 ipc_async_callback_t callback );72 ipc_async_callback_t callback, int can_preempt); 73 73 extern void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1, 74 74 ipcarg_t arg2, ipcarg_t arg3, void *private, 75 ipc_async_callback_t callback); 75 ipc_async_callback_t callback, int can_preempt); 76 76 77 extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone); 77 78 extern int ipc_connect_me_to(int phoneid, int arg1, int arg2); … … 81 82 extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1); 82 83 84 85 /* Primitve functions for IPC communication */ 86 void send_call_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 87 ipcarg_t arg3); 88 void send_call_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2); 89 #define send_call(ph,m,a1) send_call_2(ph,m,a1,0) 90 /* These functions never preempt */ 91 void nsend_call_3(int phoneid, ipcarg_t method, ipcarg_t arg1, 92 ipcarg_t arg2, ipcarg_t arg3); 93 void nsend_call_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2); 94 #define nsend_call(ph,m,a1) nsend_call_2(ph,m,a1,0) 95 83 96 #endif
Note:
See TracChangeset
for help on using the changeset viewer.