forked from TrungNguyen1909/qemu-t8030
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyscall_defs.h
2913 lines (2559 loc) · 98.6 KB
/
syscall_defs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* common syscall defines for all architectures */
/* Note: although the syscall numbers change between architectures,
most of them stay the same, so we handle it by putting ifdefs if
necessary */
#ifndef SYSCALL_DEFS_H
#define SYSCALL_DEFS_H
#include "syscall_nr.h"
/* socket operations for socketcall() */
#define TARGET_SYS_SOCKET 1 /* socket() */
#define TARGET_SYS_BIND 2 /* bind() */
#define TARGET_SYS_CONNECT 3 /* connect() */
#define TARGET_SYS_LISTEN 4 /* listen() */
#define TARGET_SYS_ACCEPT 5 /* accept() */
#define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */
#define TARGET_SYS_GETPEERNAME 7 /* getpeername() */
#define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */
#define TARGET_SYS_SEND 9 /* send() */
#define TARGET_SYS_RECV 10 /* recv() */
#define TARGET_SYS_SENDTO 11 /* sendto() */
#define TARGET_SYS_RECVFROM 12 /* recvfrom() */
#define TARGET_SYS_SHUTDOWN 13 /* shutdown() */
#define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */
#define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */
#define TARGET_SYS_SENDMSG 16 /* sendmsg() */
#define TARGET_SYS_RECVMSG 17 /* recvmsg() */
#define TARGET_SYS_ACCEPT4 18 /* accept4() */
#define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */
#define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */
#define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP))
#define IPCOP_semop 1
#define IPCOP_semget 2
#define IPCOP_semctl 3
#define IPCOP_semtimedop 4
#define IPCOP_msgsnd 11
#define IPCOP_msgrcv 12
#define IPCOP_msgget 13
#define IPCOP_msgctl 14
#define IPCOP_shmat 21
#define IPCOP_shmdt 22
#define IPCOP_shmget 23
#define IPCOP_shmctl 24
#define TARGET_SEMOPM 500
/*
* The following is for compatibility across the various Linux
* platforms. The i386 ioctl numbering scheme doesn't really enforce
* a type field. De facto, however, the top 8 bits of the lower 16
* bits are indeed used as a type field, so we might just as well make
* this explicit here. Please be sure to use the decoding macros
* below from now on.
*/
#define TARGET_IOC_NRBITS 8
#define TARGET_IOC_TYPEBITS 8
#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
|| (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
|| defined(TARGET_SPARC) \
|| defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
/* 16 bit uid wrappers emulation */
#define USE_UID16
#define target_id uint16_t
#else
#define target_id uint32_t
#endif
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
|| defined(TARGET_M68K) || defined(TARGET_CRIS) \
|| defined(TARGET_S390X) || defined(TARGET_OPENRISC) \
|| defined(TARGET_NIOS2) || defined(TARGET_RISCV) \
|| defined(TARGET_XTENSA)
#define TARGET_IOC_SIZEBITS 14
#define TARGET_IOC_DIRBITS 2
#define TARGET_IOC_NONE 0U
#define TARGET_IOC_WRITE 1U
#define TARGET_IOC_READ 2U
#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
defined(TARGET_MIPS)
#define TARGET_IOC_SIZEBITS 13
#define TARGET_IOC_DIRBITS 3
#define TARGET_IOC_NONE 1U
#define TARGET_IOC_READ 2U
#define TARGET_IOC_WRITE 4U
#elif defined(TARGET_HPPA)
#define TARGET_IOC_SIZEBITS 14
#define TARGET_IOC_DIRBITS 2
#define TARGET_IOC_NONE 0U
#define TARGET_IOC_WRITE 2U
#define TARGET_IOC_READ 1U
#elif defined(TARGET_HEXAGON)
#define TARGET_IOC_SIZEBITS 14
#define TARGET_IOC_NONE 0U
#define TARGET_IOC_WRITE 1U
#define TARGET_IOC_READ 2U
#else
#error unsupported CPU
#endif
#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
#define TARGET_IOC_NRSHIFT 0
#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
#define TARGET_IOC(dir,type,nr,size) \
(((dir) << TARGET_IOC_DIRSHIFT) | \
((type) << TARGET_IOC_TYPESHIFT) | \
((nr) << TARGET_IOC_NRSHIFT) | \
((size) << TARGET_IOC_SIZESHIFT))
/* used to create numbers */
#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
/* the size is automatically computed for these defines */
#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
struct target_sockaddr {
abi_ushort sa_family;
uint8_t sa_data[14];
};
struct target_sockaddr_ll {
abi_ushort sll_family; /* Always AF_PACKET */
abi_ushort sll_protocol; /* Physical layer protocol */
abi_int sll_ifindex; /* Interface number */
abi_ushort sll_hatype; /* ARP hardware type */
uint8_t sll_pkttype; /* Packet type */
uint8_t sll_halen; /* Length of address */
uint8_t sll_addr[8]; /* Physical layer address */
};
struct target_sockaddr_un {
abi_ushort su_family;
uint8_t sun_path[108];
};
struct target_sockaddr_nl {
abi_ushort nl_family; /* AF_NETLINK */
abi_ushort __pad;
abi_uint nl_pid;
abi_uint nl_groups;
};
struct target_in_addr {
abi_uint s_addr; /* big endian */
};
struct target_sockaddr_in {
abi_ushort sin_family;
abi_short sin_port; /* big endian */
struct target_in_addr sin_addr;
uint8_t __pad[sizeof(struct target_sockaddr) -
sizeof(abi_ushort) - sizeof(abi_short) -
sizeof(struct target_in_addr)];
};
struct target_sockaddr_in6 {
abi_ushort sin6_family;
abi_ushort sin6_port; /* big endian */
abi_uint sin6_flowinfo; /* big endian */
struct in6_addr sin6_addr; /* IPv6 address, big endian */
abi_uint sin6_scope_id;
};
struct target_sock_filter {
abi_ushort code;
uint8_t jt;
uint8_t jf;
abi_uint k;
};
struct target_sock_fprog {
abi_ushort len;
abi_ulong filter;
};
struct target_ip_mreq {
struct target_in_addr imr_multiaddr;
struct target_in_addr imr_address;
};
struct target_ip_mreqn {
struct target_in_addr imr_multiaddr;
struct target_in_addr imr_address;
abi_long imr_ifindex;
};
struct target_ip_mreq_source {
/* big endian */
uint32_t imr_multiaddr;
uint32_t imr_interface;
uint32_t imr_sourceaddr;
};
struct target_linger {
abi_int l_onoff; /* Linger active */
abi_int l_linger; /* How long to linger for */
};
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
struct target_timeval {
abi_long tv_sec;
abi_int tv_usec;
};
#define target__kernel_sock_timeval target_timeval
#else
struct target_timeval {
abi_long tv_sec;
abi_long tv_usec;
};
struct target__kernel_sock_timeval {
abi_llong tv_sec;
abi_llong tv_usec;
};
#endif
struct target_timespec {
abi_long tv_sec;
abi_long tv_nsec;
};
struct target__kernel_timespec {
abi_llong tv_sec;
abi_llong tv_nsec;
};
struct target_timezone {
abi_int tz_minuteswest;
abi_int tz_dsttime;
};
struct target_itimerval {
struct target_timeval it_interval;
struct target_timeval it_value;
};
struct target_itimerspec {
struct target_timespec it_interval;
struct target_timespec it_value;
};
struct target__kernel_itimerspec {
struct target__kernel_timespec it_interval;
struct target__kernel_timespec it_value;
};
struct target_timex {
abi_uint modes; /* Mode selector */
abi_long offset; /* Time offset */
abi_long freq; /* Frequency offset */
abi_long maxerror; /* Maximum error (microseconds) */
abi_long esterror; /* Estimated error (microseconds) */
abi_int status; /* Clock command/status */
abi_long constant; /* PLL (phase-locked loop) time constant */
abi_long precision; /* Clock precision (microseconds, ro) */
abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */
struct target_timeval time; /* Current time */
abi_long tick; /* Microseconds between clock ticks */
abi_long ppsfreq; /* PPS (pulse per second) frequency */
abi_long jitter; /* PPS jitter (ro); nanoseconds */
abi_int shift; /* PPS interval duration (seconds) */
abi_long stabil; /* PPS stability */
abi_long jitcnt; /* PPS jitter limit exceeded (ro) */
abi_long calcnt; /* PPS calibration intervals */
abi_long errcnt; /* PPS calibration errors */
abi_long stbcnt; /* PPS stability limit exceeded */
abi_int tai; /* TAI offset */
/* Further padding bytes to allow for future expansion */
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
abi_int:32; abi_int:32; abi_int:32;
};
struct target__kernel_timex {
abi_uint modes; /* Mode selector */
abi_int: 32; /* pad */
abi_llong offset; /* Time offset */
abi_llong freq; /* Frequency offset */
abi_llong maxerror; /* Maximum error (microseconds) */
abi_llong esterror; /* Estimated error (microseconds) */
abi_int status; /* Clock command/status */
abi_int: 32; /* pad */
abi_llong constant; /* PLL (phase-locked loop) time constant */
abi_llong precision; /* Clock precision (microseconds, ro) */
abi_llong tolerance; /* Clock freq. tolerance (ppm, ro) */
struct target__kernel_sock_timeval time; /* Current time */
abi_llong tick; /* Microseconds between clock ticks */
abi_llong ppsfreq; /* PPS (pulse per second) frequency */
abi_llong jitter; /* PPS jitter (ro); nanoseconds */
abi_int shift; /* PPS interval duration (seconds) */
abi_int: 32; /* pad */
abi_llong stabil; /* PPS stability */
abi_llong jitcnt; /* PPS jitter limit exceeded (ro) */
abi_llong calcnt; /* PPS calibration intervals */
abi_llong errcnt; /* PPS calibration errors */
abi_llong stbcnt; /* PPS stability limit exceeded */
abi_int tai; /* TAI offset */
/* Further padding bytes to allow for future expansion */
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
abi_int:32; abi_int:32; abi_int:32;
};
typedef abi_long target_clock_t;
#define TARGET_HZ 100
struct target_tms {
target_clock_t tms_utime;
target_clock_t tms_stime;
target_clock_t tms_cutime;
target_clock_t tms_cstime;
};
struct target_utimbuf {
abi_long actime;
abi_long modtime;
};
struct target_sel_arg_struct {
abi_long n;
abi_long inp, outp, exp;
abi_long tvp;
};
struct target_iovec {
abi_long iov_base; /* Starting address */
abi_long iov_len; /* Number of bytes */
};
struct target_msghdr {
abi_long msg_name; /* Socket name */
int msg_namelen; /* Length of name */
abi_long msg_iov; /* Data blocks */
abi_long msg_iovlen; /* Number of blocks */
abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
abi_long msg_controllen; /* Length of cmsg list */
unsigned int msg_flags;
};
struct target_cmsghdr {
abi_long cmsg_len;
int cmsg_level;
int cmsg_type;
};
#define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \
__target_cmsg_nxthdr(mhdr, cmsg, cmsg_start)
#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
& (size_t) ~(sizeof (abi_long) - 1))
#define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \
TARGET_CMSG_ALIGN(len))
#define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len))
static __inline__ struct target_cmsghdr *
__target_cmsg_nxthdr(struct target_msghdr *__mhdr,
struct target_cmsghdr *__cmsg,
struct target_cmsghdr *__cmsg_start)
{
struct target_cmsghdr *__ptr;
__ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
+ TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start)
> tswapal(__mhdr->msg_controllen)) {
/* No more entries. */
return (struct target_cmsghdr *)0;
}
return __ptr;
}
struct target_mmsghdr {
struct target_msghdr msg_hdr; /* Message header */
unsigned int msg_len; /* Number of bytes transmitted */
};
struct target_rusage {
struct target_timeval ru_utime; /* user time used */
struct target_timeval ru_stime; /* system time used */
abi_long ru_maxrss; /* maximum resident set size */
abi_long ru_ixrss; /* integral shared memory size */
abi_long ru_idrss; /* integral unshared data size */
abi_long ru_isrss; /* integral unshared stack size */
abi_long ru_minflt; /* page reclaims */
abi_long ru_majflt; /* page faults */
abi_long ru_nswap; /* swaps */
abi_long ru_inblock; /* block input operations */
abi_long ru_oublock; /* block output operations */
abi_long ru_msgsnd; /* messages sent */
abi_long ru_msgrcv; /* messages received */
abi_long ru_nsignals; /* signals received */
abi_long ru_nvcsw; /* voluntary context switches */
abi_long ru_nivcsw; /* involuntary " */
};
typedef struct {
int val[2];
} kernel_fsid_t;
struct target_dirent {
abi_long d_ino;
abi_long d_off;
unsigned short d_reclen;
char d_name[];
};
struct target_dirent64 {
uint64_t d_ino;
int64_t d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[256];
};
/* mostly generic signal stuff */
#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
#ifdef TARGET_MIPS
#define TARGET_NSIG 128
#else
#define TARGET_NSIG 64
#endif
#define TARGET_NSIG_BPW TARGET_ABI_BITS
#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
typedef struct {
abi_ulong sig[TARGET_NSIG_WORDS];
} target_sigset_t;
#ifdef BSWAP_NEEDED
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
{
int i;
for(i = 0;i < TARGET_NSIG_WORDS; i++)
d->sig[i] = tswapal(s->sig[i]);
}
#else
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
{
*d = *s;
}
#endif
static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
{
int i;
d->sig[0] = set;
for(i = 1;i < TARGET_NSIG_WORDS; i++)
d->sig[i] = 0;
}
void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
void host_to_target_old_sigset(abi_ulong *old_sigset,
const sigset_t *sigset);
void target_to_host_old_sigset(sigset_t *sigset,
const abi_ulong *old_sigset);
struct target_sigaction;
int do_sigaction(int sig, const struct target_sigaction *act,
struct target_sigaction *oact, abi_ulong ka_restorer);
#include "target_signal.h"
#ifdef TARGET_SA_RESTORER
#define TARGET_ARCH_HAS_SA_RESTORER 1
#endif
#if defined(TARGET_ALPHA)
typedef int32_t target_old_sa_flags;
#else
typedef abi_ulong target_old_sa_flags;
#endif
#if defined(TARGET_MIPS)
struct target_sigaction {
uint32_t sa_flags;
#if defined(TARGET_ABI_MIPSN32)
uint32_t _sa_handler;
#else
abi_ulong _sa_handler;
#endif
target_sigset_t sa_mask;
#ifdef TARGET_ARCH_HAS_SA_RESTORER
/* ??? This is always present, but ignored unless O32. */
abi_ulong sa_restorer;
#endif
};
#else
struct target_old_sigaction {
abi_ulong _sa_handler;
abi_ulong sa_mask;
target_old_sa_flags sa_flags;
#ifdef TARGET_ARCH_HAS_SA_RESTORER
abi_ulong sa_restorer;
#endif
};
struct target_sigaction {
abi_ulong _sa_handler;
abi_ulong sa_flags;
#ifdef TARGET_ARCH_HAS_SA_RESTORER
abi_ulong sa_restorer;
#endif
target_sigset_t sa_mask;
#ifdef TARGET_ARCH_HAS_KA_RESTORER
abi_ulong ka_restorer;
#endif
};
#endif
typedef union target_sigval {
int sival_int;
abi_ulong sival_ptr;
} target_sigval_t;
#if 0
#if defined (TARGET_SPARC)
typedef struct {
struct {
abi_ulong psr;
abi_ulong pc;
abi_ulong npc;
abi_ulong y;
abi_ulong u_regs[16]; /* globals and ins */
} si_regs;
int si_mask;
} __siginfo_t;
typedef struct {
unsigned long si_float_regs [32];
unsigned long si_fsr;
unsigned long si_fpqdepth;
struct {
unsigned long *insn_addr;
unsigned long insn;
} si_fpqueue [16];
} __siginfo_fpu_t;
#endif
#endif
#define TARGET_SI_MAX_SIZE 128
#if TARGET_ABI_BITS == 32
#define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
#else
#define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int))
#endif
#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int))
/* Within QEMU the top 16 bits of si_code indicate which of the parts of
* the union in target_siginfo is valid. This only applies between
* host_to_target_siginfo_noswap() and tswap_siginfo(); it does not
* appear either within host siginfo_t or in target_siginfo structures
* which we get from the guest userspace program. (The Linux kernel
* does a similar thing with using the top bits for its own internal
* purposes but not letting them be visible to userspace.)
*/
#define QEMU_SI_KILL 0
#define QEMU_SI_TIMER 1
#define QEMU_SI_POLL 2
#define QEMU_SI_FAULT 3
#define QEMU_SI_CHLD 4
#define QEMU_SI_RT 5
typedef struct target_siginfo {
#ifdef TARGET_MIPS
int si_signo;
int si_code;
int si_errno;
#else
int si_signo;
int si_errno;
int si_code;
#endif
union {
int _pad[TARGET_SI_PAD_SIZE];
/* kill() */
struct {
pid_t _pid; /* sender's pid */
uid_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
struct {
unsigned int _timer1;
unsigned int _timer2;
} _timer;
/* POSIX.1b signals */
struct {
pid_t _pid; /* sender's pid */
uid_t _uid; /* sender's uid */
target_sigval_t _sigval;
} _rt;
/* SIGCHLD */
struct {
pid_t _pid; /* which child */
uid_t _uid; /* sender's uid */
int _status; /* exit code */
target_clock_t _utime;
target_clock_t _stime;
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
struct {
abi_ulong _addr; /* faulting insn/memory ref. */
} _sigfault;
/* SIGPOLL */
struct {
int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
int _fd;
} _sigpoll;
} _sifields;
} target_siginfo_t;
/*
* si_code values
* Digital reserves positive values for kernel-generated signals.
*/
#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
#define TARGET_SI_QUEUE -1 /* sent by sigqueue */
#define TARGET_SI_TIMER -2 /* sent by timer expiration */
#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
/*
* SIGILL si_codes
*/
#define TARGET_ILL_ILLOPC (1) /* illegal opcode */
#define TARGET_ILL_ILLOPN (2) /* illegal operand */
#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
#define TARGET_ILL_ILLTRP (4) /* illegal trap */
#define TARGET_ILL_PRVOPC (5) /* privileged opcode */
#define TARGET_ILL_PRVREG (6) /* privileged register */
#define TARGET_ILL_COPROC (7) /* coprocessor error */
#define TARGET_ILL_BADSTK (8) /* internal stack error */
/*
* SIGFPE si_codes
*/
#define TARGET_FPE_INTDIV (1) /* integer divide by zero */
#define TARGET_FPE_INTOVF (2) /* integer overflow */
#define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
#define TARGET_FPE_FLTOVF (4) /* floating point overflow */
#define TARGET_FPE_FLTUND (5) /* floating point underflow */
#define TARGET_FPE_FLTRES (6) /* floating point inexact result */
#define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
#define TARGET_FPE_FLTSUB (8) /* subscript out of range */
#define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */
#define TARGET_NSIGFPE 15
/*
* SIGSEGV si_codes
*/
#define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
#define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
#define TARGET_SEGV_BNDERR (3) /* failed address bound checks */
/*
* SIGBUS si_codes
*/
#define TARGET_BUS_ADRALN (1) /* invalid address alignment */
#define TARGET_BUS_ADRERR (2) /* non-existent physical address */
#define TARGET_BUS_OBJERR (3) /* object specific hardware error */
/* hardware memory error consumed on a machine check: action required */
#define TARGET_BUS_MCEERR_AR (4)
/* hardware memory error detected in process but not consumed: action optional*/
#define TARGET_BUS_MCEERR_AO (5)
/*
* SIGTRAP si_codes
*/
#define TARGET_TRAP_BRKPT (1) /* process breakpoint */
#define TARGET_TRAP_TRACE (2) /* process trace trap */
#define TARGET_TRAP_BRANCH (3) /* process taken branch trap */
#define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */
struct target_rlimit {
abi_ulong rlim_cur;
abi_ulong rlim_max;
};
#if defined(TARGET_ALPHA)
#define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
#elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
#define TARGET_RLIM_INFINITY 0x7fffffffUL
#else
#define TARGET_RLIM_INFINITY ((abi_ulong)-1)
#endif
#if defined(TARGET_MIPS)
#define TARGET_RLIMIT_CPU 0
#define TARGET_RLIMIT_FSIZE 1
#define TARGET_RLIMIT_DATA 2
#define TARGET_RLIMIT_STACK 3
#define TARGET_RLIMIT_CORE 4
#define TARGET_RLIMIT_RSS 7
#define TARGET_RLIMIT_NPROC 8
#define TARGET_RLIMIT_NOFILE 5
#define TARGET_RLIMIT_MEMLOCK 9
#define TARGET_RLIMIT_AS 6
#define TARGET_RLIMIT_LOCKS 10
#define TARGET_RLIMIT_SIGPENDING 11
#define TARGET_RLIMIT_MSGQUEUE 12
#define TARGET_RLIMIT_NICE 13
#define TARGET_RLIMIT_RTPRIO 14
#else
#define TARGET_RLIMIT_CPU 0
#define TARGET_RLIMIT_FSIZE 1
#define TARGET_RLIMIT_DATA 2
#define TARGET_RLIMIT_STACK 3
#define TARGET_RLIMIT_CORE 4
#define TARGET_RLIMIT_RSS 5
#if defined(TARGET_SPARC)
#define TARGET_RLIMIT_NOFILE 6
#define TARGET_RLIMIT_NPROC 7
#else
#define TARGET_RLIMIT_NPROC 6
#define TARGET_RLIMIT_NOFILE 7
#endif
#define TARGET_RLIMIT_MEMLOCK 8
#define TARGET_RLIMIT_AS 9
#define TARGET_RLIMIT_LOCKS 10
#define TARGET_RLIMIT_SIGPENDING 11
#define TARGET_RLIMIT_MSGQUEUE 12
#define TARGET_RLIMIT_NICE 13
#define TARGET_RLIMIT_RTPRIO 14
#endif
struct target_pollfd {
int fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
};
/* virtual terminal ioctls */
#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
#define TARGET_KDMKTONE 0x4B30 /* generate tone */
#define TARGET_KDGKBTYPE 0x4b33
#define TARGET_KDSETMODE 0x4b3a
#define TARGET_KDGKBMODE 0x4b44
#define TARGET_KDSKBMODE 0x4b45
#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */
#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */
#define TARGET_KDGETLED 0x4B31 /* return current led state */
#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
#define TARGET_KDSIGACCEPT 0x4B4E
struct target_rtc_pll_info {
int pll_ctrl;
int pll_value;
int pll_max;
int pll_min;
int pll_posmult;
int pll_negmult;
abi_long pll_clock;
};
/* real time clock ioctls */
#define TARGET_RTC_AIE_ON TARGET_IO('p', 0x01)
#define TARGET_RTC_AIE_OFF TARGET_IO('p', 0x02)
#define TARGET_RTC_UIE_ON TARGET_IO('p', 0x03)
#define TARGET_RTC_UIE_OFF TARGET_IO('p', 0x04)
#define TARGET_RTC_PIE_ON TARGET_IO('p', 0x05)
#define TARGET_RTC_PIE_OFF TARGET_IO('p', 0x06)
#define TARGET_RTC_WIE_ON TARGET_IO('p', 0x0f)
#define TARGET_RTC_WIE_OFF TARGET_IO('p', 0x10)
#define TARGET_RTC_ALM_READ TARGET_IOR('p', 0x08, struct rtc_time)
#define TARGET_RTC_ALM_SET TARGET_IOW('p', 0x07, struct rtc_time)
#define TARGET_RTC_RD_TIME TARGET_IOR('p', 0x09, struct rtc_time)
#define TARGET_RTC_SET_TIME TARGET_IOW('p', 0x0a, struct rtc_time)
#define TARGET_RTC_IRQP_READ TARGET_IOR('p', 0x0b, abi_ulong)
#define TARGET_RTC_IRQP_SET TARGET_IOW('p', 0x0c, abi_ulong)
#define TARGET_RTC_EPOCH_READ TARGET_IOR('p', 0x0d, abi_ulong)
#define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong)
#define TARGET_RTC_WKALM_RD TARGET_IOR('p', 0x10, struct rtc_wkalrm)
#define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalrm)
#define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \
struct target_rtc_pll_info)
#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \
struct target_rtc_pll_info)
#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int)
#define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14)
#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \
defined(TARGET_XTENSA)
#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int)
#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int)
#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t)
#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)
#else
#define TARGET_FIOGETOWN 0x8903
#define TARGET_FIOSETOWN 0x8901
#define TARGET_SIOCATMARK 0x8905
#define TARGET_SIOCSPGRP 0x8902
#define TARGET_SIOCGPGRP 0x8904
#endif
#if defined(TARGET_SH4)
#define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval)
#define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec)
#else
#define TARGET_SIOCGSTAMP_OLD 0x8906
#define TARGET_SIOCGSTAMPNS_OLD 0x8907
#endif
#define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2])
#define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2])
/* Networking ioctls */
#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
#define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
#define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
#define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
#define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
#define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
#define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
#define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
#define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
#define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
#define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
#define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
#define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
#define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
#define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
#define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
#define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
#define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
#define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
#define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
#define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
#define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
#define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
#define TARGET_SIOCSIFENCAP 0x8926
#define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
#define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
#define TARGET_SIOCSIFSLAVE 0x8930
#define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
#define TARGET_SIOCDELMULTI 0x8932
#define TARGET_SIOCGIFINDEX 0x8933
#define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */
#define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */
/* Bridging control calls */
#define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
#define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
#define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
#define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
/* ARP cache control calls. */
#define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
#define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
#define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
#define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
#define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
#define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
/* RARP cache control calls. */
#define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
#define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
#define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
/* Driver configuration calls */
#define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
#define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
/* DLCI configuration calls */
#define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
#define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
/* From <linux/wireless.h> */
#define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
/* From <linux/if_tun.h> */
#define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, int)
#define TARGET_TUNSETIFF TARGET_IOW('T', 202, int)
#define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, int)
#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int)
#define TARGET_TUNSETLINK TARGET_IOW('T', 205, int)
#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int)
#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, unsigned int)
#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, unsigned int)
#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, unsigned int)
#define TARGET_TUNGETIFF TARGET_IOR('T', 210, unsigned int)
#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int)
#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int)
/*
* TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a
* user pointer in TUNATTACHFILTER, which we are not able to correctly handle.
*/
#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int)
#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int)
#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int)
#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, unsigned int)
/* TUNGETFILTER is not supported: see TUNATTACHFILTER. */
#define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int)
#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int)
#define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, int)
#define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, int)
#define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, int)
#define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, int)
#define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, int)
#define TARGET_TUNGETDEVNETNS TARGET_IO('T', 227)
/* From <linux/random.h> */
#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int)
#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int)
#define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04)
#define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06)
#define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07)
/* From <linux/fs.h> */
#define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
#define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
#define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
#define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
#define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
#define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
#define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
#define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
#define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
#define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
#define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
#define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */
/* A jump here: 108-111 have been used for various private purposes. */
#define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)
#define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)
#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
/* return device size in bytes
(u64 *arg) */
#define TARGET_BLKDISCARD TARGET_IO(0x12, 119)
#define TARGET_BLKIOMIN TARGET_IO(0x12, 120)
#define TARGET_BLKIOOPT TARGET_IO(0x12, 121)
#define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122)
#define TARGET_BLKPBSZGET TARGET_IO(0x12, 123)
#define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124)
#define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125)
#define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126)
#define TARGET_BLKZEROOUT TARGET_IO(0x12, 127)
/* From <linux/fd.h> */
#define TARGET_FDMSGON TARGET_IO(2, 0x45)
#define TARGET_FDMSGOFF TARGET_IO(2, 0x46)
#define TARGET_FDFMTBEG TARGET_IO(2, 0x47)
#define TARGET_FDFMTTRK TARGET_IOW(2, 0x48, struct format_descr)
#define TARGET_FDFMTEND TARGET_IO(2, 0x49)
#define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a)
#define TARGET_FDFLUSH TARGET_IO(2, 0x4b)