Print this page
11581 'debug' loader option is a little obscure
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Rob Johnston <rob.johnston@joyent.com>


 139      s" YES" compare-insensitive 0= if
 140        [char] s addr len + c! len 1+ to len
 141      then
 142   else
 143     drop
 144   then
 145   s" boot_verbose" getenv dup -1 <> if
 146      s" YES" compare-insensitive 0= if
 147        [char] v addr len + c! len 1+ to len
 148      then
 149   else
 150     drop
 151   then
 152   s" boot_kmdb" getenv dup -1 <> if
 153      s" YES" compare-insensitive 0= if
 154        [char] k addr len + c! len 1+ to len
 155      then
 156   else
 157     drop
 158   then
 159   s" boot_debug" getenv dup -1 <> if
 160      s" YES" compare-insensitive 0= if
 161        [char] d addr len + c! len 1+ to len
 162      then
 163   else
 164     drop
 165   then
 166   s" boot_reconfigure" getenv dup -1 <> if
 167      s" YES" compare-insensitive 0= if
 168        [char] r addr len + c! len 1+ to len
 169      then
 170   else
 171     drop
 172   then
 173   s" boot_ask" getenv dup -1 <> if
 174      s" YES" compare-insensitive 0= if
 175        [char] a addr len + c! len 1+ to len
 176      then
 177   else
 178     drop
 179   then


 269 : boot-conf
 270   0= if ( interpreted ) get_arguments then
 271   0 1 unload drop
 272   load_kernel_and_modules
 273   ?dup 0= if 0 1 autoboot then
 274 ;
 275 
 276 also forth definitions previous
 277 
 278 builtin: boot
 279 builtin: boot-conf
 280 
 281 only forth definitions also support-functions
 282 
 283 \ 
 284 \ in case the boot-args is set, parse it and extract following options:
 285 \ -a to boot_ask=YES
 286 \ -s to boot_single=YES
 287 \ -v to boot_verbose=YES
 288 \ -k to boot_kmdb=YES
 289 \ -d to boot_debug=YES
 290 \ -r to boot_reconfigure=YES
 291 \ -B acpi-user-options=X to acpi-user-options=X
 292 \ 
 293 \ This is needed so that the menu can manage these options. Unfortunately, this
 294 \ also means that boot-args will override previously set options, but we have no
 295 \ way to control the processing order here. boot-args will be rebuilt at boot.
 296 \ 
 297 \ NOTE: The best way to address the order is to *not* set any above options
 298 \ in boot-args.
 299 
 300 : parse-boot-args  { | baddr blen -- }
 301   s" boot-args" getenv dup -1 = if drop exit then
 302   to blen
 303   to baddr
 304 
 305   baddr blen
 306 
 307   \ loop over all instances of switch blocks, starting with '-'
 308   begin
 309     [char] - strchr


 438           then
 439         then
 440       repeat
 441                                 ( addr len len' addr' )
 442       \ this block is done, remove addr and len from stack
 443       2swap 2drop swap
 444     then
 445 
 446     over c@ [char] - = if       ( addr len )
 447       2dup 1- swap 1+           ( addr len len' addr' )
 448       begin                     \ loop till ' ' or 0
 449         dup c@ dup 0<> swap bl <> and
 450       while
 451         dup c@ [char] s = if
 452           s" set boot_single=YES" evaluate TRUE
 453         else dup c@ [char] v = if
 454           s" set boot_verbose=YES" evaluate TRUE
 455         else dup c@ [char] k = if
 456           s" set boot_kmdb=YES" evaluate TRUE
 457         else dup c@ [char] d = if
 458           s" set boot_debug=YES" evaluate TRUE
 459         else dup c@ [char] r = if
 460           s" set boot_reconfigure=YES" evaluate TRUE
 461         else dup c@ [char] a = if
 462           s" set boot_ask=YES" evaluate TRUE
 463         then then then then then then
 464         dup TRUE = if
 465           drop
 466           dup >r             ( addr len len' addr' R: addr' )
 467           1+ swap 1-            ( addr len addr'+1 len'-1 R: addr' )
 468           r> swap move               ( addr len )
 469 
 470           2drop baddr blen 1-
 471           \ check if we have space after '-', if so, drop '- '
 472           swap dup 1+ c@ bl = if
 473               2 + swap 2 -
 474           else
 475               swap
 476           then
 477           dup dup 0= swap 1 = or if     \ empty or only '-' is left.
 478             2drop




 139      s" YES" compare-insensitive 0= if
 140        [char] s addr len + c! len 1+ to len
 141      then
 142   else
 143     drop
 144   then
 145   s" boot_verbose" getenv dup -1 <> if
 146      s" YES" compare-insensitive 0= if
 147        [char] v addr len + c! len 1+ to len
 148      then
 149   else
 150     drop
 151   then
 152   s" boot_kmdb" getenv dup -1 <> if
 153      s" YES" compare-insensitive 0= if
 154        [char] k addr len + c! len 1+ to len
 155      then
 156   else
 157     drop
 158   then
 159   s" boot_drop_into_kmdb" getenv dup -1 <> if
 160      s" YES" compare-insensitive 0= if
 161        [char] d addr len + c! len 1+ to len
 162      then
 163   else
 164     drop
 165   then
 166   s" boot_reconfigure" getenv dup -1 <> if
 167      s" YES" compare-insensitive 0= if
 168        [char] r addr len + c! len 1+ to len
 169      then
 170   else
 171     drop
 172   then
 173   s" boot_ask" getenv dup -1 <> if
 174      s" YES" compare-insensitive 0= if
 175        [char] a addr len + c! len 1+ to len
 176      then
 177   else
 178     drop
 179   then


 269 : boot-conf
 270   0= if ( interpreted ) get_arguments then
 271   0 1 unload drop
 272   load_kernel_and_modules
 273   ?dup 0= if 0 1 autoboot then
 274 ;
 275 
 276 also forth definitions previous
 277 
 278 builtin: boot
 279 builtin: boot-conf
 280 
 281 only forth definitions also support-functions
 282 
 283 \ 
 284 \ in case the boot-args is set, parse it and extract following options:
 285 \ -a to boot_ask=YES
 286 \ -s to boot_single=YES
 287 \ -v to boot_verbose=YES
 288 \ -k to boot_kmdb=YES
 289 \ -d to boot_drop_into_kmdb=YES
 290 \ -r to boot_reconfigure=YES
 291 \ -B acpi-user-options=X to acpi-user-options=X
 292 \ 
 293 \ This is needed so that the menu can manage these options. Unfortunately, this
 294 \ also means that boot-args will override previously set options, but we have no
 295 \ way to control the processing order here. boot-args will be rebuilt at boot.
 296 \ 
 297 \ NOTE: The best way to address the order is to *not* set any above options
 298 \ in boot-args.
 299 
 300 : parse-boot-args  { | baddr blen -- }
 301   s" boot-args" getenv dup -1 = if drop exit then
 302   to blen
 303   to baddr
 304 
 305   baddr blen
 306 
 307   \ loop over all instances of switch blocks, starting with '-'
 308   begin
 309     [char] - strchr


 438           then
 439         then
 440       repeat
 441                                 ( addr len len' addr' )
 442       \ this block is done, remove addr and len from stack
 443       2swap 2drop swap
 444     then
 445 
 446     over c@ [char] - = if       ( addr len )
 447       2dup 1- swap 1+           ( addr len len' addr' )
 448       begin                     \ loop till ' ' or 0
 449         dup c@ dup 0<> swap bl <> and
 450       while
 451         dup c@ [char] s = if
 452           s" set boot_single=YES" evaluate TRUE
 453         else dup c@ [char] v = if
 454           s" set boot_verbose=YES" evaluate TRUE
 455         else dup c@ [char] k = if
 456           s" set boot_kmdb=YES" evaluate TRUE
 457         else dup c@ [char] d = if
 458           s" set boot_drop_into_kmdb=YES" evaluate TRUE
 459         else dup c@ [char] r = if
 460           s" set boot_reconfigure=YES" evaluate TRUE
 461         else dup c@ [char] a = if
 462           s" set boot_ask=YES" evaluate TRUE
 463         then then then then then then
 464         dup TRUE = if
 465           drop
 466           dup >r             ( addr len len' addr' R: addr' )
 467           1+ swap 1-            ( addr len addr'+1 len'-1 R: addr' )
 468           r> swap move               ( addr len )
 469 
 470           2drop baddr blen 1-
 471           \ check if we have space after '-', if so, drop '- '
 472           swap dup 1+ c@ bl = if
 473               2 + swap 2 -
 474           else
 475               swap
 476           then
 477           dup dup 0= swap 1 = or if     \ empty or only '-' is left.
 478             2drop