diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-06-23 22:17:47 +0545 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-01-02 20:55:21 -0500 |
commit | 0ede24f2c46d2b888f5e19418e577f3c1110f6a5 (patch) | |
tree | fa410e70e724d2dc61347f24e137b9aecbcc6efb /sim/common | |
parent | 3b47e132c439a5ac477bc07fab06edaa45fa0533 (diff) | |
download | gdb-0ede24f2c46d2b888f5e19418e577f3c1110f6a5.zip gdb-0ede24f2c46d2b888f5e19418e577f3c1110f6a5.tar.gz gdb-0ede24f2c46d2b888f5e19418e577f3c1110f6a5.tar.bz2 |
sim: common: add align_{up,down} to match gdb
We have ALIGN_{8,16,PAGE} and FLOOR_PAGE macros (where PAGE is defined as
4k) which were imported from the ppc sim. But no other sim utilizes these
and hardcoding the sizes in the name is a bit limiting.
Let's delete these and import the two general macros that gdb uses:
align_up(addr, bytes)
align_down(addr, bytes)
This in turn allows us to cut over the Blackfin code immediately.
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/ChangeLog | 6 | ||||
-rw-r--r-- | sim/common/sim-bits.h | 17 |
2 files changed, 10 insertions, 13 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 2c71b13..0545493 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,9 @@ +2021-01-02 Mike Frysinger <vapier@gentoo.org> + + * sim-bits.h (_ALIGNa, _FLOORa, ALIGN_8, ALIGN_16, ALIGN_PAGE, + FLOOR_PAGE): Delete unused macros. + (align_up, align_down): Define. + 2020-08-10 Tom de Vries <tdevries@suse.de> * sim-cpu.c: Include stdlib.h for free. diff --git a/sim/common/sim-bits.h b/sim/common/sim-bits.h index f02dd8c..f8c2563 100644 --- a/sim/common/sim-bits.h +++ b/sim/common/sim-bits.h @@ -92,11 +92,8 @@ EXTEND*(VALUE): Convert the `*' bit value to the targets natural word size. Sign extend the value if needed. - ALIGN_*(VALUE): Round the value upwards so that it is aligned to a - `_*' byte boundary. - - FLOOR_*(VALUE): Truncate the value so that it is aligned to a `_*' - byte boundary. + align_*(VALUE, BYTES): Round the value so that it is aligned to a + BYTES boundary. ROT*(VALUE, NR_BITS): Return the `*' bit VALUE rotated by NR_BITS right (positive) or left (negative). @@ -525,14 +522,8 @@ INLINE_SIM_BITS(unsigned_word) MSINSERTED (unsigned_word val, int start, int sto /* memory alignment macro's */ -#define _ALIGNa(A,X) (((X) + ((A) - 1)) & ~((A) - 1)) -#define _FLOORa(A,X) ((X) & ~((A) - 1)) - -#define ALIGN_8(X) _ALIGNa (8, X) -#define ALIGN_16(X) _ALIGNa (16, X) - -#define ALIGN_PAGE(X) _ALIGNa (0x1000, X) -#define FLOOR_PAGE(X) ((X) & ~(0x1000 - 1)) +#define align_up(v, n) (((v) + (n) - 1) & -(n)) +#define align_down(v, n) ((v) & -(n)) /* bit bliting macro's */ |