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)
18 #define CBFS_STAGE_COMPRESSION 0
19 #define CBFS_STAGE_ENTRY (CBFS_STAGE_COMPRESSION + 4)
20 #define CBFS_STAGE_LOAD (CBFS_STAGE_ENTRY + 8)
21 #define CBFS_STAGE_LEN (CBFS_STAGE_LOAD + 8)
22 #define CBFS_STAGE_MEMLEN (CBFS_STAGE_LEN + 4)
26 input %esp: return address (not pointer to return address!)
27 output %eax: entry point
28 clobbers %ebx, %ecx, %edi
33 mov CBFS_HEADER_PTR, %eax
34 mov CBFS_HEADER_ROMSIZE(%eax), %ecx
38 mov CBFS_HEADER_OFFSET(%eax), %ecx
42 /* determine filename length */
60 add $CBFS_FILE_STRUCTSIZE, %edi /* edi = address of first byte after struct cbfs_file */
63 # zero flag set if strings are equal
67 mov CBFS_FILE_OFFSET(%ebx), %eax
70 add $CBFS_STAGE_ENTRY, %eax /* eax = ((cbfs_stage* (cbfs_file* ebx)->offset)->entry) */
76 sub $CBFS_FILE_STRUCTSIZE, %edi /* edi = # of walked bytes */
77 sub %edi, %esi /* esi = start of filename */
79 /* ebx = ecx = (current+offset+len+ALIGN-1) & ~(ALIGN-1) */
80 mov CBFS_FILE_OFFSET(%ebx), %ecx
83 mov CBFS_FILE_LEN(%ebx), %edi
86 mov CBFS_HEADER_PTR, %edi
87 mov CBFS_HEADER_ALIGN(%edi), %edi
94 /* if oldaddr >= addr, leave */
101 /* look if we should exit: did we pass into the bootblock already? */
102 mov CBFS_HEADER_PTR, %ecx
103 mov CBFS_HEADER_BOOTBLOCKSIZE(%ecx), %ecx
109 /* if bootblockstart >= addr (==we're still in the data area) , jump back */
118 /* if filemagic isn't found, move forward cbfs_header->align bytes */
119 mov CBFS_HEADER_PTR, %edi
120 mov CBFS_HEADER_ALIGN(%edi), %edi