Exemplo n.º 1
0
/*
 * Write bytes to kernel address space for debugger.
 */
void
db_write_bytes(db_addr_t addr, size_t size, const char *data)
{
	char *dst = (char *)addr;
	extern char kernel_text[], etext[];

	/* If any part is in kernel text, use db_write_text() */
	if (dst + size > kernel_text && dst < etext) {
		db_write_text(addr, size, data);
		return;
	}

	if (size == 4) {
		*((uint32_t *)dst) = *((const uint32_t *)data);
		return;
	}

	if (size == 2) {
		*((uint16_t *)dst) = *((const uint16_t *)data);
		return;
	}

	while (size-- > 0) {
		*dst++ = *data++;
	}
}
Exemplo n.º 2
0
/*
 * Write bytes to kernel address space for debugger.
 */
void
db_write_bytes(vaddr_t addr, size_t size, const char *data)
{
	extern char __data_start;
	char *dst;

	dst = (char *)addr;

	/* If any part is in kernel text, use db_write_text() */
	if (addr >= KERNBASE && addr < (vaddr_t)&__data_start) {
		db_write_text(addr, size, data);
		return;
	}

	dst = (char *)addr;

	if (size == 8) {
		*((long *)dst) = *((const long *)data);
		return;
	}

	if (size == 4) {
		*((int *)dst) = *((const int *)data);
		return;
	}

	if (size == 2) {
		*((short *)dst) = *((const short *)data);
		return;
	}

	while (size-- > 0)
		*dst++ = *data++;
}
Exemplo n.º 3
0
/*
 * Write bytes to kernel address space for debugger.
 */
void
db_write_bytes(vaddr_t addr, size_t size, char *data)
{
    char	*dst;
    extern char	etext;

    if (addr >= VM_MIN_KERNEL_ADDRESS &&
            addr < (vaddr_t)&etext) {
        db_write_text(addr, size, data);
        return;
    }

    dst = (char *)addr;

    while (size-- > 0)
        *dst++ = *data++;
}