Changeset 2917


Ignore:
Timestamp:
Mar 26, 2012, 5:35:34 PM (3 years ago)
Author:
wmb
Message:

Core - Converted config-int, chosen-int, chosen-value, and chosen-variable to cell size intead of explicit 32-bit. Those values often contain pointers that need the full width of the processors native cell size, and represent dynamically-determined information that does not need portability across processor types. Property values in the device description portion of the device tree remain as explicit 32-bit chunks. The OFW client library code needs to be changed accordingly, but has not yet been changed.

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/linux.fth

    r2891 r2917  
    127127   to ramdisk-adr
    128128
    129    ramdisk-adr " linux,initrd-start"  chosen-int-property
    130    ramdisk-adr /ramdisk +  " linux,initrd-end"  chosen-int-property
     129   ramdisk-adr " linux,initrd-start"  chosen-cell-property
     130   ramdisk-adr /ramdisk +  " linux,initrd-end"  chosen-cell-property
    131131;
    132132: $load-ramdisk  ( name$ -- )
  • cpu/arm/loadmach.fth

    r1039 r2917  
    1313
    1414fload ${BP}/cpu/arm/decompm.fth
    15 
    16 : be-l,  ( l -- )  here 4 note-string  allot  be-l!  ;
    1715
    1816\needs $save-forth  transient  fload ${BP}/cpu/arm/savefort.fth  resident
  • forth/kernel/endian.fth

    r2915 r2917  
    2929
    3030: le-l,   ( l -- )     here /l allot le-l!  ;
     31: be-l,   ( l -- )     here /l allot be-l!  ;
    3132
    32 64\ : le-x@   ( a -- l )   dup le-l@ swap la1+ le-l@ lxjoin  ;
    33 64\ : be-x@   ( a -- l )   dup la1+ be-l@ swap be-l@ lxjoin  ;
     33[ifndef] /x
     348 constant /x
     35[then]
     36
     3732\ : le-x@  ( adr -- d )  dup le-l@  swap la1+ le-l@  ;
     3832\ : be-x@  ( adr -- d )  dup la1+ be-l@  swap be-l@  ;
     3932\ : le-x!  ( d adr -- )  tuck la1+ le-l!  le-l!  ;
     4032\ : be-x!  ( d adr -- )  tuck be-l!  la1+ be-l!  ;
     41
     4264\ : le-x@   ( a -- l )   dup le-l@  swap la1+ le-l@ lxjoin  ;
     4364\ : be-x@   ( a -- l )   dup la1+ be-l@  swap be-l@ lxjoin  ;
    344464\ : le-x!   ( l a -- )   >r xlsplit r@ la1+ le-l! r> le-l!  ;
    354564\ : be-x!   ( l a -- )   >r xlsplit r@ be-l! r> la1+ be-l!  ;
    36 64\ : le-x,   ( x -- )     here /x allot le-x!  ;
    37 64\ : be-x,   ( x -- )     here /x allot be-x!  ;
     46
     47: le-x,   ( x -- )  here /x allot le-x!  ;
     48: be-x,   ( x -- )  here /x allot be-x!  ;
     49
     5032\ alias be-n@ be-l@
     5132\ alias be-n! be-l!
     5232\ alias be-n, be-l,
     53
     5464\ alias be-n@ be-x@
     5564\ alias be-n! be-x!
     5664\ alias be-n, be-x,
    3857
    3958\ LICENSE_BEGIN
  • ofw/confvar/conftype.fth

    r2831 r2917  
    125125
    126126headers
    127 : set-config-int-default  ( n xt -- )  >body la1+ unaligned-!  ;
     127: set-config-int-default  ( n xt -- )  >body na1+ unaligned-!  ;
    128128
    1291296 actions
     
    133133action: ( n apf -- adr len )  drop (.d)  ;
    134134action: ( adr len apf -- n )  drop $>number  ;
    135 action: ( apf -- n )  la1+ @  ;
     135action: ( apf -- n )  na1+ @  ;
    136136
    137137: config-int  ( "name" default-value -- )  config-create use-actions   ,  ;
  • ofw/confvar/nameval.fth

    r1294 r2917  
    268268   over -    ( cv-adr cv-len )
    269269;
    270 
    271 : config-adr  ( apf -- adr )  l@ config-mem +  ;
    272270
    273271: (cv-flag@)  ( apf -- flag )  cv-adr  if  >cv$ $>flag  else  @ 0<>  then  ;
  • ofw/core/fdt.fth

    r2852 r2917  
    156156   \ This is redundant because the Linux kernel reserves the initrd explicitly,
    157157   \ independent of the reserve map (and it reserves the device tree blob too).
    158    " linux,initrd-start"  get-chosen-int  dup  fdt h# 40 +  be-l!  ( start )
    159    " linux,initrd-end"    get-chosen-int  swap -                   ( length )
     158   " linux,initrd-start"  get-chosen-cell  dup  fdt h# 40 +  be-l!  ( start )
     159   " linux,initrd-end"    get-chosen-cell  swap -                   ( length )
    160160   fdt h# 4c +  be-l!  ( start )
    161161[then]
  • ofw/core/ofwcore.fth

    r2914 r2917  
    665665;
    666666: get-encoded-int  ( adr len -- n )  drop be-l@  ;
     667
     668: encode-cell  ( n -- adr len )   here  swap be-n,  /n  ;
     669
     670: decode-cell  ( adr len -- adr' len' n )
     671   over be-x@ >r  /x /string  r>
     672;
     673: get-encoded-cell  ( adr len -- n )  drop be-n@  ;
    667674headers
    668675
     
    29372944\ variable in a "/chosen" property.  Example: stdout " stdout" chosen-variable
    293829455 actions
    2939 action:  token@ execute @ encode-int over here - allot  ;   \ get
    2940 action:  token@ execute >r get-encoded-int r> !   ;         \ set
    2941 action:  token@ execute  ;                                  \ addr
     2946action:  token@ execute @ encode-cell over here - allot  ;   \ get
     2947action:  token@ execute >r get-encoded-cell r> !   ;         \ set
     2948action:  token@ execute  ;                                   \ addr
    29422949action:  drop  ;
    29432950action:  drop  ;
     
    29522959\ variable in a "/chosen" property.  Example: stdout " stdout" chosen-variable
    295329605 actions
    2954 action:  token@ execute encode-int over here - allot  ;     \ get
    2955 action:  token@ >r get-encoded-int r> 1 perform-action  ;   \ set
    2956 action:  token@ 2 perform-action  ;                         \ addr
     2961action:  token@ execute encode-cell over here - allot  ;     \ get
     2962action:  token@ >r get-encoded-cell r> 1 perform-action  ;   \ set
     2963action:  token@ 2 perform-action  ;                          \ addr
    29572964action:  drop  ;
    29582965action:  drop  ;
     
    30393046;
    30403047
    3041 : chosen-int-property  ( int name-str -- )
     3048: chosen-cell-property  ( n name-str -- )
    30423049   " /chosen" find-device
    30433050   \ XXX this eats up some space every time it's called ...
    3044    \ We really want an "set-encoded-int"
    3045       rot encode-int  2swap (property)
     3051   \ We really want "set-encoded-cell"
     3052      rot encode-cell  2swap (property)
    30463053   device-end
    30473054;
    30483055: set-stdin  ( ihandle -- )
    30493056   stdin @  swap stdin !                        ( old-ihandle )
    3050    stdin @  " stdin" chosen-int-property
     3057   stdin @  " stdin" chosen-cell-property
    30513058
    30523059   " install-abort" stdin @ $call-method        ( old-ihandle )
     
    30943101      else                      ( adr len )
    30953102         \ Report the value of the "#lines" property
    3096          get-encoded-int        ( #lines )
     3103         get-encoded-cell       ( #lines )
    30973104      then                      ( #lines )
    30983105   then                         ( #lines )
     
    31023109   stdout @  swap stdout !      ( old-ihandle )
    31033110   ?close
    3104    stdout @  " stdout" chosen-int-property
     3111   stdout @  " stdout" chosen-cell-property
    31053112   report-#lines
    31063113;
     
    44634470      my-voc (push-package)                          ( adr len )
    44644471      " address" get-property  0=  if                ( adr len value-adr,len )
    4465          get-encoded-int  2 pick  =  if              ( adr len )
     4472         get-encoded-cell  2 pick  =  if             ( adr len )
    44664473            " address" delete-property               ( adr len )
    44674474         then                                        ( adr len )
  • ofw/fs/ext2fs/recovery.fth

    r2817 r2917  
    355355;
    356356
    357 : be-x@  ( adr -- d )  dup la1+ be-l@  swap be-l@  ;
    358357: do-revoke-block  ( -- )
    359358   revoking?  0=  if  exit  then
  • ofw/wifi/data.fth

    r2784 r2917  
    178178: ssid$       ( -- $ )  wifi >ssid cscount  ;
    179179: ssid!       ( $ -- )  /ssid 1- min wifi >ssid dup /ssid erase swap move  ;
    180 32\ : be-x!  ( d adr -- )  tuck be-l!  la1+ be-l!  ;
    181 32\ : be-x@  ( adr -- d )  dup la1+ be-l@  swap be-l@  ;
    182180: last-rcnt@  ( -- d )  wifi >last-rcnt be-x@  ;
    183181: last-rcnt!  ( d -- )  wifi >last-rcnt be-x!  ;
Note: See TracChangeset for help on using the changeset viewer.