diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-07-06 23:09:26 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-07-06 23:09:26 +0000 |
commit | 9304bb58c096915708de51c647c64a387c5e1338 (patch) | |
tree | 61b7b7811c33b48bc43fd41bdd315ccc8a82b1ab /sys | |
parent | 9ec92f3d98a4f9f781f84d2c7f911c9934f925b0 (diff) |
64 bit fixes
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ddb/db_access.c | 26 | ||||
-rw-r--r-- | sys/ddb/db_examine.c | 37 | ||||
-rw-r--r-- | sys/ddb/db_print.c | 7 | ||||
-rw-r--r-- | sys/ddb/db_sym.c | 10 |
4 files changed, 39 insertions, 41 deletions
diff --git a/sys/ddb/db_access.c b/sys/ddb/db_access.c index 58e67cbdb8d..23ab6e17ec2 100644 --- a/sys/ddb/db_access.c +++ b/sys/ddb/db_access.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_access.c,v 1.5 1996/04/21 22:18:53 deraadt Exp $ */ +/* $OpenBSD: db_access.c,v 1.6 1997/07/06 23:09:23 niklas Exp $ */ /* $NetBSD: db_access.c,v 1.8 1994/10/09 08:37:35 mycroft Exp $ */ /* @@ -42,28 +42,20 @@ * Access unaligned data items on aligned (longword) * boundaries. */ - -int db_extend[] = { /* table for sign-extending */ - 0, - (int)0xFFFFFF80, - (int)0xFFFF8000, - (int)0xFF800000, - (int)0x80000000 -}; - db_expr_t db_get_value(addr, size, is_signed) db_addr_t addr; - register size_t size; + size_t size; boolean_t is_signed; { - char data[sizeof(int)]; - register db_expr_t value; - register int i; + char data[sizeof(db_expr_t)]; + db_expr_t value, extend; + int i; db_read_bytes(addr, size, data); value = 0; + extend = (~(db_expr_t)0) << (size * 8 - 1); #if BYTE_ORDER == LITTLE_ENDIAN for (i = size - 1; i >= 0; i--) #else /* BYTE_ORDER == BIG_ENDIAN */ @@ -71,8 +63,8 @@ db_get_value(addr, size, is_signed) #endif /* BYTE_ORDER */ value = (value << 8) + (data[i] & 0xFF); - if (size < 4 && is_signed && (value & db_extend[size]) != 0) - value |= db_extend[size]; + if (size < sizeof(db_expr_t) && is_signed && (value & extend)) + value |= extend; return (value); } @@ -82,7 +74,7 @@ db_put_value(addr, size, value) register size_t size; register db_expr_t value; { - char data[sizeof(int)]; + char data[sizeof(db_expr_t)]; register int i; #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c index 539686d7e43..825a8cdadba 100644 --- a/sys/ddb/db_examine.c +++ b/sys/ddb/db_examine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_examine.c,v 1.5 1996/08/04 01:27:45 niklas Exp $ */ +/* $OpenBSD: db_examine.c,v 1.6 1997/07/06 23:09:24 niklas Exp $ */ /* $NetBSD: db_examine.c,v 1.11 1996/03/30 22:30:07 christos Exp $ */ /* @@ -47,7 +47,7 @@ char db_examine_format[TOK_STRING_SIZE] = "x"; /* * Examine (print) data. Syntax is: - * x/[bhl][cdiorsuxz]* + * x/[bhlq][cdiorsuxz]* * For example, the command: * x/bxxxx * should print: @@ -72,8 +72,7 @@ db_examine_cmd(addr, have_addr, count, modif) void db_examine(addr, fmt, count) - register - db_addr_t addr; + db_addr_t addr; char * fmt; /* format string */ int count; /* repeat count */ { @@ -107,38 +106,42 @@ db_examine(addr, fmt, count) size = 4; width = 12; break; + case 'q': /* quad-word */ + size = 8; + width = 20; + break; case 'a': /* address */ - db_printf("= 0x%lx\n", addr); + db_printf("= 0x%lx\n", (long)addr); break; case 'r': /* signed, current radix */ value = db_get_value(addr, size, TRUE); addr += size; - db_printf("%-*r", width, value); + db_printf("%-*lr", width, (long)value); break; case 'x': /* unsigned hex */ value = db_get_value(addr, size, FALSE); addr += size; - db_printf("%-*x", width, value); + db_printf("%-*lx", width, (long)value); break; case 'z': /* signed hex */ value = db_get_value(addr, size, TRUE); addr += size; - db_printf("%-*z", width, value); + db_printf("%-*lz", width, (long)value); break; case 'd': /* signed decimal */ value = db_get_value(addr, size, TRUE); addr += size; - db_printf("%-*d", width, value); + db_printf("%-*ld", width, (long)value); break; case 'u': /* unsigned decimal */ value = db_get_value(addr, size, FALSE); addr += size; - db_printf("%-*u", width, value); + db_printf("%-*lu", width, (long)value); break; case 'o': /* unsigned octal */ value = db_get_value(addr, size, FALSE); addr += size; - db_printf("%-*o", width, value); + db_printf("%-*lo", width, value); break; case 'c': /* character */ value = db_get_value(addr, 1, FALSE); @@ -199,22 +202,22 @@ db_print_cmd(addr, have_addr, count, modif) db_printsym((db_addr_t)addr, DB_STGY_ANY); break; case 'r': - db_printf("%11r", addr); + db_printf("%*r", sizeof(db_expr_t) * 2 * 6 / 5, addr); break; case 'x': - db_printf("%8x", addr); + db_printf("%*x", sizeof(db_expr_t) * 2, addr); break; case 'z': - db_printf("%8z", addr); + db_printf("%*z", sizeof(db_expr_t) * 2, addr); break; case 'd': - db_printf("%11d", addr); + db_printf("%*d", sizeof(db_expr_t) * 2 * 6 / 5, addr); break; case 'u': - db_printf("%11u", addr); + db_printf("%*u", sizeof(db_expr_t) * 2 * 6 / 5, addr); break; case 'o': - db_printf("%16o", addr); + db_printf("%*o", sizeof(db_expr_t) * 2 * 4 / 3, addr); break; case 'c': value = addr & 0xFF; diff --git a/sys/ddb/db_print.c b/sys/ddb/db_print.c index 0e55e096f7d..e2e6c17dd1a 100644 --- a/sys/ddb/db_print.c +++ b/sys/ddb/db_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_print.c,v 1.4 1996/04/21 22:19:08 deraadt Exp $ */ +/* $OpenBSD: db_print.c,v 1.5 1997/07/06 23:09:24 niklas Exp $ */ /* $NetBSD: db_print.c,v 1.5 1996/02/05 01:57:11 christos Exp $ */ /* @@ -60,12 +60,13 @@ db_show_regs(addr, have_addr, count, modif) for (regp = db_regs; regp < db_eregs; regp++) { db_read_variable(regp, &value); - db_printf("%-12s%#10n", regp->name, value); + db_printf("%-12s%#*ln", regp->name, sizeof(db_expr_t) * 2 * 6 / 5, + (long)value); db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset); if (name != 0 && offset <= db_maxoff && offset != value) { db_printf("\t%s", name); if (offset != 0) - db_printf("+%#r", offset); + db_printf("+%#lr", (long)offset); } db_printf("\n"); } diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index d39bd76ea14..a52e70d7c8b 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_sym.c,v 1.19 1997/05/29 03:28:44 mickey Exp $ */ +/* $OpenBSD: db_sym.c,v 1.20 1997/07/06 23:09:25 niklas Exp $ */ /* $NetBSD: db_sym.c,v 1.12 1996/02/05 01:57:15 christos Exp $ */ /* @@ -363,13 +363,15 @@ db_printsym(off, strategy) if (d) db_printf("+%#r", d); if (strategy == DB_STGY_PROC) { - if (db_line_at_pc(cursym, &filename, &linenum, off)) - db_printf(" [%s:%d]", filename, linenum); + if (db_line_at_pc(cursym, &filename, &linenum, + off)) + db_printf(" [%s:%d]", filename, + linenum); } return; } } - db_printf("%#n", off); + db_printf("%#ln", off); return; } |