[Midnightbsd-cvs] src [10196] trunk/sys/boot/forth: sync with freebsd 10

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jun 1 19:53:34 EDT 2018


Revision: 10196
          http://svnweb.midnightbsd.org/src/?rev=10196
Author:   laffer1
Date:     2018-06-01 19:53:33 -0400 (Fri, 01 Jun 2018)
Log Message:
-----------
sync with freebsd 10

Modified Paths:
--------------
    trunk/sys/boot/forth/menusets.4th
    trunk/sys/boot/forth/screen.4th
    trunk/sys/boot/forth/support.4th
    trunk/sys/boot/forth/version.4th

Modified: trunk/sys/boot/forth/menusets.4th
===================================================================
--- trunk/sys/boot/forth/menusets.4th	2018-06-01 23:50:53 UTC (rev 10195)
+++ trunk/sys/boot/forth/menusets.4th	2018-06-01 23:53:33 UTC (rev 10196)
@@ -21,12 +21,15 @@
 \ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 \ SUCH DAMAGE.
-\ 
-\ $MidnightBSD$
-\ $FreeBSD: stable/9/sys/boot/forth/menusets.4th 263701 2014-03-25 03:19:03Z dteske $
+\
+\ $MidnightBSD$ 
+\ $FreeBSD: stable/10/sys/boot/forth/menusets.4th 281843 2015-04-22 01:08:40Z dteske $
 
 marker task-menusets.4th
 
+vocabulary menusets-infrastructure
+only forth also menusets-infrastructure definitions
+
 variable menuset_use_name
 
 create menuset_affixbuf	255 allot
@@ -438,6 +441,8 @@
 	s" affix" unsetenv
 ;
 
+only forth definitions also menusets-infrastructure
+
 : menuset-loadsetnum ( N -- )
 
 	menuset-checksetnum ( n -- )
@@ -538,16 +543,6 @@
 	menuset-cleanup
 ;
 
-: menuset-loadinitial ( -- )
-	s" menuset_initial" getenv dup -1 <> if
-		?number 0<> if
-			menuset-loadsetnum
-		then
-	else
-		drop \ cruft
-	then
-;
-
 : menusets-unset ( -- )
 
 	s" menuset_initial" unsetenv
@@ -616,3 +611,15 @@
 	s" buf" unsetenv
 	menuset-cleanup
 ;
+
+only forth definitions
+
+: menuset-loadinitial ( -- )
+	s" menuset_initial" getenv dup -1 <> if
+		?number 0<> if
+			menuset-loadsetnum
+		then
+	else
+		drop \ cruft
+	then
+;

Modified: trunk/sys/boot/forth/screen.4th
===================================================================
--- trunk/sys/boot/forth/screen.4th	2018-06-01 23:50:53 UTC (rev 10195)
+++ trunk/sys/boot/forth/screen.4th	2018-06-01 23:53:33 UTC (rev 10196)
@@ -1,36 +1,75 @@
-\ Screen manipulation related words.
-\ $MidnightBSD$
+\ Copyright (c) 2003 Scott Long <scottl at FreeBSD.org>
+\ Copyright (c) 2015 Devin Teske <dteske at FreeBSD.org>
+\ All rights reserved.
+\ 
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\    notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\    notice, this list of conditions and the following disclaimer in the
+\    documentation and/or other materials provided with the distribution.
+\ 
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\
+\ $MidnightBSD$ 
+\ $FreeBSD: stable/10/sys/boot/forth/screen.4th 281843 2015-04-22 01:08:40Z dteske $
 
 marker task-screen.4th
 
-: escc	( -- )	\ emit Esc-[
-	91 27 emit emit
-;
+\ emit Esc-[
+: escc ( -- ) 27 emit [char] [ emit ;
 
-: ho	( -- )	\ Home cursor
-	escc 72 emit	\ Esc-[H
-;
+\ Home cursor ( Esc-[H )
+: ho ( -- ) escc [char] H emit ;
 
-: cld	( -- )	\ Clear from current position to end of display
-	escc 74 emit	\ Esc-[J
-;
+\ Clear from current position to end of display ( Esc-[J )
+: cld ( -- ) escc [char] J emit ;
 
-: clear	( -- )	\ clear screen
-	ho cld
-;
+\ clear screen
+: clear ( -- ) ho cld ;
 
-: at-xy	( x y -- )	\ move cursor to x rows, y cols (1-based coords)
-	escc .# 59 emit .# 72 emit	\ Esc-[%d;%dH
-;
+\ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH )
+: at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ;
 
-: fg	( x -- )	\ Set foreground color
-	escc 3 .# .# 109 emit	\ Esc-[3%dm
-;
+\ Set foreground color ( Esc-[3%dm )
+: fg ( x -- ) escc 3 .# .# [char] m emit ;
 
-: bg	( x -- )	\ Set background color
-	escc 4 .# .# 109 emit	\ Esc-[4%dm
-;
+\ Set background color ( Esc-[4%dm )
+: bg ( x -- ) escc 4 .# .# [char] m emit ;
 
-: me	( -- )	\ Mode end (clear attributes)
-	escc 109 emit
+\ Mode end (clear attributes)
+: me ( -- ) escc [char] m emit ;
+
+\ Enable bold mode ( Esc-[1m )
+: b ( -- ) escc 1 .# [char] m emit ;
+
+\ Disable bold mode ( Esc-[22m )
+: -b ( -- ) escc 22 .# [char] m emit ;
+
+\ Enable inverse foreground/background mode ( Esc-[7m )
+: inv ( -- ) escc 7 .# [char] m emit ;
+
+\ Disable inverse foreground/background mode ( Esc-[27m )
+: -inv ( -- ) escc 27 .# [char] m emit ;
+
+\ Convert all occurrences of given character (c) in string (c-addr/u) to Esc
+: escc! ( c-addr/u c -- c-addr/u )
+	2 pick 2 pick
+	begin dup 0> while
+		over c@ 3 pick = if over 27 swap c! then
+		1- swap 1+ swap
+	repeat
+	2drop drop
 ;

Modified: trunk/sys/boot/forth/support.4th
===================================================================
--- trunk/sys/boot/forth/support.4th	2018-06-01 23:50:53 UTC (rev 10195)
+++ trunk/sys/boot/forth/support.4th	2018-06-01 23:53:33 UTC (rev 10196)
@@ -1,4 +1,4 @@
-\ Copyright (c) 1999 Daniel C. Sobral <dcs at freebsd.org>
+\ Copyright (c) 1999 Daniel C. Sobral <dcs at FreeBSD.org>
 \ All rights reserved.
 \ 
 \ Redistribution and use in source and binary forms, with or without
@@ -23,6 +23,7 @@
 \ SUCH DAMAGE.
 \
 \ $MidnightBSD$
+\ $FreeBSD: stable/10/sys/boot/forth/support.4th 299706 2016-05-14 00:44:23Z pfg $
 
 \ Loader.rc support functions:
 \
@@ -56,7 +57,7 @@
 \ string conf_files		configuration files to be loaded
 \ cell modules_options		pointer to first module information
 \ value verbose?		indicates if user wants a verbose loading
-\ value any_conf_read?		indicates if a conf file was succesfully read
+\ value any_conf_read?		indicates if a conf file was successfully read
 \
 \ Other exported words:
 \    note, strlen is internal
@@ -315,7 +316,7 @@
 \	reset_line_reading
 
 vocabulary line-reading
-also line-reading definitions also
+also line-reading definitions
 
 \ File data temporary storage
 
@@ -324,13 +325,13 @@
 
 \ File's line reading function
 
-support-functions definitions
+get-current ( -- wid ) previous definitions
 
 string line_buffer
 0 value end_of_file?
 variable fd
 
-line-reading definitions
+>search ( wid -- ) definitions
 
 : skip_newlines
   begin
@@ -405,7 +406,7 @@
   read_buffer .len !
 ;
 
-support-functions definitions
+get-current ( -- wid ) previous definitions >search ( wid -- )
 
 : reset_line_reading
   0 to read_buffer_ptr
@@ -447,7 +448,7 @@
 \	get_assignment
 
 vocabulary parser
-also parser definitions also
+also parser definitions
 
 0 value parsing_function
 0 value end_of_line
@@ -606,7 +607,7 @@
   end_of_line? 0= if ESYNTAX throw then
 ;
 
-file-processing definitions
+get-current ( -- wid ) previous definitions >search ( wid -- )
 
 : get_assignment
   line_buffer strget + to end_of_line
@@ -623,7 +624,7 @@
   or or 0= if ESYNTAX throw then
 ;
 
-only forth also support-functions also file-processing definitions also
+only forth also support-functions also file-processing definitions
 
 \ Process line
 
@@ -684,7 +685,7 @@
   s" loader_conf_files" getenv conf_files string=
 ;
 
-: set_nextboot_conf \ XXX maybe do as set_conf_files ?
+: set_nextboot_conf
   value_buffer strget unquote nextboot_conf_file string=
 ;
 
@@ -818,7 +819,7 @@
 
 \ Higher level file processing
 
-support-functions definitions
+get-current ( -- wid ) previous definitions >search ( wid -- )
 
 : process_conf
   begin
@@ -833,7 +834,7 @@
   repeat
 ;
 
-: peek_file
+: peek_file ( addr len -- )
   0 to end_of_file?
   reset_line_reading
   O_RDONLY fopen fd !
@@ -844,6 +845,7 @@
   ['] process_assignment catch
   ['] free_buffers catch
   fd @ fclose
+  swap throw throw
 ;
   
 only forth also support-functions definitions
@@ -851,7 +853,6 @@
 \ Interface to loading conf files
 
 : load_conf  ( addr len -- )
-  \ ." ----- Trying conf " 2dup type cr \ debugging
   0 to end_of_file?
   reset_line_reading
   O_RDONLY fopen fd !
@@ -930,6 +931,30 @@
   repeat
 ;
 
+: free-one-module { addr -- addr }
+  addr module.name strfree
+  addr module.loadname strfree
+  addr module.type strfree
+  addr module.args strfree
+  addr module.beforeload strfree
+  addr module.afterload strfree
+  addr module.loaderror strfree
+  addr
+;
+
+: free-module-options
+  module_options @
+  begin
+    ?dup
+  while
+    free-one-module
+    dup module.next @
+    swap free-memory
+  repeat
+  0 module_options !
+  0 last_module_option !
+;
+
 only forth also support-functions definitions
 
 \ Variables used for processing multiple conf files
@@ -936,7 +961,7 @@
 
 string current_file_name_ref	\ used to print the file name
 
-\ Indicates if any conf file was succesfully read
+\ Indicates if any conf file was successfully read
 
 0 value any_conf_read?
 
@@ -943,7 +968,6 @@
 \ loader_conf_files processing support functions
 
 : get_conf_files ( -- addr len )  \ put addr/len on stack, reset var
-  \ ." -- starting on <" conf_files strtype ." >" cr \ debugging
   conf_files strget 0 0 conf_files strset
 ;
 
@@ -970,7 +994,6 @@
     pos char+ to pos
   repeat
   addr len pos addr r@ + pos r> -
-  \ 2dup ." get_file_name has " type cr \ debugging
 ;
 
 : get_next_file  ( addr len ptr -- addr len ptr' addr' len' | 0 )
@@ -1021,7 +1044,7 @@
 ;
 
 : get_nextboot_conf_file ( -- addr len )
-  nextboot_conf_file strget strdup	\ XXX is the strdup a leak ?
+  nextboot_conf_file strget
 ;
 
 : rewrite_nextboot_file ( -- )
@@ -1028,18 +1051,19 @@
   get_nextboot_conf_file
   O_WRONLY fopen fd !
   fd @ -1 = if EOPEN throw then
-  fd @ s' nextboot_enable="NO" ' fwrite
+  fd @ s' nextboot_enable="NO" ' fwrite ( fd buf len -- nwritten ) drop
   fd @ fclose
 ;
 
-: include_nextboot_file
+: include_nextboot_file ( -- )
   get_nextboot_conf_file
-  ['] peek_file catch
+  ['] peek_file catch if 2drop then
   nextboot? if
     get_nextboot_conf_file
+    current_file_name_ref strref
     ['] load_conf catch
     process_conf_errors
-    ['] rewrite_nextboot_file catch
+    ['] rewrite_nextboot_file catch if 2drop then
   then
 ;
 
@@ -1110,7 +1134,7 @@
       then
     else
       after_load
-      load_succesful_message true	\ Succesful, do not retry
+      load_succesful_message true	\ Successful, do not retry
     then
   until
 ;
@@ -1302,7 +1326,7 @@
 \   1. /boot/path
 \   2. path
 \
-\ The module_path variable is overridden if load is succesful, by
+\ The module_path variable is overridden if load is successful, by
 \ prepending the successful path.
 
 : load_from_directory ( path len 1 | flags len' path len 2 -- flag )
@@ -1389,7 +1413,7 @@
 \ will first be tried as a full path, and, next, search on the
 \ directories pointed by module_path.
 \
-\ The module_path variable is overridden if load is succesful, by
+\ The module_path variable is overridden if load is successful, by
 \ prepending the successful path.
 
 : load_directory_or_file ( path len 1 | flags len' path len 2 -- flag )
@@ -1437,6 +1461,20 @@
   abort" Unable to load a kernel!"
 ;
 
+: load_xen ( -- flag )
+  s" xen_kernel" getenv dup -1 <> if
+    1 1 load ( c-addr/u flag N -- flag )
+  else
+    drop
+    0 ( -1 -- flag )
+  then
+;
+
+: load_xen_throw ( -- ) ( throws: abort )
+  load_xen
+  abort" Unable to load Xen!"
+;
+
 : set_defaultoptions  ( -- )
   s" kernel_options" getenv dup -1 = if
     drop
@@ -1555,15 +1593,15 @@
   else
     drop
   then
-  r> if ( a path was passed )
-    load_directory_or_file
-  else
-    standard_kernel_search
+  load_xen
+  ?dup 0= if ( success )
+    r> if ( a path was passed )
+      load_directory_or_file
+    else
+      standard_kernel_search
+    then
+    ?dup 0= if ['] load_modules catch then
   then
-  ?dup 0= if ['] load_modules catch then
 ;
 
-\ Go back to straight forth vocabulary
-
-only forth also definitions
-
+only forth definitions

Modified: trunk/sys/boot/forth/version.4th
===================================================================
--- trunk/sys/boot/forth/version.4th	2018-06-01 23:50:53 UTC (rev 10195)
+++ trunk/sys/boot/forth/version.4th	2018-06-01 23:53:33 UTC (rev 10196)
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2013 Devin Teske <dteske at FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske at FreeBSD.org>
 \ All rights reserved.
 \ 
 \ Redistribution and use in source and binary forms, with or without
@@ -21,21 +21,27 @@
 \ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 \ SUCH DAMAGE.
-\ 
-\ $MidnightBSD$
+\
+\ $MidnightBSD$ 
+\ $FreeBSD: stable/10/sys/boot/forth/version.4th 281843 2015-04-22 01:08:40Z dteske $
 
 marker task-version.4th
 
+vocabulary version-processing
+only forth also version-processing definitions
+
 variable versionX
 variable versionY
 
 \ Default $loader_version value if not overridden or using tribute screen
-: str_loader_version ( -- C-ADDR/U|-1 ) s" " ;
+: str_loader_version ( -- C-ADDR/U|-1 ) -1 ;
 
 \ Initialize text placement to defaults
 80 versionX !	\ NOTE: this is the ending column (text is right-justified)
 24 versionY !
 
+only forth definitions also version-processing
+
 : print_version ( -- )
 
 	\ Get the text placement position (if set)
@@ -49,21 +55,22 @@
 	\ Default version if none was set
 	s" loader_version" getenv dup -1 = if
 		drop
-		\ Default version if no logo is requested
+		\ Use above default if no logo is requested
 		s" loader_logo" getenv dup -1 = if
 			drop str_loader_version
 		else
+			\ For tributes, do nothing (defer to logo-*.4th)
 			2dup s" tribute" compare-insensitive 0= if
 				2drop
-				s" tribute-logo" sfind if
-					drop exit \ see beastie tribute-text
+				s" logo" sfind if
+					drop exit \ see logo-tribute.4th
 				else
 					drop str_loader_version
 				then
 			else 2dup s" tributebw" compare-insensitive 0= if
 				2drop
-				s" tributebw-logo" sfind if
-					drop exit \ see beastie tribute-text
+				s" logo" sfind if
+					drop exit \ see logo-tributebw.4th
 				else
 					drop str_loader_version
 				then
@@ -79,9 +86,12 @@
 	dup versionX @ swap - versionY @ at-xy
 
 	\ Print the version (optionally in cyan)
-	loader_color? if
-		." " type ." "
-	else
-		type
-	then
+	loader_color? dup ( c-addr/u -- c-addr/u bool bool )
+	if 6 fg then
+	-rot type
+	if me then
+
+	0 25 at-xy
 ;
+
+only forth definitions



More information about the Midnightbsd-cvs mailing list