diff options
author | edp <none@none> | 2007-04-27 14:21:30 -0700 |
---|---|---|
committer | edp <none@none> | 2007-04-27 14:21:30 -0700 |
commit | 4a75c0c1ad1b9f32a7a423e1f23a8d23ac800de0 (patch) | |
tree | 4c4ae72248bbecce94bce5f283480c6e91e7a8d9 /usr/src | |
parent | a399b7655a1d835aa8606c2b29e4e777baac8635 (diff) | |
download | illumos-gate-4a75c0c1ad1b9f32a7a423e1f23a8d23ac800de0.tar.gz |
6539878 sparc brandz syscall wrappers don't collect trapstat data
6539890 sparc brandz syscall wrappers don't support sun4v
6540634 sparc sn1 brand fail on platforms where NCPU > 31
--HG--
rename : usr/src/uts/sun4u/brand/sn1/sn1_brand_asm.s => usr/src/uts/sun4/brand/sn1/sn1_brand_asm.s
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/Makefile.psm | 4 | ||||
-rw-r--r-- | usr/src/Makefile.psm.targ | 3 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWsn1rint/prototype_sparc | 17 | ||||
-rw-r--r-- | usr/src/tools/scripts/bfu.sh | 6 | ||||
-rw-r--r-- | usr/src/uts/Makefile.uts | 5 | ||||
-rw-r--r-- | usr/src/uts/intel/Makefile.intel.shared | 2 | ||||
-rw-r--r-- | usr/src/uts/sun4/brand/sn1/sn1_brand_asm.s (renamed from usr/src/uts/sun4u/brand/sn1/sn1_brand_asm.s) | 82 | ||||
-rw-r--r-- | usr/src/uts/sun4/ml/offsets.in | 2 | ||||
-rw-r--r-- | usr/src/uts/sun4u/Makefile.rules | 6 | ||||
-rw-r--r-- | usr/src/uts/sun4u/Makefile.sun4u.shared | 2 | ||||
-rw-r--r-- | usr/src/uts/sun4u/ml/trap_table.s | 67 | ||||
-rw-r--r-- | usr/src/uts/sun4u/sn1_brand/Makefile | 4 | ||||
-rw-r--r-- | usr/src/uts/sun4u/sys/machcpuvar.h | 2 | ||||
-rw-r--r-- | usr/src/uts/sun4v/Makefile.files | 5 | ||||
-rw-r--r-- | usr/src/uts/sun4v/Makefile.rules | 6 | ||||
-rw-r--r-- | usr/src/uts/sun4v/Makefile.sun4v.shared | 31 | ||||
-rw-r--r-- | usr/src/uts/sun4v/ml/trap_table.s | 78 | ||||
-rw-r--r-- | usr/src/uts/sun4v/sn1_brand/Makefile | 83 | ||||
-rw-r--r-- | usr/src/uts/sun4v/sys/machcpuvar.h | 2 |
19 files changed, 331 insertions, 76 deletions
diff --git a/usr/src/Makefile.psm b/usr/src/Makefile.psm index dfcb70c8eb..4ade958609 100644 --- a/usr/src/Makefile.psm +++ b/usr/src/Makefile.psm @@ -66,6 +66,7 @@ ROOT_PSM_MMU_DIR_32 = $(ROOT_PSM_MOD_DIR)/mmu ROOT_PSM_DACF_DIR_32 = $(ROOT_PSM_MOD_DIR)/dacf ROOT_PSM_CRYPTO_DIR_32 = $(ROOT_PSM_MOD_DIR)/crypto ROOT_PSM_PCBE_DIR_32 = $(ROOT_PSM_MOD_DIR)/pcbe +ROOT_PSM_BRAND_DIR_32 = $(ROOT_PSM_MOD_DIR)/brand ROOT_PSM_KERN_DIR_64 = $(ROOT_PSM_MOD_DIR)/$(SUBDIR64) ROOT_PSM_DRV_DIR_64 = $(ROOT_PSM_MOD_DIR)/drv/$(SUBDIR64) @@ -84,6 +85,7 @@ ROOT_PSM_MMU_DIR_64 = $(ROOT_PSM_MOD_DIR)/mmu/$(SUBDIR64) ROOT_PSM_DACF_DIR_64 = $(ROOT_PSM_MOD_DIR)/dacf/$(SUBDIR64) ROOT_PSM_CRYPTO_DIR_64 = $(ROOT_PSM_MOD_DIR)/crypto/$(SUBDIR64) ROOT_PSM_PCBE_DIR_64 = $(ROOT_PSM_MOD_DIR)/pcbe/$(SUBDIR64) +ROOT_PSM_BRAND_DIR_64 = $(ROOT_PSM_MOD_DIR)/brand/$(SUBDIR64) ROOT_PSM_KERN_DIR = $(ROOT_PSM_KERN_DIR_$(CLASS)) ROOT_PSM_DRV_DIR = $(ROOT_PSM_DRV_DIR_$(CLASS)) @@ -102,6 +104,7 @@ ROOT_PSM_MMU_DIR = $(ROOT_PSM_MMU_DIR_$(CLASS)) ROOT_PSM_DACF_DIR = $(ROOT_PSM_DACF_DIR_$(CLASS)) ROOT_PSM_CRYPTO_DIR = $(ROOT_PSM_CRYPTO_DIR_$(CLASS)) ROOT_PSM_PCBE_DIR = $(ROOT_PSM_PCBE_DIR_$(CLASS)) +ROOT_PSM_BRAND_DIR = $(ROOT_PSM_BRAND_DIR_$(CLASS)) ROOT_PSM_MOD_DIRS_32 = $(ROOT_PSM_DRV_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_EXEC_DIR_32) $(ROOT_PSM_FS_DIR_32) @@ -114,6 +117,7 @@ ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_MMU_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_DACF_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_CRYPTO_DIR_32) ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_PCBE_DIR_32) +ROOT_PSM_MOD_DIRS_32 += $(ROOT_PSM_BRAND_DIR_32) USR_PLAT_DIR = $(ROOT)/usr/platform diff --git a/usr/src/Makefile.psm.targ b/usr/src/Makefile.psm.targ index fce4f698e0..4570a118dc 100644 --- a/usr/src/Makefile.psm.targ +++ b/usr/src/Makefile.psm.targ @@ -111,6 +111,9 @@ $(ROOT_PSM_CRYPTO_DIR)/%: $(OBJS_DIR)/% $(ROOT_PSM_CRYPTO_DIR) FRC $(ROOT_PSM_PCBE_DIR)/%: $(OBJS_DIR)/% $(ROOT_PSM_PCBE_DIR) FRC $(INS.file) +$(ROOT_PSM_BRAND_DIR)/%: $(OBJS_DIR)/% $(ROOT_PSM_BRAND_DIR) FRC + $(INS.file) + # # # diff --git a/usr/src/pkgdefs/SUNWsn1rint/prototype_sparc b/usr/src/pkgdefs/SUNWsn1rint/prototype_sparc index 3c8fd04ce9..51a618240e 100644 --- a/usr/src/pkgdefs/SUNWsn1rint/prototype_sparc +++ b/usr/src/pkgdefs/SUNWsn1rint/prototype_sparc @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -33,7 +33,14 @@ !include prototype_com # the kernel brand module -d none kernel 0755 root sys -d none kernel/brand 0755 root sys -d none kernel/brand/sparcv9 0755 root sys -f none kernel/brand/sparcv9/sn1_brand 0755 root sys +d none platform 0755 root sys +d none platform/sun4u 0755 root sys +d none platform/sun4u/kernel 0755 root sys +d none platform/sun4u/kernel/brand 0755 root sys +d none platform/sun4u/kernel/brand/sparcv9 0755 root sys +f none platform/sun4u/kernel/brand/sparcv9/sn1_brand 0755 root sys +d none platform/sun4v 0755 root sys +d none platform/sun4v/kernel 0755 root sys +d none platform/sun4v/kernel/brand 0755 root sys +d none platform/sun4v/kernel/brand/sparcv9 0755 root sys +f none platform/sun4v/kernel/brand/sparcv9/sn1_brand 0755 root sys diff --git a/usr/src/tools/scripts/bfu.sh b/usr/src/tools/scripts/bfu.sh index f44cd08721..b784770b10 100644 --- a/usr/src/tools/scripts/bfu.sh +++ b/usr/src/tools/scripts/bfu.sh @@ -6702,6 +6702,12 @@ mondo_loop() { rm -f $root/dev/cfg/*pci* # + # remove the architecture-specific sn1_brand module since it's being + # replaced with platform-specific modules. + # + rm -f $root/kernel/brand/sparcv9/sn1_brand + + # # Remove I2O. # rm -f $root/kernel/drv/i2o_bs diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts index 9ee15055c9..ef356bad11 100644 --- a/usr/src/uts/Makefile.uts +++ b/usr/src/uts/Makefile.uts @@ -581,7 +581,7 @@ PARALLEL_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \ $(MMU_KMODS) $(DACF_KMODS) $(EXPORT_KMODS) $(IPP_KMODS) \ $(CRYPTO_KMODS) $(CRYPTO_EK_KMODS) $(PCBE_KMODS) \ $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \ - $(DEVNAME_KMODS) + $(DEVNAME_KMODS) $(BRAND_KMODS) KMODS = $(GENUNIX_KMODS) $(PARALLEL_KMODS) @@ -595,7 +595,8 @@ LINT_KMODS = $(DRV_KMODS) $(EXEC_KMODS) $(FS_KMODS) $(SCHED_KMODS) \ $(TOD_KMODS) $(STRMOD_KMODS) $(SYS_KMODS) $(MISC_KMODS) \ $(MACH_KMODS) $(GSS_KMODS) $(DACF_KMODS) $(IPP_KMODS) \ $(CRYPTO_KMODS) $(PCBE_KMODS) $(DEVNAME_KMODS) \ - $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) + $(DRV_KMODS_$(CLASS)) $(MISC_KMODS_$(CLASS)) $(MAC_KMODS) \ + $(BRAND_KMODS) $(CLOSED_BUILD)CLOSED_LINT_KMODS = $(CLOSED_DRV_KMODS) $(CLOSED_TOD_KMODS) \ $(CLOSED_MISC_KMODS) $(CLOSED_DRV_KMODS_$(CLASS)) diff --git a/usr/src/uts/intel/Makefile.intel.shared b/usr/src/uts/intel/Makefile.intel.shared index f3c5f47b7a..3c507ac6c0 100644 --- a/usr/src/uts/intel/Makefile.intel.shared +++ b/usr/src/uts/intel/Makefile.intel.shared @@ -430,7 +430,7 @@ MISC_KMODS += md_sp # # Brand modules # -MISC_KMODS += sn1_brand lx_brand +BRAND_KMODS += sn1_brand lx_brand DRV_KMODS += lx_systrace lx_ptm lx_audio STRMOD_KMODS += ldlinux diff --git a/usr/src/uts/sun4u/brand/sn1/sn1_brand_asm.s b/usr/src/uts/sun4/brand/sn1/sn1_brand_asm.s index d699c8dda8..2a8c8b92e0 100644 --- a/usr/src/uts/sun4u/brand/sn1/sn1_brand_asm.s +++ b/usr/src/uts/sun4/brand/sn1/sn1_brand_asm.s @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,32 +47,69 @@ sn1_brand_syscall_callback(void) #else /* lint */ +#ifdef sun4v + +#define GLOBALS_SWAP(reg) \ + rdpr %gl, reg ;\ + wrpr reg, 1, %gl + +#define GLOBALS_RESTORE(reg) \ + wrpr reg, 0, %gl + +#else /* !sun4v */ + +#define GLOBALS_SWAP(reg) \ + rdpr %pstate, reg ;\ + wrpr reg, PSTATE_AG, %pstate + +#define GLOBALS_RESTORE(reg) \ + wrpr reg, %g0, %pstate + +#endif /* !sun4v */ + + /* + * Input parameters: + * %g1: return point + * %g2: pointer to our cpu structure + */ ENTRY(sn1_brand_syscall_callback) /* * save some locals in the CPU tmp area to give us a little * room to work. */ - CPU_ADDR(%g2, %g3) ! load CPU struct addr to %g2 using %g3 stn %l0, [%g2 + CPU_TMP1] stn %l1, [%g2 + CPU_TMP2] +#ifdef sun4v + /* + * On sun4v save our input parameters (which are stored in the + * alternate globals) since we'll need to switch between alternate + * globals and normal globals, and on sun4v the alternate globals + * are not preserved across these types of switches. + */ + stn %l2, [%g2 + CPU_TMP3] + stn %l3, [%g2 + CPU_TMP4] + mov %g1, %l2 + mov %g2, %l3 +#endif /* sun4v */ + /* * Switch from the alternate to user globals to grab the syscall * number, then switch back to the alternate globals. - * + * * If the system call number is >= 1024, then it is coming from the * emulation support library and should not be emulated. */ - rdpr %pstate, %l0 - wrpr %l0, PSTATE_AG, %pstate ! switch to normal globals + GLOBALS_SWAP(%l0) ! switch to normal globals cmp %g1, 1024 ! is this call from the library? bl,a 1f mov %g1, %l1 ! delay slot - grab syscall number sub %g1, 1024, %g1 ! convert magic num to real syscall ba 2f ! jump back into syscall path 1: - wrpr %l0, %g0, %pstate ! switch back to alternate globals + GLOBALS_RESTORE(%l0) ! delay slot - + ! switch back to alternate globals /* * Check to see if we want to interpose on this system call. If @@ -90,6 +127,10 @@ sn1_brand_syscall_callback(void) * Find the address of the userspace handler. * cpu->cpu_thread->t_procp->p_brandhdlr. */ +#ifdef sun4v + ! restore the alternate global registers after incrementing %gl + mov %l3, %g2 +#endif /* sun4v */ ldn [%g2 + CPU_THREAD], %g3 ! load thread pointer ldn [%g3 + T_PROCP], %g3 ! get proc pointer ldn [%g3 + P_BRAND_DATA], %g3 ! get brand handler @@ -108,18 +149,37 @@ sn1_brand_syscall_callback(void) */ rdpr %tnpc, %l1 ! save old tnpc wrpr %g0, %g3, %tnpc ! setup tnpc - rdpr %pstate, %l0 - wrpr %l0, PSTATE_AG, %pstate ! switch to normal globals + GLOBALS_SWAP(%l0) ! switch to normal globals mov %l1, %g6 ! pass tnpc to user code in %g6 - wrpr %l0, %g0, %pstate ! switch back to alternate globals + GLOBALS_RESTORE(%l0) ! switch back to alternate globals + + /* Update the address we're going to return to */ +#ifdef sun4v + set fast_trap_done_chk_intr, %l2 +#else /* !sun4v */ set fast_trap_done_chk_intr, %g1 +#endif /* !sun4v */ 2: - ! Note that %g2 still contains CPU struct addr + /* + * Restore registers before returning. + * + * Note that %g2 should be loaded with the CPU struct addr and + * %g1 should be loaded the address we're going to return to. + */ +#ifdef sun4v + ! restore the alternate global registers after incrementing %gl + mov %l3, %g2 + mov %l2, %g1 + + ldn [%g2 + CPU_TMP4], %l3 ! restore locals + ldn [%g2 + CPU_TMP3], %l2 +#endif /* sun4v */ + ldn [%g2 + CPU_TMP2], %l1 ! restore locals ldn [%g2 + CPU_TMP1], %l0 + jmp %g1 nop SET_SIZE(sn1_brand_syscall_callback) #endif /* lint */ - diff --git a/usr/src/uts/sun4/ml/offsets.in b/usr/src/uts/sun4/ml/offsets.in index ab35ef4bd0..eb8c2ca9b4 100644 --- a/usr/src/uts/sun4/ml/offsets.in +++ b/usr/src/uts/sun4/ml/offsets.in @@ -373,6 +373,8 @@ cpu CPUSIZE cpu_m.intrcnt CPU_INTRCNT cpu_m.tmp1 CPU_TMP1 cpu_m.tmp2 CPU_TMP2 + cpu_m.tmp3 CPU_TMP3 + cpu_m.tmp4 CPU_TMP4 cpu_m.ofd CPU_OFD cpu_m.lfd CPU_LFD cpu_m.otd CPU_OTD diff --git a/usr/src/uts/sun4u/Makefile.rules b/usr/src/uts/sun4u/Makefile.rules index 6779f9e734..3bffe56e51 100644 --- a/usr/src/uts/sun4u/Makefile.rules +++ b/usr/src/uts/sun4u/Makefile.rules @@ -20,7 +20,7 @@ # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -113,7 +113,7 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/sun4u/pcbe/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) -$(OBJS_DIR)/%.o: $(UTSBASE)/sun4u/brand/sn1/%.s +$(OBJS_DIR)/%.o: $(UTSBASE)/sun4/brand/sn1/%.s $(COMPILE.s) -o $@ $< $(OBJS_DIR)/%.o: $(UTSBASE)/sun4u/vm/%.c @@ -242,7 +242,7 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/os/%.c $(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/pcbe/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL)) -$(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/brand/sn1/%.s +$(LINTS_DIR)/%.ln: $(UTSBASE)/sun4/brand/sn1/%.s @($(LHEAD) $(LINT.s) $< $(LTAIL)) $(LINTS_DIR)/%.ln: $(UTSBASE)/sun4u/vm/%.c diff --git a/usr/src/uts/sun4u/Makefile.sun4u.shared b/usr/src/uts/sun4u/Makefile.sun4u.shared index 2b7e0beaff..c77a378664 100644 --- a/usr/src/uts/sun4u/Makefile.sun4u.shared +++ b/usr/src/uts/sun4u/Makefile.sun4u.shared @@ -452,7 +452,7 @@ MISC_KMODS += zuluvm # # Brand modules # -MISC_KMODS += sn1_brand +BRAND_KMODS += sn1_brand $(CLOSED_BUILD)CLOSED_MISC_KMODS += gptwo_cpu gptwocfg diff --git a/usr/src/uts/sun4u/ml/trap_table.s b/usr/src/uts/sun4u/ml/trap_table.s index d92ceed8a8..8972d229ee 100644 --- a/usr/src/uts/sun4u/ml/trap_table.s +++ b/usr/src/uts/sun4u/ml/trap_table.s @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -183,6 +183,9 @@ */ #define SYSCALL(which) \ TT_TRACE(trace_gen) ;\ + SYSCALL_NOTT(which) + +#define SYSCALL_NOTT(which) \ set (which), %g1 ;\ ba,pt %xcc, sys_trap ;\ sub %g0, 1, %g4 ;\ @@ -628,7 +631,7 @@ * FILL_64bit_asi fills a 64-bit-wide register window from a 64-bit * wide address space via the designated asi. It is used to fill * non-kernel windows. The stack pointer is required to be eight-byte - * aligned. + * aligned. */ #define FILL_64bit_asi(asi_num, tail) \ mov V9BIAS64 + 0, %g1 ;\ @@ -1441,11 +1444,11 @@ trap_table0: BAD; /* 105 range check ?? */ GOTO(.fix_alignment); /* 106 do unaligned references */ BAD; /* 107 unused */ -#ifdef DEBUG - GOTO(syscall_wrapper32) /* 108 ILP32 system call on LP64 */ -#else - SYSCALL(syscall_trap32) /* 108 ILP32 system call on LP64 */ -#endif +#ifndef DEBUG + SYSCALL(syscall_trap32); /* 108 ILP32 system call on LP64 */ +#else /* DEBUG */ + GOTO(syscall_wrapper32); /* 108 ILP32 system call on LP64 */ +#endif /* DEBUG */ GOTO(set_trap0_addr); /* 109 set trap0 address */ BAD; BAD; BAD4; /* 10A - 10F unused */ TRP4; TRP4; TRP4; TRP4; /* 110 - 11F V9 user trap handlers */ @@ -1465,11 +1468,11 @@ trap_table0: BAD; /* 139 unused */ DTRACE_RETURN; /* 13A dtrace pid return probe */ BAD; BAD4; /* 13B - 13F unused */ -#ifdef DEBUG - GOTO(syscall_wrapper) /* 140 LP64 system call */ -#else - SYSCALL(syscall_trap) /* 140 LP64 system call */ -#endif +#ifndef DEBUG + SYSCALL(syscall_trap); /* 140 LP64 system call */ +#else /* DEBUG */ + GOTO(syscall_wrapper); /* 140 LP64 system call */ +#endif /* DEBUG */ SYSCALL(nosys); /* 141 unused system call trap */ #ifdef DEBUG_USER_TRAPTRACECTL GOTO(.traptrace_freeze); /* 142 freeze traptrace */ @@ -1667,7 +1670,7 @@ etrap_table: set dtlb_parity_trap, %g4 cmp %g1, T_DATA_EXCEPTION ! to a IMMU exception be 3f ! or DMMU exception. - nop + nop 2: sllx %g3, 32, %g3 or %g3, %g1, %g3 @@ -1791,7 +1794,7 @@ etrap_table: brz,pt %g5, 3f ! if p_utraps == NULL goto trap() rdpr %tt, %g3 ! delay - get actual hw trap type - + sub %g3, 254, %g1 ! UT_TRAP_INSTRUCTION_16 = p_utraps[18] ba,pt %icc, 2f smul %g1, CPTRSIZE, %g2 @@ -1805,7 +1808,7 @@ etrap_table: mov 1, %g1 st %g1, [%g4 + CPU_TL1_HDLR] ! set CPU_TL1_HDLR - rdpr %tpc, %g1 ! ld trapping instruction using + rdpr %tpc, %g1 ! ld trapping instruction using lduwa [%g1]ASI_AIUP, %g1 ! "AS IF USER" ASI which could fault st %g0, [%g4 + CPU_TL1_HDLR] ! clr CPU_TL1_HDLR @@ -1813,7 +1816,7 @@ etrap_table: andcc %g1, %g4, %g4 ! and instruction with mask bnz,a,pt %icc, 3f ! if %g4 == zero, %g1 is an ILLTRAP nop ! fall thru to setup -2: +2: ldn [%g5 + %g2], %g5 brnz,a,pt %g5, .setup_v9utrap nop @@ -1920,7 +1923,7 @@ etrap_table: srl %g2, FSR_FTT_SHIFT, %g7 ! extract ftt from %fsr and %g7, (FSR_FTT>>FSR_FTT_SHIFT), %g7 cmp %g7, FTT_UNFIN - set FSR_TEM_NX, %g5 + set FSR_TEM_NX, %g5 bne,pn %xcc, .fp_exception_cont ! branch if NOT unfinished_FPop andcc %g2, %g5, %g0 bne,pn %xcc, .fp_exception_cont ! branch if FSR_TEM_NX enabled @@ -2055,7 +2058,7 @@ _fitos_fdtos_done: ldx [%g7], %g5 1: add %g5, 1, %g6 - + casxa [%g7] ASI_N, %g5, %g6 cmp %g5, %g6 bne,a,pn %xcc, 1b @@ -3018,35 +3021,41 @@ fast_trap_dummy_call: * systems. */ #define BRAND_CALLBACK(callback_id) \ - CPU_ADDR(%g1, %g2) /* load CPU struct addr to %g1 */ ;\ - ldn [%g1 + CPU_THREAD], %g2 /* load thread pointer */ ;\ - ldn [%g2 + T_PROCP], %g2 /* get proc pointer */ ;\ - ldn [%g2 + P_BRAND], %g2 /* get brand pointer */ ;\ - brz %g2, 1f /* No brand? No callback. */ ;\ + CPU_ADDR(%g2, %g1) /* load CPU struct addr to %g2 */ ;\ + ldn [%g2 + CPU_THREAD], %g3 /* load thread pointer */ ;\ + ldn [%g3 + T_PROCP], %g3 /* get proc pointer */ ;\ + ldn [%g3 + P_BRAND], %g3 /* get brand pointer */ ;\ + brz %g3, 1f /* No brand? No callback. */ ;\ nop ;\ - ldn [%g2 + B_MACHOPS], %g2 /* get machops list */ ;\ - ldn [%g2 + (callback_id << 3)], %g2 ;\ - brz %g2, 1f ;\ + ldn [%g3 + B_MACHOPS], %g3 /* get machops list */ ;\ + ldn [%g3 + (callback_id << 3)], %g3 ;\ + brz %g3, 1f ;\ /* \ * This isn't pretty. We want a low-latency way for the callback \ * routine to decline to do anything. We just pass in an address \ * the routine can directly jmp back to, pretending that nothing \ * has happened. \ + * \ + * %g1: return address (where the brand handler jumps back to) \ + * %g2: address of CPU structure \ + * %g3: address of brand handler (where we will jump to) \ */ \ mov %pc, %g1 ;\ add %g1, 16, %g1 ;\ - jmp %g2 ;\ + jmp %g3 ;\ nop ;\ 1: ENTRY_NP(syscall_wrapper32) + TT_TRACE(trace_gen) BRAND_CALLBACK(BRAND_CB_SYSCALL32) - SYSCALL(syscall_trap32) + SYSCALL_NOTT(syscall_trap32) SET_SIZE(syscall_wrapper32) ENTRY_NP(syscall_wrapper) + TT_TRACE(trace_gen) BRAND_CALLBACK(BRAND_CB_SYSCALL) - SYSCALL(syscall_trap) + SYSCALL_NOTT(syscall_trap) SET_SIZE(syscall_wrapper) #endif /* DEBUG */ diff --git a/usr/src/uts/sun4u/sn1_brand/Makefile b/usr/src/uts/sun4u/sn1_brand/Makefile index 188dec81ff..3531a5eacf 100644 --- a/usr/src/uts/sun4u/sn1_brand/Makefile +++ b/usr/src/uts/sun4u/sn1_brand/Makefile @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -39,7 +39,7 @@ UTSBASE = ../.. MODULE = sn1_brand OBJECTS = $(SN1_BRAND_OBJS:%=$(OBJS_DIR)/%) LINTS = $(SN1_BRAND_OBJS:%.o=$(LINTS_DIR)/%.ln) -ROOTMODULE = $(ROOT_BRAND_DIR)/$(MODULE) +ROOTMODULE = $(ROOT_PSM_BRAND_DIR)/$(MODULE) # # Include common rules. diff --git a/usr/src/uts/sun4u/sys/machcpuvar.h b/usr/src/uts/sun4u/sys/machcpuvar.h index ded3e20600..7551c4b477 100644 --- a/usr/src/uts/sun4u/sys/machcpuvar.h +++ b/usr/src/uts/sun4u/sys/machcpuvar.h @@ -104,6 +104,8 @@ struct machcpu { uint8_t intrcnt; /* number of back-to-back interrupts */ u_longlong_t tmp1; /* per-cpu tmps */ u_longlong_t tmp2; /* used in trap processing */ + u_longlong_t tmp3; + u_longlong_t tmp4; label_t *ofd[HIGH_LEVELS]; /* saved pil ofd */ uintptr_t lfd[HIGH_LEVELS]; /* saved ret PC */ diff --git a/usr/src/uts/sun4v/Makefile.files b/usr/src/uts/sun4v/Makefile.files index 8c04b8010a..8a6de56271 100644 --- a/usr/src/uts/sun4v/Makefile.files +++ b/usr/src/uts/sun4v/Makefile.files @@ -161,6 +161,11 @@ OBPSYM_OBJS += obpsym.o obpsym_1275.o PLATSVC_OBJS = platsvc.o mdeg.o # +# Brand modules +# +SN1_BRAND_OBJS = sn1_brand.o sn1_brand_asm.o + +# # Performance Counter BackEnd (PCBE) Modules # NI_PCBE_OBJS = niagara_pcbe.o diff --git a/usr/src/uts/sun4v/Makefile.rules b/usr/src/uts/sun4v/Makefile.rules index 691d537382..1f542f30b1 100644 --- a/usr/src/uts/sun4v/Makefile.rules +++ b/usr/src/uts/sun4v/Makefile.rules @@ -62,6 +62,9 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/sun4v/pcbe/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) +$(OBJS_DIR)/%.o: $(UTSBASE)/sun4/brand/sn1/%.s + $(COMPILE.s) -o $@ $< + $(OBJS_DIR)/%.o: $(UTSBASE)/sun4v/promif/%.c $(COMPILE.c) -o $@ $< $(CTFCONVERT_O) @@ -187,6 +190,9 @@ $(LINTS_DIR)/%.ln: $(UTSBASE)/sun4v/os/%.c $(LINTS_DIR)/%.ln: $(UTSBASE)/sun4v/pcbe/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL)) +$(LINTS_DIR)/%.ln: $(UTSBASE)/sun4/brand/sn1/%.s + @($(LHEAD) $(LINT.s) $< $(LTAIL)) + $(LINTS_DIR)/%.ln: $(UTSBASE)/sun4v/promif/%.c @($(LHEAD) $(LINT.c) $< $(LTAIL)) diff --git a/usr/src/uts/sun4v/Makefile.sun4v.shared b/usr/src/uts/sun4v/Makefile.sun4v.shared index 8b067938a9..35db48e4a0 100644 --- a/usr/src/uts/sun4v/Makefile.sun4v.shared +++ b/usr/src/uts/sun4v/Makefile.sun4v.shared @@ -72,7 +72,7 @@ UNAME_M = $(PLATFORM) # This list should be empty. A platform without platform modules # is a plain, generic sun4v platform. # -#IMPLEMENTED_PLATFORM = +#IMPLEMENTED_PLATFORM = #PLATFORMS = $(IMPLEMENTED_PLATFORM) IMPLEMENTATIONS = ontario montoya @@ -100,7 +100,7 @@ MODSTUBS_DIR = $(UNIX_DIR) DSF_DIR = $(UTSBASE)/$(PLATFORM)/genassym LINTS_DIR = $(OBJS_DIR) LINT_LIB_DIR = $(UTSBASE)/$(PLATFORM)/lint-libs/$(OBJS_DIR) - + DTRACESTUBS_O = $(OBJS_DIR)/dtracestubs.o DTRACESTUBS = $(OBJS_DIR)/libdtracestubs.so @@ -239,7 +239,7 @@ DEBUG_DEFS_DBG64 = -DDEBUG DEBUG_DEFS = $(DEBUG_DEFS_$(BUILD_TYPE)) DEBUG_COND_OBJ64 :sh = echo \\043 -DEBUG_COND_DBG64 = +DEBUG_COND_DBG64 = IF_DEBUG_OBJ = $(DEBUG_COND_$(BUILD_TYPE))$(OBJS_DIR)/ $(IF_DEBUG_OBJ)trap.o := DEBUG_DEFS += -DTRAPDEBUG @@ -275,7 +275,7 @@ $(IF_TRAPTRACE_OBJ)x_call.o := DEBUG_DEFS += -DTRAPTRACE #$(IF_DEBUG_OBJ)lock_prim.o := DEBUG_DEFS += -DDISP_LOCK_STATS #$(IF_DEBUG_OBJ)disp.o := DEBUG_DEFS += -DDISP_LOCK_STATS -# Comment these out if you don't want dispatcher debugging +# Comment these out if you don't want dispatcher debugging #$(IF_DEBUG_OBJ)lock_prim.o := DEBUG_DEFS += -DDISP_DEBUG @@ -341,7 +341,7 @@ DRV_KMODS += qcn DRV_KMODS += rootnex DRV_KMODS += su DRV_KMODS += trapstat -DRV_KMODS += vcc +DRV_KMODS += vcc DRV_KMODS += vdc DRV_KMODS += vds DRV_KMODS += vldc @@ -382,21 +382,26 @@ SYS_KMODS += # # 'User' Modules (/kernel/misc): # -MISC_KMODS += bootdev -MISC_KMODS += dr_cpu +MISC_KMODS += bootdev +MISC_KMODS += dr_cpu MISC_KMODS += ds MISC_KMODS += fault_iso -MISC_KMODS += ldc -MISC_KMODS += obpsym -MISC_KMODS += platmod -MISC_KMODS += platsvc -MISC_KMODS += vis - +MISC_KMODS += ldc +MISC_KMODS += obpsym +MISC_KMODS += platmod +MISC_KMODS += platsvc +MISC_KMODS += vis + # md5 optimized for Niagara # MISC_KMODS += md5 # +# Brand modules +# +BRAND_KMODS += sn1_brand + +# # Software Cryptographic Providers (/kernel/crypto): # # Don't build this for OpenSolaris, since it will be replaced by diff --git a/usr/src/uts/sun4v/ml/trap_table.s b/usr/src/uts/sun4v/ml/trap_table.s index 9825a08a93..d920835328 100644 --- a/usr/src/uts/sun4v/ml/trap_table.s +++ b/usr/src/uts/sun4v/ml/trap_table.s @@ -36,6 +36,7 @@ #include <sys/hypervisor_api.h> #include <sys/machtrap.h> #include <sys/machthread.h> +#include <sys/machbrand.h> #include <sys/pcb.h> #include <sys/pte.h> #include <sys/mmu.h> @@ -187,6 +188,9 @@ */ #define SYSCALL(which) \ TT_TRACE(trace_gen) ;\ + SYSCALL_NOTT(which) + +#define SYSCALL_NOTT(which) \ set (which), %g1 ;\ ba,pt %xcc, sys_trap ;\ sub %g0, 1, %g4 ;\ @@ -544,7 +548,7 @@ * FILL_64bit_asi fills a 64-bit-wide register window from a 64-bit * wide address space via the designated asi. It is used to fill * non-kernel windows. The stack pointer is required to be eight-byte - * aligned. + * aligned. */ #define FILL_64bit_asi(asi_num, tail) \ mov V9BIAS64 + 0, %g1 ;\ @@ -827,7 +831,7 @@ tt_pil/**/level: ;\ ba,a,pt %xcc, .watchdog_trap ;\ .align 32 - + /* * MMU Trap Handlers. */ @@ -882,7 +886,7 @@ tt_pil/**/level: ;\ .align 32 /* * SPARC V9 IMPL. DEP. #109(1) and (2) and #110(1) and (2) - */ + */ /* * synthesize for trap(): SFAR in %g2, SFSR in %g3 @@ -1226,7 +1230,11 @@ trap_table0: BAD; /* 105 range check ?? */ GOTO(.fix_alignment); /* 106 do unaligned references */ BAD; /* 107 unused */ +#ifndef DEBUG SYSCALL(syscall_trap32); /* 108 ILP32 system call on LP64 */ +#else /* DEBUG */ + GOTO(syscall_wrapper32); /* 108 ILP32 system call on LP64 */ +#endif /* DEBUG */ GOTO(set_trap0_addr); /* 109 set trap0 address */ BAD; BAD; BAD4; /* 10A - 10F unused */ TRP4; TRP4; TRP4; TRP4; /* 110 - 11F V9 user trap handlers */ @@ -1246,7 +1254,11 @@ trap_table0: BAD; /* 139 unused */ DTRACE_RETURN; /* 13A dtrace pid return probe */ BAD; BAD4; /* 13B - 13F unused */ - SYSCALL(syscall_trap) /* 140 LP64 system call */ +#ifndef DEBUG + SYSCALL(syscall_trap); /* 140 LP64 system call */ +#else /* DEBUG */ + GOTO(syscall_wrapper); /* 140 LP64 system call */ +#endif /* DEBUG */ SYSCALL(nosys); /* 141 unused system call trap */ #ifdef DEBUG_USER_TRAPTRACECTL GOTO(.traptrace_freeze); /* 142 freeze traptrace */ @@ -1569,7 +1581,7 @@ etrap_table: brz,pt %g5, 3f ! if p_utraps == NULL goto trap() rdpr %tt, %g3 ! delay - get actual hw trap type - + sub %g3, 254, %g1 ! UT_TRAP_INSTRUCTION_16 = p_utraps[18] ba,pt %icc, 2f smul %g1, CPTRSIZE, %g2 @@ -1583,7 +1595,7 @@ etrap_table: mov 1, %g1 st %g1, [%g4 + CPU_TL1_HDLR] ! set CPU_TL1_HDLR - rdpr %tpc, %g1 ! ld trapping instruction using + rdpr %tpc, %g1 ! ld trapping instruction using lduwa [%g1]ASI_AIUP, %g1 ! "AS IF USER" ASI which could fault st %g0, [%g4 + CPU_TL1_HDLR] ! clr CPU_TL1_HDLR @@ -1591,7 +1603,7 @@ etrap_table: andcc %g1, %g4, %g4 ! and instruction with mask bnz,a,pt %icc, 3f ! if %g4 == zero, %g1 is an ILLTRAP nop ! fall thru to setup -2: +2: ldn [%g5 + %g2], %g5 brnz,a,pt %g5, .setup_v9utrap nop @@ -1698,7 +1710,7 @@ etrap_table: srl %g2, FSR_FTT_SHIFT, %g7 ! extract ftt from %fsr and %g7, (FSR_FTT>>FSR_FTT_SHIFT), %g7 cmp %g7, FTT_UNFIN - set FSR_TEM_NX, %g5 + set FSR_TEM_NX, %g5 bne,pn %xcc, .fp_exception_cont ! branch if NOT unfinished_FPop andcc %g2, %g5, %g0 bne,pn %xcc, .fp_exception_cont ! branch if FSR_TEM_NX enabled @@ -1833,7 +1845,7 @@ _fitos_fdtos_done: ldx [%g7], %g5 1: add %g5, 1, %g6 - + casxa [%g7] ASI_N, %g5, %g6 cmp %g5, %g6 bne,a,pn %xcc, 1b @@ -2849,4 +2861,52 @@ fast_trap_dummy_call: retl nop +#ifdef DEBUG +/* + * Currently we only support syscall interposition for branded zones on + * DEBUG kernels. The only brand that makes use of this functionality is + * the fake Solaris 10 brand. Since this brand is only used for exercising + * the framework, we don't want this overhead incurred on production + * systems. + */ +#define BRAND_CALLBACK(callback_id) \ + CPU_ADDR(%g2, %g1) /* load CPU struct addr to %g2 */ ;\ + ldn [%g2 + CPU_THREAD], %g3 /* load thread pointer */ ;\ + ldn [%g3 + T_PROCP], %g3 /* get proc pointer */ ;\ + ldn [%g3 + P_BRAND], %g3 /* get brand pointer */ ;\ + brz %g3, 1f /* No brand? No callback. */ ;\ + nop ;\ + ldn [%g3 + B_MACHOPS], %g3 /* get machops list */ ;\ + ldn [%g3 + (callback_id << 3)], %g3 ;\ + brz %g3, 1f ;\ + /* \ + * This isn't pretty. We want a low-latency way for the callback \ + * routine to decline to do anything. We just pass in an address \ + * the routine can directly jmp back to, pretending that nothing \ + * has happened. \ + * \ + * %g1: return address (where the brand handler jumps back to) \ + * %g2: address of CPU structure \ + * %g3: address of brand handler (where we will jump to) \ + */ \ + mov %pc, %g1 ;\ + add %g1, 16, %g1 ;\ + jmp %g3 ;\ + nop ;\ +1: + + ENTRY_NP(syscall_wrapper32) + TT_TRACE(trace_gen) + BRAND_CALLBACK(BRAND_CB_SYSCALL32) + SYSCALL_NOTT(syscall_trap32) + SET_SIZE(syscall_wrapper32) + + ENTRY_NP(syscall_wrapper) + TT_TRACE(trace_gen) + BRAND_CALLBACK(BRAND_CB_SYSCALL) + SYSCALL_NOTT(syscall_trap) + SET_SIZE(syscall_wrapper) + +#endif /* DEBUG */ + #endif /* lint */ diff --git a/usr/src/uts/sun4v/sn1_brand/Makefile b/usr/src/uts/sun4v/sn1_brand/Makefile new file mode 100644 index 0000000000..0333e5fe15 --- /dev/null +++ b/usr/src/uts/sun4v/sn1_brand/Makefile @@ -0,0 +1,83 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +#ident "%Z%%M% %I% %E% SMI" +# +# This makefile drives the production of the kernel component of +# the N-1 Solaris brand +# + +# +# Path to the base of the uts directory tree (usually /usr/src/uts). +# +UTSBASE = ../.. + +# +# Define the module and object file sets. +# +MODULE = sn1_brand +OBJECTS = $(SN1_BRAND_OBJS:%=$(OBJS_DIR)/%) +LINTS = $(SN1_BRAND_OBJS:%.o=$(LINTS_DIR)/%.ln) +ROOTMODULE = $(ROOT_PSM_BRAND_DIR)/$(MODULE) + +# +# Include common rules. +# +include $(UTSBASE)/sun4v/Makefile.sun4v + +# +# Define targets +# +ALL_TARGET = $(BINARY) +LINT_TARGET = $(MODULE).lint +INSTALL_TARGET = $(BINARY) $(ROOTMODULE) + +INC_PATH += -I$(UTSBASE)/common/brand/sn1 + + +# +# Default build targets. +# +.KEEP_STATE: + +def: $(DEF_DEPS) + +all: $(ALL_DEPS) + +clean: $(CLEAN_DEPS) + +clobber: $(CLOBBER_DEPS) + +lint: $(LINT_DEPS) + +modlintlib: $(MODLINTLIB_DEPS) + +clean.lint: $(CLEAN_LINT_DEPS) + +install: $(INSTALL_DEPS) + +# +# Include common targets. +# +include $(UTSBASE)/sun4v/Makefile.targ diff --git a/usr/src/uts/sun4v/sys/machcpuvar.h b/usr/src/uts/sun4v/sys/machcpuvar.h index 010f5f0bc1..57b791a400 100644 --- a/usr/src/uts/sun4v/sys/machcpuvar.h +++ b/usr/src/uts/sun4v/sys/machcpuvar.h @@ -111,6 +111,8 @@ struct machcpu { uint8_t intrcnt; /* number of back-to-back interrupts */ u_longlong_t tmp1; /* per-cpu tmps */ u_longlong_t tmp2; /* used in trap processing */ + u_longlong_t tmp3; + u_longlong_t tmp4; label_t *ofd[HIGH_LEVELS]; /* saved pil ofd */ uintptr_t lfd[HIGH_LEVELS]; /* saved ret PC */ |