interrupt

General Protection Fault when trying to `sti`

微笑、不失礼 提交于 2021-01-05 09:23:22
问题 Trying to implement hardware interrupts on a test bootloader. Exceptions are working(thus found it is GPF). When trying to sti , a GPF is occured. Here is my main code: cli lgdt [gdt_desc] lidt [idt_desc] mov eax, cr0 or eax, 1 mov cr0, eax jmp 0x8:bit_32 bit_32: [bits 32] mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax mov eax, 0x8000 mov esp, eax mov ebp, esp sti ; exception raised This is how my GDT looks like: start_gdt: null: dd 0x0 dd 0x0 code: dw 0xffff dw 0x0 db

General Protection Fault when trying to `sti`

蹲街弑〆低调 提交于 2021-01-05 09:23:18
问题 Trying to implement hardware interrupts on a test bootloader. Exceptions are working(thus found it is GPF). When trying to sti , a GPF is occured. Here is my main code: cli lgdt [gdt_desc] lidt [idt_desc] mov eax, cr0 or eax, 1 mov cr0, eax jmp 0x8:bit_32 bit_32: [bits 32] mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax mov eax, 0x8000 mov esp, eax mov ebp, esp sti ; exception raised This is how my GDT looks like: start_gdt: null: dd 0x0 dd 0x0 code: dw 0xffff dw 0x0 db

Interrupting instruction in the middle of execution

筅森魡賤 提交于 2020-12-23 09:56:14
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Interrupting instruction in the middle of execution

北城以北 提交于 2020-12-23 09:52:28
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Interrupting instruction in the middle of execution

六眼飞鱼酱① 提交于 2020-12-23 09:52:27
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Interrupting instruction in the middle of execution

て烟熏妆下的殇ゞ 提交于 2020-12-23 09:52:17
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Does a thread need to be in a RUNNABLE state before it can be interrupted?

半城伤御伤魂 提交于 2020-12-12 11:54:46
问题 Is it necessary for a thread in java to be in ready state before it gets interrupted by interrupt method? I tried to check this by typing the above given code below. class MyThread extends Thread { public void run() { try { for(int i =0;i<10;i++) { System.out.println("I am lazy thread"); Thread.sleep(2000); } } catch(InterruptedException e) { System.out.println("I got interrupted"); } } } public class SleepAndInterruptDemonstrationByDurga { public static void main(String[] args) { MyThread t=

Does a thread need to be in a RUNNABLE state before it can be interrupted?

醉酒当歌 提交于 2020-12-12 11:54:30
问题 Is it necessary for a thread in java to be in ready state before it gets interrupted by interrupt method? I tried to check this by typing the above given code below. class MyThread extends Thread { public void run() { try { for(int i =0;i<10;i++) { System.out.println("I am lazy thread"); Thread.sleep(2000); } } catch(InterruptedException e) { System.out.println("I got interrupted"); } } } public class SleepAndInterruptDemonstrationByDurga { public static void main(String[] args) { MyThread t=

C/C++: How to exit sleep() when an interrupt arrives?

和自甴很熟 提交于 2020-11-25 03:33:17
问题 I'm looking for a way to exit sleep when an user interrupt arrives - its important to exit sleep rather than do this: interrupt sleep , do ISR processing, and go back to sleep - which is what I'm finding solutions for. I'm looking for something like this in C++ - an equivalent in C is even better: void * timer_thread(void*dummy) { while(1) { // Check if some callbacks are to be given // when all are given, Determine x duration to sleep try { sleep(x); } except(/* the except block should hit

C/C++: How to exit sleep() when an interrupt arrives?

你说的曾经没有我的故事 提交于 2020-11-25 03:29:31
问题 I'm looking for a way to exit sleep when an user interrupt arrives - its important to exit sleep rather than do this: interrupt sleep , do ISR processing, and go back to sleep - which is what I'm finding solutions for. I'm looking for something like this in C++ - an equivalent in C is even better: void * timer_thread(void*dummy) { while(1) { // Check if some callbacks are to be given // when all are given, Determine x duration to sleep try { sleep(x); } except(/* the except block should hit