|
|
1.1 ! root 1: \ ***************************************************************************** ! 2: \ * Copyright (c) 2004, 2008 IBM Corporation ! 3: \ * All rights reserved. ! 4: \ * This program and the accompanying materials ! 5: \ * are made available under the terms of the BSD License ! 6: \ * which accompanies this distribution, and is available at ! 7: \ * http://www.opensource.org/licenses/bsd-license.php ! 8: \ * ! 9: \ * Contributors: ! 10: \ * IBM Corporation - initial implementation ! 11: \ ****************************************************************************/ ! 12: ! 13: ( eva - gordons fcode bytecode evaluator ) ! 14: ! 15: hex ! 16: ! 17: -1 constant true ! 18: 0 constant false ! 19: ! 20: variable ip ! 21: variable fcode-end ! 22: variable fcode-num ! 23: 1 value fcode-spread ! 24: 16 value fcode-offset ! 25: false value eva-debug? ! 26: false value fcode-debug? ! 27: defer fcode-rb@ ! 28: defer fcode@ ! 29: ! 30: ' c@ to fcode-rb@ ! 31: ! 32: create token-table 2000 cells allot \ 1000h = 4096d ! 33: ! 34: include core.fs ! 35: include 1275.fs ! 36: include tokens.fs ! 37: ! 38: 0 value buff ! 39: 0 value buff-size ! 40: ! 41: ( ---------------------------------------------------- ) ! 42: ! 43: ' read-fcode# to fcode@ ! 44: ! 45: : step next-ip fcode@ exec ; immediate ! 46: ( ---------------------------------------------------- ) ! 47: ! 48: : rom-code-ignored ( image# name len -- ) ! 49: diagnostic-mode? IF type ." code found in image " . ." , ignoring ..." cr ! 50: ELSE 3drop THEN ! 51: ; ! 52: ! 53: : pci-find-rom ( baseaddr -- addr ) ! 54: -8 and dup IF ! 55: dup rw@ 55aa = IF ! 56: diagnostic-mode? IF ." Device ROM found at " dup . cr THEN ! 57: ELSE drop 0 THEN ! 58: THEN ! 59: ; ! 60: ! 61: : pci-find-fcode ( baseaddr -- addr len | false ) ! 62: pci-find-rom ?dup IF ! 63: dup 18 + rw@ wbflip + ! 64: 0 swap BEGIN ! 65: dup rl@ 50434952 ( 'PCIR') <> IF ! 66: diagnostic-mode? IF ! 67: ." Invalid PCI Data structure, ignoring ROM contents" cr ! 68: THEN ! 69: 2drop false EXIT ! 70: THEN ! 71: dup 14 + rb@ CASE ! 72: 0 OF over . s" Intel x86 BIOS" rom-code-ignored ENDOF ! 73: 1 OF swap diagnostic-mode? IF ! 74: ." Open Firmware FCode found at image " . cr ! 75: ELSE drop THEN ! 76: dup a + rw@ wbflip over + \ This code start ! 77: swap 10 + rw@ wbflip 200 * \ This code length ! 78: EXIT ! 79: ENDOF ! 80: 2 OF over . s" HP PA RISC" rom-code-ignored ENDOF ! 81: 3 OF over . s" EFI" rom-code-ignored ENDOF ! 82: dup OF over . s" Unknown type" rom-code-ignored ENDOF ! 83: ENDCASE ! 84: dup 15 + rb@ 80 and IF 2drop EXIT THEN \ End of last image ! 85: dup 10 + rw@ wbflip 200 * + \ Next image start ! 86: swap 1+ swap \ Next image # ! 87: 0 UNTIL ! 88: THEN false ! 89: ; ! 90: ! 91: : execute-rom-fcode ( addr len | false -- ) ! 92: ?dup IF ! 93: diagnostic-mode? IF ." , executing ..." cr THEN ! 94: dup >r r@ alloc-mem dup >r swap rmove ! 95: r@ set-ip evaluate-fcode ! 96: diagnostic-mode? IF ." Done." cr THEN ! 97: r> r> free-mem ! 98: THEN ! 99: ;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.