A update
This commit is contained in:
62
misc_asm.s
Normal file
62
misc_asm.s
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
A bunch of functions I could have written in C (or not), but decided not to,
|
||||
Mostly so I could get more experience in assembler.
|
||||
*/
|
||||
|
||||
/*
|
||||
DO NOT USE "pusha" AND/OR "popa"!!!
|
||||
THEY ARE DEPRECATED (or something like that)
|
||||
AND SHOULD NOT BE USED!!!
|
||||
INSTEAD PUSH/POP REGISTERS ON/OFF THE STACK INDIVIDUALLY!!!
|
||||
*/
|
||||
|
||||
|
||||
.section .text
|
||||
|
||||
.global _enable_paging_asm
|
||||
|
||||
.global _push_regs
|
||||
.global _pop_regs
|
||||
|
||||
.global _hang_asm
|
||||
|
||||
_enable_paging_asm:
|
||||
push %eax
|
||||
|
||||
mov %cr0, %eax
|
||||
or $0x80000000, %eax
|
||||
mov %eax, %cr0
|
||||
|
||||
pop %eax
|
||||
|
||||
ret
|
||||
|
||||
_push_regs:
|
||||
push %eax
|
||||
push %ebx
|
||||
push %ecx
|
||||
push %edx
|
||||
push %esi
|
||||
push %edi
|
||||
push %esp
|
||||
push %ebp
|
||||
|
||||
ret
|
||||
|
||||
_pop_regs:
|
||||
pop %ebp
|
||||
pop %esp
|
||||
pop %edi
|
||||
pop %esi
|
||||
pop %edx
|
||||
pop %ecx
|
||||
pop %ebx
|
||||
pop %eax
|
||||
|
||||
ret
|
||||
|
||||
_hang_asm:
|
||||
hlt
|
||||
jmp _hang_asm
|
||||
|
||||
.section .data
|
Reference in New Issue
Block a user