Changeset 7c34822e in mainline for uspace/rd/rd.c


Ignore:
Timestamp:
2006-11-30T15:38:45Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7bf7ef7
Parents:
8c19cf28
Message:

update rd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/rd/rd.c

    r8c19cf28 r7c34822e  
    3939#include <ipc/services.h>
    4040#include <ipc/ns.h>
     41#include <sysinfo.h>
     42#include <as.h>
     43#include <ddi.h>
     44#include <align.h>
     45#include <bool.h>
    4146#include <errno.h>
    4247#include <async.h>
     
    6570
    6671
     72static bool rd_init(void)
     73{
     74        size_t rd_size = sysinfo_value("rd.size");
     75        void * rd_ph_addr = (void *) sysinfo_value("rd.address.physical");
     76       
     77        if (rd_size == 0)
     78                return false;
     79       
     80        void * rd_addr = as_get_mappable_page(rd_size);
     81       
     82        map_physmem(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
     83       
     84        return true;
     85}
     86
     87
    6788int main(int argc, char **argv)
    6889{
    69         ipcarg_t phonead;
     90        if (rd_init()) {
     91                ipcarg_t phonead;
     92               
     93                async_set_client_connection(rd_connection);
     94               
     95                /* Register service at nameserver */
     96                if (ipc_connect_to_me(PHONE_NS, SERVICE_RD, 0, &phonead) != 0)
     97                        return -1;
     98               
     99                async_manager();
     100               
     101                /* Never reached */
     102                return 0;
     103        }
    70104       
    71         async_set_client_connection(rd_connection);
    72        
    73         /* Register service at nameserver */
    74         if (ipc_connect_to_me(PHONE_NS, SERVICE_RD, 0, &phonead) != 0)
    75                 return -1;
    76 
    77         async_manager();
    78 
    79         /* Never reached */
    80         return 0;
     105        return -1;
    81106}
    82107
Note: See TracChangeset for help on using the changeset viewer.