1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * linux/arch/alpha/kernel/osf_sys.c
4 *
5 * Copyright (C) 1995 Linus Torvalds
6 */
7
8 /*
9 * This file handles some of the stranger OSF/1 system call interfaces.
10 * Some of the system calls expect a non-C calling standard, others have
11 * special parameter blocks..
12 */
13
14 #include <linux/errno.h>
15 #include <linux/sched/signal.h>
16 #include <linux/sched/mm.h>
17 #include <linux/sched/task_stack.h>
18 #include <linux/sched/cputime.h>
19 #include <linux/kernel.h>
20 #include <linux/mm.h>
21 #include <linux/smp.h>
22 #include <linux/stddef.h>
23 #include <linux/syscalls.h>
24 #include <linux/unistd.h>
25 #include <linux/ptrace.h>
26 #include <linux/user.h>
27 #include <linux/utsname.h>
28 #include <linux/time.h>
29 #include <linux/timex.h>
30 #include <linux/major.h>
31 #include <linux/stat.h>
32 #include <linux/mman.h>
33 #include <linux/shm.h>
34 #include <linux/poll.h>
35 #include <linux/file.h>
36 #include <linux/types.h>
37 #include <linux/ipc.h>
38 #include <linux/namei.h>
39 #include <linux/mount.h>
40 #include <linux/uio.h>
41 #include <linux/hugetlb.h>
42 #include <linux/vfs.h>
43 #include <linux/rcupdate.h>
44 #include <linux/slab.h>
45
46 #include <asm/fpu.h>
47 #include <asm/io.h>
48 #include <linux/uaccess.h>
49 #include <asm/sysinfo.h>
50 #include <asm/thread_info.h>
51 #include <asm/hwrpb.h>
52 #include <asm/processor.h>
53
54 /*
55 * Brk needs to return an error. Still support Linux's brk(0) query idiom,
56 * which OSF programs just shouldn't be doing. We're still not quite
57 * identical to OSF as we don't return 0 on success, but doing otherwise
58 * would require changes to libc. Hopefully this is good enough.
59 */
SYSCALL_DEFINE1(osf_brk,unsigned long,brk)60 SYSCALL_DEFINE1(osf_brk, unsigned long, brk)
61 {
62 unsigned long retval = sys_brk(brk);
63 if (brk && brk != retval)
64 retval = -ENOMEM;
65 return retval;
66 }
67
68 /*
69 * This is pure guess-work..
70 */
SYSCALL_DEFINE4(osf_set_program_attributes,unsigned long,text_start,unsigned long,text_len,unsigned long,bss_start,unsigned long,bss_len)71 SYSCALL_DEFINE4(osf_set_program_attributes, unsigned long, text_start,
72 unsigned long, text_len, unsigned long, bss_start,
73 unsigned long, bss_len)
74 {
75 struct mm_struct *mm;
76
77 mm = current->mm;
78 mm->end_code = bss_start + bss_len;
79 mm->start_brk = bss_start + bss_len;
80 mm->brk = bss_start + bss_len;
81 #if 0
82 printk("set_program_attributes(%lx %lx %lx %lx)\n",
83 text_start, text_len, bss_start, bss_len);
84 #endif
85 return 0;
86 }
87
88 /*
89 * OSF/1 directory handling functions...
90 *
91 * The "getdents()" interface is much more sane: the "basep" stuff is
92 * braindamage (it can't really handle filesystems where the directory
93 * offset differences aren't the same as "d_reclen").
94 */
95 #define NAME_OFFSET offsetof (struct osf_dirent, d_name)
96
97 struct osf_dirent {
98 unsigned int d_ino;
99 unsigned short d_reclen;
100 unsigned short d_namlen;
101 char d_name[];
102 };
103
104 struct osf_dirent_callback {
105 struct dir_context ctx;
106 struct osf_dirent __user *dirent;
107 long __user *basep;
108 unsigned int count;
109 int error;
110 };
111
112 static bool
osf_filldir(struct dir_context * ctx,const char * name,int namlen,loff_t offset,u64 ino,unsigned int d_type)113 osf_filldir(struct dir_context *ctx, const char *name, int namlen,
114 loff_t offset, u64 ino, unsigned int d_type)
115 {
116 struct osf_dirent __user *dirent;
117 struct osf_dirent_callback *buf =
118 container_of(ctx, struct osf_dirent_callback, ctx);
119 unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32));
120 unsigned int d_ino;
121
122 buf->error = -EINVAL; /* only used if we fail */
123 if (reclen > buf->count)
124 return false;
125 d_ino = ino;
126 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
127 buf->error = -EOVERFLOW;
128 return false;
129 }
130 if (buf->basep) {
131 if (put_user(offset, buf->basep))
132 goto Efault;
133 buf->basep = NULL;
134 }
135 dirent = buf->dirent;
136 if (put_user(d_ino, &dirent->d_ino) ||
137 put_user(namlen, &dirent->d_namlen) ||
138 put_user(reclen, &dirent->d_reclen) ||
139 copy_to_user(dirent->d_name, name, namlen) ||
140 put_user(0, dirent->d_name + namlen))
141 goto Efault;
142 dirent = (void __user *)dirent + reclen;
143 buf->dirent = dirent;
144 buf->count -= reclen;
145 return true;
146 Efault:
147 buf->error = -EFAULT;
148 return false;
149 }
150
SYSCALL_DEFINE4(osf_getdirentries,unsigned int,fd,struct osf_dirent __user *,dirent,unsigned int,count,long __user *,basep)151 SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
152 struct osf_dirent __user *, dirent, unsigned int, count,
153 long __user *, basep)
154 {
155 int error;
156 CLASS(fd_pos, arg)(fd);
157 struct osf_dirent_callback buf = {
158 .ctx.actor = osf_filldir,
159 .dirent = dirent,
160 .basep = basep,
161 .count = count
162 };
163
164 if (fd_empty(arg))
165 return -EBADF;
166
167 error = iterate_dir(fd_file(arg), &buf.ctx);
168 if (error >= 0)
169 error = buf.error;
170 if (count != buf.count)
171 error = count - buf.count;
172
173 return error;
174 }
175
176 #undef NAME_OFFSET
177
SYSCALL_DEFINE6(osf_mmap,unsigned long,addr,unsigned long,len,unsigned long,prot,unsigned long,flags,unsigned long,fd,unsigned long,off)178 SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len,
179 unsigned long, prot, unsigned long, flags, unsigned long, fd,
180 unsigned long, off)
181 {
182 unsigned long ret = -EINVAL;
183
184 #if 0
185 if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED))
186 printk("%s: unimplemented OSF mmap flags %04lx\n",
187 current->comm, flags);
188 #endif
189 if ((off + PAGE_ALIGN(len)) < off)
190 goto out;
191 if (off & ~PAGE_MASK)
192 goto out;
193 ret = ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
194 out:
195 return ret;
196 }
197
198 struct osf_stat {
199 int st_dev;
200 int st_pad1;
201 unsigned st_mode;
202 unsigned short st_nlink;
203 short st_nlink_reserved;
204 unsigned st_uid;
205 unsigned st_gid;
206 int st_rdev;
207 int st_ldev;
208 long st_size;
209 int st_pad2;
210 int st_uatime;
211 int st_pad3;
212 int st_umtime;
213 int st_pad4;
214 int st_uctime;
215 int st_pad5;
216 int st_pad6;
217 unsigned st_flags;
218 unsigned st_gen;
219 long st_spare[4];
220 unsigned st_ino;
221 int st_ino_reserved;
222 int st_atime;
223 int st_atime_reserved;
224 int st_mtime;
225 int st_mtime_reserved;
226 int st_ctime;
227 int st_ctime_reserved;
228 long st_blksize;
229 long st_blocks;
230 };
231
232 /*
233 * The OSF/1 statfs structure is much larger, but this should
234 * match the beginning, at least.
235 */
236 struct osf_statfs {
237 short f_type;
238 short f_flags;
239 int f_fsize;
240 int f_bsize;
241 int f_blocks;
242 int f_bfree;
243 int f_bavail;
244 int f_files;
245 int f_ffree;
246 __kernel_fsid_t f_fsid;
247 };
248
249 struct osf_statfs64 {
250 short f_type;
251 short f_flags;
252 int f_pad1;
253 int f_pad2;
254 int f_pad3;
255 int f_pad4;
256 int f_pad5;
257 int f_pad6;
258 int f_pad7;
259 __kernel_fsid_t f_fsid;
260 u_short f_namemax;
261 short f_reserved1;
262 int f_spare[8];
263 char f_pad8[90];
264 char f_pad9[90];
265 long mount_info[10];
266 u_long f_flags2;
267 long f_spare2[14];
268 long f_fsize;
269 long f_bsize;
270 long f_blocks;
271 long f_bfree;
272 long f_bavail;
273 long f_files;
274 long f_ffree;
275 };
276
277 static int
linux_to_osf_stat(struct kstat * lstat,struct osf_stat __user * osf_stat)278 linux_to_osf_stat(struct kstat *lstat, struct osf_stat __user *osf_stat)
279 {
280 struct osf_stat tmp = { 0 };
281
282 tmp.st_dev = lstat->dev;
283 tmp.st_mode = lstat->mode;
284 tmp.st_nlink = lstat->nlink;
285 tmp.st_uid = from_kuid_munged(current_user_ns(), lstat->uid);
286 tmp.st_gid = from_kgid_munged(current_user_ns(), lstat->gid);
287 tmp.st_rdev = lstat->rdev;
288 tmp.st_ldev = lstat->rdev;
289 tmp.st_size = lstat->size;
290 tmp.st_uatime = lstat->atime.tv_nsec / 1000;
291 tmp.st_umtime = lstat->mtime.tv_nsec / 1000;
292 tmp.st_uctime = lstat->ctime.tv_nsec / 1000;
293 tmp.st_ino = lstat->ino;
294 tmp.st_atime = lstat->atime.tv_sec;
295 tmp.st_mtime = lstat->mtime.tv_sec;
296 tmp.st_ctime = lstat->ctime.tv_sec;
297 tmp.st_blksize = lstat->blksize;
298 tmp.st_blocks = lstat->blocks;
299
300 return copy_to_user(osf_stat, &tmp, sizeof(tmp)) ? -EFAULT : 0;
301 }
302
303 static int
linux_to_osf_statfs(struct kstatfs * linux_stat,struct osf_statfs __user * osf_stat,unsigned long bufsiz)304 linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat,
305 unsigned long bufsiz)
306 {
307 struct osf_statfs tmp_stat;
308
309 tmp_stat.f_type = linux_stat->f_type;
310 tmp_stat.f_flags = 0; /* mount flags */
311 tmp_stat.f_fsize = linux_stat->f_frsize;
312 tmp_stat.f_bsize = linux_stat->f_bsize;
313 tmp_stat.f_blocks = linux_stat->f_blocks;
314 tmp_stat.f_bfree = linux_stat->f_bfree;
315 tmp_stat.f_bavail = linux_stat->f_bavail;
316 tmp_stat.f_files = linux_stat->f_files;
317 tmp_stat.f_ffree = linux_stat->f_ffree;
318 tmp_stat.f_fsid = linux_stat->f_fsid;
319 if (bufsiz > sizeof(tmp_stat))
320 bufsiz = sizeof(tmp_stat);
321 return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0;
322 }
323
324 static int
linux_to_osf_statfs64(struct kstatfs * linux_stat,struct osf_statfs64 __user * osf_stat,unsigned long bufsiz)325 linux_to_osf_statfs64(struct kstatfs *linux_stat, struct osf_statfs64 __user *osf_stat,
326 unsigned long bufsiz)
327 {
328 struct osf_statfs64 tmp_stat = { 0 };
329
330 tmp_stat.f_type = linux_stat->f_type;
331 tmp_stat.f_fsize = linux_stat->f_frsize;
332 tmp_stat.f_bsize = linux_stat->f_bsize;
333 tmp_stat.f_blocks = linux_stat->f_blocks;
334 tmp_stat.f_bfree = linux_stat->f_bfree;
335 tmp_stat.f_bavail = linux_stat->f_bavail;
336 tmp_stat.f_files = linux_stat->f_files;
337 tmp_stat.f_ffree = linux_stat->f_ffree;
338 tmp_stat.f_fsid = linux_stat->f_fsid;
339 if (bufsiz > sizeof(tmp_stat))
340 bufsiz = sizeof(tmp_stat);
341 return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0;
342 }
343
SYSCALL_DEFINE3(osf_statfs,const char __user *,pathname,struct osf_statfs __user *,buffer,unsigned long,bufsiz)344 SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname,
345 struct osf_statfs __user *, buffer, unsigned long, bufsiz)
346 {
347 struct kstatfs linux_stat;
348 int error = user_statfs(pathname, &linux_stat);
349 if (!error)
350 error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz);
351 return error;
352 }
353
SYSCALL_DEFINE2(osf_stat,char __user *,name,struct osf_stat __user *,buf)354 SYSCALL_DEFINE2(osf_stat, char __user *, name, struct osf_stat __user *, buf)
355 {
356 struct kstat stat;
357 int error;
358
359 error = vfs_stat(name, &stat);
360 if (error)
361 return error;
362
363 return linux_to_osf_stat(&stat, buf);
364 }
365
SYSCALL_DEFINE2(osf_lstat,char __user *,name,struct osf_stat __user *,buf)366 SYSCALL_DEFINE2(osf_lstat, char __user *, name, struct osf_stat __user *, buf)
367 {
368 struct kstat stat;
369 int error;
370
371 error = vfs_lstat(name, &stat);
372 if (error)
373 return error;
374
375 return linux_to_osf_stat(&stat, buf);
376 }
377
SYSCALL_DEFINE2(osf_fstat,int,fd,struct osf_stat __user *,buf)378 SYSCALL_DEFINE2(osf_fstat, int, fd, struct osf_stat __user *, buf)
379 {
380 struct kstat stat;
381 int error;
382
383 error = vfs_fstat(fd, &stat);
384 if (error)
385 return error;
386
387 return linux_to_osf_stat(&stat, buf);
388 }
389
SYSCALL_DEFINE3(osf_fstatfs,unsigned long,fd,struct osf_statfs __user *,buffer,unsigned long,bufsiz)390 SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd,
391 struct osf_statfs __user *, buffer, unsigned long, bufsiz)
392 {
393 struct kstatfs linux_stat;
394 int error = fd_statfs(fd, &linux_stat);
395 if (!error)
396 error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz);
397 return error;
398 }
399
SYSCALL_DEFINE3(osf_statfs64,char __user *,pathname,struct osf_statfs64 __user *,buffer,unsigned long,bufsiz)400 SYSCALL_DEFINE3(osf_statfs64, char __user *, pathname,
401 struct osf_statfs64 __user *, buffer, unsigned long, bufsiz)
402 {
403 struct kstatfs linux_stat;
404 int error = user_statfs(pathname, &linux_stat);
405 if (!error)
406 error = linux_to_osf_statfs64(&linux_stat, buffer, bufsiz);
407 return error;
408 }
409
SYSCALL_DEFINE3(osf_fstatfs64,unsigned long,fd,struct osf_statfs64 __user *,buffer,unsigned long,bufsiz)410 SYSCALL_DEFINE3(osf_fstatfs64, unsigned long, fd,
411 struct osf_statfs64 __user *, buffer, unsigned long, bufsiz)
412 {
413 struct kstatfs linux_stat;
414 int error = fd_statfs(fd, &linux_stat);
415 if (!error)
416 error = linux_to_osf_statfs64(&linux_stat, buffer, bufsiz);
417 return error;
418 }
419
420 /*
421 * Uhh.. OSF/1 mount parameters aren't exactly obvious..
422 *
423 * Although to be frank, neither are the native Linux/i386 ones..
424 */
425 struct ufs_args {
426 char __user *devname;
427 int flags;
428 uid_t exroot;
429 };
430
431 struct cdfs_args {
432 char __user *devname;
433 int flags;
434 uid_t exroot;
435
436 /* This has lots more here, which Linux handles with the option block
437 but I'm too lazy to do the translation into ASCII. */
438 };
439
440 struct procfs_args {
441 char __user *devname;
442 int flags;
443 uid_t exroot;
444 };
445
446 /*
447 * We can't actually handle ufs yet, so we translate UFS mounts to
448 * ext2fs mounts. I wouldn't mind a UFS filesystem, but the UFS
449 * layout is so braindead it's a major headache doing it.
450 *
451 * Just how long ago was it written? OTOH our UFS driver may be still
452 * unhappy with OSF UFS. [CHECKME]
453 */
454 static int
osf_ufs_mount(const char __user * dirname,struct ufs_args __user * args,int flags)455 osf_ufs_mount(const char __user *dirname,
456 struct ufs_args __user *args, int flags)
457 {
458 struct ufs_args tmp;
459 char *devname __free(kfree) = NULL;
460
461 if (copy_from_user(&tmp, args, sizeof(tmp)))
462 return -EFAULT;
463 devname = strndup_user(tmp.devname, PATH_MAX);
464 if (IS_ERR(devname))
465 return PTR_ERR(devname);
466 return do_mount(devname, dirname, "ext2", flags, NULL);
467 }
468
469 static int
osf_cdfs_mount(const char __user * dirname,struct cdfs_args __user * args,int flags)470 osf_cdfs_mount(const char __user *dirname,
471 struct cdfs_args __user *args, int flags)
472 {
473 struct cdfs_args tmp;
474 char *devname __free(kfree) = NULL;
475
476 if (copy_from_user(&tmp, args, sizeof(tmp)))
477 return -EFAULT;
478 devname = strndup_user(tmp.devname, PATH_MAX);
479 if (IS_ERR(devname))
480 return PTR_ERR(devname);
481 return do_mount(devname, dirname, "iso9660", flags, NULL);
482 }
483
484 static int
osf_procfs_mount(const char __user * dirname,struct procfs_args __user * args,int flags)485 osf_procfs_mount(const char __user *dirname,
486 struct procfs_args __user *args, int flags)
487 {
488 struct procfs_args tmp;
489
490 if (copy_from_user(&tmp, args, sizeof(tmp)))
491 return -EFAULT;
492
493 return do_mount("", dirname, "proc", flags, NULL);
494 }
495
SYSCALL_DEFINE4(osf_mount,unsigned long,typenr,const char __user *,path,int,flag,void __user *,data)496 SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
497 int, flag, void __user *, data)
498 {
499 int retval;
500
501 switch (typenr) {
502 case 1:
503 retval = osf_ufs_mount(path, data, flag);
504 break;
505 case 6:
506 retval = osf_cdfs_mount(path, data, flag);
507 break;
508 case 9:
509 retval = osf_procfs_mount(path, data, flag);
510 break;
511 default:
512 retval = -EINVAL;
513 printk_ratelimited("osf_mount(%ld, %x)\n", typenr, flag);
514 }
515
516 return retval;
517 }
518
SYSCALL_DEFINE1(osf_utsname,char __user *,name)519 SYSCALL_DEFINE1(osf_utsname, char __user *, name)
520 {
521 char tmp[5 * 32];
522
523 down_read(&uts_sem);
524 memcpy(tmp + 0 * 32, utsname()->sysname, 32);
525 memcpy(tmp + 1 * 32, utsname()->nodename, 32);
526 memcpy(tmp + 2 * 32, utsname()->release, 32);
527 memcpy(tmp + 3 * 32, utsname()->version, 32);
528 memcpy(tmp + 4 * 32, utsname()->machine, 32);
529 up_read(&uts_sem);
530
531 if (copy_to_user(name, tmp, sizeof(tmp)))
532 return -EFAULT;
533 return 0;
534 }
535
SYSCALL_DEFINE0(getpagesize)536 SYSCALL_DEFINE0(getpagesize)
537 {
538 return PAGE_SIZE;
539 }
540
SYSCALL_DEFINE0(getdtablesize)541 SYSCALL_DEFINE0(getdtablesize)
542 {
543 return sysctl_nr_open;
544 }
545
546 /*
547 * For compatibility with OSF/1 only. Use utsname(2) instead.
548 */
SYSCALL_DEFINE2(osf_getdomainname,char __user *,name,int,namelen)549 SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen)
550 {
551 int len;
552 char *kname;
553 char tmp[32];
554
555 if (namelen < 0 || namelen > 32)
556 namelen = 32;
557
558 down_read(&uts_sem);
559 kname = utsname()->domainname;
560 len = strnlen(kname, namelen);
561 len = min(len + 1, namelen);
562 memcpy(tmp, kname, len);
563 up_read(&uts_sem);
564
565 if (copy_to_user(name, tmp, len))
566 return -EFAULT;
567 return 0;
568 }
569
570 /*
571 * The following stuff should move into a header file should it ever
572 * be labeled "officially supported." Right now, there is just enough
573 * support to avoid applications (such as tar) printing error
574 * messages. The attributes are not really implemented.
575 */
576
577 /*
578 * Values for Property list entry flag
579 */
580 #define PLE_PROPAGATE_ON_COPY 0x1 /* cp(1) will copy entry
581 by default */
582 #define PLE_FLAG_MASK 0x1 /* Valid flag values */
583 #define PLE_FLAG_ALL -1 /* All flag value */
584
585 struct proplistname_args {
586 unsigned int pl_mask;
587 unsigned int pl_numnames;
588 char **pl_names;
589 };
590
591 union pl_args {
592 struct setargs {
593 char __user *path;
594 long follow;
595 long nbytes;
596 char __user *buf;
597 } set;
598 struct fsetargs {
599 long fd;
600 long nbytes;
601 char __user *buf;
602 } fset;
603 struct getargs {
604 char __user *path;
605 long follow;
606 struct proplistname_args __user *name_args;
607 long nbytes;
608 char __user *buf;
609 int __user *min_buf_size;
610 } get;
611 struct fgetargs {
612 long fd;
613 struct proplistname_args __user *name_args;
614 long nbytes;
615 char __user *buf;
616 int __user *min_buf_size;
617 } fget;
618 struct delargs {
619 char __user *path;
620 long follow;
621 struct proplistname_args __user *name_args;
622 } del;
623 struct fdelargs {
624 long fd;
625 struct proplistname_args __user *name_args;
626 } fdel;
627 };
628
629 enum pl_code {
630 PL_SET = 1, PL_FSET = 2,
631 PL_GET = 3, PL_FGET = 4,
632 PL_DEL = 5, PL_FDEL = 6
633 };
634
SYSCALL_DEFINE2(osf_proplist_syscall,enum pl_code,code,union pl_args __user *,args)635 SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code,
636 union pl_args __user *, args)
637 {
638 long error;
639 int __user *min_buf_size_ptr;
640
641 switch (code) {
642 case PL_SET:
643 if (get_user(error, &args->set.nbytes))
644 error = -EFAULT;
645 break;
646 case PL_FSET:
647 if (get_user(error, &args->fset.nbytes))
648 error = -EFAULT;
649 break;
650 case PL_GET:
651 error = get_user(min_buf_size_ptr, &args->get.min_buf_size);
652 if (error)
653 break;
654 error = put_user(0, min_buf_size_ptr);
655 break;
656 case PL_FGET:
657 error = get_user(min_buf_size_ptr, &args->fget.min_buf_size);
658 if (error)
659 break;
660 error = put_user(0, min_buf_size_ptr);
661 break;
662 case PL_DEL:
663 case PL_FDEL:
664 error = 0;
665 break;
666 default:
667 error = -EOPNOTSUPP;
668 break;
669 }
670 return error;
671 }
672
SYSCALL_DEFINE2(osf_sigstack,struct sigstack __user *,uss,struct sigstack __user *,uoss)673 SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss,
674 struct sigstack __user *, uoss)
675 {
676 unsigned long usp = rdusp();
677 unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size;
678 unsigned long oss_os = on_sig_stack(usp);
679 int error;
680
681 if (uss) {
682 void __user *ss_sp;
683
684 error = -EFAULT;
685 if (get_user(ss_sp, &uss->ss_sp))
686 goto out;
687
688 /* If the current stack was set with sigaltstack, don't
689 swap stacks while we are on it. */
690 error = -EPERM;
691 if (current->sas_ss_sp && on_sig_stack(usp))
692 goto out;
693
694 /* Since we don't know the extent of the stack, and we don't
695 track onstack-ness, but rather calculate it, we must
696 presume a size. Ho hum this interface is lossy. */
697 current->sas_ss_sp = (unsigned long)ss_sp - SIGSTKSZ;
698 current->sas_ss_size = SIGSTKSZ;
699 }
700
701 if (uoss) {
702 error = -EFAULT;
703 if (put_user(oss_sp, &uoss->ss_sp) ||
704 put_user(oss_os, &uoss->ss_onstack))
705 goto out;
706 }
707
708 error = 0;
709 out:
710 return error;
711 }
712
SYSCALL_DEFINE3(osf_sysinfo,int,command,char __user *,buf,long,count)713 SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)
714 {
715 const char *sysinfo_table[] = {
716 utsname()->sysname,
717 utsname()->nodename,
718 utsname()->release,
719 utsname()->version,
720 utsname()->machine,
721 "alpha", /* instruction set architecture */
722 "dummy", /* hardware serial number */
723 "dummy", /* hardware manufacturer */
724 "dummy", /* secure RPC domain */
725 };
726 unsigned long offset;
727 const char *res;
728 long len;
729 char tmp[__NEW_UTS_LEN + 1];
730
731 offset = command-1;
732 if (offset >= ARRAY_SIZE(sysinfo_table)) {
733 /* Digital UNIX has a few unpublished interfaces here */
734 printk("sysinfo(%d)", command);
735 return -EINVAL;
736 }
737
738 down_read(&uts_sem);
739 res = sysinfo_table[offset];
740 len = strlen(res)+1;
741 if ((unsigned long)len > (unsigned long)count)
742 len = count;
743 memcpy(tmp, res, len);
744 up_read(&uts_sem);
745 if (copy_to_user(buf, tmp, len))
746 return -EFAULT;
747 return 0;
748 }
749
SYSCALL_DEFINE5(osf_getsysinfo,unsigned long,op,void __user *,buffer,unsigned long,nbytes,int __user *,start,void __user *,arg)750 SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer,
751 unsigned long, nbytes, int __user *, start, void __user *, arg)
752 {
753 unsigned long w;
754 struct percpu_struct *cpu;
755
756 switch (op) {
757 case GSI_IEEE_FP_CONTROL:
758 /* Return current software fp control & status bits. */
759 /* Note that DU doesn't verify available space here. */
760
761 w = current_thread_info()->ieee_state & IEEE_SW_MASK;
762 w = swcr_update_status(w, rdfpcr());
763 if (put_user(w, (unsigned long __user *) buffer))
764 return -EFAULT;
765 return 0;
766
767 case GSI_IEEE_STATE_AT_SIGNAL:
768 /*
769 * Not sure anybody will ever use this weird stuff. These
770 * ops can be used (under OSF/1) to set the fpcr that should
771 * be used when a signal handler starts executing.
772 */
773 break;
774
775 case GSI_UACPROC:
776 if (nbytes < sizeof(unsigned int))
777 return -EINVAL;
778 w = current_thread_info()->status & UAC_BITMASK;
779 if (put_user(w, (unsigned int __user *)buffer))
780 return -EFAULT;
781 return 1;
782
783 case GSI_PROC_TYPE:
784 if (nbytes < sizeof(unsigned long))
785 return -EINVAL;
786 cpu = (struct percpu_struct*)
787 ((char*)hwrpb + hwrpb->processor_offset);
788 w = cpu->type;
789 if (put_user(w, (unsigned long __user*)buffer))
790 return -EFAULT;
791 return 1;
792
793 case GSI_GET_HWRPB:
794 if (nbytes > sizeof(*hwrpb))
795 return -EINVAL;
796 if (copy_to_user(buffer, hwrpb, nbytes) != 0)
797 return -EFAULT;
798 return 1;
799
800 default:
801 break;
802 }
803
804 return -EOPNOTSUPP;
805 }
806
SYSCALL_DEFINE5(osf_setsysinfo,unsigned long,op,void __user *,buffer,unsigned long,nbytes,int __user *,start,void __user *,arg)807 SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer,
808 unsigned long, nbytes, int __user *, start, void __user *, arg)
809 {
810 switch (op) {
811 case SSI_IEEE_FP_CONTROL: {
812 unsigned long swcr, fpcr;
813 unsigned int *state;
814
815 /*
816 * Alpha Architecture Handbook 4.7.7.3:
817 * To be fully IEEE compiant, we must track the current IEEE
818 * exception state in software, because spurious bits can be
819 * set in the trap shadow of a software-complete insn.
820 */
821
822 if (get_user(swcr, (unsigned long __user *)buffer))
823 return -EFAULT;
824 state = ¤t_thread_info()->ieee_state;
825
826 /* Update software trap enable bits. */
827 *state = (*state & ~IEEE_SW_MASK) | (swcr & IEEE_SW_MASK);
828
829 /* Update the real fpcr. */
830 fpcr = rdfpcr() & FPCR_DYN_MASK;
831 fpcr |= ieee_swcr_to_fpcr(swcr);
832 wrfpcr(fpcr);
833
834 return 0;
835 }
836
837 case SSI_IEEE_RAISE_EXCEPTION: {
838 unsigned long exc, swcr, fpcr, fex;
839 unsigned int *state;
840
841 if (get_user(exc, (unsigned long __user *)buffer))
842 return -EFAULT;
843 state = ¤t_thread_info()->ieee_state;
844 exc &= IEEE_STATUS_MASK;
845
846 /* Update software trap enable bits. */
847 swcr = (*state & IEEE_SW_MASK) | exc;
848 *state |= exc;
849
850 /* Update the real fpcr. */
851 fpcr = rdfpcr();
852 fpcr |= ieee_swcr_to_fpcr(swcr);
853 wrfpcr(fpcr);
854
855 /* If any exceptions set by this call, and are unmasked,
856 send a signal. Old exceptions are not signaled. */
857 fex = (exc >> IEEE_STATUS_TO_EXCSUM_SHIFT) & swcr;
858 if (fex) {
859 int si_code = FPE_FLTUNK;
860
861 if (fex & IEEE_TRAP_ENABLE_DNO) si_code = FPE_FLTUND;
862 if (fex & IEEE_TRAP_ENABLE_INE) si_code = FPE_FLTRES;
863 if (fex & IEEE_TRAP_ENABLE_UNF) si_code = FPE_FLTUND;
864 if (fex & IEEE_TRAP_ENABLE_OVF) si_code = FPE_FLTOVF;
865 if (fex & IEEE_TRAP_ENABLE_DZE) si_code = FPE_FLTDIV;
866 if (fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV;
867
868 send_sig_fault_trapno(SIGFPE, si_code,
869 (void __user *)NULL, /* FIXME */
870 0, current);
871 }
872 return 0;
873 }
874
875 case SSI_IEEE_STATE_AT_SIGNAL:
876 case SSI_IEEE_IGNORE_STATE_AT_SIGNAL:
877 /*
878 * Not sure anybody will ever use this weird stuff. These
879 * ops can be used (under OSF/1) to set the fpcr that should
880 * be used when a signal handler starts executing.
881 */
882 break;
883
884 case SSI_NVPAIRS: {
885 unsigned __user *p = buffer;
886 unsigned i;
887
888 for (i = 0, p = buffer; i < nbytes; ++i, p += 2) {
889 unsigned v, w, status;
890
891 if (get_user(v, p) || get_user(w, p + 1))
892 return -EFAULT;
893 switch (v) {
894 case SSIN_UACPROC:
895 w &= UAC_BITMASK;
896 status = current_thread_info()->status;
897 status = (status & ~UAC_BITMASK) | w;
898 current_thread_info()->status = status;
899 break;
900
901 default:
902 return -EOPNOTSUPP;
903 }
904 }
905 return 0;
906 }
907
908 case SSI_LMF:
909 return 0;
910
911 default:
912 break;
913 }
914
915 return -EOPNOTSUPP;
916 }
917
918 /* Translations due to the fact that OSF's time_t is an int. Which
919 affects all sorts of things, like timeval and itimerval. */
920
921 extern struct timezone sys_tz;
922
923 struct timeval32
924 {
925 int tv_sec, tv_usec;
926 };
927
928 struct itimerval32
929 {
930 struct timeval32 it_interval;
931 struct timeval32 it_value;
932 };
933
934 static inline long
get_tv32(struct timespec64 * o,struct timeval32 __user * i)935 get_tv32(struct timespec64 *o, struct timeval32 __user *i)
936 {
937 struct timeval32 tv;
938 if (copy_from_user(&tv, i, sizeof(struct timeval32)))
939 return -EFAULT;
940 o->tv_sec = tv.tv_sec;
941 o->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
942 return 0;
943 }
944
945 static inline long
put_tv32(struct timeval32 __user * o,struct timespec64 * i)946 put_tv32(struct timeval32 __user *o, struct timespec64 *i)
947 {
948 return copy_to_user(o, &(struct timeval32){
949 .tv_sec = i->tv_sec,
950 .tv_usec = i->tv_nsec / NSEC_PER_USEC},
951 sizeof(struct timeval32));
952 }
953
954 static inline long
put_tv_to_tv32(struct timeval32 __user * o,struct __kernel_old_timeval * i)955 put_tv_to_tv32(struct timeval32 __user *o, struct __kernel_old_timeval *i)
956 {
957 return copy_to_user(o, &(struct timeval32){
958 .tv_sec = i->tv_sec,
959 .tv_usec = i->tv_usec},
960 sizeof(struct timeval32));
961 }
962
963 static inline void
jiffies_to_timeval32(unsigned long jiffies,struct timeval32 * value)964 jiffies_to_timeval32(unsigned long jiffies, struct timeval32 *value)
965 {
966 value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
967 value->tv_sec = jiffies / HZ;
968 }
969
SYSCALL_DEFINE2(osf_gettimeofday,struct timeval32 __user *,tv,struct timezone __user *,tz)970 SYSCALL_DEFINE2(osf_gettimeofday, struct timeval32 __user *, tv,
971 struct timezone __user *, tz)
972 {
973 if (tv) {
974 struct timespec64 kts;
975
976 ktime_get_real_ts64(&kts);
977 if (put_tv32(tv, &kts))
978 return -EFAULT;
979 }
980 if (tz) {
981 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
982 return -EFAULT;
983 }
984 return 0;
985 }
986
SYSCALL_DEFINE2(osf_settimeofday,struct timeval32 __user *,tv,struct timezone __user *,tz)987 SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
988 struct timezone __user *, tz)
989 {
990 struct timespec64 kts;
991 struct timezone ktz;
992
993 if (tv) {
994 if (get_tv32(&kts, tv))
995 return -EFAULT;
996 }
997 if (tz) {
998 if (copy_from_user(&ktz, tz, sizeof(*tz)))
999 return -EFAULT;
1000 }
1001
1002 return do_sys_settimeofday64(tv ? &kts : NULL, tz ? &ktz : NULL);
1003 }
1004
SYSCALL_DEFINE2(osf_utimes,const char __user *,filename,struct timeval32 __user *,tvs)1005 SYSCALL_DEFINE2(osf_utimes, const char __user *, filename,
1006 struct timeval32 __user *, tvs)
1007 {
1008 struct timespec64 tv[2];
1009
1010 if (tvs) {
1011 if (get_tv32(&tv[0], &tvs[0]) ||
1012 get_tv32(&tv[1], &tvs[1]))
1013 return -EFAULT;
1014
1015 if (tv[0].tv_nsec < 0 || tv[0].tv_nsec >= 1000000000 ||
1016 tv[1].tv_nsec < 0 || tv[1].tv_nsec >= 1000000000)
1017 return -EINVAL;
1018 }
1019
1020 return do_utimes(AT_FDCWD, filename, tvs ? tv : NULL, 0);
1021 }
1022
SYSCALL_DEFINE5(osf_select,int,n,fd_set __user *,inp,fd_set __user *,outp,fd_set __user *,exp,struct timeval32 __user *,tvp)1023 SYSCALL_DEFINE5(osf_select, int, n, fd_set __user *, inp, fd_set __user *, outp,
1024 fd_set __user *, exp, struct timeval32 __user *, tvp)
1025 {
1026 struct timespec64 end_time, *to = NULL;
1027 if (tvp) {
1028 struct timespec64 tv;
1029 to = &end_time;
1030
1031 if (get_tv32(&tv, tvp))
1032 return -EFAULT;
1033
1034 if (tv.tv_sec < 0 || tv.tv_nsec < 0)
1035 return -EINVAL;
1036
1037 if (poll_select_set_timeout(to, tv.tv_sec, tv.tv_nsec))
1038 return -EINVAL;
1039
1040 }
1041
1042 /* OSF does not copy back the remaining time. */
1043 return core_sys_select(n, inp, outp, exp, to);
1044 }
1045
1046 struct rusage32 {
1047 struct timeval32 ru_utime; /* user time used */
1048 struct timeval32 ru_stime; /* system time used */
1049 long ru_maxrss; /* maximum resident set size */
1050 long ru_ixrss; /* integral shared memory size */
1051 long ru_idrss; /* integral unshared data size */
1052 long ru_isrss; /* integral unshared stack size */
1053 long ru_minflt; /* page reclaims */
1054 long ru_majflt; /* page faults */
1055 long ru_nswap; /* swaps */
1056 long ru_inblock; /* block input operations */
1057 long ru_oublock; /* block output operations */
1058 long ru_msgsnd; /* messages sent */
1059 long ru_msgrcv; /* messages received */
1060 long ru_nsignals; /* signals received */
1061 long ru_nvcsw; /* voluntary context switches */
1062 long ru_nivcsw; /* involuntary " */
1063 };
1064
SYSCALL_DEFINE2(osf_getrusage,int,who,struct rusage32 __user *,ru)1065 SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)
1066 {
1067 struct rusage32 r;
1068 u64 utime, stime;
1069 unsigned long utime_jiffies, stime_jiffies;
1070
1071 if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN)
1072 return -EINVAL;
1073
1074 memset(&r, 0, sizeof(r));
1075 switch (who) {
1076 case RUSAGE_SELF:
1077 task_cputime(current, &utime, &stime);
1078 utime_jiffies = nsecs_to_jiffies(utime);
1079 stime_jiffies = nsecs_to_jiffies(stime);
1080 jiffies_to_timeval32(utime_jiffies, &r.ru_utime);
1081 jiffies_to_timeval32(stime_jiffies, &r.ru_stime);
1082 r.ru_minflt = current->min_flt;
1083 r.ru_majflt = current->maj_flt;
1084 break;
1085 case RUSAGE_CHILDREN:
1086 utime_jiffies = nsecs_to_jiffies(current->signal->cutime);
1087 stime_jiffies = nsecs_to_jiffies(current->signal->cstime);
1088 jiffies_to_timeval32(utime_jiffies, &r.ru_utime);
1089 jiffies_to_timeval32(stime_jiffies, &r.ru_stime);
1090 r.ru_minflt = current->signal->cmin_flt;
1091 r.ru_majflt = current->signal->cmaj_flt;
1092 break;
1093 }
1094
1095 return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;
1096 }
1097
SYSCALL_DEFINE4(osf_wait4,pid_t,pid,int __user *,ustatus,int,options,struct rusage32 __user *,ur)1098 SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options,
1099 struct rusage32 __user *, ur)
1100 {
1101 struct rusage r;
1102 long err = kernel_wait4(pid, ustatus, options, &r);
1103 if (err <= 0)
1104 return err;
1105 if (!ur)
1106 return err;
1107 if (put_tv_to_tv32(&ur->ru_utime, &r.ru_utime))
1108 return -EFAULT;
1109 if (put_tv_to_tv32(&ur->ru_stime, &r.ru_stime))
1110 return -EFAULT;
1111 if (copy_to_user(&ur->ru_maxrss, &r.ru_maxrss,
1112 sizeof(struct rusage32) - offsetof(struct rusage32, ru_maxrss)))
1113 return -EFAULT;
1114 return err;
1115 }
1116
1117 /*
1118 * I don't know what the parameters are: the first one
1119 * seems to be a timeval pointer, and I suspect the second
1120 * one is the time remaining.. Ho humm.. No documentation.
1121 */
SYSCALL_DEFINE2(osf_usleep_thread,struct timeval32 __user *,sleep,struct timeval32 __user *,remain)1122 SYSCALL_DEFINE2(osf_usleep_thread, struct timeval32 __user *, sleep,
1123 struct timeval32 __user *, remain)
1124 {
1125 struct timespec64 tmp;
1126 unsigned long ticks;
1127
1128 if (get_tv32(&tmp, sleep))
1129 goto fault;
1130
1131 ticks = timespec64_to_jiffies(&tmp);
1132
1133 ticks = schedule_timeout_interruptible(ticks);
1134
1135 if (remain) {
1136 jiffies_to_timespec64(ticks, &tmp);
1137 if (put_tv32(remain, &tmp))
1138 goto fault;
1139 }
1140
1141 return 0;
1142 fault:
1143 return -EFAULT;
1144 }
1145
1146
1147 struct timex32 {
1148 unsigned int modes; /* mode selector */
1149 long offset; /* time offset (usec) */
1150 long freq; /* frequency offset (scaled ppm) */
1151 long maxerror; /* maximum error (usec) */
1152 long esterror; /* estimated error (usec) */
1153 int status; /* clock command/status */
1154 long constant; /* pll time constant */
1155 long precision; /* clock precision (usec) (read only) */
1156 long tolerance; /* clock frequency tolerance (ppm)
1157 * (read only)
1158 */
1159 struct timeval32 time; /* (read only) */
1160 long tick; /* (modified) usecs between clock ticks */
1161
1162 long ppsfreq; /* pps frequency (scaled ppm) (ro) */
1163 long jitter; /* pps jitter (us) (ro) */
1164 int shift; /* interval duration (s) (shift) (ro) */
1165 long stabil; /* pps stability (scaled ppm) (ro) */
1166 long jitcnt; /* jitter limit exceeded (ro) */
1167 long calcnt; /* calibration intervals (ro) */
1168 long errcnt; /* calibration errors (ro) */
1169 long stbcnt; /* stability limit exceeded (ro) */
1170
1171 int :32; int :32; int :32; int :32;
1172 int :32; int :32; int :32; int :32;
1173 int :32; int :32; int :32; int :32;
1174 };
1175
SYSCALL_DEFINE1(old_adjtimex,struct timex32 __user *,txc_p)1176 SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p)
1177 {
1178 struct __kernel_timex txc;
1179 int ret;
1180
1181 /* copy relevant bits of struct timex. */
1182 if (copy_from_user(&txc, txc_p, offsetof(struct timex32, time)) ||
1183 copy_from_user(&txc.tick, &txc_p->tick, sizeof(struct timex32) -
1184 offsetof(struct timex32, tick)))
1185 return -EFAULT;
1186
1187 ret = do_adjtimex(&txc);
1188 if (ret < 0)
1189 return ret;
1190
1191 /* copy back to timex32 */
1192 if (copy_to_user(txc_p, &txc, offsetof(struct timex32, time)) ||
1193 (copy_to_user(&txc_p->tick, &txc.tick, sizeof(struct timex32) -
1194 offsetof(struct timex32, tick))) ||
1195 (put_user(txc.time.tv_sec, &txc_p->time.tv_sec)) ||
1196 (put_user(txc.time.tv_usec, &txc_p->time.tv_usec)))
1197 return -EFAULT;
1198
1199 return ret;
1200 }
1201
1202 /* Get an address range which is currently unmapped. */
1203
1204 static unsigned long
arch_get_unmapped_area_1(struct file * filp,unsigned long addr,unsigned long len,unsigned long limit)1205 arch_get_unmapped_area_1(struct file *filp, unsigned long addr,
1206 unsigned long len, unsigned long limit)
1207 {
1208 struct vm_unmapped_area_info info = {};
1209
1210 info.length = len;
1211 info.low_limit = addr;
1212 info.high_limit = limit;
1213 if (filp && is_file_hugepages(filp))
1214 info.align_mask = huge_page_mask_align(filp);
1215 return vm_unmapped_area(&info);
1216 }
1217
1218 unsigned long
arch_get_unmapped_area(struct file * filp,unsigned long addr,unsigned long len,unsigned long pgoff,unsigned long flags,vm_flags_t vm_flags)1219 arch_get_unmapped_area(struct file *filp, unsigned long addr,
1220 unsigned long len, unsigned long pgoff,
1221 unsigned long flags, vm_flags_t vm_flags)
1222 {
1223 unsigned long limit = TASK_SIZE;
1224
1225 if (len > limit)
1226 return -ENOMEM;
1227
1228 if (flags & MAP_FIXED)
1229 return addr;
1230
1231 /* First, see if the given suggestion fits.
1232
1233 The OSF/1 loader (/sbin/loader) relies on us returning an
1234 address larger than the requested if one exists, which is
1235 a terribly broken way to program.
1236
1237 That said, I can see the use in being able to suggest not
1238 merely specific addresses, but regions of memory -- perhaps
1239 this feature should be incorporated into all ports? */
1240
1241 if (addr) {
1242 addr = arch_get_unmapped_area_1 (filp, PAGE_ALIGN(addr), len,
1243 limit);
1244 if (addr != (unsigned long) -ENOMEM)
1245 return addr;
1246 }
1247
1248 /* Next, try allocating at TASK_UNMAPPED_BASE. */
1249 addr = arch_get_unmapped_area_1 (filp, PAGE_ALIGN(TASK_UNMAPPED_BASE),
1250 len, limit);
1251 if (addr != (unsigned long) -ENOMEM)
1252 return addr;
1253
1254 /* Finally, try allocating in low memory. */
1255 addr = arch_get_unmapped_area_1 (filp, PAGE_SIZE, len, limit);
1256
1257 return addr;
1258 }
1259
SYSCALL_DEFINE2(osf_getpriority,int,which,int,who)1260 SYSCALL_DEFINE2(osf_getpriority, int, which, int, who)
1261 {
1262 int prio = sys_getpriority(which, who);
1263 if (prio >= 0) {
1264 /* Return value is the unbiased priority, i.e. 20 - prio.
1265 This does result in negative return values, so signal
1266 no error */
1267 force_successful_syscall_return();
1268 prio = 20 - prio;
1269 }
1270 return prio;
1271 }
1272
SYSCALL_DEFINE0(getxuid)1273 SYSCALL_DEFINE0(getxuid)
1274 {
1275 current_pt_regs()->r20 = sys_geteuid();
1276 return sys_getuid();
1277 }
1278
SYSCALL_DEFINE0(getxgid)1279 SYSCALL_DEFINE0(getxgid)
1280 {
1281 current_pt_regs()->r20 = sys_getegid();
1282 return sys_getgid();
1283 }
1284
SYSCALL_DEFINE0(getxpid)1285 SYSCALL_DEFINE0(getxpid)
1286 {
1287 current_pt_regs()->r20 = sys_getppid();
1288 return sys_getpid();
1289 }
1290
SYSCALL_DEFINE0(alpha_pipe)1291 SYSCALL_DEFINE0(alpha_pipe)
1292 {
1293 int fd[2];
1294 int res = do_pipe_flags(fd, 0);
1295 if (!res) {
1296 /* The return values are in $0 and $20. */
1297 current_pt_regs()->r20 = fd[1];
1298 res = fd[0];
1299 }
1300 return res;
1301 }
1302
SYSCALL_DEFINE1(sethae,unsigned long,val)1303 SYSCALL_DEFINE1(sethae, unsigned long, val)
1304 {
1305 current_pt_regs()->hae = val;
1306 return 0;
1307 }
1308