Changeset 7c34822e in mainline
- Timestamp:
- 2006-11-30T15:38:45Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7bf7ef7
- Parents:
- 8c19cf28
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/lib/rd.h
r8c19cf28 r7c34822e 76 76 } rd_header; 77 77 78 extern int init_rd(rd_header * addr );78 extern int init_rd(rd_header * addr, size_t size); 79 79 80 80 #endif -
kernel/generic/src/lib/rd.c
r8c19cf28 r7c34822e 40 40 #include <lib/rd.h> 41 41 #include <arch/byteorder.h> 42 #include <mm/frame.h> 43 #include <sysinfo/sysinfo.h> 42 44 43 int init_rd(rd_header * header )45 int init_rd(rd_header * header, size_t size) 44 46 { 45 47 /* Identify RAM disk */ … … 51 53 return RE_UNSUPPORTED; 52 54 53 uint64_t hsize; 55 uint32_t hsize; 56 uint64_t dsize; 54 57 switch (header->data_type) { 55 58 case RD_DATA_LSB: 56 hsize = uint64_t_le2host(header->header_size); 59 hsize = uint32_t_le2host(header->header_size); 60 dsize = uint64_t_le2host(header->data_size); 57 61 break; 58 // case RD_DATA_MSB: 59 // hsize = uint64_t_be2host(header->header_size); 60 // break; 62 case RD_DATA_MSB: 63 hsize = uint32_t_be2host(header->header_size); 64 dsize = uint64_t_le2host(header->data_size); 65 break; 61 66 default: 62 67 return RE_UNSUPPORTED; 63 68 } 64 69 70 if ((hsize % FRAME_SIZE) || (dsize % FRAME_SIZE)) 71 return RE_UNSUPPORTED; 72 73 if (hsize > size) 74 return RE_INVALID; 75 76 if ((uint64_t) hsize + dsize > size) 77 dsize = size - hsize; 78 79 sysinfo_set_item_val("rd", NULL, true); 80 sysinfo_set_item_val("rd.size", NULL, dsize); 81 sysinfo_set_item_val("rd.address.physical", NULL, (unative_t) KA2PA((void *) header + hsize)); 65 82 66 83 return RE_OK; -
kernel/generic/src/main/kinit.c
r8c19cf28 r7c34822e 181 181 ipc_phone_0 = &utask->answerbox; 182 182 } else { 183 int rd = init_rd(( void *) init.tasks[i].addr);183 int rd = init_rd((rd_header *) init.tasks[i].addr, init.tasks[i].size); 184 184 185 185 if (rd != RE_OK) -
uspace/libc/generic/sysinfo.c
r8c19cf28 r7c34822e 39 39 sysarg_t sysinfo_value(char *name) 40 40 { 41 return __SYSCALL2(SYS_SYSINFO_VALUE, (sysarg_t ) name, (sysarg_t) strlen(name) 41 return __SYSCALL2(SYS_SYSINFO_VALUE, (sysarg_t ) name, (sysarg_t) strlen(name)); 42 42 } 43 43 44 44 /** @} 45 45 */ 46 47 -
uspace/rd/rd.c
r8c19cf28 r7c34822e 39 39 #include <ipc/services.h> 40 40 #include <ipc/ns.h> 41 #include <sysinfo.h> 42 #include <as.h> 43 #include <ddi.h> 44 #include <align.h> 45 #include <bool.h> 41 46 #include <errno.h> 42 47 #include <async.h> … … 65 70 66 71 72 static 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 67 88 int main(int argc, char **argv) 68 89 { 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 } 70 104 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; 81 106 } 82 107
Note:
See TracChangeset
for help on using the changeset viewer.