| # pebs0 = n0 + m1, # pebs1 = n0 + m1, # buf1 = EB_PAGE_SIZE, pebs1[m1] = mkpeb(buf0, m2, false), pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], m1 < # pebs1, mtd-cons(pebs0), mtd-cons(pebs1), mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), ubi-io-initial(subarray(pebs1, 0, m1)), err = ESUCCESS → is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), err = ESUCCESS ∨ ⌊err⌋ ⊦ ⟪if err = ESUCCESS then mtd_asm_write#(m1, 0, 0, EB_PAGE_SIZE, buf1; pebs; err); m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ mtd-cons(pebs) ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n0 + m1), n0 = 0 |
# buf1 = EB_PAGE_SIZE, # pebs1 = n0 + m1, # pebs0 = n0 + m1, pebs1[m1] = mkpeb(buf0, m2, false), err = ESUCCESS, pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], m1 < # pebs1, mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), mtd-cons(pebs1), mtd-cons(pebs0), ubi-io-initial(subarray(pebs1, 0, m1)), err = ESUCCESS → is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), err = ESUCCESS ∨ ⌊err⌋ ⊦ ⟪mtd_asm_write#(m1, 0, 0, EB_PAGE_SIZE, buf1; pebs; err); m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ mtd-cons(pebs) ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n0 + m1), n0 = 0
# buf1 = EB_PAGE_SIZE, # pebs1 = n0 + m1, # pebs0 = n0 + m1, pebs1[m1] = mkpeb(buf0, m2, false), pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], m1 < # pebs1, mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), mtd-cons(pebs1), mtd-cons(pebs0), ubi-io-initial(subarray(pebs1, 0, m1)), err = ESUCCESS → is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), err = ESUCCESS ∨ ⌊err⌋ ⊦ ⟪skip; m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ mtd-cons(pebs) ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n0 + m1), err = ESUCCESS, n0 = 0