1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Add assemnly code for enabling/disabling insterrupts and halting the CPU

This commit is contained in:
Achilleas Anagnostopoulos 2017-06-21 07:58:15 +01:00
parent d793300279
commit cd3199199b
2 changed files with 22 additions and 0 deletions

View File

@ -1,5 +1,14 @@
package cpu package cpu
// EnableInterrupts enables interrupt handling.
func EnableInterrupts()
// DisableInterrupts disables interrupt handling.
func DisableInterrupts()
// Halt stops instruction execution.
func Halt()
// FlushTLBEntry flushes a TLB entry for a particular virtual address. // FlushTLBEntry flushes a TLB entry for a particular virtual address.
func FlushTLBEntry(virtAddr uintptr) func FlushTLBEntry(virtAddr uintptr)

View File

@ -1,5 +1,18 @@
#include "textflag.h" #include "textflag.h"
TEXT ·EnableInterrupts(SB),NOSPLIT,$0
STI
RET
TEXT ·DisableInterrupts(SB),NOSPLIT,$0
CLI
RET
TEXT ·Halt(SB),NOSPLIT,$0
CLI
HLT
RET
TEXT ·FlushTLBEntry(SB),NOSPLIT,$0 TEXT ·FlushTLBEntry(SB),NOSPLIT,$0
INVLPG virtAddr+0(FP) INVLPG virtAddr+0(FP)
RET RET