cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

sys32.S (7299B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * sys32.S: I-cache tricks for 32-bit compatibility layer simple
      4 *          conversions.
      5 *
      6 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
      7 * Copyright (C) 1998 Jakub Jelinek   (jj@ultra.linux.cz)
      8 */
      9
     10#include <asm/errno.h>
     11
     12/* NOTE: call as jump breaks return stack, we have to avoid that */
     13
     14	.text
     15
     16	.globl		sys32_mmap2
     17sys32_mmap2:
     18	sethi		%hi(sys_mmap), %g1
     19	jmpl		%g1 + %lo(sys_mmap), %g0
     20	 sllx		%o5, 12, %o5
     21
     22	.align		32
     23	.globl		sys32_socketcall
     24sys32_socketcall:	/* %o0=call, %o1=args */
     25	cmp		%o0, 1
     26	bl,pn		%xcc, do_einval
     27	 cmp		%o0, 18
     28	bg,pn		%xcc, do_einval
     29	 sub		%o0, 1, %o0
     30	sllx		%o0, 5, %o0
     31	sethi		%hi(__socketcall_table_begin), %g2
     32	or		%g2, %lo(__socketcall_table_begin), %g2
     33	jmpl		%g2 + %o0, %g0
     34	 nop
     35do_einval:
     36	retl
     37	 mov		-EINVAL, %o0
     38
     39	.align		32
     40__socketcall_table_begin:
     41
     42	/* Each entry is exactly 32 bytes. */
     43do_sys_socket: /* sys_socket(int, int, int) */
     441:	ldswa		[%o1 + 0x0] %asi, %o0
     45	sethi		%hi(sys_socket), %g1
     462:	ldswa		[%o1 + 0x8] %asi, %o2
     47	jmpl		%g1 + %lo(sys_socket), %g0
     483:	 ldswa		[%o1 + 0x4] %asi, %o1
     49	nop
     50	nop
     51	nop
     52do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */
     534:	ldswa		[%o1 + 0x0] %asi, %o0
     54	sethi		%hi(sys_bind), %g1
     555:	ldswa		[%o1 + 0x8] %asi, %o2
     56	jmpl		%g1 + %lo(sys_bind), %g0
     576:	 lduwa		[%o1 + 0x4] %asi, %o1
     58	nop
     59	nop
     60	nop
     61do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */
     627:	ldswa		[%o1 + 0x0] %asi, %o0
     63	sethi		%hi(sys_connect), %g1
     648:	ldswa		[%o1 + 0x8] %asi, %o2
     65	jmpl		%g1 + %lo(sys_connect), %g0
     669:	 lduwa		[%o1 + 0x4] %asi, %o1
     67	nop
     68	nop
     69	nop
     70do_sys_listen: /* sys_listen(int, int) */
     7110:	ldswa		[%o1 + 0x0] %asi, %o0
     72	sethi		%hi(sys_listen), %g1
     73	jmpl		%g1 + %lo(sys_listen), %g0
     7411:	 ldswa		[%o1 + 0x4] %asi, %o1
     75	nop
     76	nop
     77	nop
     78	nop
     79do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */
     8012:	ldswa		[%o1 + 0x0] %asi, %o0
     81	sethi		%hi(sys_accept), %g1
     8213:	lduwa		[%o1 + 0x8] %asi, %o2
     83	jmpl		%g1 + %lo(sys_accept), %g0
     8414:	 lduwa		[%o1 + 0x4] %asi, %o1
     85	nop
     86	nop
     87	nop
     88do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */
     8915:	ldswa		[%o1 + 0x0] %asi, %o0
     90	sethi		%hi(sys_getsockname), %g1
     9116:	lduwa		[%o1 + 0x8] %asi, %o2
     92	jmpl		%g1 + %lo(sys_getsockname), %g0
     9317:	 lduwa		[%o1 + 0x4] %asi, %o1
     94	nop
     95	nop
     96	nop
     97do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */
     9818:	ldswa		[%o1 + 0x0] %asi, %o0
     99	sethi		%hi(sys_getpeername), %g1
    10019:	lduwa		[%o1 + 0x8] %asi, %o2
    101	jmpl		%g1 + %lo(sys_getpeername), %g0
    10220:	 lduwa		[%o1 + 0x4] %asi, %o1
    103	nop
    104	nop
    105	nop
    106do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */
    10721:	ldswa		[%o1 + 0x0] %asi, %o0
    108	sethi		%hi(sys_socketpair), %g1
    10922:	ldswa		[%o1 + 0x8] %asi, %o2
    11023:	lduwa		[%o1 + 0xc] %asi, %o3
    111	jmpl		%g1 + %lo(sys_socketpair), %g0
    11224:	 ldswa		[%o1 + 0x4] %asi, %o1
    113	nop
    114	nop
    115do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */
    11625:	ldswa		[%o1 + 0x0] %asi, %o0
    117	sethi		%hi(sys_send), %g1
    11826:	lduwa		[%o1 + 0x8] %asi, %o2
    11927:	lduwa		[%o1 + 0xc] %asi, %o3
    120	jmpl		%g1 + %lo(sys_send), %g0
    12128:	 lduwa		[%o1 + 0x4] %asi, %o1
    122	nop
    123	nop
    124do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */
    12529:	ldswa		[%o1 + 0x0] %asi, %o0
    126	sethi		%hi(sys_recv), %g1
    12730:	lduwa		[%o1 + 0x8] %asi, %o2
    12831:	lduwa		[%o1 + 0xc] %asi, %o3
    129	jmpl		%g1 + %lo(sys_recv), %g0
    13032:	 lduwa		[%o1 + 0x4] %asi, %o1
    131	nop
    132	nop
    133do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
    13433:	ldswa		[%o1 + 0x0] %asi, %o0
    135	sethi		%hi(sys_sendto), %g1
    13634:	lduwa		[%o1 + 0x8] %asi, %o2
    13735:	lduwa		[%o1 + 0xc] %asi, %o3
    13836:	lduwa		[%o1 + 0x10] %asi, %o4
    13937:	ldswa		[%o1 + 0x14] %asi, %o5
    140	jmpl		%g1 + %lo(sys_sendto), %g0
    14138:	 lduwa		[%o1 + 0x4] %asi, %o1
    142do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
    14339:	ldswa		[%o1 + 0x0] %asi, %o0
    144	sethi		%hi(sys_recvfrom), %g1
    14540:	lduwa		[%o1 + 0x8] %asi, %o2
    14641:	lduwa		[%o1 + 0xc] %asi, %o3
    14742:	lduwa		[%o1 + 0x10] %asi, %o4
    14843:	lduwa		[%o1 + 0x14] %asi, %o5
    149	jmpl		%g1 + %lo(sys_recvfrom), %g0
    15044:	 lduwa		[%o1 + 0x4] %asi, %o1
    151do_sys_shutdown: /* sys_shutdown(int, int) */
    15245:	ldswa		[%o1 + 0x0] %asi, %o0
    153	sethi		%hi(sys_shutdown), %g1
    154	jmpl		%g1 + %lo(sys_shutdown), %g0
    15546:	 ldswa		[%o1 + 0x4] %asi, %o1
    156	nop
    157	nop
    158	nop
    159	nop
    160do_sys_setsockopt: /* sys_setsockopt(int, int, int, char *, int) */
    16147:	ldswa		[%o1 + 0x0] %asi, %o0
    162	sethi		%hi(sys_setsockopt), %g1
    16348:	ldswa		[%o1 + 0x8] %asi, %o2
    16449:	lduwa		[%o1 + 0xc] %asi, %o3
    16550:	ldswa		[%o1 + 0x10] %asi, %o4
    166	jmpl		%g1 + %lo(sys_setsockopt), %g0
    16751:	 ldswa		[%o1 + 0x4] %asi, %o1
    168	nop
    169do_sys_getsockopt: /* sys_getsockopt(int, int, int, u32, u32) */
    17052:	ldswa		[%o1 + 0x0] %asi, %o0
    171	sethi		%hi(sys_getsockopt), %g1
    17253:	ldswa		[%o1 + 0x8] %asi, %o2
    17354:	lduwa		[%o1 + 0xc] %asi, %o3
    17455:	lduwa		[%o1 + 0x10] %asi, %o4
    175	jmpl		%g1 + %lo(sys_getsockopt), %g0
    17656:	 ldswa		[%o1 + 0x4] %asi, %o1
    177	nop
    178do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */
    17957:	ldswa		[%o1 + 0x0] %asi, %o0
    180	sethi		%hi(compat_sys_sendmsg), %g1
    18158:	lduwa		[%o1 + 0x8] %asi, %o2
    182	jmpl		%g1 + %lo(compat_sys_sendmsg), %g0
    18359:	 lduwa		[%o1 + 0x4] %asi, %o1
    184	nop
    185	nop
    186	nop
    187do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */
    18860:	ldswa		[%o1 + 0x0] %asi, %o0
    189	sethi		%hi(compat_sys_recvmsg), %g1
    19061:	lduwa		[%o1 + 0x8] %asi, %o2
    191	jmpl		%g1 + %lo(compat_sys_recvmsg), %g0
    19262:	 lduwa		[%o1 + 0x4] %asi, %o1
    193	nop
    194	nop
    195	nop
    196do_sys_accept4: /* sys_accept4(int, struct sockaddr *, int *, int) */
    19763:	ldswa		[%o1 + 0x0] %asi, %o0
    198	sethi		%hi(sys_accept4), %g1
    19964:	lduwa		[%o1 + 0x8] %asi, %o2
    20065:	ldswa		[%o1 + 0xc] %asi, %o3
    201	jmpl		%g1 + %lo(sys_accept4), %g0
    20266:	 lduwa		[%o1 + 0x4] %asi, %o1
    203	nop
    204	nop
    205
    206	.section	__ex_table,"a"
    207	.align		4
    208	.word		1b, __retl_efault, 2b, __retl_efault
    209	.word		3b, __retl_efault, 4b, __retl_efault
    210	.word		5b, __retl_efault, 6b, __retl_efault
    211	.word		7b, __retl_efault, 8b, __retl_efault
    212	.word		9b, __retl_efault, 10b, __retl_efault
    213	.word		11b, __retl_efault, 12b, __retl_efault
    214	.word		13b, __retl_efault, 14b, __retl_efault
    215	.word		15b, __retl_efault, 16b, __retl_efault
    216	.word		17b, __retl_efault, 18b, __retl_efault
    217	.word		19b, __retl_efault, 20b, __retl_efault
    218	.word		21b, __retl_efault, 22b, __retl_efault
    219	.word		23b, __retl_efault, 24b, __retl_efault
    220	.word		25b, __retl_efault, 26b, __retl_efault
    221	.word		27b, __retl_efault, 28b, __retl_efault
    222	.word		29b, __retl_efault, 30b, __retl_efault
    223	.word		31b, __retl_efault, 32b, __retl_efault
    224	.word		33b, __retl_efault, 34b, __retl_efault
    225	.word		35b, __retl_efault, 36b, __retl_efault
    226	.word		37b, __retl_efault, 38b, __retl_efault
    227	.word		39b, __retl_efault, 40b, __retl_efault
    228	.word		41b, __retl_efault, 42b, __retl_efault
    229	.word		43b, __retl_efault, 44b, __retl_efault
    230	.word		45b, __retl_efault, 46b, __retl_efault
    231	.word		47b, __retl_efault, 48b, __retl_efault
    232	.word		49b, __retl_efault, 50b, __retl_efault
    233	.word		51b, __retl_efault, 52b, __retl_efault
    234	.word		53b, __retl_efault, 54b, __retl_efault
    235	.word		55b, __retl_efault, 56b, __retl_efault
    236	.word		57b, __retl_efault, 58b, __retl_efault
    237	.word		59b, __retl_efault, 60b, __retl_efault
    238	.word		61b, __retl_efault, 62b, __retl_efault
    239	.word		63b, __retl_efault, 64b, __retl_efault
    240	.word		65b, __retl_efault, 66b, __retl_efault
    241	.previous