Wednesday, October 20, 2010

C + + / CLI object of speculation recorded the Object Layout


C + + / CLI is a relatively pure C + +, support the creation of managed reference object, managed object to allocate memory from the virtual machine and management, the programmer can no longer worry about the memory leak problem. In fact, that white is the equivalent of their own to create a memory pool, and the virtual machine actually do so.

In the CLI, all classes derived from Object, including the value of this int. So the internal structure of how the Object like? Vm code through the research, you can see in general is structured as follows:




Users Save handle to a managed object, in fact, can be seen as a pointer to a Object pointer, which contains a MethodTable in Object pointer, this type of information preserved MethodTable and some function, which is like the same virtual function pointer. Many of the operations are accomplished through the pointer, such as Allocate (), such as Box (), UnBox () and so on. Followed behind in MethodTable is the real data.

This MethodTable is very core vm inside a class, it can be done by a lot of action.






Recommended links:



3GPP Converter



My favorite Multimedia Creation Tools



States United States To Transfer?



ZHONGGUANCUN hand new countryside



c # and class Differences in the structure



Patriot mp3 fashion stakes



MP4 to 3GP



Comparison of windows and linux systems



Why engage in career planning?



How to strengthen the promotion effect of media and public relations?



SoftBrands, Because Focusing So Professional



Vertical Market Apps Comments



MP4 to Flash



Thursday, October 7, 2010

80386 interrupt and exception


In addition to maintaining 8086/80386 80386 related functions, but also enhanced interrupt handling capability, and the concept of "exception" concept. This article will introduce the 80386 interrupt and exception mechanism. Download the article all the source code.

8086/8088 to break into the internal interrupt and external interrupt two categories. In order to support multi-tasking and virtual memory and other functions, 80,386 external interrupt known as the "break", the internal interrupt as "abnormal." As with the 8086/8088, 80386 usually between the two commands to respond to interrupt or exception. 80386 handle up to 256 interrupt or exception.

1. Interrupted

On the 80386, the interrupt is caused by asynchronous external events. External events and interrupt response and is not related to the implementation of the directive. Typically, the interrupt to indicate I / O device has completed an operation. As with the 8086/8088, 80386 INTR and NMI are two pins accept external interrupt request signal. INTR accepted maskable interrupt request. NMI received interrupt request can not be shielded. In 80386, the flag register IF flag in EFLAGS to decide whether screening can shield interrupt request.

External hardware through an interrupt request signal INTR the same time, but also to give an 8-bit processor interrupt vector. Processor in response to maskable interrupt request, read the paper by the external hardware interrupt vector number. Processor interrupt vector of this number and does not provide. But in the specific computer system, the system must meet the set of software and hardware, so given the interrupt vector number corresponds not only with the external interrupt sources and interrupt vector number used to avoid the appearance of conflict. 8259A programmable interrupt controller chip can work with the 80386, can be set to the processor according to the interrupt vector number, can handle the priority interrupt request. Each 8259A chip can support 8 interrupt request signal, if you use 9 8259A chip (a master piece, eight from the film), would enable a single pin INTR 80386 accepted up to 64 interrupt sources, interrupt request signal .

Processor does not mask the interrupt request from the NMI. Processor in response to NMI interrupt is not received from the external hardware interrupt vector number. And 8086/8088, as in 80386, the non-maskable interrupt the corresponding interrupt vector number is fixed at 2. For non-maskable interrupt nesting, when receiving an NMI interrupt, the processor again in response to the internal shielding of the NMI, the implementation of the screening process until after the end of the interrupt return instruction IRET. Therefore, NMI handler should be the end of IRET instruction.

2. Exception

80386 instruction exception is detected during the implementation of irregular or illegal conditions are present. Abnormality in the execution of the instructions have a direct link. For example, the implementation of the divide instruction, the divisor is equal to 0. Again, the implementation of instruction privilege level is not correct when found. When these situations occur, the directive can not be completed successfully. Software interrupt instruction "INT n" and "INTO" also classified as abnormal and not interrupt, because the implementation of these instructions produced anomalies.

80386 identify different types of anomalies, and to give each category a different interrupt vector number. After the exception occurs, the processor so as to respond to interrupt handling exceptions. That under the interrupt vector number, switch to the corresponding interrupt handler. This interrupt handler is called the exception handler may be more appropriate.

Abnormal according to whether the procedure caused the restoration and recovery point can be different, to be further classified as abnormal fault (Fault), trap (Trap) and suspension (Abort). We were the corresponding exception handler is called fault handler, trap handlers and termination handlers.

Failure is caused by abnormalities in the instruction before it is notified to the system anomaly an exception. That the fault is 80386 can be excluded. When control is transferred to the fault handler, the saved CS and EIP values break point to lead to failure of the command. Thus, the fault handler to troubleshooting, the implementation of the IRET to return to the program caused by failure to execute, just lead to failure of command can be re-implemented. This re-run, no additional operating system software to participate. Failure of the findings may begin before the command may also be in the instruction execution period. If failures are detected during instruction execution, then the suspension of fault instruction, and instruction operands to restore the value before the instruction started. This will ensure the re-implementation of fault instruction to get the right results. For example, during the execution of an instruction, if we find there is no section, then stop the implementation of the directive, and notify the system to produce Fault, the corresponding segment fault handler can load the troubleshooting section of way, after which the original instruction can be successfully implemented, at least not non-existent fault segment occurred.

Trap is caused by abnormalities in the following instructions to inform the anomalies An exception to the system. When control is transferred to the exception handler, the saved CS and EIP break point to lead to trap the value of the next instruction to execute instructions. The next instruction to be executed, not necessarily the next instruction. Therefore, the trap handler does not always save the breakpoints according to the anti-push identify an exception instruction. When the trap handler in turn, lead to the completion of trap instruction to be normal, it is possible to change a register or memory cell. Software interrupt instruction, single-step exception is the example of the trap.

Suspension is a serious situation in the system, an exception notification system. Caused by the suspension order can not be determined. Produce termination, is the implementation of the program can not be reinstated. System receives the suspension, the processing procedure to re-establish the system forms, and may restart the operating system. Hardware failures and system tables in the illegal value or inconsistent value is suspended example.

3. Priority

In an instruction execution period into more than one interrupt is detected, or abnormal, then press the priorities listed in the table notification system. The highest priority interrupt or exception notification system, other lower-priority exception being abandoned, while the higher-priority interrupt will remain hanging.

80386 responses

Interrupt / exception priority interrupt / exception types the highest priority fault other fault 鈫?debug trap instruction INT n and INTO 鈫?鈫?NMI debug trap minimum disruption 鈫?INTR interrupt






相关链接:



Good Browsers



Introduction Games Simulation



PLM on the 411



MTS to AVI



Expert Anti-Virus Tools



Utilize all practical use OF small floating window all captures Thunder 5.9



RMVB to MP4



The "job" into a "job search" strategy



Storage Debugging



After the operator Completed three items off our support AVS



11n vs. 150M and 300M internal battle cost the king



Nokia 6111 A Compact Sliding Handset



Dealers should not be Fishing in 10



XviD to WMV



Create a simple window