Changeset 3ae470a in mainline
- Timestamp:
- 2007-06-21T17:04:06Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 00acd66
- Parents:
- 6765c07
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/rd/rd.c
r6765c07 r3ae470a 56 56 /** Pointer to the ramdisk's image. */ 57 57 static void *rd_addr; 58 /** Size of the ramdisk. */ 59 static size_t rd_size; 58 60 59 61 /** … … 75 77 ipc_call_t call; 76 78 int retval; 77 uintptr_tfs_va = NULL;79 void *fs_va = NULL; 78 80 ipcarg_t offset; 79 81 … … 140 142 case RD_READ_BLOCK: 141 143 offset = IPC_GET_ARG1(call); 144 if (offset * BLOCK_SIZE > rd_size - BLOCK_SIZE) { 145 /* 146 * Reading past the end of the device. 147 */ 148 retval = ELIMIT; 149 break; 150 } 142 151 futex_down(&rd_futex); 143 memcpy( (void *)fs_va, rd_addr + offset, BLOCK_SIZE);152 memcpy(fs_va, rd_addr + offset, BLOCK_SIZE); 144 153 futex_up(&rd_futex); 145 154 retval = EOK; … … 147 156 case RD_WRITE_BLOCK: 148 157 offset = IPC_GET_ARG1(call); 158 if (offset * BLOCK_SIZE > rd_size - BLOCK_SIZE) { 159 /* 160 * Writing past the end of the device. 161 */ 162 retval = ELIMIT; 163 break; 164 } 149 165 futex_up(&rd_futex); 150 memcpy(rd_addr + offset, (void *)fs_va, BLOCK_SIZE);166 memcpy(rd_addr + offset, fs_va, BLOCK_SIZE); 151 167 futex_down(&rd_futex); 152 168 retval = EOK; … … 171 187 int retval, flags; 172 188 173 size_trd_size = sysinfo_value("rd.size");189 rd_size = sysinfo_value("rd.size"); 174 190 void *rd_ph_addr = (void *) sysinfo_value("rd.address.physical"); 175 191
Note:
See TracChangeset
for help on using the changeset viewer.