📄 ata.lst
字号:
GAS LISTING /tmp/ccpN3UVf.s page 1 1 .section .mdebug.abi32 2 .previous 3 .section .debug_abbrev,"",@progbits 4 $Ldebug_abbrev0: 5 .section .debug_info,"",@progbits 6 $Ldebug_info0: 7 .section .debug_line,"",@progbits 8 $Ldebug_line0: 9 0000 49010000 .text 9 02009600 9 00000101 9 FB0E0A00 9 01010101 10 $Ltext0: 11 .align 2 12 .globl ata_wait_busy 13 .ent ata_wait_busy 14 .type ata_wait_busy, @function 15 ata_wait_busy: 16 $LFB2: 17 .file 1 "/mnt/hgfs/boot/booter/source/ata.c" 1:/mnt/hgfs/boot/booter/source/ata.c **** #include "example.h" 2:/mnt/hgfs/boot/booter/source/ata.c **** #include "ata.h" 3:/mnt/hgfs/boot/booter/source/ata.c **** 4:/mnt/hgfs/boot/booter/source/ata.c **** void __inline ata_wait_busy(volatile uint8* status) 5:/mnt/hgfs/boot/booter/source/ata.c **** { 18 .loc 1 5 0 19 .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 20 .mask 0x00000000,0 21 .fmask 0x00000000,0 22 .set noreorder 23 .set nomacro 24 25 $L2: 6:/mnt/hgfs/boot/booter/source/ata.c **** while(*status & ATA_STATUS_BSY); // wait for not busy 26 .loc 1 6 0 27 0000 00008290 lbu $2,0($4) 28 0004 00160200 sll $2,$2,24 29 0008 03160200 sra $2,$2,24 30 000c FCFF4004 bltz $2,$L2 31 0010 00000000 nop 32 33 0014 0800E003 j $31 34 0018 00000000 nop 35 36 .set macro 37 .set reorder 38 $LFE2: 39 .end ata_wait_busy 40 .section .rodata.str1.4,"aMS",@progbits,1 41 .align 2 42 $LC0: 43 0000 53656374 .ascii "Sector %d\n\000" 43 6F722025 43 640A00 44 000b 00 .text 45 .align 2GAS LISTING /tmp/ccpN3UVf.s page 2 46 .globl ata_dump_sectors 47 .ent ata_dump_sectors 48 .type ata_dump_sectors, @function 49 ata_dump_sectors: 50 $LFB3: 7:/mnt/hgfs/boot/booter/source/ata.c **** } 8:/mnt/hgfs/boot/booter/source/ata.c **** 9:/mnt/hgfs/boot/booter/source/ata.c **** int ata_dump_sectors(short* buf, int sect, int n) 10:/mnt/hgfs/boot/booter/source/ata.c **** { 51 .loc 1 10 0 52 .frame $sp,40,$31 # vars= 0, regs= 6/0, args= 16, gp= 0 53 .mask 0x801f0000,-4 54 .fmask 0x00000000,0 55 .set noreorder 56 .set nomacro 57 58 001c D8FFBD27 addiu $sp,$sp,-40 59 $LCFI0: 60 0020 2000B4AF sw $20,32($sp) 61 $LCFI1: 62 0024 1C00B3AF sw $19,28($sp) 63 $LCFI2: 64 0028 1400B1AF sw $17,20($sp) 65 $LCFI3: 66 002c 2400BFAF sw $31,36($sp) 67 $LCFI4: 68 0030 1800B2AF sw $18,24($sp) 69 $LCFI5: 70 0034 1000B0AF sw $16,16($sp) 71 $LCFI6: 72 .loc 1 10 0 73 0038 21A0C000 move $20,$6 74 003c 2198A000 move $19,$5 11:/mnt/hgfs/boot/booter/source/ata.c **** int i; 12:/mnt/hgfs/boot/booter/source/ata.c **** for(i = 0; i < n; ++i) 75 .loc 1 12 0 76 0040 0D00C018 blez $6,$L11 77 0044 21880000 move $17,$0 78 79 0048 21808000 move $16,$4 80 004c 0000123C lui $18,%hi($LC0) 81 $L9: 82 $LBB2: 13:/mnt/hgfs/boot/booter/source/ata.c **** { 14:/mnt/hgfs/boot/booter/source/ata.c **** printf("Sector %d\n", sect+i); 83 .loc 1 14 0 84 0050 21287102 addu $5,$19,$17 85 0054 0000000C jal printf 86 0058 00004426 addiu $4,$18,%lo($LC0) 87 88 $LBE2: 89 .loc 1 12 0 90 005c 01003126 addiu $17,$17,1 91 $LBB3: 15:/mnt/hgfs/boot/booter/source/ata.c **** dump_memory(&buf[i*SECTOR_SIZE], SECTOR_SIZE); 92 .loc 1 15 0 93 0060 21200002 move $4,$16GAS LISTING /tmp/ccpN3UVf.s page 3 94 0064 0000000C jal dump_memory 95 0068 00020524 li $5,512 # 0x200 96 97 $LBE3: 98 .loc 1 12 0 99 006c 2A183402 slt $3,$17,$20 100 0070 F7FF6014 bne $3,$0,$L9 101 0074 00041026 addiu $16,$16,1024 102 103 $L11: 16:/mnt/hgfs/boot/booter/source/ata.c **** } 17:/mnt/hgfs/boot/booter/source/ata.c **** } 104 .loc 1 17 0 105 0078 2400BF8F lw $31,36($sp) 106 007c 2000B48F lw $20,32($sp) 107 0080 1C00B38F lw $19,28($sp) 108 0084 1800B28F lw $18,24($sp) 109 0088 1400B18F lw $17,20($sp) 110 008c 1000B08F lw $16,16($sp) 111 0090 0800E003 j $31 112 0094 2800BD27 addiu $sp,$sp,40 113 114 .set macro 115 .set reorder 116 $LFE3: 117 .end ata_dump_sectors 118 .align 2 119 .globl ata_read_sector 120 .ent ata_read_sector 121 .type ata_read_sector, @function 122 ata_read_sector: 123 $LFB4: 18:/mnt/hgfs/boot/booter/source/ata.c **** 19:/mnt/hgfs/boot/booter/source/ata.c **** int ata_read_sector(void* base, int sect, int n, short *buf, int reg_size) 20:/mnt/hgfs/boot/booter/source/ata.c **** { 124 .loc 1 20 0 125 .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 126 .mask 0x00000000,0 127 .fmask 0x00000000,0 128 .set noreorder 129 .set nomacro 130 131 .loc 1 20 0 132 0098 1000AC8F lw $12,16($sp) 133 009c 21588000 move $11,$4 134 00a0 2170A000 move $14,$5 135 $LBB4: 136 .loc 1 5 0 137 00a4 C0680C00 sll $13,$12,3 138 00a8 2310AC01 subu $2,$13,$12 139 $LBE4: 140 .loc 1 20 0 141 00ac 2178C000 move $15,$6 142 00b0 21C0E000 move $24,$7 143 $LBB5: 144 .loc 1 5 0 145 00b4 21184400 addu $3,$2,$4GAS LISTING /tmp/ccpN3UVf.s page 4 146 $L13: 147 $LBB6: 148 .loc 1 6 0 149 00b8 00006290 lbu $2,0($3) 150 00bc 00160200 sll $2,$2,24 151 00c0 03160200 sra $2,$2,24 21:/mnt/hgfs/boot/booter/source/ata.c **** // DPRINTF("\n"); 22:/mnt/hgfs/boot/booter/source/ata.c **** volatile uint8* regs = (volatile uint8*) base; 23:/mnt/hgfs/boot/booter/source/ata.c **** 24:/mnt/hgfs/boot/booter/source/ata.c **** ata_wait_busy(®s[reg_size*ATA_REG_STATUS]); 25:/mnt/hgfs/boot/booter/source/ata.c **** 26:/mnt/hgfs/boot/booter/source/ata.c **** //setup sector to read from 27:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_FEATURES] = 0; 28:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_SECTOR_COUNT] = n; 152 .loc 1 28 0 153 .loc 1 6 0 154 00c4 FCFF4004 bltz $2,$L13 155 00c8 40280C00 sll $5,$12,1 156 157 $LBE6: 158 $LBE5: 29:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_SECTOR_NUMBER] = (sect >> 0) & 0xff; 30:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_CYLINDER_LOW] = (sect >> 8) & 0xff; 31:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_CYLINDER_HIGH] = (sect >> 16) & 0xff; 32:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_DEVICE_HEAD] = (sect >> 24) & 0x0f | 0xe0; 159 .loc 1 32 0 160 00cc 031E0E00 sra $3,$14,24 161 .loc 1 29 0 162 00d0 2130AC00 addu $6,$5,$12 163 .loc 1 30 0 164 00d4 80200C00 sll $4,$12,2 165 .loc 1 32 0 166 00d8 E0FF0224 li $2,-32 167 00dc 0F006330 andi $3,$3,0xf 168 .loc 1 31 0 169 00e0 21388C00 addu $7,$4,$12 170 .loc 1 32 0 171 00e4 40400600 sll $8,$6,1 172 00e8 25186200 or $3,$3,$2 173 .loc 1 27 0 174 00ec 21506C01 addu $10,$11,$12 175 .loc 1 30 0 176 00f0 03120E00 sra $2,$14,8 177 .loc 1 28 0 178 00f4 2128AB00 addu $5,$5,$11 179 .loc 1 29 0 180 00f8 2130CB00 addu $6,$6,$11 181 .loc 1 30 0 182 00fc 21208B00 addu $4,$4,$11 183 .loc 1 27 0 184 0100 000040A1 sb $0,0($10) 185 .loc 1 31 0 186 0104 2138EB00 addu $7,$7,$11 187 .loc 1 28 0 188 0108 0000AFA0 sb $15,0($5) 189 .loc 1 32 0 190 010c 21400B01 addu $8,$8,$11GAS LISTING /tmp/ccpN3UVf.s page 5 191 .loc 1 29 0 192 0110 0000CEA0 sb $14,0($6) 193 .loc 1 31 0 194 0114 034C0E00 sra $9,$14,16 195 .loc 1 30 0 196 0118 000082A0 sb $2,0($4) 33:/mnt/hgfs/boot/booter/source/ata.c **** 34:/mnt/hgfs/boot/booter/source/ata.c **** if (n == 1) 197 .loc 1 34 0 198 011c 01000224 li $2,1 # 0x1 199 .loc 1 31 0 200 0120 0000E9A0 sb $9,0($7) 201 .loc 1 32 0 202 0124 000003A1 sb $3,0($8) 35:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_COMMAND] = 0x21; 203 .loc 1 35 0 204 .loc 1 34 0 205 0128 2900E211 beq $15,$2,$L29 206 012c 2310AC01 subu $2,$13,$12 207 36:/mnt/hgfs/boot/booter/source/ata.c **** else 37:/mnt/hgfs/boot/booter/source/ata.c **** regs[reg_size*ATA_REG_COMMAND] = 0xc4; 208 .loc 1 37 0 209 0130 21104B00 addu $2,$2,$11 210 0134 C4FF0324 li $3,-60 211 $L28: 212 0138 000043A0 sb $3,0($2) 213 $LBB7: 214 .loc 1 5 0 215 013c 2310AC01 subu $2,$13,$12 216 0140 21184B00 addu $3,$2,$11 217 $L18: 218 $LBB8: 219 .loc 1 6 0 220 0144 00006290 lbu $2,0($3) 221 0148 00160200 sll $2,$2,24 222 014c 03160200 sra $2,$2,24 223 0150 FCFF4004 bltz $2,$L18 224 0154 2320AC01 subu $4,$13,$12 225 226 $LBE8: 227 $LBE7: 228 0158 21188B00 addu $3,$4,$11 229 015c 00006290 lbu $2,0($3) 230 0160 08004230 andi $2,$2,0x8 38:/mnt/hgfs/boot/booter/source/ata.c **** 39:/mnt/hgfs/boot/booter/source/ata.c **** ata_wait_busy(®s[reg_size*ATA_REG_STATUS]); 40:/mnt/hgfs/boot/booter/source/ata.c **** 41:/mnt/hgfs/boot/booter/source/ata.c **** int i = 0; 231 .loc 1 41 0 232 .loc 1 6 0 233 0164 18004010 beq $2,$0,$L22 234 0168 21400000 move $8,$0 235 236 016c 00320F00 sll $6,$15,8 237 0170 1500C018 blez $6,$L22 238 0174 00000000 nopGAS LISTING /tmp/ccpN3UVf.s page 6 239 240 0178 21380003 move $7,$24 241 017c 21188000 move $3,$4 242 $L26: 42:/mnt/hgfs/boot/booter/source/ata.c **** while((regs[reg_size*ATA_REG_STATUS] & ATA_STATUS_DRQ) && i < ((SECTOR_SIZE/2)*n) ) // while DR 43:/mnt/hgfs/boot/booter/source/ata.c **** { 44:/mnt/hgfs/boot/booter/source/ata.c **** buf[i++] = *((uint16*) ®s[reg_size*ATA_REG_DATA]); 243 .loc 1 44 0 244 0180 00006295 lhu $2,0($11) 245 0184 01000825 addiu $8,$8,1 246 $LBB9: 247 .loc 1 5 0 248 0188 21186B00 addu $3,$3,$11 249 $LBE9: 250 .loc 1 44 0 251 018c 0000E2A4 sh $2,0($7) 252 0190 0200E724 addiu $7,$7,2 253 $L23: 254 $LBB10: 255 $LBB11: 256 .loc 1 6 0 257 0194 00006290 lbu $2,0($3) 258 0198 00160200 sll $2,$2,24 259 019c 03160200 sra $2,$2,24 260 01a0 FCFF4004 bltz $2,$L23 261 01a4 00000000 nop 262 263 $LBE11: 264 $LBE10: 265 01a8 21188B00 addu $3,$4,$11 266 01ac 00006290 lbu $2,0($3) 267 01b0 08004230 andi $2,$2,0x8 268 01b4 04004010 beq $2,$0,$L22 269 01b8 21188000 move $3,$4 270 271 01bc 2A100601 slt $2,$8,$6 272 01c0 EFFF4014 bne $2,$0,$L26 273 01c4 00000000 nop 274 275 $L22: 45:/mnt/hgfs/boot/booter/source/ata.c **** ata_wait_busy(®s[reg_size*ATA_REG_STATUS]); 46:/mnt/hgfs/boot/booter/source/ata.c **** } 47:/mnt/hgfs/boot/booter/source/ata.c **** 48:/mnt/hgfs/boot/booter/source/ata.c **** //ata_dump_sectors(buf, sect, n); 49:/mnt/hgfs/boot/booter/source/ata.c **** 50:/mnt/hgfs/boot/booter/source/ata.c **** return i*2; 51:/mnt/hgfs/boot/booter/source/ata.c **** } 276 .loc 1 51 0 277 01c8 0800E003 j $31 278 01cc 40100800 sll $2,$8,1 279 280 $L29: 281 .loc 1 35 0 282 01d0 21104B00 addu $2,$2,$11 283 01d4 4E000008 j $L28 284 01d8 21000324 li $3,33 285 GAS LISTING /tmp/ccpN3UVf.s page 7 286 .set macro 287 .set reorder 288 $LFE4: 289 .end ata_read_sector 290 .align 2 291 .globl ata_read_sectors 292 .ent ata_read_sectors 293 .type ata_read_sectors, @function 294 ata_read_sectors: 295 $LFB5: 52:/mnt/hgfs/boot/booter/source/ata.c **** 53:/mnt/hgfs/boot/booter/source/ata.c **** int ata_read_sectors(void* base, int sect, int n, short *buf, int reg_size) 54:/mnt/hgfs/boot/booter/source/ata.c **** { 296 .loc 1 54 0 297 .frame $sp,56,$31 # vars= 0, regs= 8/0, args= 24, gp= 0 298 .mask 0x807f0000,-4 299 .fmask 0x00000000,0 300 .set noreorder 301 .set nomacro 302 303 01dc C8FFBD27 addiu $sp,$sp,-56 304 $LCFI7: 305 01e0 3000B6AF sw $22,48($sp) 306 $LCFI8: 307 01e4 2C00B5AF sw $21,44($sp) 308 $LCFI9: 309 01e8 2800B4AF sw $20,40($sp) 310 $LCFI10: 311 01ec 2400B3AF sw $19,36($sp) 312 $LCFI11: 313 01f0 2000B2AF sw $18,32($sp) 314 $LCFI12: 315 01f4 1C00B1AF sw $17,28($sp) 316 $LCFI13: 317 01f8 1800B0AF sw $16,24($sp) 318 $LCFI14: 319 01fc 3400BFAF sw $31,52($sp) 320 $LCFI15: 321 .loc 1 54 0 322 0200 21A0C000 move $20,$6 323 0204 21B08000 move $22,$4 324 0208 21A8A000 move $21,$5 325 020c 2180E000 move $16,$7 326 0210 4800B38F lw $19,72($sp) 55:/mnt/hgfs/boot/booter/source/ata.c **** int i, bytes_read = 0;; 327 .loc 1 55 0 328 0214 21900000 move $18,$0 56:/mnt/hgfs/boot/booter/source/ata.c **** for(i = 0; i < n; ++i) 329 .loc 1 56 0 330 0218 0C00C018 blez $6,$L36 331 021c 21880000 move $17,$0 332 333 $L34: 57:/mnt/hgfs/boot/booter/source/ata.c **** { 58:/mnt/hgfs/boot/booter/source/ata.c **** bytes_read += ata_read_sector(base, sect + i, 1, buf, reg_size); 334 .loc 1 58 0 335 0220 2128B102 addu $5,$21,$17GAS LISTING /tmp/ccpN3UVf.s page 8 336 0224 21380002 move $7,$16 337 .loc 1 56 0 338 0228 01003126 addiu $17,$17,1 339 .loc 1 58 0 340 022c 2120C002 move $4,$22 341 0230 01000624 li $6,1 # 0x1 342 0234 0000000C jal ata_read_sector
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -