From d6be5aafe29d9b5815bbaf545b3dba7af1e6c401 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 27 Nov 2020 19:11:58 +0500 Subject: [PATCH] Add function "kernaux_arch_i386_hang" --- include/kernaux/arch/i386.h | 2 ++ src/arch/i386.S | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/kernaux/arch/i386.h b/include/kernaux/arch/i386.h index 02fcf6b..423493c 100644 --- a/include/kernaux/arch/i386.h +++ b/include/kernaux/arch/i386.h @@ -5,6 +5,8 @@ extern "C" { #endif +void kernaux_arch_i386_hang() __attribute__((noreturn)); + unsigned long kernaux_arch_i386_read_cr0(); unsigned long kernaux_arch_i386_read_cr4(); diff --git a/src/arch/i386.S b/src/arch/i386.S index d66ccf9..d93d289 100644 --- a/src/arch/i386.S +++ b/src/arch/i386.S @@ -1,9 +1,15 @@ +.global kernaux_arch_i386_hang .global kernaux_arch_i386_read_cr0 .global kernaux_arch_i386_read_cr4 .global kernaux_arch_i386_write_cr0 .global kernaux_arch_i386_write_cr3 .global kernaux_arch_i386_write_cr4 +kernaux_arch_i386_hang: + cli + hlt + jmp kernaux_arch_i386_hang + kernaux_arch_i386_read_cr0: mov %cr0, %eax ret