File alsa-emu.diff of Package ia32el

--- ia32toia64/ia32_ioctl.c
+++ ia32toia64/ia32_ioctl.c
@@ -1425,8 +1425,298 @@ static long atm_iobuf_ioctl32(int fd, un
 
 #endif
 
+static long sndrv_pcm_ioctl_hw_params_ioctl32(int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_pcm_hw_params32 sphp32;
+	struct snd_pcm_hw_params sphp64;
+	long ret;
+
+	if (g_safe_memcpy (&sphp32, I2P(arg), sizeof (struct snd_pcm_hw_params32)) < 0) {
+                return -EFAULT;
+        }
+
+	sphp64.flags = sphp32.flags;
+	bt_memcpy(&sphp64.masks, sphp32.masks, sizeof(sphp32.masks));
+	bt_memcpy(&sphp64.mres, sphp32.mres, sizeof(sphp32.mres));
+	bt_memcpy(&sphp64.intervals, sphp32.intervals, sizeof(sphp32.intervals));
+	bt_memcpy(&sphp64.ires, sphp32.ires, sizeof(sphp32.ires));
+	sphp64.rmask = sphp32.rmask;
+	sphp64.cmask = sphp32.cmask;
+	sphp64.info = sphp32.info;
+	sphp64.msbits = sphp32.msbits;
+	sphp64.rate_num = sphp32.rate_num;
+	sphp64.rate_den = sphp32.rate_den;
+	sphp64.fifo_size = sphp32.fifo_size;
+	
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &sphp64);
+
+	if (ret == 0) {
+		sphp64.flags = sphp32.flags;
+		bt_memcpy(&sphp32.masks, sphp64.masks, sizeof(sphp32.masks));
+		bt_memcpy(&sphp32.mres, sphp64.mres, sizeof(sphp32.mres));
+		bt_memcpy(&sphp32.intervals, sphp64.intervals, sizeof(sphp32.intervals));
+		bt_memcpy(&sphp32.ires, sphp64.ires, sizeof(sphp32.ires));
+		sphp32.rmask = sphp64.rmask;
+		sphp32.cmask = sphp64.cmask;
+		sphp32.info = sphp64.info;
+		sphp32.msbits = sphp64.msbits;
+		sphp32.rate_num = sphp64.rate_num;
+		sphp32.rate_den = sphp64.rate_den;
+		sphp32.fifo_size = sphp64.fifo_size;
+
+		if (g_safe_memcpy(I2P(arg), &sphp32, sizeof (struct snd_pcm_hw_params32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
+
+static long sndrv_pcm_ioctl_sw_params_ioctl32(int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_pcm_sw_params32 spsp32;
+	struct snd_pcm_sw_params spsp64;
+	long ret;
+	unsigned long boundary;
+
+	if (g_safe_memcpy (&spsp32, I2P(arg), sizeof (struct snd_pcm_sw_params32)) < 0) {
+                return -EFAULT;
+        }
+
+	bt_memset(&spsp64, 0, sizeof(spsp64));
+	spsp64.tstamp_mode = spsp32.tstamp_mode;
+	spsp64.period_step = spsp32.period_step;
+	spsp64.sleep_min = spsp32.sleep_min;
+	spsp64.avail_min = spsp32.avail_min;
+	spsp64.xfer_align = spsp32.xfer_align;
+	spsp64.start_threshold = spsp32.start_threshold;
+	spsp64.stop_threshold = spsp32.stop_threshold;
+	spsp64.silence_threshold = spsp32.silence_threshold;
+	spsp64.silence_size = spsp32.silence_size;
+
+	if (spsp32.xfer_align == 0)
+		boundary = 0;
+	else {
+		boundary = spsp32.xfer_align;
+		while (boundary * 2 <= 0x7fffffff - spsp32.xfer_align)
+			boundary *= 2;
+	}
+	if (boundary && spsp32.silence_size >= boundary)
+		spsp64.silence_size = boundary << 32;
+	if (boundary && spsp32.stop_threshold >= boundary)
+		spsp64.stop_threshold = boundary << 32;
+
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &spsp64);
+
+	if (ret == 0) {
+		//spsp32.boundary = spsp64.boundary;
+		spsp32.boundary = boundary;
+
+		if (g_safe_memcpy(I2P(arg), &spsp32, sizeof (struct snd_pcm_sw_params32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
+
+static long sndrv_pcm_ioctl_status_ioctl32(int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_pcm_status32 sps32;
+	struct snd_pcm_status sps64;
+	long ret;
+
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &sps64);
+
+	if (ret == 0) {
+		sps32.state = sps64.state;
+		sps32.trigger_tstamp.tv_sec = sps64.trigger_tstamp.tv_sec;
+		sps32.trigger_tstamp.tv_nsec = sps64.trigger_tstamp.tv_nsec;
+		sps32.tstamp.tv_sec = sps64.tstamp.tv_sec;
+		sps32.tstamp.tv_nsec = sps64.tstamp.tv_nsec;
+		sps32.appl_ptr = sps64.appl_ptr;
+		sps32.hw_ptr = sps64.hw_ptr;
+		sps32.delay = sps64.delay;
+		sps32.avail = sps64.avail;
+		sps32.avail_max = sps64.avail_max;
+		sps32.overrange = sps64.overrange;
+		sps32.suspended_state = sps64.suspended_state;
+
+		if (g_safe_memcpy(I2P(arg), &sps32, sizeof (struct snd_pcm_status32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
+
+static long sndrv_pcm_ioctl_sync_ptr_ioctl32(int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_pcm_sync_ptr32 spsp32;
+	struct snd_pcm_sync_ptr spsp64;
+	long ret;
+
+	if (g_safe_memcpy (&spsp32, I2P(arg), sizeof (struct snd_pcm_sync_ptr32)) < 0) {
+                return -EFAULT;
+        }
+
+	spsp64.flags = spsp32.flags;
+	spsp64.c.control.appl_ptr = spsp32.c.control.appl_ptr;
+	spsp64.c.control.avail_min = spsp32.c.control.avail_min;
+
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &spsp64);
+
+	if (ret == 0) {
+		spsp32.s.status.state = spsp64.s.status.state;
+		spsp32.s.status.hw_ptr = spsp64.s.status.hw_ptr;
+		spsp32.s.status.tstamp.tv_sec = spsp64.s.status.tstamp.tv_sec;
+		spsp32.s.status.tstamp.tv_nsec = spsp64.s.status.tstamp.tv_nsec;
+		spsp32.s.status.suspended_state = spsp64.s.status.suspended_state;
+		spsp32.c.control.appl_ptr = spsp64.c.control.appl_ptr;
+		spsp32.c.control.avail_min = spsp64.c.control.avail_min;
+
+		if (g_safe_memcpy(I2P(arg), &spsp32, sizeof (struct snd_pcm_sync_ptr32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
+
+static long sndrv_pcm_ioctl_channel_info_ioctl32(int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_pcm_channel_info32 spci32;
+	struct snd_pcm_channel_info spci64;
+	long ret;
 
+	if (g_safe_memcpy (&spci32, I2P(arg), sizeof (struct snd_pcm_channel_info32)) < 0) {
+                return -EFAULT;
+        }
 
+	spci64.channel = spci32.channel;
+	spci64.offset = spci32.offset;
+	spci64.first = spci32.first;
+	spci64.step = spci32.step;
+
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &spci64);
+
+	if (ret == 0) {
+		spci32.channel = spci64.channel;
+		spci32.offset = spci64.offset;
+		spci32.first = spci64.first;
+		spci32.step = spci64.step;
+
+		if (g_safe_memcpy(I2P(arg), &spci32, sizeof (struct snd_pcm_channel_info32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
+
+static long sndrv_pcm_ioctl_xferi_ioctl32 (int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_xferi32 sx32;
+	struct snd_xferi sx64;
+	long ret;
+
+	if (g_safe_memcpy (&sx32, I2P(arg), sizeof (struct snd_xferi32)) < 0) {
+		return -EFAULT;
+	}
+
+	sx64.buf = I2P(sx32.buf);
+	sx64.frames = sx32.frames;
+
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &sx64);
+
+	if (ret == 0) {
+		sx32.result = sx64.result;
+
+		if (g_safe_memcpy (I2P(arg), &sx32, sizeof (struct snd_xferi32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
+
+static long sndrv_ctl_ioctl_elem_list_ioctl32(int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_ctl_elem_list32 scel32;
+	struct snd_ctl_elem_list scel64;
+	long ret;
+
+	if (g_safe_memcpy (&scel32, I2P(arg), sizeof (struct snd_ctl_elem_list32)) < 0) {
+		return -EFAULT;
+	}
+
+	scel64.offset = scel32.offset;
+	scel64.space = scel32.space;
+	scel64.used = scel32.used;
+	scel64.count = scel32.count;
+	scel64.pids = I2P(scel32.pids);
+
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &scel64);
+
+	if (ret == 0) {
+		scel32.offset = scel64.offset;
+		scel32.space = scel64.space;
+		scel32.used = scel64.used;
+		scel32.count = scel64.count;
+
+		if (g_safe_memcpy(I2P(arg), &scel32, sizeof (struct snd_ctl_elem_list32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
+
+static long sndrv_ctl_ioctl_elem_info_ioctl32 (int fd, unsigned int cmd, unsigned long arg)
+{
+	struct snd_ctl_elem_info32 scei32;
+	struct snd_ctl_elem_info scei64;
+	long ret;
+
+	if (g_safe_memcpy (&scei32, I2P(arg), sizeof (struct snd_ctl_elem_info32)) < 0) {
+		return -EFAULT;
+	}
+
+	scei64.id = scei32.id;
+	scei64.value.enumerated.item = scei64.value.enumerated.item;
+
+	ret = LONG_SYSCALL3 (ioctl, fd, cmd, &scei64);
+
+	if (ret == 0) {
+		scei32.id = scei64.id;
+		scei32.type = scei64.type;
+		scei32.owner = scei64.owner;
+		switch (scei64.type) {
+		case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
+		case SNDRV_CTL_ELEM_TYPE_INTEGER:
+			scei32.value.integer.min = scei64.value.integer.min;
+			scei32.value.integer.max = scei64.value.integer.max;
+			scei32.value.integer.step = scei64.value.integer.step;
+			break;
+		case SNDRV_CTL_ELEM_TYPE_INTEGER64:
+			scei32.value.integer64.min = scei64.value.integer64.min;
+			scei32.value.integer64.max = scei64.value.integer64.max;
+			scei32.value.integer64.step = scei64.value.integer64.step;
+			break;
+		case SNDRV_CTL_ELEM_TYPE_ENUMERATED:
+			scei32.value.enumerated.items = scei64.value.enumerated.items;
+			scei32.value.enumerated.item = scei64.value.enumerated.item;
+			bt_memcpy(scei32.value.enumerated.name, scei64.value.enumerated.name, sizeof(scei32.value.enumerated.name));
+			break;
+		}
+
+		if (g_safe_memcpy(I2P(arg), &scei32, sizeof (struct snd_ctl_elem_info32)) < 0) {
+			return -EFAULT;
+		}
+	}
+
+	return ret;
+}
 
 long HIDDEN sys32_ioctl (int fd, unsigned int cmd, unsigned long arg)
 {
--- ia32toia64/ia32_ioctl_prototype.h
+++ ia32toia64/ia32_ioctl_prototype.h
@@ -1113,3 +1113,367 @@ static inline unsigned long ioctl_hash_v
 
 #define UNUSED_IOCTL	1
 
+struct snd_interval {
+	unsigned int min, max;
+	unsigned int openmin:1,
+		     openmax:1,
+		     integer:1,
+		     empty:1;
+};
+
+struct snd_mask {
+	unsigned int bits[8];
+};
+
+struct snd_pcm_hw_params {
+	unsigned int flags;
+	struct snd_mask masks[3];
+	struct snd_mask mres[5];
+	struct snd_interval intervals[12];
+	struct snd_interval ires[9];
+	unsigned int rmask;
+	unsigned int cmask;
+	unsigned int info;
+	unsigned int msbits;
+	unsigned int rate_num;
+	unsigned int rate_den;
+	unsigned long fifo_size;
+	unsigned char reserved[64];
+};
+
+struct snd_pcm_sw_params {
+	int tstamp_mode;
+	unsigned int period_step;
+	unsigned int sleep_min;
+	unsigned long avail_min;
+	unsigned long xfer_align;
+	unsigned long start_threshold;
+	unsigned long stop_threshold;
+	unsigned long silence_threshold;
+	unsigned long silence_size;
+	unsigned long boundary;
+	unsigned char reserved[64];
+};
+
+struct snd_pcm_mmap_status {
+	int state;
+	int pad1;
+	unsigned long hw_ptr;
+	struct timespec tstamp;
+	int suspended_state;
+};
+
+struct snd_pcm_mmap_control {
+	unsigned long appl_ptr;
+	unsigned long avail_min;
+};
+
+struct snd_pcm_sync_ptr {
+	unsigned int flags;
+	union {
+		struct snd_pcm_mmap_status status;
+		unsigned char reserved[64];
+	} s;
+	union {
+		struct snd_pcm_mmap_control control;
+		unsigned char reserved[64];
+	} c;
+};
+
+struct snd_pcm_channel_info {
+	unsigned int channel;
+	off_t offset;
+	unsigned int first;
+	unsigned int step;
+};
+
+struct snd_pcm_status {
+	int state;
+	struct timespec trigger_tstamp;
+	struct timespec tstamp;
+	unsigned long appl_ptr;
+	unsigned long hw_ptr;
+	long delay;
+	unsigned long avail;
+	unsigned long avail_max;
+	unsigned long overrange;
+	int suspended_state;
+	unsigned char reserved[60];
+};
+
+struct snd_xferi {
+	long result;
+	void *buf;
+	unsigned long frames;
+};
+
+struct snd_xfern {
+	long result;
+	void **bufs;
+	unsigned long frames;
+};
+
+#define SNDRV_PCM_IOCTL_HW_REFINE	_IOWR('A', 0x10, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_PARAMS	_IOWR('A', 0x11, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_SW_PARAMS	_IOWR('A', 0x13, struct snd_pcm_sw_params)
+#define SNDRV_PCM_IOCTL_STATUS		_IOR('A', 0x20, struct snd_pcm_status)
+#define SNDRV_PCM_IOCTL_DELAY		_IOR('A', 0x21, long)
+#define SNDRV_PCM_IOCTL_SYNC_PTR	_IOWR('A', 0x23, struct snd_pcm_sync_ptr)
+#define SNDRV_PCM_IOCTL_CHANNEL_INFO	_IOR('A', 0x32, struct snd_pcm_channel_info)
+#define SNDRV_PCM_IOCTL_REWIND		_IOW('A', 0x46, unsigned long)
+#define SNDRV_PCM_IOCTL_FORWARD		_IOW('A', 0x49, unsigned long)
+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES	_IOW('A', 0x50, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_READI_FRAMES	_IOR('A', 0x51, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES	_IOW('A', 0x52, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_READN_FRAMES	_IOR('A', 0x53, struct snd_xfern)
+
+struct snd_pcm_hw_params32 {
+	__u32 flags;
+	struct snd_mask masks[3];
+	struct snd_mask mres[5];
+	struct snd_interval intervals[12];
+	struct snd_interval ires[9];
+	__u32 rmask;
+	__u32 cmask;
+	__u32 info;
+	__u32 msbits;
+	__u32 rate_num;
+	__u32 rate_den;
+	__u32 fifo_size;
+	unsigned char reserved[64];
+};
+
+struct snd_pcm_sw_params32 {
+	__s32 tstamp_mode;
+	__u32 period_step;
+	__u32 sleep_min;
+	__u32 avail_min;
+	__u32 xfer_align;
+	__u32 start_threshold;
+	__u32 stop_threshold;
+	__u32 silence_threshold;
+	__u32 silence_size;
+	__u32 boundary;
+	unsigned char reserved[64];
+};
+
+struct snd_pcm_mmap_status32 {
+	__s32 state;
+	__s32 pad1;
+	__u32 hw_ptr;
+	struct timespec32 tstamp;
+	__s32 suspended_state;
+} __attribute__((packed));
+
+struct snd_pcm_mmap_control32 {
+	__u32 appl_ptr;
+	__u32 avail_min;
+};
+
+struct snd_pcm_sync_ptr32 {
+	__u32 flags;
+	union {
+		struct snd_pcm_mmap_status status;
+		unsigned char reserved[64];
+	} s;
+	union {
+		struct snd_pcm_mmap_control control;
+		unsigned char reserved[64];
+	} c;
+} __attribute__((packed));
+
+struct snd_pcm_channel_info32 {
+	__u32 channel;
+	__u32 offset;
+	__u32 first;
+	__u32 step;
+};
+
+struct snd_pcm_status32 {
+	__s32 state;
+	struct timespec32 trigger_tstamp;
+	struct timespec32 tstamp;
+	__u32 appl_ptr;
+	__u32 hw_ptr;
+	__s32 delay;
+	__u32 avail;
+	__u32 avail_max;
+	__u32 overrange;
+	__s32 suspended_state;
+	unsigned char reserved[60];
+} __attribute__((packed));
+
+struct snd_xferi32 {
+	__s32 result;
+	__u32 buf;
+	__u32 frames;
+};
+
+struct snd_xfern32 {
+	__s32 result;
+	__u32 bufs;
+	__u32 frames;
+};
+
+#define SNDRV_PCM_IOCTL_HW_REFINE32	_IOWR('A', 0x10, struct snd_pcm_hw_params32)
+#define SNDRV_PCM_IOCTL_HW_PARAMS32	_IOWR('A', 0x11, struct snd_pcm_hw_params32)
+#define SNDRV_PCM_IOCTL_SW_PARAMS32	_IOWR('A', 0x13, struct snd_pcm_sw_params32)
+#define SNDRV_PCM_IOCTL_STATUS32	_IOR('A', 0x20, struct snd_pcm_status32)
+#define SNDRV_PCM_IOCTL_DELAY32		_IOR('A', 0x21, __s32)
+#define SNDRV_PCM_IOCTL_SYNC_PTR32	_IOWR('A', 0x23, struct snd_pcm_sync_ptr32)
+#define SNDRV_PCM_IOCTL_CHANNEL_INFO32	_IOR('A', 0x32, struct snd_pcm_channel_info32)
+#define SNDRV_PCM_IOCTL_REWIND32	_IOW('A', 0x46, __u32)
+#define SNDRV_PCM_IOCTL_FORWARD32	_IOW('A', 0x49, __u32)
+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES32	_IOW('A', 0x50, struct snd_xferi32)
+#define SNDRV_PCM_IOCTL_READI_FRAMES32	_IOR('A', 0x51, struct snd_xferi32)
+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES32	_IOW('A', 0x52, struct snd_xfern32)
+#define SNDRV_PCM_IOCTL_READN_FRAMES32	_IOR('A', 0x53, struct snd_xfern32)
+
+struct snd_aes_iec958 {
+	unsigned char status[24];
+	unsigned char subcode[147];
+	unsigned char pad;
+	unsigned char dig_subframe[4];
+};
+
+struct snd_ctl_elem_id {
+	unsigned int numid;
+	int iface;
+	unsigned int device;
+	unsigned int subdevice;
+        unsigned char name[44];
+	unsigned int index;
+};
+
+struct snd_ctl_elem_list {
+	unsigned int offset;
+	unsigned int space;
+	unsigned int used;
+	unsigned int count;
+	struct snd_ctl_elem_id *pids;
+	unsigned char reserved[50];
+};
+
+#define	SNDRV_CTL_ELEM_TYPE_BOOLEAN	1
+#define	SNDRV_CTL_ELEM_TYPE_INTEGER	2
+#define	SNDRV_CTL_ELEM_TYPE_ENUMERATED	3
+#define	SNDRV_CTL_ELEM_TYPE_BYTES	3
+#define	SNDRV_CTL_ELEM_TYPE_IEC958	5
+#define	SNDRV_CTL_ELEM_TYPE_INTEGER64	6
+
+struct snd_ctl_elem_info {
+	struct snd_ctl_elem_id id;
+	int type;
+	unsigned int access;
+	unsigned int count;
+	pid_t owner;
+	union {
+		struct {
+			long min;
+			long max;
+			long step;
+		} integer;
+		struct {
+			long long min;
+			long long max;
+			long long step;
+		} integer64;
+		struct {
+			unsigned int items;
+			unsigned int item;
+			char name[64];
+		} enumerated;
+		unsigned char reserved[128];
+	} value;
+	union {
+		unsigned short d[4];
+		unsigned short *d_ptr;
+	} dimen;
+	unsigned char reserved[64-4*sizeof(unsigned short)];
+};
+
+struct snd_ctl_elem_value {
+	struct snd_ctl_elem_id id;
+	unsigned int indirect: 1;
+        union {
+		union {
+			long value[128];
+			long *value_ptr;
+		} integer;
+		union {
+			long long value[64];
+			long long *value_ptr;
+		} integer64;
+		union {
+			unsigned int item[128];
+			unsigned int *item_ptr;
+		} enumerated;
+		union {
+			unsigned char data[512];
+			unsigned char *data_ptr;
+		} bytes;
+		struct snd_aes_iec958 iec958;
+        } value;
+	struct timespec tstamp;
+        unsigned char reserved[128-sizeof(struct timespec)];
+};
+
+#define SNDRV_CTL_IOCTL_ELEM_LIST	_IOWR('U', 0x10, struct snd_ctl_elem_list)
+#define SNDRV_CTL_IOCTL_ELEM_INFO	_IOWR('U', 0x11, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_READ	_IOWR('U', 0x12, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_WRITE	_IOWR('U', 0x13, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_ADD	_IOWR('U', 0x17, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REPLACE	_IOWR('U', 0x18, struct snd_ctl_elem_info)
+
+struct snd_ctl_elem_list32 {
+	__u32 offset;
+	__u32 space;
+	__u32 used;
+	__u32 count;
+	__u32 pids;
+	unsigned char reserved[50];
+};
+
+struct snd_ctl_elem_info32 {
+	struct snd_ctl_elem_id id;
+	__s32 type;
+	__u32 access;
+	__u32 count;
+	__s32 owner;
+	union {
+		struct {
+			__s32 min;
+			__s32 max;
+			__s32 step;
+		} integer;
+		struct {
+			__u64 min;
+			__u64 max;
+			__u64 step;
+		} integer64;
+		struct {
+			__u32 items;
+			__u32 item;
+			char name[64];
+		} enumerated;
+		unsigned char reserved[128];
+	} value;
+	unsigned char reserved[64];
+} __attribute__((packed));
+
+struct snd_ctl_elem_value32 {
+	struct snd_ctl_elem_id id;
+	unsigned int indirect;
+        union {
+		__s32 integer[128];
+		unsigned char data[512];
+        } value;
+        unsigned char reserved[128];
+};
+
+#define SNDRV_CTL_IOCTL_ELEM_LIST32	_IOWR('U', 0x10, struct snd_ctl_elem_list32)
+#define SNDRV_CTL_IOCTL_ELEM_INFO32	_IOWR('U', 0x11, struct snd_ctl_elem_info32)
+#define SNDRV_CTL_IOCTL_ELEM_READ32	_IOWR('U', 0x12, struct snd_ctl_elem_value32)
+#define SNDRV_CTL_IOCTL_ELEM_WRITE32	_IOWR('U', 0x13, struct snd_ctl_elem_value32)
+#define SNDRV_CTL_IOCTL_ELEM_ADD32	_IOWR('U', 0x17, struct snd_ctl_elem_info32)
+#define SNDRV_CTL_IOCTL_ELEM_REPLACE32	_IOWR('U', 0x18, struct snd_ctl_elem_info32)
--- ia32toia64/make_ia32_ioctl_h.c
+++ ia32toia64/make_ia32_ioctl_h.c
@@ -395,7 +395,28 @@ int main(int argc, char ** argv, char **
 	insert_ht(IOCTL_NORMAL(SONET_GETFRAMING, atmif_sioc_ioctl32));
 	insert_ht(IOCTL_NORMAL(SONET_GETFRSENSE, atmif_sioc_ioctl32));
 #endif
-	
+
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_HW_REFINE32, SNDRV_PCM_IOCTL_HW_REFINE, sndrv_pcm_ioctl_hw_params_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_HW_PARAMS32, SNDRV_PCM_IOCTL_HW_PARAMS, sndrv_pcm_ioctl_hw_params_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_SW_PARAMS32, SNDRV_PCM_IOCTL_SW_PARAMS, sndrv_pcm_ioctl_sw_params_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_STATUS32, SNDRV_PCM_IOCTL_STATUS, sndrv_pcm_ioctl_status_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_DELAY32, SNDRV_PCM_IOCTL_DELAY, arg32_to_arg64_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_SYNC_PTR32, SNDRV_PCM_IOCTL_SYNC_PTR, sndrv_pcm_ioctl_sync_ptr_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_CHANNEL_INFO32, SNDRV_PCM_IOCTL_CHANNEL_INFO, sndrv_pcm_ioctl_channel_info_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_REWIND32, SNDRV_PCM_IOCTL_REWIND, arg32_to_arg64_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_FORWARD32, SNDRV_PCM_IOCTL_FORWARD, arg32_to_arg64_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_WRITEI_FRAMES32, SNDRV_PCM_IOCTL_WRITEI_FRAMES, sndrv_pcm_ioctl_xferi_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_PCM_IOCTL_READI_FRAMES32, SNDRV_PCM_IOCTL_READI_FRAMES, sndrv_pcm_ioctl_xferi_ioctl32));
+
+	insert_ht(IOCTL_NEWCMD(SNDRV_CTL_IOCTL_ELEM_LIST32, SNDRV_CTL_IOCTL_ELEM_LIST, sndrv_ctl_ioctl_elem_list_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_CTL_IOCTL_ELEM_INFO32, SNDRV_CTL_IOCTL_ELEM_INFO, sndrv_ctl_ioctl_elem_info_ioctl32));
+	/*
+	insert_ht(IOCTL_NEWCMD(SNDRV_CTL_IOCTL_ELEM_READ32, SNDRV_CTL_IOCTL_ELEM_READ, sndrv_ctl_ioctl_elem_read_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_CTL_IOCTL_ELEM_WRITE32, SNDRV_CTL_IOCTL_ELEM_WRITE, sndrv_ctl_ioctl_elem_write_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_CTL_IOCTL_ELEM_ADD32, SNDRV_CTL_IOCTL_ELEM_ADD, sndrv_ctl_ioctl_elem_add_ioctl32));
+	insert_ht(IOCTL_NEWCMD(SNDRV_CTL_IOCTL_ELEM_REPLACE32, SNDRV_CTL_IOCTL_ELEM_REPLACE, sndrv_ctl_ioctl_elem_replace_ioctl32));
+	*/
+
 	if (setup_ioctl_handler_table()) {
 		fprintf (stdout, "setup ioctl table error!\n");
 		return 1;
--- ia32toia64/user32_memory.c
+++ ia32toia64/user32_memory.c
@@ -212,6 +212,10 @@ sys32_get_mempolicy (int* policy, unsign
 	}
 	return (int)SYSCALL (get_mempolicy, ((int*)policy, (unsigned long*)nmask, maxnode, addr, flags));
 	}*/
+
+#define SNDRV_PCM_MMAP_OFFSET_STATUS  0x80000000
+#define SNDRV_PCM_MMAP_OFFSET_CONTROL 0x81000000
+
 /*****************************************************************************/
 /*
  * do the actual work of the mmap syscalls.
@@ -244,6 +248,11 @@ long do_mmap32 (unsigned long addr, unsi
 		return -EINVAL;
 	}
 	
+	/* Dirty hack: prevent alsa from using mmap. */
+	if (offset == SNDRV_PCM_MMAP_OFFSET_STATUS || offset == SNDRV_PCM_MMAP_OFFSET_CONTROL) {
+		return -EINVAL;
+	}
+
 	prot = convert_prot64_to_prot32 (prot);
 
 	lock_mregion_manager(MREGION_MANAGER_IA32);
openSUSE Build Service is sponsored by