From 47b7ce55f8c466fef9d1cc255fd7bf1d6c6e1e60 Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Sun, 5 Jul 2026 08:59:11 -0500 Subject: [PATCH 1/2] feat: add macro for DMA alignment for SIF and use for SIF types --- common/include/sifcmd-common.h | 14 ++++++++++++-- common/include/sifrpc-common.h | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/common/include/sifcmd-common.h b/common/include/sifcmd-common.h index 110894d93378..30ed55c0690b 100644 --- a/common/include/sifcmd-common.h +++ b/common/include/sifcmd-common.h @@ -18,6 +18,16 @@ #include +#ifdef _IOP +/* 16 byte alignment (4 byte if accessing through uncached segment), 16 byte size multiple */ +#define ALIGNED_FOR_SIFDMA __attribute__((__aligned__((16)))) +#define ALIGNED_FOR_SIFDMA_UNCACHED __attribute__((__aligned__((4)))) +#else +/* 64 byte alignment (16 byte if accessing through uncached segment), 16 byte size multiple */ +#define ALIGNED_FOR_SIFDMA __attribute__((__aligned__((64)))) +#define ALIGNED_FOR_SIFDMA_UNCACHED __attribute__((__aligned__((16)))) +#endif + /** SIF command. */ typedef struct t_SifCmdHeader { @@ -31,7 +41,7 @@ typedef struct t_SifCmdHeader int cid; /** Can be freely used. */ u32 opt; -} SifCmdHeader_t; +} ALIGNED_FOR_SIFDMA SifCmdHeader_t; /** System functions */ #define SIF_CMD_ID_SYSTEM 0x80000000 @@ -81,7 +91,7 @@ typedef struct t_SifCmdSysHandlerData typedef struct _iop_reset_pkt { - struct t_SifCmdHeader header; + SifCmdHeader_t header; int arglen; int mode; char arg[RESET_ARG_MAX + 1]; diff --git a/common/include/sifrpc-common.h b/common/include/sifrpc-common.h index 6074d7a0bd03..07953efcee0b 100644 --- a/common/include/sifrpc-common.h +++ b/common/include/sifrpc-common.h @@ -37,7 +37,7 @@ typedef void (*SifRpcEndFunc_t)(void *end_param); typedef struct t_SifRpcPktHeader { - struct t_SifCmdHeader sifcmd; + SifCmdHeader_t sifcmd; int rec_id; void *pkt_addr; int rpc_id; @@ -45,7 +45,7 @@ typedef struct t_SifRpcPktHeader typedef struct t_SifRpcRendPkt { - struct t_SifCmdHeader sifcmd; + SifCmdHeader_t sifcmd; int rec_id; /* 04 */ void *pkt_addr; /* 05 */ int rpc_id; /* 06 */ @@ -59,7 +59,7 @@ typedef struct t_SifRpcRendPkt typedef struct t_SifRpcOtherDataPkt { - struct t_SifCmdHeader sifcmd; + SifCmdHeader_t sifcmd; int rec_id; /* 04 */ void *pkt_addr; /* 05 */ int rpc_id; /* 06 */ @@ -72,7 +72,7 @@ typedef struct t_SifRpcOtherDataPkt typedef struct t_SifRpcBindPkt { - struct t_SifCmdHeader sifcmd; + SifCmdHeader_t sifcmd; int rec_id; /* 04 */ void *pkt_addr; /* 05 */ int rpc_id; /* 06 */ @@ -82,7 +82,7 @@ typedef struct t_SifRpcBindPkt typedef struct t_SifRpcCallPkt { - struct t_SifCmdHeader sifcmd; + SifCmdHeader_t sifcmd; int rec_id; /* 04 */ void *pkt_addr; /* 05 */ int rpc_id; /* 06 */ @@ -119,7 +119,7 @@ typedef struct t_SifRpcServerData struct t_SifRpcServerData *link; /* 18 14 */ struct t_SifRpcServerData *next; /* 19 15 */ struct t_SifRpcDataQueue *base; /* 20 16 */ -} SifRpcServerData_t; +} ALIGNED_FOR_SIFDMA SifRpcServerData_t; typedef struct t_SifRpcHeader @@ -128,12 +128,12 @@ typedef struct t_SifRpcHeader u32 rpc_id; /* 05 01 */ int sema_id; /* 06 02 */ u32 mode; /* 07 03 */ -} SifRpcHeader_t; +} ALIGNED_FOR_SIFDMA SifRpcHeader_t; typedef struct t_SifRpcClientData { - struct t_SifRpcHeader hdr; + SifRpcHeader_t hdr; u32 command; /* 04 08 */ void *buf, /* 05 09 */ *cbuf; /* 06 10 */ @@ -144,7 +144,7 @@ typedef struct t_SifRpcClientData typedef struct t_SifRpcReceiveData { - struct t_SifRpcHeader hdr; + SifRpcHeader_t hdr; void *src, /* 04 */ *dest; /* 05 */ int size; /* 06 */ @@ -158,7 +158,7 @@ typedef struct t_SifRpcDataQueue *start, /* 03 */ *end; /* 04 */ struct t_SifRpcDataQueue *next; /* 05 */ -} SifRpcDataQueue_t; +} ALIGNED_FOR_SIFDMA SifRpcDataQueue_t; #ifdef __cplusplus extern "C" { From 4fe4a0638a09b759197e9daa9fc2ea78217825a7 Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Sun, 5 Jul 2026 08:59:11 -0500 Subject: [PATCH 2/2] refactor: Remove extra alignment attributes or use ALIGNED_FOR_SIFDMA --- common/include/fileXio.h | 5 +-- common/include/fileio-common.h | 17 ++++----- common/include/librm-common.h | 3 +- common/include/loadfile-common.h | 17 ++++----- ee/iopreboot/src/SifIopRebootBuffer.c | 2 +- ee/kernel/src/fileio.c | 4 +-- ee/kernel/src/iopcontrol.c | 4 +-- ee/kernel/src/rom0_info.c | 2 +- ee/kernel/src/sifcmd.c | 8 ++--- ee/kernel/src/sifrpc.c | 8 ++--- ee/network/netman/src/rpc_client.c | 6 ++-- ee/network/netman/src/rpc_server.c | 6 ++-- ee/rpc/ahx/src/ahx_rpc.c | 4 +-- ee/rpc/audsrv/src/audsrv_rpc.c | 10 +++--- ee/rpc/camera/src/ps2cam_rpc.c | 4 +-- ee/rpc/cdvd/src/libcdvd.c | 18 +++++----- ee/rpc/cdvd/src/ncmd.c | 24 ++++++------- ee/rpc/cdvd/src/scmd.c | 8 ++--- ee/rpc/filexio/src/fileXio_rpc.c | 8 ++--- ee/rpc/memorycard/include/libmc.h | 4 +-- ee/rpc/memorycard/samples/mc_example.c | 2 +- ee/rpc/memorycard/src/libmc.c | 14 ++++---- ee/rpc/mouse/src/libmouse.c | 4 +-- ee/rpc/multitap/src/libmtap.c | 8 ++--- ee/rpc/pad/samples/pad/pad.c | 2 +- ee/rpc/pad/src/libpad.c | 8 ++--- ee/rpc/poweroff/src/poweroff.c | 6 ++-- ee/rpc/ps2snd/src/ps2snd.c | 48 ++++++++++++------------- ee/rpc/remote/samples/remote.c | 2 +- ee/rpc/remote/src/librm.c | 6 ++-- ee/rpc/secr/src/libsecr.c | 2 +- ee/rpc/sior/src/sior_rpc.c | 6 ++-- ee/rpc/tcpips/src/ps2ipc.c | 4 +-- ee/sbv/src/common.c | 2 +- ee/sbv/src/common.h | 5 ++- ee/sbv/src/patch_disable_prefix_check.c | 3 +- ee/sbv/src/patch_enable_lmb.c | 2 +- ee/sbv/src/patch_fileio.c | 2 +- iop/debug/sior/src/sior.c | 2 +- iop/debug/sior/src/xprintf.c | 2 +- iop/dev9/poweroff/src/poweroff.c | 4 +-- iop/fs/fakehost/src/nprintf.c | 6 ++-- iop/fs/fileio/src/fileio.c | 28 +++++++-------- iop/fs/filexio/src/fileXio_iop.c | 16 ++++----- iop/input/padman/src/freepad.h | 5 +-- iop/input/padman/src/padInit.c | 2 +- iop/input/padman/src/rpcserver.c | 4 +-- iop/input/rmman/src/rmman.c | 2 +- iop/memorycard/mcserv/src/mcserv.c | 10 +++--- iop/network/netcnfif/src/netcnfif.c | 10 +++--- iop/network/netman/src/rpc_server.c | 2 +- iop/sio/mtapman/src/rpcservers.c | 2 +- iop/sound/ahx/src/ahx_irx.c | 2 +- iop/sound/audsrv/src/adpcm.c | 3 +- iop/sound/audsrv/src/rpc_server.c | 2 +- iop/sound/ps2snd/src/ps2snd.c | 2 +- iop/system/loadfile/src/loadfile.c | 8 ++--- iop/system/sifcmd/src/sifcmd.c | 6 ++-- iop/system/sifcmd/src/sifrpc.c | 8 ++--- iop/tcpip/tcpips/src/ps2ips.c | 6 ++-- iop/usb/camera/src/ps2cam.c | 8 ++--- iop/usb/mouse/src/ps2mouse.c | 6 ++-- 62 files changed, 221 insertions(+), 213 deletions(-) diff --git a/common/include/fileXio.h b/common/include/fileXio.h index 0ee98fabc860..298dc510eae1 100644 --- a/common/include/fileXio.h +++ b/common/include/fileXio.h @@ -21,6 +21,7 @@ #include #include +#include #ifdef _EE #ifndef NEWLIB_PORT_AWARE @@ -101,7 +102,7 @@ struct fileXioDirEntry u32 fileSize; u8 fileProperties; char filename[128 + 1]; -} __attribute__((aligned(64))); +} ALIGNED_FOR_SIFDMA; struct fileXioDevice { @@ -110,7 +111,7 @@ struct fileXioDevice /** Not so sure about this one. */ unsigned int version; char desc[128]; -} __attribute__((aligned(64))); +} ALIGNED_FOR_SIFDMA; struct fxio_devlist_packet { diff --git a/common/include/fileio-common.h b/common/include/fileio-common.h index d525d4590751..abf9036e784a 100644 --- a/common/include/fileio-common.h +++ b/common/include/fileio-common.h @@ -18,6 +18,7 @@ #include #include +#include // fileio common definitions @@ -51,7 +52,7 @@ struct _fio_read_data void *dest2; u8 buf1[16]; u8 buf2[16]; -}; +} ALIGNED_FOR_SIFDMA; #define FIO_PATH_MAX 256 @@ -59,7 +60,7 @@ struct _fio_open_arg { int mode; char name[FIO_PATH_MAX]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _fio_read_arg { @@ -67,7 +68,7 @@ struct _fio_read_arg void *ptr; int size; struct _fio_read_data *read_data; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _fio_write_arg { @@ -76,7 +77,7 @@ struct _fio_write_arg u32 size; u32 mis; u8 aligned[16]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _fio_lseek_arg { @@ -87,7 +88,7 @@ struct _fio_lseek_arg } p; int offset; int whence; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _fio_ioctl_arg { @@ -98,7 +99,7 @@ struct _fio_ioctl_arg } p; int request; u8 data[1024]; // Will this be ok ? -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _fio_dread_arg { @@ -108,7 +109,7 @@ struct _fio_dread_arg int result; } p; io_dirent_t *buf; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _fio_getstat_arg { @@ -118,7 +119,7 @@ struct _fio_getstat_arg int result; } p; char name[FIO_PATH_MAX]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _fio_chstat_arg { diff --git a/common/include/librm-common.h b/common/include/librm-common.h index c6e3fad4e1af..e01104d18a37 100644 --- a/common/include/librm-common.h +++ b/common/include/librm-common.h @@ -17,6 +17,7 @@ #define __LIBRM_COMMON_H__ #include +#include struct rmRpcPacket { @@ -42,7 +43,7 @@ struct rmRpcPacket } cmd; u8 buffer[128]; }; -}; +} ALIGNED_FOR_SIFDMA; struct rmEEData { diff --git a/common/include/loadfile-common.h b/common/include/loadfile-common.h index 0d3e226c4cfb..c0fed14b6746 100644 --- a/common/include/loadfile-common.h +++ b/common/include/loadfile-common.h @@ -17,6 +17,7 @@ #define __LOADFILE_COMMON_H__ #include +#include // loadfile common definitions @@ -72,7 +73,7 @@ struct _lf_iop_val_arg u16 s; u32 l; } val; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _lf_module_load_arg { @@ -84,7 +85,7 @@ struct _lf_module_load_arg int modres; char path[LF_PATH_MAX]; char args[LF_ARG_MAX]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _lf_module_stop_arg { @@ -100,13 +101,13 @@ struct _lf_module_stop_arg } q; char dummy[LF_PATH_MAX]; char args[LF_ARG_MAX]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; union _lf_module_unload_arg { int id; int result; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _lf_search_module_by_name_arg { @@ -114,7 +115,7 @@ struct _lf_search_module_by_name_arg int dummy1; char name[LF_PATH_MAX]; char dummy2[LF_ARG_MAX]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _lf_search_module_by_address_arg { @@ -123,7 +124,7 @@ struct _lf_search_module_by_address_arg const void *ptr; int id; } p; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _lf_elf_load_arg { @@ -131,7 +132,7 @@ struct _lf_elf_load_arg u32 gp; char path[LF_PATH_MAX]; char secname[LF_ARG_MAX]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; struct _lf_module_buffer_load_arg { @@ -147,6 +148,6 @@ struct _lf_module_buffer_load_arg } q; char unused[LF_PATH_MAX]; char args[LF_ARG_MAX]; -} __attribute__((aligned(16))); +} ALIGNED_FOR_SIFDMA; #endif diff --git a/ee/iopreboot/src/SifIopRebootBuffer.c b/ee/iopreboot/src/SifIopRebootBuffer.c index b51eed19def7..8d72a460c1d9 100644 --- a/ee/iopreboot/src/SifIopRebootBuffer.c +++ b/ee/iopreboot/src/SifIopRebootBuffer.c @@ -37,7 +37,7 @@ extern int imgdrv_offset_ioprpsiz; extern void init_imgdrv_offsets(void); #ifdef F__iopcontrol_special_internals -u8 iopbtconf_img[IOPBTCONF_IOP_MAX_SIZE] __attribute__((aligned(64))); +u8 iopbtconf_img[IOPBTCONF_IOP_MAX_SIZE] ALIGNED_FOR_SIFDMA; int imgdrv_offset_ioprpimg = 0; int imgdrv_offset_ioprpsiz = 0; diff --git a/ee/kernel/src/fileio.c b/ee/kernel/src/fileio.c index a2d957b1fbeb..ed46e989e1e7 100644 --- a/ee/kernel/src/fileio.c +++ b/ee/kernel/src/fileio.c @@ -38,8 +38,8 @@ void _fio_intr(); #ifdef F___fio_internals SifRpcClientData_t _fio_cd; -int _fio_recv_data[512] __attribute__((aligned(64))); -int _fio_intr_data[32] __attribute__((aligned(64))); +int _fio_recv_data[512] ALIGNED_FOR_SIFDMA; +int _fio_intr_data[32] ALIGNED_FOR_SIFDMA; int _fio_block_mode; int _fio_io_sema; int _fio_completion_sema; diff --git a/ee/kernel/src/iopcontrol.c b/ee/kernel/src/iopcontrol.c index bec4a0fe835a..88b43d392033 100644 --- a/ee/kernel/src/iopcontrol.c +++ b/ee/kernel/src/iopcontrol.c @@ -33,8 +33,8 @@ extern int _iop_reboot_count; int SifIopReset(const char *arg, int mode) { - static SifCmdResetData_t reset_pkt __attribute__((aligned(64))); - struct t_SifDmaTransfer dmat; + static SifCmdResetData_t reset_pkt; + SifDmaTransfer_t dmat; int arglen; _iop_reboot_count++; // increment reboot counter to allow RPC clients to detect unbinding! diff --git a/ee/kernel/src/rom0_info.c b/ee/kernel/src/rom0_info.c index c604e1053854..e9527c964e03 100644 --- a/ee/kernel/src/rom0_info.c +++ b/ee/kernel/src/rom0_info.c @@ -39,7 +39,7 @@ void SetupRomInfo(void) { void *iop_addr; SifRpcReceiveData_t rdata; - u8 buf[64] __attribute__((__aligned__(64))); + u8 buf[64] ALIGNED_FOR_SIFDMA; /* ROMVER needs to be read from the IOP due to PPCIOP region patching. */ /* only read in the romname the first time */ diff --git a/ee/kernel/src/sifcmd.c b/ee/kernel/src/sifcmd.c index 05554f682caf..60f282d04d1f 100644 --- a/ee/kernel/src/sifcmd.c +++ b/ee/kernel/src/sifcmd.c @@ -49,7 +49,7 @@ struct cmd_data SifCmdHandlerData_t *usr_cmd_handlers; u32 nr_usr_handlers; int *sregs; -} __attribute__((aligned(64))); +} ALIGNED_FOR_SIFDMA; extern struct cmd_data _sif_cmd_data; extern unsigned int _SifSendCmd(int cid, int mode, void *pkt, int pktsize, void *src, @@ -173,10 +173,10 @@ int _SifCmdIntHandler(int channel) #endif #ifdef F_sif_cmd_main -static u8 pktbuf[CMD_PACKET_MAX] __attribute__((aligned(64))); +static u8 pktbuf[CMD_PACKET_MAX] ALIGNED_FOR_SIFDMA; /* Define this so that in the unlikely case another SIF implementation decides to use it, it won't crash. Otherwise unused. */ -static u8 sif_unused[64] __attribute__((aligned(64))); +static u8 sif_unused[64] ALIGNED_FOR_SIFDMA; static SifCmdSysHandlerData_t sys_cmd_handlers[SYS_CMD_HANDLER_MAX]; static int sregs[32]; @@ -215,7 +215,7 @@ static void set_sreg(void *packet, void *harg) void sceSifInitCmd(void) { - static struct ca_pkt packet __attribute((aligned(64))); + static struct ca_pkt packet; int i; if (HasIopRebootedSinceLastCall()) sceSifExitCmd(); diff --git a/ee/kernel/src/sifrpc.c b/ee/kernel/src/sifrpc.c index 22e67da102dc..9bd452729f01 100644 --- a/ee/kernel/src/sifrpc.c +++ b/ee/kernel/src/sifrpc.c @@ -49,7 +49,7 @@ struct rpc_data int client_table_len; int rdata_table_idx; void *active_queue; -} __attribute__((aligned(64))); +} ALIGNED_FOR_SIFDMA; extern struct rpc_data _sif_rpc_data; @@ -277,10 +277,10 @@ int sceSifGetOtherData(SifRpcReceiveData_t *rd, void *src, void *dest, int size, #ifdef F_SifRpcMain /* The packets sent on EE RPC requests are allocated from this table. */ -static u8 pkt_table[32][RPC_PACKET_SIZE] __attribute__((aligned(64))); +static u8 pkt_table[32][RPC_PACKET_SIZE] ALIGNED_FOR_SIFDMA; /* A ring buffer used to allocate packets sent on IOP requests. */ -static u8 rdata_table[32][RPC_PACKET_SIZE] __attribute__((aligned(64))); -static u8 client_table[32][RPC_PACKET_SIZE] __attribute__((aligned(64))); +static u8 rdata_table[32][RPC_PACKET_SIZE] ALIGNED_FOR_SIFDMA; +static u8 client_table[32][RPC_PACKET_SIZE] ALIGNED_FOR_SIFDMA; struct rpc_data _sif_rpc_data; diff --git a/ee/network/netman/src/rpc_client.c b/ee/network/netman/src/rpc_client.c index 8e4a31f1eab9..db9051ab6d85 100644 --- a/ee/network/netman/src/rpc_client.c +++ b/ee/network/netman/src/rpc_client.c @@ -18,7 +18,7 @@ static union { char netifName[NETMAN_NETIF_NAME_MAX_LEN]; struct NetManRegNetworkStack NetStack; u8 buffer[128]; -}TransmitBuffer ALIGNED(64); +}TransmitBuffer ALIGNED_FOR_SIFDMA; static union { s32 result; @@ -26,7 +26,7 @@ static union { struct NetManIoctlResult IoctlResult; struct NetManQueryMainNetIFResult QueryMainNetIFResult; u8 buffer[128]; -}ReceiveBuffer ALIGNED(64); +}ReceiveBuffer ALIGNED_FOR_SIFDMA; static int NetManIOSemaID, NETMAN_Tx_threadID; static unsigned char NETMAN_Tx_ThreadStack[0x1000] ALIGNED(16); @@ -190,7 +190,7 @@ int NetManRpcIoctl(unsigned int command, void *args, unsigned int args_len, void static void NETMAN_TxThread(void *arg) { - static SifCmdHeader_t cmd ALIGNED(64); + static SifCmdHeader_t cmd; SifDmaTransfer_t dmat[2]; struct NetManPktCmd *npcmd; int dmat_id, unaligned, unalignedCache; diff --git a/ee/network/netman/src/rpc_server.c b/ee/network/netman/src/rpc_server.c index 4a27fa2c7bc1..8ecf0af1289f 100644 --- a/ee/network/netman/src/rpc_server.c +++ b/ee/network/netman/src/rpc_server.c @@ -152,12 +152,12 @@ static void *NETMAN_EE_RPC_Handler(int fnum, void *buffer, int NumBytes) return result; } -static struct t_SifRpcDataQueue cb_queue; -static struct t_SifRpcServerData cb_srv; +static SifRpcDataQueue_t cb_queue; +static SifRpcServerData_t cb_srv; static void NETMAN_RPC_Thread(void *arg) { - static unsigned char cb_rpc_buffer[64] __attribute__((__aligned__(64))); + static unsigned char cb_rpc_buffer[64] ALIGNED_FOR_SIFDMA; (void)arg; diff --git a/ee/rpc/ahx/src/ahx_rpc.c b/ee/rpc/ahx/src/ahx_rpc.c index 629abc3a5bca..294081efedd4 100644 --- a/ee/rpc/ahx/src/ahx_rpc.c +++ b/ee/rpc/ahx/src/ahx_rpc.c @@ -25,8 +25,8 @@ #include #include "ahx_rpc.h" -static unsigned sbuff[64] __attribute__((aligned (64))); -static struct t_SifRpcClientData cd0; +static unsigned sbuff[64] ALIGNED_FOR_SIFDMA; +static SifRpcClientData_t cd0; /** EE mapped IOP mem */ #define IOP_MEM 0xbc000000 char* songbuffer_addr; diff --git a/ee/rpc/audsrv/src/audsrv_rpc.c b/ee/rpc/audsrv/src/audsrv_rpc.c index 98a6e47dde8c..b588613af283 100755 --- a/ee/rpc/audsrv/src/audsrv_rpc.c +++ b/ee/rpc/audsrv/src/audsrv_rpc.c @@ -27,10 +27,10 @@ #define MIN(a,b) ((a) <= (b)) ? (a) : (b) /* rpc mambo jambo */ -static struct t_SifRpcClientData cd0; -static unsigned int sbuff[4096] __attribute__((aligned (64))); -static struct t_SifRpcDataQueue cb_queue; -static struct t_SifRpcServerData cb_srv; +static SifRpcClientData_t cd0; +static unsigned int sbuff[4096] ALIGNED_FOR_SIFDMA; +static SifRpcDataQueue_t cb_queue; +static SifRpcServerData_t cb_srv; static unsigned char rpc_server_stack[0x1800] __attribute__((aligned (16))); extern void *_gp; @@ -316,7 +316,7 @@ static void *audsrv_ee_rpc_handler(int fnum, void *buffer, int len) static void rpc_server_thread(void *arg) { - static unsigned char cb_rpc_buffer[64] __attribute__((__aligned__(64))); + static unsigned char cb_rpc_buffer[64] ALIGNED_FOR_SIFDMA; (void)arg; diff --git a/ee/rpc/camera/src/ps2cam_rpc.c b/ee/rpc/camera/src/ps2cam_rpc.c index 2654fd9025ee..f9485dd281d2 100644 --- a/ee/rpc/camera/src/ps2cam_rpc.c +++ b/ee/rpc/camera/src/ps2cam_rpc.c @@ -23,8 +23,8 @@ -static SifRpcClientData_t cdata __attribute__((aligned(64))); -static char data[1024] __attribute__((aligned(64))); +static SifRpcClientData_t cdata; +static char data[1024] ALIGNED_FOR_SIFDMA; static char campacket[896] __attribute__((aligned(64))); ee_sema_t compSema; diff --git a/ee/rpc/cdvd/src/libcdvd.c b/ee/rpc/cdvd/src/libcdvd.c index 1b53d2afbfda..95cd326c9e72 100644 --- a/ee/rpc/cdvd/src/libcdvd.c +++ b/ee/rpc/cdvd/src/libcdvd.c @@ -68,11 +68,11 @@ int initVersionCdvdfsv; int initVersionCdvdman; // rpc binded client data /** for sceCdInit() */ -SifRpcClientData_t clientInit __attribute__((aligned(64))); +SifRpcClientData_t clientInit; /** for sceCdDiskReady() (s-cmd) */ -SifRpcClientData_t clientDiskReady __attribute__((aligned(64))); +SifRpcClientData_t clientDiskReady; /** for sceCdSearchFile() (n-cmd) */ -SifRpcClientData_t clientSearchFile __attribute__((aligned(64))); +SifRpcClientData_t clientSearchFile; /** set this to 1 or 2 to print sceCdvd debug messages */ int CdDebug = 0; @@ -95,15 +95,15 @@ ee_thread_t callbackThreadParam; // current command variables -s32 diskReadyMode __attribute__((aligned(64))); -s32 trayReqData __attribute__((aligned(64))); -u32 initMode __attribute__((aligned(64))); +s32 diskReadyMode ALIGNED_FOR_SIFDMA; +s32 trayReqData ALIGNED_FOR_SIFDMA; +u32 initMode ALIGNED_FOR_SIFDMA; // init stuff -CdInitPkt cdInitRecvBuff __attribute__((aligned(64))); +CdInitPkt cdInitRecvBuff ALIGNED_FOR_SIFDMA; // searchfile stuff -SearchFilePkt searchFileSendBuff __attribute__((aligned(64))); -u32 searchFileRecvBuff __attribute__((aligned(64))); +SearchFilePkt searchFileSendBuff ALIGNED_FOR_SIFDMA; +u32 searchFileRecvBuff ALIGNED_FOR_SIFDMA; #endif // Prototypes for multimodule diff --git a/ee/rpc/cdvd/src/ncmd.c b/ee/rpc/cdvd/src/ncmd.c index 8c667683c8c8..baac954d2640 100644 --- a/ee/rpc/cdvd/src/ncmd.c +++ b/ee/rpc/cdvd/src/ncmd.c @@ -78,28 +78,28 @@ typedef union #ifdef F__ncmd_internals /** for n-cmds */ -SifRpcClientData_t clientNCmd __attribute__((aligned(64))); +SifRpcClientData_t clientNCmd; /** n-cmd semaphore id */ int nCmdSemaId; int nCmdNum = 0; -u32 readStreamData[5] __attribute__((aligned(64))); -u32 readData[6] __attribute__((aligned(64))); -sceCdRChain readChainData[66] __attribute__((aligned(64))); +u32 readStreamData[5] ALIGNED_FOR_SIFDMA; +u32 readData[6] ALIGNED_FOR_SIFDMA; +sceCdRChain readChainData[66] ALIGNED_FOR_SIFDMA; /** get toc */ -u32 getTocSendBuff[3] __attribute__((aligned(64))); -u32 _rd_intr_data[64] __attribute__((aligned(64))); -u32 curReadPos __attribute__((aligned(64))); +u32 getTocSendBuff[3] ALIGNED_FOR_SIFDMA; +u32 _rd_intr_data[64] ALIGNED_FOR_SIFDMA; +u32 curReadPos ALIGNED_FOR_SIFDMA; /** toc buffer (for sceCdGetToc()) */ -u8 tocBuff[2064] __attribute__((aligned(64))); -u8 nCmdRecvBuff[48] __attribute__((aligned(64))); -nCmdSendParams_t nCmdSendBuff __attribute__((aligned(64))); +u8 tocBuff[2064] ALIGNED_FOR_SIFDMA; +u8 nCmdRecvBuff[48] ALIGNED_FOR_SIFDMA; +nCmdSendParams_t nCmdSendBuff ALIGNED_FOR_SIFDMA; int streamStatus = 0; sceCdRMode dummyMode; -u32 seekSector __attribute__((aligned(64))); -u32 cdda_st_buf[64 / sizeof(u32)] ALIGNED(64); +u32 seekSector ALIGNED_FOR_SIFDMA; +u32 cdda_st_buf[64 / sizeof(u32)] ALIGNED_FOR_SIFDMA; #endif extern int initVersionCdvdfsv; diff --git a/ee/rpc/cdvd/src/scmd.c b/ee/rpc/cdvd/src/scmd.c index e7b538460db5..f0dbbfa2d968 100644 --- a/ee/rpc/cdvd/src/scmd.c +++ b/ee/rpc/cdvd/src/scmd.c @@ -85,15 +85,15 @@ typedef union u8 id[8]; char mname[16]; u8 data[0x420]; -} sCmdSendParams_t; +} ALIGNED_FOR_SIFDMA sCmdSendParams_t; #ifdef F__scmd_internals -SifRpcClientData_t clientSCmd __attribute__((aligned(64))); +SifRpcClientData_t clientSCmd; int sCmdSemaId; -u8 sCmdRecvBuff[0x440] __attribute__((aligned(64))); -sCmdSendParams_t sCmdSendBuff __attribute__((aligned(64))); +u8 sCmdRecvBuff[0x440] ALIGNED_FOR_SIFDMA; +sCmdSendParams_t sCmdSendBuff; int sCmdNum = 0; diff --git a/ee/rpc/filexio/src/fileXio_rpc.c b/ee/rpc/filexio/src/fileXio_rpc.c index 1aa2e6885441..562d2e66503c 100644 --- a/ee/rpc/filexio/src/fileXio_rpc.c +++ b/ee/rpc/filexio/src/fileXio_rpc.c @@ -39,15 +39,15 @@ extern SifRpcClientData_t __cd0; #endif #ifdef F___sbuff -unsigned int __sbuff[0x1300] __attribute__((aligned (64))); +unsigned int __sbuff[0x1300] ALIGNED_FOR_SIFDMA; #else -extern unsigned int __sbuff[0x1300] __attribute__((aligned (64))); +extern unsigned int __sbuff[0x1300] ALIGNED_FOR_SIFDMA; #endif #ifdef F___intr_data -int __intr_data[0xC00] __attribute__((aligned(64))); +unsigned int __intr_data[0xC00] ALIGNED_FOR_SIFDMA; #else -extern int __intr_data[0xC00] __attribute__((aligned(64))); +extern unsigned int __intr_data[0xC00] ALIGNED_FOR_SIFDMA; #endif #ifdef F___fileXioBlockMode diff --git a/ee/rpc/memorycard/include/libmc.h b/ee/rpc/memorycard/include/libmc.h index fcef7d256c55..b12e19fa07df 100644 --- a/ee/rpc/memorycard/include/libmc.h +++ b/ee/rpc/memorycard/include/libmc.h @@ -144,7 +144,7 @@ typedef struct _sceMcTblGetDir { // size = 64 u32 Reserve2; // 24 u32 PdaAplNo; // 28 unsigned char EntryName[32]; // 32 -} sceMcTblGetDir __attribute__((aligned(64))); +} sceMcTblGetDir ALIGNED_FOR_SIFDMA; typedef struct { @@ -190,7 +190,7 @@ typedef struct unsigned unknown4[2]; /** Entry name */ unsigned char name[32]; -} mcTable __attribute__((deprecated, aligned (64))); +} mcTable __attribute__((deprecated)) ALIGNED_FOR_SIFDMA; // values to send to mcInit() to use either mcserv or xmcserv // These definitions are retained for backwards compatibility diff --git a/ee/rpc/memorycard/samples/mc_example.c b/ee/rpc/memorycard/samples/mc_example.c index 3c9b2e1c144a..bfc4bbe62b99 100644 --- a/ee/rpc/memorycard/samples/mc_example.c +++ b/ee/rpc/memorycard/samples/mc_example.c @@ -36,7 +36,7 @@ void LoadModules(void); int CreateSave(void); #define ARRAY_ENTRIES 64 -static sceMcTblGetDir mcDir[ARRAY_ENTRIES] __attribute__((aligned(64))); +static sceMcTblGetDir mcDir[ARRAY_ENTRIES]; static int mc_Type, mc_Free, mc_Format; int main() { diff --git a/ee/rpc/memorycard/src/libmc.c b/ee/rpc/memorycard/src/libmc.c index 18cab50511e8..1a0b4158abd9 100644 --- a/ee/rpc/memorycard/src/libmc.c +++ b/ee/rpc/memorycard/src/libmc.c @@ -112,14 +112,14 @@ union libmc_name_desc_param_unio { struct libmc_name_param_stru m_name_param; mcDescParam_t m_desc_param; -}; +} ALIGNED_FOR_SIFDMA; union libmc_rdata_param_unio { int m_result; mcRpcStat_t m_rpcStat; u8 m_buffer[2048]; -}; +} ALIGNED_FOR_SIFDMA; struct libmc_page_read_align_data_stru { @@ -138,7 +138,7 @@ union libmc_extra_send_recv_unio char m_cur_dir[1024]; sceMcTblGetDir m_file_info_buff; struct libmc_page_read_align_data_stru m_page_read_align_data; -}; +} ALIGNED_FOR_SIFDMA; typedef struct mcExtraEndParam_ { @@ -152,13 +152,13 @@ typedef struct mcExtraEndParam_ struct libmc_interface_data_stru { - SifRpcClientData_t m_client_data __attribute__((aligned(64))); // target->m_interface_data->m_client_data + SifRpcClientData_t m_client_data; // target->m_interface_data->m_client_data unsigned int m_current_command; // target->m_interface_data->m_current_command int m_mc_rpc_type; // target->m_interface_data->m_mc_rpc_type mcExtraEndParam_t m_extra_end_param; // target->m_interface_data->m_extra_end_param - union libmc_name_desc_param_unio m_name_desc_param __attribute__((aligned(64))); // target->m_interface_data->m_name_desc_param - union libmc_rdata_param_unio m_rpc_rdata __attribute__((aligned(64))); // target->m_interface_data->m_rpc_rdata - union libmc_extra_send_recv_unio m_extra_send_recv_param __attribute__((aligned(64))); // target->m_interface_data->m_extra_send_recv_param + union libmc_name_desc_param_unio m_name_desc_param; // target->m_interface_data->m_name_desc_param + union libmc_rdata_param_unio m_rpc_rdata; // target->m_interface_data->m_rpc_rdata + union libmc_extra_send_recv_unio m_extra_send_recv_param; // target->m_interface_data->m_extra_send_recv_param }; enum MC_INTERFACE diff --git a/ee/rpc/mouse/src/libmouse.c b/ee/rpc/mouse/src/libmouse.c index ffbf12009928..8f19e547fce0 100644 --- a/ee/rpc/mouse/src/libmouse.c +++ b/ee/rpc/mouse/src/libmouse.c @@ -21,7 +21,7 @@ #include #include "libmouse.h" -static SifRpcClientData_t mouseif __attribute__((aligned(64))); +static SifRpcClientData_t mouseif; static union { char buffer[128]; u32 mode; @@ -36,7 +36,7 @@ static union { } pos; u32 data; u32 time; -} buffer __attribute__((aligned(64))); +} buffer ALIGNED_FOR_SIFDMA; int PS2MouseInit(void) diff --git a/ee/rpc/multitap/src/libmtap.c b/ee/rpc/multitap/src/libmtap.c index 0c223f812e85..56ffe3f349be 100644 --- a/ee/rpc/multitap/src/libmtap.c +++ b/ee/rpc/multitap/src/libmtap.c @@ -26,10 +26,10 @@ #define MTAPSERV_PORT_CLOSE 0x80000902 #define MTAPSERV_GET_CONNECTION 0x80000903 -static unsigned int mtapRpcBuffer[32] __attribute__((aligned (64))); -static struct t_SifRpcClientData clientPortOpen __attribute__((aligned (64))); -static struct t_SifRpcClientData clientPortClose __attribute__((aligned (64))); -static struct t_SifRpcClientData clientGetConnection __attribute__((aligned (64))); +static unsigned int mtapRpcBuffer[32] ALIGNED_FOR_SIFDMA; +static SifRpcClientData_t clientPortOpen; +static SifRpcClientData_t clientPortClose; +static SifRpcClientData_t clientGetConnection; int mtapInit(void) { diff --git a/ee/rpc/pad/samples/pad/pad.c b/ee/rpc/pad/samples/pad/pad.c index 30d393c439a5..7d16aba7882f 100644 --- a/ee/rpc/pad/samples/pad/pad.c +++ b/ee/rpc/pad/samples/pad/pad.c @@ -25,7 +25,7 @@ */ // pad_dma_buf is provided by the user, one buf for each pad // contains the pad's current state -static char padBuf[256] __attribute__((aligned(64))); +static char padBuf[256] ALIGNED_FOR_SIFDMA; static char actAlign[6]; static int actuators; diff --git a/ee/rpc/pad/src/libpad.c b/ee/rpc/pad/src/libpad.c index d933820df867..4a6a033d2102 100644 --- a/ee/rpc/pad/src/libpad.c +++ b/ee/rpc/pad/src/libpad.c @@ -163,7 +163,7 @@ static const char *padReqStateString[] = { static int padInitialised = 0; // pad rpc call -static SifRpcClientData_t padsif[2] __attribute__((aligned(64))); +static SifRpcClientData_t padsif[2]; static union { s32 command; struct { @@ -239,10 +239,10 @@ static union { } padActDirAlignArgs; char buffer[128]; } -buffer __attribute__((aligned(64))); +buffer ALIGNED_FOR_SIFDMA; /** Port state data */ -static struct open_slot openSlot[2] __attribute__((aligned(64))); +static struct open_slot openSlot[2] ALIGNED_FOR_SIFDMA; static struct pad_state PadState[2][8]; @@ -324,7 +324,7 @@ padInit(int mode) { unsigned int i; - SifRpcClientData_t rpciftmp[2] __attribute__((aligned(64))); + SifRpcClientData_t rpciftmp[2]; static const int rpc_ids[] = { PAD_BIND_RPC_ID1_NEW, PAD_BIND_RPC_ID1_OLD, diff --git a/ee/rpc/poweroff/src/poweroff.c b/ee/rpc/poweroff/src/poweroff.c index 0a234656b8e5..0fc55f711602 100644 --- a/ee/rpc/poweroff/src/poweroff.c +++ b/ee/rpc/poweroff/src/poweroff.c @@ -27,8 +27,8 @@ static void *poweroff_data = NULL; static u8 poffThreadStack[512 * 16] __attribute__((aligned(16))); static SifRpcClientData_t cd0; -static struct t_SifRpcDataQueue cb_queue; -static struct t_SifRpcServerData cb_srv; +static SifRpcDataQueue_t cb_queue; +static SifRpcServerData_t cb_srv; static int powerOffThreadId; static void *PowerOff_ee_rpc_handler(int fnum, void *buffer, int len) @@ -52,7 +52,7 @@ static void *PowerOff_ee_rpc_handler(int fnum, void *buffer, int len) static void PowerOffThread(void *dat) { - static unsigned char cb_rpc_buffer[64] __attribute__((__aligned__(64))); + static unsigned char cb_rpc_buffer[64] ALIGNED_FOR_SIFDMA; (void)dat; diff --git a/ee/rpc/ps2snd/src/ps2snd.c b/ee/rpc/ps2snd/src/ps2snd.c index 2f4c8c10d121..8f36a34527b0 100644 --- a/ee/rpc/ps2snd/src/ps2snd.c +++ b/ee/rpc/ps2snd/src/ps2snd.c @@ -16,11 +16,11 @@ #include #include -static SifRpcClientData_t sd_client ALIGNED(64); +static SifRpcClientData_t sd_client; int sceSdInit(int flag) { - s32 buf[1] ALIGNED(64); + s32 buf[1] ALIGNED_FOR_SIFDMA; if (HasIopRebootedSinceLastCall()) memset(&sd_client, 0, sizeof(sd_client)); @@ -50,7 +50,7 @@ int sceSdInit(int flag) void sceSdSetParam(u16 entry, u16 value) { - u32 buf[2] ALIGNED(64); + u32 buf[2] ALIGNED_FOR_SIFDMA; buf[0] = entry; buf[1] = value; sceSifCallRpc(&sd_client, PS2SND_SetParam, 0, buf, 8, NULL, 0, NULL, NULL); @@ -58,7 +58,7 @@ void sceSdSetParam(u16 entry, u16 value) u16 sceSdGetParam(u16 entry) { - u32 buf[1] ALIGNED(64); + u32 buf[1] ALIGNED_FOR_SIFDMA; buf[0] = entry; sceSifCallRpc(&sd_client, PS2SND_GetParam, 0, buf, 4, buf, 4, NULL, NULL); return(buf[0]); @@ -66,7 +66,7 @@ u16 sceSdGetParam(u16 entry) void sceSdSetSwitch(u16 entry, u32 value) { - u32 buf[2] ALIGNED(64); + u32 buf[2] ALIGNED_FOR_SIFDMA; buf[0] = entry; buf[1] = value; sceSifCallRpc(&sd_client, PS2SND_SetSwitch, 0, buf, 8, NULL, 0, NULL, NULL); @@ -74,7 +74,7 @@ void sceSdSetSwitch(u16 entry, u32 value) u32 sceSdGetSwitch(u16 entry) { - u32 buf[1] ALIGNED(64); + u32 buf[1] ALIGNED_FOR_SIFDMA; buf[0] = entry; sceSifCallRpc(&sd_client, PS2SND_GetSwitch, 0, buf, 4, buf, 4, NULL, NULL); return(buf[0]); @@ -82,7 +82,7 @@ u32 sceSdGetSwitch(u16 entry) void sceSdSetAddr(u16 entry, u32 value) { - u32 buf[2] ALIGNED(64); + u32 buf[2] ALIGNED_FOR_SIFDMA; buf[0] = entry; buf[1] = value; sceSifCallRpc(&sd_client, PS2SND_SetAddr, 0, buf, 8, NULL, 0, NULL, NULL); @@ -90,7 +90,7 @@ void sceSdSetAddr(u16 entry, u32 value) u32 sceSdGetAddr(u16 entry) { - u32 buf[1] ALIGNED(64); + u32 buf[1] ALIGNED_FOR_SIFDMA; buf[0] = entry; sceSifCallRpc(&sd_client, PS2SND_GetAddr, 0, buf, 4, buf, 4, NULL, NULL); return(buf[0]); @@ -98,7 +98,7 @@ u32 sceSdGetAddr(u16 entry) void sceSdSetCoreAttr(u16 entry, u16 value) { - u32 buf[2] ALIGNED(64); + u32 buf[2] ALIGNED_FOR_SIFDMA; buf[0] = entry; buf[1] = value; sceSifCallRpc(&sd_client, PS2SND_SetCoreAttr, 0, buf, 8, NULL, 0, NULL, NULL); @@ -106,7 +106,7 @@ void sceSdSetCoreAttr(u16 entry, u16 value) u16 sceSdGetCoreAttr(u16 entry) { - u32 buf[1] ALIGNED(64); + u32 buf[1] ALIGNED_FOR_SIFDMA; buf[0] = entry; sceSifCallRpc(&sd_client, PS2SND_GetCoreAttr, 0, buf, 4, buf, 4, NULL, NULL); return(buf[0]); @@ -157,7 +157,7 @@ int sceSdProcBatchEx(const sceSdBatch* batch, u32 returns[], u32 num, u32 voice) int sceSdVoiceTrans(s16 channel, u16 mode, u8 *m_addr, u32 *s_addr, u32 size) { - u32 buf[5] ALIGNED(64); + u32 buf[5] ALIGNED_FOR_SIFDMA; ((s32 *)buf)[0] = channel; buf[1] = mode; buf[2] = (u32)m_addr; @@ -180,7 +180,7 @@ int sceSdBlockTrans(s16 channel, u16 mode, u8 *m_addr, u32 size, ...) u32 sceSdVoiceTransStatus (s16 channel, s16 flag) { - s32 buf[2] ALIGNED(64); + s32 buf[2] ALIGNED_FOR_SIFDMA; buf[0] = channel; buf[1] = flag; @@ -190,7 +190,7 @@ u32 sceSdVoiceTransStatus (s16 channel, s16 flag) u32 sceSdBlockTransStatus (s16 channel, s16 flag) { - s32 buf[2] ALIGNED(64); + s32 buf[2] ALIGNED_FOR_SIFDMA; buf[0] = channel; buf[1] = flag; @@ -203,7 +203,7 @@ u32 sceSdBlockTransStatus (s16 channel, s16 flag) int sceSdSetEffectAttr (int core, const sceSdEffectAttr *attr) { - s32 buf[1+((sizeof(sceSdEffectAttr)+3)/4)] ALIGNED(64); + s32 buf[1+((sizeof(sceSdEffectAttr)+3)/4)] ALIGNED_FOR_SIFDMA; buf[0] = core; memcpy(&buf[1], attr, sizeof(sceSdEffectAttr)); sceSifCallRpc(&sd_client, PS2SND_SetEffectAttr, 0, buf, 4+sizeof(sceSdEffectAttr), buf, 4, NULL, NULL); @@ -212,7 +212,7 @@ int sceSdSetEffectAttr (int core, const sceSdEffectAttr *attr) void sceSdGetEffectAttr (int core, sceSdEffectAttr *attr) { - s32 buf[((sizeof(sceSdEffectAttr)+3)/4)] ALIGNED(64); + s32 buf[((sizeof(sceSdEffectAttr)+3)/4)] ALIGNED_FOR_SIFDMA; buf[0] = core; sceSifCallRpc(&sd_client, PS2SND_GetEffectAttr, 0, buf, 4, buf, sizeof(sceSdEffectAttr), NULL, NULL); memcpy(attr, buf, sizeof(sceSdEffectAttr)); @@ -220,7 +220,7 @@ void sceSdGetEffectAttr (int core, sceSdEffectAttr *attr) int sceSdClearEffectWorkArea (int core, int channel, int effect_mode) { - s32 buf[3] ALIGNED(64); + s32 buf[3] ALIGNED_FOR_SIFDMA; buf[0] = core; buf[1] = channel; buf[2] = effect_mode; @@ -231,14 +231,14 @@ int sceSdClearEffectWorkArea (int core, int channel, int effect_mode) u32 sndQueryMaxFreeMemSize(void) { - u32 buf[1] ALIGNED(64); + u32 buf[1] ALIGNED_FOR_SIFDMA; sceSifCallRpc(&sd_client, PS2SND_QueryMaxFreeMemSize, 0, NULL, 0, buf, 4, NULL, NULL); return(buf[0]); } int sndStreamOpen(char *file, u32 voices, u32 flags, u32 bufaddr, u32 bufsize) { - u32 buf[32] ALIGNED(64); + u32 buf[32] ALIGNED_FOR_SIFDMA; buf[0] = voices; buf[1] = flags; buf[2] = bufaddr; @@ -253,14 +253,14 @@ int sndStreamOpen(char *file, u32 voices, u32 flags, u32 bufaddr, u32 bufsize) int sndStreamClose(void) { - s32 buf[1] ALIGNED(64); + s32 buf[1] ALIGNED_FOR_SIFDMA; sceSifCallRpc(&sd_client, PS2SND_StreamClose, 0, NULL, 0, buf, 4, NULL, NULL); return(buf[0]); } int sndStreamPlay(void) { - s32 buf[1] ALIGNED(64); + s32 buf[1] ALIGNED_FOR_SIFDMA; sceSifCallRpc(&sd_client, PS2SND_StreamPlay, 0, NULL, 0, buf, 4, NULL, NULL); return(buf[0]); } @@ -268,14 +268,14 @@ int sndStreamPlay(void) int sndStreamPause(void) { - s32 buf[1] ALIGNED(64); + s32 buf[1] ALIGNED_FOR_SIFDMA; sceSifCallRpc(&sd_client, PS2SND_StreamPause, 0, NULL, 0, buf, 4, NULL, NULL); return(buf[0]); } int sndStreamSetPosition(int block) { - s32 buf[1] ALIGNED(64); + s32 buf[1] ALIGNED_FOR_SIFDMA; buf[0] = block; sceSifCallRpc(&sd_client, PS2SND_StreamSetPosition, 0, buf, 4, buf, 4, NULL, NULL); return(buf[0]); @@ -283,7 +283,7 @@ int sndStreamSetPosition(int block) int sndStreamSetVolume(int left, int right) { - s32 buf[2] ALIGNED(64); + s32 buf[2] ALIGNED_FOR_SIFDMA; buf[0] = left; buf[1] = right; sceSifCallRpc(&sd_client, PS2SND_StreamSetVolume, 0, buf, 8, buf, 4, NULL, NULL); @@ -292,7 +292,7 @@ int sndStreamSetVolume(int left, int right) int sndStreamGetPosition(void) { - s32 buf[1] ALIGNED(64); + s32 buf[1] ALIGNED_FOR_SIFDMA; sceSifCallRpc(&sd_client, PS2SND_StreamGetPosition, 0, NULL, 0, buf, 4, NULL, NULL); return(buf[0]); } diff --git a/ee/rpc/remote/samples/remote.c b/ee/rpc/remote/samples/remote.c index e503ae6aa0f6..48797c1f57e8 100644 --- a/ee/rpc/remote/samples/remote.c +++ b/ee/rpc/remote/samples/remote.c @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) /* Buffers for receiving input from remote controllers. A 256-byte region is required for each possible remote. Buffers must be each aligned to a 64-byte boundary due to how the EE data cache works. */ - static u8 rmData[256] __attribute__((aligned(64))); + static u8 rmData[256] ALIGNED_FOR_SIFDMA; struct remote_data data, olddata; int startY, wrap; ee_sema_t sema; diff --git a/ee/rpc/remote/src/librm.c b/ee/rpc/remote/src/librm.c index fcc329a2b16e..6a0485e2f392 100644 --- a/ee/rpc/remote/src/librm.c +++ b/ee/rpc/remote/src/librm.c @@ -21,8 +21,8 @@ #include #include "librm.h" -static SifRpcClientData_t rmmanif __attribute__((aligned(64))); -static struct rmRpcPacket buffer __attribute__((aligned(64))); +static SifRpcClientData_t rmmanif; +static struct rmRpcPacket buffer; static int rmman_type; struct port_state @@ -71,7 +71,7 @@ int RMMan_Init(void) } { - SifRpcClientData_t rpciftmp[3] __attribute__((aligned(64))); + SifRpcClientData_t rpciftmp[3]; int rpc_ids[3] = { RMMANX_RPC_ID, RMMAN2_RPC_ID, diff --git a/ee/rpc/secr/src/libsecr.c b/ee/rpc/secr/src/libsecr.c index 7bbfcddd30ae..88a7cbedf7b0 100644 --- a/ee/rpc/secr/src/libsecr.c +++ b/ee/rpc/secr/src/libsecr.c @@ -15,7 +15,7 @@ static SifRpcClientData_t SifRpcClient05; static SifRpcClientData_t SifRpcClient06; static SifRpcClientData_t SifRpcClient07; -static unsigned char RpcBuffer[0x1000] ALIGNED(64); +static unsigned char RpcBuffer[0x1000] ALIGNED_FOR_SIFDMA; #define _printf(args...) // printf(args) diff --git a/ee/rpc/sior/src/sior_rpc.c b/ee/rpc/sior/src/sior_rpc.c index dc13de7d2303..86414dc7fa49 100644 --- a/ee/rpc/sior/src/sior_rpc.c +++ b/ee/rpc/sior/src/sior_rpc.c @@ -24,9 +24,9 @@ #include #include "sior_rpc.h" -static SifRpcDataQueue_t qd __attribute__((aligned(64))); -static SifRpcServerData_t Sd0 __attribute__((aligned(64))); -static u32 buffer[32] __attribute__((__aligned__(64))); +static SifRpcDataQueue_t qd; +static SifRpcServerData_t Sd0; +static u32 buffer[32] ALIGNED_FOR_SIFDMA; /** EE mapped IOP mem */ #define IOP_MEM 0xbc000000 diff --git a/ee/rpc/tcpips/src/ps2ipc.c b/ee/rpc/tcpips/src/ps2ipc.c index d51b9b25ce3b..2da5eaac54a2 100644 --- a/ee/rpc/tcpips/src/ps2ipc.c +++ b/ee/rpc/tcpips/src/ps2ipc.c @@ -48,8 +48,8 @@ static struct { u8 numdns; u8 buffer[512]; }; -} _rpc_buffer __attribute__((aligned(64))); -static int _intr_data[32] __attribute__((aligned(64))); +} _rpc_buffer ALIGNED_FOR_SIFDMA; +static int _intr_data[32] ALIGNED_FOR_SIFDMA; static ip_addr_t dns_servers[DNS_MAX_SERVERS]; diff --git a/ee/sbv/src/common.c b/ee/sbv/src/common.c index 2441a0c3a258..399f1f45499f 100644 --- a/ee/sbv/src/common.c +++ b/ee/sbv/src/common.c @@ -21,7 +21,7 @@ #include "common.h" -struct smem_buf smem_buf ALIGNED(64); +struct smem_buf smem_buf; /* Do not link to memcmp() from libc, so we only depend on libkernel. */ int __memcmp(const void *s1, const void *s2, unsigned int length) diff --git a/ee/sbv/src/common.h b/ee/sbv/src/common.h index 1c662d72a405..9b79265b2fe9 100644 --- a/ee/sbv/src/common.h +++ b/ee/sbv/src/common.h @@ -1,3 +1,6 @@ + +#include + #define SMEM_BUF_SIZE 0x300 //Must be large enough to accommodate all operations. struct smem_buf { @@ -7,7 +10,7 @@ struct smem_buf { smod_mod_info_t mod_info; slib_exp_lib_t exp_lib; }; -}; +} ALIGNED_FOR_SIFDMA; extern int smem_write_word(void *address, u32 value); extern int __memcmp(const void *s1, const void *s2, unsigned int length); diff --git a/ee/sbv/src/patch_disable_prefix_check.c b/ee/sbv/src/patch_disable_prefix_check.c index a7fd43b84ede..28255abd8b16 100644 --- a/ee/sbv/src/patch_disable_prefix_check.c +++ b/ee/sbv/src/patch_disable_prefix_check.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "slib.h" @@ -32,7 +33,7 @@ int sbv_patch_disable_prefix_check(void) u8 buf[256]; slib_exp_lib_t exp_lib; } buf; - static u32 patch[sizeof(g_patch)/sizeof(g_patch[0])] ALIGNED(16); + static u32 patch[sizeof(g_patch)/sizeof(g_patch[0])] ALIGNED_FOR_SIFDMA; SifDmaTransfer_t dmat; slib_exp_lib_t *modload_lib = &buf.exp_lib; diff --git a/ee/sbv/src/patch_enable_lmb.c b/ee/sbv/src/patch_enable_lmb.c index 6ff3fd858719..c230ea09317b 100644 --- a/ee/sbv/src/patch_enable_lmb.c +++ b/ee/sbv/src/patch_enable_lmb.c @@ -70,7 +70,7 @@ int sbv_patch_enable_lmb(void) /* This is the routine called by the loadfile RPC dispatcher for LoadModuleBuffer over RPC (call #6). The bracketed operands are the ones patched by the real locations in IOP memory before being installed onto the IOP. */ - static u32 lmb_patch[sizeof(g_lmb_patch)] ALIGNED(16); + static u32 lmb_patch[sizeof(g_lmb_patch)] ALIGNED_FOR_SIFDMA; u8 buf[256]; SifRpcReceiveData_t RData; slib_exp_lib_t *modload_lib = (slib_exp_lib_t *)buf; diff --git a/ee/sbv/src/patch_fileio.c b/ee/sbv/src/patch_fileio.c index 647bf32efd50..face969ca4e9 100644 --- a/ee/sbv/src/patch_fileio.c +++ b/ee/sbv/src/patch_fileio.c @@ -53,7 +53,7 @@ int sbv_patch_fileio(void) smod_mod_info_t mod_info; SifDmaTransfer_t dmat; - static u32 new_fileio[sizeof(g_new_fileio)/sizeof(g_new_fileio[0])] ALIGNED(16); + static u32 new_fileio[sizeof(g_new_fileio)/sizeof(g_new_fileio[0])] ALIGNED_FOR_SIFDMA; u32 *p_new_fileio; u32 new_jump_op; void *patch_addr; diff --git a/iop/debug/sior/src/sior.c b/iop/debug/sior/src/sior.c index 5e65e3350667..82c047cd15de 100644 --- a/iop/debug/sior/src/sior.c +++ b/iop/debug/sior/src/sior.c @@ -24,7 +24,7 @@ IRX_ID("sioremote_driver", 1, 1); extern struct irx_export_table _exp_sior; -static struct t_SifRpcClientData cd0; +static SifRpcClientData_t cd0; static union siorCommsData buffer; static char tbuf[2048]; diff --git a/iop/debug/sior/src/xprintf.c b/iop/debug/sior/src/xprintf.c index c7ec1ffd7e89..3fe55afdcaad 100644 --- a/iop/debug/sior/src/xprintf.c +++ b/iop/debug/sior/src/xprintf.c @@ -1042,7 +1042,7 @@ static int npm_puts_init() int npmPuts(const char *buf) { - u8 puts_buf[512]; /* Implicitly aligned. */ + u8 puts_buf[512] ALIGNED_FOR_SIFDMA; void *p = puts_buf; if (npm_puts_init() < 0) diff --git a/iop/dev9/poweroff/src/poweroff.c b/iop/dev9/poweroff/src/poweroff.c index 88deeec73ca8..d16cbe49b717 100644 --- a/iop/dev9/poweroff/src/poweroff.c +++ b/iop/dev9/poweroff/src/poweroff.c @@ -70,8 +70,8 @@ struct CallbackEntry static char cmdData[16]; static pwoffcb poweroff_button_cb = 0; static void *poweroff_button_data = 0; -static struct t_SifRpcDataQueue qd; -static struct t_SifRpcServerData sd0; +static SifRpcDataQueue_t qd; +static SifRpcServerData_t sd0; static int PowerOffThreadID = -1; static SifRpcClientData_t client; diff --git a/iop/fs/fakehost/src/nprintf.c b/iop/fs/fakehost/src/nprintf.c index 66d7811faa83..217c2f76e53b 100644 --- a/iop/fs/fakehost/src/nprintf.c +++ b/iop/fs/fakehost/src/nprintf.c @@ -44,9 +44,9 @@ static void *naplinkRpcHandler(int cmd, void *buffer, int size) } //////////////////////////////////////////////////////////////////////// -static SifRpcServerData_t server __attribute((aligned(16))); -static SifRpcDataQueue_t queue __attribute((aligned(16))); -static unsigned char rpc_buffer[512] __attribute__((__aligned__(4))); +static SifRpcServerData_t server; +static SifRpcDataQueue_t queue; +static unsigned char rpc_buffer[512] ALIGNED_FOR_SIFDMA; /** naplink compatbile RPC handler thread. * @ingroup fakehost diff --git a/iop/fs/fileio/src/fileio.c b/iop/fs/fileio/src/fileio.c index 2c46cd4575af..bdf862a1b458 100644 --- a/iop/fs/fileio/src/fileio.c +++ b/iop/fs/fileio/src/fileio.c @@ -26,10 +26,10 @@ IRX_ID(MODNAME, 1, 1); #endif -static struct _fio_read_data read_data_out __attribute__((aligned(16))); +static struct _fio_read_data read_data_out; static void *xfer_buffer; static int xfer_size; -static int fileio_rpc_tmpbuf[0x4c] __attribute__((aligned(16))); +static int fileio_rpc_tmpbuf[0x4c] ALIGNED_FOR_SIFDMA; static void fileio_rpc_start_thread(void *param); static void heap_rpc_start_thread(void *param); @@ -436,7 +436,7 @@ static void fileio_rpc_chstat(struct _fio_chstat_arg *buffer, int length, int *o *outbuffer = io_chstat(buffer->name, &buffer->stat, buffer->p.cbit); } -static int fileio_rpc_outbuf[0x4] __attribute__((aligned(16))); +static int fileio_rpc_outbuf[0x4] ALIGNED_FOR_SIFDMA; static int *fileio_rpc_service_handler(int fno, void *buffer, int length) { @@ -500,9 +500,9 @@ static int *fileio_rpc_service_handler(int fno, void *buffer, int length) return fileio_rpc_outbuf; } -static SifRpcDataQueue_t fileio_rpc_service_queue __attribute__((aligned(16))); -static SifRpcServerData_t fileio_rpc_service_data __attribute__((aligned(16))); -static int fileio_rpc_service_in_buf[0x112] __attribute__((aligned(16))); +static SifRpcDataQueue_t fileio_rpc_service_queue; +static SifRpcServerData_t fileio_rpc_service_data; +static int fileio_rpc_service_in_buf[0x112] ALIGNED_FOR_SIFDMA; static void fileio_rpc_start_thread(void *param) { @@ -554,7 +554,7 @@ static void heap_rpc_free_iop_heap(void **buffer, int length, int *outbuffer) *outbuffer = FreeSysMemory(*buffer); } -static int heap_rpc_outbuf[0x4] __attribute__((aligned(16))); +static int heap_rpc_outbuf[0x4] ALIGNED_FOR_SIFDMA; static int *heap_rpc_service_handler(int fno, void *buffer, int length) { @@ -575,9 +575,9 @@ static int *heap_rpc_service_handler(int fno, void *buffer, int length) return heap_rpc_outbuf; } -static SifRpcDataQueue_t heap_rpc_service_queue __attribute__((aligned(16))); -static SifRpcServerData_t heap_rpc_service_data __attribute__((aligned(16))); -static int heap_rpc_service_in_buf[0x40] __attribute__((aligned(16))); +static SifRpcDataQueue_t heap_rpc_service_queue; +static SifRpcServerData_t heap_rpc_service_data; +static int heap_rpc_service_in_buf[0x40] ALIGNED_FOR_SIFDMA; static void heap_rpc_start_thread(void *param) { @@ -609,7 +609,7 @@ static void iopinfo_rpc_querybootmode(void *buffer, int length, int *outbuffer) *outbuffer = (BootMode != 0) ? (*(u16 *)BootMode & 0xFFFC) : 0x800; } -static int iopinfo_rpc_outbuf[0x4] __attribute__((aligned(16))); +static int iopinfo_rpc_outbuf[0x4] ALIGNED_FOR_SIFDMA; static int *iopinfo_rpc_service_handler(int fno, void *buffer, int length) { @@ -624,9 +624,9 @@ static int *iopinfo_rpc_service_handler(int fno, void *buffer, int length) return iopinfo_rpc_outbuf; } -static SifRpcDataQueue_t iopinfo_rpc_service_queue __attribute__((aligned(16))); -static SifRpcServerData_t iopinfo_rpc_service_data __attribute__((aligned(16))); -static int iopinfo_rpc_service_in_buf[0x10] __attribute__((aligned(16))); +static SifRpcDataQueue_t iopinfo_rpc_service_queue; +static SifRpcServerData_t iopinfo_rpc_service_data; +static int iopinfo_rpc_service_in_buf[0x10] ALIGNED_FOR_SIFDMA; static void iopinfo_rpc_service_start_thread(void *param) { diff --git a/iop/fs/filexio/src/fileXio_iop.c b/iop/fs/filexio/src/fileXio_iop.c index ce35588247dd..b881907d2c71 100644 --- a/iop/fs/filexio/src/fileXio_iop.c +++ b/iop/fs/filexio/src/fileXio_iop.c @@ -54,9 +54,9 @@ static unsigned int RWBufferSize=DEFAULT_RWSIZE; // 0x4800 bytes for DirEntry structures // 0x400 bytes for the filename string -static unsigned char fileXio_rpc_buffer[0x4C00] __attribute__((__aligned__(4))); // RPC send/receive buffer -struct t_SifRpcDataQueue qd; -struct t_SifRpcServerData sd0; +static unsigned char fileXio_rpc_buffer[0x4C00] ALIGNED_FOR_SIFDMA; // RPC send/receive buffer +SifRpcDataQueue_t qd; +SifRpcServerData_t sd0; static rests_pkt rests; @@ -155,7 +155,7 @@ static int fileXio_GetDeviceList_RPC(struct fileXioDevice* ee_devices, int eecou } if (device_count) { - struct t_SifDmaTransfer dmaStruct; + SifDmaTransfer_t dmaStruct; int intStatus; // interrupt status - for dis/en-abling interrupts dmaStruct.src = local_devices; @@ -214,7 +214,7 @@ static int fileXio_Read_RPC(int infd, char *read_buf, int read_size, void *intr_ int total; int readlen; int status; - struct t_SifDmaTransfer dmaStruct; + SifDmaTransfer_t dmaStruct; void *buffer; void *aebuffer; int intStatus; // interrupt status - for dis/en-abling interrupts @@ -353,7 +353,7 @@ static int fileXio_GetDir_RPC(const char* pathname, struct fileXioDirEntry dirEn iox_dirent_t dirbuf; struct fileXioDirEntry localDirEntry; int intStatus; // interrupt status - for dis/en-abling interrupts - struct t_SifDmaTransfer dmaStruct; + SifDmaTransfer_t dmaStruct; M_DEBUG("GetDir Request '%s'\n",pathname); @@ -434,7 +434,7 @@ static int fileXio_getstat_RPC(char *filename, void* eeptr) { iox_stat_t localStat; int res = 0; - struct t_SifDmaTransfer dmaStruct; + SifDmaTransfer_t dmaStruct; int intStatus; // interrupt status - for dis/en-abling interrupts res = iomanX_getstat(filename, &localStat); @@ -460,7 +460,7 @@ static int fileXio_dread_RPC(int fd, void* eeptr) { int res=0; iox_dirent_t localDir; - struct t_SifDmaTransfer dmaStruct; + SifDmaTransfer_t dmaStruct; int intStatus; // interrupt status - for dis/en-abling interrupts res = iomanX_dread(fd, &localDir); diff --git a/iop/input/padman/src/freepad.h b/iop/input/padman/src/freepad.h index e3dff1658131..6d5197c71151 100644 --- a/iop/input/padman/src/freepad.h +++ b/iop/input/padman/src/freepad.h @@ -14,6 +14,7 @@ #include "irx.h" #include "types.h" +#include #define MODNAME "freepad" #define M_PRINTF(format, args...) printf(MODNAME ": " format, ## args) @@ -157,8 +158,8 @@ typedef struct typedef struct { - ee_paddata_t ee_pdata __attribute__((aligned(4))); - ee_old_paddata_t ee_old_pdata __attribute__((aligned(4))); + ee_paddata_t ee_pdata ALIGNED_FOR_SIFDMA; + ee_old_paddata_t ee_old_pdata ALIGNED_FOR_SIFDMA; u8 modeConfig; u8 modeCurId; u8 model; diff --git a/iop/input/padman/src/padInit.c b/iop/input/padman/src/padInit.c index dd8030434081..39a88298eb0e 100644 --- a/iop/input/padman/src/padInit.c +++ b/iop/input/padman/src/padInit.c @@ -29,7 +29,7 @@ int pad_slot; u32 mainThreadCount2; u32 pad_portdata[2]; /* It is very important that sif_buffer and padState are right after each other. */ -u32 sif_buffer[4] __attribute__((aligned(4))); +u32 sif_buffer[4] ALIGNED_FOR_SIFDMA; padState_t padState[2][4]; u32 openSlots[2]; vblankData_t vblankData; diff --git a/iop/input/padman/src/rpcserver.c b/iop/input/padman/src/rpcserver.c index 10c7d23dd24a..17a7087dadd3 100644 --- a/iop/input/padman/src/rpcserver.c +++ b/iop/input/padman/src/rpcserver.c @@ -67,13 +67,13 @@ enum PAD_RPCCMD { static s32 ThreadIdRpcServer; static SifRpcDataQueue_t qd; static SifRpcServerData_t sd[2]; -static u32 sb[2][32] __attribute__((__aligned__(4))); // server buffer +static u32 sb[2][32] ALIGNED_FOR_SIFDMA; // server buffer // RPC Server Extended static s32 ThreadIdRpcServerExt; static SifRpcDataQueue_t qdext; static SifRpcServerData_t sdext[2]; -static u32 sbext[2][32] __attribute__((__aligned__(4))); // server buffer +static u32 sbext[2][32] ALIGNED_FOR_SIFDMA; // server buffer static void* RpcPadOpen(u32 *data) { diff --git a/iop/input/rmman/src/rmman.c b/iop/input/rmman/src/rmman.c index 3ee2a979b0e7..649867956e00 100644 --- a/iop/input/rmman/src/rmman.c +++ b/iop/input/rmman/src/rmman.c @@ -122,7 +122,7 @@ static int IsInitialized; static int RpcThreadID; static SifRpcDataQueue_t RpcDataQueue; static SifRpcServerData_t RpcServerData; -static struct rmRpcPacket RpcDataBuffer __attribute__((__aligned__(4))); +static struct rmRpcPacket RpcDataBuffer; static int CreateMainThread(void); static void MainThread(void *arg); diff --git a/iop/memorycard/mcserv/src/mcserv.c b/iop/memorycard/mcserv/src/mcserv.c index 77a3903382d2..b71c6ffc8bbd 100644 --- a/iop/memorycard/mcserv/src/mcserv.c +++ b/iop/memorycard/mcserv/src/mcserv.c @@ -19,14 +19,14 @@ IRX_ID(MODNAME, 2, 8); static int mcserv_tidS_0400; static int mcserv_in_rpc_0400 = 0; -static SifRpcDataQueue_t mcserv_qdS_0400 __attribute__((aligned(16))); -static SifRpcServerData_t mcserv_sdS_0400 __attribute__((aligned(16))); +static SifRpcDataQueue_t mcserv_qdS_0400; +static SifRpcServerData_t mcserv_sdS_0400; -static u8 mcserv_rpc_buf[2048] __attribute__((__aligned__(4))); -static mcRpcStat_t rpc_stat __attribute__((aligned(16))); +static u8 mcserv_rpc_buf[2048] ALIGNED_FOR_SIFDMA; +static mcRpcStat_t rpc_stat ALIGNED_FOR_SIFDMA; #define MCSERV_BUFSIZE 8192 -static u8 mcserv_buf[MCSERV_BUFSIZE] __attribute__((aligned(16))); +static u8 mcserv_buf[MCSERV_BUFSIZE] ALIGNED_FOR_SIFDMA; #ifdef BUILDING_XFROMSERV #define MCSERV_RPC_ID 0x80000480 diff --git a/iop/network/netcnfif/src/netcnfif.c b/iop/network/netcnfif/src/netcnfif.c index deae165cd975..c99ebcdd0c61 100644 --- a/iop/network/netcnfif/src/netcnfif.c +++ b/iop/network/netcnfif/src/netcnfif.c @@ -15,18 +15,16 @@ IRX_ID("Netcnf_Interface", 2, 30); #endif // Based on the module from SCE SDK 3.1.0. -// TODO EE alignment 64 -typedef struct __attribute__((aligned(16))) sceNetcnfifList +typedef struct sceNetcnfifList { int type; int stat; char sys_name[256]; char usr_name[256]; int padding[14]; -} sceNetcnfifList_t; +} ALIGNED_FOR_SIFDMA sceNetcnfifList_t; -// TODO EE alignment 64 -typedef struct __attribute__((aligned(16))) sceNetcnfifData +typedef struct sceNetcnfifData { char attach_ifc[256]; char attach_dev[256]; @@ -68,7 +66,7 @@ typedef struct __attribute__((aligned(16))) sceNetcnfifData u8 p2; u8 p3; int p4[5]; -} sceNetcnfifData_t; +} ALIGNED_FOR_SIFDMA sceNetcnfifData_t; typedef struct sceNetcnfifArg { diff --git a/iop/network/netman/src/rpc_server.c b/iop/network/netman/src/rpc_server.c index 9fa603af5543..a76f8e84865f 100644 --- a/iop/network/netman/src/rpc_server.c +++ b/iop/network/netman/src/rpc_server.c @@ -17,7 +17,7 @@ /* Data used for registering the RPC server. */ static SifRpcServerData_t rpc_sdata; -static unsigned char rpc_buffer[80] __attribute__((__aligned__(4))); +static unsigned char rpc_buffer[80] ALIGNED_FOR_SIFDMA; static SifRpcDataQueue_t rpc_qdata; static union{ diff --git a/iop/sio/mtapman/src/rpcservers.c b/iop/sio/mtapman/src/rpcservers.c index d769a36f3907..74f74358dc43 100644 --- a/iop/sio/mtapman/src/rpcservers.c +++ b/iop/sio/mtapman/src/rpcservers.c @@ -24,7 +24,7 @@ #define MTAPSERV_CHANGE_SLOT 0x800009FF -static u32 sb[4] __attribute__((__aligned__(4))); // Server buffer +static u32 sb[4] ALIGNED_FOR_SIFDMA; // Server buffer static s32 threadid_rpc1; static SifRpcDataQueue_t qd1; diff --git a/iop/sound/ahx/src/ahx_irx.c b/iop/sound/ahx/src/ahx_irx.c index 0cf878e03a06..16941f9a825a 100644 --- a/iop/sound/ahx/src/ahx_irx.c +++ b/iop/sound/ahx/src/ahx_irx.c @@ -58,7 +58,7 @@ SifRpcDataQueue_t qd; SifRpcServerData_t Sd0; extern void wmemcpy(void *dest, void *src, int numwords); -static unsigned int buffer[0x80] __attribute__((__aligned__(4))); +static unsigned int buffer[0x80] ALIGNED_FOR_SIFDMA; // function prototypes void AHX_Thread(void *param); diff --git a/iop/sound/audsrv/src/adpcm.c b/iop/sound/audsrv/src/adpcm.c index d42cd81bfae5..b7dbb77ebc72 100644 --- a/iop/sound/audsrv/src/adpcm.c +++ b/iop/sound/audsrv/src/adpcm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "audsrv_internal.h" @@ -43,7 +44,7 @@ typedef struct adpcm_list_t static adpcm_list_t *adpcm_list_head = 0; static adpcm_list_t *adpcm_list_tail = 0; -static u32 sbuffer[16] __attribute__((aligned(16))); +static u32 sbuffer[16] ALIGNED_FOR_SIFDMA; /** Allocates memory for a new sample. */ static adpcm_list_t *alloc_new_sample(void) diff --git a/iop/sound/audsrv/src/rpc_server.c b/iop/sound/audsrv/src/rpc_server.c index 993dfda10acf..e34573b4a98d 100755 --- a/iop/sound/audsrv/src/rpc_server.c +++ b/iop/sound/audsrv/src/rpc_server.c @@ -28,7 +28,7 @@ /* rpc server variables */ /** buffer for RPC DMA */ -static int rpc_buffer[18000/4] __attribute__((__aligned__(4))); +static int rpc_buffer[18000/4] ALIGNED_FOR_SIFDMA; /** RPC thread variables */ static SifRpcDataQueue_t qd; /** RPC thread variables */ diff --git a/iop/sound/ps2snd/src/ps2snd.c b/iop/sound/ps2snd/src/ps2snd.c index 50306360af57..f1b7549f1a06 100644 --- a/iop/sound/ps2snd/src/ps2snd.c +++ b/iop/sound/ps2snd/src/ps2snd.c @@ -27,7 +27,7 @@ int debug_level = OUT_WARNING; static SifRpcDataQueue_t queue; static SifRpcServerData_t server; -static u32 rpc_buffer[2][32] __attribute__((__aligned__(4))); /* XXX: how big should this be? */ +static u32 rpc_buffer[2][32] ALIGNED_FOR_SIFDMA; /* XXX: how big should this be? */ #define DS ((u32*)data) diff --git a/iop/system/loadfile/src/loadfile.c b/iop/system/loadfile/src/loadfile.c index 1bbe9749fa76..e41d2a56d1f6 100644 --- a/iop/system/loadfile/src/loadfile.c +++ b/iop/system/loadfile/src/loadfile.c @@ -264,7 +264,7 @@ static int *loadfile_get_version(void *in_packet, int length, int *outbuffer) return outbuffer; } -static int loadfile_rpc_outbuf[0x4] __attribute__((aligned(16))); +static int loadfile_rpc_outbuf[0x4] ALIGNED_FOR_SIFDMA; static int *loadfile_rpc_service_handler(int fno, void *buffer, int length) { @@ -300,9 +300,9 @@ static int *loadfile_rpc_service_handler(int fno, void *buffer, int length) } } -static SifRpcDataQueue_t loadfile_rpc_service_queue __attribute__((aligned(16))); -static SifRpcServerData_t loadfile_rpc_service_data __attribute__((aligned(16))); -static int loadfile_rpc_service_in_buf[0x112] __attribute__((aligned(16))); +static SifRpcDataQueue_t loadfile_rpc_service_queue; +static SifRpcServerData_t loadfile_rpc_service_data; +static int loadfile_rpc_service_in_buf[0x112] ALIGNED_FOR_SIFDMA; static void loadfile_rpc_service_thread(void *param) { diff --git a/iop/system/sifcmd/src/sifcmd.c b/iop/system/sifcmd/src/sifcmd.c index 15954909c39a..52dc808acec4 100644 --- a/iop/system/sifcmd/src/sifcmd.c +++ b/iop/system/sifcmd/src/sifcmd.c @@ -33,7 +33,7 @@ typedef struct sif_cmd_data_ void *sif_1_callback_userdata; SifCmdSysHandlerData_t sys_cmd_handler_handler[32]; unsigned int sregs[32]; -} __attribute__((aligned(16))) sif_cmd_data_t; +} ALIGNED_FOR_SIFDMA sif_cmd_data_t; typedef struct t_SifCmdChgAddrData { @@ -42,8 +42,8 @@ typedef struct t_SifCmdChgAddrData } SifCmdChgAddrData_t; static sif_cmd_data_t sif_cmd_data; -static u8 sif_iop_recvbuf[0x80] __attribute__((aligned(16))); -static u8 sif_unused[0x40] __attribute__((aligned(16))); +static u8 sif_iop_recvbuf[0x80] ALIGNED_FOR_SIFDMA; +static u8 sif_unused[0x40] ALIGNED_FOR_SIFDMA; static int sif_cmd_int_handler(void *userdata); diff --git a/iop/system/sifcmd/src/sifrpc.c b/iop/system/sifcmd/src/sifrpc.c index bae86e33c2b5..228a7e696d6b 100644 --- a/iop/system/sifcmd/src/sifrpc.c +++ b/iop/system/sifcmd/src/sifrpc.c @@ -26,13 +26,13 @@ typedef struct sif_rpc_data_ SifRpcDataQueue_t *active_queue; int sif_rpc_sema_ef; int used_sema_bitfield; -} __attribute__((aligned(16))) sif_rpc_data_t; +} ALIGNED_FOR_SIFDMA sif_rpc_data_t; static sif_rpc_data_t sif_rpc_data; static u32 init = 0; -static u8 pkt_table[0x800] __attribute__((aligned(16))); -static u8 rdata_table[0x800] __attribute__((aligned(16))); -static u8 client_data[0x800] __attribute__((aligned(16))); +static u8 pkt_table[0x800] ALIGNED_FOR_SIFDMA; +static u8 rdata_table[0x800] ALIGNED_FOR_SIFDMA; +static u8 client_data[0x800] ALIGNED_FOR_SIFDMA; static void sif_cmd_handler_end(SifRpcRendPkt_t *data, sif_rpc_data_t *harg); static void sif_cmd_handler_bind(SifRpcBindPkt_t *data, sif_rpc_data_t *harg); diff --git a/iop/tcpip/tcpips/src/ps2ips.c b/iop/tcpip/tcpips/src/ps2ips.c index e893f722a703..1cb5c3262a85 100644 --- a/iop/tcpip/tcpips/src/ps2ips.c +++ b/iop/tcpip/tcpips/src/ps2ips.c @@ -44,7 +44,7 @@ IRX_ID(MODNAME, 1, 1); static SifRpcDataQueue_t ps2ips_queue; static SifRpcServerData_t ps2ips_server; -static u8 _rpc_buffer[512 * 4] __attribute__((__aligned__(4))); +static u8 _rpc_buffer[512 * 4] ALIGNED_FOR_SIFDMA; static char lwip_buffer[BUFF_SIZE + 32]; static rests_pkt rests; @@ -125,7 +125,7 @@ static void do_recv( void * rpcBuffer, int size ) int intr_stat; s_recv_pkt *recv_pkt = (s_recv_pkt *)rpcBuffer; r_recv_pkt *ret_pkt = (r_recv_pkt *)rpcBuffer; - struct t_SifDmaTransfer sifdma; + SifDmaTransfer_t sifdma; (void)size; @@ -219,7 +219,7 @@ static void do_recvfrom( void * rpcBuffer, int size ) int intr_stat; s_recv_pkt *recv_pkt = (s_recv_pkt *)rpcBuffer; r_recv_pkt *ret_pkt = (r_recv_pkt *)rpcBuffer; - static struct t_SifDmaTransfer sifdma; + static SifDmaTransfer_t sifdma; static struct sockaddr sockaddr; int fromlen; diff --git a/iop/usb/camera/src/ps2cam.c b/iop/usb/camera/src/ps2cam.c index 3b2c6decfc4e..3694518cb925 100644 --- a/iop/usb/camera/src/ps2cam.c +++ b/iop/usb/camera/src/ps2cam.c @@ -39,9 +39,9 @@ IRX_ID(MODNAME, 1, 1); #define MAX_CAM_DEVICE_HANDLE 2 -static SifRpcDataQueue_t rpc_queue __attribute__((__aligned__(16))); -static SifRpcServerData_t rpc_server __attribute__((__aligned__(16))); -static int _rpc_buffer[1024] __attribute__((__aligned__(4))); +static SifRpcDataQueue_t rpc_queue; +static SifRpcServerData_t rpc_server; +static int _rpc_buffer[1024] ALIGNED_FOR_SIFDMA; //static int threadId; static int maintain_thread; sceUsbdLddOps cam_driver = {NULL, @@ -54,7 +54,7 @@ sceUsbdLddOps cam_driver = {NULL, -char campacket[896] __attribute__((__aligned__(16))); +char campacket[896] ALIGNED_FOR_SIFDMA; char irx_initialized = 0; int ps2cam_sema=0; CAMERA_DEVICE Camera[MAX_CAM_DEVICE]; diff --git a/iop/usb/mouse/src/ps2mouse.c b/iop/usb/mouse/src/ps2mouse.c index 6d63d81a7bd7..d692415d60cc 100644 --- a/iop/usb/mouse/src/ps2mouse.c +++ b/iop/usb/mouse/src/ps2mouse.c @@ -46,9 +46,9 @@ IRX_ID(MODNAME, 1, 1); #define PS2MOUSE_DEFACCEL (1 << 16) #define PS2MOUSE_DEFTHRES 65536; -static SifRpcDataQueue_t ps2mouse_queue __attribute__((aligned(16))); -static SifRpcServerData_t ps2mouse_server __attribute__((aligned(16))); -static int _rpc_buffer[512] __attribute__((__aligned__(4))); +static SifRpcDataQueue_t ps2mouse_queue; +static SifRpcServerData_t ps2mouse_server; +static int _rpc_buffer[512] ALIGNED_FOR_SIFDMA; #define ABS(x) (x < 0 ? -x : x)