SAA: add saa_writeaddr() similar to other locations
Provide saa_writeaddr() to write an integer in x86 format. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
9a1f9f5ab6
commit
edb58f7813
2 changed files with 22 additions and 0 deletions
21
saa.c
21
saa.c
|
@ -287,6 +287,11 @@ void saa_write64(struct SAA *s, uint64_t v)
|
|||
saa_wbytes(s, &v, 8);
|
||||
}
|
||||
|
||||
void saa_writeaddr(struct SAA *s, uint64_t v, size_t len)
|
||||
{
|
||||
saa_wbytes(s, &v, len);
|
||||
}
|
||||
|
||||
#else /* not WORDS_LITTLEENDIAN */
|
||||
|
||||
void saa_write16(struct SAA *s, uint16_t v)
|
||||
|
@ -324,6 +329,22 @@ void saa_write64(struct SAA *s, uint64_t v)
|
|||
saa_wbytes(s, b, 8);
|
||||
}
|
||||
|
||||
void saa_writeaddr(struct SAA *s, uint64_t v, size_t len)
|
||||
{
|
||||
uint8_t b[8];
|
||||
|
||||
b[0] = v;
|
||||
b[1] = v >> 8;
|
||||
b[2] = v >> 16;
|
||||
b[3] = v >> 24;
|
||||
b[4] = v >> 32;
|
||||
b[5] = v >> 40;
|
||||
b[6] = v >> 48;
|
||||
b[7] = v >> 56;
|
||||
|
||||
saa_wbytes(s, &v, len);
|
||||
}
|
||||
|
||||
#endif /* WORDS_LITTLEENDIAN */
|
||||
|
||||
/* write unsigned LEB128 value to SAA */
|
||||
|
|
1
saa.h
1
saa.h
|
@ -55,5 +55,6 @@ void saa_write32(struct SAA *s, uint32_t v);
|
|||
void saa_write64(struct SAA *s, uint64_t v);
|
||||
void saa_wleb128u(struct SAA *, int); /* write unsigned LEB128 value */
|
||||
void saa_wleb128s(struct SAA *, int); /* write signed LEB128 value */
|
||||
void saa_writeaddr(struct SAA *, uint64_t, size_t);
|
||||
|
||||
#endif /* NASM_SAA_H */
|
||||
|
|
Loading…
Reference in a new issue