1
0
Fork 0

Fix alignment when writing to the cache

This commit is contained in:
krcroft 2020-04-11 13:38:16 -07:00 committed by Patryk Obara
parent 32692cc50e
commit 0d004f4c60
2 changed files with 21 additions and 19 deletions

View file

@ -487,19 +487,22 @@ static INLINE void cache_addb(Bit8u val) {
*cache.pos++=val;
}
static INLINE void cache_addw(Bit16u val) {
*(Bit16u*)cache.pos=val;
cache.pos+=2;
static INLINE void cache_addw(const uint16_t val)
{
host_writew(cache.pos, val);
cache.pos += sizeof(val);
}
static INLINE void cache_addd(Bit32u val) {
*(Bit32u*)cache.pos=val;
cache.pos+=4;
static INLINE void cache_addd(const uint32_t val)
{
host_writed(cache.pos, val);
cache.pos += sizeof(val);
}
static INLINE void cache_addq(Bit64u val) {
*(Bit64u*)cache.pos=val;
cache.pos+=8;
static INLINE void cache_addq(const uint64_t val)
{
host_writeq(cache.pos, val);
cache.pos += sizeof(val);
}
static void gen_return(BlockReturn retcode);

View file

@ -533,24 +533,23 @@ static INLINE void cache_addb(Bit8u val) {
}
// place a 16bit value into the cache
static INLINE void cache_addw(Bit16u val) {
*(Bit16u*)cache.pos=val;
cache.pos+=2;
static INLINE void cache_addw(const uint16_t val) {
host_writew(cache.pos, val);
cache.pos += sizeof(val);
}
// place a 32bit value into the cache
static INLINE void cache_addd(Bit32u val) {
*(Bit32u*)cache.pos=val;
cache.pos+=4;
static INLINE void cache_addd(const uint32_t val) {
host_writed(cache.pos, val);
cache.pos += sizeof(val);
}
// place a 64bit value into the cache
static INLINE void cache_addq(Bit64u val) {
*(Bit64u*)cache.pos=val;
cache.pos+=8;
static INLINE void cache_addq(const uint64_t val) {
host_writeq(cache.pos, val);
cache.pos += sizeof(val);
}
static void dyn_return(BlockReturn retcode,bool ret_exception);
static void dyn_run_code(void);