Merge pull request #5 from codex/jd-native-outbound-relay-20260806
fix(native): bound JD receive waits and persist progress
This commit is contained in:
commit
7180ef9161
6 changed files with 36 additions and 1 deletions
|
|
@ -187,6 +187,10 @@ long_mode_start:
|
|||
call ghal_net_icmp_exchange_once
|
||||
pop rcx
|
||||
jc native_network_proof_error
|
||||
push rcx
|
||||
call write_native_progress_checkpoint
|
||||
pop rcx
|
||||
jc native_block_proof_error
|
||||
loop .login_session_loop
|
||||
call ghal_block_persist_world_store
|
||||
jc native_world_store_error
|
||||
|
|
@ -199,6 +203,8 @@ long_mode_start:
|
|||
mov byte [rel ghal_net_command_kind], 1
|
||||
call ghal_net_icmp_exchange_once
|
||||
jc native_network_proof_error
|
||||
call write_native_progress_checkpoint
|
||||
jc native_block_proof_error
|
||||
call ghal_block_persist_code_object
|
||||
jc native_world_store_error
|
||||
lea rax, [rel ghal_branch_move_magic]
|
||||
|
|
@ -206,6 +212,8 @@ long_mode_start:
|
|||
mov byte [rel ghal_net_command_kind], 2
|
||||
call ghal_net_icmp_exchange_once
|
||||
jc native_network_proof_error
|
||||
call write_native_progress_checkpoint
|
||||
jc native_block_proof_error
|
||||
call ghal_block_persist_branch_receipt
|
||||
jc native_world_store_error
|
||||
%ifdef GHOS_NATIVE_RESIDENT
|
||||
|
|
@ -218,12 +226,18 @@ long_mode_start:
|
|||
call ghal_net_icmp_exchange_once
|
||||
pop rcx
|
||||
jc native_network_proof_error
|
||||
push rcx
|
||||
call write_native_progress_checkpoint
|
||||
pop rcx
|
||||
jc native_block_proof_error
|
||||
loop .resident_login_loop
|
||||
lea rax, [rel ghal_recovery_magic]
|
||||
mov [rel ghal_net_expected_magic], rax
|
||||
mov byte [rel ghal_net_command_kind], 3
|
||||
call ghal_net_icmp_exchange_once
|
||||
jc native_network_proof_error
|
||||
call write_native_progress_checkpoint
|
||||
jc native_block_proof_error
|
||||
call ghal_write_native_recovery_beacon
|
||||
jc native_world_store_error
|
||||
%endif
|
||||
|
|
@ -275,6 +289,11 @@ return_with_physical_proof:
|
|||
push rax
|
||||
retfq
|
||||
|
||||
write_native_progress_checkpoint:
|
||||
mov byte [rel physical_proof_flag], 0x5a
|
||||
call ghal_block_write_proof
|
||||
ret
|
||||
|
||||
ghal_initialization_error:
|
||||
mov rsi, msg_ghal_error
|
||||
call serial_write64
|
||||
|
|
@ -458,6 +477,7 @@ physical_proof_recovery_beacon_read_verified: db 0
|
|||
physical_proof_gestational_index_initialized: db 0
|
||||
physical_proof_gestational_index_present: db 0
|
||||
physical_proof_gestational_index_read_verified: db 0
|
||||
physical_proof_last_completed_sequence: db 0
|
||||
times 512 - ($ - physical_proof_sector) db 0
|
||||
%endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1091,7 +1091,7 @@ ghal_net_icmp_exchange_once:
|
|||
inc word [rel ghal_net_tx_next_index]
|
||||
|
||||
.reset_receive_wait:
|
||||
mov ecx, 0x80000000
|
||||
mov ecx, 0x08000000
|
||||
.wait_receive:
|
||||
cmp word [r12 + 2], r8w
|
||||
je .packet_received
|
||||
|
|
@ -1219,6 +1219,8 @@ ghal_net_icmp_exchange_once:
|
|||
.exchange_verified:
|
||||
mov [rel ghal_net_rx_next_index], r8w
|
||||
inc word [rel ghal_net_rx_next_index]
|
||||
mov al, [rel ghal_net_expected_sequence]
|
||||
mov [rel physical_proof_last_completed_sequence], al
|
||||
inc byte [rel ghal_net_expected_sequence]
|
||||
cmp byte [rel ghal_net_matched_kind], 0
|
||||
jne .not_login_reply
|
||||
|
|
|
|||
|
|
@ -201,6 +201,11 @@ def main() -> None:
|
|||
peer.sendto(reply, address)
|
||||
if repetition + 1 < args.native_ack_repetitions:
|
||||
time.sleep(args.native_ack_interval)
|
||||
print(
|
||||
f"native_ack sequence={sequence} source={source} "
|
||||
f"repetitions={args.native_ack_repetitions}",
|
||||
flush=True,
|
||||
)
|
||||
acknowledged.add(sequence)
|
||||
sources.add(source)
|
||||
if len(acknowledged) == len(pipeline) and completed_at is None:
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ with pathlib.Path(sys.argv[1]).open("rb") as disk:
|
|||
assert proof[42:44] == bytes([0x7F, 0])
|
||||
assert proof[90] == 13
|
||||
assert proof[93:105] == bytes([1] * 12)
|
||||
assert proof[105] == 16
|
||||
assert sector(135).startswith(b"GHOS_HLDP_WORLD_STORE_V1\n")
|
||||
assert sector(136).startswith(b"GHOS_CODE_CHANNEL_STORE_V1\n")
|
||||
assert sector(137) == sector(136)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ assert proof[88:90] == bytes([1, 1])
|
|||
assert proof[90] == 13
|
||||
assert proof[91:99] == bytes([1, 1, 1, 1, 1, 1, 1, 1])
|
||||
assert proof[99:105] == bytes([1, 1, 1, 1, 1, 1])
|
||||
assert proof[105] == 16
|
||||
|
||||
world = (root / "lba135-138.native-world.bin").read_bytes()
|
||||
assert world[:512].startswith(b"GHOS_HLDP_WORLD_STORE_V1\n")
|
||||
|
|
|
|||
|
|
@ -19,7 +19,13 @@ handshake:
|
|||
expected_sequences: 1-16
|
||||
ordinary_echo_action: IGNORE
|
||||
ordinary_echo_follow_up: REPOST_RX_AND_WAIT_WITHOUT_RETRANSMIT
|
||||
receive_wait_budget: 0x08000000_PAUSE_LOOPS
|
||||
receive_timeout_action: RETRY_THREE_TIMES_THEN_WRITE_FAIL_PROOF_AND_RESET
|
||||
completed_sequence_checkpoint:
|
||||
lba: 134
|
||||
in_progress_flag: 0x5a
|
||||
last_completed_sequence_offset: 105
|
||||
write_timing: AFTER_EACH_AUTHENTICATED_SEQUENCE
|
||||
stale_sequence_action: IGNORE_WITHOUT_STATE_ADVANCE
|
||||
future_sequence_action: IGNORE_WITHOUT_STATE_ADVANCE
|
||||
accepted_sequence_action: ADVANCE_EXACTLY_ONCE
|
||||
|
|
|
|||
Loading…
Reference in a new issue