add some comments to walkcbfs.S

Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6498 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2011-04-14 20:33:53 +00:00 committed by Stefan Reinauer
parent 31853d8976
commit 1fdfed1798
1 changed files with 11 additions and 10 deletions

View File

@ -16,11 +16,11 @@
#define CBFS_FILE_STRUCTSIZE (CBFS_FILE_OFFSET + 4) #define CBFS_FILE_STRUCTSIZE (CBFS_FILE_OFFSET + 4)
/* /*
input %esi: filename * input %esi: filename
input %esp: return address (not pointer to return address!) * input %esp: return address (not pointer to return address!)
output %eax: entry point * output %eax: entry point
clobbers %ebx, %ecx, %edi * clobbers %ebx, %ecx, %edi
*/ */
walkcbfs_asm: walkcbfs_asm:
cld cld
@ -28,10 +28,10 @@ walkcbfs_asm:
mov CBFS_HEADER_ROMSIZE(%eax), %ecx mov CBFS_HEADER_ROMSIZE(%eax), %ecx
bswap %ecx bswap %ecx
mov $0, %ebx mov $0, %ebx
sub %ecx, %ebx sub %ecx, %ebx /* rom base address in ebx */
mov CBFS_HEADER_OFFSET(%eax), %ecx mov CBFS_HEADER_OFFSET(%eax), %ecx
bswap %ecx bswap %ecx
add %ecx, %ebx add %ecx, %ebx /* address where we start looking for LARCHIVEs */
/* determine filename length */ /* determine filename length */
mov $0, %eax mov $0, %eax
@ -43,21 +43,22 @@ walkcbfs_asm:
2: 2:
add $1, %eax add $1, %eax
walker: walker:
mov 0(%ebx), %edi mov 0(%ebx), %edi /* Check for LARCHIVE header */
cmp %edi, filemagic cmp %edi, filemagic
jne searchfile jne searchfile
mov 4(%ebx), %edi mov 4(%ebx), %edi
cmp %edi, filemagic+4 cmp %edi, filemagic+4
jne searchfile jne searchfile
/* LARCHIVE header found */
mov %ebx, %edi mov %ebx, %edi
add $CBFS_FILE_STRUCTSIZE, %edi /* edi = address of first byte after struct cbfs_file */ add $CBFS_FILE_STRUCTSIZE, %edi /* edi = address of first byte after struct cbfs_file */
mov %eax, %ecx mov %eax, %ecx
repe cmpsb repe cmpsb
# zero flag set if strings are equal /* zero flag set if strings are equal */
jnz tryharder jnz tryharder
# we found it! /* we found it! */
mov CBFS_FILE_OFFSET(%ebx), %eax mov CBFS_FILE_OFFSET(%ebx), %eax
bswap %eax bswap %eax
add %ebx, %eax add %ebx, %eax