Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cfg/c64-https-uci-m3.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ SEGMENTS {
HTTP_AUX_CODE: load = MAIN, type = ro;
HTTP_AUX_CODE2: load = MAIN, type = ro;
HTTP_SINK_CODE: load = MAIN, type = ro;
HTTP_SINK_GUARD: load = MAIN, type = ro; # the sink's REU-region bound (src/http.s)
TARGET_PROMPT_CODE: load = MAIN, type = ro;
UCI_CODE: load = MAIN, type = ro;
CRYPTO_CODE: load = MAIN, type = ro, optional = yes;
Expand Down
3 changes: 3 additions & 0 deletions cfg/c64-https-uci-onchip-cold.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ SEGMENTS {
# here breaks a rig loudly rather than corrupting crypto; it is still
# the first thing to check when one starts failing.
HTTP_SINK_CODE: load = CRYPTO_OVERLAY, type = ro, optional = yes;
# The sink's REU-region guard (src/http.s: reu_probe_size, sink_fits):
# resident, CRYPTO_HOT has the room CRYPTO_OVERLAY and LOADER lack.
HTTP_SINK_GUARD: load = CRYPTO_HOT, type = ro, optional = yes;
# jsr-only helper slice split out of HTTP_AUX_CODE for ip65's sake
# (see c64-https-ip65.cfg); under UCI it shares CRYPTO_OVERLAY.
HTTP_AUX_CODE2: load = CRYPTO_OVERLAY, type = ro, optional = yes;
Expand Down
3 changes: 3 additions & 0 deletions cfg/c64-https-uci-onchip.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ SEGMENTS {
# here breaks a rig loudly rather than corrupting crypto; it is still
# the first thing to check when one starts failing.
HTTP_SINK_CODE: load = CRYPTO_OVERLAY, type = ro, optional = yes;
# The sink's REU-region guard (src/http.s: reu_probe_size, sink_fits):
# resident, CRYPTO_HOT has the room CRYPTO_OVERLAY and LOADER lack.
HTTP_SINK_GUARD: load = CRYPTO_HOT, type = ro, optional = yes;
# jsr-only helper slice split out of HTTP_AUX_CODE for ip65's sake
# (see c64-https-ip65.cfg); under UCI it shares CRYPTO_OVERLAY.
HTTP_AUX_CODE2: load = CRYPTO_OVERLAY, type = ro, optional = yes;
Expand Down
3 changes: 3 additions & 0 deletions cfg/c64-https-uci.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ SEGMENTS {
# build target is broken and TLS-level P-384 is stubbed (the same
# trade the other overlay residents already make).
HTTP_SINK_CODE: load = CRYPTO_OVERLAY, type = ro, optional = yes;
# The sink's REU-region guard (src/http.s: reu_probe_size, sink_fits):
# resident, CRYPTO_HOT has the room CRYPTO_OVERLAY and LOADER lack.
HTTP_SINK_GUARD: load = CRYPTO_HOT, type = ro, optional = yes;
# jsr-only helper slice split out of HTTP_AUX_CODE for ip65's sake
# (see c64-https-ip65.cfg); under UCI it shares CRYPTO_OVERLAY.
HTTP_AUX_CODE2: load = CRYPTO_OVERLAY, type = ro, optional = yes;
Expand Down
25 changes: 24 additions & 1 deletion src/boot.s
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
.if .defined(HTTPS_PIN_SPKI) .and (.not .defined(BACKEND_UCI_M3))
.import cert_pin_banner
.endif
; uci-m3 fills the sink only under HTTPS_BODY_TO_REU: otherwise no REU DMA
.if .defined(BACKEND_UCI) .and ((.not .defined(BACKEND_UCI_M3)) .or .defined(HTTPS_BODY_TO_REU))
SINK_PROBE = 1
.import reu_probe_size
.endif
.ifdef COLD_BANK
; uci-comb cold-code bank (src/net/uci/cold_bank.s)
.include "cold_bank.inc"
Expand All @@ -44,7 +49,7 @@
.ifdef VIEWER_LINKED ; #155 phase 2: see Makefile KEEP_VIEWER
.import viewer_enter
.endif
.import http_body_sink
.import http_body_sink, http_sink_full
.endif

; ---- exports: REU multiply table routines ----
Expand Down Expand Up @@ -278,6 +283,12 @@ start:
inc @zbss_store+2
dex
bne @zbss_page
.ifdef SINK_PROBE
; The REU's size bounds the HTTP body sink's region (src/http.s).
; Probed before anything else writes the REU: it writes offset 0
; of banks 0, 1, 2, 4 ... 128, which boot rewrites afterwards.
jsr reu_probe_size
.endif
.ifdef COLD_BANK
; Before anything else can touch the image's copy at $C000 (the
; TCP ring's range): stash it into the REU.
Expand Down Expand Up @@ -793,8 +804,15 @@ do_https_get:
; zeroed at boot), so the hook would be a dead branch.
lda http_body_sink
beq @print_body
lda http_sink_full ; the body outgrew its REU region: the
bne @sink_full ; sink stopped it, and wrote nothing past
jsr viewer_enter
jmp @close
@sink_full:
lda #<sink_full_msg
ldy #>sink_full_msg
jsr print_string
jmp @close
@print_body:
.endif
; display response body
Expand All @@ -812,6 +830,11 @@ do_https_get:
.include "m3_https_get.inc" ; src/net/uci-m3/: do_https_get
.endif ; BACKEND_UCI_M3

.if .defined(BACKEND_UCI) .and .defined(VIEWER_LINKED)
sink_full_msg:
.byte "BODY TOO BIG FOR THE REU", $0d, 0
.endif

; =============================================================================
; print_resp_body - print up to 200 bytes of http_resp_buf to screen.
; Bytes originate from the network as ASCII, so they are fed through
Expand Down
6 changes: 3 additions & 3 deletions src/cold_bank.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ COLD_E_TS_SAVE = 3 ; trust_store_save (COLD_G_TRUST)
; table and $4000-$9F9F the P-384 one (parked, not deleted: libs/nistcurves
; API.md's REU map, "$9FA0-$FFFF safe for consumer use"). reu_layout.inc's
; $20100/$22100/$24100 overlay slots sit inside the P-256 table and are
; never used here. cold_bank.s asserts the images stay in
; [COLD_REU_FLOOR, bank 3) and below HTTP_REU_BODY_BASE.
; never used here. cold_bank.s asserts at link time that the images miss
; the LINKED library's tables (its exported bank/offset symbols) and stay
; below the HTTP body sink's banks.
COLD_REU = $02A000
COLD_REU_FLOOR = $029FA0
COLD_IMAGE_MAX = $1000 ; the cfg's COLD_IMAGE size: every group

COLD_MARK = $5C ; each group's last byte
Expand Down
Loading