@@ -34,6 +34,8 @@ const (
3434 XenHVM
3535 Bhyve
3636 Hygon
37+ SiS
38+ RDC
3739)
3840
3941const (
@@ -177,6 +179,7 @@ var flagNames = map[Flags]string{
177179type CPUInfo struct {
178180 BrandName string // Brand name reported by the CPU
179181 VendorID Vendor // Comparable CPU vendor ID
182+ VendorString string // Raw vendor string.
180183 Features Flags // Features of the CPU
181184 PhysicalCores int // Number of physical processor cores in your CPU. Will be 0 if undetectable.
182185 ThreadsPerCore int // Number of threads per physical core. Will be 1 if undetectable.
@@ -231,7 +234,7 @@ func Detect() {
231234 CPU .ThreadsPerCore = threadsPerCore ()
232235 CPU .LogicalCores = logicalCores ()
233236 CPU .PhysicalCores = physicalCores ()
234- CPU .VendorID = vendorID ()
237+ CPU .VendorID , CPU . VendorString = vendorID ()
235238 CPU .Hz = hertz (CPU .BrandName )
236239 CPU .cacheSize ()
237240}
@@ -726,12 +729,14 @@ func brandName() string {
726729
727730func threadsPerCore () int {
728731 mfi := maxFunctionID ()
729- if mfi < 0x4 || (vendorID () != Intel && vendorID () != AMD ) {
732+ vend , _ := vendorID ()
733+
734+ if mfi < 0x4 || (vend != Intel && vend != AMD ) {
730735 return 1
731736 }
732737
733738 if mfi < 0xb {
734- if vendorID () != Intel {
739+ if vend != Intel {
735740 return 1
736741 }
737742 _ , b , _ , d := cpuid (1 )
@@ -758,7 +763,8 @@ func threadsPerCore() int {
758763
759764func logicalCores () int {
760765 mfi := maxFunctionID ()
761- switch vendorID () {
766+ v , _ := vendorID ()
767+ switch v {
762768 case Intel :
763769 // Use this on old Intel processors
764770 if mfi < 0xb {
@@ -793,7 +799,8 @@ func familyModel() (int, int) {
793799}
794800
795801func physicalCores () int {
796- switch vendorID () {
802+ v , _ := vendorID ()
803+ switch v {
797804 case Intel :
798805 return logicalCores () / threadsPerCore ()
799806 case AMD , Hygon :
@@ -828,16 +835,20 @@ var vendorMapping = map[string]Vendor{
828835 "XenVMMXenVMM" : XenHVM ,
829836 "bhyve bhyve " : Bhyve ,
830837 "HygonGenuine" : Hygon ,
838+ "Vortex86 SoC" : SiS ,
839+ "SiS SiS SiS " : SiS ,
840+ "RiseRiseRise" : SiS ,
841+ "Genuine RDC" : RDC ,
831842}
832843
833- func vendorID () Vendor {
844+ func vendorID () ( Vendor , string ) {
834845 _ , b , c , d := cpuid (0 )
835- v := valAsString (b , d , c )
836- vend , ok := vendorMapping [string ( v ) ]
846+ v := string ( valAsString (b , d , c ) )
847+ vend , ok := vendorMapping [v ]
837848 if ! ok {
838- return Other
849+ return Other , v
839850 }
840- return vend
851+ return vend , v
841852}
842853
843854func cacheLine () int {
@@ -860,7 +871,7 @@ func (c *CPUInfo) cacheSize() {
860871 c .Cache .L1I = - 1
861872 c .Cache .L2 = - 1
862873 c .Cache .L3 = - 1
863- vendor := vendorID ()
874+ vendor , _ := vendorID ()
864875 switch vendor {
865876 case Intel :
866877 if maxFunctionID () < 4 {
@@ -1015,7 +1026,7 @@ func hasSGX(available, lc bool) (rval SGXSupport) {
10151026
10161027func support () Flags {
10171028 mfi := maxFunctionID ()
1018- vend := vendorID ()
1029+ vend , _ := vendorID ()
10191030 if mfi < 0x1 {
10201031 return 0
10211032 }
@@ -1243,7 +1254,7 @@ func support() Flags {
12431254 AV_CPU_FLAG_SSE2 and AV_CPU_FLAG_SSE2SLOW are both set in this case
12441255 so that SSE2 is used unless explicitly disabled by checking
12451256 AV_CPU_FLAG_SSE2SLOW. */
1246- if vendorID () != Intel &&
1257+ if vend != Intel &&
12471258 rval & SSE2 != 0 && (c & 0x00000040 ) == 0 {
12481259 rval |= SSE2SLOW
12491260 }
@@ -1259,7 +1270,7 @@ func support() Flags {
12591270 }
12601271 }
12611272
1262- if vendorID () == Intel {
1273+ if vend == Intel {
12631274 family , model := familyModel ()
12641275 if family == 6 && (model == 9 || model == 13 || model == 14 ) {
12651276 /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and
0 commit comments