WO2014135052A1 - 一种高性能微处理器寄存器及其内存地址弹性保护方法 - Google Patents

一种高性能微处理器寄存器及其内存地址弹性保护方法 Download PDF

Info

Publication number
WO2014135052A1
WO2014135052A1 PCT/CN2014/072820 CN2014072820W WO2014135052A1 WO 2014135052 A1 WO2014135052 A1 WO 2014135052A1 CN 2014072820 W CN2014072820 W CN 2014072820W WO 2014135052 A1 WO2014135052 A1 WO 2014135052A1
Authority
WO
WIPO (PCT)
Prior art keywords
register
page
processor
registers
mode
Prior art date
Application number
PCT/CN2014/072820
Other languages
English (en)
French (fr)
Inventor
周海林
Original Assignee
成都腾悦科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 成都腾悦科技有限公司 filed Critical 成都腾悦科技有限公司
Publication of WO2014135052A1 publication Critical patent/WO2014135052A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1416Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights
    • G06F12/1425Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights the protection being physical, e.g. cell, word, block

Definitions

  • the invention relates to a high performance microprocessor register and a memory address elastic protection method thereof.
  • the processor is at the heart of the contemporary computer industry.
  • Processors fall into two broad categories: reduced instruction set processors and complex instruction set processors.
  • reduced instruction set processors are widely used, such as: PAD, high-performance servers, desktop platforms, embedded platforms, etc.; however, complex instruction set processors are relatively small, generally only used Low performance servers and desktop platforms.
  • PAD high-performance servers
  • complex instruction set processors are relatively small, generally only used Low performance servers and desktop platforms.
  • the main reason is that the instruction set of the reduced instruction set processor has the same length, the instruction format is small, the number of registers is large, and the number of instructions is small, which makes the processor process streamline. It has the characteristics of simple design, high efficiency, easy testing and high yield. Therefore, how to develop a high-performance reduced instruction set processor with completely independent core intellectual property has become an important topic in computer industry design research.
  • the kernel of the computer operating system is mainly placed in the low address range of the memory (only a very small number of processors put the kernel in the high address of the memory), and then the operating system handles the abnormally interrupted program, and then puts it for the application.
  • the service program, the application is placed at the end.
  • mainstream processors are currently implemented in the following ways:
  • the computer's memory is fixedly divided into segments of a certain length, and the application and the operating system kernel are placed in a prescribed memory interval to prevent unauthorized access by the user program;
  • the processor prevents unauthorized access by the user program by checking the length of the program, privilege level, and read and write execution;
  • the operating system prevents unauthorized access by user programs by checking the length of the program, privilege level, and read and write execution.
  • An object of the present invention is to overcome the deficiencies of the prior art and provide a high performance microprocessor that can be easily upgraded without changing the instruction set, using a shallow pipeline design and a streamlined pipeline architecture, static branch prediction, dynamic branch prediction. , can better reduce the execution time of each instruction, and support multiple shots, reducing the time taken by the processor to find data from memory;
  • Another object of the present invention is to provide a memory address elastic protection method for a high-performance microprocessor register, which overcomes the insufficiency of the traditional processor to prevent unauthorized access by the application through software protection and fixed segment protection, and can effectively prevent the application from being Unauthorized access.
  • a high performance microprocessor register which includes:
  • page 17, 18, the page only has the processor in ken mode and int Mode is only assigned by the data movement instruction. If the processor is in soft mode and urs mode, it cannot be assigned and generates an exception.
  • the page Used as the instruction pointer of the software mode, the 19th and 20th registers of the page, the page only has the processor in ken mode, int Mode and soft mode are assigned by the data movement instruction. If the processor is in urs mode, it cannot be assigned and generates an exception.
  • page 21, 22 registers, when assigning a value to its controlled level 0 cache, check its privilege level, when the privilege level value is less than or equal to it is assigned, otherwise an exception occurs;
  • the pointer used as the page register, the 27th and 28th registers of the page when the value of the level 0 cache controlled by it is checked, the privilege level is checked, and when the privilege level value is less than or equal to it, it is assigned, otherwise an exception is generated;
  • the pointer used as the page register, the 29th and 30th registers of the page when the value of the level 0 cache controlled by it is checked, the privilege level is checked, and when the privilege level value is less than or equal to it, it is assigned, otherwise an exception is generated;
  • the processor Used as the timer timer 33 to 36 registers. When the timer is enabled, the processor increments by one value per clock register, and an exception occurs when overflow occurs.
  • the memory in the computer is no more than 4 GB.
  • the page size is 4 kb, the lower 20 bits are valid, and the upper 12 bits must be 0. Otherwise, an instruction error is generated.
  • the values of the 21, 22, and 23 bits of this register are 000, 001, 010, 011, 100, 101, 110, 111, where 011, 100, 101, 110 are reserved.
  • 000 is used as the address of level 0 cache
  • 001 is used as the address of level 1 cache
  • 010 is used as the address of level 2 cache
  • 111 is used as the global address of the processor for io input and output blocks
  • high 9 bits are the processing core number of the processor, which is used when the processor is upgraded to multiple cores.
  • the operating system is a single core, it is forced to 0, and the lower 20 bits are the block number of the cache;
  • the 51st register is the start address of the address
  • the 52nd register is the end of the address (both block numbers);
  • Registers 57 to 60 are respectively used as config0, config1, config2, and config3.
  • config0 the lower 4 bits of register 25 enable clocks 0, 1, 2, and 3 respectively, and the 4th bit is 1 to enable paging mechanism, which is 0.
  • the operating system checks the current usr If the range of the instruction page number of mode is in the 42 or 43 registers, it will not be generated, and an exception will be generated; other bits are reserved, and config1, config2, and config3 are reserved respectively;
  • registers 61 and 62 are used as registers 61 and 62 of trp and trpp registers respectively.
  • the values of registers 61 and 62 need not be saved.
  • the data length of each line is 32 bits.
  • the value of the register is placed in the task switching. , the data is taken out when the task is performed;
  • the cpu attribute of register 63 is as follows:
  • the current core of the processor is 9bit [22, 14]
  • the value of the 32-63 register only runs in ker mode, int mode and soft Mode can be assigned.
  • a memory address elastic protection method for a high performance microprocessor register comprising the following steps:
  • S1 The operating system allocates the memory range of the processor in various modes by assigning registers 37, 38, and 39;
  • S2 The processor checks whether the content of the 14th register is within the page value of the 39th register, if it is within the range, an exception is generated, and if it is not within the range, no exception is generated;
  • S3 The processor checks whether the page number of the 16th register is in the page number range of the 0th to the 37th register, if it is within the range, no abnormality is generated, and if it is not within the range, an exception is generated;
  • S4 The processor checks whether the page number of the 18th register is in the range of the 37th register and the 38th register, if it is within the range, no abnormality is generated, and if it is not within the range, an exception is generated;
  • S5 The processor checks whether the content of the 20th register is within the page value of the 38th register and the 39th register, and if it is outside the range, an exception is generated;
  • S6 The processor sends the exception number to the exception interrupt register and enters the int Mode, the current processor's instruction page is 18 registers, the instruction pointer is the 17th register, and the processor prevents the illegal access of the application by executing the operating system's abnormal interrupt handler.
  • the instruction set adopts the current mainstream reduced instructions. There are about 60 instructions. This instruction set can support up to 1024. When the processor exceeds 1024 bits, it needs to be upgraded.
  • the operating system assigns the registers 37 to 39 through the data movement instruction, which can allocate the computer memory space more effectively;
  • FIG. 1 is a flowchart of a memory address elastic protection method.
  • a 0th register that is always 0 for the lowest potential of the power supply
  • page 17 and 18 registers Used as the instruction pointer of the processor in interrupt mode, page 17 and 18 registers, its page only has the processor in ker mode and int Mode is only assigned by the data movement instruction. If the processor is in soft mode and urs mode, it cannot be assigned and generates an exception.
  • the page Used as the instruction pointer of the software mode, the 19th and 20th registers of the page, the page only has the processor in ker mode, int Mode and soft mode are assigned by the data movement instruction. If the processor is in urs mode, it cannot be assigned and generates an exception.
  • page 21, 22 registers, when assigning a value to its controlled level 0 cache, check its privilege level, when the privilege level value is less than or equal to it is assigned, otherwise an exception occurs;
  • the pointer used as the page register, the 27th and 28th registers of the page when the value of the level 0 cache controlled by it is checked, the privilege level is checked, and when the privilege level value is less than or equal to it, it is assigned, otherwise an exception is generated;
  • the pointer used as the page register, the 29th and 30th registers of the page when the value of the level 0 cache controlled by it is checked, the privilege level is checked, and when the privilege level value is less than or equal to it, it is assigned, otherwise an exception is generated;
  • timer register No. 33 to 36 Used as a timer register No. 33 to 36.
  • the processor increments by one value per clock register, and an exception occurs when overflow occurs.
  • the memory in the computer is no more than 4 GB.
  • the page size is 4 kb, the lower 20 bits are valid, and the upper 12 bits must be 0. Otherwise, an instruction error is generated.
  • the values of the 21, 22, and 23 bits of this register are 000, 001, 010, 011, 100, 101, 110, 111, where 011, 100, 101, 110 are reserved.
  • 000 is used as the address of level 0 cache
  • 001 is used as the address of level 1 cache
  • 010 is used as the address of level 2 cache
  • 111 is used as the global address of the processor for io input and output blocks
  • high 9 bits are the processing core number of the processor, which is used when the processor is upgraded to multiple cores.
  • the operating system is a single core, it is forced to 0, and the lower 20 bits are the block number of the cache;
  • the 51st register is the start address of the address
  • the 52nd register is the end of the address (both block numbers);
  • Registers 57 to 60 are respectively used as config0, config1, config2, and config3.
  • config0 the lower 4 bits of register 25 enable clocks 0, 1, 2, and 3 respectively, and the 4th bit is 1 to enable paging mechanism, which is 0.
  • the operating system checks the current usr The range of the instruction page number of mode is not in the registers 42 and 43. If it is not in the range, an exception is generated; other bits are reserved, and config1, config2, and config3 are reserved respectively;
  • registers 61 and 62 are used as registers 61 and 62 of trp and trpp registers respectively.
  • the values of registers 61 and 62 need not be saved.
  • the data length of each line is 32 bits.
  • the value of the register is placed in the task switching. , the data is taken out when the task is performed;
  • the cpu attribute of register 63 is as follows:
  • the current core of the processor is 9bit [22, 14]
  • the value of the 32-63 register can only be assigned if it is running in privileged mode. Registers 37 to 39 are only available in ken Mode can be assigned, other mode assignments generate exceptions.
  • Mov which is a data movement instruction, can be divided into two categories: an immediate movement instruction; an inter-register movement instruction.
  • the immediate movement instruction can be divided into a signed immediate movement instruction, and an unsigned immediate movement instruction:
  • Source operand destination operand (this is the destination register)
  • Source operand destination operand (this is the destination register)
  • the source operand is the 11th register
  • the destination operand is the 12th register
  • the user mode pointer and page are placed in the corresponding registers.
  • the processor enters user mode.
  • Ken passive destination operand the processor enters core mode.
  • the processor enters interrupt mode.
  • the processor enters software mode.
  • Pop pops up the data command from the stack page, pops up, and presses the data length to the number of bits in the processor.
  • Set The set command sets the source operand (source operand bit).
  • the clr clear command sets the source operand (source operand bit) to zero.
  • Tst Test the command, test the (source operand bit) bit of the destination operand, and place the result in the 27 bits of the status register (Register 31).
  • M32 32-bit unsigned multiply instruction the result is placed, the low bit is placed in the 10th register, and the high bit is placed in the 9th register.
  • the sm32 32-bit signed multiply instruction the result is placed, the low bit is placed in the 10th register, and the high bit is placed in the 9th register.
  • the Sd32 32-bit signed multiply instruction the result is placed, the result is placed in the 9th register, and the module is placed in the 10th register.
  • a memory address elastic protection method for a high performance microprocessor register includes the following steps:
  • S1 The operating system allocates the memory range of the processor in various modes by assigning registers 37, 38, and 39;
  • S2 The processor checks whether the content of the 14th register is within the page value of the 39th register, if it is within the range, an exception is generated, and if it is not within the range, no exception is generated;
  • S3 The processor checks whether the page number of the 16th register is in the page number range of the 0th to the 37th register, if it is within the range, no abnormality is generated, and if it is not within the range, an exception is generated;
  • S4 The processor checks whether the page number of the 18th register is in the range of the 37th register and the 38th register, if it is within the range, no abnormality is generated, and if it is not within the range, an exception is generated;
  • S5 The processor checks whether the content of the 20th register is within the page value of the 38th register and the 39th register, and if it is outside the range, an exception is generated;
  • S6 The processor sends the exception number to the exception interrupt register (register 40) and enters the int Mode, the current processor's instruction page is 18 registers, the instruction pointer is the 17th register, and the processor prevents the illegal access of the application by executing the operating system's abnormal interrupt handler.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

本发明公开了一种高性能微处理器寄存器及其内存地址弹性保护方法,方法包括:赋值37、38、39号寄存器,分配内存区间;检査14号寄存器的内容是否在39号中页值之内;检査16号寄存器的页码是否在0号到37号页码范围中;检査18号寄存器的页码是否在37、38号范围中;检査20号寄存器的内容是否在38、39号中页值之内;处理器把异常号送到异常中断寄存器中,当前处理器的指令页是18号,指令指针是17号,处理器通过执行操作系统的异常中断处理程序。本发明在不改变指令集的前提下可轻易升级,采用浅流水线设计和精简流水线架构,能够更好地减少每条指令的时间,同时支持多发多射,提高处理器运算速度,有效地分配内存空间,有效防止应用程序的非法访问。

Description

一种高性能微处理器寄存器及其内存地址弹性保护方法 技术领域
本发明涉及一种高性能微处理器寄存器及其内存地址弹性保护方法。
背景技术
处理器是当代计算机工业的核心。处理器大致分为两类:精简指令集处理器和复杂指令集处理器。在高性能处理平台中,精简指令集处理器被广泛使用,如:PAD,高性能服务器,桌面平台,嵌入式平台等;然而,复杂指令集处理器的使用却相对较少,一般只用于低性能服务器和桌面平台等。其主要原因是:精简指令集处理器指令长度不变,指令格式少,寄存器数目多,指令数目少,更能使处理器处理流水化。具有设计简单、效率高、容易测试、成品率高等特点。因此,如何研发出具有完全自主核心知识产权的高性能精简指令集处理器,已成为计算机工业设计研究中的重要课题。
目前,计算机操作系统的内核主要放在内存的低地址区间中(只有极少数的处理器把内核放在内存的高地址),接着放操作系统处理异常中断的程序,再接着放为应用程序提供服务的程序,应用程序放在最后。为了防止应用程序的非法访问,目前,主流的处理器主要用以下方法实现:
(1)把计算机的内存固定分成一定长度的段,应用程序和操作系统内核放在规定的内存区间内,以防止用户程序的非法访问;
(2)处理器通过检查程序的长度,特权级和读写执行等属性以防止用户程序的非法访问;
(3)操作系统通过检查程序的长度,特权级和读写执行等属性以防止用户程序的非法访问。
现有的计算机内存地址的保护方法存在以下不足:
1)当计算机的内存很小(如PDD、嵌入式平台中)时,如果固定长度的内存很大,供应用程序使用的内存就会很小,会造成宝贵的内存资源浪费,造成内存没有被合理的使用;
2)当计算机的内存很大(如在高性能的服务器中、大型计算机中),并且其操作系统内核也很大时,会造成操作系统内核不能完全被处理器内核保护的情况;
3)如果应用程序利用操作系统的漏洞,篡改程序属性(在分段操作系统,分页操作系统中分别更改段属性,页属性等),使程序得到非法权限。
技术问题
本发明的一个目的在于克服现有技术的不足,提供一种高性能微处理器,在不改变指令集的前提下可轻易升级,采用浅流水线设计和精简流水线架构,静态分支预测,动态分支预测,能够更好地减少每条指令执行的时间,同时支持多发多射,减少处理器从内存里查找数据所用的时间;
本发明的另一个目的在于提供一种高性能微处理器寄存器的内存地址弹性保护方法,克服传统处理器通过软件保护和固定分段保护来防止应用程序非法访问的不足,可有效防止应用程序的非法访问。
技术解决方案
本发明的目的是通过以下技术方案来实现的:一种高性能微处理器寄存器,它包括:
永远为0的0号寄存器;
用作累加器的1~8号寄存器;
用作乘法时的高位,除法指令的商的9号寄存器;
用作乘法时的低位,除法指令的模的10号寄存器;
用作返回用户模式时的指针、页的11、12号寄存器;
用作处理器在用户模式时的指令指针、页的13、14号寄存器;
用作处理器在特权模式时的指令指针、页的15、16号寄存器;
用作处理器在中断模式时的指令指针、页的17、18号寄存器,其页只有处理器在ken mode和int mode下才被数据移动指令赋值,如果处理器在soft mode和urs mode,则不能赋值并产生异常;
用作软件模式的指令指针、页的19、20号寄存器,其页只有处理器在ken mode、int mode和soft mode下才被数据移动指令赋值,如果处理器在urs mode,则不能赋值并产生异常;
用作堆栈指针、页的21、22号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的23、24号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的25、26号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的27、28号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的29、30号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作状态寄存器的31号寄存器;
用作页目录寄存器的32号寄存器,保存虚拟地址转换式的页目录低20位有效,高12位强制为0,否则在以后的产品中产生不可预知的错误异常;
用作定时器timer的33~36号寄存器,当timer使能后,处理器每经过一个时钟寄存器的值加1,溢出时产生异常;
分别用作kenend、intend和softend寄存器的37~39号寄存器,在计算机的内存不大于4GB,在页大小为4kb时低20位有效,高12位必须为0,否则产生指令错误异常;
用作异常中断寄存器的40号寄存器,15位为1开启中断,反之不开启;16位为1开启异常,反之不开启;
用作页异常线性地址的41号寄存器;
用作多任务模式下的页开始、结束位置的42、43号寄存器,当操作系统开启多任务保护模式,当用户页的值在42、43号寄存器值之外时,处理器产生出界异常;
用作虚拟模式下的页开始、结束位置的44、45号寄存器,0号版本的内核暂时保留;
用作tlb入口的46~50号寄存器,该寄存器的21,22,23位的值是000,001,010,011,100,101,110,111,其中,011,100,101,110保留,供处理器架构升级用,000作为0级cache的地址使用,001作为1级cache的地址使用,010作为2级cache的地址使用,111作为处理器的全局地址,供io输入输出块使用,高9位是处理器的处理核心号码,供处理器升级成多核心时使用,在操作系统为单核心时强制为0,低20位是cache的块号;
用作内部dma的51~53号寄存器,51号寄存器为地址的开始地址,52号寄存器为地址结束处(都是块号);
53号寄存器保留;
54号寄存器保留;
用作分页模式下的局部地址转换的奇54、55号寄存器;
57~60号寄存器分别作为config0、config1、config2、config3,其中,对于config0,25号寄存器低4位分别使能0,1,2,3号时钟,第4位为1开启分页机制,为0时开启分页码机制,第5位多任务保护模式,操作系统检查当前usr mode的指令页码的范围是否在42、43号寄存器之内,不在其内,则产生异常;其它位保留,config1、config2、config3分别保留;
分别用作trp、trpp寄存器的61、62号寄存器,在任务切换时,61、62号寄存器的值无需保存,其每行的数据长度为32位,在任务切换时把寄存器的值放在里面,执行该任务时将数据取出;
63号寄存器cpu属性如下:
处理器核心数 9bit【31,23】
处理器当前核心号 9bit【22,14】
处理器的位数 3bit【2,0】
其它位保留;
其中,32~63号寄存器的值只有运行在ker mode,int mode和soft mode才能被赋值。
一种高性能微处理器寄存器的内存地址弹性保护方法,它包括以下步骤:
S1:操作系统通过赋值37、38、39号寄存器,分配处理器在各种模式下的内存区间;
S2:处理器检查14号寄存器的内容是否在39号寄存器中页值之内,如果在其范围之内,则产生异常,如果不在其范围之内,则不产生异常;
S3:处理器检查16号寄存器的页码是否在0号到37号寄存器页码范围中,如果在其范围之内,则不产生异常,如果不在其范围之内,则产生异常;
S4:处理器检查18号寄存器的页码是否在37号寄存器和38号寄存器范围中,如果在其范围之内,则不产生异常,如果不在其范围之内,则产生异常;
S5:处理器检查20号寄存器的内容是否在38号寄存器和39号寄存器中页值之内,如果在其范围之外,则产生异常;
S6:处理器把异常号送到异常中断寄存器中,并且进入int mode,当前处理器的指令页是18寄存器,指令指针是17号寄存器,处理器通过执行操作系统的异常中断处理程序,从而防止应用程序的非法访问。
有益效果
本发明的有益效果是:
1)在不改变指令集的前提下可轻易升级,采用浅流水线设计和精简流水线架构,静态分支预测,能够更好地减少每条指令的时间,同时支持多发多射;
2)指令集采用目前主流的精简指令,现大约有60条,本指令集最大可以支持1024条,在处理器的位超过1024位时,才需要升级;
3)在任务切换时,61、62号寄存器的值不需要保存,其每行数据的长度为32位,在任务切换时把寄存器的值放在里面,执行该任务时把数据从里面取出,可减少处理器从内存里查找数据所用的时间;
4)操作系统通过数据移动指令赋值37至39号寄存器,能更有效地分配计算机内存空间;
5)从计算机硬件层面保护了系统资源,克服了传统处理器通过软件保护和固定分段保护来防止应用程序非法访问的不足,可有效防止应用程序的非法访问。
附图说明
图1为内存地址弹性保护方法流程图。
本发明的实施方式
下面结合附图进一步详细描述本发明的技术方案,但本发明的保护范围不局限于以下所述。
一种高性能微处理器寄存器,其特征在于:它包括:
用于接电源最低电位的永远为0的0号寄存器;
用作累加器的1~8号寄存器;
用作乘法时的高位,除法指令的商的9号寄存器;
用作乘法时的低位,除法指令的模的10号寄存器;
用作返回用户模式时的指针、页的11、12号寄存器;
用作处理器在用户模式时的指令指针、页的13、14号寄存器;
用作处理器在特权模式时的指令指针、页的15、16号寄存器;
用作处理器在中断模式时的指令指针、页的17、18号寄存器,其页只有处理器在ker mode和int mode下才被数据移动指令赋值,如果处理器在soft mode和urs mode,则不能赋值并产生异常;
用作软件模式的指令指针、页的19、20号寄存器,其页只有处理器在ker mode、int mode和soft mode下才被数据移动指令赋值,如果处理器在urs mode,则不能赋值并产生异常;
用作堆栈指针、页的21、22号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的23、24号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的25、26号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的27、28号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作页寄存器的指针、页的29、30号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
用作状态寄存器的31号寄存器;
用作页目录寄存器的32号寄存器,保存虚拟地址转换式的页目录低20位有效,高12位强制为0,否则在以后的产品中产生不可预知的错误异常;
用作定时器(timer)的33~36号寄存器,当timer使能后,处理器每经过一个时钟寄存器的值加1,溢出时产生异常;
分别用作kenend、intend和softend寄存器的37~39号寄存器,在计算机的内存不大于4GB,在页大小为4kb时低20位有效,高12位必须为0,否则产生指令错误异常;
用作异常中断寄存器的40号寄存器,15位为1开启中断,反之不开启;16位为1开启异常,反之不开启;
用作页异常线性地址的41号寄存器;
用作多任务模式下的页开始、结束位置的42、43号寄存器,当操作系统开启了多任务保护模式,当用户页的值在42、43号寄存器值之外时,处理器产生出界异常;
用作虚拟模式下的页开始、结束位置的44、45号寄存器,0号版本的内核暂时保留;
用作tlb入口的46~50号寄存器,该寄存器的21,22,23位的值是000,001,010,011,100,101,110,111,其中,011,100,101,110保留,供处理器架构升级用,000作为0级cache的地址使用,001作为1级cache的地址使用,010作为2级cache的地址使用,111作为处理器的全局地址,供io输入输出块使用,高9位是处理器的处理核心号码,供处理器升级成多核心时使用,在操作系统为单核心时强制为0,低20位是cache的块号;
用作内部dma的51~53号寄存器,51号寄存器为地址的开始地址,52号寄存器为地址结束处(都是块号);
53号寄存器保留;
54号寄存器保留;
用作分页模式下的局部地址转换的奇54、55号寄存器;
57~60号寄存器分别作为config0、config1、config2、config3,其中,对于config0,25号寄存器低4位分别使能0,1,2,3号时钟,第4位为1开启分页机制,为0时开启分页码机制,第5位多任务保护模式,操作系统检查当前usr mode的指令页码的范围是不是在42、43号寄存器之内,不在其内,则产生异常;其它位保留,config1、config2、config3分别保留;
分别用作trp、trpp寄存器的61、62号寄存器,在任务切换时,61、62号寄存器的值无需保存,其每行的数据长度为32位,在任务切换时把寄存器的值放在里面,执行该任务时将数据取出;
63号寄存器cpu属性如下:
处理器核心数 9bit【31,23】
处理器当前核心号 9bit【22,14】
处理器的位数 3bit【2,0】
其它位保留;
其中,32~63号寄存器的值只有运行在特权模式下才能被赋值。37~39号寄存器只有在ken mode下才能被赋值,其他mode赋值产生异常。
指令集手册:
mov 指令
mov,其为数据移动指令,该指令可以分成两类:立即数移动指令;寄存器间移动指令。
[0013] (1)立即数移动指令可以分成有符号立即数移动指令,无符号立即数移动指令:
A:有符号立即数移动指令
源操作数 目的操作数(该处是目的寄存器)
movsb 立即数 , %n 8位有符号移动指令
movsw 立即数 , %n 16位有符号移动指令
movsd 立即数 , %n 32位有符号移动指令
movsl 立即数 , %n 64位有符号移动指令(在32位处理器中保留)
B:无符号立即数移动指令
源操作数 目的操作数(该处是目的寄存器)
movb 立即数 , %n 8位有符号移动指令
movw 立即数 , %n 16位有符号移动指令
movd 立即数 , %n 32位有符号移动指令
movl 立即数 , %n 64位有符号移动指令(在32位处理器中保留)
C: 寄存器间移动指令:
mov %n ,%m(把源操作数所在的寄存器%n,送到目的操作数所在寄存器%m)
(2)特殊指令
指令 注释
bck 源操作数为11号寄存器,目的操作数为12号寄存器,返回用户模式,在跳转指令时,把用户模式的指针,页放入对应的寄存器。
usr 无源目的操作数,处理器进入用户模式。
ken 无源目的操作数,处理器进入核心模式。
int 无源目的操作数,处理器进入中断模式。
saft 无源目的操作数,处理器进入软件模式。
pop 从堆栈页中弹出数据指令,弹出,压人的数据长度为处理器的位数。
push 把寄存器中的数据压人堆栈中,弹出,压人的数据长度为处理器的位数。
set 置位命令,把目的操作数的(源操作数位)置1。
clr 清位命令,把目的操作数的(源操作数位)置0。
tst 测试命令,测试目的操作数的(源操作数位)位,结果放入(31号寄存器)状态寄存器的27位。
m32 32位无符号数乘法指令,结果放到,低位放到10号寄存器,高位放到9号寄存器中。
sm32 32位有符号数乘法指令,结果放到,低位放到10号寄存器,高位放到9号寄存器中。
d32 32位无符号数除法指令,结果放到,结果放到9号寄存器,模放到10号寄存器中。
Sd32 32位有符号数乘法指令,结果放到,结果放到9号寄存器,模放到10号寄存器中。
rst rest(只有处理器处在ken mode,才能执行,否则产生异常)。
如图1所示,一种高性能微处理器寄存器的内存地址弹性保护方法,它包括以下步骤:
S1:操作系统通过赋值37、38、39号寄存器,分配处理器在各种模式下的内存区间;
S2:处理器检查14号寄存器的内容是否在39号寄存器中页值之内,如果在其范围之内,则产生异常,如果不在其范围之内,则不产生异常;
S3:处理器检查16号寄存器的页码是否在0号到37号寄存器页码范围中,如果在其范围之内,则不产生异常,如果不在其范围之内,则产生异常;
S4:处理器检查18号寄存器的页码是否在37号寄存器和38号寄存器范围中,如果在其范围之内,则不产生异常,如果不在其范围之内,则产生异常;
S5:处理器检查20号寄存器的内容是否在38号寄存器和39号寄存器中页值之内,如果在其范围之外,则产生异常;
S6:处理器把异常号送到异常中断寄存器(40号寄存器)中,并且进入int mode,当前处理器的指令页是18寄存器,指令指针是17号寄存器,处理器通过执行操作系统的异常中断处理程序,从而防止应用程序的非法访问。

Claims (2)

  1. 一种高性能微处理器寄存器,其特征在于:它包括:
    永远为0的0号寄存器;
    用作累加器的1~8号寄存器;
    用作乘法时的高位,除法指令的商的9号寄存器;
    用作乘法时的低位,除法指令的模的10号寄存器;
    用作返回用户模式时的指针、页的11、12号寄存器;
    用作处理器在用户模式时的指令指针、页的13、14号寄存器;
    用作处理器在特权模式时的指令指针、页的15、16号寄存器;
    用作处理器在中断模式时的指令指针、页的17、18号寄存器,其页只有处理器在ken mode和int mode下才被数据移动指令赋值,如果处理器在soft mode和urs mode,则不能赋值并产生异常;
    用作软件模式的指令指针、页的19、20号寄存器,其页只有处理器在ken mode、int mode和soft mode下才被数据移动指令赋值,如果处理器在urs mode,则不能赋值并产生异常;
    用作堆栈指针、页的21、22号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
    用作页寄存器的指针、页的23、24号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
    用作页寄存器的指针、页的25、26号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
    用作页寄存器的指针、页的27、28号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
    用作页寄存器的指针、页的29、30号寄存器,当给其控制的0级cache赋值时,检查其特权级,当特权级值小于等于它才被赋值,否则产生异常;
    用作状态寄存器的31号寄存器;
    用作页目录寄存器的32号寄存器,保存虚拟地址转换式的页目录低20位有效,高12位强制为0,否则在以后的产品中产生不可预知的错误异常;
    用作定时器timer的33~36号寄存器,当timer使能后,处理器每经过一个时钟寄存器的值加1,溢出时产生异常;
    分别用作kenend、intend和softend寄存器的37~39号寄存器,在计算机的内存不大于4GB,在页大小为4kb时低20位有效,高12位必须为0,否则产生指令错误异常;
    用作异常中断寄存器的40号寄存器,15位为1开启中断,反之不开启;16位为1开启异常,反之不开启;
    用作页异常线性地址的41号寄存器;
    用作多任务模式下的页开始、结束位置的42、43号寄存器,当操作系统开启多任务保护模式,当用户页的值在42、43号寄存器值之外时,处理器产生出界异常;
    用作虚拟模式下的页开始、结束位置的44、45号寄存器,0号版本的内核暂时保留;
    用作tlb入口的46~50号寄存器,该寄存器的21,22,23位的值是000,001,010,011,100,101,110,111,其中,011,100,101,110保留,供处理器架构升级用,000作为0级cache的地址使用,001作为1级cache的地址使用,010作为2级cache的地址使用,111作为处理器的全局地址,供io输入输出块使用,高9位是处理器的处理核心号码,供处理器升级成多核心时使用,在操作系统为单核心时强制为0,低20位是cache的块号;
    用作内部dma的51~53号寄存器,51号寄存器为地址的开始地址,52号寄存器为地址结束处;
    53号寄存器保留;
    54号寄存器保留;
    用作分页模式下的局部地址转换的奇54、55号寄存器;
    57~60号寄存器分别作为config0、config1、config2、config3,其中,对于config0,25号寄存器低4位分别使能0,1,2,3号时钟,第4位为1开启分页机制,为0时开启分页码机制,第5位多任务保护模式,操作系统检查当前usr mode的指令页码的范围是否在42、43号寄存器之内,不在其内,则产生异常;其它位保留,config1、config2、config3分别保留;
    分别用作trp、trpp寄存器的61、62号寄存器,在任务切换时,61、62号寄存器的值无需保存,其每行的数据长度为32位,在任务切换时把寄存器的值放在里面,执行该任务时将数据取出;
    63号寄存器cpu属性如下:
    处理器核心数 9bit【31,23】
    处理器当前核心号 9bit【22,14】
    处理器的位数 3bit【2,0】
    其它位保留;
    其中,32~63号寄存器的值只有运行在ker mode,int mode和soft mode才能被赋值。
  2. 一种高性能微处理器寄存器的内存地址弹性保护方法,其特征在于,它包括以下步骤:
    S1:操作系统通过赋值37、38、39号寄存器,分配处理器在各种模式下的内存区间;
    S2:处理器检查14号寄存器的内容是否在39号寄存器中页值之内,如果在其范围之内,则产生异常,如果不在其范围之内,则不产生异常;
    S3:处理器检查16号寄存器的页码是否在0号到37号寄存器页码范围中,如果在其范围之内,则不产生异常,如果不在其范围之内,则产生异常;
    S4:处理器检查18号寄存器的页码是否在37号寄存器和38号寄存器范围中,如果在其范围之内,则不产生异常,如果不在其范围之内,则产生异常;
    S5:处理器检查20号寄存器的内容是否在38号寄存器和39号寄存器中页值之内,如果在其范围之外,则产生异常;
    S6:处理器把异常号送到异常中断寄存器中,并且进入int mode,当前处理器的指令页是18寄存器,指令指针是17号寄存器,处理器通过执行操作系统的异常中断处理程序,从而防止应用程序的非法访问。
PCT/CN2014/072820 2013-03-07 2014-03-03 一种高性能微处理器寄存器及其内存地址弹性保护方法 WO2014135052A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310072972.7 2013-03-07
CN201310072972.7A CN103150521B (zh) 2013-03-07 2013-03-07 一种高性能微处理器寄存器及其内存地址弹性保护方法

Publications (1)

Publication Number Publication Date
WO2014135052A1 true WO2014135052A1 (zh) 2014-09-12

Family

ID=48548593

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/072820 WO2014135052A1 (zh) 2013-03-07 2014-03-03 一种高性能微处理器寄存器及其内存地址弹性保护方法

Country Status (2)

Country Link
CN (1) CN103150521B (zh)
WO (1) WO2014135052A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114546495A (zh) * 2021-09-03 2022-05-27 北京睿芯众核科技有限公司 适用于risc-v架构处理器的地址属性检查的方法及系统

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103150521B (zh) * 2013-03-07 2015-05-13 周海林 一种高性能微处理器寄存器及其内存地址弹性保护方法
CN104991869B (zh) * 2015-07-31 2017-11-10 成都腾悦科技有限公司 一种微处理器存储管理方法
CN107301037B (zh) * 2016-04-15 2021-03-30 龙芯中科技术股份有限公司 操作系统内核的加载方法和装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1641567A (zh) * 2004-01-16 2005-07-20 智权第一公司 自堆栈快取存储器进行快速推测性弹出操作方法及装置
CN101158891A (zh) * 2007-11-19 2008-04-09 中国科学院计算技术研究所 在非cisc处理器上进行浮点栈溢出检查的装置和方法
CN103150521A (zh) * 2013-03-07 2013-06-12 周海林 一种高性能微处理器寄存器及其内存地址弹性保护方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6779013B2 (en) * 2001-06-04 2004-08-17 Intel Corporation Floating point overflow and sign detection
CN1447244A (zh) * 2003-04-03 2003-10-08 杭州中天微系统有限公司 一种设计在cpu里的侦测缓冲区溢出的方法
CN1818822A (zh) * 2005-02-07 2006-08-16 福建东方微点信息安全有限责任公司 缓冲区溢出攻击的检测方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1641567A (zh) * 2004-01-16 2005-07-20 智权第一公司 自堆栈快取存储器进行快速推测性弹出操作方法及装置
CN101158891A (zh) * 2007-11-19 2008-04-09 中国科学院计算技术研究所 在非cisc处理器上进行浮点栈溢出检查的装置和方法
CN103150521A (zh) * 2013-03-07 2013-06-12 周海林 一种高性能微处理器寄存器及其内存地址弹性保护方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114546495A (zh) * 2021-09-03 2022-05-27 北京睿芯众核科技有限公司 适用于risc-v架构处理器的地址属性检查的方法及系统
CN114546495B (zh) * 2021-09-03 2022-12-20 北京睿芯众核科技有限公司 适用于risc-v架构处理器的地址属性检查的方法及系统

Also Published As

Publication number Publication date
CN103150521A (zh) 2013-06-12
CN103150521B (zh) 2015-05-13

Similar Documents

Publication Publication Date Title
WO2014135052A1 (zh) 一种高性能微处理器寄存器及其内存地址弹性保护方法
US6851072B2 (en) Fault management and recovery based on task-ID
TWI516958B (zh) 用於處理器加速器介面的虛擬化的處理器、系統及方法
WO2018036000A1 (zh) 应用程序跨系统运行的方法和装置
US20030140244A1 (en) Secure mode for processors supporting MMU
WO2018113239A1 (zh) 一种卷积神经网络的数据调度方法、系统及计算机设备
JP3663317B2 (ja) コンピュータ・システム
WO2013017037A1 (zh) 一种soc芯片的验证方法及系统
WO2021118125A1 (ko) 안드로이드 어플리케이션에 의해 실행 가능한 보안 컨테이너 구축 장치, 방법 및 그 프로그램이 기록된 컴퓨터로 읽을 수 있는 기록매체
WO2014189275A1 (en) Apparatus and method of recognizing external device in a communication system
WO2022037182A1 (zh) 一种计算机设备、异常处理的方法以及中断处理的方法
US7712098B2 (en) Data transfer controlled by task attributes
WO2013174210A1 (zh) 一种闪存设备中数据存储的方法及装置
WO2014025212A1 (en) Method and apparatus for modelling power consumption of integrated circuit
WO2015180434A1 (zh) 一种数据库集群管理数据的方法、节点及系统
WO2018076890A1 (zh) 数据备份的方法、装置、存储介质、服务器及系统
EP1313014B1 (en) Interruptible and re-entrant instruction for cleaning a region of a cache memory
WO2015016615A1 (ko) 프로세서 및 메모리 제어 방법
WO2013013486A1 (zh) 一种将pdf格式文件转换为epub格式的方法及系统
WO2014077614A1 (en) Anti-malware system, method of processing data in the same, and computing device
WO2019177265A1 (ko) 랜섬웨어 대응을 위한 데이터 처리 방법, 이를 실행시키는 프로그램 및 상기 프로그램을 기록한 컴퓨터 판독 가능한 기록매체
EP0196244A3 (en) Cache mmu system
Yano et al. V60/V70 microprocessor and its systems support functions
WO2015080440A1 (en) Method and processor for executing instructions, method and apparatus for encoding instructions, and recording medium therefor
WO2021025490A1 (ko) 프로세서, 프로세서의 동작 방법 및 이를 포함한 전자 장치

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14760659

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14760659

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 15/02/2016)