1 #define CBFS_HEADER_PTR 0xfffffffc
3 #define CBFS_HEADER_MAGIC 0
4 #define CBFS_HEADER_VERSION (CBFS_HEADER_MAGIC + 4)
5 #define CBFS_HEADER_ROMSIZE (CBFS_HEADER_VERSION + 4)
6 #define CBFS_HEADER_BOOTBLOCKSIZE (CBFS_HEADER_ROMSIZE + 4)
7 #define CBFS_HEADER_ALIGN (CBFS_HEADER_BOOTBLOCKSIZE + 4)
8 #define CBFS_HEADER_OFFSET (CBFS_HEADER_ALIGN + 4)
10 #define CBFS_FILE_MAGIC 0
11 #define CBFS_FILE_LEN (CBFS_FILE_MAGIC + 8)
12 #define CBFS_FILE_TYPE (CBFS_FILE_LEN + 4)
13 #define CBFS_FILE_CHECKSUM (CBFS_FILE_TYPE + 4)
14 #define CBFS_FILE_OFFSET (CBFS_FILE_CHECKSUM + 4)
16 #define CBFS_FILE_STRUCTSIZE (CBFS_FILE_OFFSET + 4)
19 * input %esi: filename
20 * input %esp: return address (not pointer to return address!)
21 * output %eax: entry point
22 * clobbers %ebx, %ecx, %edi
27 mov CBFS_HEADER_PTR, %eax
28 mov CBFS_HEADER_ROMSIZE(%eax), %ecx
31 sub %ecx, %ebx /* rom base address in ebx */
32 mov CBFS_HEADER_OFFSET(%eax), %ecx
34 add %ecx, %ebx /* address where we start looking for LARCHIVEs */
36 /* determine filename length */
46 mov 0(%ebx), %edi /* Check for LARCHIVE header */
53 /* LARCHIVE header found */
55 add $CBFS_FILE_STRUCTSIZE, %edi /* edi = address of first byte after struct cbfs_file */
58 /* zero flag set if strings are equal */
62 mov CBFS_FILE_OFFSET(%ebx), %eax
69 sub $CBFS_FILE_STRUCTSIZE, %edi /* edi = # of walked bytes */
70 sub %edi, %esi /* esi = start of filename */
72 /* ebx = ecx = (current+offset+len+ALIGN-1) & ~(ALIGN-1) */
73 mov CBFS_FILE_OFFSET(%ebx), %ecx
76 mov CBFS_FILE_LEN(%ebx), %edi
79 mov CBFS_HEADER_PTR, %edi
80 mov CBFS_HEADER_ALIGN(%edi), %edi
87 /* if oldaddr >= addr, leave */
94 /* look if we should exit: did we pass into the bootblock already? */
95 mov CBFS_HEADER_PTR, %ecx
96 mov CBFS_HEADER_BOOTBLOCKSIZE(%ecx), %ecx
102 /* if bootblockstart >= addr (==we're still in the data area) , jump back */
111 /* if filemagic isn't found, move forward cbfs_header->align bytes */
112 mov CBFS_HEADER_PTR, %edi
113 mov CBFS_HEADER_ALIGN(%edi), %edi