aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig12
-rw-r--r--arch/sparc/defconfig165
-rw-r--r--arch/sparc/kernel/Makefile10
-rw-r--r--arch/sparc/kernel/entry.S206
-rw-r--r--arch/sparc/kernel/errtbls.c144
-rw-r--r--arch/sparc/kernel/head.S37
-rw-r--r--arch/sparc/kernel/sclow.S86
-rw-r--r--arch/sparc/kernel/signal.c307
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c8
-rw-r--r--arch/sparc/kernel/sunos_asm.S67
-rw-r--r--arch/sparc/kernel/sunos_ioctl.c230
-rw-r--r--arch/sparc/kernel/sys_solaris.c35
-rw-r--r--arch/sparc/kernel/sys_sunos.c1210
-rw-r--r--arch/sparc/kernel/systbls.S121
14 files changed, 130 insertions, 2508 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c40343c54920..49590f8fe98c 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -27,9 +27,6 @@ config ARCH_NO_VIRT_TO_BUS
27config OF 27config OF
28 def_bool y 28 def_bool y
29 29
30config ARCH_SUPPORTS_AOUT
31 def_bool y
32
33config HZ 30config HZ
34 int 31 int
35 default 100 32 default 100
@@ -257,15 +254,6 @@ config SPARC_LED
257 254
258source "fs/Kconfig.binfmt" 255source "fs/Kconfig.binfmt"
259 256
260config SUNOS_EMUL
261 bool "SunOS binary emulation"
262 help
263 This allows you to run most SunOS binaries. If you want to do this,
264 say Y here and place appropriate files in /usr/gnemul/sunos. See
265 <http://www.ultralinux.org/faq.html> for more information. If you
266 want to run SunOS binaries on an Ultra you must also say Y to
267 "Kernel support for 32-bit a.out binaries" above.
268
269source "mm/Kconfig" 257source "mm/Kconfig"
270 258
271endmenu 259endmenu
diff --git a/arch/sparc/defconfig b/arch/sparc/defconfig
index f7a509149199..6a2c57a2fe71 100644
--- a/arch/sparc/defconfig
+++ b/arch/sparc/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc1 3# Linux kernel version: 2.6.25
4# Wed Jul 25 15:30:21 2007 4# Sun Apr 20 01:49:51 2008
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_HIGHMEM=y 7CONFIG_HIGHMEM=y
@@ -9,18 +9,15 @@ CONFIG_ZONE_DMA=y
9CONFIG_GENERIC_ISA_DMA=y 9CONFIG_GENERIC_ISA_DMA=y
10CONFIG_ARCH_NO_VIRT_TO_BUS=y 10CONFIG_ARCH_NO_VIRT_TO_BUS=y
11CONFIG_OF=y 11CONFIG_OF=y
12CONFIG_HZ=100
12CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
13 14
14# 15#
15# Code maturity level options 16# General setup
16# 17#
17CONFIG_EXPERIMENTAL=y 18CONFIG_EXPERIMENTAL=y
18CONFIG_BROKEN_ON_SMP=y 19CONFIG_BROKEN_ON_SMP=y
19CONFIG_INIT_ENV_ARG_LIMIT=32 20CONFIG_INIT_ENV_ARG_LIMIT=32
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION="" 21CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y 22CONFIG_LOCALVERSION_AUTO=y
26CONFIG_SWAP=y 23CONFIG_SWAP=y
@@ -29,12 +26,23 @@ CONFIG_SYSVIPC_SYSCTL=y
29CONFIG_POSIX_MQUEUE=y 26CONFIG_POSIX_MQUEUE=y
30# CONFIG_BSD_PROCESS_ACCT is not set 27# CONFIG_BSD_PROCESS_ACCT is not set
31# CONFIG_TASKSTATS is not set 28# CONFIG_TASKSTATS is not set
32# CONFIG_USER_NS is not set
33# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
34# CONFIG_IKCONFIG is not set 30# CONFIG_IKCONFIG is not set
35CONFIG_LOG_BUF_SHIFT=14 31CONFIG_LOG_BUF_SHIFT=14
32# CONFIG_CGROUPS is not set
33CONFIG_GROUP_SCHED=y
34CONFIG_FAIR_GROUP_SCHED=y
35CONFIG_RT_GROUP_SCHED=y
36CONFIG_USER_SCHED=y
37# CONFIG_CGROUP_SCHED is not set
36CONFIG_SYSFS_DEPRECATED=y 38CONFIG_SYSFS_DEPRECATED=y
39CONFIG_SYSFS_DEPRECATED_V2=y
37# CONFIG_RELAY is not set 40# CONFIG_RELAY is not set
41CONFIG_NAMESPACES=y
42# CONFIG_UTS_NS is not set
43# CONFIG_IPC_NS is not set
44# CONFIG_USER_NS is not set
45# CONFIG_PID_NS is not set
38CONFIG_BLK_DEV_INITRD=y 46CONFIG_BLK_DEV_INITRD=y
39CONFIG_INITRAMFS_SOURCE="" 47CONFIG_INITRAMFS_SOURCE=""
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 48# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -49,6 +57,7 @@ CONFIG_HOTPLUG=y
49CONFIG_PRINTK=y 57CONFIG_PRINTK=y
50CONFIG_BUG=y 58CONFIG_BUG=y
51CONFIG_ELF_CORE=y 59CONFIG_ELF_CORE=y
60CONFIG_COMPAT_BRK=y
52CONFIG_BASE_FULL=y 61CONFIG_BASE_FULL=y
53CONFIG_FUTEX=y 62CONFIG_FUTEX=y
54CONFIG_ANON_INODES=y 63CONFIG_ANON_INODES=y
@@ -61,6 +70,13 @@ CONFIG_VM_EVENT_COUNTERS=y
61CONFIG_SLAB=y 70CONFIG_SLAB=y
62# CONFIG_SLUB is not set 71# CONFIG_SLUB is not set
63# CONFIG_SLOB is not set 72# CONFIG_SLOB is not set
73# CONFIG_PROFILING is not set
74# CONFIG_MARKERS is not set
75CONFIG_HAVE_OPROFILE=y
76# CONFIG_HAVE_KPROBES is not set
77# CONFIG_HAVE_KRETPROBES is not set
78CONFIG_PROC_PAGE_MONITOR=y
79CONFIG_SLABINFO=y
64CONFIG_RT_MUTEXES=y 80CONFIG_RT_MUTEXES=y
65# CONFIG_TINY_SHMEM is not set 81# CONFIG_TINY_SHMEM is not set
66CONFIG_BASE_SMALL=0 82CONFIG_BASE_SMALL=0
@@ -88,6 +104,7 @@ CONFIG_IOSCHED_CFQ=y
88CONFIG_DEFAULT_CFQ=y 104CONFIG_DEFAULT_CFQ=y
89# CONFIG_DEFAULT_NOOP is not set 105# CONFIG_DEFAULT_NOOP is not set
90CONFIG_DEFAULT_IOSCHED="cfq" 106CONFIG_DEFAULT_IOSCHED="cfq"
107CONFIG_CLASSIC_RCU=y
91 108
92# 109#
93# General machine setup 110# General machine setup
@@ -113,14 +130,13 @@ CONFIG_SUN_PM=y
113CONFIG_PCI=y 130CONFIG_PCI=y
114CONFIG_PCI_SYSCALL=y 131CONFIG_PCI_SYSCALL=y
115# CONFIG_ARCH_SUPPORTS_MSI is not set 132# CONFIG_ARCH_SUPPORTS_MSI is not set
133CONFIG_PCI_LEGACY=y
116# CONFIG_PCI_DEBUG is not set 134# CONFIG_PCI_DEBUG is not set
117# CONFIG_NO_DMA is not set 135# CONFIG_NO_DMA is not set
118CONFIG_SUN_OPENPROMFS=m 136CONFIG_SUN_OPENPROMFS=m
119# CONFIG_SPARC_LED is not set 137# CONFIG_SPARC_LED is not set
120CONFIG_BINFMT_ELF=y 138CONFIG_BINFMT_ELF=y
121CONFIG_BINFMT_AOUT=y
122CONFIG_BINFMT_MISC=m 139CONFIG_BINFMT_MISC=m
123CONFIG_SUNOS_EMUL=y
124CONFIG_SELECT_MEMORY_MODEL=y 140CONFIG_SELECT_MEMORY_MODEL=y
125CONFIG_FLATMEM_MANUAL=y 141CONFIG_FLATMEM_MANUAL=y
126# CONFIG_DISCONTIGMEM_MANUAL is not set 142# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -128,6 +144,7 @@ CONFIG_FLATMEM_MANUAL=y
128CONFIG_FLATMEM=y 144CONFIG_FLATMEM=y
129CONFIG_FLAT_NODE_MEM_MAP=y 145CONFIG_FLAT_NODE_MEM_MAP=y
130# CONFIG_SPARSEMEM_STATIC is not set 146# CONFIG_SPARSEMEM_STATIC is not set
147# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
131CONFIG_SPLIT_PTLOCK_CPUS=4 148CONFIG_SPLIT_PTLOCK_CPUS=4
132# CONFIG_RESOURCES_64BIT is not set 149# CONFIG_RESOURCES_64BIT is not set
133CONFIG_ZONE_DMA_FLAG=1 150CONFIG_ZONE_DMA_FLAG=1
@@ -148,6 +165,7 @@ CONFIG_XFRM=y
148CONFIG_XFRM_USER=m 165CONFIG_XFRM_USER=m
149# CONFIG_XFRM_SUB_POLICY is not set 166# CONFIG_XFRM_SUB_POLICY is not set
150# CONFIG_XFRM_MIGRATE is not set 167# CONFIG_XFRM_MIGRATE is not set
168# CONFIG_XFRM_STATISTICS is not set
151CONFIG_NET_KEY=m 169CONFIG_NET_KEY=m
152# CONFIG_NET_KEY_MIGRATE is not set 170# CONFIG_NET_KEY_MIGRATE is not set
153CONFIG_INET=y 171CONFIG_INET=y
@@ -170,6 +188,7 @@ CONFIG_INET_TUNNEL=y
170CONFIG_INET_XFRM_MODE_TRANSPORT=y 188CONFIG_INET_XFRM_MODE_TRANSPORT=y
171CONFIG_INET_XFRM_MODE_TUNNEL=y 189CONFIG_INET_XFRM_MODE_TUNNEL=y
172CONFIG_INET_XFRM_MODE_BEET=y 190CONFIG_INET_XFRM_MODE_BEET=y
191# CONFIG_INET_LRO is not set
173CONFIG_INET_DIAG=y 192CONFIG_INET_DIAG=y
174CONFIG_INET_TCP_DIAG=y 193CONFIG_INET_TCP_DIAG=y
175# CONFIG_TCP_CONG_ADVANCED is not set 194# CONFIG_TCP_CONG_ADVANCED is not set
@@ -191,8 +210,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
191CONFIG_INET6_XFRM_MODE_BEET=m 210CONFIG_INET6_XFRM_MODE_BEET=m
192# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 211# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
193CONFIG_IPV6_SIT=m 212CONFIG_IPV6_SIT=m
213CONFIG_IPV6_NDISC_NODETYPE=y
194CONFIG_IPV6_TUNNEL=m 214CONFIG_IPV6_TUNNEL=m
195# CONFIG_IPV6_MULTIPLE_TABLES is not set 215# CONFIG_IPV6_MULTIPLE_TABLES is not set
216# CONFIG_IPV6_MROUTE is not set
196# CONFIG_NETWORK_SECMARK is not set 217# CONFIG_NETWORK_SECMARK is not set
197# CONFIG_NETFILTER is not set 218# CONFIG_NETFILTER is not set
198# CONFIG_IP_DCCP is not set 219# CONFIG_IP_DCCP is not set
@@ -214,10 +235,6 @@ CONFIG_SCTP_HMAC_MD5=y
214# CONFIG_LAPB is not set 235# CONFIG_LAPB is not set
215# CONFIG_ECONET is not set 236# CONFIG_ECONET is not set
216# CONFIG_WAN_ROUTER is not set 237# CONFIG_WAN_ROUTER is not set
217
218#
219# QoS and/or fair queueing
220#
221# CONFIG_NET_SCHED is not set 238# CONFIG_NET_SCHED is not set
222 239
223# 240#
@@ -225,6 +242,7 @@ CONFIG_SCTP_HMAC_MD5=y
225# 242#
226CONFIG_NET_PKTGEN=m 243CONFIG_NET_PKTGEN=m
227# CONFIG_HAMRADIO is not set 244# CONFIG_HAMRADIO is not set
245# CONFIG_CAN is not set
228# CONFIG_IRDA is not set 246# CONFIG_IRDA is not set
229# CONFIG_BT is not set 247# CONFIG_BT is not set
230CONFIG_AF_RXRPC=m 248CONFIG_AF_RXRPC=m
@@ -248,6 +266,7 @@ CONFIG_AF_RXRPC=m
248# 266#
249# Generic Driver Options 267# Generic Driver Options
250# 268#
269CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
251CONFIG_STANDALONE=y 270CONFIG_STANDALONE=y
252CONFIG_PREVENT_FIRMWARE_BUILD=y 271CONFIG_PREVENT_FIRMWARE_BUILD=y
253# CONFIG_FW_LOADER is not set 272# CONFIG_FW_LOADER is not set
@@ -271,7 +290,7 @@ CONFIG_BLK_DEV_CRYPTOLOOP=m
271CONFIG_BLK_DEV_RAM=y 290CONFIG_BLK_DEV_RAM=y
272CONFIG_BLK_DEV_RAM_COUNT=16 291CONFIG_BLK_DEV_RAM_COUNT=16
273CONFIG_BLK_DEV_RAM_SIZE=4096 292CONFIG_BLK_DEV_RAM_SIZE=4096
274CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 293# CONFIG_BLK_DEV_XIP is not set
275# CONFIG_CDROM_PKTCDVD is not set 294# CONFIG_CDROM_PKTCDVD is not set
276# CONFIG_ATA_OVER_ETH is not set 295# CONFIG_ATA_OVER_ETH is not set
277CONFIG_MISC_DEVICES=y 296CONFIG_MISC_DEVICES=y
@@ -279,6 +298,8 @@ CONFIG_MISC_DEVICES=y
279# CONFIG_EEPROM_93CX6 is not set 298# CONFIG_EEPROM_93CX6 is not set
280# CONFIG_SGI_IOC4 is not set 299# CONFIG_SGI_IOC4 is not set
281# CONFIG_TIFM_CORE is not set 300# CONFIG_TIFM_CORE is not set
301# CONFIG_ENCLOSURE_SERVICES is not set
302CONFIG_HAVE_IDE=y
282# CONFIG_IDE is not set 303# CONFIG_IDE is not set
283 304
284# 305#
@@ -318,6 +339,7 @@ CONFIG_SCSI_SPI_ATTRS=y
318# CONFIG_SCSI_FC_ATTRS is not set 339# CONFIG_SCSI_FC_ATTRS is not set
319# CONFIG_SCSI_ISCSI_ATTRS is not set 340# CONFIG_SCSI_ISCSI_ATTRS is not set
320# CONFIG_SCSI_SAS_LIBSAS is not set 341# CONFIG_SCSI_SAS_LIBSAS is not set
342# CONFIG_SCSI_SRP_ATTRS is not set
321CONFIG_SCSI_LOWLEVEL=y 343CONFIG_SCSI_LOWLEVEL=y
322# CONFIG_ISCSI_TCP is not set 344# CONFIG_ISCSI_TCP is not set
323# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 345# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -338,6 +360,7 @@ CONFIG_SCSI_LOWLEVEL=y
338# CONFIG_SCSI_IPS is not set 360# CONFIG_SCSI_IPS is not set
339# CONFIG_SCSI_INITIO is not set 361# CONFIG_SCSI_INITIO is not set
340# CONFIG_SCSI_INIA100 is not set 362# CONFIG_SCSI_INIA100 is not set
363# CONFIG_SCSI_MVSAS is not set
341# CONFIG_SCSI_STEX is not set 364# CONFIG_SCSI_STEX is not set
342# CONFIG_SCSI_SYM53C8XX_2 is not set 365# CONFIG_SCSI_SYM53C8XX_2 is not set
343# CONFIG_SCSI_QLOGIC_1280 is not set 366# CONFIG_SCSI_QLOGIC_1280 is not set
@@ -353,14 +376,7 @@ CONFIG_SCSI_SUNESP=y
353# CONFIG_SCSI_SRP is not set 376# CONFIG_SCSI_SRP is not set
354# CONFIG_ATA is not set 377# CONFIG_ATA is not set
355# CONFIG_MD is not set 378# CONFIG_MD is not set
356
357#
358# Fusion MPT device support
359#
360# CONFIG_FUSION is not set 379# CONFIG_FUSION is not set
361# CONFIG_FUSION_SPI is not set
362# CONFIG_FUSION_FC is not set
363# CONFIG_FUSION_SAS is not set
364 380
365# 381#
366# IEEE 1394 (FireWire) support 382# IEEE 1394 (FireWire) support
@@ -375,6 +391,7 @@ CONFIG_DUMMY=m
375# CONFIG_MACVLAN is not set 391# CONFIG_MACVLAN is not set
376# CONFIG_EQUALIZER is not set 392# CONFIG_EQUALIZER is not set
377CONFIG_TUN=m 393CONFIG_TUN=m
394# CONFIG_VETH is not set
378# CONFIG_ARCNET is not set 395# CONFIG_ARCNET is not set
379# CONFIG_PHYLIB is not set 396# CONFIG_PHYLIB is not set
380CONFIG_NET_ETHERNET=y 397CONFIG_NET_ETHERNET=y
@@ -388,11 +405,20 @@ CONFIG_SUNQE=m
388# CONFIG_NET_VENDOR_3COM is not set 405# CONFIG_NET_VENDOR_3COM is not set
389# CONFIG_NET_TULIP is not set 406# CONFIG_NET_TULIP is not set
390# CONFIG_HP100 is not set 407# CONFIG_HP100 is not set
408# CONFIG_IBM_NEW_EMAC_ZMII is not set
409# CONFIG_IBM_NEW_EMAC_RGMII is not set
410# CONFIG_IBM_NEW_EMAC_TAH is not set
411# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
391# CONFIG_NET_PCI is not set 412# CONFIG_NET_PCI is not set
413# CONFIG_B44 is not set
392CONFIG_NETDEV_1000=y 414CONFIG_NETDEV_1000=y
393# CONFIG_ACENIC is not set 415# CONFIG_ACENIC is not set
394# CONFIG_DL2K is not set 416# CONFIG_DL2K is not set
395# CONFIG_E1000 is not set 417# CONFIG_E1000 is not set
418# CONFIG_E1000E is not set
419# CONFIG_E1000E_ENABLED is not set
420# CONFIG_IP1000 is not set
421# CONFIG_IGB is not set
396# CONFIG_MYRI_SBUS is not set 422# CONFIG_MYRI_SBUS is not set
397# CONFIG_NS83820 is not set 423# CONFIG_NS83820 is not set
398# CONFIG_HAMACHI is not set 424# CONFIG_HAMACHI is not set
@@ -409,11 +435,15 @@ CONFIG_NETDEV_1000=y
409CONFIG_NETDEV_10000=y 435CONFIG_NETDEV_10000=y
410# CONFIG_CHELSIO_T1 is not set 436# CONFIG_CHELSIO_T1 is not set
411# CONFIG_CHELSIO_T3 is not set 437# CONFIG_CHELSIO_T3 is not set
438# CONFIG_IXGBE is not set
412# CONFIG_IXGB is not set 439# CONFIG_IXGB is not set
413# CONFIG_S2IO is not set 440# CONFIG_S2IO is not set
414# CONFIG_MYRI10GE is not set 441# CONFIG_MYRI10GE is not set
415# CONFIG_NETXEN_NIC is not set 442# CONFIG_NETXEN_NIC is not set
443# CONFIG_NIU is not set
416# CONFIG_MLX4_CORE is not set 444# CONFIG_MLX4_CORE is not set
445# CONFIG_TEHUTI is not set
446# CONFIG_BNX2X is not set
417# CONFIG_TR is not set 447# CONFIG_TR is not set
418 448
419# 449#
@@ -421,13 +451,13 @@ CONFIG_NETDEV_10000=y
421# 451#
422# CONFIG_WLAN_PRE80211 is not set 452# CONFIG_WLAN_PRE80211 is not set
423# CONFIG_WLAN_80211 is not set 453# CONFIG_WLAN_80211 is not set
454# CONFIG_IWLWIFI_LEDS is not set
424# CONFIG_WAN is not set 455# CONFIG_WAN is not set
425# CONFIG_FDDI is not set 456# CONFIG_FDDI is not set
426# CONFIG_HIPPI is not set 457# CONFIG_HIPPI is not set
427# CONFIG_PPP is not set 458# CONFIG_PPP is not set
428# CONFIG_SLIP is not set 459# CONFIG_SLIP is not set
429# CONFIG_NET_FC is not set 460# CONFIG_NET_FC is not set
430# CONFIG_SHAPER is not set
431# CONFIG_NETCONSOLE is not set 461# CONFIG_NETCONSOLE is not set
432# CONFIG_NETPOLL is not set 462# CONFIG_NETPOLL is not set
433# CONFIG_NET_POLL_CONTROLLER is not set 463# CONFIG_NET_POLL_CONTROLLER is not set
@@ -449,7 +479,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
449CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 479CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
450CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 480CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
451CONFIG_INPUT_JOYDEV=m 481CONFIG_INPUT_JOYDEV=m
452# CONFIG_INPUT_TSDEV is not set
453CONFIG_INPUT_EVDEV=m 482CONFIG_INPUT_EVDEV=m
454CONFIG_INPUT_EVBUG=m 483CONFIG_INPUT_EVBUG=m
455 484
@@ -498,6 +527,7 @@ CONFIG_VT_CONSOLE=y
498CONFIG_HW_CONSOLE=y 527CONFIG_HW_CONSOLE=y
499# CONFIG_VT_HW_CONSOLE_BINDING is not set 528# CONFIG_VT_HW_CONSOLE_BINDING is not set
500# CONFIG_SERIAL_NONSTANDARD is not set 529# CONFIG_SERIAL_NONSTANDARD is not set
530# CONFIG_NOZOMI is not set
501 531
502# 532#
503# Serial drivers 533# Serial drivers
@@ -519,7 +549,6 @@ CONFIG_UNIX98_PTYS=y
519CONFIG_LEGACY_PTYS=y 549CONFIG_LEGACY_PTYS=y
520CONFIG_LEGACY_PTY_COUNT=256 550CONFIG_LEGACY_PTY_COUNT=256
521# CONFIG_IPMI_HANDLER is not set 551# CONFIG_IPMI_HANDLER is not set
522# CONFIG_WATCHDOG is not set
523CONFIG_HW_RANDOM=m 552CONFIG_HW_RANDOM=m
524CONFIG_JS_RTC=m 553CONFIG_JS_RTC=m
525# CONFIG_R3964 is not set 554# CONFIG_R3964 is not set
@@ -538,9 +567,9 @@ CONFIG_DEVPORT=y
538# CONFIG_POWER_SUPPLY is not set 567# CONFIG_POWER_SUPPLY is not set
539CONFIG_HWMON=y 568CONFIG_HWMON=y
540# CONFIG_HWMON_VID is not set 569# CONFIG_HWMON_VID is not set
541# CONFIG_SENSORS_ABITUGURU is not set 570# CONFIG_SENSORS_I5K_AMB is not set
542# CONFIG_SENSORS_ABITUGURU3 is not set
543# CONFIG_SENSORS_F71805F is not set 571# CONFIG_SENSORS_F71805F is not set
572# CONFIG_SENSORS_F71882FG is not set
544# CONFIG_SENSORS_IT87 is not set 573# CONFIG_SENSORS_IT87 is not set
545# CONFIG_SENSORS_PC87360 is not set 574# CONFIG_SENSORS_PC87360 is not set
546# CONFIG_SENSORS_PC87427 is not set 575# CONFIG_SENSORS_PC87427 is not set
@@ -553,6 +582,14 @@ CONFIG_HWMON=y
553# CONFIG_SENSORS_W83627HF is not set 582# CONFIG_SENSORS_W83627HF is not set
554# CONFIG_SENSORS_W83627EHF is not set 583# CONFIG_SENSORS_W83627EHF is not set
555# CONFIG_HWMON_DEBUG_CHIP is not set 584# CONFIG_HWMON_DEBUG_CHIP is not set
585# CONFIG_THERMAL is not set
586# CONFIG_WATCHDOG is not set
587
588#
589# Sonics Silicon Backplane
590#
591CONFIG_SSB_POSSIBLE=y
592# CONFIG_SSB is not set
556 593
557# 594#
558# Multifunction device drivers 595# Multifunction device drivers
@@ -569,15 +606,15 @@ CONFIG_HWMON=y
569# 606#
570# Graphics support 607# Graphics support
571# 608#
609# CONFIG_VGASTATE is not set
610# CONFIG_VIDEO_OUTPUT_CONTROL is not set
611# CONFIG_FB is not set
572# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 612# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
573 613
574# 614#
575# Display device support 615# Display device support
576# 616#
577# CONFIG_DISPLAY_SUPPORT is not set 617# CONFIG_DISPLAY_SUPPORT is not set
578# CONFIG_VGASTATE is not set
579# CONFIG_VIDEO_OUTPUT_CONTROL is not set
580# CONFIG_FB is not set
581 618
582# 619#
583# Console display driver support 620# Console display driver support
@@ -592,6 +629,7 @@ CONFIG_DUMMY_CONSOLE=y
592CONFIG_HID_SUPPORT=y 629CONFIG_HID_SUPPORT=y
593CONFIG_HID=y 630CONFIG_HID=y
594# CONFIG_HID_DEBUG is not set 631# CONFIG_HID_DEBUG is not set
632# CONFIG_HIDRAW is not set
595CONFIG_USB_SUPPORT=y 633CONFIG_USB_SUPPORT=y
596CONFIG_USB_ARCH_HAS_HCD=y 634CONFIG_USB_ARCH_HAS_HCD=y
597CONFIG_USB_ARCH_HAS_OHCI=y 635CONFIG_USB_ARCH_HAS_OHCI=y
@@ -601,34 +639,14 @@ CONFIG_USB_ARCH_HAS_EHCI=y
601# 639#
602# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 640# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
603# 641#
604
605#
606# USB Gadget Support
607#
608# CONFIG_USB_GADGET is not set 642# CONFIG_USB_GADGET is not set
609# CONFIG_MMC is not set 643# CONFIG_MMC is not set
644# CONFIG_MEMSTICK is not set
610# CONFIG_NEW_LEDS is not set 645# CONFIG_NEW_LEDS is not set
611# CONFIG_INFINIBAND is not set 646# CONFIG_INFINIBAND is not set
612
613#
614# Real Time Clock
615#
616# CONFIG_RTC_CLASS is not set 647# CONFIG_RTC_CLASS is not set
617 648
618# 649#
619# DMA Engine support
620#
621# CONFIG_DMA_ENGINE is not set
622
623#
624# DMA Clients
625#
626
627#
628# DMA Devices
629#
630
631#
632# Userspace I/O 650# Userspace I/O
633# 651#
634# CONFIG_UIO is not set 652# CONFIG_UIO is not set
@@ -664,18 +682,14 @@ CONFIG_FS_MBCACHE=y
664CONFIG_FS_POSIX_ACL=y 682CONFIG_FS_POSIX_ACL=y
665CONFIG_XFS_FS=m 683CONFIG_XFS_FS=m
666CONFIG_XFS_QUOTA=y 684CONFIG_XFS_QUOTA=y
667CONFIG_XFS_SECURITY=y
668CONFIG_XFS_POSIX_ACL=y 685CONFIG_XFS_POSIX_ACL=y
669CONFIG_XFS_RT=y 686CONFIG_XFS_RT=y
670# CONFIG_GFS2_FS is not set
671# CONFIG_OCFS2_FS is not set 687# CONFIG_OCFS2_FS is not set
672# CONFIG_MINIX_FS is not set 688CONFIG_DNOTIFY=y
673CONFIG_ROMFS_FS=m
674CONFIG_INOTIFY=y 689CONFIG_INOTIFY=y
675CONFIG_INOTIFY_USER=y 690CONFIG_INOTIFY_USER=y
676# CONFIG_QUOTA is not set 691# CONFIG_QUOTA is not set
677CONFIG_QUOTACTL=y 692CONFIG_QUOTACTL=y
678CONFIG_DNOTIFY=y
679CONFIG_AUTOFS_FS=m 693CONFIG_AUTOFS_FS=m
680CONFIG_AUTOFS4_FS=m 694CONFIG_AUTOFS4_FS=m
681# CONFIG_FUSE_FS is not set 695# CONFIG_FUSE_FS is not set
@@ -704,7 +718,6 @@ CONFIG_PROC_SYSCTL=y
704CONFIG_SYSFS=y 718CONFIG_SYSFS=y
705# CONFIG_TMPFS is not set 719# CONFIG_TMPFS is not set
706# CONFIG_HUGETLB_PAGE is not set 720# CONFIG_HUGETLB_PAGE is not set
707CONFIG_RAMFS=y
708# CONFIG_CONFIGFS_FS is not set 721# CONFIG_CONFIGFS_FS is not set
709 722
710# 723#
@@ -721,14 +734,13 @@ CONFIG_BEFS_FS=m
721# CONFIG_EFS_FS is not set 734# CONFIG_EFS_FS is not set
722# CONFIG_CRAMFS is not set 735# CONFIG_CRAMFS is not set
723# CONFIG_VXFS_FS is not set 736# CONFIG_VXFS_FS is not set
737# CONFIG_MINIX_FS is not set
724# CONFIG_HPFS_FS is not set 738# CONFIG_HPFS_FS is not set
725# CONFIG_QNX4FS_FS is not set 739# CONFIG_QNX4FS_FS is not set
740CONFIG_ROMFS_FS=m
726# CONFIG_SYSV_FS is not set 741# CONFIG_SYSV_FS is not set
727# CONFIG_UFS_FS is not set 742# CONFIG_UFS_FS is not set
728 743CONFIG_NETWORK_FILESYSTEMS=y
729#
730# Network File Systems
731#
732CONFIG_NFS_FS=y 744CONFIG_NFS_FS=y
733# CONFIG_NFS_V3 is not set 745# CONFIG_NFS_V3 is not set
734# CONFIG_NFS_V4 is not set 746# CONFIG_NFS_V4 is not set
@@ -760,10 +772,6 @@ CONFIG_AFS_FS=m
760# CONFIG_PARTITION_ADVANCED is not set 772# CONFIG_PARTITION_ADVANCED is not set
761CONFIG_MSDOS_PARTITION=y 773CONFIG_MSDOS_PARTITION=y
762CONFIG_SUN_PARTITION=y 774CONFIG_SUN_PARTITION=y
763
764#
765# Native Language Support
766#
767CONFIG_NLS=y 775CONFIG_NLS=y
768CONFIG_NLS_DEFAULT="iso8859-1" 776CONFIG_NLS_DEFAULT="iso8859-1"
769# CONFIG_NLS_CODEPAGE_437 is not set 777# CONFIG_NLS_CODEPAGE_437 is not set
@@ -804,21 +812,14 @@ CONFIG_NLS_DEFAULT="iso8859-1"
804# CONFIG_NLS_KOI8_R is not set 812# CONFIG_NLS_KOI8_R is not set
805# CONFIG_NLS_KOI8_U is not set 813# CONFIG_NLS_KOI8_U is not set
806# CONFIG_NLS_UTF8 is not set 814# CONFIG_NLS_UTF8 is not set
807
808#
809# Distributed Lock Manager
810#
811# CONFIG_DLM is not set 815# CONFIG_DLM is not set
812 816
813# 817#
814# Instrumentation Support
815#
816# CONFIG_PROFILING is not set
817
818#
819# Kernel hacking 818# Kernel hacking
820# 819#
820CONFIG_TRACE_IRQFLAGS_SUPPORT=y
821# CONFIG_PRINTK_TIME is not set 821# CONFIG_PRINTK_TIME is not set
822# CONFIG_ENABLE_WARN_DEPRECATED is not set
822CONFIG_ENABLE_MUST_CHECK=y 823CONFIG_ENABLE_MUST_CHECK=y
823CONFIG_MAGIC_SYSRQ=y 824CONFIG_MAGIC_SYSRQ=y
824# CONFIG_UNUSED_SYMBOLS is not set 825# CONFIG_UNUSED_SYMBOLS is not set
@@ -842,9 +843,12 @@ CONFIG_DEBUG_BUGVERBOSE=y
842# CONFIG_DEBUG_INFO is not set 843# CONFIG_DEBUG_INFO is not set
843# CONFIG_DEBUG_VM is not set 844# CONFIG_DEBUG_VM is not set
844# CONFIG_DEBUG_LIST is not set 845# CONFIG_DEBUG_LIST is not set
845CONFIG_FORCED_INLINING=y 846# CONFIG_DEBUG_SG is not set
847# CONFIG_BOOT_PRINTK_DELAY is not set
846# CONFIG_RCU_TORTURE_TEST is not set 848# CONFIG_RCU_TORTURE_TEST is not set
849# CONFIG_BACKTRACE_SELF_TEST is not set
847# CONFIG_FAULT_INJECTION is not set 850# CONFIG_FAULT_INJECTION is not set
851# CONFIG_SAMPLES is not set
848# CONFIG_DEBUG_STACK_USAGE is not set 852# CONFIG_DEBUG_STACK_USAGE is not set
849 853
850# 854#
@@ -853,9 +857,12 @@ CONFIG_FORCED_INLINING=y
853CONFIG_KEYS=y 857CONFIG_KEYS=y
854# CONFIG_KEYS_DEBUG_PROC_KEYS is not set 858# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
855# CONFIG_SECURITY is not set 859# CONFIG_SECURITY is not set
860# CONFIG_SECURITY_FILE_CAPABILITIES is not set
856CONFIG_CRYPTO=y 861CONFIG_CRYPTO=y
857CONFIG_CRYPTO_ALGAPI=y 862CONFIG_CRYPTO_ALGAPI=y
863CONFIG_CRYPTO_AEAD=y
858CONFIG_CRYPTO_BLKCIPHER=y 864CONFIG_CRYPTO_BLKCIPHER=y
865# CONFIG_CRYPTO_SEQIV is not set
859CONFIG_CRYPTO_HASH=y 866CONFIG_CRYPTO_HASH=y
860CONFIG_CRYPTO_MANAGER=y 867CONFIG_CRYPTO_MANAGER=y
861CONFIG_CRYPTO_HMAC=y 868CONFIG_CRYPTO_HMAC=y
@@ -873,6 +880,10 @@ CONFIG_CRYPTO_ECB=m
873CONFIG_CRYPTO_CBC=y 880CONFIG_CRYPTO_CBC=y
874CONFIG_CRYPTO_PCBC=m 881CONFIG_CRYPTO_PCBC=m
875# CONFIG_CRYPTO_LRW is not set 882# CONFIG_CRYPTO_LRW is not set
883# CONFIG_CRYPTO_XTS is not set
884# CONFIG_CRYPTO_CTR is not set
885# CONFIG_CRYPTO_GCM is not set
886# CONFIG_CRYPTO_CCM is not set
876# CONFIG_CRYPTO_CRYPTD is not set 887# CONFIG_CRYPTO_CRYPTD is not set
877CONFIG_CRYPTO_DES=y 888CONFIG_CRYPTO_DES=y
878# CONFIG_CRYPTO_FCRYPT is not set 889# CONFIG_CRYPTO_FCRYPT is not set
@@ -887,11 +898,15 @@ CONFIG_CRYPTO_CAST6=m
887CONFIG_CRYPTO_ARC4=m 898CONFIG_CRYPTO_ARC4=m
888# CONFIG_CRYPTO_KHAZAD is not set 899# CONFIG_CRYPTO_KHAZAD is not set
889# CONFIG_CRYPTO_ANUBIS is not set 900# CONFIG_CRYPTO_ANUBIS is not set
901# CONFIG_CRYPTO_SEED is not set
902# CONFIG_CRYPTO_SALSA20 is not set
890CONFIG_CRYPTO_DEFLATE=y 903CONFIG_CRYPTO_DEFLATE=y
891CONFIG_CRYPTO_MICHAEL_MIC=m 904CONFIG_CRYPTO_MICHAEL_MIC=m
892CONFIG_CRYPTO_CRC32C=m 905CONFIG_CRYPTO_CRC32C=m
893# CONFIG_CRYPTO_CAMELLIA is not set 906# CONFIG_CRYPTO_CAMELLIA is not set
894# CONFIG_CRYPTO_TEST is not set 907# CONFIG_CRYPTO_TEST is not set
908CONFIG_CRYPTO_AUTHENC=y
909# CONFIG_CRYPTO_LZO is not set
895# CONFIG_CRYPTO_HW is not set 910# CONFIG_CRYPTO_HW is not set
896 911
897# 912#
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 2712bb166f6f..59700aaaae93 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -9,9 +9,9 @@ EXTRA_AFLAGS := -ansi
9IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o 9IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o
10obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \ 10obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \
11 process.o signal.o ioport.o setup.o idprom.o \ 11 process.o signal.o ioport.o setup.o idprom.o \
12 sys_sparc.o sunos_asm.o systbls.o \ 12 sys_sparc.o systbls.o \
13 time.o windows.o cpu.o devices.o sclow.o \ 13 time.o windows.o cpu.o devices.o \
14 tadpole.o tick14.o ptrace.o sys_solaris.o \ 14 tadpole.o tick14.o ptrace.o \
15 unaligned.o una_asm.o muldiv.o \ 15 unaligned.o una_asm.o muldiv.o \
16 prom.o of_device.o devres.o 16 prom.o of_device.o devres.o
17 17
@@ -25,7 +25,3 @@ obj-$(CONFIG_PCI) += ebus.o
25obj-$(CONFIG_SUN_PM) += apc.o pmc.o 25obj-$(CONFIG_SUN_PM) += apc.o pmc.o
26obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o 26obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o
27obj-$(CONFIG_SPARC_LED) += led.o 27obj-$(CONFIG_SPARC_LED) += led.o
28
29ifdef CONFIG_SUNOS_EMUL
30obj-y += sys_sunos.o sunos_ioctl.o
31endif
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index c2eed8f71516..135644f8add7 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1186,36 +1186,6 @@ srmmu_fault:
1186 1186
1187 RESTORE_ALL 1187 RESTORE_ALL
1188 1188
1189#ifdef CONFIG_SUNOS_EMUL
1190 /* SunOS uses syscall zero as the 'indirect syscall' it looks
1191 * like indir_syscall(scall_num, arg0, arg1, arg2...); etc.
1192 * This is complete brain damage.
1193 */
1194 .globl sunos_indir
1195sunos_indir:
1196 mov %o7, %l4
1197 cmp %o0, NR_SYSCALLS
1198 blu,a 1f
1199 sll %o0, 0x2, %o0
1200
1201 sethi %hi(sunos_nosys), %l6
1202 b 2f
1203 or %l6, %lo(sunos_nosys), %l6
1204
12051:
1206 set sunos_sys_table, %l7
1207 ld [%l7 + %o0], %l6
1208
12092:
1210 mov %o1, %o0
1211 mov %o2, %o1
1212 mov %o3, %o2
1213 mov %o4, %o3
1214 mov %o5, %o4
1215 call %l6
1216 mov %l4, %o7
1217#endif
1218
1219 .align 4 1189 .align 4
1220 .globl sys_nis_syscall 1190 .globl sys_nis_syscall
1221sys_nis_syscall: 1191sys_nis_syscall:
@@ -1232,6 +1202,16 @@ sys_execve:
1232 call sparc_execve 1202 call sparc_execve
1233 mov %l5, %o7 1203 mov %l5, %o7
1234 1204
1205 .globl sunos_execv
1206sunos_execv:
1207 st %g0, [%sp + STACKFRAME_SZ + PT_I2]
1208
1209 call sparc_execve
1210 add %sp, STACKFRAME_SZ, %o0
1211
1212 b ret_sys_call
1213 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
1214
1235 .align 4 1215 .align 4
1236 .globl sys_pipe 1216 .globl sys_pipe
1237sys_pipe: 1217sys_pipe:
@@ -1394,7 +1374,7 @@ ret_from_fork:
1394 b ret_sys_call 1374 b ret_sys_call
1395 ld [%sp + STACKFRAME_SZ + PT_I0], %o0 1375 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
1396 1376
1397 /* Linux native and SunOS system calls enter here... */ 1377 /* Linux native system calls enter here... */
1398 .align 4 1378 .align 4
1399 .globl linux_sparc_syscall 1379 .globl linux_sparc_syscall
1400linux_sparc_syscall: 1380linux_sparc_syscall:
@@ -1472,170 +1452,6 @@ linux_syscall_trace2:
1472 st %l2, [%sp + STACKFRAME_SZ + PT_NPC] 1452 st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
1473 1453
1474 1454
1475 /*
1476 * Solaris system calls and indirect system calls enter here.
1477 *
1478 * I have named the solaris indirect syscalls like that because
1479 * it seems like Solaris has some fast path syscalls that can
1480 * be handled as indirect system calls. - mig
1481 */
1482
1483linux_syscall_for_solaris:
1484 sethi %hi(sys_call_table), %l7
1485 b linux_sparc_syscall
1486 or %l7, %lo(sys_call_table), %l7
1487
1488 .align 4
1489 .globl solaris_syscall
1490solaris_syscall:
1491 cmp %g1,59
1492 be linux_syscall_for_solaris
1493 cmp %g1,2
1494 be linux_syscall_for_solaris
1495 cmp %g1,42
1496 be linux_syscall_for_solaris
1497 cmp %g1,119
1498 be,a linux_syscall_for_solaris
1499 mov 2, %g1
15001:
1501 SAVE_ALL_HEAD
1502 rd %wim, %l3
1503
1504 wr %l0, PSR_ET, %psr
1505 nop
1506 nop
1507 mov %i0, %l5
1508
1509 call do_solaris_syscall
1510 add %sp, STACKFRAME_SZ, %o0
1511
1512 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
1513 set PSR_C, %g2
1514 cmp %o0, -ERESTART_RESTARTBLOCK
1515 bgeu 1f
1516 ld [%sp + STACKFRAME_SZ + PT_PSR], %g3
1517
1518 /* System call success, clear Carry condition code. */
1519 andn %g3, %g2, %g3
1520 clr %l6
1521 b 2f
1522 st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
1523
15241:
1525 /* System call failure, set Carry condition code.
1526 * Also, get abs(errno) to return to the process.
1527 */
1528 sub %g0, %o0, %o0
1529 mov 1, %l6
1530 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
1531 or %g3, %g2, %g3
1532 st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
1533
1534 /* Advance the pc and npc over the trap instruction.
1535 * If the npc is unaligned (has a 1 in the lower byte), it means
1536 * the kernel does not want us to play magic (ie, skipping over
1537 * traps). Mainly when the Solaris code wants to set some PC and
1538 * nPC (setcontext).
1539 */
15402:
1541 ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
1542 andcc %l1, 1, %g0
1543 bne 1f
1544 add %l1, 0x4, %l2 /* npc = npc+4 */
1545 st %l1, [%sp + STACKFRAME_SZ + PT_PC]
1546 b ret_trap_entry
1547 st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
1548
1549 /* kernel knows what it is doing, fixup npc and continue */
15501:
1551 sub %l1, 1, %l1
1552 b ret_trap_entry
1553 st %l1, [%sp + STACKFRAME_SZ + PT_NPC]
1554
1555#ifndef CONFIG_SUNOS_EMUL
1556 .align 4
1557 .globl sunos_syscall
1558sunos_syscall:
1559 SAVE_ALL_HEAD
1560 rd %wim, %l3
1561 wr %l0, PSR_ET, %psr
1562 nop
1563 nop
1564 mov %i0, %l5
1565 call do_sunos_syscall
1566 add %sp, STACKFRAME_SZ, %o0
1567#endif
1568
1569 /* {net, open}bsd system calls enter here... */
1570 .align 4
1571 .globl bsd_syscall
1572bsd_syscall:
1573 /* Direct access to user regs, must faster. */
1574 cmp %g1, NR_SYSCALLS
1575 blu,a 1f
1576 sll %g1, 2, %l4
1577
1578 set sys_ni_syscall, %l7
1579 b bsd_is_too_hard
1580 nop
1581
15821:
1583 ld [%l7 + %l4], %l7
1584
1585 .globl bsd_is_too_hard
1586bsd_is_too_hard:
1587 rd %wim, %l3
1588 SAVE_ALL
1589
1590 wr %l0, PSR_ET, %psr
1591 WRITE_PAUSE
1592
15932:
1594 mov %i0, %o0
1595 mov %i1, %o1
1596 mov %i2, %o2
1597 mov %i0, %l5
1598 mov %i3, %o3
1599 mov %i4, %o4
1600 call %l7
1601 mov %i5, %o5
1602
1603 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
1604 set PSR_C, %g2
1605 cmp %o0, -ERESTART_RESTARTBLOCK
1606 bgeu 1f
1607 ld [%sp + STACKFRAME_SZ + PT_PSR], %g3
1608
1609 /* System call success, clear Carry condition code. */
1610 andn %g3, %g2, %g3
1611 clr %l6
1612 b 2f
1613 st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
1614
16151:
1616 /* System call failure, set Carry condition code.
1617 * Also, get abs(errno) to return to the process.
1618 */
1619 sub %g0, %o0, %o0
1620#if 0 /* XXX todo XXX */
1621 sethi %hi(bsd_xlatb_rorl), %o3
1622 or %o3, %lo(bsd_xlatb_rorl), %o3
1623 sll %o0, 2, %o0
1624 ld [%o3 + %o0], %o0
1625#endif
1626 mov 1, %l6
1627 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
1628 or %g3, %g2, %g3
1629 st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
1630
1631 /* Advance the pc and npc over the trap instruction. */
16322:
1633 ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
1634 add %l1, 0x4, %l2 /* npc = npc+4 */
1635 st %l1, [%sp + STACKFRAME_SZ + PT_PC]
1636 b ret_trap_entry
1637 st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
1638
1639/* Saving and restoring the FPU state is best done from lowlevel code. 1455/* Saving and restoring the FPU state is best done from lowlevel code.
1640 * 1456 *
1641 * void fpsave(unsigned long *fpregs, unsigned long *fsr, 1457 * void fpsave(unsigned long *fpregs, unsigned long *fsr,
diff --git a/arch/sparc/kernel/errtbls.c b/arch/sparc/kernel/errtbls.c
deleted file mode 100644
index ed14df7116e9..000000000000
--- a/arch/sparc/kernel/errtbls.c
+++ /dev/null
@@ -1,144 +0,0 @@
1/* errtbls.c: Error number conversion tables.
2 *
3 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
4 *
5 * Based upon preliminary work which is:
6 *
7 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
8 */
9
10#include <asm/solerrno.h> /* Solaris errnos */
11
12/* Here is the table which converts between Linux error number values
13 * to the equivalent under Solaris. Note that since the Linux ones
14 * have been set up to match exactly those of SunOS, no translation
15 * table is needed for that OS.
16 */
17
18int solaris_errno[] = {
19 0,
20 SOL_EPERM,
21 SOL_ENOENT,
22 SOL_ESRCH,
23 SOL_EINTR,
24 SOL_EIO,
25 SOL_ENXIO,
26 SOL_E2BIG,
27 SOL_ENOEXEC,
28 SOL_EBADF,
29 SOL_ECHILD,
30 SOL_EAGAIN,
31 SOL_ENOMEM,
32 SOL_EACCES,
33 SOL_EFAULT,
34 SOL_NOTBLK,
35 SOL_EBUSY,
36 SOL_EEXIST,
37 SOL_EXDEV,
38 SOL_ENODEV,
39 SOL_ENOTDIR,
40 SOL_EISDIR,
41 SOL_EINVAL,
42 SOL_ENFILE,
43 SOL_EMFILE,
44 SOL_ENOTTY,
45 SOL_ETXTBSY,
46 SOL_EFBIG,
47 SOL_ENOSPC,
48 SOL_ESPIPE,
49 SOL_EROFS,
50 SOL_EMLINK,
51 SOL_EPIPE,
52 SOL_EDOM,
53 SOL_ERANGE,
54 SOL_EWOULDBLOCK,
55 SOL_EINPROGRESS,
56 SOL_EALREADY,
57 SOL_ENOTSOCK,
58 SOL_EDESTADDRREQ,
59 SOL_EMSGSIZE,
60 SOL_EPROTOTYPE,
61 SOL_ENOPROTOOPT,
62 SOL_EPROTONOSUPPORT,
63 SOL_ESOCKTNOSUPPORT,
64 SOL_EOPNOTSUPP,
65 SOL_EPFNOSUPPORT,
66 SOL_EAFNOSUPPORT,
67 SOL_EADDRINUSE,
68 SOL_EADDRNOTAVAIL,
69 SOL_ENETDOWN,
70 SOL_ENETUNREACH,
71 SOL_ENETRESET,
72 SOL_ECONNABORTED,
73 SOL_ECONNRESET,
74 SOL_ENOBUFS,
75 SOL_EISCONN,
76 SOL_ENOTONN,
77 SOL_ESHUTDOWN,
78 SOL_ETOOMANYREFS,
79 SOL_ETIMEDOUT,
80 SOL_ECONNREFUSED,
81 SOL_ELOOP,
82 SOL_ENAMETOOLONG,
83 SOL_EHOSTDOWN,
84 SOL_EHOSTUNREACH,
85 SOL_ENOTEMPTY,
86 SOL_EPROCLIM,
87 SOL_EUSERS,
88 SOL_EDQUOT,
89 SOL_ESTALE,
90 SOL_EREMOTE,
91 SOL_ENOSTR,
92 SOL_ETIME,
93 SOL_ENOSR,
94 SOL_ENOMSG,
95 SOL_EBADMSG,
96 SOL_IDRM,
97 SOL_EDEADLK,
98 SOL_ENOLCK,
99 SOL_ENONET,
100 SOL_ERREMOTE,
101 SOL_ENOLINK,
102 SOL_EADV,
103 SOL_ESRMNT,
104 SOL_ECOMM,
105 SOL_EPROTO,
106 SOL_EMULTIHOP,
107 SOL_EINVAL, /* EDOTDOT XXX??? */
108 SOL_REMCHG,
109 SOL_NOSYS,
110 SOL_STRPIPE,
111 SOL_EOVERFLOW,
112 SOL_EBADFD,
113 SOL_ECHRNG,
114 SOL_EL2NSYNC,
115 SOL_EL3HLT,
116 SOL_EL3RST,
117 SOL_NRNG,
118 SOL_EUNATCH,
119 SOL_ENOCSI,
120 SOL_EL2HLT,
121 SOL_EBADE,
122 SOL_EBADR,
123 SOL_EXFULL,
124 SOL_ENOANO,
125 SOL_EBADRQC,
126 SOL_EBADSLT,
127 SOL_EDEADLOCK,
128 SOL_EBFONT,
129 SOL_ELIBEXEC,
130 SOL_ENODATA,
131 SOL_ELIBBAD,
132 SOL_ENOPKG,
133 SOL_ELIBACC,
134 SOL_ENOTUNIQ,
135 SOL_ERESTART,
136 SOL_EUCLEAN,
137 SOL_ENOTNAM,
138 SOL_ENAVAIL,
139 SOL_EISNAM,
140 SOL_EREMOTEIO,
141 SOL_EILSEQ,
142 SOL_ELIBMAX,
143 SOL_ELIBSCN,
144};
diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head.S
index 9a219e8b5ddb..b7f1e81c8ff2 100644
--- a/arch/sparc/kernel/head.S
+++ b/arch/sparc/kernel/head.S
@@ -78,11 +78,6 @@ sun4e_notsup:
78 .asciz "Sparc-Linux sun4e support does not exist\n\n" 78 .asciz "Sparc-Linux sun4e support does not exist\n\n"
79 .align 4 79 .align 4
80 80
81#ifndef CONFIG_SUNOS_EMUL
82#undef SUNOS_SYSCALL_TRAP
83#define SUNOS_SYSCALL_TRAP SUNOS_NO_SYSCALL_TRAP
84#endif
85
86 /* The Sparc trap table, bootloader gives us control at _start. */ 81 /* The Sparc trap table, bootloader gives us control at _start. */
87 .text 82 .text
88 .globl start, _stext, _start, __stext 83 .globl start, _stext, _start, __stext
@@ -158,7 +153,7 @@ t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x7
158t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) 153t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
159t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) 154t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
160t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f) 155t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
161t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */ 156t_bad80:BAD_TRAP(0x80) /* SunOS System Call */
162t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */ 157t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
163t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */ 158t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */
164t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */ 159t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
@@ -166,8 +161,8 @@ t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
166t_rchk: BAD_TRAP(0x85) /* Range Check */ 161t_rchk: BAD_TRAP(0x85) /* Range Check */
167t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */ 162t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
168t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */ 163t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
169t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */ 164t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */
170t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */ 165t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */
171t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e) 166t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
172t_bad8f:BAD_TRAP(0x8f) 167t_bad8f:BAD_TRAP(0x8f)
173t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */ 168t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
@@ -178,7 +173,7 @@ t_getcc:GETCC_TRAP /* Get Condition Codes */
178t_setcc:SETCC_TRAP /* Set Condition Codes */ 173t_setcc:SETCC_TRAP /* Set Condition Codes */
179t_getpsr:GETPSR_TRAP /* Get PSR Register */ 174t_getpsr:GETPSR_TRAP /* Get PSR Register */
180t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) 175t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
181t_slowi:INDIRECT_SOLARIS_SYSCALL(156) 176t_bada7:BAD_TRAP(0xa7)
182t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) 177t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
183t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) 178t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
184t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) 179t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
@@ -243,19 +238,19 @@ trapbase_cpu1:
243 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) 238 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
244 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) 239 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
245 BAD_TRAP(0x7e) BAD_TRAP(0x7f) 240 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
246 SUNOS_SYSCALL_TRAP 241 BAD_TRAP(0x80)
247 BREAKPOINT_TRAP 242 BREAKPOINT_TRAP
248 TRAP_ENTRY(0x82, do_hw_divzero) 243 TRAP_ENTRY(0x82, do_hw_divzero)
249 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) 244 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
250 BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP 245 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
251 NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) 246 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
252 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) 247 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
253 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) 248 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
254 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) 249 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
255 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) 250 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
256 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP 251 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
257 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) 252 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
258 INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) 253 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
259 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) 254 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
260 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) 255 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
261 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) 256 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
@@ -311,19 +306,19 @@ trapbase_cpu2:
311 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) 306 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
312 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) 307 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
313 BAD_TRAP(0x7e) BAD_TRAP(0x7f) 308 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
314 SUNOS_SYSCALL_TRAP 309 BAD_TRAP(0x80)
315 BREAKPOINT_TRAP 310 BREAKPOINT_TRAP
316 TRAP_ENTRY(0x82, do_hw_divzero) 311 TRAP_ENTRY(0x82, do_hw_divzero)
317 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) 312 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
318 BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP 313 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
319 NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) 314 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
320 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) 315 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
321 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) 316 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
322 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) 317 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
323 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) 318 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
324 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP 319 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
325 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) 320 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
326 INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) 321 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
327 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) 322 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
328 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) 323 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
329 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) 324 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
@@ -379,19 +374,19 @@ trapbase_cpu3:
379 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) 374 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
380 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) 375 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
381 BAD_TRAP(0x7e) BAD_TRAP(0x7f) 376 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
382 SUNOS_SYSCALL_TRAP 377 BAD_TRAP(0x80)
383 BREAKPOINT_TRAP 378 BREAKPOINT_TRAP
384 TRAP_ENTRY(0x82, do_hw_divzero) 379 TRAP_ENTRY(0x82, do_hw_divzero)
385 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) 380 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
386 BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP 381 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
387 NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) 382 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
388 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) 383 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
389 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) 384 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
390 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) 385 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
391 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) 386 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
392 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP 387 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
393 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) 388 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
394 INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) 389 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
395 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) 390 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
396 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) 391 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
397 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) 392 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
diff --git a/arch/sparc/kernel/sclow.S b/arch/sparc/kernel/sclow.S
deleted file mode 100644
index 136e37c53d49..000000000000
--- a/arch/sparc/kernel/sclow.S
+++ /dev/null
@@ -1,86 +0,0 @@
1/* sclow.S: Low level special syscall handling.
2 * Basically these are cases where we can completely
3 * handle the system call without saving any state
4 * because we know that the process will not sleep.
5 *
6 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
7 */
8
9#include <asm/ptrace.h>
10#include <asm/asm-offsets.h>
11#include <asm/errno.h>
12#include <asm/winmacro.h>
13#include <asm/thread_info.h>
14#include <asm/psr.h>
15#include <asm/page.h>
16
17#define CC_AND_RETT \
18 set PSR_C, %l4; \
19 andn %l0, %l4, %l4; \
20 wr %l4, 0x0, %psr; \
21 nop; nop; nop; \
22 jmp %l2; \
23 rett %l2 + 4;
24
25#define SC_AND_RETT \
26 set PSR_C, %l4; \
27 or %l0, %l4, %l4; \
28 wr %l4, 0x0, %psr; \
29 nop; nop; nop; \
30 jmp %l2; \
31 rett %l2 + 4;
32
33#define LABEL(func) func##_low
34
35 .globl LABEL(sunosnop)
36LABEL(sunosnop):
37 CC_AND_RETT
38
39#if (ASIZ_task_uid == 2 && ASIZ_task_euid == 2)
40 .globl LABEL(sunosgetuid)
41LABEL(sunosgetuid):
42 LOAD_CURRENT(l4, l5)
43 ld [%l4 + TI_TASK], %l4
44 lduh [%l4 + AOFF_task_uid], %i0
45 lduh [%l4 + AOFF_task_euid], %i1
46 CC_AND_RETT
47#endif
48
49#if (ASIZ_task_gid == 2 && ASIZ_task_egid == 2)
50 .globl LABEL(sunosgetgid)
51LABEL(sunosgetgid):
52 LOAD_CURRENT(l4, l5)
53 ld [%l4 + TI_TASK], %l4
54 lduh [%l4 + AOFF_task_gid], %i0
55 lduh [%l4 + AOFF_task_egid], %i1
56 CC_AND_RETT
57#endif
58
59 .globl LABEL(sunosmctl)
60LABEL(sunosmctl):
61 mov 0, %i0
62 CC_AND_RETT
63
64 .globl LABEL(sunosgdtsize)
65LABEL(sunosgdtsize):
66 mov 256, %i0
67 CC_AND_RETT
68
69 .globl LABEL(getpagesize)
70LABEL(getpagesize):
71 set PAGE_SIZE, %i0
72 CC_AND_RETT
73
74 /* XXX sys_nice() XXX */
75 /* XXX sys_setpriority() XXX */
76 /* XXX sys_getpriority() XXX */
77 /* XXX sys_setregid() XXX */
78 /* XXX sys_setgid() XXX */
79 /* XXX sys_setreuid() XXX */
80 /* XXX sys_setuid() XXX */
81 /* XXX sys_setfsuid() XXX */
82 /* XXX sys_setfsgid() XXX */
83 /* XXX sys_setpgid() XXX */
84 /* XXX sys_getpgid() XXX */
85 /* XXX sys_setsid() XXX */
86 /* XXX sys_getsid() XXX */
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 9994cac95078..1f730619a24a 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -22,7 +22,6 @@
22 22
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
25#include <asm/svr4.h>
26#include <asm/pgalloc.h> 25#include <asm/pgalloc.h>
27#include <asm/pgtable.h> 26#include <asm/pgtable.h>
28#include <asm/cacheflush.h> /* flush_sig_insns */ 27#include <asm/cacheflush.h> /* flush_sig_insns */
@@ -454,7 +453,6 @@ setup_frame(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *old
454 break; 453 break;
455 case SIGSYS: 454 case SIGSYS:
456 if (info->si_code == (__SI_FAULT|0x100)) { 455 if (info->si_code == (__SI_FAULT|0x100)) {
457 /* See sys_sunos.c */
458 sig_code = info->si_trapno; 456 sig_code = info->si_trapno;
459 break; 457 break;
460 } 458 }
@@ -676,291 +674,17 @@ sigsegv:
676 force_sigsegv(signo, current); 674 force_sigsegv(signo, current);
677} 675}
678 676
679/* Setup a Solaris stack frame */
680static inline void
681setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc,
682 struct pt_regs *regs, int signr, sigset_t *oldset)
683{
684 svr4_signal_frame_t __user *sfp;
685 svr4_gregset_t __user *gr;
686 svr4_siginfo_t __user *si;
687 svr4_mcontext_t __user *mc;
688 svr4_gwindows_t __user *gw;
689 svr4_ucontext_t __user *uc;
690 svr4_sigset_t setv;
691 struct thread_info *tp = current_thread_info();
692 int window = 0, err;
693
694 synchronize_user_stack();
695 sfp = (svr4_signal_frame_t __user *)
696 get_sigframe(sa, regs, SVR4_SF_ALIGNED + sizeof(struct reg_window));
697
698 if (invalid_frame_pointer(sfp, sizeof(*sfp)))
699 goto sigill_and_return;
700
701 /* Start with a clean frame pointer and fill it */
702 err = __clear_user(sfp, sizeof(*sfp));
703
704 /* Setup convenience variables */
705 si = &sfp->si;
706 uc = &sfp->uc;
707 gw = &sfp->gw;
708 mc = &uc->mcontext;
709 gr = &mc->greg;
710
711 /* FIXME: where am I supposed to put this?
712 * sc->sigc_onstack = old_status;
713 * anyways, it does not look like it is used for anything at all.
714 */
715 setv.sigbits[0] = oldset->sig[0];
716 setv.sigbits[1] = oldset->sig[1];
717 if (_NSIG_WORDS >= 4) {
718 setv.sigbits[2] = oldset->sig[2];
719 setv.sigbits[3] = oldset->sig[3];
720 err |= __copy_to_user(&uc->sigmask, &setv, sizeof(svr4_sigset_t));
721 } else
722 err |= __copy_to_user(&uc->sigmask, &setv,
723 2 * sizeof(unsigned int));
724
725 /* Store registers */
726 err |= __put_user(regs->pc, &((*gr)[SVR4_PC]));
727 err |= __put_user(regs->npc, &((*gr)[SVR4_NPC]));
728 err |= __put_user(regs->psr, &((*gr)[SVR4_PSR]));
729 err |= __put_user(regs->y, &((*gr)[SVR4_Y]));
730
731 /* Copy g[1..7] and o[0..7] registers */
732 err |= __copy_to_user(&(*gr)[SVR4_G1], &regs->u_regs[UREG_G1],
733 sizeof(long) * 7);
734 err |= __copy_to_user(&(*gr)[SVR4_O0], &regs->u_regs[UREG_I0],
735 sizeof(long) * 8);
736
737 /* Setup sigaltstack */
738 err |= __put_user(current->sas_ss_sp, &uc->stack.sp);
739 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &uc->stack.flags);
740 err |= __put_user(current->sas_ss_size, &uc->stack.size);
741
742 /* Save the currently window file: */
743
744 /* 1. Link sfp->uc->gwins to our windows */
745 err |= __put_user(gw, &mc->gwin);
746
747 /* 2. Number of windows to restore at setcontext(): */
748 err |= __put_user(tp->w_saved, &gw->count);
749
750 /* 3. Save each valid window
751 * Currently, it makes a copy of the windows from the kernel copy.
752 * David's code for SunOS, makes the copy but keeps the pointer to
753 * the kernel. My version makes the pointer point to a userland
754 * copy of those. Mhm, I wonder if I shouldn't just ignore those
755 * on setcontext and use those that are on the kernel, the signal
756 * handler should not be modyfing those, mhm.
757 *
758 * These windows are just used in case synchronize_user_stack failed
759 * to flush the user windows.
760 */
761 for (window = 0; window < tp->w_saved; window++) {
762 err |= __put_user((int __user *) &(gw->win[window]), &gw->winptr[window]);
763 err |= __copy_to_user(&gw->win[window],
764 &tp->reg_window[window],
765 sizeof(svr4_rwindow_t));
766 err |= __put_user(0, gw->winptr[window]);
767 }
768
769 /* 4. We just pay attention to the gw->count field on setcontext */
770 tp->w_saved = 0; /* So process is allowed to execute. */
771
772 /* Setup the signal information. Solaris expects a bunch of
773 * information to be passed to the signal handler, we don't provide
774 * that much currently, should use siginfo.
775 */
776 err |= __put_user(signr, &si->siginfo.signo);
777 err |= __put_user(SVR4_SINOINFO, &si->siginfo.code);
778 if (err)
779 goto sigsegv;
780
781 regs->u_regs[UREG_FP] = (unsigned long) sfp;
782 regs->pc = (unsigned long) sa->sa_handler;
783 regs->npc = (regs->pc + 4);
784
785 /* Arguments passed to signal handler */
786 if (regs->u_regs[14]){
787 struct reg_window __user *rw = (struct reg_window __user *)
788 regs->u_regs[14];
789
790 err |= __put_user(signr, &rw->ins[0]);
791 err |= __put_user(si, &rw->ins[1]);
792 err |= __put_user(uc, &rw->ins[2]);
793 err |= __put_user(sfp, &rw->ins[6]); /* frame pointer */
794 if (err)
795 goto sigsegv;
796
797 regs->u_regs[UREG_I0] = signr;
798 regs->u_regs[UREG_I1] = (unsigned long) si;
799 regs->u_regs[UREG_I2] = (unsigned long) uc;
800 }
801 return;
802
803sigill_and_return:
804 do_exit(SIGILL);
805sigsegv:
806 force_sigsegv(signr, current);
807}
808
809asmlinkage int svr4_getcontext(svr4_ucontext_t __user *uc, struct pt_regs *regs)
810{
811 svr4_gregset_t __user *gr;
812 svr4_mcontext_t __user *mc;
813 svr4_sigset_t setv;
814 int err = 0;
815
816 synchronize_user_stack();
817
818 if (current_thread_info()->w_saved)
819 return -EFAULT;
820
821 err = clear_user(uc, sizeof(*uc));
822 if (err)
823 return -EFAULT;
824
825 /* Setup convenience variables */
826 mc = &uc->mcontext;
827 gr = &mc->greg;
828
829 setv.sigbits[0] = current->blocked.sig[0];
830 setv.sigbits[1] = current->blocked.sig[1];
831 if (_NSIG_WORDS >= 4) {
832 setv.sigbits[2] = current->blocked.sig[2];
833 setv.sigbits[3] = current->blocked.sig[3];
834 err |= __copy_to_user(&uc->sigmask, &setv, sizeof(svr4_sigset_t));
835 } else
836 err |= __copy_to_user(&uc->sigmask, &setv,
837 2 * sizeof(unsigned int));
838
839 /* Store registers */
840 err |= __put_user(regs->pc, &uc->mcontext.greg[SVR4_PC]);
841 err |= __put_user(regs->npc, &uc->mcontext.greg[SVR4_NPC]);
842 err |= __put_user(regs->psr, &uc->mcontext.greg[SVR4_PSR]);
843 err |= __put_user(regs->y, &uc->mcontext.greg[SVR4_Y]);
844
845 /* Copy g[1..7] and o[0..7] registers */
846 err |= __copy_to_user(&(*gr)[SVR4_G1], &regs->u_regs[UREG_G1],
847 sizeof(uint) * 7);
848 err |= __copy_to_user(&(*gr)[SVR4_O0], &regs->u_regs[UREG_I0],
849 sizeof(uint) * 8);
850
851 /* Setup sigaltstack */
852 err |= __put_user(current->sas_ss_sp, &uc->stack.sp);
853 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &uc->stack.flags);
854 err |= __put_user(current->sas_ss_size, &uc->stack.size);
855
856 /* The register file is not saved
857 * we have already stuffed all of it with sync_user_stack
858 */
859 return (err ? -EFAULT : 0);
860}
861
862/* Set the context for a svr4 application, this is Solaris way to sigreturn */
863asmlinkage int svr4_setcontext(svr4_ucontext_t __user *c, struct pt_regs *regs)
864{
865 svr4_gregset_t __user *gr;
866 unsigned long pc, npc, psr;
867 mm_segment_t old_fs;
868 sigset_t set;
869 svr4_sigset_t setv;
870 int err;
871 stack_t st;
872
873 /* Fixme: restore windows, or is this already taken care of in
874 * svr4_setup_frame when sync_user_windows is done?
875 */
876 flush_user_windows();
877
878 if (current_thread_info()->w_saved)
879 goto sigsegv_and_return;
880
881 if (((unsigned long) c) & 3)
882 goto sigsegv_and_return;
883
884 if (!__access_ok((unsigned long)c, sizeof(*c)))
885 goto sigsegv_and_return;
886
887 /* Check for valid PC and nPC */
888 gr = &c->mcontext.greg;
889 err = __get_user(pc, &((*gr)[SVR4_PC]));
890 err |= __get_user(npc, &((*gr)[SVR4_NPC]));
891
892 if ((pc | npc) & 3)
893 goto sigsegv_and_return;
894
895 /* Retrieve information from passed ucontext */
896 /* note that nPC is ored a 1, this is used to inform entry.S */
897 /* that we don't want it to mess with our PC and nPC */
898
899 /* This is pretty much atomic, no amount locking would prevent
900 * the races which exist anyways.
901 */
902 err |= __copy_from_user(&setv, &c->sigmask, sizeof(svr4_sigset_t));
903
904 err |= __get_user(st.ss_sp, &c->stack.sp);
905 err |= __get_user(st.ss_flags, &c->stack.flags);
906 err |= __get_user(st.ss_size, &c->stack.size);
907
908 if (err)
909 goto sigsegv_and_return;
910
911 /* It is more difficult to avoid calling this function than to
912 call it and ignore errors. */
913 old_fs = get_fs();
914 set_fs(KERNEL_DS);
915 do_sigaltstack((const stack_t __user *) &st, NULL,
916 regs->u_regs[UREG_I6]);
917 set_fs(old_fs);
918
919 set.sig[0] = setv.sigbits[0];
920 set.sig[1] = setv.sigbits[1];
921 if (_NSIG_WORDS >= 4) {
922 set.sig[2] = setv.sigbits[2];
923 set.sig[3] = setv.sigbits[3];
924 }
925 sigdelsetmask(&set, ~_BLOCKABLE);
926 spin_lock_irq(&current->sighand->siglock);
927 current->blocked = set;
928 recalc_sigpending();
929 spin_unlock_irq(&current->sighand->siglock);
930 regs->pc = pc;
931 regs->npc = npc | 1;
932 err |= __get_user(regs->y, &((*gr)[SVR4_Y]));
933 err |= __get_user(psr, &((*gr)[SVR4_PSR]));
934 regs->psr &= ~(PSR_ICC);
935 regs->psr |= (psr & PSR_ICC);
936
937 /* Restore g[1..7] and o[0..7] registers */
938 err |= __copy_from_user(&regs->u_regs[UREG_G1], &(*gr)[SVR4_G1],
939 sizeof(long) * 7);
940 err |= __copy_from_user(&regs->u_regs[UREG_I0], &(*gr)[SVR4_O0],
941 sizeof(long) * 8);
942 return (err ? -EFAULT : 0);
943
944sigsegv_and_return:
945 force_sig(SIGSEGV, current);
946 return -EFAULT;
947}
948
949static inline void 677static inline void
950handle_signal(unsigned long signr, struct k_sigaction *ka, 678handle_signal(unsigned long signr, struct k_sigaction *ka,
951 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs, 679 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
952 int svr4_signal)
953{ 680{
954 if (svr4_signal) 681 if (ka->sa.sa_flags & SA_SIGINFO)
955 setup_svr4_frame(&ka->sa, regs->pc, regs->npc, regs, signr, oldset); 682 new_setup_rt_frame(ka, regs, signr, oldset, info);
956 else { 683 else if (current->thread.new_signal)
957 if (ka->sa.sa_flags & SA_SIGINFO) 684 new_setup_frame(ka, regs, signr, oldset);
958 new_setup_rt_frame(ka, regs, signr, oldset, info); 685 else
959 else if (current->thread.new_signal) 686 setup_frame(&ka->sa, regs, signr, oldset, info);
960 new_setup_frame(ka, regs, signr, oldset); 687
961 else
962 setup_frame(&ka->sa, regs, signr, oldset, info);
963 }
964 spin_lock_irq(&current->sighand->siglock); 688 spin_lock_irq(&current->sighand->siglock);
965 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 689 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
966 if (!(ka->sa.sa_flags & SA_NOMASK)) 690 if (!(ka->sa.sa_flags & SA_NOMASK))
@@ -1002,17 +726,6 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest
1002 int signr; 726 int signr;
1003 sigset_t *oldset; 727 sigset_t *oldset;
1004 728
1005 /*
1006 * XXX Disable svr4 signal handling until solaris emulation works.
1007 * It is buggy - Anton
1008 */
1009#define SVR4_SIGNAL_BROKEN 1
1010#ifdef SVR4_SIGNAL_BROKEN
1011 int svr4_signal = 0;
1012#else
1013 int svr4_signal = current->personality == PER_SVR4;
1014#endif
1015
1016 cookie.restart_syscall = restart_syscall; 729 cookie.restart_syscall = restart_syscall;
1017 cookie.orig_i0 = orig_i0; 730 cookie.orig_i0 = orig_i0;
1018 731
@@ -1025,8 +738,8 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest
1025 if (signr > 0) { 738 if (signr > 0) {
1026 if (cookie.restart_syscall) 739 if (cookie.restart_syscall)
1027 syscall_restart(cookie.orig_i0, regs, &ka.sa); 740 syscall_restart(cookie.orig_i0, regs, &ka.sa);
1028 handle_signal(signr, &ka, &info, oldset, 741 handle_signal(signr, &ka, &info, oldset, regs);
1029 regs, svr4_signal); 742
1030 /* a signal was successfully delivered; the saved 743 /* a signal was successfully delivered; the saved
1031 * sigmask will have been stored in the signal frame, 744 * sigmask will have been stored in the signal frame,
1032 * and will be restored by sigreturn, so we can simply 745 * and will be restored by sigreturn, so we can simply
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 97b1de0e9094..0bcf98a7ef38 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -36,12 +36,10 @@
36#include <asm/io.h> 36#include <asm/io.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/idprom.h> 38#include <asm/idprom.h>
39#include <asm/svr4.h>
40#include <asm/head.h> 39#include <asm/head.h>
41#include <asm/smp.h> 40#include <asm/smp.h>
42#include <asm/mostek.h> 41#include <asm/mostek.h>
43#include <asm/ptrace.h> 42#include <asm/ptrace.h>
44#include <asm/user.h>
45#include <asm/uaccess.h> 43#include <asm/uaccess.h>
46#include <asm/checksum.h> 44#include <asm/checksum.h>
47#ifdef CONFIG_SBUS 45#ifdef CONFIG_SBUS
@@ -62,8 +60,6 @@ struct poll {
62 short revents; 60 short revents;
63}; 61};
64 62
65extern int svr4_getcontext (svr4_ucontext_t *, struct pt_regs *);
66extern int svr4_setcontext (svr4_ucontext_t *, struct pt_regs *);
67extern void (*__copy_1page)(void *, const void *); 63extern void (*__copy_1page)(void *, const void *);
68extern void __memmove(void *, const void *, __kernel_size_t); 64extern void __memmove(void *, const void *, __kernel_size_t);
69extern void (*bzero_1page)(void *); 65extern void (*bzero_1page)(void *);
@@ -204,10 +200,6 @@ EXPORT_SYMBOL(kmap_atomic);
204EXPORT_SYMBOL(kunmap_atomic); 200EXPORT_SYMBOL(kunmap_atomic);
205#endif 201#endif
206 202
207/* Solaris/SunOS binary compatibility */
208EXPORT_SYMBOL(svr4_setcontext);
209EXPORT_SYMBOL(svr4_getcontext);
210
211/* prom symbols */ 203/* prom symbols */
212EXPORT_SYMBOL(idprom); 204EXPORT_SYMBOL(idprom);
213EXPORT_SYMBOL(prom_root_node); 205EXPORT_SYMBOL(prom_root_node);
diff --git a/arch/sparc/kernel/sunos_asm.S b/arch/sparc/kernel/sunos_asm.S
deleted file mode 100644
index 07fe86014fb5..000000000000
--- a/arch/sparc/kernel/sunos_asm.S
+++ /dev/null
@@ -1,67 +0,0 @@
1/* $Id: sunos_asm.S,v 1.15 2000/01/11 17:33:21 jj Exp $
2 * sunos_asm.S: SunOS system calls which must have a low-level
3 * entry point to operate correctly.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 *
7 * Based upon preliminary work which is:
8 *
9 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
10 */
11
12#include <asm/ptrace.h>
13
14 .text
15 .align 4
16
17 /* When calling ret_sys_call, %o0 should contain the same
18 * value as in [%sp + STACKFRAME_SZ + PT_I0] */
19
20 /* SunOS getpid() returns pid in %o0 and ppid in %o1 */
21 .globl sunos_getpid
22sunos_getpid:
23 call sys_getppid
24 nop
25
26 call sys_getpid
27 st %o0, [%sp + STACKFRAME_SZ + PT_I1]
28
29 b ret_sys_call
30 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
31
32 /* SunOS getuid() returns uid in %o0 and euid in %o1 */
33 .globl sunos_getuid
34sunos_getuid:
35 call sys_geteuid16
36 nop
37
38 call sys_getuid16
39 st %o0, [%sp + STACKFRAME_SZ + PT_I1]
40
41 b ret_sys_call
42 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
43
44 /* SunOS getgid() returns gid in %o0 and egid in %o1 */
45 .globl sunos_getgid
46sunos_getgid:
47 call sys_getegid16
48 nop
49
50 call sys_getgid16
51 st %o0, [%sp + STACKFRAME_SZ + PT_I1]
52
53 b ret_sys_call
54 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
55
56 /* SunOS's execv() call only specifies the argv argument, the
57 * environment settings are the same as the calling processes.
58 */
59 .globl sunos_execv
60sunos_execv:
61 st %g0, [%sp + STACKFRAME_SZ + PT_I2]
62
63 call sparc_execve
64 add %sp, STACKFRAME_SZ, %o0
65
66 b ret_sys_call
67 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
diff --git a/arch/sparc/kernel/sunos_ioctl.c b/arch/sparc/kernel/sunos_ioctl.c
deleted file mode 100644
index e613cc6a10ba..000000000000
--- a/arch/sparc/kernel/sunos_ioctl.c
+++ /dev/null
@@ -1,230 +0,0 @@
1/* $Id: sunos_ioctl.c,v 1.34 2000/09/03 14:10:56 anton Exp $
2 * sunos_ioctl.c: The Linux Operating system: SunOS ioctl compatibility.
3 *
4 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7
8#include <asm/uaccess.h>
9
10#include <linux/sched.h>
11#include <linux/errno.h>
12#include <linux/string.h>
13#include <linux/termios.h>
14#include <linux/tty.h>
15#include <linux/ioctl.h>
16#include <linux/route.h>
17#include <linux/sockios.h>
18#include <linux/if.h>
19#include <linux/netdevice.h>
20#include <linux/if_arp.h>
21#include <linux/fs.h>
22#include <linux/mm.h>
23#include <linux/smp.h>
24#include <linux/syscalls.h>
25#include <linux/file.h>
26
27#if 0
28extern char sunkbd_type;
29extern char sunkbd_layout;
30#endif
31
32/* NR_OPEN is now larger and dynamic in recent kernels. */
33#define SUNOS_NR_OPEN 256
34
35asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg)
36{
37 int ret = -EBADF;
38
39 if (fd >= SUNOS_NR_OPEN || !fcheck(fd))
40 goto out;
41
42 /* First handle an easy compat. case for tty ldisc. */
43 if (cmd == TIOCSETD) {
44 int __user *p;
45 int ntty = N_TTY, tmp;
46 mm_segment_t oldfs;
47
48 p = (int __user *) arg;
49 ret = -EFAULT;
50 if (get_user(tmp, p))
51 goto out;
52 if (tmp == 2) {
53 oldfs = get_fs();
54 set_fs(KERNEL_DS);
55 ret = sys_ioctl(fd, cmd, (unsigned long) &ntty);
56 set_fs(oldfs);
57 ret = (ret == -EINVAL ? -EOPNOTSUPP : ret);
58 goto out;
59 }
60 }
61
62 /* Binary compatibility is good American knowhow fuckin' up. */
63 if (cmd == TIOCNOTTY) {
64 ret = sys_setsid();
65 goto out;
66 }
67
68 /* SunOS networking ioctls. */
69 switch (cmd) {
70 case _IOW('r', 10, struct rtentry):
71 ret = sys_ioctl(fd, SIOCADDRT, arg);
72 goto out;
73 case _IOW('r', 11, struct rtentry):
74 ret = sys_ioctl(fd, SIOCDELRT, arg);
75 goto out;
76 case _IOW('i', 12, struct ifreq):
77 ret = sys_ioctl(fd, SIOCSIFADDR, arg);
78 goto out;
79 case _IOWR('i', 13, struct ifreq):
80 ret = sys_ioctl(fd, SIOCGIFADDR, arg);
81 goto out;
82 case _IOW('i', 14, struct ifreq):
83 ret = sys_ioctl(fd, SIOCSIFDSTADDR, arg);
84 goto out;
85 case _IOWR('i', 15, struct ifreq):
86 ret = sys_ioctl(fd, SIOCGIFDSTADDR, arg);
87 goto out;
88 case _IOW('i', 16, struct ifreq):
89 ret = sys_ioctl(fd, SIOCSIFFLAGS, arg);
90 goto out;
91 case _IOWR('i', 17, struct ifreq):
92 ret = sys_ioctl(fd, SIOCGIFFLAGS, arg);
93 goto out;
94 case _IOW('i', 18, struct ifreq):
95 ret = sys_ioctl(fd, SIOCSIFMEM, arg);
96 goto out;
97 case _IOWR('i', 19, struct ifreq):
98 ret = sys_ioctl(fd, SIOCGIFMEM, arg);
99 goto out;
100 case _IOWR('i', 20, struct ifconf):
101 ret = sys_ioctl(fd, SIOCGIFCONF, arg);
102 goto out;
103 case _IOW('i', 21, struct ifreq): /* SIOCSIFMTU */
104 ret = sys_ioctl(fd, SIOCSIFMTU, arg);
105 goto out;
106 case _IOWR('i', 22, struct ifreq): /* SIOCGIFMTU */
107 ret = sys_ioctl(fd, SIOCGIFMTU, arg);
108 goto out;
109
110 case _IOWR('i', 23, struct ifreq):
111 ret = sys_ioctl(fd, SIOCGIFBRDADDR, arg);
112 goto out;
113 case _IOW('i', 24, struct ifreq):
114 ret = sys_ioctl(fd, SIOCSIFBRDADDR, arg);
115 goto out;
116 case _IOWR('i', 25, struct ifreq):
117 ret = sys_ioctl(fd, SIOCGIFNETMASK, arg);
118 goto out;
119 case _IOW('i', 26, struct ifreq):
120 ret = sys_ioctl(fd, SIOCSIFNETMASK, arg);
121 goto out;
122 case _IOWR('i', 27, struct ifreq):
123 ret = sys_ioctl(fd, SIOCGIFMETRIC, arg);
124 goto out;
125 case _IOW('i', 28, struct ifreq):
126 ret = sys_ioctl(fd, SIOCSIFMETRIC, arg);
127 goto out;
128
129 case _IOW('i', 30, struct arpreq):
130 ret = sys_ioctl(fd, SIOCSARP, arg);
131 goto out;
132 case _IOWR('i', 31, struct arpreq):
133 ret = sys_ioctl(fd, SIOCGARP, arg);
134 goto out;
135 case _IOW('i', 32, struct arpreq):
136 ret = sys_ioctl(fd, SIOCDARP, arg);
137 goto out;
138
139 case _IOW('i', 40, struct ifreq): /* SIOCUPPER */
140 case _IOW('i', 41, struct ifreq): /* SIOCLOWER */
141 case _IOW('i', 44, struct ifreq): /* SIOCSETSYNC */
142 case _IOW('i', 45, struct ifreq): /* SIOCGETSYNC */
143 case _IOW('i', 46, struct ifreq): /* SIOCSSDSTATS */
144 case _IOW('i', 47, struct ifreq): /* SIOCSSESTATS */
145 case _IOW('i', 48, struct ifreq): /* SIOCSPROMISC */
146 ret = -EOPNOTSUPP;
147 goto out;
148
149 case _IOW('i', 49, struct ifreq):
150 ret = sys_ioctl(fd, SIOCADDMULTI, arg);
151 goto out;
152 case _IOW('i', 50, struct ifreq):
153 ret = sys_ioctl(fd, SIOCDELMULTI, arg);
154 goto out;
155
156 /* FDDI interface ioctls, unsupported. */
157
158 case _IOW('i', 51, struct ifreq): /* SIOCFDRESET */
159 case _IOW('i', 52, struct ifreq): /* SIOCFDSLEEP */
160 case _IOW('i', 53, struct ifreq): /* SIOCSTRTFMWAR */
161 case _IOW('i', 54, struct ifreq): /* SIOCLDNSTRTFW */
162 case _IOW('i', 55, struct ifreq): /* SIOCGETFDSTAT */
163 case _IOW('i', 56, struct ifreq): /* SIOCFDNMIINT */
164 case _IOW('i', 57, struct ifreq): /* SIOCFDEXUSER */
165 case _IOW('i', 58, struct ifreq): /* SIOCFDGNETMAP */
166 case _IOW('i', 59, struct ifreq): /* SIOCFDGIOCTL */
167 printk("FDDI ioctl, returning EOPNOTSUPP\n");
168 ret = -EOPNOTSUPP;
169 goto out;
170
171 case _IOW('t', 125, int):
172 /* More stupid tty sunos ioctls, just
173 * say it worked.
174 */
175 ret = 0;
176 goto out;
177 /* Non posix grp */
178 case _IOW('t', 118, int): {
179 int oldval, newval, __user *ptr;
180
181 cmd = TIOCSPGRP;
182 ptr = (int __user *) arg;
183 ret = -EFAULT;
184 if (get_user(oldval, ptr))
185 goto out;
186 ret = sys_ioctl(fd, cmd, arg);
187 __get_user(newval, ptr);
188 if (newval == -1) {
189 __put_user(oldval, ptr);
190 ret = -EIO;
191 }
192 if (ret == -ENOTTY)
193 ret = -EIO;
194 goto out;
195 }
196
197 case _IOR('t', 119, int): {
198 int oldval, newval, __user *ptr;
199
200 cmd = TIOCGPGRP;
201 ptr = (int __user *) arg;
202 ret = -EFAULT;
203 if (get_user(oldval, ptr))
204 goto out;
205 ret = sys_ioctl(fd, cmd, arg);
206 __get_user(newval, ptr);
207 if (newval == -1) {
208 __put_user(oldval, ptr);
209 ret = -EIO;
210 }
211 if (ret == -ENOTTY)
212 ret = -EIO;
213 goto out;
214 }
215 }
216
217#if 0
218 if ((cmd & 0xff00) == ('k' << 8)) {
219 printk ("[[KBIO: %8.8x\n", (unsigned int) cmd);
220 }
221#endif
222
223 ret = sys_ioctl(fd, cmd, arg);
224 /* so stupid... */
225 ret = (ret == -EINVAL ? -EOPNOTSUPP : ret);
226out:
227 return ret;
228}
229
230
diff --git a/arch/sparc/kernel/sys_solaris.c b/arch/sparc/kernel/sys_solaris.c
deleted file mode 100644
index 2226a5992484..000000000000
--- a/arch/sparc/kernel/sys_solaris.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * linux/arch/sparc/kernel/sys_solaris.c
3 *
4 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
5 */
6
7#include <linux/sched.h>
8#include <linux/kernel.h>
9#include <linux/string.h>
10#include <linux/errno.h>
11#include <linux/personality.h>
12#include <linux/ptrace.h>
13#include <linux/mm.h>
14#include <linux/smp.h>
15#include <linux/module.h>
16
17asmlinkage int
18do_solaris_syscall (struct pt_regs *regs)
19{
20 static int cnt = 0;
21 if (++cnt < 10) printk ("No solaris handler\n");
22 force_sig(SIGSEGV, current);
23 return 0;
24}
25
26#ifndef CONFIG_SUNOS_EMUL
27asmlinkage int
28do_sunos_syscall (struct pt_regs *regs)
29{
30 static int cnt = 0;
31 if (++cnt < 10) printk ("SunOS binary emulation not compiled in\n");
32 force_sig (SIGSEGV, current);
33 return 0;
34}
35#endif
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
deleted file mode 100644
index f5b608bbe8af..000000000000
--- a/arch/sparc/kernel/sys_sunos.c
+++ /dev/null
@@ -1,1210 +0,0 @@
1/* $Id: sys_sunos.c,v 1.137 2002/02/08 03:57:14 davem Exp $
2 * sys_sunos.c: SunOS specific syscall compatibility support.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
6 *
7 * Based upon preliminary work which is:
8 *
9 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
10 *
11 */
12
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/types.h>
16#include <linux/mman.h>
17#include <linux/mm.h>
18#include <linux/swap.h>
19#include <linux/fs.h>
20#include <linux/file.h>
21#include <linux/resource.h>
22#include <linux/ipc.h>
23#include <linux/shm.h>
24#include <linux/msg.h>
25#include <linux/sem.h>
26#include <linux/signal.h>
27#include <linux/uio.h>
28#include <linux/utsname.h>
29#include <linux/major.h>
30#include <linux/stat.h>
31#include <linux/slab.h>
32#include <linux/pagemap.h>
33#include <linux/capability.h>
34#include <linux/errno.h>
35#include <linux/smp.h>
36#include <linux/smp_lock.h>
37#include <linux/syscalls.h>
38
39#include <net/sock.h>
40
41#include <asm/uaccess.h>
42#ifndef KERNEL_DS
43#include <linux/segment.h>
44#endif
45
46#include <asm/page.h>
47#include <asm/pgtable.h>
48#include <asm/pconf.h>
49#include <asm/idprom.h> /* for gethostid() */
50#include <asm/unistd.h>
51#include <asm/system.h>
52
53/* For the nfs mount emulation */
54#include <linux/socket.h>
55#include <linux/in.h>
56#include <linux/nfs.h>
57#include <linux/nfs2.h>
58#include <linux/nfs_mount.h>
59
60/* for sunos_select */
61#include <linux/time.h>
62#include <linux/personality.h>
63
64/* NR_OPEN is now larger and dynamic in recent kernels. */
65#define SUNOS_NR_OPEN 256
66
67/* We use the SunOS mmap() semantics. */
68asmlinkage unsigned long sunos_mmap(unsigned long addr, unsigned long len,
69 unsigned long prot, unsigned long flags,
70 unsigned long fd, unsigned long off)
71{
72 struct file * file = NULL;
73 unsigned long retval, ret_type;
74
75 if (flags & MAP_NORESERVE) {
76 static int cnt;
77 if (cnt++ < 10)
78 printk("%s: unimplemented SunOS MAP_NORESERVE mmap() flag\n",
79 current->comm);
80 flags &= ~MAP_NORESERVE;
81 }
82 retval = -EBADF;
83 if (!(flags & MAP_ANONYMOUS)) {
84 if (fd >= SUNOS_NR_OPEN)
85 goto out;
86 file = fget(fd);
87 if (!file)
88 goto out;
89 }
90
91 retval = -EINVAL;
92 /* If this is ld.so or a shared library doing an mmap
93 * of /dev/zero, transform it into an anonymous mapping.
94 * SunOS is so stupid some times... hmph!
95 */
96 if (file) {
97 if (imajor(file->f_path.dentry->d_inode) == MEM_MAJOR &&
98 iminor(file->f_path.dentry->d_inode) == 5) {
99 flags |= MAP_ANONYMOUS;
100 fput(file);
101 file = NULL;
102 }
103 }
104 ret_type = flags & _MAP_NEW;
105 flags &= ~_MAP_NEW;
106
107 if (!(flags & MAP_FIXED))
108 addr = 0;
109 else {
110 if (ARCH_SUN4C_SUN4 &&
111 (len > 0x20000000 ||
112 ((flags & MAP_FIXED) &&
113 addr < 0xe0000000 && addr + len > 0x20000000)))
114 goto out_putf;
115
116 /* See asm-sparc/uaccess.h */
117 if (len > TASK_SIZE - PAGE_SIZE ||
118 addr + len > TASK_SIZE - PAGE_SIZE)
119 goto out_putf;
120 }
121
122 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
123 down_write(&current->mm->mmap_sem);
124 retval = do_mmap(file, addr, len, prot, flags, off);
125 up_write(&current->mm->mmap_sem);
126 if (!ret_type)
127 retval = ((retval < PAGE_OFFSET) ? 0 : retval);
128
129out_putf:
130 if (file)
131 fput(file);
132out:
133 return retval;
134}
135
136/* lmbench calls this, just say "yeah, ok" */
137asmlinkage int sunos_mctl(unsigned long addr, unsigned long len, int function, char *arg)
138{
139 return 0;
140}
141
142/* SunOS is completely broken... it returns 0 on success, otherwise
143 * ENOMEM. For sys_sbrk() it wants the old brk value as a return
144 * on success and ENOMEM as before on failure.
145 */
146asmlinkage int sunos_brk(unsigned long brk)
147{
148 int freepages, retval = -ENOMEM;
149 unsigned long rlim;
150 unsigned long newbrk, oldbrk;
151
152 down_write(&current->mm->mmap_sem);
153 if (ARCH_SUN4C_SUN4) {
154 if (brk >= 0x20000000 && brk < 0xe0000000) {
155 goto out;
156 }
157 }
158
159 if (brk < current->mm->end_code)
160 goto out;
161
162 newbrk = PAGE_ALIGN(brk);
163 oldbrk = PAGE_ALIGN(current->mm->brk);
164 retval = 0;
165 if (oldbrk == newbrk) {
166 current->mm->brk = brk;
167 goto out;
168 }
169
170 /*
171 * Always allow shrinking brk
172 */
173 if (brk <= current->mm->brk) {
174 current->mm->brk = brk;
175 do_munmap(current->mm, newbrk, oldbrk-newbrk);
176 goto out;
177 }
178 /*
179 * Check against rlimit and stack..
180 */
181 retval = -ENOMEM;
182 rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
183 if (rlim >= RLIM_INFINITY)
184 rlim = ~0;
185 if (brk - current->mm->end_code > rlim)
186 goto out;
187
188 /*
189 * Check against existing mmap mappings.
190 */
191 if (find_vma_intersection(current->mm, oldbrk, newbrk+PAGE_SIZE))
192 goto out;
193
194 /*
195 * stupid algorithm to decide if we have enough memory: while
196 * simple, it hopefully works in most obvious cases.. Easy to
197 * fool it, but this should catch most mistakes.
198 */
199 freepages = global_page_state(NR_FILE_PAGES);
200 freepages >>= 1;
201 freepages += nr_free_pages();
202 freepages += nr_swap_pages;
203 freepages -= num_physpages >> 4;
204 freepages -= (newbrk-oldbrk) >> PAGE_SHIFT;
205 if (freepages < 0)
206 goto out;
207 /*
208 * Ok, we have probably got enough memory - let it rip.
209 */
210 current->mm->brk = brk;
211 do_brk(oldbrk, newbrk-oldbrk);
212 retval = 0;
213out:
214 up_write(&current->mm->mmap_sem);
215 return retval;
216}
217
218asmlinkage unsigned long sunos_sbrk(int increment)
219{
220 int error;
221 unsigned long oldbrk;
222
223 /* This should do it hopefully... */
224 lock_kernel();
225 oldbrk = current->mm->brk;
226 error = sunos_brk(((int) current->mm->brk) + increment);
227 if (!error)
228 error = oldbrk;
229 unlock_kernel();
230 return error;
231}
232
233/* XXX Completely undocumented, and completely magic...
234 * XXX I believe it is to increase the size of the stack by
235 * XXX argument 'increment' and return the new end of stack
236 * XXX area. Wheee...
237 */
238asmlinkage unsigned long sunos_sstk(int increment)
239{
240 lock_kernel();
241 printk("%s: Call to sunos_sstk(increment<%d>) is unsupported\n",
242 current->comm, increment);
243 unlock_kernel();
244 return -1;
245}
246
247/* Give hints to the kernel as to what paging strategy to use...
248 * Completely bogus, don't remind me.
249 */
250#define VA_NORMAL 0 /* Normal vm usage expected */
251#define VA_ABNORMAL 1 /* Abnormal/random vm usage probable */
252#define VA_SEQUENTIAL 2 /* Accesses will be of a sequential nature */
253#define VA_INVALIDATE 3 /* Page table entries should be flushed ??? */
254static char *vstrings[] = {
255 "VA_NORMAL",
256 "VA_ABNORMAL",
257 "VA_SEQUENTIAL",
258 "VA_INVALIDATE",
259};
260
261asmlinkage void sunos_vadvise(unsigned long strategy)
262{
263 /* I wanna see who uses this... */
264 lock_kernel();
265 printk("%s: Advises us to use %s paging strategy\n",
266 current->comm,
267 strategy <= 3 ? vstrings[strategy] : "BOGUS");
268 unlock_kernel();
269}
270
271/* This just wants the soft limit (ie. rlim_cur element) of the RLIMIT_NOFILE
272 * resource limit and is for backwards compatibility with older sunos
273 * revs.
274 */
275asmlinkage long sunos_getdtablesize(void)
276{
277 return SUNOS_NR_OPEN;
278}
279
280#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
281
282asmlinkage unsigned long sunos_sigblock(unsigned long blk_mask)
283{
284 unsigned long old;
285
286 spin_lock_irq(&current->sighand->siglock);
287 old = current->blocked.sig[0];
288 current->blocked.sig[0] |= (blk_mask & _BLOCKABLE);
289 recalc_sigpending();
290 spin_unlock_irq(&current->sighand->siglock);
291 return old;
292}
293
294asmlinkage unsigned long sunos_sigsetmask(unsigned long newmask)
295{
296 unsigned long retval;
297
298 spin_lock_irq(&current->sighand->siglock);
299 retval = current->blocked.sig[0];
300 current->blocked.sig[0] = (newmask & _BLOCKABLE);
301 recalc_sigpending();
302 spin_unlock_irq(&current->sighand->siglock);
303 return retval;
304}
305
306/* SunOS getdents is very similar to the newer Linux (iBCS2 compliant) */
307/* getdents system call, the format of the structure just has a different */
308/* layout (d_off+d_ino instead of d_ino+d_off) */
309struct sunos_dirent {
310 long d_off;
311 unsigned long d_ino;
312 unsigned short d_reclen;
313 unsigned short d_namlen;
314 char d_name[1];
315};
316
317struct sunos_dirent_callback {
318 struct sunos_dirent __user *curr;
319 struct sunos_dirent __user *previous;
320 int count;
321 int error;
322};
323
324#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
325#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
326
327static int sunos_filldir(void * __buf, const char * name, int namlen,
328 loff_t offset, u64 ino, unsigned int d_type)
329{
330 struct sunos_dirent __user *dirent;
331 struct sunos_dirent_callback * buf = __buf;
332 unsigned long d_ino;
333 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
334
335 buf->error = -EINVAL; /* only used if we fail.. */
336 if (reclen > buf->count)
337 return -EINVAL;
338 d_ino = ino;
339 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
340 return -EOVERFLOW;
341 dirent = buf->previous;
342 if (dirent)
343 put_user(offset, &dirent->d_off);
344 dirent = buf->curr;
345 buf->previous = dirent;
346 put_user(d_ino, &dirent->d_ino);
347 put_user(namlen, &dirent->d_namlen);
348 put_user(reclen, &dirent->d_reclen);
349 copy_to_user(dirent->d_name, name, namlen);
350 put_user(0, dirent->d_name + namlen);
351 dirent = (void __user *) dirent + reclen;
352 buf->curr = dirent;
353 buf->count -= reclen;
354 return 0;
355}
356
357asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt)
358{
359 struct file * file;
360 struct sunos_dirent __user *lastdirent;
361 struct sunos_dirent_callback buf;
362 int error = -EBADF;
363
364 if (fd >= SUNOS_NR_OPEN)
365 goto out;
366
367 file = fget(fd);
368 if (!file)
369 goto out;
370
371 error = -EINVAL;
372 if (cnt < (sizeof(struct sunos_dirent) + 255))
373 goto out_putf;
374
375 buf.curr = (struct sunos_dirent __user *) dirent;
376 buf.previous = NULL;
377 buf.count = cnt;
378 buf.error = 0;
379
380 error = vfs_readdir(file, sunos_filldir, &buf);
381 if (error < 0)
382 goto out_putf;
383
384 lastdirent = buf.previous;
385 error = buf.error;
386 if (lastdirent) {
387 put_user(file->f_pos, &lastdirent->d_off);
388 error = cnt - buf.count;
389 }
390
391out_putf:
392 fput(file);
393out:
394 return error;
395}
396
397/* Old sunos getdirentries, severely broken compatibility stuff here. */
398struct sunos_direntry {
399 unsigned long d_ino;
400 unsigned short d_reclen;
401 unsigned short d_namlen;
402 char d_name[1];
403};
404
405struct sunos_direntry_callback {
406 struct sunos_direntry __user *curr;
407 struct sunos_direntry __user *previous;
408 int count;
409 int error;
410};
411
412static int sunos_filldirentry(void * __buf, const char * name, int namlen,
413 loff_t offset, u64 ino, unsigned int d_type)
414{
415 struct sunos_direntry __user *dirent;
416 struct sunos_direntry_callback *buf = __buf;
417 unsigned long d_ino;
418 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
419
420 buf->error = -EINVAL; /* only used if we fail.. */
421 if (reclen > buf->count)
422 return -EINVAL;
423 d_ino = ino;
424 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
425 return -EOVERFLOW;
426 dirent = buf->previous;
427 dirent = buf->curr;
428 buf->previous = dirent;
429 put_user(d_ino, &dirent->d_ino);
430 put_user(namlen, &dirent->d_namlen);
431 put_user(reclen, &dirent->d_reclen);
432 copy_to_user(dirent->d_name, name, namlen);
433 put_user(0, dirent->d_name + namlen);
434 dirent = (void __user *) dirent + reclen;
435 buf->curr = dirent;
436 buf->count -= reclen;
437 return 0;
438}
439
440asmlinkage int sunos_getdirentries(unsigned int fd, void __user *dirent,
441 int cnt, unsigned int __user *basep)
442{
443 struct file * file;
444 struct sunos_direntry __user *lastdirent;
445 struct sunos_direntry_callback buf;
446 int error = -EBADF;
447
448 if (fd >= SUNOS_NR_OPEN)
449 goto out;
450
451 file = fget(fd);
452 if (!file)
453 goto out;
454
455 error = -EINVAL;
456 if (cnt < (sizeof(struct sunos_direntry) + 255))
457 goto out_putf;
458
459 buf.curr = (struct sunos_direntry __user *) dirent;
460 buf.previous = NULL;
461 buf.count = cnt;
462 buf.error = 0;
463
464 error = vfs_readdir(file, sunos_filldirentry, &buf);
465 if (error < 0)
466 goto out_putf;
467
468 lastdirent = buf.previous;
469 error = buf.error;
470 if (lastdirent) {
471 put_user(file->f_pos, basep);
472 error = cnt - buf.count;
473 }
474
475out_putf:
476 fput(file);
477out:
478 return error;
479}
480
481struct sunos_utsname {
482 char sname[9];
483 char nname[9];
484 char nnext[56];
485 char rel[9];
486 char ver[9];
487 char mach[9];
488};
489
490asmlinkage int sunos_uname(struct sunos_utsname __user *name)
491{
492 int ret;
493 down_read(&uts_sem);
494 ret = copy_to_user(&name->sname[0], &utsname()->sysname[0],
495 sizeof(name->sname) - 1);
496 if (!ret) {
497 ret |= __copy_to_user(&name->nname[0], &utsname()->nodename[0],
498 sizeof(name->nname) - 1);
499 ret |= __put_user('\0', &name->nname[8]);
500 ret |= __copy_to_user(&name->rel[0], &utsname()->release[0],
501 sizeof(name->rel) - 1);
502 ret |= __copy_to_user(&name->ver[0], &utsname()->version[0],
503 sizeof(name->ver) - 1);
504 ret |= __copy_to_user(&name->mach[0], &utsname()->machine[0],
505 sizeof(name->mach) - 1);
506 }
507 up_read(&uts_sem);
508 return ret ? -EFAULT : 0;
509}
510
511asmlinkage int sunos_nosys(void)
512{
513 struct pt_regs *regs;
514 siginfo_t info;
515 static int cnt;
516
517 lock_kernel();
518 regs = current->thread.kregs;
519 info.si_signo = SIGSYS;
520 info.si_errno = 0;
521 info.si_code = __SI_FAULT|0x100;
522 info.si_addr = (void __user *)regs->pc;
523 info.si_trapno = regs->u_regs[UREG_G1];
524 send_sig_info(SIGSYS, &info, current);
525 if (cnt++ < 4) {
526 printk("Process makes ni_syscall number %d, register dump:\n",
527 (int) regs->u_regs[UREG_G1]);
528 show_regs(regs);
529 }
530 unlock_kernel();
531 return -ENOSYS;
532}
533
534/* This is not a real and complete implementation yet, just to keep
535 * the easy SunOS binaries happy.
536 */
537asmlinkage int sunos_fpathconf(int fd, int name)
538{
539 int ret;
540
541 switch(name) {
542 case _PCONF_LINK:
543 ret = LINK_MAX;
544 break;
545 case _PCONF_CANON:
546 ret = MAX_CANON;
547 break;
548 case _PCONF_INPUT:
549 ret = MAX_INPUT;
550 break;
551 case _PCONF_NAME:
552 ret = NAME_MAX;
553 break;
554 case _PCONF_PATH:
555 ret = PATH_MAX;
556 break;
557 case _PCONF_PIPE:
558 ret = PIPE_BUF;
559 break;
560 case _PCONF_CHRESTRICT: /* XXX Investigate XXX */
561 ret = 1;
562 break;
563 case _PCONF_NOTRUNC: /* XXX Investigate XXX */
564 case _PCONF_VDISABLE:
565 ret = 0;
566 break;
567 default:
568 ret = -EINVAL;
569 break;
570 }
571 return ret;
572}
573
574asmlinkage int sunos_pathconf(char __user *path, int name)
575{
576 int ret;
577
578 ret = sunos_fpathconf(0, name); /* XXX cheese XXX */
579 return ret;
580}
581
582/* SunOS mount system call emulation */
583
584asmlinkage int sunos_select(int width, fd_set __user *inp, fd_set __user *outp,
585 fd_set __user *exp, struct timeval __user *tvp)
586{
587 int ret;
588
589 /* SunOS binaries expect that select won't change the tvp contents */
590 ret = sys_select (width, inp, outp, exp, tvp);
591 if (ret == -EINTR && tvp) {
592 time_t sec, usec;
593
594 __get_user(sec, &tvp->tv_sec);
595 __get_user(usec, &tvp->tv_usec);
596
597 if (sec == 0 && usec == 0)
598 ret = 0;
599 }
600 return ret;
601}
602
603asmlinkage void sunos_nop(void)
604{
605 return;
606}
607
608/* SunOS mount/umount. */
609#define SMNT_RDONLY 1
610#define SMNT_NOSUID 2
611#define SMNT_NEWTYPE 4
612#define SMNT_GRPID 8
613#define SMNT_REMOUNT 16
614#define SMNT_NOSUB 32
615#define SMNT_MULTI 64
616#define SMNT_SYS5 128
617
618struct sunos_fh_t {
619 char fh_data [NFS_FHSIZE];
620};
621
622struct sunos_nfs_mount_args {
623 struct sockaddr_in __user *addr; /* file server address */
624 struct nfs_fh __user *fh; /* File handle to be mounted */
625 int flags; /* flags */
626 int wsize; /* write size in bytes */
627 int rsize; /* read size in bytes */
628 int timeo; /* initial timeout in .1 secs */
629 int retrans; /* times to retry send */
630 char __user *hostname; /* server's hostname */
631 int acregmin; /* attr cache file min secs */
632 int acregmax; /* attr cache file max secs */
633 int acdirmin; /* attr cache dir min secs */
634 int acdirmax; /* attr cache dir max secs */
635 char __user *netname; /* server's netname */
636};
637
638
639/* Bind the socket on a local reserved port and connect it to the
640 * remote server. This on Linux/i386 is done by the mount program,
641 * not by the kernel.
642 */
643static int
644sunos_nfs_get_server_fd (int fd, struct sockaddr_in *addr)
645{
646 struct sockaddr_in local;
647 struct sockaddr_in server;
648 int try_port;
649 struct socket *socket;
650 struct inode *inode;
651 struct file *file;
652 int ret, result = 0;
653
654 file = fget(fd);
655 if (!file)
656 goto out;
657
658 inode = file->f_path.dentry->d_inode;
659
660 socket = SOCKET_I(inode);
661 local.sin_family = AF_INET;
662 local.sin_addr.s_addr = htonl(INADDR_ANY);
663
664 /* IPPORT_RESERVED = 1024, can't find the definition in the kernel */
665 try_port = 1024;
666 do {
667 local.sin_port = htons (--try_port);
668 ret = socket->ops->bind(socket, (struct sockaddr*)&local,
669 sizeof(local));
670 } while (ret && try_port > (1024 / 2));
671
672 if (ret)
673 goto out_putf;
674
675 server.sin_family = AF_INET;
676 server.sin_addr = addr->sin_addr;
677 server.sin_port = NFS_PORT;
678
679 /* Call sys_connect */
680 ret = socket->ops->connect (socket, (struct sockaddr *) &server,
681 sizeof (server), file->f_flags);
682 if (ret >= 0)
683 result = 1;
684
685out_putf:
686 fput(file);
687out:
688 return result;
689}
690
691static int get_default (int value, int def_value)
692{
693 if (value)
694 return value;
695 else
696 return def_value;
697}
698
699static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data)
700{
701 int server_fd, err;
702 char *the_name, *mount_page;
703 struct nfs_mount_data linux_nfs_mount;
704 struct sunos_nfs_mount_args sunos_mount;
705
706 /* Ok, here comes the fun part: Linux's nfs mount needs a
707 * socket connection to the server, but SunOS mount does not
708 * require this, so we use the information on the destination
709 * address to create a socket and bind it to a reserved
710 * port on this system
711 */
712 if (copy_from_user(&sunos_mount, data, sizeof(sunos_mount)))
713 return -EFAULT;
714
715 server_fd = sys_socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
716 if (server_fd < 0)
717 return -ENXIO;
718
719 if (copy_from_user(&linux_nfs_mount.addr,sunos_mount.addr,
720 sizeof(*sunos_mount.addr)) ||
721 copy_from_user(&linux_nfs_mount.root,sunos_mount.fh,
722 sizeof(*sunos_mount.fh))) {
723 sys_close (server_fd);
724 return -EFAULT;
725 }
726
727 if (!sunos_nfs_get_server_fd (server_fd, &linux_nfs_mount.addr)){
728 sys_close (server_fd);
729 return -ENXIO;
730 }
731
732 /* Now, bind it to a locally reserved port */
733 linux_nfs_mount.version = NFS_MOUNT_VERSION;
734 linux_nfs_mount.flags = sunos_mount.flags;
735 linux_nfs_mount.fd = server_fd;
736
737 linux_nfs_mount.rsize = get_default (sunos_mount.rsize, 8192);
738 linux_nfs_mount.wsize = get_default (sunos_mount.wsize, 8192);
739 linux_nfs_mount.timeo = get_default (sunos_mount.timeo, 10);
740 linux_nfs_mount.retrans = sunos_mount.retrans;
741
742 linux_nfs_mount.acregmin = sunos_mount.acregmin;
743 linux_nfs_mount.acregmax = sunos_mount.acregmax;
744 linux_nfs_mount.acdirmin = sunos_mount.acdirmin;
745 linux_nfs_mount.acdirmax = sunos_mount.acdirmax;
746
747 the_name = getname(sunos_mount.hostname);
748 if (IS_ERR(the_name))
749 return PTR_ERR(the_name);
750
751 strlcpy(linux_nfs_mount.hostname, the_name,
752 sizeof(linux_nfs_mount.hostname));
753 putname (the_name);
754
755 mount_page = (char *) get_zeroed_page(GFP_KERNEL);
756 if (!mount_page)
757 return -ENOMEM;
758
759 memcpy(mount_page, &linux_nfs_mount, sizeof(linux_nfs_mount));
760
761 err = do_mount("", dir_name, "nfs", linux_flags, mount_page);
762
763 free_page((unsigned long) mount_page);
764 return err;
765}
766
767asmlinkage int
768sunos_mount(char __user *type, char __user *dir, int flags, void __user *data)
769{
770 int linux_flags = 0;
771 int ret = -EINVAL;
772 char *dev_fname = NULL;
773 char *dir_page, *type_page;
774
775 if (!capable (CAP_SYS_ADMIN))
776 return -EPERM;
777
778 lock_kernel();
779 /* We don't handle the integer fs type */
780 if ((flags & SMNT_NEWTYPE) == 0)
781 goto out;
782
783 /* Do not allow for those flags we don't support */
784 if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5))
785 goto out;
786
787 if (flags & SMNT_REMOUNT)
788 linux_flags |= MS_REMOUNT;
789 if (flags & SMNT_RDONLY)
790 linux_flags |= MS_RDONLY;
791 if (flags & SMNT_NOSUID)
792 linux_flags |= MS_NOSUID;
793
794 dir_page = getname(dir);
795 ret = PTR_ERR(dir_page);
796 if (IS_ERR(dir_page))
797 goto out;
798
799 type_page = getname(type);
800 ret = PTR_ERR(type_page);
801 if (IS_ERR(type_page))
802 goto out1;
803
804 if (strcmp(type_page, "ext2") == 0) {
805 dev_fname = getname(data);
806 } else if (strcmp(type_page, "iso9660") == 0) {
807 dev_fname = getname(data);
808 } else if (strcmp(type_page, "minix") == 0) {
809 dev_fname = getname(data);
810 } else if (strcmp(type_page, "nfs") == 0) {
811 ret = sunos_nfs_mount (dir_page, flags, data);
812 goto out2;
813 } else if (strcmp(type_page, "ufs") == 0) {
814 printk("Warning: UFS filesystem mounts unsupported.\n");
815 ret = -ENODEV;
816 goto out2;
817 } else if (strcmp(type_page, "proc")) {
818 ret = -ENODEV;
819 goto out2;
820 }
821 ret = PTR_ERR(dev_fname);
822 if (IS_ERR(dev_fname))
823 goto out2;
824 ret = do_mount(dev_fname, dir_page, type_page, linux_flags, NULL);
825 if (dev_fname)
826 putname(dev_fname);
827out2:
828 putname(type_page);
829out1:
830 putname(dir_page);
831out:
832 unlock_kernel();
833 return ret;
834}
835
836
837asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
838{
839 int ret;
840
841 /* So stupid... */
842 if ((!pid || pid == current->pid) &&
843 !pgid) {
844 sys_setsid();
845 ret = 0;
846 } else {
847 ret = sys_setpgid(pid, pgid);
848 }
849 return ret;
850}
851
852/* So stupid... */
853asmlinkage int sunos_wait4(pid_t pid, unsigned int __user *stat_addr,
854 int options, struct rusage __user*ru)
855{
856 int ret;
857
858 ret = sys_wait4((pid ? pid : -1), stat_addr, options, ru);
859 return ret;
860}
861
862asmlinkage int sunos_killpg(int pgrp, int sig)
863{
864 int ret;
865
866 rcu_read_lock();
867 ret = -EINVAL;
868 if (pgrp > 0)
869 ret = kill_pgrp(find_vpid(pgrp), sig, 0);
870 rcu_read_unlock();
871
872 return ret;
873}
874
875asmlinkage int sunos_audit(void)
876{
877 lock_kernel();
878 printk ("sys_audit\n");
879 unlock_kernel();
880 return -1;
881}
882
883asmlinkage unsigned long sunos_gethostid(void)
884{
885 unsigned long ret;
886
887 lock_kernel();
888 ret = ((unsigned long)idprom->id_machtype << 24) |
889 (unsigned long)idprom->id_sernum;
890 unlock_kernel();
891 return ret;
892}
893
894/* sysconf options, for SunOS compatibility */
895#define _SC_ARG_MAX 1
896#define _SC_CHILD_MAX 2
897#define _SC_CLK_TCK 3
898#define _SC_NGROUPS_MAX 4
899#define _SC_OPEN_MAX 5
900#define _SC_JOB_CONTROL 6
901#define _SC_SAVED_IDS 7
902#define _SC_VERSION 8
903
904asmlinkage long sunos_sysconf (int name)
905{
906 long ret;
907
908 switch (name){
909 case _SC_ARG_MAX:
910 ret = ARG_MAX;
911 break;
912 case _SC_CHILD_MAX:
913 ret = current->signal->rlim[RLIMIT_NPROC].rlim_cur;
914 break;
915 case _SC_CLK_TCK:
916 ret = HZ;
917 break;
918 case _SC_NGROUPS_MAX:
919 ret = NGROUPS_MAX;
920 break;
921 case _SC_OPEN_MAX:
922 ret = current->signal->rlim[RLIMIT_NOFILE].rlim_cur;
923 break;
924 case _SC_JOB_CONTROL:
925 ret = 1; /* yes, we do support job control */
926 break;
927 case _SC_SAVED_IDS:
928 ret = 1; /* yes, we do support saved uids */
929 break;
930 case _SC_VERSION:
931 /* mhm, POSIX_VERSION is in /usr/include/unistd.h
932 * should it go on /usr/include/linux?
933 */
934 ret = 199009L;
935 break;
936 default:
937 ret = -1;
938 break;
939 };
940 return ret;
941}
942
943asmlinkage int sunos_semsys(int op, unsigned long arg1, unsigned long arg2,
944 unsigned long arg3, void *ptr)
945{
946 union semun arg4;
947 int ret;
948
949 switch (op) {
950 case 0:
951 /* Most arguments match on a 1:1 basis but cmd doesn't */
952 switch(arg3) {
953 case 4:
954 arg3=GETPID; break;
955 case 5:
956 arg3=GETVAL; break;
957 case 6:
958 arg3=GETALL; break;
959 case 3:
960 arg3=GETNCNT; break;
961 case 7:
962 arg3=GETZCNT; break;
963 case 8:
964 arg3=SETVAL; break;
965 case 9:
966 arg3=SETALL; break;
967 }
968 /* sys_semctl(): */
969 /* value to modify semaphore to */
970 arg4.__pad = (void __user *) ptr;
971 ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4 );
972 break;
973 case 1:
974 /* sys_semget(): */
975 ret = sys_semget((key_t)arg1, (int)arg2, (int)arg3);
976 break;
977 case 2:
978 /* sys_semop(): */
979 ret = sys_semop((int)arg1, (struct sembuf __user *)arg2, (unsigned)arg3);
980 break;
981 default:
982 ret = -EINVAL;
983 break;
984 };
985 return ret;
986}
987
988asmlinkage int sunos_msgsys(int op, unsigned long arg1, unsigned long arg2,
989 unsigned long arg3, unsigned long arg4)
990{
991 struct sparc_stackf *sp;
992 unsigned long arg5;
993 int rval;
994
995 switch(op) {
996 case 0:
997 rval = sys_msgget((key_t)arg1, (int)arg2);
998 break;
999 case 1:
1000 rval = sys_msgctl((int)arg1, (int)arg2,
1001 (struct msqid_ds __user *)arg3);
1002 break;
1003 case 2:
1004 lock_kernel();
1005 sp = (struct sparc_stackf *)current->thread.kregs->u_regs[UREG_FP];
1006 arg5 = sp->xxargs[0];
1007 unlock_kernel();
1008 rval = sys_msgrcv((int)arg1, (struct msgbuf __user *)arg2,
1009 (size_t)arg3, (long)arg4, (int)arg5);
1010 break;
1011 case 3:
1012 rval = sys_msgsnd((int)arg1, (struct msgbuf __user *)arg2,
1013 (size_t)arg3, (int)arg4);
1014 break;
1015 default:
1016 rval = -EINVAL;
1017 break;
1018 }
1019 return rval;
1020}
1021
1022asmlinkage int sunos_shmsys(int op, unsigned long arg1, unsigned long arg2,
1023 unsigned long arg3)
1024{
1025 unsigned long raddr;
1026 int rval;
1027
1028 switch(op) {
1029 case 0:
1030 /* do_shmat(): attach a shared memory area */
1031 rval = do_shmat((int)arg1,(char __user *)arg2,(int)arg3,&raddr);
1032 if (!rval)
1033 rval = (int) raddr;
1034 break;
1035 case 1:
1036 /* sys_shmctl(): modify shared memory area attr. */
1037 rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds __user *)arg3);
1038 break;
1039 case 2:
1040 /* sys_shmdt(): detach a shared memory area */
1041 rval = sys_shmdt((char __user *)arg1);
1042 break;
1043 case 3:
1044 /* sys_shmget(): get a shared memory area */
1045 rval = sys_shmget((key_t)arg1,(int)arg2,(int)arg3);
1046 break;
1047 default:
1048 rval = -EINVAL;
1049 break;
1050 };
1051 return rval;
1052}
1053
1054#define SUNOS_EWOULDBLOCK 35
1055
1056/* see the sunos man page read(2v) for an explanation
1057 of this garbage. We use O_NDELAY to mark
1058 file descriptors that have been set non-blocking
1059 using 4.2BSD style calls. (tridge) */
1060
1061static inline int check_nonblock(int ret, int fd)
1062{
1063 if (ret == -EAGAIN) {
1064 struct file * file = fget(fd);
1065 if (file) {
1066 if (file->f_flags & O_NDELAY)
1067 ret = -SUNOS_EWOULDBLOCK;
1068 fput(file);
1069 }
1070 }
1071 return ret;
1072}
1073
1074asmlinkage int sunos_read(unsigned int fd, char __user *buf, int count)
1075{
1076 int ret;
1077
1078 ret = check_nonblock(sys_read(fd,buf,count),fd);
1079 return ret;
1080}
1081
1082asmlinkage int sunos_readv(unsigned long fd, const struct iovec __user *vector,
1083 long count)
1084{
1085 int ret;
1086
1087 ret = check_nonblock(sys_readv(fd,vector,count),fd);
1088 return ret;
1089}
1090
1091asmlinkage int sunos_write(unsigned int fd, char __user *buf, int count)
1092{
1093 int ret;
1094
1095 ret = check_nonblock(sys_write(fd,buf,count),fd);
1096 return ret;
1097}
1098
1099asmlinkage int sunos_writev(unsigned long fd,
1100 const struct iovec __user *vector, long count)
1101{
1102 int ret;
1103
1104 ret = check_nonblock(sys_writev(fd,vector,count),fd);
1105 return ret;
1106}
1107
1108asmlinkage int sunos_recv(int fd, void __user *ubuf, int size, unsigned flags)
1109{
1110 int ret;
1111
1112 ret = check_nonblock(sys_recv(fd,ubuf,size,flags),fd);
1113 return ret;
1114}
1115
1116asmlinkage int sunos_send(int fd, void __user *buff, int len, unsigned flags)
1117{
1118 int ret;
1119
1120 ret = check_nonblock(sys_send(fd,buff,len,flags),fd);
1121 return ret;
1122}
1123
1124asmlinkage int sunos_accept(int fd, struct sockaddr __user *sa,
1125 int __user *addrlen)
1126{
1127 int ret;
1128
1129 while (1) {
1130 ret = check_nonblock(sys_accept(fd,sa,addrlen),fd);
1131 if (ret != -ENETUNREACH && ret != -EHOSTUNREACH)
1132 break;
1133 }
1134
1135 return ret;
1136}
1137
1138#define SUNOS_SV_INTERRUPT 2
1139
1140asmlinkage int
1141sunos_sigaction(int sig, const struct old_sigaction __user *act,
1142 struct old_sigaction __user *oact)
1143{
1144 struct k_sigaction new_ka, old_ka;
1145 int ret;
1146
1147 if (act) {
1148 old_sigset_t mask;
1149
1150 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
1151 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
1152 __get_user(new_ka.sa.sa_flags, &act->sa_flags))
1153 return -EFAULT;
1154 __get_user(mask, &act->sa_mask);
1155 new_ka.sa.sa_restorer = NULL;
1156 new_ka.ka_restorer = NULL;
1157 siginitset(&new_ka.sa.sa_mask, mask);
1158 new_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT;
1159 }
1160
1161 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
1162
1163 if (!ret && oact) {
1164 /* In the clone() case we could copy half consistent
1165 * state to the user, however this could sleep and
1166 * deadlock us if we held the signal lock on SMP. So for
1167 * now I take the easy way out and do no locking.
1168 * But then again we don't support SunOS lwp's anyways ;-)
1169 */
1170 old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT;
1171 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
1172 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
1173 __put_user(old_ka.sa.sa_flags, &oact->sa_flags))
1174 return -EFAULT;
1175 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
1176 }
1177
1178 return ret;
1179}
1180
1181
1182asmlinkage int sunos_setsockopt(int fd, int level, int optname,
1183 char __user *optval, int optlen)
1184{
1185 int tr_opt = optname;
1186 int ret;
1187
1188 if (level == SOL_IP) {
1189 /* Multicast socketopts (ttl, membership) */
1190 if (tr_opt >=2 && tr_opt <= 6)
1191 tr_opt += 30;
1192 }
1193 ret = sys_setsockopt(fd, level, tr_opt, optval, optlen);
1194 return ret;
1195}
1196
1197asmlinkage int sunos_getsockopt(int fd, int level, int optname,
1198 char __user *optval, int __user *optlen)
1199{
1200 int tr_opt = optname;
1201 int ret;
1202
1203 if (level == SOL_IP) {
1204 /* Multicast socketopts (ttl, membership) */
1205 if (tr_opt >=2 && tr_opt <= 6)
1206 tr_opt += 30;
1207 }
1208 ret = sys_getsockopt(fd, level, tr_opt, optval, optlen);
1209 return ret;
1210}
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index 9064485dc40b..5a7c4c8345c3 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -81,124 +81,3 @@ sys_call_table:
81/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait 81/*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait
82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate 82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime 83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime
84
85#ifdef CONFIG_SUNOS_EMUL
86 /* Now the SunOS syscall table. */
87
88 .align 4
89 .globl sunos_sys_table
90sunos_sys_table:
91/*0*/ .long sunos_indir, sys_exit, sys_fork
92 .long sunos_read, sunos_write, sys_open
93 .long sys_close, sunos_wait4, sys_creat
94 .long sys_link, sys_unlink, sunos_execv
95 .long sys_chdir, sunos_nosys, sys_mknod
96 .long sys_chmod, sys_lchown16, sunos_brk
97 .long sunos_nosys, sys_lseek, sunos_getpid
98 .long sunos_nosys, sunos_nosys, sunos_nosys
99 .long sunos_getuid, sunos_nosys, sys_ptrace
100 .long sunos_nosys, sunos_nosys, sunos_nosys
101 .long sunos_nosys, sunos_nosys, sunos_nosys
102 .long sys_access, sunos_nosys, sunos_nosys
103 .long sys_sync, sys_kill, sys_newstat
104 .long sunos_nosys, sys_newlstat, sys_dup
105 .long sys_pipe, sunos_nosys, sunos_nosys
106 .long sunos_nosys, sunos_nosys, sunos_getgid
107 .long sunos_nosys, sunos_nosys
108/*50*/ .long sunos_nosys, sys_acct, sunos_nosys
109 .long sunos_mctl, sunos_ioctl, sys_reboot
110 .long sunos_nosys, sys_symlink, sys_readlink
111 .long sys_execve, sys_umask, sys_chroot
112 .long sys_newfstat, sunos_nosys, sys_getpagesize
113 .long sys_msync, sys_vfork, sunos_nosys
114 .long sunos_nosys, sunos_sbrk, sunos_sstk
115 .long sunos_mmap, sunos_vadvise, sys_munmap
116 .long sys_mprotect, sys_madvise, sys_vhangup
117 .long sunos_nosys, sys_mincore, sys_getgroups16
118 .long sys_setgroups16, sys_getpgrp, sunos_setpgrp
119 .long sys_setitimer, sunos_nosys, sys_swapon
120 .long sys_getitimer, sys_gethostname, sys_sethostname
121 .long sunos_getdtablesize, sys_dup2, sunos_nop
122 .long sys_fcntl, sunos_select, sunos_nop
123 .long sys_fsync, sys_setpriority, sys_socket
124 .long sys_connect, sunos_accept
125/*100*/ .long sys_getpriority, sunos_send, sunos_recv
126 .long sunos_nosys, sys_bind, sunos_setsockopt
127 .long sys_listen, sunos_nosys, sunos_sigaction
128 .long sunos_sigblock, sunos_sigsetmask, sys_sigpause
129 .long sys_sigstack, sys_recvmsg, sys_sendmsg
130 .long sunos_nosys, sys_gettimeofday, sys_getrusage
131 .long sunos_getsockopt, sunos_nosys, sunos_readv
132 .long sunos_writev, sys_settimeofday, sys_fchown16
133 .long sys_fchmod, sys_recvfrom, sys_setreuid16
134 .long sys_setregid16, sys_rename, sys_truncate
135 .long sys_ftruncate, sys_flock, sunos_nosys
136 .long sys_sendto, sys_shutdown, sys_socketpair
137 .long sys_mkdir, sys_rmdir, sys_utimes
138 .long sys_sigreturn, sunos_nosys, sys_getpeername
139 .long sunos_gethostid, sunos_nosys, sys_getrlimit
140 .long sys_setrlimit, sunos_killpg, sunos_nosys
141 .long sunos_nosys, sunos_nosys
142/*150*/ .long sys_getsockname, sunos_nosys, sunos_nosys
143 .long sys_poll, sunos_nosys, sunos_nosys
144 .long sunos_getdirentries, sys_statfs, sys_fstatfs
145 .long sys_oldumount, sunos_nosys, sunos_nosys
146 .long sys_getdomainname, sys_setdomainname
147 .long sunos_nosys, sys_quotactl, sunos_nosys
148 .long sunos_mount, sys_ustat, sunos_semsys
149 .long sunos_msgsys, sunos_shmsys, sunos_audit
150 .long sunos_nosys, sunos_getdents, sys_setsid
151 .long sys_fchdir, sunos_nosys, sunos_nosys
152 .long sunos_nosys, sunos_nosys, sunos_nosys
153 .long sunos_nosys, sys_sigpending, sunos_nosys
154 .long sys_setpgid, sunos_pathconf, sunos_fpathconf
155 .long sunos_sysconf, sunos_uname, sunos_nosys
156 .long sunos_nosys, sunos_nosys, sunos_nosys
157 .long sunos_nosys, sunos_nosys, sunos_nosys
158 .long sunos_nosys, sunos_nosys, sunos_nosys
159/*200*/ .long sunos_nosys, sunos_nosys, sunos_nosys
160 .long sunos_nosys, sunos_nosys, sunos_nosys
161 .long sunos_nosys, sunos_nosys, sunos_nosys
162 .long sunos_nosys, sunos_nosys, sunos_nosys
163 .long sunos_nosys, sunos_nosys, sunos_nosys
164 .long sunos_nosys, sunos_nosys, sunos_nosys
165 .long sunos_nosys, sunos_nosys, sunos_nosys
166 .long sunos_nosys, sunos_nosys, sunos_nosys
167 .long sunos_nosys, sunos_nosys, sunos_nosys
168 .long sunos_nosys, sunos_nosys, sunos_nosys
169 .long sunos_nosys, sunos_nosys, sunos_nosys
170 .long sunos_nosys, sunos_nosys, sunos_nosys
171 .long sunos_nosys, sunos_nosys, sunos_nosys
172 .long sunos_nosys, sunos_nosys, sunos_nosys
173 .long sunos_nosys, sunos_nosys, sunos_nosys
174 .long sunos_nosys, sunos_nosys, sunos_nosys
175 .long sunos_nosys, sunos_nosys
176/*250*/ .long sunos_nosys, sunos_nosys, sunos_nosys
177 .long sunos_nosys, sunos_nosys, sunos_nosys
178 .long sunos_nosys, sunos_nosys, sunos_nosys
179 .long sunos_nosys
180/*260*/ .long sunos_nosys, sunos_nosys, sunos_nosys
181 .long sunos_nosys, sunos_nosys, sunos_nosys
182 .long sunos_nosys, sunos_nosys, sunos_nosys
183 .long sunos_nosys
184/*270*/ .long sunos_nosys, sunos_nosys, sunos_nosys
185 .long sunos_nosys, sunos_nosys, sunos_nosys
186 .long sunos_nosys, sunos_nosys, sunos_nosys
187 .long sunos_nosys
188/*280*/ .long sunos_nosys, sunos_nosys, sunos_nosys
189 .long sunos_nosys, sunos_nosys, sunos_nosys
190 .long sunos_nosys, sunos_nosys, sunos_nosys
191 .long sunos_nosys
192/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys
193 .long sunos_nosys, sunos_nosys, sunos_nosys
194 .long sunos_nosys, sunos_nosys, sunos_nosys
195 .long sunos_nosys
196/*300*/ .long sunos_nosys, sunos_nosys, sunos_nosys
197 .long sunos_nosys, sunos_nosys, sunos_nosys
198 .long sunos_nosys, sunos_nosys, sunos_nosys
199 .long sunos_nosys
200/*310*/ .long sunos_nosys, sunos_nosys, sunos_nosys
201 .long sunos_nosys, sunos_nosys, sunos_nosys
202 .long sunos_nosys
203
204#endif