File tree 1 file changed +30
-4
lines changed
1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -375,12 +375,12 @@ launchProgram:
375
375
push de
376
376
push ix
377
377
call openFileRead
378
- jr nz , .error
378
+ jp nz , .error
379
379
380
380
call getStreamInfo
381
381
; TODO: If E > 0, then the file is too large. Error out before we ask malloc about it.
382
382
call malloc
383
- jr nz , .error_pop2
383
+ jp nz , .error_pop2
384
384
call getNewThreadId
385
385
call reassignMemory
386
386
@@ -401,8 +401,31 @@ launchProgram:
401
401
cp (ix + 3 )
402
402
jr nz , .magic_error
403
403
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:
406
429
; Grab header info
407
430
ld b , KEXC_ENTRY_POINT
408
431
push ix \ call _getThreadHeader \ pop ix
@@ -436,6 +459,9 @@ _: ld a, b
436
459
pop bc
437
460
cp a
438
461
ret
462
+ .kernel_too_low:
463
+ ld a , errKernelMismatch
464
+ jr .error
439
465
.no_entry_point:
440
466
ld a , errNoEntryPoint
441
467
jr .error
You can’t perform that action at this time.
0 commit comments