Changeset 90f5d64 in mainline


Ignore:
Timestamp:
2006-06-03T14:54:51Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dc5a0fe1
Parents:
0861786
Message:

AS_AREA_CACHEABLE not needed anymore for sharing.
Added icons to console.

Files:
5 added
21 edited

Legend:

Unmodified
Added
Removed
  • console/Makefile

    r0861786 r90f5d64  
    4848        gcons.c
    4949
     50IMAGES = helenos.ppm nameic.ppm
     51
    5052ARCH_SOURCES =
    5153
    52 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
     54GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) \
     55                        $(addsuffix .o,$(basename $(IMAGES)))   
    5356ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
    5457
     
    7982%.o: %.c
    8083        $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
     84
     85%.o: %.ppm
     86        $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) $< $@
  • console/console.c

    r0861786 r90f5d64  
    389389       
    390390        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) {
    392392                        munmap(interbuffer, sizeof(keyfield_t) * fb_info.cols * fb_info.rows);
    393393                        interbuffer = NULL;
  • console/gcons.c

    r0861786 r90f5d64  
    3131#include <async.h>
    3232#include <stdio.h>
     33#include <sys/mman.h>
     34#include <string.h>
    3335
    3436#include "console.h"
    3537#include "gcons.h"
    3638
    37 #define CONSOLE_TOP      50
     39#define CONSOLE_TOP      65
    3840#define CONSOLE_MARGIN   10
    3941
    40 #define STATUS_SPACE    20
     42#define STATUS_START    120
     43#define STATUS_SPACE    5
    4144#define STATUS_WIDTH    40
    4245#define STATUS_HEIGHT   30
    4346
    44 #define MAIN_COLOR      0x118811
     47#define MAIN_COLOR      0xffffff
    4548
    4649static int use_gcons = 0;
     
    146149}
    147150
     151static 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);
     171drop:
     172        /* Drop area */
     173        nsend_call(fbphone, FB_DROP_SHM, 0);
     174exit:       
     175        /* Remove area */
     176        munmap(shm, size);
     177}
     178
     179extern char _binary_helenos_ppm_start[0];
     180extern int _binary_helenos_ppm_size;
     181extern char _binary_nameic_ppm_start[0];
     182extern int _binary_nameic_ppm_size;
    148183void gcons_redraw_console(void)
    149184{
    150185        int i;
     186        size_t hsize = (size_t)&_binary_helenos_ppm_size;
    151187
    152188        if (!use_gcons)
     
    156192        set_style(MAIN_COLOR, MAIN_COLOR);
    157193        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
    158197
    159198        for (i=0;i < CONSOLE_COUNT; i++)
     
    185224        /* Create status buttons */
    186225        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),
    188227                                          CONSOLE_MARGIN, STATUS_WIDTH, STATUS_HEIGHT);
    189228                if (cstatus_vp[i] < 0)
  • fb/Makefile

    r0861786 r90f5d64  
    5050        main.c \
    5151        sysio.c \
    52         ega.c
     52        ega.c \
     53        ppm.c
    5354
    5455OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
  • fb/ega.c

    r0861786 r90f5d64  
    111111                        intersize = IPC_GET_ARG2(call);
    112112                        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);
    114114                                continue;
    115115                        }
  • fb/fb.c

    r0861786 r90f5d64  
    4747#include "main.h"
    4848#include "../console/screenbuffer.h"
     49#include "ppm.h"
    4950
    5051#define DEFAULT_BGCOLOR                0x000080
     
    475476}
    476477
     478static 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}
    477560
    478561/** Function for handling connections to FB
     
    487570        unsigned int row,col;
    488571        char c;
    489         keyfield_t *interbuffer = NULL;
    490         size_t intersize = 0;
    491572
    492573        int vp = 0;
     
    506587                        continue;
    507588                }
     589                if (shm_handle(callid, &call, vp))
     590                        continue;
     591
    508592                switch (IPC_GET_METHOD(call)) {
    509593                case IPC_M_PHONE_HUNGUP:
     
    514598                        ipc_answer_fast(callid,0,0,0);
    515599                        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
    535601                case FB_PUTCHAR:
    536602                        c = IPC_GET_ARG1(call);
  • fb/main.c

    r0861786 r90f5d64  
    4040#include "main.h"
    4141
    42 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area,
    43                        size_t maxsize)
     42void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area)
    4443{
    4544        void *dest;
    4645
    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;
    5051        }
    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;
    5952}
    6053
  • fb/main.h

    r0861786 r90f5d64  
    3030#define __MAIN_H_
    3131
    32 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area,
    33                        size_t maxsize);
     32void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area);
    3433
    3534#endif
  • libc/arch/amd64/Makefile.inc

    r0861786 r90f5d64  
    3838
    3939LFLAGS += -N
     40
     41BFD_NAME = elf64-x86-64
     42BFD_ARCH = i386:x86-64
  • libc/arch/ia32/Makefile.inc

    r0861786 r90f5d64  
    3838
    3939LFLAGS += -N
     40
     41BFD_NAME = elf32-i386
     42BFD_ARCH = i386
  • libc/arch/ia64/Makefile.inc

    r0861786 r90f5d64  
    3939                arch/$(ARCH)/src/psthread.S \
    4040                arch/$(ARCH)/src/thread.c
     41
     42BFD_NAME = elf64-little
     43BFD_ARCH = ia64-elf64
  • libc/arch/mips32/Makefile.inc

    r0861786 r90f5d64  
    3838        arch/$(ARCH)/src/thread.c
    3939
    40 
     40BFD_ARCH = mips
     41BFD_NAME = elf32-little
  • libc/arch/mips32eb/Makefile.inc

    r0861786 r90f5d64  
    3232TARGET = mips-sgi-irix5
    3333TOOLCHAIN_DIR = /usr/local/mips/bin
    34 CFLAGS += -mno-abicalls -mips3
     34CFLAGS += -mips3
    3535
    36 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c
     36ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \
     37                arch/$(ARCH)/src/psthread.S \
     38                arch/$(ARCH)/src/thread.c
    3739
    3840LFLAGS += -N
    3941
     42BFD_ARCH = mips
     43BFD_NAME = elf32-big
  • libc/arch/ppc32/Makefile.inc

    r0861786 r90f5d64  
    4040AFLAGS += -a32
    4141LFLAGS += -N
     42
     43BFD_NAME = elf32-powerpc
     44BFD_ARCH = powerpc:common
  • libc/generic/async.c

    r0861786 r90f5d64  
    624624}
    625625
     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 */
     631aid_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
    626647/** Wait for a message sent by async framework
    627648 *
  • libc/generic/mmap.c

    r0861786 r90f5d64  
    3434           off_t offset)
    3535{
     36        int rc;
     37
    3638        if (!start)
    3739                start = as_get_mappable_page(length);
    3840       
    39         prot |= AS_AREA_CACHEABLE;
    40        
    4141//      if (! ((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE)))
    42 //              return NULL;
     42//              return MAP_FAILED;
    4343        if (! (flags & MAP_ANONYMOUS))
    44                 return NULL;
     44                return MAP_FAILED;
    4545
    4646        return as_area_create(start, length, prot);
  • libc/generic/time.c

    r0861786 r90f5d64  
    7474                        _exit(1);
    7575                }
    76                 if (rights != (AS_AREA_READ | AS_AREA_CACHEABLE)) {
     76                if (! (rights & AS_AREA_READ)) {
    7777                        printf("Received bad rights on time area: %X\n",
    7878                               rights);
  • libc/include/async.h

    r0861786 r90f5d64  
    4747aid_t async_send_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
    4848                   ipc_call_t *dataptr);
     49aid_t async_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
     50                   ipcarg_t arg3, ipc_call_t *dataptr);
    4951void async_wait_for(aid_t amsgid, ipcarg_t *result);
    5052int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, suseconds_t timeout);
     
    6971        return rc;
    7072}
     73static 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}
    7190
    7291
  • libc/include/ipc/fb.h

    r0861786 r90f5d64  
    2121#define FB_FLUSH             1037
    2222
     23#define FB_DRAW_PPM          1038
     24#define FB_PREPARE_SHM       1039
     25#define FB_DROP_SHM          1040
     26
    2327#endif
  • libc/include/sys/mman.h

    r0861786 r90f5d64  
    3232#include <as.h>
    3333
     34#define MAP_FAILED  ((void *) -1)
     35
    3436#define MAP_SHARED       (1 << 0)
    3537#define MAP_PRIVATE      (1 << 1)
  • ns/ns.c

    r0861786 r90f5d64  
    9191                map_physmem(ph_addr, addr, 1, AS_AREA_READ | AS_AREA_CACHEABLE);
    9292        }
    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);
    9494}
    9595
Note: See TracChangeset for help on using the changeset viewer.