Changeset 90f5d64 in mainline
- Timestamp:
- 2006-06-03T14:54:51Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dc5a0fe1
- Parents:
- 0861786
- Files:
-
- 5 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
console/Makefile
r0861786 r90f5d64 48 48 gcons.c 49 49 50 IMAGES = helenos.ppm nameic.ppm 51 50 52 ARCH_SOURCES = 51 53 52 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 54 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) \ 55 $(addsuffix .o,$(basename $(IMAGES))) 53 56 ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) 54 57 … … 79 82 %.o: %.c 80 83 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 84 85 %.o: %.ppm 86 $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) $< $@ -
console/console.c
r0861786 r90f5d64 389 389 390 390 if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols * fb_info.rows , PROTO_READ|PROTO_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0 ,0 )) != NULL) { 391 if (ipc_call_sync_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)interbuffer, 0, AS_AREA_READ | AS_AREA_CACHEABLE, NULL, NULL, NULL) != 0) {391 if (ipc_call_sync_3(fb_info.phone, IPC_M_AS_AREA_SEND, (ipcarg_t)interbuffer, 0, AS_AREA_READ, NULL, NULL, NULL) != 0) { 392 392 munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols * fb_info.rows); 393 393 interbuffer = NULL; -
console/gcons.c
r0861786 r90f5d64 31 31 #include <async.h> 32 32 #include <stdio.h> 33 #include <sys/mman.h> 34 #include <string.h> 33 35 34 36 #include "console.h" 35 37 #include "gcons.h" 36 38 37 #define CONSOLE_TOP 5039 #define CONSOLE_TOP 65 38 40 #define CONSOLE_MARGIN 10 39 41 40 #define STATUS_SPACE 20 42 #define STATUS_START 120 43 #define STATUS_SPACE 5 41 44 #define STATUS_WIDTH 40 42 45 #define STATUS_HEIGHT 30 43 46 44 #define MAIN_COLOR 0x 11881147 #define MAIN_COLOR 0xffffff 45 48 46 49 static int use_gcons = 0; … … 146 149 } 147 150 151 static void draw_pixmap(char *logo, size_t size, int x, int y) 152 { 153 char *shm; 154 int rc; 155 156 /* Create area */ 157 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); 158 if (shm == MAP_FAILED) 159 return; 160 161 memcpy(shm, logo, size); 162 /* Send area */ 163 rc = sync_send_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); 164 if (rc) 165 goto exit; 166 rc = sync_send_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); 167 if (rc) 168 goto drop; 169 /* Draw logo */ 170 send_call_2(fbphone, FB_DRAW_PPM, x, y); 171 drop: 172 /* Drop area */ 173 nsend_call(fbphone, FB_DROP_SHM, 0); 174 exit: 175 /* Remove area */ 176 munmap(shm, size); 177 } 178 179 extern char _binary_helenos_ppm_start[0]; 180 extern int _binary_helenos_ppm_size; 181 extern char _binary_nameic_ppm_start[0]; 182 extern int _binary_nameic_ppm_size; 148 183 void gcons_redraw_console(void) 149 184 { 150 185 int i; 186 size_t hsize = (size_t)&_binary_helenos_ppm_size; 151 187 152 188 if (!use_gcons) … … 156 192 set_style(MAIN_COLOR, MAIN_COLOR); 157 193 clear(); 194 draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-64, 0); 195 draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 10); 196 158 197 159 198 for (i=0;i < CONSOLE_COUNT; i++) … … 185 224 /* Create status buttons */ 186 225 for (i=0; i < CONSOLE_COUNT; i++) { 187 cstatus_vp[i] = vp_create( CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE),226 cstatus_vp[i] = vp_create(STATUS_START+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), 188 227 CONSOLE_MARGIN, STATUS_WIDTH, STATUS_HEIGHT); 189 228 if (cstatus_vp[i] < 0) -
fb/Makefile
r0861786 r90f5d64 50 50 main.c \ 51 51 sysio.c \ 52 ega.c 52 ega.c \ 53 ppm.c 53 54 54 55 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) -
fb/ega.c
r0861786 r90f5d64 111 111 intersize = IPC_GET_ARG2(call); 112 112 if (intersize >= scr_width*scr_height*sizeof(*interbuf)) { 113 receive_comm_area(callid,&call,(void **)&interbuf , scr_width*scr_height*sizeof(*interbuf));113 receive_comm_area(callid,&call,(void **)&interbuf); 114 114 continue; 115 115 } -
fb/fb.c
r0861786 r90f5d64 47 47 #include "main.h" 48 48 #include "../console/screenbuffer.h" 49 #include "ppm.h" 49 50 50 51 #define DEFAULT_BGCOLOR 0x000080 … … 475 476 } 476 477 478 static int shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp) 479 { 480 static keyfield_t *interbuffer = NULL; 481 static size_t intersize = 0; 482 483 static char *pixmap = NULL; 484 static ipcarg_t pixmap_id = 0; 485 static size_t pixmap_size; 486 487 int handled = 1; 488 int retval = 0; 489 viewport_t *vport = &viewports[vp]; 490 unsigned int x,y; 491 492 switch (IPC_GET_METHOD(*call)) { 493 case IPC_M_AS_AREA_SEND: 494 /* We accept one area for data interchange */ 495 if (IPC_GET_ARG1(*call) == pixmap_id) { 496 void *dest = as_get_mappable_page(IPC_GET_ARG2(*call)); 497 pixmap_size = IPC_GET_ARG2(*call); 498 if (!ipc_answer_fast(callid, 0, (sysarg_t)dest, 0)) 499 pixmap = dest; 500 else 501 pixmap_id = 0; 502 if (pixmap[0] != 'P') 503 while (1) 504 ; 505 return 1; 506 } else { 507 intersize = IPC_GET_ARG2(*call); 508 receive_comm_area(callid,call,(void **)&interbuffer); 509 } 510 return 1; 511 case FB_PREPARE_SHM: 512 if (pixmap_id) 513 retval = EBUSY; 514 else 515 pixmap_id = IPC_GET_ARG1(*call); 516 break; 517 518 case FB_DROP_SHM: 519 if (pixmap) { 520 as_area_destroy(pixmap); 521 pixmap = NULL; 522 } 523 pixmap_id = 0; 524 break; 525 526 case FB_DRAW_PPM: 527 if (!pixmap) { 528 retval = EINVAL; 529 break; 530 } 531 x = IPC_GET_ARG1(*call); 532 y = IPC_GET_ARG2(*call); 533 if (x > vport->width || y > vport->height) { 534 retval = EINVAL; 535 break; 536 } 537 538 draw_ppm(pixmap, pixmap_size, IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), 539 vport->width - x, vport->height - y, putpixel, vp); 540 break; 541 case FB_DRAW_TEXT_DATA: 542 if (!interbuffer) { 543 retval = EINVAL; 544 break; 545 } 546 if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) { 547 retval = EINVAL; 548 break; 549 } 550 draw_text_data(vp, interbuffer); 551 break; 552 default: 553 handled = 0; 554 } 555 556 if (handled) 557 ipc_answer_fast(callid, retval, 0, 0); 558 return handled; 559 } 477 560 478 561 /** Function for handling connections to FB … … 487 570 unsigned int row,col; 488 571 char c; 489 keyfield_t *interbuffer = NULL;490 size_t intersize = 0;491 572 492 573 int vp = 0; … … 506 587 continue; 507 588 } 589 if (shm_handle(callid, &call, vp)) 590 continue; 591 508 592 switch (IPC_GET_METHOD(call)) { 509 593 case IPC_M_PHONE_HUNGUP: … … 514 598 ipc_answer_fast(callid,0,0,0); 515 599 return; /* Exit thread */ 516 case IPC_M_AS_AREA_SEND: 517 /* We accept one area for data interchange */ 518 intersize = IPC_GET_ARG2(call); 519 receive_comm_area(callid,&call,(void **)&interbuffer, 520 sizeof(*interbuffer)*viewports[0].cols*viewports[0].rows); 521 continue; 522 523 case FB_DRAW_TEXT_DATA: 524 if (!interbuffer) { 525 retval = EINVAL; 526 break; 527 } 528 if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) { 529 retval = EINVAL; 530 break; 531 } 532 draw_text_data(vp, interbuffer); 533 retval = 0; 534 break; 600 535 601 case FB_PUTCHAR: 536 602 c = IPC_GET_ARG1(call); -
fb/main.c
r0861786 r90f5d64 40 40 #include "main.h" 41 41 42 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area, 43 size_t maxsize) 42 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area) 44 43 { 45 44 void *dest; 46 45 47 if (*area) { 48 ipc_answer_fast(callid, ELIMIT, 0, 0); 49 return; 46 dest = as_get_mappable_page(IPC_GET_ARG2(*call)); 47 if (ipc_answer_fast(callid, 0, (sysarg_t)dest, 0) == 0) { 48 if (*area) 49 as_area_destroy(*area); 50 *area = dest; 50 51 } 51 if (IPC_GET_ARG2(*call) > ALIGN_UP(maxsize, PAGE_SIZE)) {52 ipc_answer_fast(callid, EINVAL, 0, 0);53 return;54 }55 56 dest = as_get_mappable_page(maxsize);57 if (ipc_answer_fast(callid, 0, (sysarg_t)dest, 0) == 0)58 *area = dest;59 52 } 60 53 -
fb/main.h
r0861786 r90f5d64 30 30 #define __MAIN_H_ 31 31 32 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area, 33 size_t maxsize); 32 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area); 34 33 35 34 #endif -
libc/arch/amd64/Makefile.inc
r0861786 r90f5d64 38 38 39 39 LFLAGS += -N 40 41 BFD_NAME = elf64-x86-64 42 BFD_ARCH = i386:x86-64 -
libc/arch/ia32/Makefile.inc
r0861786 r90f5d64 38 38 39 39 LFLAGS += -N 40 41 BFD_NAME = elf32-i386 42 BFD_ARCH = i386 -
libc/arch/ia64/Makefile.inc
r0861786 r90f5d64 39 39 arch/$(ARCH)/src/psthread.S \ 40 40 arch/$(ARCH)/src/thread.c 41 42 BFD_NAME = elf64-little 43 BFD_ARCH = ia64-elf64 -
libc/arch/mips32/Makefile.inc
r0861786 r90f5d64 38 38 arch/$(ARCH)/src/thread.c 39 39 40 40 BFD_ARCH = mips 41 BFD_NAME = elf32-little -
libc/arch/mips32eb/Makefile.inc
r0861786 r90f5d64 32 32 TARGET = mips-sgi-irix5 33 33 TOOLCHAIN_DIR = /usr/local/mips/bin 34 CFLAGS += -m no-abicalls -mips334 CFLAGS += -mips3 35 35 36 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c 36 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \ 37 arch/$(ARCH)/src/psthread.S \ 38 arch/$(ARCH)/src/thread.c 37 39 38 40 LFLAGS += -N 39 41 42 BFD_ARCH = mips 43 BFD_NAME = elf32-big -
libc/arch/ppc32/Makefile.inc
r0861786 r90f5d64 40 40 AFLAGS += -a32 41 41 LFLAGS += -N 42 43 BFD_NAME = elf32-powerpc 44 BFD_ARCH = powerpc:common -
libc/generic/async.c
r0861786 r90f5d64 624 624 } 625 625 626 /** Send message and return id of the sent message 627 * 628 * The return value can be used as input for async_wait() to wait 629 * for completion. 630 */ 631 aid_t async_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 632 ipcarg_t arg3, ipc_call_t *dataptr) 633 { 634 amsg_t *msg; 635 636 msg = malloc(sizeof(*msg)); 637 msg->done = 0; 638 msg->dataptr = dataptr; 639 640 msg->wdata.active = 1; /* We may sleep in next method, but it 641 * will use it's own mechanism */ 642 ipc_call_async_3(phoneid,method,arg1,arg2,arg3, msg,reply_received,1); 643 644 return (aid_t) msg; 645 } 646 626 647 /** Wait for a message sent by async framework 627 648 * -
libc/generic/mmap.c
r0861786 r90f5d64 34 34 off_t offset) 35 35 { 36 int rc; 37 36 38 if (!start) 37 39 start = as_get_mappable_page(length); 38 40 39 prot |= AS_AREA_CACHEABLE;40 41 41 // if (! ((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE))) 42 // return NULL;42 // return MAP_FAILED; 43 43 if (! (flags & MAP_ANONYMOUS)) 44 return NULL;44 return MAP_FAILED; 45 45 46 46 return as_area_create(start, length, prot); -
libc/generic/time.c
r0861786 r90f5d64 74 74 _exit(1); 75 75 } 76 if ( rights != (AS_AREA_READ | AS_AREA_CACHEABLE)) {76 if (! (rights & AS_AREA_READ)) { 77 77 printf("Received bad rights on time area: %X\n", 78 78 rights); -
libc/include/async.h
r0861786 r90f5d64 47 47 aid_t async_send_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 48 48 ipc_call_t *dataptr); 49 aid_t async_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 50 ipcarg_t arg3, ipc_call_t *dataptr); 49 51 void async_wait_for(aid_t amsgid, ipcarg_t *result); 50 52 int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, suseconds_t timeout); … … 69 71 return rc; 70 72 } 73 static inline ipcarg_t sync_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, 74 ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *r1, 75 ipcarg_t *r2, ipcarg_t *r3) 76 { 77 ipc_call_t result; 78 ipcarg_t rc; 79 80 aid_t eid = async_send_3(phoneid, method, arg1, arg2, arg3, &result); 81 async_wait_for(eid, &rc); 82 if (r1) 83 *r1 = IPC_GET_ARG1(result); 84 if (r2) 85 *r2 = IPC_GET_ARG2(result); 86 if (r3) 87 *r3 = IPC_GET_ARG3(result); 88 return rc; 89 } 71 90 72 91 -
libc/include/ipc/fb.h
r0861786 r90f5d64 21 21 #define FB_FLUSH 1037 22 22 23 #define FB_DRAW_PPM 1038 24 #define FB_PREPARE_SHM 1039 25 #define FB_DROP_SHM 1040 26 23 27 #endif -
libc/include/sys/mman.h
r0861786 r90f5d64 32 32 #include <as.h> 33 33 34 #define MAP_FAILED ((void *) -1) 35 34 36 #define MAP_SHARED (1 << 0) 35 37 #define MAP_PRIVATE (1 << 1) -
ns/ns.c
r0861786 r90f5d64 91 91 map_physmem(ph_addr, addr, 1, AS_AREA_READ | AS_AREA_CACHEABLE); 92 92 } 93 ipc_answer_fast(callid, 0, (ipcarg_t)addr, AS_AREA_READ | AS_AREA_CACHEABLE);93 ipc_answer_fast(callid, 0, (ipcarg_t)addr, AS_AREA_READ); 94 94 } 95 95
Note:
See TracChangeset
for help on using the changeset viewer.