cpu

How does the CPU knows which interrupt service routine to run against a hardware interrupt?

◇◆丶佛笑我妖孽 提交于 2019-12-02 06:23:17
For example, a key on a keyboard is press causing a hardware interrupt to be generated to the CPU, the CPU sends an acknowledgement to the interrupt controller. At the stage of the interrupt process, how does the CPU knows which interrupt service routine to run based on a key press on the keyboard? 来源: https://stackoverflow.com/questions/48110019/how-does-the-cpu-knows-which-interrupt-service-routine-to-run-against-a-hardware

port size does not match connection size

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 04:00:34
问题 I have write the code Alu.v module ALU( src1_i, src2_i, src3_i, src4_i, ctrl_i, result_o, zero_o ); //I/O ports input [32-1:0] src1_i; input [32-1:0] src2_i; input [4-1:0] src3_i;//shmat is 5 bits instruction[10:6] input [15-1:0] src4_i;//ori have to deal with 'zero-extended' number input [4-1:0] ctrl_i; output [32-1:0] result_o; output zero_o; //Internal signals reg [32-1:0] result_o; wire zero_o; //Parameter assign zero_o = (result_o == 0); //Main function always @(*) begin case(ctrl_i) 0

Counting Context Switches for Specific Process in Windows

妖精的绣舞 提交于 2019-12-02 03:53:53
What I would like to do is write a small program that continuously live counts the number of context switches that a specific process experiences per a sufficiently small unit of time. I have observed this functionality within the software "Process Explorer", so I know it is definitely possible. Unfortunately, I have very little idea of how to begin coding this and have so far been unable to find any helpful code snippets online. Thus, a small working example implementing a per process and per unit time live context switch count would be immensely helpful for me. Here's one way to do it - This

port size does not match connection size

自古美人都是妖i 提交于 2019-12-02 02:18:47
I have write the code Alu.v module ALU( src1_i, src2_i, src3_i, src4_i, ctrl_i, result_o, zero_o ); //I/O ports input [32-1:0] src1_i; input [32-1:0] src2_i; input [4-1:0] src3_i;//shmat is 5 bits instruction[10:6] input [15-1:0] src4_i;//ori have to deal with 'zero-extended' number input [4-1:0] ctrl_i; output [32-1:0] result_o; output zero_o; //Internal signals reg [32-1:0] result_o; wire zero_o; //Parameter assign zero_o = (result_o == 0); //Main function always @(*) begin case(ctrl_i) 0 :result_o <= src1_i & src2_i;//and 1 :result_o <= src1_i | src2_i;//or 2 :result_o <= src1_i + src2_i;/

CPUs in multi-core architectures and memory access

杀马特。学长 韩版系。学妹 提交于 2019-12-02 01:06:38
问题 I wondered how memory access is handled "in general" if ,for example, 2 cores of CPU try to access memory at the same time (over the memory controller)? Actually the same applies when a core and an DMA-enabled IO device try to access in the same way. I think, memory controller is smart enough to utilise the address bus and handle those requests concurrently, however I'm not sure what happens when they try to access to same location or when the IO operation monopolises the address bus and

During an x86 software interrupt, when exactly is a context switch made?

↘锁芯ラ 提交于 2019-12-02 00:29:37
I am asking this because I am trying to implement interrupts in my toy kernel. So, I know that when an interrupt occurs, the CPU pushes various bits of information onto the stack. However, everywhere I search online shows different information in different order being pushed. I also know that if the interrupt occurred in user mode (Ring 3), the CPU must switch to kernel mode (Ring 0) before it can execute the ISR. I think it has something to do with the TSS and ss and esp , however I am not sure. I have read various different explanations all over the internet and have not found any uniformity

CPUs in multi-core architectures and memory access

走远了吗. 提交于 2019-12-01 21:11:42
I wondered how memory access is handled "in general" if ,for example, 2 cores of CPU try to access memory at the same time (over the memory controller)? Actually the same applies when a core and an DMA-enabled IO device try to access in the same way. I think , memory controller is smart enough to utilise the address bus and handle those requests concurrently, however I'm not sure what happens when they try to access to same location or when the IO operation monopolises the address bus and there's no room for CPU to move on. Thx The short answer is "it's complex, but access can certainly

Is 8-byte alignment for “double” type necessary?

拥有回忆 提交于 2019-12-01 20:37:11
问题 I understand word-alignment, which makes the cpu only need to read once when reading an integer into a register. But is 8-byte alignment (let's assume 32bit system) for "double" necessary? What is the benefit? What will happen if the space for storing a "double" is just 4-byte alignment? 回答1: There are multiple hardware components that may be adversely affected by unaligned loads or stores. The interface to memory might be eight bytes wide and only able to access memory at multiples of eight

Is 8-byte alignment for “double” type necessary?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 19:04:00
I understand word-alignment, which makes the cpu only need to read once when reading an integer into a register. But is 8-byte alignment (let's assume 32bit system) for "double" necessary? What is the benefit? What will happen if the space for storing a "double" is just 4-byte alignment? There are multiple hardware components that may be adversely affected by unaligned loads or stores. The interface to memory might be eight bytes wide and only able to access memory at multiples of eight bytes. Loading an unaligned eight-byte double then requires two reads on the bus. Stores are worse, because

Do modern cpus skip multiplications by zero?

試著忘記壹切 提交于 2019-12-01 18:08:27
I would like to know if current cpus avoid multiplying two numbers when at least one of them is a zero. Thanks Modern CPUs - what do you mean by that? Do you mean most commonly used (like x86, AMD64, ARM) or most recently developed. Every processor architecture has it's own properties. Moreover, each company (like Intel or AMD) can make processor different way (that usually being company secret). As you question goes, I doubt that. You know, even checking if number is equal to zero twice prior EVERY multiplication is too much overhead, if you account how low percentage of multiply operations