MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_write_bytes

Function db_write_bytes

freebsd/mips/mips/db_interface.c:184–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184int
185db_write_bytes(vm_offset_t addr, size_t size, char *data)
186{
187 int ret;
188 jmp_buf jb;
189 void *prev_jb;
190
191 prev_jb = kdb_jmpbuf(jb);
192 ret = setjmp(jb);
193
194 if (ret == 0) {
195 /*
196 * 'addr' could be a memory-mapped I/O address. Try to
197 * do atomic load/store in unit of size requested.
198 * size == 8 is only atomic on 64bit or n32 kernel.
199 */
200 if ((size == 2 || size == 4 || size == 8) &&
201 ((addr & (size -1)) == 0) &&
202 (((vm_offset_t)data & (size -1)) == 0)) {
203 switch (size) {
204 case 2:
205 *(uint16_t *)addr = *(uint16_t *)data;
206 break;
207 case 4:
208 *(uint32_t *)addr = *(uint32_t *)data;
209 break;
210 case 8:
211 *(uint64_t *)addr = *(uint64_t *)data;
212 break;
213 }
214 } else {
215 char *dst;
216 size_t len = size;
217
218 dst = (char *)addr;
219 while (len-- > 0)
220 *dst++ = *data++;
221 }
222
223 mips_icache_sync_range((db_addr_t) addr, size);
224 mips_dcache_wbinv_range((db_addr_t) addr, size);
225 }
226 (void)kdb_jmpbuf(prev_jb);
227 return (ret);
228}
229
230/*
231 * To do a single step ddb needs to know the next address

Callers

nothing calls this directly

Calls 2

kdb_jmpbufFunction · 0.85
setjmpFunction · 0.85

Tested by

no test coverage detected