Added comments to reg_dump and deleted junk

This commit is contained in:
lucic71 2022-06-28 19:40:51 +03:00
parent 8afd4661b5
commit 459e7d54b8
1 changed files with 8 additions and 9 deletions

View File

@ -1,16 +1,22 @@
.global reg_dump
.extern printf
.text
.text
/*
* reg_dump:
* ---------
* -------------
*
* Save the context of caller in prev_* memory locations and print them.
*
* Registers must be saved before calling other routines because they may
* change the registers.
*
* 4 is added to prev_esp because current esp has the return address. eip
* is fetched by dereferencing esp.
*/
reg_dump:
mov %esp, prev_esp
@ -43,42 +49,36 @@ reg_dump:
add $0x08, %esp
push prev_edx
push $EDX_FMT
call printf
add $0x08, %esp
push prev_ebx
push $EBX_FMT
call printf
add $0x08, %esp
push prev_esp
push $ESP_FMT
call printf
add $0x08, %esp
push prev_ebp
push $EBP_FMT
call printf
add $0x08, %esp
push prev_esi
push $ESI_FMT
call printf
add $0x08, %esp
push prev_edi
push $EDI_FMT
call printf
@ -119,4 +119,3 @@ reg_dump:
prev_esi: .skip 4
prev_edi: .skip 4
prev_eip: .skip 4