summaryrefslogtreecommitdiff
path: root/sys/ddb/db_write_cmd.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-05-30 20:58:50 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-05-30 20:58:50 +0000
commit78ea362728c4672cea84d6875e3aa41c25a5a361 (patch)
tree9feaf72d0bb7dfc3e1c24ba5b2de6fef7874d7d7 /sys/ddb/db_write_cmd.c
parent1c726ef63fd4be85dc4f48e37dc99420a2fa3722 (diff)
Allow 8 byte writes from ddb (w/q) on 64 bit platforms, just like we allow
8 byte reads (x/q) already.
Diffstat (limited to 'sys/ddb/db_write_cmd.c')
-rw-r--r--sys/ddb/db_write_cmd.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/sys/ddb/db_write_cmd.c b/sys/ddb/db_write_cmd.c
index 1ace001b670..9567548ddf0 100644
--- a/sys/ddb/db_write_cmd.c
+++ b/sys/ddb/db_write_cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_write_cmd.c,v 1.10 2007/11/05 19:23:24 miod Exp $ */
+/* $OpenBSD: db_write_cmd.c,v 1.11 2009/05/30 20:58:49 miod Exp $ */
/* $NetBSD: db_write_cmd.c,v 1.6 1996/02/05 01:57:25 christos Exp $ */
/*
@@ -62,38 +62,43 @@ db_write_cmd(db_expr_t address, boolean_t have_addr, db_expr_t count,
addr = (db_addr_t) address;
switch (modif[0]) {
- case 'b':
+ case 'b':
size = 1;
break;
- case 'h':
+ case 'h':
size = 2;
break;
- case 'l':
- case '\0':
+ case 'l':
+ case '\0':
size = 4;
break;
- default:
+#ifdef __LP64__
+ case 'q':
+ size = 8;
+ break;
+#endif
+ default:
size = -1;
db_error("Unknown size\n");
/*NOTREACHED*/
}
while (db_expression(&new_value)) {
- old_value = db_get_value(addr, size, FALSE);
- db_printsym(addr, DB_STGY_ANY, db_printf);
- db_printf("\t\t%s\t", db_format(tmpfmt, sizeof tmpfmt,
- old_value, DB_FORMAT_N, 0, 8));
- db_printf("=\t%s\n", db_format(tmpfmt, sizeof tmpfmt,
- new_value, DB_FORMAT_N, 0, 8));
- db_put_value(addr, size, new_value);
- addr += size;
+ old_value = db_get_value(addr, size, FALSE);
+ db_printsym(addr, DB_STGY_ANY, db_printf);
+ db_printf("\t\t%s\t", db_format(tmpfmt, sizeof tmpfmt,
+ old_value, DB_FORMAT_N, 0, 8));
+ db_printf("=\t%s\n", db_format(tmpfmt, sizeof tmpfmt,
+ new_value, DB_FORMAT_N, 0, 8));
+ db_put_value(addr, size, new_value);
+ addr += size;
- wrote_one = TRUE;
+ wrote_one = TRUE;
}
if (!wrote_one) {
- db_error("Nothing written.\n");
- /*NOTREACHED*/
+ db_error("Nothing written.\n");
+ /*NOTREACHED*/
}
db_next = addr;
@@ -101,4 +106,3 @@ db_write_cmd(db_expr_t address, boolean_t have_addr, db_expr_t count,
db_skip_to_eol();
}
-