engines/asm/e_padlock*: add support for Zhaoxin's x86 platform
authorJeffZhao <jeffzhao@zhaoxin.com>
Fri, 16 Mar 2018 06:15:16 +0000 (14:15 +0800)
committerAndy Polyakov <appro@openssl.org>
Mon, 19 Mar 2018 10:47:33 +0000 (11:47 +0100)
VIA and Shanghai United Investment Co.,Ltd. found Shanghai ZhaoXin,
which is a fabless x86 CPU IC design company. ZhaoXin has issued
ZX-C, ZX-D x86 processors, which have 'Shanghai' CPU vendor id.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5640)

engines/asm/e_padlock-x86.pl
engines/asm/e_padlock-x86_64.pl

index c4129e8..0cea549 100644 (file)
@@ -73,11 +73,20 @@ $chunk="ebx";
        &cpuid  ();
        &xor    ("eax","eax");
        &cmp    ("ebx","0x".unpack("H*",'tneC'));
-       &jne    (&label("noluck"));
+       &jne    (&label("zhaoxin"));
        &cmp    ("edx","0x".unpack("H*",'Hrua'));
        &jne    (&label("noluck"));
        &cmp    ("ecx","0x".unpack("H*",'slua'));
        &jne    (&label("noluck"));
+       &jmp    (&label("zhaoxinEnd"));
+&set_label("zhaoxin");
+       &cmp    ("ebx","0x".unpack("H*",'hS  '));
+       &jne    (&label("noluck"));
+       &cmp    ("edx","0x".unpack("H*",'hgna'));
+       &jne    (&label("noluck"));
+       &cmp    ("ecx","0x".unpack("H*",'  ia'));
+       &jne    (&label("noluck"));
+&set_label("zhaoxinEnd");
        &mov    ("eax",0xC0000000);
        &cpuid  ();
        &mov    ("edx","eax");
index 834b1ea..9eff881 100644 (file)
@@ -57,11 +57,20 @@ padlock_capability:
        cpuid
        xor     %eax,%eax
        cmp     \$`"0x".unpack("H*",'tneC')`,%ebx
-       jne     .Lnoluck
+       jne     .Lzhaoxin
        cmp     \$`"0x".unpack("H*",'Hrua')`,%edx
        jne     .Lnoluck
        cmp     \$`"0x".unpack("H*",'slua')`,%ecx
        jne     .Lnoluck
+       jmp     .LzhaoxinEnd
+.Lzhaoxin:
+       cmp     \$`"0x".unpack("H*",'hS  ')`,%ebx
+       jne     .Lnoluck
+       cmp     \$`"0x".unpack("H*",'hgna')`,%edx
+       jne     .Lnoluck
+       cmp     \$`"0x".unpack("H*",'  ia')`,%ecx
+       jne     .Lnoluck
+.LzhaoxinEnd:
        mov     \$0xC0000000,%eax
        cpuid
        mov     %eax,%edx