2 * (C) Copyright 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
11 /* charset conversions */
12 extern u8 ascii2ebcdic_table
[256];
13 extern u8 ebcdic2ascii_table
[256];
15 /* ASCII transforms */
16 extern u8 ascii2upper_table
[256];
19 * Generic translate buffer function.
21 static inline void __translate(u8
*buf
, int len
, const u8
*table
)
24 " sgr %%r0,%%r0\n" /* test byte = 0 */
25 " la %%r2,0(%0)\n" /* buffer */
26 " lgr %%r3,%2\n" /* length */
27 " la %%r4,0(%1)\n" /* table */
36 "cc", "r0", "r2", "r3", "r4"
40 #define ascii2ebcdic(buf, len) \
41 __translate((buf), (len), ascii2ebcdic_table)
42 #define ebcdic2ascii(buf, len) \
43 __translate((buf), (len), ebcdic2ascii_table)
45 #define ascii2upper(buf, len) \
46 __translate((buf), (len), ascii2upper_table)