z90hardware.c
来自「linux2.6.16版本」· C语言 代码 · 共 2,426 行 · 第 1/5 页
C
2,426 行
static struct function_and_rules_block static_pke_function_and_rulesX = { {0x50,0x4B}, {0x00,0x0A}, {'M','R','P',' ',' ',' ',' ',' '}};static unsigned char static_PKE_function_code[2] = {0x50, 0x4B};struct T6_keyBlock_hdrX { unsigned short blen; unsigned short ulen; unsigned char flags[2];};static unsigned char static_pad[256] = {0x1B,0x7B,0x5D,0xB5,0x75,0x01,0x3D,0xFD,0x8D,0xD1,0xC7,0x03,0x2D,0x09,0x23,0x57,0x89,0x49,0xB9,0x3F,0xBB,0x99,0x41,0x5B,0x75,0x21,0x7B,0x9D,0x3B,0x6B,0x51,0x39,0xBB,0x0D,0x35,0xB9,0x89,0x0F,0x93,0xA5,0x0B,0x47,0xF1,0xD3,0xBB,0xCB,0xF1,0x9D,0x23,0x73,0x71,0xFF,0xF3,0xF5,0x45,0xFB,0x61,0x29,0x23,0xFD,0xF1,0x29,0x3F,0x7F,0x17,0xB7,0x1B,0xA9,0x19,0xBD,0x57,0xA9,0xD7,0x95,0xA3,0xCB,0xED,0x1D,0xDB,0x45,0x7D,0x11,0xD1,0x51,0x1B,0xED,0x71,0xE9,0xB1,0xD1,0xAB,0xAB,0x21,0x2B,0x1B,0x9F,0x3B,0x9F,0xF7,0xF7,0xBD,0x63,0xEB,0xAD,0xDF,0xB3,0x6F,0x5B,0xDB,0x8D,0xA9,0x5D,0xE3,0x7D,0x77,0x49,0x47,0xF5,0xA7,0xFD,0xAB,0x2F,0x27,0x35,0x77,0xD3,0x49,0xC9,0x09,0xEB,0xB1,0xF9,0xBF,0x4B,0xCB,0x2B,0xEB,0xEB,0x05,0xFF,0x7D,0xC7,0x91,0x8B,0x09,0x83,0xB9,0xB9,0x69,0x33,0x39,0x6B,0x79,0x75,0x19,0xBF,0xBB,0x07,0x1D,0xBD,0x29,0xBF,0x39,0x95,0x93,0x1D,0x35,0xC7,0xC9,0x4D,0xE5,0x97,0x0B,0x43,0x9B,0xF1,0x16,0x93,0x03,0x1F,0xA5,0xFB,0xDB,0xF3,0x27,0x4F,0x27,0x61,0x05,0x1F,0xB9,0x23,0x2F,0xC3,0x81,0xA9,0x23,0x71,0x55,0x55,0xEB,0xED,0x41,0xE5,0xF3,0x11,0xF1,0x43,0x69,0x03,0xBD,0x0B,0x37,0x0F,0x51,0x8F,0x0B,0xB5,0x89,0x5B,0x67,0xA9,0xD9,0x4F,0x01,0xF9,0x21,0x77,0x37,0x73,0x79,0xC5,0x7F,0x51,0xC1,0xCF,0x97,0xA1,0x75,0xAD,0x35,0x9D,0xD3,0xD3,0xA7,0x9D,0x5D,0x41,0x6F,0x65,0x1B,0xCF,0xA9,0x87,0x91,0x09};static struct cca_private_ext_ME static_pvt_me_key = { { 0x1E, 0x00, 0x0183, {0x00,0x00,0x00,0x00} }, { 0x02, 0x00, 0x016C, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00}, 0x00, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}, {0x80,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }, { 0x04, 0x00, 0x000F, {0x00,0x00}, 0x0003, 0x0000, 0x0000, {0x01,0x00,0x01} }};static struct cca_public_key static_public_key = { { 0x1E, 0x00, 0x0000, {0x00,0x00,0x00,0x00} }, { 0x04, 0x00, 0x0000, {0x00,0x00}, 0x0000, 0x0000, 0x0000, {0x01,0x00,0x01} }};#define FIXED_TYPE6_ME_LEN 0x0000025F#define FIXED_TYPE6_ME_EN_LEN 0x000000F0#define FIXED_TYPE6_ME_LENX 0x000002CB#define FIXED_TYPE6_ME_EN_LENX 0x0000015Cstatic struct cca_public_sec static_cca_pub_sec = { 0x04, 0x00, 0x000f, {0x00,0x00}, 0x0003, 0x0000, 0x0000, {0x01,0x00,0x01}};#define FIXED_TYPE6_CR_LEN 0x00000177#define FIXED_TYPE6_CR_LENX 0x000001E3#define MAX_RESPONSE_SIZE 0x00000710#define MAX_RESPONSEX_SIZE 0x0000077C#define RESPONSE_CPRB_SIZE 0x000006B8#define RESPONSE_CPRBX_SIZE 0x00000724struct type50_hdr { u8 reserved1; u8 msg_type_code; u16 msg_len; u8 reserved2; u8 ignored; u16 reserved3;};#define TYPE50_TYPE_CODE 0x50#define TYPE50_MEB1_LEN (sizeof(struct type50_meb1_msg))#define TYPE50_MEB2_LEN (sizeof(struct type50_meb2_msg))#define TYPE50_CRB1_LEN (sizeof(struct type50_crb1_msg))#define TYPE50_CRB2_LEN (sizeof(struct type50_crb2_msg))#define TYPE50_MEB1_FMT 0x0001#define TYPE50_MEB2_FMT 0x0002#define TYPE50_CRB1_FMT 0x0011#define TYPE50_CRB2_FMT 0x0012struct type50_meb1_msg { struct type50_hdr header; u16 keyblock_type; u8 reserved[6]; u8 exponent[128]; u8 modulus[128]; u8 message[128];};struct type50_meb2_msg { struct type50_hdr header; u16 keyblock_type; u8 reserved[6]; u8 exponent[256]; u8 modulus[256]; u8 message[256];};struct type50_crb1_msg { struct type50_hdr header; u16 keyblock_type; u8 reserved[6]; u8 p[64]; u8 q[64]; u8 dp[64]; u8 dq[64]; u8 u[64]; u8 message[128];};struct type50_crb2_msg { struct type50_hdr header; u16 keyblock_type; u8 reserved[6]; u8 p[128]; u8 q[128]; u8 dp[128]; u8 dq[128]; u8 u[128]; u8 message[256];};union type50_msg { struct type50_meb1_msg meb1; struct type50_meb2_msg meb2; struct type50_crb1_msg crb1; struct type50_crb2_msg crb2;};struct type80_hdr { u8 reserved1; u8 type; u16 len; u8 code; u8 reserved2[3]; u8 reserved3[8];};#define TYPE80_RSP_CODE 0x80struct error_hdr { unsigned char reserved1; unsigned char type; unsigned char reserved2[2]; unsigned char reply_code; unsigned char reserved3[3];};#define TYPE82_RSP_CODE 0x82#define TYPE88_RSP_CODE 0x88#define REP82_ERROR_MACHINE_FAILURE 0x10#define REP82_ERROR_PREEMPT_FAILURE 0x12#define REP82_ERROR_CHECKPT_FAILURE 0x14#define REP82_ERROR_MESSAGE_TYPE 0x20#define REP82_ERROR_INVALID_COMM_CD 0x21#define REP82_ERROR_INVALID_MSG_LEN 0x23#define REP82_ERROR_RESERVD_FIELD 0x24#define REP82_ERROR_FORMAT_FIELD 0x29#define REP82_ERROR_INVALID_COMMAND 0x30#define REP82_ERROR_MALFORMED_MSG 0x40#define REP82_ERROR_RESERVED_FIELDO 0x50#define REP82_ERROR_WORD_ALIGNMENT 0x60#define REP82_ERROR_MESSAGE_LENGTH 0x80#define REP82_ERROR_OPERAND_INVALID 0x82#define REP82_ERROR_OPERAND_SIZE 0x84#define REP82_ERROR_EVEN_MOD_IN_OPND 0x85#define REP82_ERROR_RESERVED_FIELD 0x88#define REP82_ERROR_TRANSPORT_FAIL 0x90#define REP82_ERROR_PACKET_TRUNCATED 0xA0#define REP82_ERROR_ZERO_BUFFER_LEN 0xB0#define REP88_ERROR_MODULE_FAILURE 0x10#define REP88_ERROR_MODULE_TIMEOUT 0x11#define REP88_ERROR_MODULE_NOTINIT 0x13#define REP88_ERROR_MODULE_NOTAVAIL 0x14#define REP88_ERROR_MODULE_DISABLED 0x15#define REP88_ERROR_MODULE_IN_DIAGN 0x17#define REP88_ERROR_FASTPATH_DISABLD 0x19#define REP88_ERROR_MESSAGE_TYPE 0x20#define REP88_ERROR_MESSAGE_MALFORMD 0x22#define REP88_ERROR_MESSAGE_LENGTH 0x23#define REP88_ERROR_RESERVED_FIELD 0x24#define REP88_ERROR_KEY_TYPE 0x34#define REP88_ERROR_INVALID_KEY 0x82#define REP88_ERROR_OPERAND 0x84#define REP88_ERROR_OPERAND_EVEN_MOD 0x85#define CALLER_HEADER 12static inline inttestq(int q_nr, int *q_depth, int *dev_type, struct ap_status_word *stat){ int ccode; asm volatile#ifdef CONFIG_64BIT (" llgfr 0,%4 \n" " slgr 1,1 \n" " lgr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " iihh %0,0 \n" " iihl %0,0 \n" " lgr %1,1 \n" " lgr %3,2 \n" " srl %3,24 \n" " sll 2,24 \n" " srl 2,24 \n" " lgr %2,2 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h5 \n" " jg 2b \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 8 \n" " .quad 0b,3b \n" " .quad 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat),"=d" (*q_depth), "=d" (*dev_type) :"d" (q_nr), "K" (DEV_TSQ_EXCEPTION) :"cc","0","1","2","memory");#else (" lr 0,%4 \n" " slr 1,1 \n" " lr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " lr %1,1 \n" " lr %3,2 \n" " srl %3,24 \n" " sll 2,24 \n" " srl 2,24 \n" " lr %2,2 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h5 \n" " bras 1,4f \n" " .long 2b \n" "4: \n" " l 1,0(1) \n" " br 1 \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 4 \n" " .long 0b,3b \n" " .long 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat),"=d" (*q_depth), "=d" (*dev_type) :"d" (q_nr), "K" (DEV_TSQ_EXCEPTION) :"cc","0","1","2","memory");#endif return ccode;}static inline intresetq(int q_nr, struct ap_status_word *stat_p){ int ccode; asm volatile#ifdef CONFIG_64BIT (" llgfr 0,%2 \n" " lghi 1,1 \n" " sll 1,24 \n" " or 0,1 \n" " slgr 1,1 \n" " lgr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " iihh %0,0 \n" " iihl %0,0 \n" " lgr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h3 \n" " jg 2b \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 8 \n" " .quad 0b,3b \n" " .quad 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat_p) :"d" (q_nr), "K" (DEV_RSQ_EXCEPTION) :"cc","0","1","2","memory");#else (" lr 0,%2 \n" " lhi 1,1 \n" " sll 1,24 \n" " or 0,1 \n" " slr 1,1 \n" " lr 2,1 \n" "0: .long 0xb2af0000 \n" "1: ipm %0 \n" " srl %0,28 \n" " lr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h3 \n" " bras 1,4f \n" " .long 2b \n" "4: \n" " l 1,0(1) \n" " br 1 \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 4 \n" " .long 0b,3b \n" " .long 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat_p) :"d" (q_nr), "K" (DEV_RSQ_EXCEPTION) :"cc","0","1","2","memory");#endif return ccode;}static inline intsen(int msg_len, unsigned char *msg_ext, struct ap_status_word *stat){ int ccode; asm volatile#ifdef CONFIG_64BIT (" lgr 6,%3 \n" " llgfr 7,%2 \n" " llgt 0,0(6) \n" " lghi 1,64 \n" " sll 1,24 \n" " or 0,1 \n" " la 6,4(6) \n" " llgt 2,0(6) \n" " llgt 3,4(6) \n" " la 6,8(6) \n" " slr 1,1 \n" "0: .long 0xb2ad0026 \n" "1: brc 2,0b \n" " ipm %0 \n" " srl %0,28 \n" " iihh %0,0 \n" " iihl %0,0 \n" " lgr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h4 \n" " jg 2b \n" ".previous \n" ".section __ex_table,\"a\" \n" " .align 8 \n" " .quad 0b,3b \n" " .quad 1b,3b \n" ".previous" :"=d" (ccode),"=d" (*stat) :"d" (msg_len),"a" (msg_ext), "K" (DEV_SEN_EXCEPTION) :"cc","0","1","2","3","6","7","memory");#else (" lr 6,%3 \n" " lr 7,%2 \n" " l 0,0(6) \n" " lhi 1,64 \n" " sll 1,24 \n" " or 0,1 \n" " la 6,4(6) \n" " l 2,0(6) \n" " l 3,4(6) \n" " la 6,8(6) \n" " slr 1,1 \n" "0: .long 0xb2ad0026 \n" "1: brc 2,0b \n" " ipm %0 \n" " srl %0,28 \n" " lr %1,1 \n" "2: \n" ".section .fixup,\"ax\" \n" "3: \n" " lhi %0,%h4 \n" " bras 1,4f \n"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?