Changeset 058b021 in mainline
- Timestamp:
- 2006-11-30T13:43:00Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c55dd58
- Parents:
- 0cf1dcf
- Location:
- kernel/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/byteorder.h
r0cf1dcf r058b021 42 42 ((n & 0xff0000) << 24) | 43 43 ((n & 0xff000000LL) << 8) | 44 ((n & 0xff00000000LL) >> 8) |44 ((n & 0xff00000000LL) >> 8) | 45 45 ((n & 0xff0000000000LL) >> 24) | 46 46 ((n & 0xff000000000000LL) >> 40) | -
kernel/generic/include/lib/rd.h
r0cf1dcf r058b021 36 36 #define KERN_RD_H_ 37 37 38 #include <arch/types.h> 38 39 #include <typedefs.h> 39 40 40 extern bool init_rd(void * addr); 41 /** 42 * RAM disk version 43 */ 44 #define RD_VERSION 0 45 46 /** 47 * RAM disk magic number 48 */ 49 #define RD_MAGIC_SIZE 4 50 #define RD_MAG0 'H' 51 #define RD_MAG1 'O' 52 #define RD_MAG2 'R' 53 #define RD_MAG3 'D' 54 55 /** 56 * RAM disk data encoding types 57 */ 58 #define RD_DATA_NONE 0 59 #define RD_DATA_LSB 1 /* Least significant byte first (little endian) */ 60 #define RD_DATA_MSB 2 /* Most signigicant byte first (big endian) */ 61 62 /** 63 * RAM disk error return codes 64 */ 65 #define RE_OK 0 /* No error */ 66 #define RE_INVALID 1 /* Invalid RAM disk image */ 67 #define RE_UNSUPPORTED 2 /* Non-supported image (e.g. wrong version) */ 68 69 /** RAM disk header */ 70 typedef struct { 71 uint8_t magic[RD_MAGIC_SIZE]; 72 uint8_t version; 73 uint8_t data_type; 74 uint32_t header_size; 75 uint64_t data_size; 76 } rd_header; 77 78 extern int init_rd(rd_header * addr); 41 79 42 80 #endif -
kernel/generic/src/lib/rd.c
r0cf1dcf r058b021 39 39 40 40 #include <lib/rd.h> 41 #include <arch/byteorder.h> 41 42 42 bool init_rd(void * addr)43 int init_rd(rd_header * header) 43 44 { 44 return false; 45 /* Identify RAM disk */ 46 if ((header->magic[0] != RD_MAG0) || (header->magic[1] != RD_MAG1) || (header->magic[2] != RD_MAG2) || (header->magic[3] != RD_MAG3)) 47 return RE_INVALID; 48 49 /* Identify version */ 50 if (header->version != RD_VERSION) 51 return RE_UNSUPPORTED; 52 53 uint64_t hsize; 54 switch (header->data_type) { 55 case RD_DATA_LSB: 56 hsize = uint64_t_le2host(header->header_size); 57 break; 58 // case RD_DATA_MSB: 59 // hsize = uint64_t_be2host(header->header_size); 60 // break; 61 default: 62 return RE_UNSUPPORTED; 63 } 64 65 66 return RE_OK; 45 67 } 46 68 -
kernel/generic/src/main/kinit.c
r0cf1dcf r058b021 181 181 ipc_phone_0 = &utask->answerbox; 182 182 } else { 183 boolrd = init_rd((void *) init.tasks[i].addr);183 int rd = init_rd((void *) init.tasks[i].addr); 184 184 185 if ( !rd)185 if (rd != RE_OK) 186 186 printf("Init binary %zd not used.\n", i); 187 187 }
Note:
See TracChangeset
for help on using the changeset viewer.