a5bd9f6
From 38ce1e9087067fa3fbb132d943b35d3a995408a5 Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Sun, 10 Mar 2013 18:36:39 +0100
a5bd9f6
Subject: [PATCH 202/364] 	Adjust types in gdb module to have intended
a5bd9f6
 unsigned shifts rather than 	signed divisions.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                   | 5 +++++
a5bd9f6
 grub-core/gdb/cstub.c       | 4 ++--
a5bd9f6
 grub-core/gdb/i386/signal.c | 2 +-
a5bd9f6
 include/grub/gdb.h          | 2 +-
a5bd9f6
 4 files changed, 9 insertions(+), 4 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 931ae8e..51bc363 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,10 @@
a5bd9f6
 2013-03-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	Adjust types in gdb module to have intended unsigned shifts rather than
a5bd9f6
+	signed divisions.
a5bd9f6
+
a5bd9f6
+2013-03-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	* grub-core/fs/hfs.c (grub_hfs_read_file): Avoid divmod64 since the
a5bd9f6
 	maximum size is 4G - 1 on hfs
a5bd9f6
 
a5bd9f6
diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c
a5bd9f6
index a5c0c43..3c89c19 100644
a5bd9f6
--- a/grub-core/gdb/cstub.c
a5bd9f6
+++ b/grub-core/gdb/cstub.c
a5bd9f6
@@ -204,7 +204,7 @@ grub_gdb_hex2int (char **ptr, grub_uint64_t *int_value)
a5bd9f6
 void
a5bd9f6
 grub_gdb_trap (int trap_no)
a5bd9f6
 {
a5bd9f6
-  int sig_no;
a5bd9f6
+  unsigned int sig_no;
a5bd9f6
   int stepping;
a5bd9f6
   grub_uint64_t addr;
a5bd9f6
   grub_uint64_t length;
a5bd9f6
@@ -264,7 +264,7 @@ grub_gdb_trap (int trap_no)
a5bd9f6
 	case '?':
a5bd9f6
 	  grub_gdb_outbuf[0] = 'S';
a5bd9f6
 	  grub_gdb_outbuf[1] = hexchars[sig_no >> 4];
a5bd9f6
-	  grub_gdb_outbuf[2] = hexchars[sig_no % 16];
a5bd9f6
+	  grub_gdb_outbuf[2] = hexchars[sig_no & 0xf];
a5bd9f6
 	  grub_gdb_outbuf[3] = 0;
a5bd9f6
 	  break;
a5bd9f6
 
a5bd9f6
diff --git a/grub-core/gdb/i386/signal.c b/grub-core/gdb/i386/signal.c
a5bd9f6
index 23b7c35..1ac3bbd 100644
a5bd9f6
--- a/grub-core/gdb/i386/signal.c
a5bd9f6
+++ b/grub-core/gdb/i386/signal.c
a5bd9f6
@@ -24,7 +24,7 @@
a5bd9f6
 
a5bd9f6
 /* Converting CPU trap number to UNIX signal number as
a5bd9f6
    described in System V ABI i386 Processor Supplement, 3-25.  */
a5bd9f6
-int
a5bd9f6
+unsigned int
a5bd9f6
 grub_gdb_trap2sig (int trap_no)
a5bd9f6
 {
a5bd9f6
   const int signals[] = {
a5bd9f6
diff --git a/include/grub/gdb.h b/include/grub/gdb.h
a5bd9f6
index 59fd456..e73d135 100644
a5bd9f6
--- a/include/grub/gdb.h
a5bd9f6
+++ b/include/grub/gdb.h
a5bd9f6
@@ -33,7 +33,7 @@ struct grub_serial_port;
a5bd9f6
 extern struct grub_serial_port *grub_gdb_port;
a5bd9f6
 
a5bd9f6
 void grub_gdb_breakpoint (void);
a5bd9f6
-int grub_gdb_trap2sig (int);
a5bd9f6
+unsigned int grub_gdb_trap2sig (int);
a5bd9f6
 
a5bd9f6
 #endif /* ! GRUB_GDB_HEADER */
a5bd9f6
 
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6