File tree Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -375,12 +375,12 @@ launchProgram:
375375 push de
376376 push ix
377377 call openFileRead
378- jr nz , .error
378+ jp nz , .error
379379
380380 call getStreamInfo
381381 ; TODO: If E > 0, then the file is too large. Error out before we ask malloc about it.
382382 call malloc
383- jr nz , .error_pop2
383+ jp nz , .error_pop2
384384 call getNewThreadId
385385 call reassignMemory
386386
@@ -401,8 +401,31 @@ launchProgram:
401401 cp (ix + 3 )
402402 jr nz , .magic_error
403403
404- ; TODO: Check minimum required kernel version, if present
405-
404+ ; Check minimum required kernel version, if present
405+ ld b , KEXC_KERNEL_VER
406+ push ix \ call _getThreadHeader \ pop ix
407+ jr nz , .no_minimum_ver
408+ ex hl , de
409+
410+ call getKernelMajorVersion
411+ jr nz , .unknown_ver
412+ ; If running minimum ver is less than required, abort load
413+ ; TODO on major ver: decide what to do if major ver is greater
414+ ld a , e
415+ cp l
416+ jr c , .kernel_too_low
417+
418+ call getKernelMinorVersion
419+ jr nz , .unknown_ver
420+ ld a , d
421+ cp l
422+ jr c , .kernel_too_low
423+ ; Running version meets requirements
424+
425+ ; Running version is unknown
426+ .unknown_ver:
427+ ; no minimum version is specified by the executable
428+ .no_minimum_ver:
406429 ; Grab header info
407430 ld b , KEXC_ENTRY_POINT
408431 push ix \ call _getThreadHeader \ pop ix
@@ -436,6 +459,9 @@ _: ld a, b
436459 pop bc
437460 cp a
438461 ret
462+ .kernel_too_low:
463+ ld a , errKernelMismatch
464+ jr .error
439465.no_entry_point:
440466 ld a , errNoEntryPoint
441467 jr .error
You can’t perform that action at this time.
0 commit comments