Changeset ff3a34b in mainline
- Timestamp:
- 2007-06-01T14:15:42Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ea7890e7
- Parents:
- 60133d0
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/doc/AUTHORS
r60133d0 rff3a34b 5 5 Josef Cejka <cejka@helenos.eu> 6 6 Sergey Bondari <bondari@helenos.eu> 7 Michal Konopa <mkonopa@seznam.cz> 7 8 -
kernel/generic/include/errno.h
r60133d0 rff3a34b 38 38 /* 1-255 are kernel error codes, 256-512 are user error codes */ 39 39 40 #define EOK 0 /* No error */ 40 41 #define ENOENT -1 /* No such entry */ 41 42 #define ENOMEM -2 /* Not enough memory */ -
kernel/generic/include/lib/rd.h
r60133d0 rff3a34b 41 41 * RAM disk version 42 42 */ 43 #define RD_VERSION 043 #define RD_VERSION 1 44 44 45 45 /** -
kernel/generic/src/lib/rd.c
r60133d0 rff3a34b 43 43 #include <sysinfo/sysinfo.h> 44 44 #include <ddi/ddi.h> 45 #include <print.h> 46 #include <align.h> 45 47 46 48 static parea_t rd_parea; /**< Physical memory area for rd. */ 47 49 50 /** 51 * RAM disk initialization routine. At this point, the RAM disk memory is shared 52 * and information about the share is provided as sysinfo values to the userspace 53 * tasks. 54 */ 48 55 int init_rd(rd_header * header, size_t size) 49 56 { … … 75 82 return RE_UNSUPPORTED; 76 83 84 if (dsize % FRAME_SIZE) 85 return RE_UNSUPPORTED; 86 77 87 if (hsize > size) 78 88 return RE_INVALID; … … 81 91 dsize = size - hsize; 82 92 83 rd_parea.pbase = KA2PA((void *) header + hsize);93 rd_parea.pbase = ALIGN_DOWN((uintptr_t) KA2PA((void *) header + hsize), FRAME_SIZE); 84 94 rd_parea.vbase = (uintptr_t) ((void *) header + hsize); 85 95 rd_parea.frames = SIZE2FRAMES(dsize); … … 88 98 89 99 sysinfo_set_item_val("rd", NULL, true); 100 sysinfo_set_item_val("rd.header_size", NULL, hsize); 90 101 sysinfo_set_item_val("rd.size", NULL, dsize); 91 102 sysinfo_set_item_val("rd.address.physical", NULL, (unative_t) -
kernel/generic/src/main/kinit.c
r60133d0 rff3a34b 168 168 task_t *utask = task_run_program((void *) init.tasks[i].addr, 169 169 "uspace"); 170 170 171 if (utask) { 171 172 /* … … 182 183 183 184 if (rd != RE_OK) 184 printf("Init binary %zd not used .\n", i);185 printf("Init binary %zd not used, error code %d.\n", i, rd); 185 186 } 186 187 } -
uspace/libc/include/ipc/services.h
r60133d0 rff3a34b 43 43 #define SERVICE_CONSOLE 4 44 44 #define SERVICE_RD 5 45 #define SERVICE_FS 6 45 46 46 47 /* Memory area to be received from NS */ -
uspace/rd/rd.c
r60133d0 rff3a34b 1 1 /* 2 * Copyright (c) 2006 Martin Decky 2 * Copyright (c) 2007 Michal Konopa 3 * Copyright (c) 2007 Martin Jelen 4 * Copyright (c) 2007 Peter Majer 3 5 * All rights reserved. 4 6 * … … 46 48 #include <errno.h> 47 49 #include <async.h> 50 #include <stdlib.h> 51 #include <unistd.h> 52 #include <align.h> 53 #include <async.h> 54 #include <ddi.h> 55 #include <libarch/ddi.h> 56 #include <stdio.h> 57 #include "rd.h" 48 58 59 static void *rd_addr; 60 static void *fs_addr; 49 61 50 62 static void rd_connection(ipc_callid_t iid, ipc_call_t *icall) … … 55 67 56 68 ipc_answer_fast(iid, 0, 0, 0); 69 ipcarg_t offset; 57 70 58 71 while (1) { 59 72 callid = async_get_call(&call); 60 73 switch (IPC_GET_METHOD(call)) { 61 case IPC_M_PHONE_HUNGUP: 62 ipc_answer_fast(callid, 0,0,0); 63 return; 64 default: 65 retval = EINVAL; 74 case IPC_M_PHONE_HUNGUP: 75 ipc_answer_fast(callid, 0,0,0); 76 return; 77 case IPC_M_AS_AREA_SEND: 78 ipc_answer_fast(callid, 0, (uintptr_t)fs_addr, 0); 79 continue; 80 case RD_READ_BLOCK: 81 offset = IPC_GET_ARG1(call); 82 memcpy((void *)fs_addr, rd_addr+offset, BLOCK_SIZE); 83 retval = EOK; 84 break; 85 default: 86 retval = EINVAL; 66 87 } 67 88 ipc_answer_fast(callid, retval, 0, 0); … … 72 93 static bool rd_init(void) 73 94 { 95 int retval, flags; 96 74 97 size_t rd_size = sysinfo_value("rd.size"); 75 98 void * rd_ph_addr = (void *) sysinfo_value("rd.address.physical"); … … 78 101 return false; 79 102 80 void *rd_addr = as_get_mappable_page(rd_size);103 rd_addr = as_get_mappable_page(rd_size); 81 104 82 physmem_map(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE); 105 flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; 106 retval = physmem_map(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags); 107 108 if (retval < 0) 109 return false; 83 110 111 size_t fs_size = ALIGN_UP(BLOCK_SIZE * sizeof(char), PAGE_SIZE); 112 fs_addr = as_get_mappable_page(fs_size); 113 84 114 return true; 85 115 } 86 87 116 88 117 int main(int argc, char **argv)
Note:
See TracChangeset
for help on using the changeset viewer.