max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
supported_grammars/lark/LarkParser.g4 | kaby76/Domemtech.TrashBase | 1 | 1971 | <filename>supported_grammars/lark/LarkParser.g4
parser grammar LarkParser;
options {
tokenVocab = LarkLexer;
// contextSuperClass=AttributedParseTreeNode;
}
start: (item? NL)* item? EOF ;
item: rule_ | token | statement ;
rule_: RULE rule_params priority? ':' expansions ;
token: TOKEN token_params priority? ':' expansions ;
rule_params: ('{' RULE (',' RULE)* '}')? ;
token_params: ('{' TOKEN (',' TOKEN)* '}')? ;
priority: '.' NUMBER ;
statement: '%ignore' expansions
| '%import' import_path ('->' name)?
| '%import' import_path name_list
| '%override' rule_
| '%declare' name+
;
import_path: '.'? name ('.' name)* ;
name_list: '(' name (',' name)* ')' ;
expansions: alias (VBAR alias)* ;
alias: expansion ('->' RULE)? ;
expansion: expr* ;
expr: atom (OP | '~' NUMBER ('..' NUMBER)? )? ;
atom: '(' expansions ')' | '[' expansions ']' | value ;
value: STRING '..' STRING
| name
| (REGEXP | STRING)
| name '{' value (',' value)* '}'
;
name: RULE | TOKEN ;
|
alloy4fun_models/trashltl/models/4/wxuJ3nWaubKfXKAEf.als | Kaixi26/org.alloytools.alloy | 0 | 647 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idwxuJ3nWaubKfXKAEf_prop5 {
eventually (
some f: Trash | f not in Trash'
)
}
pred __repair { idwxuJ3nWaubKfXKAEf_prop5 }
check __repair { idwxuJ3nWaubKfXKAEf_prop5 <=> prop5o } |
alloy4fun_models/trashltl/models/11/WkfxoZDDEuk9dpmYu.als | Kaixi26/org.alloytools.alloy | 0 | 4654 | <filename>alloy4fun_models/trashltl/models/11/WkfxoZDDEuk9dpmYu.als<gh_stars>0
open main
pred idWkfxoZDDEuk9dpmYu_prop12 {
eventually (always some f:File | f not in Trash implies f in Trash')
}
pred __repair { idWkfxoZDDEuk9dpmYu_prop12 }
check __repair { idWkfxoZDDEuk9dpmYu_prop12 <=> prop12o } |
src/fot/FOTC/Base/PropertiesATP.agda | asr/fotc | 11 | 1291 | <filename>src/fot/FOTC/Base/PropertiesATP.agda
------------------------------------------------------------------------------
-- FOCT terms properties
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Base.PropertiesATP where
open import FOTC.Base
------------------------------------------------------------------------------
-- Injective properties
postulate succInjective : ∀ {m n} → succ₁ m ≡ succ₁ n → m ≡ n
{-# ATP prove succInjective #-}
------------------------------------------------------------------------------
-- Discrimination rules
postulate S≢0 : ∀ {n} → succ₁ n ≢ zero
{-# ATP prove S≢0 #-}
|
src/css-parser.adb | stcarrez/ada-css | 3 | 3027 | <filename>src/css-parser.adb
-----------------------------------------------------------------------
-- css -- Ada CSS Library
-- Copyright (C) 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Log.Loggers;
with CSS.Parser.Parser;
with CSS.Parser.Parser_Tokens;
package body CSS.Parser is
use Ada.Strings.Unbounded;
use Util.Concurrent.Counters;
use type CSS.Core.Styles.CSSStyleRule_Access;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("CSS.Parser");
Report_Handler : CSS.Core.Errors.Error_Handler_Access;
Current_Sheet : CSS.Core.Sheets.CSSStylesheet_Access;
procedure Load (Path : in String;
Sheet : in CSS.Core.Sheets.CSSStylesheet_Access;
Handler : in CSS.Core.Errors.Error_Handler_Access) is
Res : Integer;
begin
Report_Handler := Handler;
Current_Sheet := Sheet;
Res := CSS.Parser.Parser.Parse (Path, Sheet);
Report_Handler := null;
Current_Sheet := null;
exception
when Parser_Tokens.Syntax_Error =>
Log.Error ("Syntax error while parsing {0}", Path);
Report_Handler := null;
Current_Sheet := null;
end Load;
function To_String (Val : in Parser_Node_Access) return String is
begin
if Val = null then
return "null";
end if;
case Val.Kind is
when TYPE_STRING | TYPE_IDENT | TYPE_NUMBER =>
return Ada.Strings.Unbounded.To_String (Val.Str_Value);
when TYPE_STYLE =>
return "<style>";
when TYPE_PROPERTY =>
return To_String (Val.Name) & ": " & To_String (Val.Value);
when others =>
return "";
end case;
end To_String;
-- ------------------------------
-- Return a printable representation of the parse value.
-- ------------------------------
function To_String (Val : in YYstype) return String is
begin
case Val.Kind is
when TYPE_NULL =>
return "null";
when TYPE_STRING | TYPE_IDENT | TYPE_NUMBER =>
return To_String (Val.Node);
when TYPE_URI =>
return "url(" & To_String (Val.Node) & ")";
when TYPE_VALUE =>
return To_String (Val.Node);
when others =>
return "?";
end case;
end To_String;
procedure Set_Type (Into : in out YYstype;
Kind : in Node_Type;
Line : in Natural;
Column : in Natural) is
procedure Free is
new Ada.Unchecked_Deallocation (Parser_Node_Type, Parser_Node_Access);
Release : Boolean;
begin
if Into.Node /= null then
Util.Concurrent.Counters.Decrement (Into.Node.Ref_Counter, Release);
if Release then
Free (Into.Node);
else
Into.Node := null;
end if;
end if;
Into.Kind := Kind;
Into.Line := Line;
Into.Column := Column;
end Set_Type;
-- ------------------------------
-- Set the parser token with a string that represent an identifier.
-- The line and column number are recorded in the token.
-- ------------------------------
procedure Set_Ident (Into : in out YYstype;
Value : in String;
Line : in Natural;
Column : in Natural) is
begin
Set_Type (Into, TYPE_IDENT, Line, Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_IDENT,
Ref_Counter => ONE,
others => <>);
Ada.Strings.Unbounded.Set_Unbounded_String (Into.Node.Str_Value, Value);
end Set_Ident;
-- ------------------------------
-- Set the parser token with a string.
-- The line and column number are recorded in the token.
-- ------------------------------
procedure Set_String (Into : in out YYstype;
Value : in String;
Line : in Natural;
Column : in Natural) is
begin
Set_Type (Into, TYPE_STRING, Line, Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_STRING,
Ref_Counter => ONE,
others => <>);
Ada.Strings.Unbounded.Set_Unbounded_String (Into.Node.Str_Value, Value);
end Set_String;
-- ------------------------------
-- Set the parser token with a url string.
-- The line and column number are recorded in the token.
-- ------------------------------
procedure Set_Uri (Into : in out YYstype;
Value : in String;
Line : in Natural;
Column : in Natural) is
begin
Set_Type (Into, TYPE_URI, Line, Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_URI,
Ref_Counter => ONE,
others => <>);
Ada.Strings.Unbounded.Set_Unbounded_String (Into.Node.Str_Value, Value);
end Set_Uri;
-- ------------------------------
-- Set the parser token with an number value with an optional unit or dimension.
-- The line and column number are recorded in the token.
-- ------------------------------
procedure Set_Number (Into : in out YYstype;
Value : in String;
Unit : in CSS.Core.Values.Unit_Type;
Line : in Natural;
Column : in Natural) is
begin
Set_Type (Into, TYPE_VALUE, Line, Column);
Into.Unit := Unit;
Into.Kind := TYPE_NUMBER;
Into.Node := new Parser_Node_Type '(Kind => TYPE_NUMBER,
Ref_Counter => ONE,
others => <>);
if Value = "0.0" then
Ada.Strings.Unbounded.Set_Unbounded_String (Into.Node.Str_Value, "0");
elsif Value'Length > 2 and then Value (Value'First .. Value'First + 1) = "0." then
Ada.Strings.Unbounded.Set_Unbounded_String (Into.Node.Str_Value, Value (Value'First + 1 .. Value'Last));
else
Ada.Strings.Unbounded.Set_Unbounded_String (Into.Node.Str_Value, Value);
end if;
end Set_Number;
-- ------------------------------
-- Set the parser token with a color.
-- Report an error if the color is invalid.
-- ------------------------------
procedure Set_Color (Into : in out YYstype;
Value : in YYstype) is
begin
Set_Type (Into, TYPE_COLOR, Value.Line, Value.Column);
Into.Kind := TYPE_COLOR;
Into.Node := new Parser_Node_Type '(Kind => TYPE_COLOR,
Ref_Counter => ONE,
others => <>);
Into.Node.Str_Value := Value.Node.Str_Value;
end Set_Color;
-- ------------------------------
-- Set the parser token to represent a property identifier and its value expression.
-- The value may be a multi-value (ex: 1px 2em 3 4). The priority indicates whether
-- the !important keyword was present.
-- ------------------------------
procedure Set_Property (Into : in out YYstype;
Ident : in YYstype;
Value : in YYstype;
Prio : in Boolean) is
begin
Set_Type (Into, TYPE_PROPERTY, Ident.Line, Ident.Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_PROPERTY,
Ref_Counter => ONE,
Name => Ident.Node,
Value => Value.Node,
Prio => Prio);
Util.Concurrent.Counters.Increment (Ident.Node.Ref_Counter);
if Value.Node /= null then
Util.Concurrent.Counters.Increment (Value.Node.Ref_Counter);
end if;
end Set_Property;
-- ------------------------------
-- Set the parser token to represent a list of properties held by a CSSStyleRule
-- declaration. The style rule is created and the first property inserted in it.
-- The stylesheet document is used for the property string allocation.
-- ------------------------------
procedure Set_Property_List (Into : in out YYstype;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Prop : in YYstype) is
begin
Set_Type (Into, TYPE_STYLE, Prop.Line, Prop.Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_STYLE, Ref_Counter => ONE, Rule => null);
Into.Node.Rule := Document.Create_Rule;
Append_Property (Into.Node.Rule.Style, Document, Prop);
end Set_Property_List;
function Get_Property_Name (Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Prop : in YYstype) return CSS.Core.CSSProperty_Name is
begin
if Prop.Node = null then
return null;
else
return Document.Create_Property_Name (To_String (Prop.Node.Name));
end if;
end Get_Property_Name;
-- ------------------------------
-- Append to the CSSStyleRule the property held by the parser token.
-- ------------------------------
procedure Append_Property (Into : in out CSS.Core.Styles.CSSStyle_Declaration;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Prop : in YYstype) is
Name : CSS.Core.CSSProperty_Name := Get_Property_Name (Document, Prop);
begin
if Prop.Node = null then
Log.Debug ("Property has an invalid name and is dropped");
elsif Prop.Node.Value = null then
Log.Debug ("Property {0} was incorrect and is dropped", Name.all);
else
case Prop.Node.Value.Kind is
when TYPE_VALUE =>
Into.Append (Name, Prop.Node.Value.V, Prop.Line, Prop.Column);
when TYPE_PROPERTY_LIST =>
Into.Append (Name, Prop.Node.Value.Values, Prop.Line, Prop.Column);
when others =>
Log.Error ("Invalid property value");
end case;
end if;
end Append_Property;
procedure Append_Property (Into : in out CSS.Core.Styles.CSSStyleRule_Access;
Media : in CSS.Core.Medias.CSSMediaRule_Access;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Prop : in YYstype) is
begin
if Into = null then
Into := Document.Create_Rule;
Document.Append (Media, Into, Prop.Line, Prop.Column);
end if;
Append_Property (Into.Style, Document, Prop);
end Append_Property;
-- ------------------------------
-- Append the token as a string.
-- ------------------------------
procedure Append_String (Into : in out YYstype;
Value : in YYstype) is
begin
Ada.Strings.Unbounded.Append (Into.Node.Str_Value, To_String (Value));
end Append_String;
procedure Append_String (Into : in out YYstype;
Value : in String) is
begin
Ada.Strings.Unbounded.Append (Into.Node.Str_Value, Value);
end Append_String;
procedure Append_String (Into : in out YYstype;
Value1 : in YYstype;
Value2 : in YYstype) is
begin
Ada.Strings.Unbounded.Append (Into.Node.Str_Value, To_String (Value1));
Ada.Strings.Unbounded.Append (Into.Node.Str_Value, To_String (Value2));
end Append_String;
-- ------------------------------
-- Set the parser token to represent the CSS selector.
-- ------------------------------
procedure Append_Media (Into : in out CSS.Core.Medias.CSSMediaRule_Access;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
List : in YYstype) is
use type CSS.Core.Medias.CSSMediaRule_Access;
begin
if Into = null then
Into := Document.Create_Rule;
Document.Append (Into, List.Line, List.Column);
end if;
Into.Medias.Append (To_String (List));
end Append_Media;
-- ------------------------------
-- Set the parser token to represent the CSS selector list.
-- The first selector searched in the document, inserted in the document
-- CSS selector tree and then added to the selector list.
-- ------------------------------
procedure Set_Selector_List (Into : in out YYstype;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Selector : in YYstype) is
begin
Log.Error ("Selector '{0}'", CSS.Core.Selectors.To_String (Selector.Node.Selector));
end Set_Selector_List;
-- ------------------------------
-- Append to the CSS selector list the selector. The selector is first
-- searched in the document CSS selector tree and inserted in the tree.
-- It is then added to the list.
-- ------------------------------
procedure Add_Selector_List (Into : in out CSS.Core.Styles.CSSStyleRule_Access;
Media : in CSS.Core.Medias.CSSMediaRule_Access;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Selector : in YYstype) is
begin
if Into = null then
Into := Document.Create_Rule;
Document.Append (Media, Into, Selector.Line, Selector.Column);
end if;
CSS.Core.Selectors.Append (Into.Selectors, Selector.Node.Selector);
end Add_Selector_List;
-- ------------------------------
-- Set the parser token to represent the CSS selector.
-- ------------------------------
procedure Set_Selector (Into : in out YYstype;
Selector : in YYstype) is
begin
Set_Type (Into, TYPE_SELECTOR, Selector.Line, Selector.Column);
end Set_Selector;
-- ------------------------------
-- Set the parser token to represent the CSS selector.
-- ------------------------------
procedure Set_Selector (Into : in out YYstype;
Kind : in CSS.Core.Selectors.Selector_Type;
Selector : in YYstype) is
begin
Set_Type (Into, TYPE_SELECTOR, Selector.Line, Selector.Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_SELECTOR,
Ref_Counter => ONE,
Selector => <>);
Into.Node.Selector := CSS.Core.Selectors.Create (Kind, To_String (Selector));
end Set_Selector;
-- ------------------------------
-- Set the parser token to represent the CSS selector.
-- ------------------------------
procedure Set_Selector (Into : in out YYstype;
Kind : in CSS.Core.Selectors.Selector_Type;
Param1 : in YYstype;
Param2 : in YYstype) is
begin
Set_Type (Into, TYPE_SELECTOR, Param1.Line, Param1.Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_SELECTOR,
Ref_Counter => ONE,
Selector => <>);
Into.Node.Selector := CSS.Core.Selectors.Create (Kind, To_String (Param1),
To_String (Param2));
end Set_Selector;
-- ------------------------------
-- Add to the current parser token CSS selector the next CSS selector.
-- ------------------------------
procedure Add_Selector (Into : in out YYstype;
Selector : in YYstype) is
begin
CSS.Core.Selectors.Append (Into.Node.Selector, Selector.Node.Selector);
end Add_Selector;
-- ------------------------------
-- Add to the current parser token CSS selector the next CSS selector.
-- ------------------------------
procedure Add_Selector (Into : in out YYstype;
Combinator : in YYstype;
Selector : in YYstype) is
S : CSS.Core.Selectors.CSSSelector := CSS.Core.Selectors.Create (Combinator.Sel, "");
begin
CSS.Core.Selectors.Append (Into.Node.Selector, S);
CSS.Core.Selectors.Append (Into.Node.Selector, Selector.Node.Selector);
end Add_Selector;
-- ------------------------------
-- Add to the parser token CSS selector a filter represented either
-- by an attribute selection, a pseudo element, a pseudo class or
-- a function.
-- ------------------------------
procedure Add_Selector_Filter (Into : in out YYstype;
Filter : in YYstype) is
begin
CSS.Core.Selectors.Append_Child (Into.Node.Selector, Filter.Node.Selector);
end Add_Selector_Filter;
-- ------------------------------
-- Set the parser token to represent a CSS selector type.
-- Record the line and column where the selector type is found.
-- ------------------------------
procedure Set_Selector_Type (Into : in out YYstype;
Selector : in CSS.Core.Selectors.Selector_Type;
Line : in Natural;
Column : in Natural) is
begin
Set_Type (Into, TYPE_SELECTOR_TYPE, Line, Column);
Into.Sel := Selector;
end Set_Selector_Type;
function Create_Value (Document : in CSS.Core.Sheets.CSSStylesheet_Access;
From : in YYstype) return CSS.Core.Values.Value_Type is
begin
case From.Kind is
when TYPE_STRING =>
return Document.Values.Create_String (To_String (From.Node.Str_Value));
when TYPE_URI =>
return Document.Values.Create_URL (To_String (From.Node.Str_Value));
when TYPE_IDENT =>
return Document.Values.Create_Ident (To_String (From.Node.Str_Value));
when TYPE_COLOR =>
return Document.Values.Create_Color (To_String (From.Node.Str_Value));
when TYPE_NUMBER =>
return Document.Values.Create_Number (To_String (From.Node.Str_Value),
From.Unit);
when TYPE_VALUE =>
return From.Node.V;
when others =>
return CSS.Core.Values.EMPTY;
end case;
end Create_Value;
procedure Set_Value (Into : in out YYstype;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Value : in YYstype) is
begin
Set_Type (Into, TYPE_VALUE, Value.Line, Value.Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_VALUE,
Ref_Counter => ONE,
V => <>);
Into.Node.V := Create_Value (Document, Value);
end Set_Value;
procedure Set_Expr (Into : in out YYstype;
Left : in YYstype;
Right : in YYstype) is
begin
if Left.Kind = TYPE_NULL then
Log.Debug ("Ignoring syntax error in expression");
Into := Left;
elsif Right.Kind = TYPE_NULL then
Log.Debug ("Ignoring syntax error in expression");
Into := Right;
elsif Left.Kind = TYPE_PROPERTY_LIST then
Left.Node.Values.Append (Create_Value (Current_Sheet, Right));
Into := Left;
else
Set_Type (Into, TYPE_PROPERTY_LIST, Left.Line, Left.Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_PROPERTY_LIST,
Ref_Counter => ONE,
Values => <>);
Into.Node.Values.Append (Create_Value (Current_Sheet, Left));
Into.Node.Values.Append (Create_Value (Current_Sheet, Right));
end if;
end Set_Expr;
procedure Set_Expr (Into : in out YYstype;
Left : in YYstype;
Oper : in YYstype;
Right : in YYstype) is
begin
Log.Error (Natural'Image (Left.Line) & ":" & Natural'Image (Left.Column)
& "Expression {0} {1} {2}", To_String (Left), To_String (Oper),
To_String (Right));
end Set_Expr;
procedure Set_Function (Into : in out YYstype;
Document : in CSS.Core.Sheets.CSSStylesheet_Access;
Name : in YYstype;
Params : in YYstype) is
Func_Name : constant String := To_String (Name.Node.Str_Value);
begin
Log.Debug ("Set function {0}", Func_Name);
Set_Type (Into, TYPE_VALUE, Name.Line, Name.Column);
Into.Node := new Parser_Node_Type '(Kind => TYPE_VALUE,
Ref_Counter => ONE,
V => <>);
if Params.Kind = TYPE_VALUE then
Into.Node.V := Document.Values.Create_Function
(Func_Name (Func_Name'First .. Func_Name'Last - 1), Params.Node.V);
elsif Params.Kind /= TYPE_PROPERTY_LIST then
Into.Node.V := Document.Values.Create_Function
(Func_Name (Func_Name'First .. Func_Name'Last - 1), CSS.Core.Values.EMPTY_LIST);
else
Into.Node.V := Document.Values.Create_Function
(Func_Name (Func_Name'First .. Func_Name'Last - 1), Params.Node.Values);
end if;
end Set_Function;
procedure Error (Line : in Natural;
Column : in Natural;
Message : in String) is
Loc : constant Core.Location := Core.Create_Location (Current_Sheet.all'Access,
Line, Column);
begin
Report_Handler.Error (Loc, Message);
end Error;
procedure Warning (Line : in Natural;
Column : in Natural;
Message : in String) is
Loc : constant Core.Location := Core.Create_Location (Current_Sheet.all'Access,
Line, Column);
begin
Report_Handler.Warning (Loc, Message);
end Warning;
overriding
procedure Adjust (Object : in out YYstype) is
begin
if Object.Node /= null then
Util.Concurrent.Counters.Increment (Object.Node.Ref_Counter);
end if;
end Adjust;
overriding
procedure Finalize (Object : in out YYstype) is
begin
Set_Type (Object, TYPE_NULL, 0, 0);
end Finalize;
end CSS.Parser;
|
util/gut/myjb.asm | olifink/smsqe | 0 | 242653 | <gh_stars>0
; Find My JOB ID V2.00 1988 <NAME>
section gen_util
xdef gu_myjb
include 'dev8_keys_qdos_sms'
;+++
; Finds my JOB ID, preserving registers
;
; d0 c r error code
; d1 r job ID
; status returned according to D0
;---
gu_myjb
movem.l d0/d2/a0,-(sp)
moveq #sms.info,d0 ; information
trap #do.sms2
movem.l (sp)+,d0/d2/a0
tst.l d0
rts
end
|
lib/filesys.asm | simondotm/beeb-karateka | 8 | 22345 | ; General file loading / streaming routines
FILESYS_DEBUG=FALSE
FILESYS_BUFFER_ADDR = SCRATCH_RAM_ADDR ; must be page aligned
FILESYS_BUFFER_SIZE = 1 ; PAGES TO READ, MUST BE ONE (for now)
;-------------------------------------------------------------------------
; Load a file
;-------------------------------------------------------------------------
.osfile_params SKIP 18
; X=filename LSB
; Y=filename MSB
; A=load address MSB
.file_load
{
\\ Set osfile param block
stx osfile_params + 0
sty osfile_params + 1
sta osfile_params + 3
lda #0
sta osfile_params + 2
; fall into file_osfile
}
;-------------------------------------------------------------------------
; osfile call
; loads a file into memory
;-------------------------------------------------------------------------
;-------------------------------------------------------------------------
.file_osfile
{
\\ Set osfile param block
lda #0
sta osfile_params + 6
\\ Issue osfile call
ldx #LO(osfile_params)
ldy #HI(osfile_params)
lda #&FF ; loadfile
jsr osfile
rts
}
; File streaming utilities
; Note that only one file can be open at once.
;-------------------------------------------------------------------------
; Open a file for reading
;-------------------------------------------------------------------------
; entry
; X=filename LSB
; Y=filename MSB
; exit
; no outputs
.osgbpb_params SKIP 13
IF FILESYS_DEBUG
.file_text EQUS "Opened file %b", LO(osgbpb_params), HI(osgbpb_params), 13,10,0
.file_text2 EQUS "Could not open file", 13,10, 0
.file_text3 EQUS "Could not read file", 13,10, 0
.file_text4 EQUS "Reading file", 13,10, 0
.file_text5 EQUS "Bad handle for read file", 13,10, 0
ENDIF
.file_open
{
lda #&40 ; open for read
jsr osfind
; stash the opened file handle
sta osgbpb_params+0
bne open_ok
IF FILESYS_DEBUG
MPRINT file_text2
ENDIF
rts
.open_ok
; set memory ptr to 0
lda #0
sta osgbpb_params+1
sta osgbpb_params+2
sta osgbpb_params+3
sta osgbpb_params+4
; set read length to 0
sta osgbpb_params+5
sta osgbpb_params+6
sta osgbpb_params+7
sta osgbpb_params+8
; set file offset to 0
sta osgbpb_params+9
sta osgbpb_params+10
sta osgbpb_params+11
sta osgbpb_params+12
IF FILESYS_DEBUG
MPRINT file_text
ENDIF
rts
}
;-------------------------------------------------------------------------
; Read data from the currently open file
;-------------------------------------------------------------------------
; entry
; X=buffer address LSB
; Y=buffer address MSB
; A=number of 256 byte pages to read
; so max bytes that can be read in one call is 65280
; exit
; returns C=1 on error
; if eof is reached before 256 bytes are read, dword at osgbpb_params+5 contains number of bytes that could not be read
.file_read
{
; set read length msb (eg. bytes*256)
sta osgbpb_params+6
lda osgbpb_params+0
bne file_ok
; invalid file handle
IF FILESYS_DEBUG
MPRINT file_text5
ENDIF
sec
rts
.file_ok
IF FILESYS_DEBUG
; MPRINT file_text
MPRINT file_text4
ENDIF
; store the read memory ptr address
stx osgbpb_params+1
sty osgbpb_params+2
; everything else initialised in file_open
lda #3 ; read data from file to memory, updating read offset ptr sequentially
ldx #LO(osgbpb_params)
ldy #HI(osgbpb_params)
jsr osgbpb
; carry flag will be clear if requested number of bytes were successfully read
IF FILESYS_DEBUG
php
bcc read_ok
MPRINT file_text3
.read_ok
plp
ENDIF
rts
}
;-------------------------------------------------------------------------
; close the currently open file
;-------------------------------------------------------------------------
; no parameters
.file_close
{
lda #0 ; close file
ldy osgbpb_params+0
jsr osfind
lda #0
sta osgbpb_params+0
rts
}
;-------------------------------------------------------------------------
; Get the size in bytes of the currently opened file
;-------------------------------------------------------------------------
; no parameters
; returns
; osargs_params = filesize in bytes (LSB first)
osargs_params=&9C ; 4-byte zero page address for OSARGS output
.file_size
{
lda #2
ldy osgbpb_params+0
ldx #osargs_params
jsr osargs
rts
}
;-------------------------------------------------------------------------
; Stream a file into memory, 256 bytes at a time
;-------------------------------------------------------------------------
; X=filename LSB
; Y=filename MSB
; A=load address MSB (256 byte buffer)
.file_stream
{
; save the MSB write address
sta store+2
; get the currently selected ROM/RAM bank
; BEFORE we do any DFS related work since that will page the DFS ROM in
lda &f4
sta swr_select+1
; open the file
jsr file_open
; jsr file_size
.fetch_loop
; fetch 256 bytes to buffer
ldx #LO(FILESYS_BUFFER_ADDR)
ldy #HI(FILESYS_BUFFER_ADDR)
lda #FILESYS_BUFFER_SIZE ; read a number of 256 byte pages to the buffer
jsr file_read
; if EOF then carry will be set, so push status and check again later
php
.success
.swr_select
; select the destination ROM/RAM bank that was selected on entry to the routine
lda #&FF ; MODIFIED
jsr swr_select_bank
; copy the data to destination
ldx #0
.transfer
lda FILESYS_BUFFER_ADDR,x
.store
sta &ff00,x ; MODIFIED
inx
bne transfer
inc store+2
; restore status of read, if last read was successful continue loop
plp
bcc fetch_loop
rts
} |
Transynther/x86/_processed/AVXALIGN/_st_4k_sm_/i7-8650U_0xd2_notsx.log_1_1197.asm | ljhsiun2/medusa | 9 | 6773 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_st_4k_sm_/i7-8650U_0xd2_notsx.log_1_1197.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xe191, %r14
nop
nop
nop
nop
mfence
movl $0x61626364, (%r14)
nop
xor %rdi, %rdi
lea addresses_normal_ht+0xca95, %r11
nop
nop
nop
nop
nop
sub %r8, %r8
movb (%r11), %al
nop
nop
nop
sub $19302, %rsi
lea addresses_D_ht+0x10935, %r14
nop
nop
nop
nop
xor %rax, %rax
mov (%r14), %r11
nop
nop
add $57193, %r14
lea addresses_normal_ht+0xd935, %rsi
lea addresses_WT_ht+0x7795, %rdi
cmp $37669, %r8
mov $67, %rcx
rep movsb
nop
sub %r14, %r14
lea addresses_WC_ht+0x196e2, %rsi
lea addresses_WT_ht+0x182ed, %rdi
nop
nop
nop
nop
add %r12, %r12
mov $105, %rcx
rep movsb
nop
add %rax, %rax
lea addresses_WT_ht+0x15a95, %r12
nop
add %rax, %rax
movb (%r12), %r11b
nop
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x15695, %r14
and $58406, %rax
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%r14)
add $5261, %r8
lea addresses_A_ht+0xfeb, %r8
and %r14, %r14
mov $0x6162636465666768, %r11
movq %r11, %xmm7
movups %xmm7, (%r8)
add %rcx, %rcx
lea addresses_WC_ht+0xd895, %rsi
lea addresses_D_ht+0x10a21, %rdi
nop
nop
nop
xor $10163, %r12
mov $45, %rcx
rep movsb
nop
nop
nop
nop
add %rax, %rax
lea addresses_WT_ht+0xfe95, %r8
nop
nop
cmp %r11, %r11
and $0xffffffffffffffc0, %r8
vmovaps (%r8), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rax
nop
and $36917, %r12
lea addresses_D_ht+0x1cbb7, %r11
nop
nop
nop
nop
cmp $61853, %r12
mov $0x6162636465666768, %r14
movq %r14, %xmm4
movups %xmm4, (%r11)
dec %rdi
lea addresses_UC_ht+0x1f15, %rsi
lea addresses_A_ht+0xd845, %rdi
nop
nop
nop
inc %r8
mov $56, %rcx
rep movsb
nop
nop
xor $24079, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdx
// Load
mov $0x4735be0000000915, %rdx
nop
nop
nop
nop
and %rbx, %rbx
mov (%rdx), %r10
nop
nop
and $25372, %rbx
// Load
lea addresses_D+0x7515, %rcx
nop
dec %r15
movb (%rcx), %dl
nop
nop
nop
nop
add %r8, %r8
// Store
lea addresses_PSE+0x13a95, %rbx
nop
nop
nop
nop
inc %rcx
movl $0x51525354, (%rbx)
nop
nop
nop
nop
nop
add $3779, %rdx
// Store
mov $0x295, %r8
inc %rdx
movw $0x5152, (%r8)
nop
cmp $51606, %rdx
// Load
lea addresses_A+0x16315, %r10
nop
nop
nop
inc %rbx
mov (%r10), %r8d
sub %rbx, %rbx
// Store
lea addresses_WC+0x1efa5, %rdx
nop
nop
nop
nop
dec %rcx
mov $0x5152535455565758, %r15
movq %r15, %xmm3
vmovups %ymm3, (%rdx)
nop
nop
add $53565, %r14
// Faulty Load
lea addresses_PSE+0x13a95, %r8
nop
and $55163, %r14
mov (%r8), %r10d
lea oracles, %r15
and $0xff, %r10
shlq $12, %r10
mov (%r15,%r10,1), %r10
pop %rdx
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}}
{'54': 1}
54
*/
|
ANTLRTestProjects/antbased/LexerRules/build/classes/TokenWithLexerCommands.g4 | timboudreau/ANTLR4-Plugins-for-NetBeans | 1 | 5204 | <reponame>timboudreau/ANTLR4-Plugins-for-NetBeans
lexer grammar TokenWithLexerCommands;
import ImportedLexerGrammar;
channels { MyChannel }
options { tokenVocab = ImportedTokens; }
tokens { ID6 }
ID1 :
'qwerty'
-> type(ID2), pushMode(MyMode)
;
ID2 :
'azerty'
-> skip, mode(MyMode)
;
ID3 :
'itsuken'
-> more
;
mode MyMode;
ID4 : 'serteth' -> type(ID6), channel(MyChannel), popMode;
ID5 : 'id6' -> type(ID8);
ID7 : 'id7' -> type(TOKEN2); |
alloy4fun_models/trashltl/models/17/7CHFsz9omauHhHQvR.als | Kaixi26/org.alloytools.alloy | 0 | 2767 | open main
pred id7CHFsz9omauHhHQvR_prop18 {
always(all f:Protected | f in Trash implies f not in Protected)
}
pred __repair { id7CHFsz9omauHhHQvR_prop18 }
check __repair { id7CHFsz9omauHhHQvR_prop18 <=> prop18o } |
theorems/homotopy/ConstantToSetFactorization.agda | cmknapp/HoTT-Agda | 0 | 1511 | <filename>theorems/homotopy/ConstantToSetFactorization.agda
{-# OPTIONS --without-K #-}
open import HoTT
module homotopy.ConstantToSetFactorization
{i j} {A : Type i} {B : Type j} (B-is-set : is-set B)
(f : A → B) (f-is-const : ∀ a₁ a₂ → f a₁ == f a₂) where
private
Skel = SetQuotient {A = A} (λ _ _ → Unit)
abstract
Skel-has-all-paths : has-all-paths Skel
Skel-has-all-paths =
SetQuot-elim (λ _ → Π-is-set λ _ → =-preserves-set SetQuotient-is-set)
(λ a₁ →
SetQuot-elim {P = λ s₂ → q[ a₁ ] == s₂}
(λ _ → =-preserves-set SetQuotient-is-set)
(λ _ → quot-rel _)
(λ _ → prop-has-all-paths-↓ (SetQuotient-is-set _ _)))
(λ {a₁ a₂} _ → ↓-cst→app-in λ s₂ →
prop-has-all-paths-↓ (SetQuotient-is-set _ _))
Skel-is-prop : is-prop Skel
Skel-is-prop = all-paths-is-prop Skel-has-all-paths
Skel-lift : Skel → B
Skel-lift = SetQuot-rec B-is-set f (λ {a₁ a₂} _ → f-is-const a₁ a₂)
cst-extend : Trunc -1 A → B
cst-extend = Skel-lift ∘ Trunc-rec Skel-is-prop q[_]
-- The beta rule.
-- This is definitionally true, so you don't need it.
cst-extend-β : cst-extend ∘ [_] == f
cst-extend-β = idp
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_88_372.asm | ljhsiun2/medusa | 9 | 7118 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xac03, %rsi
nop
nop
nop
nop
nop
sub $5700, %rax
mov (%rsi), %r15
nop
sub %rdi, %rdi
lea addresses_normal_ht+0x98dc, %r10
xor $6040, %rcx
movb (%r10), %bl
nop
nop
inc %r10
lea addresses_WT_ht+0xbc43, %r15
nop
nop
add %rdi, %rdi
movups (%r15), %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
nop
nop
nop
inc %rcx
lea addresses_WC_ht+0x2a03, %rsi
lea addresses_WT_ht+0x16632, %rdi
nop
nop
nop
nop
sub $17905, %rbp
mov $75, %rcx
rep movsw
nop
nop
sub %rdi, %rdi
lea addresses_UC_ht+0x9c03, %rsi
lea addresses_A_ht+0xbcb, %rdi
nop
nop
nop
nop
nop
add $191, %r15
mov $37, %rcx
rep movsb
nop
nop
nop
add %rdi, %rdi
lea addresses_WT_ht+0xf403, %rsi
lea addresses_UC_ht+0x17703, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
nop
xor %rbp, %rbp
mov $72, %rcx
rep movsw
nop
nop
nop
add %rbx, %rbx
lea addresses_WT_ht+0xc003, %rsi
clflush (%rsi)
nop
cmp $26808, %rcx
movw $0x6162, (%rsi)
nop
nop
cmp %r15, %r15
lea addresses_D_ht+0x5383, %rbp
nop
xor $41907, %r15
mov (%rbp), %rsi
nop
nop
nop
nop
nop
xor $54990, %rax
lea addresses_D_ht+0xd4fb, %rsi
lea addresses_UC_ht+0x9aff, %rdi
nop
nop
sub $13870, %r15
mov $84, %rcx
rep movsw
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_UC_ht+0xd803, %rsi
lea addresses_normal_ht+0x1df73, %rdi
nop
nop
nop
xor %r15, %r15
mov $65, %rcx
rep movsq
nop
nop
nop
nop
xor $39839, %rcx
lea addresses_UC_ht+0x1eab, %rbx
nop
cmp $50182, %rcx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm7
movups %xmm7, (%rbx)
nop
nop
nop
and $18253, %r15
lea addresses_A_ht+0x1597d, %rdi
nop
nop
nop
nop
nop
sub $5441, %rbp
movups (%rdi), %xmm0
vpextrq $0, %xmm0, %rax
dec %r15
lea addresses_normal_ht+0x1856d, %rsi
lea addresses_D_ht+0x106f3, %rdi
nop
nop
nop
nop
nop
add $13738, %r15
mov $44, %rcx
rep movsl
cmp %rbx, %rbx
lea addresses_A_ht+0x17a03, %rsi
lea addresses_WT_ht+0x18803, %rdi
nop
nop
nop
nop
dec %r15
mov $119, %rcx
rep movsw
nop
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r8
push %r9
push %rcx
push %rsi
// Store
lea addresses_PSE+0x15a3, %rcx
add $65067, %r8
movb $0x51, (%rcx)
nop
cmp $7828, %r11
// Store
lea addresses_normal+0x627e, %r10
clflush (%r10)
nop
cmp %rsi, %rsi
movb $0x51, (%r10)
nop
nop
nop
nop
cmp $7484, %r8
// Load
mov $0x2b9cb70000000d3d, %rcx
nop
nop
nop
nop
nop
sub %r9, %r9
vmovaps (%rcx), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
nop
nop
xor %rcx, %rcx
// Load
lea addresses_RW+0x2343, %rcx
nop
nop
nop
nop
nop
add $39896, %rsi
mov (%rcx), %r8d
nop
nop
dec %r10
// Faulty Load
lea addresses_WT+0x1c403, %r10
nop
dec %rsi
mov (%r10), %rcx
lea oracles, %rsi
and $0xff, %rcx
shlq $12, %rcx
mov (%rsi,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'39': 88}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
libsrc/_DEVELOPMENT/math/float/am9511/lam32/z80/asm_fabsf.asm | ahjelm/z88dk | 640 | 17063 | <reponame>ahjelm/z88dk<filename>libsrc/_DEVELOPMENT/math/float/am9511/lam32/z80/asm_fabsf.asm
; float _fabsf (float number) __z88dk_fastcall
SECTION code_clib
SECTION code_fp_am9511
PUBLIC asm_fabsf
EXTERN asm_am9511_fabs_fastcall
; Takes the absolute value of a float
;
; enter : stack = ret
; DEHL = sccz80_float number
;
; exit : DEHL = |sccz80_float|
;
; uses : de, hl
defc asm_fabsf = asm_am9511_fabs_fastcall
|
legend-pure-m2-dsl-mapping/src/main/antlr4/org/finos/legend/pure/m2/dsl/mapping/serialization/grammar/AggregationAwareParser.g4 | hausea/legend-pure | 37 | 3801 | parser grammar AggregationAwareParser;
options
{
tokenVocab = AggregationAwareLexer;
}
mapping : VIEWS COLON
BRACKET_OPEN
aggregationSpecification (COMMA aggregationSpecification)*
BRACKET_CLOSE
COMMA
mainMapping
EOF
;
aggregationSpecification : GROUP_OPEN
modelOperation COMMA aggregateMapping
GROUP_CLOSE
;
modelOperation : MODEL_OP COLON
CURLY_BRACKET_OPEN CONTENT CURLY_BRACKET_CLOSE
;
aggregateMapping : AGG_MAP COLON parserName
CURLY_BRACKET_OPEN CONTENT CURLY_BRACKET_CLOSE
;
mainMapping : MAIN_MAP COLON parserName
CURLY_BRACKET_OPEN CONTENT CURLY_BRACKET_CLOSE
;
parserName : VALID_STRING
; |
Transynther/x86/_processed/AVXALIGN/_zr_/i3-7100_9_0x84_notsx.log_21829_195.asm | ljhsiun2/medusa | 9 | 92126 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x768a, %rsi
lea addresses_UC_ht+0xc42a, %rdi
nop
nop
nop
nop
dec %r12
mov $81, %rcx
rep movsb
nop
nop
nop
nop
dec %rdx
lea addresses_WC_ht+0xcc2a, %r13
nop
nop
nop
nop
nop
add $57863, %r12
movb (%r13), %cl
nop
dec %r13
lea addresses_A_ht+0x912a, %rsi
clflush (%rsi)
nop
nop
nop
dec %r11
and $0xffffffffffffffc0, %rsi
movntdqa (%rsi), %xmm1
vpextrq $1, %xmm1, %r13
nop
nop
dec %r12
lea addresses_WC_ht+0x302a, %rsi
lea addresses_D_ht+0x1c8ca, %rdi
xor $61964, %rdx
mov $74, %rcx
rep movsl
dec %rsi
lea addresses_WC_ht+0x2df2, %rsi
lea addresses_normal_ht+0x842a, %rdi
clflush (%rsi)
dec %r13
mov $123, %rcx
rep movsw
nop
nop
nop
nop
nop
add %r12, %r12
lea addresses_WC_ht+0xf82a, %rsi
lea addresses_normal_ht+0x372a, %rdi
nop
cmp %rax, %rax
mov $31, %rcx
rep movsl
nop
nop
nop
nop
xor $39147, %rcx
lea addresses_normal_ht+0x11c2a, %rsi
nop
nop
nop
nop
nop
add %rdi, %rdi
mov (%rsi), %r12
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_normal_ht+0x1cc2a, %rdi
clflush (%rdi)
nop
nop
nop
cmp %rcx, %rcx
mov $0x6162636465666768, %rax
movq %rax, %xmm6
and $0xffffffffffffffc0, %rdi
movaps %xmm6, (%rdi)
nop
add $63876, %r11
lea addresses_WT_ht+0x18b32, %rsi
lea addresses_WC_ht+0xf80a, %rdi
nop
nop
nop
nop
xor $21270, %r11
mov $72, %rcx
rep movsq
inc %rsi
lea addresses_A_ht+0x15062, %r11
nop
nop
and $41097, %r12
movb $0x61, (%r11)
nop
nop
xor $29955, %rdx
lea addresses_D_ht+0x1042a, %rsi
lea addresses_WC_ht+0x688a, %rdi
nop
nop
xor $9406, %r11
mov $84, %rcx
rep movsb
add %rdi, %rdi
lea addresses_UC_ht+0x565a, %rax
nop
dec %rdx
movb $0x61, (%rax)
nop
sub $14535, %r12
lea addresses_normal_ht+0xc0e, %r12
nop
nop
add %rcx, %rcx
movw $0x6162, (%r12)
nop
and $42822, %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdx
// Load
lea addresses_A+0xd42a, %rbp
nop
cmp $8030, %r12
vmovups (%rbp), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %r9
nop
sub $20807, %rdx
// Store
lea addresses_RW+0x7f2a, %rbp
nop
nop
inc %rcx
movb $0x51, (%rbp)
nop
add %r14, %r14
// Store
lea addresses_US+0x114c6, %rcx
nop
nop
nop
nop
sub $51554, %r8
mov $0x5152535455565758, %r14
movq %r14, (%rcx)
nop
nop
nop
nop
nop
dec %r14
// Store
lea addresses_normal+0x1dbba, %r12
cmp %rcx, %rcx
movb $0x51, (%r12)
nop
nop
nop
nop
nop
and %r12, %r12
// Store
lea addresses_US+0x8c2a, %rbp
nop
nop
nop
nop
add %rcx, %rcx
movl $0x51525354, (%rbp)
nop
nop
cmp $14023, %r12
// Store
mov $0x3b3fc40000000b2a, %rcx
nop
nop
nop
nop
nop
sub %r14, %r14
movl $0x51525354, (%rcx)
nop
nop
add $40351, %rbp
// Store
lea addresses_UC+0x738a, %rbp
nop
nop
nop
nop
nop
inc %rcx
movw $0x5152, (%rbp)
nop
add $41212, %r12
// Store
lea addresses_normal+0x10bda, %rbp
nop
nop
add %r8, %r8
mov $0x5152535455565758, %r9
movq %r9, %xmm0
movups %xmm0, (%rbp)
nop
inc %rbp
// Faulty Load
lea addresses_US+0x1142a, %r8
nop
nop
nop
nop
add $7218, %rdx
mov (%r8), %rcx
lea oracles, %r9
and $0xff, %rcx
shlq $12, %rcx
mov (%r9,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_US', 'same': False, 'size': 8, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_US', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'same': True, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 11, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
archive/echo2.asm | CodeSwimBikeRun/nasm-function | 0 | 11505 | <gh_stars>0
EXTERN exit-1
section .text
global _main
_main:
call exit-1 |
db2z/src/DB2zSQLParser.g4 | Trisk3lion/mapa | 6 | 6371 | /*
Copyright (C) 2021 <NAME>. All rights reserved. I accept
no liability for damages of any kind resulting from the use of this
software. Use at your own risk.
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
Rules for Db2 for z/OS SQL statements that can be embedded in an
application program are included here. Version 12 documentation
served as source material.
The ALTER FUNCTION variations (external), (inlined SQL scalar), and
(SQL table) are all variations on each other and are contained in
the alterFunctionStatement rule.
The rule signalStatement is not a full implementation of the syntax
of the SIGNAL statement, but a subset that is possible to embed in
an application program.
The rule trustedContextOptionList does not strictly match its
syntax diagram, for reasons documented with the rule.
The rule executeImmediateStatement only partially implements the
syntax of the EXECUTE IMMEDIATE statement in order to avoid
implementing a grammar for the entire PL/I language here. The same
is true of the prepareStatement rule.
This grammar does not include SQL/PL or the following SQL statements.
ALTER FUNCTION (compiled SQL scalar)
ALTER PROCEDURE (SQL - external)
ALTER PROCEDURE (SQL - native)
ALTER TRIGGER (advanced)
CREATE FUNCTION (compiled SQL scalar)
CREATE PROCEDURE (SQL - native)
CREATE TRIGGER (advanced)
*/
parser grammar DB2zSQLParser;
options {tokenVocab=DB2zSQLLexer;}
startRule : sqlStatement* | EOF ;
/*
The order of the releaseSavepointStatement and
releaseConnectionStatement rules is significant. In order
for savepoints to be recognized correctly the former
must come before the latter.
*/
sqlStatement
: EXEC_SQL?
(
query
| allocateCursorStatement
| alterDatabaseStatement
| alterFunctionStatement
| alterIndexStatement
| alterMaskStatement
| alterPermissionStatement
| alterProcedureStatement
| alterSequenceStatement
| alterStogroupStatement
| alterTableStatement
| alterTablespaceStatement
| alterTriggerStatement
| alterTrustedContextStatement
| alterViewStatement
| associateLocatorsStatement
| beginDeclareSectionStatement
| callStatement
| closeStatement
| commitStatement
| commentStatement
| connectStatement
| createAliasStatement
| createAuxiliaryTableStatement
| createDatabaseStatement
| createFunctionStatement
| createGlobalTemporaryTableStatement
| createIndexStatement
| createLobTablespaceStatement
| createMaskStatement
| createPermissionStatement
| createProcedureStatement
| createRoleStatement
| createSequenceStatement
| createStogroupStatement
| createTableStatement
| createTablespaceStatement
| createTriggerStatement
| createTrustedContextStatement
| createTypeArrayStatement
| createTypeDistinctStatement
| createVariableStatement
| createViewStatement
| declareCursorStatement
| declareGlobalTemporaryTableStatement
| declareTableStatement
| declareVariableStatement
| declareStatementStatement
| deleteStatement
| describeStatement
| dropStatement
| endDeclareSectionStatement
| exchangeStatement
| executeStatement
| executeImmediateStatement
| explainStatement
| fetchStatement
| freeLocatorStatement
| getDiagnosticsStatement
| grantStatement
| holdLocatorStatement
| includeStatement
| insertStatement
| labelStatement
| lockTableStatement
| mergeStatement
| openStatement
| prepareStatement
| refreshTableStatement
| releaseSavepointStatement
| releaseConnectionStatement
| renameStatement
| revokeStatement
| rollbackStatement
| savepointStatement
| setConnectionStatement
| setEncryptionPasswordStatement
| setPathStatement
| setSchemaStatement
| setSessionTimezoneStatement
| setSpecialRegisterStatement
| setAssignmentStatement
| signalStatement
| transferOwnershipStatement
| truncateStatement
| updateStatement
| valuesIntoStatement
| wheneverStatement
)
(SEMICOLON | (END_EXEC DOT?) | EOF)
;
query
: (
subSelect
| fullSelect
| selectStatement
| selectIntoStatement
)
;
cursorName
: identifier
;
statementName
: identifier
;
descriptorName
: hostVariable
;
holdability
: ((WITHOUT HOLD) | (WITH HOLD))
;
returnability
: ((WITHOUT RETURN) | (WITH RETURN ((TO CALLER) | (TO CLIENT))?))
;
rowsetPositioning
: ((WITHOUT ROWSET POSITIONING) | (WITH ROWSET POSITIONING))
;
notNullPhrase
: ((NOT NULL) | (NOT NULL WITH DEFAULT))
;
allocateCursorStatement
: (ALLOCATE cursorName CURSOR FOR RESULT SET rsLocatorVariable)
;
rsLocatorVariable
: hostVariable
;
alterDatabaseStatement
: (
ALTER DATABASE databaseName
(bufferpoolOption
| (INDEXBP bpName)
| (STOGROUP stogroupName)
| (CCSID ccsidValue))+
)
;
alterFunctionStatement
: (
ALTER
((FUNCTION functionName (LPAREN functionParameterType (COMMA functionParameterType)* RPAREN)?)
| (SPECIFIC FUNCTION specificName))
RESTRICT?
functionOptionList+
)
;
alterIndexStatement
: (
ALTER INDEX indexName regenerateClause?
alterIndexOptions*
(alterIndexPartitionOptions (COMMA alterIndexPartitionOptions)*)?
)
;
alterMaskStatement
: (
ALTER MASK maskName (ENABLE | DISABLE | regenerateClause)
)
;
alterPermissionStatement
: (
ALTER PERMISSION permissionName (ENABLE | DISABLE | regenerateClause)
)
;
alterProcedureStatement
: (
ALTER PROCEDURE procedureName procedureOptionList+
)
;
alterSequenceStatement
: (
ALTER SEQUENCE sequenceName alterSequenceOptionList+
)
;
alterStogroupStatement
: (
ALTER STOGROUP stogroupName alterStogroupOptionList+
)
;
alterTableStatement
: (
ALTER TABLE alterTableName alterTableOptionList+
)
;
alterTablespaceStatement
: (
ALTER TABLESPACE (databaseName DOT)? tablespaceName
alterTablespaceOptionList*
alterPartitionClause?
moveTableClause?
)
;
alterTriggerStatement
: (
ALTER TRIGGER (schemaName DOT) triggerName NOT? SECURED
)
;
alterTrustedContextStatement
: (
ALTER TRUSTED CONTEXT contextName trustedContextOptionList+
)
;
alterViewStatement
: (
ALTER VIEW viewName REGENERATE
(USING APPLICATION COMPATIBILITY applCompatValue)?
)
;
associateLocatorsStatement
: (
ASSOCIATE (RESULT SET)? (LOCATOR | LOCATORS)
LPAREN rsLocatorVariable (COMMA rsLocatorVariable)* RPAREN
WITH PROCEDURE (procedureName | hostVariable)
)
;
beginDeclareSectionStatement
: (BEGIN DECLARE SECTION)
;
callStatement
: (
CALL (procedureName | hostVariable)
(LPAREN (
((expression | NULL | (TABLE tableName)) (COMMA (expression | NULL | (TABLE tableName)))*)
| (USING DESCRIPTOR hostVariable)
) RPAREN)?
)
;
closeStatement
: (CLOSE cursorName)
;
commentStatement
: (
COMMENT ON ((
(aliasDesignator
| (COLUMN tableName DOT columnName)
| (functionDesignator ((ACTIVE VERSION) | (VERSION routineVersionID))?)
| (INDEX indexName)
| (PACKAGE packageDesignator)
| (PLAN planName)
| (PROCEDURE procedureName ((ACTIVE VERSION) | (VERSION routineVersionID))?)
| (ROLE roleName)
| (SEQUENCE sequenceName)
| (TABLE tableName)
| (TRIGGER triggerName ((ACTIVE VERSION) | (VERSION routineVersionID))?)
| (TRUSTED CONTEXT contextName)
| (TYPE typeName)
| (MASK maskName)
| (PERMISSION permissionName)
| (VARIABLE variableName))
IS NONNUMERICLITERAL)
| multipleColumnList)
)
;
commitStatement
: (COMMIT WORK?)
;
connectStatement
: (
CONNECT (
(TO (locationName | hostVariable) authorization?)
| RESET
| authorization)?
)
;
createAliasStatement
: (
CREATE PUBLIC? ALIAS (sequenceAlias | tableAlias)
)
;
createAuxiliaryTableStatement
: (
CREATE (AUX | AUXILIARY) TABLE auxTableName IN databaseName? tablespaceName
STORES tableName appendClause? COLUMN columnName PART INTEGERLITERAL
)
;
createDatabaseStatement
: (
CREATE DATABASE databaseName databaseOptionList*
)
;
createFunctionStatement
: (
createFunctionStatementExternalScalar
| createFunctionStatementExternalTable
| createFunctionStatementSourced
| createFunctionStatementInlineSqlScalar
)
;
createFunctionStatementExternalScalar
: (
CREATE FUNCTION functionName
LPAREN (parameterDeclaration1 (COMMA parameterDeclaration1)*)? RPAREN
createFunctionStatementExternalScalarOptions+
)
;
createFunctionStatementExternalTable
: (
CREATE FUNCTION functionName
LPAREN (parameterDeclaration1 (COMMA parameterDeclaration1)*)? RPAREN
createFunctionStatementExternalTableOptions+
)
;
createFunctionStatementSourced
: (
CREATE FUNCTION functionName
LPAREN (parameterDeclaration1 (COMMA parameterDeclaration1)*)? RPAREN
createFunctionStatementSourcedOptions+
)
;
createFunctionStatementInlineSqlScalar
: (
CREATE FUNCTION functionName
LPAREN ((parameterDeclaration2 (COMMA parameterDeclaration2)*)?) RPAREN
createFunctionStatementInlineSqlScalarOptions+
)
;
createGlobalTemporaryTableStatement
: (
CREATE GLOBAL TEMPORARY TABLE tableName
((LPAREN createGlobalTemporaryTableColumnDefinition (COMMA createGlobalTemporaryTableColumnDefinition)* RPAREN)
| (LIKE tableName))
ccsidClause1?
)
;
createIndexStatement
: (
CREATE (UNIQUE (WHERE NOT NULL)?)? INDEX indexName ON
((tableName LPAREN
(columnName | keyExpression) (ASC | DESC | RANDOM)?
(COMMA (columnName | keyExpression) (ASC | DESC | RANDOM)?)*
(COMMA BUSINESS_TIME (WITH | WITHOUT) OVERLAPS)?
RPAREN)
| (auxTableName))
createIndexOptionList*
)
;
createLobTablespaceStatement
: (
CREATE LOB TABLESPACE tablespaceName createLobTablespaceOptionList*
)
;
createMaskStatement
: (
CREATE MASK maskName ON tableName (AS? correlationName)?
FOR COLUMN columnName RETURN caseExpression enableDisableOption?
)
;
createPermissionStatement
: (
CREATE PERMISSION permissionName ON tableName (AS? correlationName)?
FOR ROWS WHERE searchCondition ENFORCED FOR ALL ACCESS enableDisableOption?
)
;
createProcedureStatement
: (
CREATE (OR REPLACE)? PROCEDURE procedureName
(LPAREN parameterDeclaration3 (COMMA parameterDeclaration3)* RPAREN)?
createProcedureOptionList+
)
;
createRoleStatement
: (
CREATE ROLE roleName
)
;
createSequenceStatement
: (
CREATE SEQUENCE sequenceName createSequenceOptionList+
)
;
createStogroupStatement
: (
CREATE STOGROUP stogroupName
(VOLUMES
(LPAREN (volumeID | NONNUMERICLITERAL | SPLAT)
(COMMA (volumeID | NONNUMERICLITERAL | SPLAT))*
RPAREN))?
VCAT catalogName
dataclasOption?
mgmtclasOption?
storclasOption?
keyLabelOption?
)
;
createTableStatement
: (
CREATE TABLE tableName
(
(LPAREN
(createTableColumnDefinition
| periodDefinition
| uniqueConstraint
| referentialConstraint
| checkConstraint)
(COMMA
(createTableColumnDefinition
| periodDefinition
| uniqueConstraint
| referentialConstraint
| checkConstraint))*
RPAREN)
| (LIKE tableName copyOptions?)
| (asResultTable copyOptions?)
| createTableMaterializedQueryDefinition
)
createTableInClause?
partitioningClause?
organizationClause?
editprocClause?
validprocClause?
auditClause?
obidClause?
dataCaptureClause?
restrictOnDropClause?
ccsidClause1?
cardinalityClause?
loggedOption?
compressOption?
appendClause?
dssizeOption?
bufferpoolOption?
memberClause?
trackmodClause?
pagenumClause?
keyLabelOption?
)
;
createTablespaceStatement
: (
CREATE TABLESPACE tablespaceName
createTablespaceOptionList*
)
;
/*
The syntax accepts WRAPPED obfuscatedStatementText, but not
in a static SQL context so it is not supported here.
*/
createTriggerStatement
: (
CREATE TRIGGER triggerName triggerDefinition
)
;
createTrustedContextStatement
: (
CREATE TRUSTED CONTEXT contextName
BASED UPON CONNECTION USING SYSTEM AUTHID authorizationName
(trustedContextDefaultRoleClause
| trustedContextEnableDisableClause
| trustedContextDefaultSecurityLabelClause
| trustedContextAttributesClause
| trustedContextWithUseForClause)+
)
;
createTypeArrayStatement
: (
CREATE TYPE arrayTypeName AS createTypeArrayBuiltinType
ARRAY OPENSQBRACKET (INTEGERLITERAL | createTypeArrayBuiltinType2) CLOSESQBRACKET
)
;
createTypeDistinctStatement
: (
CREATE TYPE distinctTypeName AS sourceDataType (INLINE LENGTH INTEGERLITERAL)?
)
;
createVariableStatement
: (
CREATE VARIABLE variableName
(createVariableBuiltInType | arrayTypeName)
(DEFAULT (NULL | INTEGERLITERAL | NONNUMERICLITERAL | specialRegister))?
)
;
createViewStatement
: (
CREATE VIEW viewName
LPAREN columnName (COMMA columnName)* RPAREN AS
(WITH commonTableExpression (COMMA commonTableExpression)*)?
fullSelect
createViewCheckOptionClause?
)
;
declareCursorStatement
: (
DECLARE cursorName
((NO SCROLL) | ((ASENSITIVE | INSENSITIVE | (SENSITIVE (DYNAMIC | STATIC))) SCROLL))?
CURSOR (holdability | returnability | rowsetPositioning)* FOR (selectStatement | statementName)
)
;
declareGlobalTemporaryTableStatement
: (
DECLARE GLOBAL TEMPORARY TABLE tableName
((LPAREN declareGlobalTemporaryTableColumnDefinition
(COMMA declareGlobalTemporaryTableColumnDefinition)* RPAREN)
| declareGlobalTemporaryTableLikeClause
| declareGlobalTemporaryTableAsResultTable)
(ccsidClause1
| onCommitClause
| loggedWithRollbackClause)*
)
;
declareTableStatement
: (
DECLARE tableName TABLE LPAREN
(columnName dataType notNullPhrase?)
(COMMA columnName dataType notNullPhrase?)*
RPAREN
)
;
declareStatementStatement
: (DECLARE statementName (COMMA statementName)* STATEMENT)
;
declareVariableStatement
: (
DECLARE hostVariable (COMMA hostVariable)* VARIABLE
((ccsidClause1 forDataQualifier) | ccsidClause1 | forDataQualifier | ccsidClause2)?
)
;
deleteStatement
: (searchedDelete | positionedDelete)
;
describeStatement
: (
describeCursorStatement
| describeInputStatement
| describeOutputStatement
| describeProcedureStatement
| describeTableStatement
)
;
describeCursorStatement
: (
DESCRIBE CURSOR (cursorName | hostVariable) INTO descriptorName
)
;
describeInputStatement
: (
DESCRIBE INPUT statementName INTO descriptorName
)
;
describeOutputStatement
: (
DESCRIBE OUTPUT? statementName INTO descriptorName describeUsingOption?
)
;
describeProcedureStatement
: (
DESCRIBE PROCEDURE (procedureName | hostVariable) INTO descriptorName
)
;
describeTableStatement
: (
DESCRIBE TABLE hostVariable INTO descriptorName describeUsingOption?
)
;
dropStatement
: (
DROP
(aliasDesignation
| dropDatabaseClause
| dropFunctionClause
| dropIndexClause
| dropMaskClause
| dropPackageClause
| dropPermissionClause
| dropProcedureClause
| dropRoleClause
| dropSequenceClause
| dropStogroupClause
| dropSynonymClause
| dropTableClause
| dropTablespaceClause
| dropTriggerClause
| dropTrustedContextClause
| dropTypeClause
| dropVariableClause
| dropViewClause)
)
;
endDeclareSectionStatement
: (END DECLARE SECTION)
;
exchangeStatement
: (EXCHANGE DATA BETWEEN TABLE tableName AND tableName)
;
executeStatement
: (
EXECUTE statementName
((USING (variable | arrayElementSpecification) (COMMA (variable | arrayElementSpecification))*)
| (USING DESCRIPTOR descriptorName)
| sourceRowData)
)
;
/*
This rule _almost_ covers the syntax. The NONNUMERICLITERAL
token corresponds to what the documentation refers to as
string-expression, which "is any PL/I expression that yields
a string." I'm not going to implement a grammar for the
entire PL/I language here.
*/
executeImmediateStatement
: (EXECUTE IMMEDIATE (variable | NONNUMERICLITERAL))
;
explainStatement
: (
EXPLAIN
(explainPlanClause
| explainStmtcacheClause
| explainPackageClause
| explainStabilizedDynamicQueryClause)
)
;
/*
The syntax diagram in the documentation lists fetchOrientation
as required. It is optional here because one of its variants is
optional.
*/
fetchStatement
: (
FETCH (INSENSITIVE | SENSITIVE)? (WITH CONTINUE)?
fetchOrientation? FROM? cursorName
(singleRowFetch | multipleRowFetch)?
)
;
freeLocatorStatement
: (FREE LOCATOR hostVariable (COMMA hostVariable)*)
;
getDiagnosticsStatement
: (
GET (CURRENT | STACKED)? DIAGNOSTICS
(statementInformation | conditionInformation | combinedInformation)
)
;
grantStatement
: (
grantCollectionStatement
| grantDatabaseStatement
| grantFunctionOrProcedureStatement
| grantPackageStatement
| grantPlanStatement
| grantSchemaStatement
| grantSequenceStatement
| grantSystemStatement
| grantTableStatement
| grantTypeOrJarStatement
| grantVariableStatement
| grantUseOfStatement
)
;
holdLocatorStatement
: (HOLD LOCATOR hostVariable (COMMA hostVariable)*)
;
includeStatement
: (INCLUDE memberName)
;
insertStatement
: (
INSERT INTO tableName (LPAREN columnName (COMMA columnName)* RPAREN)?
includeColumns?
(OVERRIDING USER VALUE)?
((VALUES (valuesList1 |
(LPAREN valuesList1 (COMMA valuesList1)* RPAREN)))
| ((WITH commonTableExpression (COMMA commonTableExpression)*)?
fullSelect isolationClause? querynoClause?)
| multipleRowInsert)
)
;
labelStatement
: (
LABEL ON
((((TABLE tableName)
| (ALIAS aliasName)
| (COLUMN tableName DOT columnName))
IS NONNUMERICLITERAL)
| (tableName LPAREN
columnName IS NONNUMERICLITERAL
(COMMA columnName IS NONNUMERICLITERAL)*
RPAREN))
)
;
lockTableStatement
: (
LOCK TABLE tableName ((PARTITION | PART) INTEGERLITERAL)? IN (SHARE | EXCLUSIVE) MODE_
)
;
mergeStatement
: (
MERGE INTO tableName correlationClause? includeColumns?
USING ((LPAREN* tableReference RPAREN*) | sourceValues) ON searchCondition
(WHEN matchingCondition THEN (modificationOperation | signalStatement))+ (ELSE IGNORE)?
notAtomicPhrase?
querynoClause?
)
;
openStatement
: (
OPEN cursorName
((USING variable (COMMA variable)*)
| (USING DESCRIPTOR descriptorName))?
)
;
/*
This is incomplete, as the FROM string-expression phrase is
not implemented because it is specific to PL/I, string-expression
can be any valid PL/I string expression, and I'm not going to
implement the entirety of the PL/I language here.
*/
prepareStatement
: (
PREPARE statementName
(INTO descriptorName (USING (NAMES | LABELS | ANY | BOTH))?)?
(ATTRIBUTES hostVariable)? FROM variable
)
;
refreshTableStatement
: (
REFRESH TABLE tableName (QUERYNO INTEGERLITERAL)?
)
;
releaseConnectionStatement
: (
RELEASE (CURRENT | (ALL SQL?) | locationName | hostVariable)
)
;
releaseSavepointStatement
: (RELEASE TO? SAVEPOINT savepointName)
;
renameStatement
: (
RENAME ((TABLE? tableName TO tableName) | (INDEX indexName TO indexName))
)
;
revokeStatement
: (
revokeCollectionStatement
| revokeDatabaseStatement
| revokeFunctionOrProcedureStatement
| revokePackageStatement
| revokePlanStatement
| revokeSchemaStatement
| revokeSequenceStatement
| revokeSystemStatement
| revokeTableStatement
| revokeTypeOrJarStatement
| revokeVariableStatement
| revokeUseOfStatement
)
;
rollbackStatement
: (ROLLBACK WORK? (TO SAVEPOINT savepointName?)?)
;
savepointStatement
: (
SAVEPOINT savepointName UNIQUE?
((ON ROLLBACK RETAIN CURSORS) | (ON ROLLBACK RETAIN LOCKS))+
)
;
setAssignmentStatement
: (
SET setAssignmentClause
)
;
setConnectionStatement
: (SET CONNECTION (locationName | hostVariable))
;
/*
The SET statement for this particular special register does not
conform to the pattern set by all the others. There's always one.
*/
setEncryptionPasswordStatement
: (
SET ENCRYPTION_PASSWORD EQ? (NONNUMERICLITERAL | variable)
(WITH HINT EQ? (NONNUMERICLITERAL | variable))?
)
;
/*
PATH is a token. CURRENT PATH is a token. Sometimes the former
is a synonym for the latter. And sometimes not.
*/
setPathStatement
: (SET (PATH | CURRENT_PATH) EQ? expression (COMMA? expression)*)
;
/*
SCHEMA is a token. CURRENT SCHEMA is a token, as is CURRENT_SCHEMA which
is considered equivalent. Sometimes the former is a synonym for either of
the latter. And sometimes not.
*/
setSchemaStatement
: (SET (SCHEMA | CURRENT_SCHEMA) EQ? expression)
;
/*
SESSIONTIMEZONE, SESSION TIME ZONE, SESSION TIMEZONE, TIME ZONE,
and TIMEZONE are all synonyms for each other in this context.
Changing the lexer rule for SESSION_TIME_ZONE to match all of
the above broke other things that expect TIME and ZONE to be
separate tokens. So here we are.
*/
setSessionTimezoneStatement
: (SET (SESSION_TIME_ZONE | (TIME ZONE) | TIMEZONE) EQ? (variable | NONNUMERICLITERAL))
;
setSpecialRegisterStatement
: (SET specialRegister EQ? (expression | NULL) (COMMA? expression)*)
;
signalStatement
: (
SIGNAL SQLSTATE VALUE? NONNUMERICLITERAL signalInformation?
)
;
transferOwnershipStatement
: (
TRANSFER OWNERSHIP OF ownedObject TO newOwner REVOKE PRIVILEGES
)
;
truncateStatement
: (
TRUNCATE TABLE? tableName ((DROP | REUSE) STORAGE)?
((IGNORE | (RESTRICT WHEN)) DELETE TRIGGERS)?
IMMEDIATE?
)
;
updateStatement
: (searchedUpdate | positionedUpdate)
;
valuesStatement
: (
VALUES (expression | (LPAREN expression (COMMA expression)* RPAREN))
)
;
valuesIntoStatement
: (
VALUES
(expression | NULL | (LPAREN (expression | NULL) (COMMA (expression | NULL))* RPAREN))
INTO ((valuesIntoTargetVariable (COMMA valuesIntoTargetVariable)*) | arrayElementSpecification)
)
;
wheneverStatement
: (
WHENEVER ((NOT FOUND) | SQLERROR | SQLWARNING)
(CONTINUE | ((GOTO | (GO TO)) COLON? hostLabel))
)
;
/*
These happen to be the same right now. Taking advantage of that,
but insulating myself against future changes too.
*/
valuesIntoTargetVariable
: (setAssignmentTargetVariable)
;
ownedObject
: (
(DATABASE databaseName)
| (INDEX indexName)
| (STOGROUP stogroupName)
| (TABLE tableName)
| (TABLESPACE (databaseName DOT)? tablespaceName)
| (VIEW viewName)
)
;
newOwner
: (
(ROLE roleName)
| (USER authorizationName)
| (SESSION_USER)
)
;
grantCollectionStatement
: (
GRANT (CREATE | PACKADM) (ON | IN) COLLECTION
((collectionID (COMMA collectionID)*) | SPLAT) TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantDatabaseStatement
: (
GRANT grantDatabaseAuthority (COMMA grantDatabaseAuthority)*
ON DATABASE databaseName (COMMA databaseName)* TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantFunctionOrProcedureStatement
: (
GRANT EXECUTE ON
((FUNCTION functionSpecification (COMMA functionSpecification)*)
| (FUNCTION SPLAT)
| (SPECIFIC FUNCTION specificName (COMMA specificName)*)
| (PROCEDURE ((procedureName (COMMA procedureName)*) | SPLAT)))
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantPackageStatement
: (
GRANT (ALL | (grantPackageAuthority (COMMA grantPackageAuthority)*))
ON PACKAGE packageSpecification (COMMA packageSpecification)*
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantPlanStatement
: (
GRANT grantPlanAuthority (COMMA grantPlanAuthority)*
ON PLAN planName (COMMA planName)*
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantSchemaStatement
: (
GRANT grantSchemaAuthority (COMMA grantSchemaAuthority)*
ON SCHEMA (SPLAT | (schemaName (COMMA schemaName)*))
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantSequenceStatement
: (
GRANT grantSequenceAuthority (COMMA grantSequenceAuthority)*
ON SEQUENCE sequenceName (COMMA sequenceName)*
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantSystemStatement
: (
GRANT grantSystemAuthority (COMMA grantSystemAuthority)*
(ON SYSTEM)?
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantTableStatement
: (
GRANT grantTableAuthority (COMMA grantTableAuthority)*
ON TABLE? tableName
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantTypeOrJarStatement
: (
GRANT USAGE ON
(((DATA | DISTINCT)? TYPE typeName (COMMA typeName)*)
| (JAR jarName (COMMA jarName)*))
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantVariableStatement
: (
GRANT grantVariableAuthority (COMMA grantVariableAuthority)*
ON VARIABLE variableName (COMMA variableName)*
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
grantUseOfStatement
: (
GRANT USE OF grantUseOfTarget
TO
grantee (COMMA grantee)*
withGrantOption?
)
;
revokeCollectionStatement
: (
REVOKE (CREATE | PACKADM) (ON | IN) COLLECTION
((collectionID (COMMA collectionID)*) | SPLAT) FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
revokeDatabaseStatement
: (
REVOKE grantDatabaseAuthority (COMMA grantDatabaseAuthority)*
ON DATABASE databaseName (COMMA databaseName)* FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
revokeFunctionOrProcedureStatement
: (
REVOKE EXECUTE ON
((FUNCTION functionSpecification (COMMA functionSpecification)*)
| (FUNCTION SPLAT)
| (SPECIFIC FUNCTION specificName (COMMA specificName)*)
| (PROCEDURE ((procedureName (COMMA procedureName)*) | SPLAT)))
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
RESTRICT?
)
;
revokePackageStatement
: (
REVOKE (ALL | (grantPackageAuthority (COMMA grantPackageAuthority)*))
ON PACKAGE packageSpecification (COMMA packageSpecification)*
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
revokePlanStatement
: (
REVOKE grantPlanAuthority (COMMA grantPlanAuthority)*
ON PLAN planName (COMMA planName)*
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
revokeSchemaStatement
: (
REVOKE grantSchemaAuthority (COMMA grantSchemaAuthority)*
ON SCHEMA (SPLAT | (schemaName (COMMA schemaName)*))
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
revokeSequenceStatement
: (
REVOKE grantSequenceAuthority (COMMA grantSequenceAuthority)*
ON SEQUENCE sequenceName (COMMA sequenceName)*
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
RESTRICT?
)
;
revokeSystemStatement
: (
REVOKE grantSystemAuthority (COMMA grantSystemAuthority)*
(ON SYSTEM)?
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
revokeTableStatement
: (
REVOKE grantTableAuthority (COMMA grantTableAuthority)*
ON TABLE? tableName
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
revokeTypeOrJarStatement
: (
REVOKE USAGE ON
(((DATA | DISTINCT)? TYPE typeName (COMMA typeName)*)
| (JAR jarName (COMMA jarName)*))
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
RESTRICT?
)
;
/*
The syntax diagram in the documentation says the RESTRICT option
comes before the revokeDependentPrivilegesOption in this
particular case.
*/
revokeVariableStatement
: (
REVOKE grantVariableAuthority (COMMA grantVariableAuthority)*
ON VARIABLE variableName (COMMA variableName)*
FROM
grantee (COMMA grantee)*
revokeByOption?
RESTRICT?
revokeDependentPrivilegesOption?
)
;
revokeUseOfStatement
: (
REVOKE USE OF grantUseOfTarget
FROM
grantee (COMMA grantee)*
revokeByOption?
revokeDependentPrivilegesOption?
)
;
grantUseOfTarget
: (
(BUFFERPOOL bpName (COMMA bpName)*)
| (ALL BUFFERPOOLS)
| (STOGROUP stogroupName (COMMA stogroupName)*)
| (TABLESPACE (databaseName DOT)? tablespaceName (COMMA (databaseName DOT)? tablespaceName)*)
)
;
grantVariableAuthority
: (
(ALL PRIVILEGES?)
| READ
| WRITE
)
;
grantTableAuthority
: (
(ALL PRIVILEGES?)
| ALTER
| DELETE
| INDEX
| INSERT
| (REFERENCES (LPAREN columnName (COMMA columnName)* RPAREN)?)
| SELECT
| TRIGGER
| UNLOAD
| (UPDATE (LPAREN columnName (COMMA columnName)* RPAREN)?)
)
;
grantSystemAuthority
: (
ACCESSCTRL
| ARCHIVE
| BINDADD
| BINDAGENT
| BSDS
| CREATEALIAS
| CREATEDBA
| CREATEDBC
| CREATESG
| CREATETMTAB
| CREATE_SECURE_OBJECT
| DATAACCESS
| (DBADM ((WITH | WITHOUT) ACCESSCTRL)? ((WITH | WITHOUT) DATAACCESS)?)
| DEBUGSESSION
| DISPLAY
| EXPLAIN
| MONITOR1
| MONITOR2
| RECOVER
| SQLADM
| STOPALL
| STOSPACE
| SYSADM
| SYSCTRL
| SYSOPR
| TRACE
)
;
grantSequenceAuthority
: (
ALTER
| USAGE
)
;
grantSchemaAuthority
: (
ALTERIN
| CREATEIN
| DROPIN
)
;
grantPlanAuthority
: (
BIND
| EXECUTE
)
;
grantPackageAuthority
: (
BIND
| COPY
| EXECUTE
| RUN
)
;
packageSpecification
: (collectionID DOT (packageName | SPLAT))
;
functionSpecification
: (
functionName (LPAREN functionParameterType (COMMA functionParameterType)* RPAREN)?
)
;
grantee
: (authorizationName | (ROLE roleName) | PUBLIC)
;
withGrantOption
: (WITH GRANT OPTION)
;
revokeByOption
: (
BY
(ALL
| ((authorizationName | (ROLE roleName))
(COMMA (authorizationName | (ROLE roleName)))*))
)
;
revokeDependentPrivilegesOption
: (NOT? INCLUDING DEPENDENT PRIVILEGES)
;
grantDatabaseAuthority
: (
DBADM
| DBCTRL
| DBMAINT
| CREATETAB
| CREATETS
| DISPLAYDB
| DROP
| IMAGCOPY
| LOAD
| RECOVERDB
| REORG
| REPAIR
| STARTDB
| STATS
| STOPDB
)
;
statementInformation
: (
(statementInformationVariableEquate (COMMA statementInformationVariableEquate)*)
| (variable EQ DB2_GET_DIAGNOSTICS_DIAGNOSTICS)
| (variable EQ DB2_SQL_NESTING_LEVEL)
)
;
statementInformationVariableEquate
: (variable EQ statementInformationItemName)
;
statementInformationItemName
: (
DB2_LAST_ROW
| DB2_NUMBER_PARAMETER_MARKERS
| DB2_NUMBER_RESULT_SETS
| DB2_NUMBER_ROWS
| DB2_RETURN_STATUS
| DB2_SQL_ATTR_CURSOR_HOLD
| DB2_SQL_ATTR_CURSOR_ROWSET
| DB2_SQL_ATTR_CURSOR_SCROLLABLE
| DB2_SQL_ATTR_CURSOR_SENSITIVITY
| DB2_SQL_ATTR_CURSOR_TYPE
| MORE_
| NUMBER
| ROW_COUNT
)
;
conditionInformation
: (
CONDITION (variable | INTEGERLITERAL)
conditionInformationVariableEquate (COMMA conditionInformationVariableEquate)*
)
;
conditionInformationVariableEquate
: (variable EQ (conditionInformationItemName | connectionInformationItemName))
;
conditionInformationItemName
: (
CATALOG_NAME
| CONDITION_NUMBER
| CURSOR_NAME
| DB2_ERROR_CODE1
| DB2_ERROR_CODE2
| DB2_ERROR_CODE3
| DB2_ERROR_CODE4
| DB2_INTERNAL_ERROR_POINTER
| DB2_LINE_NUMBER
| DB2_MESSAGE_ID
| DB2_MODULE_DETECTING_ERROR
| DB2_ORDINAL_TOKEN_n
| DB2_REASON_CODE
| DB2_RETURNED_SQLCODE
| DB2_ROW_NUMBER
| DB2_SQLERRD_SET
| DB2_SQLERRD1
| DB2_SQLERRD2
| DB2_SQLERRD3
| DB2_SQLERRD4
| DB2_SQLERRD5
| DB2_SQLERRD6
| DB2_TOKEN_COUNT
| MESSAGE_TEXT
| RETURNED_SQLSTATE
| SERVER_NAME
)
;
connectionInformationItemName
: (
DB2_AUTHENTICATION_TYPE
| DB2_AUTHORIZATION_ID
| DB2_CONNECTION_STATE
| DB2_CONNECTION_STATUS
| DB2_ENCRYPTION_TYPE
| DB2_SERVER_CLASS_NAME
| DB2_PRODUCT_ID
)
;
combinedInformation
: (
variable EQ ALL
combinedInformationOption (COMMA combinedInformationOption)*
)
;
combinedInformationOption
: (
STATEMENT
| ((CONDITION | CONNECTION) (variable | INTEGERLITERAL)?)
)
;
fetchOrientation
: (BEFORE | AFTER | rowPositioned | rowsetPositioned)
;
rowPositioned
: (
NEXT
| PRIOR
| FIRST
| LAST
| (CURRENT CONTINUE?)
| (ABSOLUTE (hostVariable | INTEGERLITERAL))
| (RELATIVE (hostVariable | INTEGERLITERAL))
)
;
rowsetPositioned
: (
(NEXT ROWSET)
| (PRIOR ROWSET)
| (FIRST ROWSET)
| (LAST ROWSET)
| (CURRENT ROWSET)
| (ROWSET STARTING AT (ABSOLUTE | RELATIVE) (hostVariable | INTEGERLITERAL))
)
;
singleRowFetch
: (
(INTO ((fetchTargetVariable (COMMA fetchTargetVariable)*) | arrayElementSpecification))
| ((INTO | USING) DESCRIPTOR descriptorName)
)
;
/*
The target variable in this clause could be any of {global-variable-name,
host-variable-name, SQL-parameter-name, SQL-variable-name,
transition-variable-name} all of which conform to the variableName rule
save for host-variable-name; thus we confine the rule to just those two.
*/
fetchTargetVariable
: (variable | hostVariable)
;
/*
The syntax diagram in the documentation shows that both of these
clauses are optional. In ANTLR terms, this means an error of the
form "rule can match the empty string." So my interpretation is
to have a rule that allows one, the other, or both, and then the
entire rule is optional in the fetchStatement rule.
*/
multipleRowFetch
: (
(multipleRowFetchForClause? multipleRowFetchIntoClause)
| (multipleRowFetchForClause multipleRowFetchIntoClause?)
| (multipleRowFetchForClause multipleRowFetchIntoClause)
)
;
multipleRowFetchForClause
: (FOR (hostVariable | INTEGERLITERAL) ROWS)
;
multipleRowFetchIntoClause
: ((INTO hostVariable (COMMA hostVariable)*) | ((INTO | USING) DESCRIPTOR descriptorName))
;
explainPlanClause
: (
(PLAN | ALL) (SET QUERYNO EQ INTEGERLITERAL)? FOR
(query | insertStatement | mergeStatement | searchedDelete | searchedUpdate)
)
;
explainStmtcacheClause
: (
STMTCACHE
(ALL
| (STMTID (hostVariable | INTEGERLITERAL))
| (STMTTOKEN (hostVariable | NONNUMERICLITERAL)))
)
;
explainPackageClause
: (
PACKAGE packageScopeSpecification
)
;
explainStabilizedDynamicQueryClause
: (
STABILIZED DYNAMIC QUERY STMTID
(hostVariable | INTEGERLITERAL)
(COPY NONNUMERICLITERAL)?
)
;
packageScopeSpecification
: (
COLLECTION collectionName
PACKAGE packageScopePackageName
(VERSION versionName)?
(COPY NONNUMERICLITERAL)?
)
;
collectionName
: (:hostVariable | NONNUMERICLITERAL)
;
packageScopePackageName
: (:hostVariable | NONNUMERICLITERAL)
;
versionName
: (:hostVariable | NONNUMERICLITERAL)
;
/*
For purposes of this grammar there is no difference between a
host-variable and a host-variable-array. The first option in
the sourceRowData rule allows either, but only for former is
coded as its rule will also match the latter.
*/
sourceRowData
: (
((USING hostVariable (COMMA hostVariable)*)
| (USING DESCRIPTOR descriptorName))
(FOR (INTEGERLITERAL | hostVariable) ROWS)?
)
;
aliasDesignation
: (PUBLIC? ALIAS aliasName (FOR (TABLE | SEQUENCE))?)
;
dropDatabaseClause
: (DATABASE databaseName)
;
dropFunctionClause
: (
(FUNCTION functionName
(LPAREN functionParameterType (COMMA functionParameterType)* RPAREN)?
RESTRICT?)
| (SPECIFIC FUNCTION specificName RESTRICT?)
)
;
dropIndexClause
: (INDEX indexName)
;
dropMaskClause
: (MASK maskName)
;
dropPackageClause
: (PACKAGE packageDesignator)
;
dropPermissionClause
: (PERMISSION permissionName)
;
dropProcedureClause
: (PROCEDURE procedureName RESTRICT?)
;
dropRoleClause
: (ROLE roleName RESTRICT?)
;
dropSequenceClause
: (SEQUENCE sequenceName RESTRICT?)
;
dropStogroupClause
: (STOGROUP stogroupName)
;
dropSynonymClause
: (SYNONYM synonym)
;
dropTableClause
: (TABLE tableName)
;
dropTablespaceClause
: (TABLESPACE (databaseName DOT)? tablespaceName)
;
dropTriggerClause
: (TRIGGER triggerName)
;
dropTrustedContextClause
: (TRUSTED CONTEXT contextName)
;
dropTypeClause
: (TYPE typeName RESTRICT?)
;
dropVariableClause
: (VARIABLE variableName RESTRICT?)
;
dropViewClause
: (VIEW viewName)
;
packageDesignator
: (collectionID DOT packageName (VERSION? versionID)?)
;
describeUsingOption
: (USING (NAMES | LABELS | ANY | BOTH))
;
declareGlobalTemporaryTableLikeClause
: (LIKE tableName copyOptions?)
;
onCommitClause
: (ON COMMIT ((DELETE ROWS) | (PRESERVE ROWS) | (DROP TABLE)))
;
loggedWithRollbackClause
: (
LOGGED
| (NOT LOGGED (ON ROLLBACK (DELETE | PRESERVE) ROWS)?)
)
;
createViewCheckOptionClause
: (WITH (CASCADED | LOCAL)? CHECK OPTION)
;
trustedContextDefaultRoleClause
: (
(NO DEFAULT ROLE)
| (DEFAULT ROLE roleName ((WITHOUT ROLE AS OBJECT OWNER) | (WITH ROLE AS OBJECT OWNER AND QUALIFIER))?)
)
;
trustedContextEnableDisableClause
: (DISABLE | ENABLE)
;
trustedContextDefaultSecurityLabelClause
: ((NO DEFAULT SECURITY LABEL) | (DEFAULT SECURITY LABEL seclabelName))
;
trustedContextAttributesClause
: (
ATTRIBUTES
LPAREN
((trustedContextAttribute1 (COMMA trustedContextAttribute1)*)
| (trustedContextAttribute2 (COMMA trustedContextAttribute2)*))
RPAREN
)
;
trustedContextWithUseForClause
: (WITH USE FOR trustedContextUseFor (COMMA trustedContextUseFor)*)
;
trustedContextAttribute1
: (
(ADDRESS addressValue)
| (ENCRYPTION encryptionValue)
| (SERVAUTH servauthValue)
)
;
trustedContextAttribute2
: (
(JOBNAME jobnameValue)
)
;
trustedContextUseFor
: (
(authorizationName userOptions*)
| (EXTERNAL SECURITY PROFILE profileName userOptions*)
| (PUBLIC (WITH | WITHOUT) AUTHENTICATION)
)
;
userOptions
: (
(ROLE roleName)
| (SECURITY LABEL seclabelName)
| ((WITH | WITHOUT) AUTHENTICATION)
)
;
triggerDefinition
: (
triggerActivationTime triggerEvent ON tableName
(REFERENCING
((OLD | NEW | OLD_TABLE | NEW_TABLE | (OLD TABLE) | (NEW TABLE)) AS? correlationName)+)?
triggerGranularity MODE_ DB2SQL triggerDefinitionOption? triggeredAction
)
;
triggerActivationTime
: (
(NO CASCADE BEFORE)
| AFTER
| (INSTEAD OF)
)
;
triggerEvent
: (
INSERT
| DELETE
| (UPDATE (OF columnName (COMMA columnName)*)?)
)
;
triggerGranularity
: (
(FOR EACH STATEMENT)
| (FOR EACH ROW)
)
;
triggeredAction
: (
(WHEN LPAREN searchCondition RPAREN)? sqlTriggerBody
)
;
sqlTriggerBody
: (
triggeredSqlStatement
| (BEGIN ATOMIC (triggeredSqlStatement SEMICOLON)+ END)
)
;
triggeredSqlStatement
: (
callStatement
| searchedDelete
| ((commonTableExpression)? fullSelect)
| insertStatement
| mergeStatement
| refreshTableStatement
| setAssignmentStatement
| signalStatement
| truncateStatement
| searchedUpdate
| valuesStatement
)
;
triggerDefinitionOption
: (
(NOT SECURED)
| SECURED
)
;
createTableInClause
: (
(IN databaseName? tablespaceName)
| (IN DATABASE databaseName)
| (IN ACCELERATOR acceleratorName)
)
;
createTableColumnDefinition
: (
columnName dataType?
(NOT NULL)?
generatedClause?
createTableColumnConstraint?
defaultClause?
fieldprocClause?
asSecurityLabelClause?
implicitlyHiddenClause?
inlineLengthClause?
)
;
editprocClause
: (EDITPROC programName ((WITH | WITHOUT) ROW ATTRIBUTES)?)
;
/*
NULL is only valid for ALTER TABLE.
*/
validprocClause
: (VALIDPROC (programName | NULL))
;
auditClause
: (AUDIT (NONE | CHANGES | ALL))
;
obidClause
: (OBID INTEGERLITERAL)
;
dataCaptureClause
: (DATA CAPTURE (NONE | CHANGES))
;
restrictOnDropClause
: (WITH RESTRICT ON DROP)
;
ccsidClause1
: (CCSID (ASCII | EBCDIC | UNICODE))
;
ccsidClause2
: (CCSID INTEGERLITERAL)
;
cardinalityClause
: (NOT? VOLATILE CARDINALITY?)
;
appendClause
: (APPEND (YES | NO))
;
memberClause
: (MEMBER CLUSTER)
;
trackmodClause
: (TRACKMOD (YES | NO))
;
pagenumClause
: (PAGENUM (RELATIVE | ABSOLUTE))
;
fieldprocClause
: (FIELDPROC programName LPAREN literal (COMMA literal)* RPAREN)
;
asSecurityLabelClause
: (AS SECURITY LABEL)
;
implicitlyHiddenClause
: (IMPLICITLY HIDDEN_)
;
inlineLengthClause
: (INLINE LENGTH INTEGERLITERAL)
;
copyOptions
: (
(
copyOptionIdentity
| copyOptionRowChangeTimestamp
| copyOptionColumnDefaults
| copyOptionXmlTypeModifiers
)+
)
;
copyOptionIdentity
: ((EXCLUDING | INCLUDING) IDENTITY (COLUMN ATTRIBUTES)?)
;
copyOptionRowChangeTimestamp
: ((EXCLUDING | INCLUDING) ROW CHANGE TIMESTAMP (COLUMN ATTRIBUTES)?)
;
copyOptionColumnDefaults
: (
((EXCLUDING | INCLUDING) COLUMN? DEFAULTS)
| (USING TYPE DEFAULTS)
)
;
copyOptionXmlTypeModifiers
: (EXCLUDING XML TYPE MODIFIERS)
;
asResultTable
: (
LPAREN (columnName (COMMA columnName)*)? RPAREN AS
LPAREN fullSelect RPAREN
WITH NO DATA
)
;
declareGlobalTemporaryTableAsResultTable
: (
AS LPAREN fullSelect RPAREN
WITH NO DATA
)
;
createTableMaterializedQueryDefinition
: (
(LPAREN columnName (COMMA columnName)* RPAREN)?
AS materializedQueryDefinition
)
;
createTableColumnConstraint
: (
(CONSTRAINT constraintName)?
(
(PRIMARY KEY)
| UNIQUE
| referencesClause
| (CHECK LPAREN checkCondition RPAREN)
)
)
;
/*
Deprecated as of Db2 12.
*/
organizationClause
: (
ORGANIZE BY HASH UNIQUE
LPAREN columnName (COMMA columnName)* RPAREN
(HASH SPACE SQLIDENTIFIER)?
)
;
createGlobalTemporaryTableColumnDefinition
: (
columnName dataType (NOT NULL)?
)
;
declareGlobalTemporaryTableColumnDefinition
: (
columnName dataType
(defaultClause1
| generatedClause2
| (NOT NULL))*
)
;
parameterDeclaration1
: (
parameterName? ((functionDataType (AS LOCATOR)?) | (TABLE LIKE tableName (AS LOCATOR)?))
)
;
parameterDeclaration2
: (
parameterName functionDataType
)
;
parameterDeclaration3
: (
(IN | OUT | INOUT)? parameterName? procedureDataType (AS LOCATOR)?
)
;
createFunctionStatementExternalScalarOptions
: (
(RETURNS
((dataType (AS LOCATOR)?)
| (dataType CAST FROM dataType (AS LOCATOR)?)))
| externalNameOption1
| languageOption3
| parameterStyleOption2
| deterministicOption
| fencedOption
| nullInputOption1
| sqlDataOption3
| externalActionOption
| packagePathOption
| scratchpadOption
| finalCallOption
| parallelOption2
| dbinfoOption
| cardinalityOption
| collectionIdOption
| wlmEnvironmentOption1
| asuTimeOption
| stayResidentOption
| programTypeOption
| securityOption
| stopAfterFailureOption
| runOptionsOption
| specialRegistersOption
| dispatchOption
| securedOption
| specificNameOption1
| parameterOption1
)
;
//
externalNameOption1
: (EXTERNAL (NAME (externalProgramName | identifier))?)
;
externalNameOption2
: (EXTERNAL NAME (externalProgramName | identifier))
;
dynamicResultSetOption
: (DYNAMIC? RESULT (SET |SETS) INTEGERLITERAL)
;
languageOption1
: (LANGUAGE SQL)
;
languageOption2
: (LANGUAGE (ASSEMBLE | C_ | COBOL | PLI))
;
languageOption3
: (LANGUAGE (ASSEMBLE | C_ | COBOL | JAVA | PLI))
;
languageOption4
: (LANGUAGE (ASSEMBLE | C_ | COBOL | JAVA | PLI | SQL))
;
languageOption5
: (LANGUAGE (ASSEMBLE | C_ | COBOL | JAVA | PLI | REXX))
;
parameterStyleOption1
: (PARAMETER STYLE SQL)
;
parameterStyleOption2
: (PARAMETER STYLE (SQL | JAVA))
;
parameterStyleOption3
: (PARAMETER STYLE (SQL | DB2SQL | (STANDARD CALL) | GENERAL | (SIMPLE CALL) | ((GENERAL | (SIMPLE CALL)) WITH NULLS) | JAVA))
;
deterministicOption
: ((NOT? DETERMINISTIC) | (NOT? VARIANT))
;
fencedOption
: (FENCED)
;
nullInputOption1
: ((RETURNS NULL ON NULL INPUT) | (CALLED ON NULL INPUT) | (NULL CALL))
;
nullInputOption2
: ((CALLED ON NULL INPUT) | (NULL CALL))
;
debugOption
: ((DISALLOW | ALLOW | DISABLE) DEBUG MODE_)
;
sqlDataOption1
: ((READS SQL DATA) | (CONTAINS SQL))
;
sqlDataOption2
: ((READS SQL DATA) | (CONTAINS SQL) | (NO SQL))
;
sqlDataOption3
: ((MODIFIES SQL DATA) | (READS SQL DATA) | (CONTAINS SQL) | (NO SQL))
;
externalActionOption
: (NO? EXTERNAL ACTION)
;
packagePathOption
: ((PACKAGE PATH packagePath) | (NO PACKAGE PATH))
;
scratchpadOption
: ((NO SCRATCHPAD) | (SCRATCHPAD INTEGERLITERAL))
;
finalCallOption
: (NO? FINAL CALL)
;
parallelOption1
: (DISALLOW PARALLEL)
;
parallelOption2
: ((ALLOW | DISALLOW) PARALLEL)
;
dbinfoOption
: (NO? DBINFO)
;
cardinalityOption
: (CARDINALITY INTEGERLITERAL)
;
collectionIdOption
: ((NO COLLID) | (COLLID collectionID))
;
wlmEnvironmentOption1
: (WLM ENVIRONMENT (identifier | (LPAREN identifier RPAREN)))
;
wlmEnvironmentOption2
: (WLM ENVIRONMENT (identifier | (LPAREN identifier COMMA SPLAT RPAREN)))
;
asuTimeOption
: (ASUTIME ((NO LIMIT) | (LIMIT INTEGERLITERAL)))
;
stayResidentOption
: (STAY RESIDENT (NO | YES))
;
programTypeOption
: (PROGRAM TYPE (SUB | MAIN))
;
securityOption
: (SECURITY (DB2 | USER | DEFINER))
;
stopAfterFailureOption
: ((STOP AFTER SYSTEM DEFAULT FAILURES) | (STOP AFTER INTEGERLITERAL FAILURES) | (CONTINUE AFTER FAILURE))
;
runOptionsOption
: (RUN OPTIONS runTimeOptions)
;
commitOnReturnOption
: (COMMIT ON RETURN (YES | NO))
;
specialRegistersOption
: ((INHERIT | DEFAULT) SPECIAL REGISTERS)
;
dispatchOption
: (STATIC DISPATCH)
;
securedOption
: (NOT? SECURED)
;
specificNameOption1
: (SPECIFIC specificName?)
;
specificNameOption2
: (SPECIFIC specificName)
;
parameterOption1
: (PARAMETER
(ccsidClause1
| (VARCHAR (NULTERM | STRUCTURE)))+)
;
parameterOption2
: (PARAMETER ccsidClause1)
;
//
createFunctionStatementExternalTableOptions
: (
(RETURNS
((TABLE LPAREN columnName functionDataType (AS LOCATOR)? (COMMA columnName functionDataType (AS LOCATOR)?)* RPAREN)
| (GENERIC TABLE)))
| externalNameOption1
| languageOption2
| parameterStyleOption1
| deterministicOption
| fencedOption
| nullInputOption1
| sqlDataOption2
| externalActionOption
| packagePathOption
| scratchpadOption
| finalCallOption
| parallelOption1
| dbinfoOption
| cardinalityOption
| collectionIdOption
| wlmEnvironmentOption1
| asuTimeOption
| stayResidentOption
| programTypeOption
| securityOption
| stopAfterFailureOption
| runOptionsOption
| specialRegistersOption
| dispatchOption
| securedOption
| specificNameOption1
| parameterOption1
)
;
createFunctionStatementSourcedOptions
: (
(RETURNS functionDataType (AS LOCATOR)?)
| specificNameOption2
| parameterOption2
| (SOURCE
((functionName LPAREN parameterType (COMMA parameterType)* RPAREN)
| specificNameOption2))
)
;
createFunctionStatementInlineSqlScalarOptions
: (
(RETURNS functionDataType languageOption1?)
| (RETURN (expression | NULL | fullSelect))
| deterministicOption
| nullInputOption1
| sqlDataOption1
| externalActionOption
| dispatchOption
| securedOption
| specificNameOption1
| parameterOption2
)
;
sequenceAlias
: (
aliasName FOR SEQUENCE sequenceName
)
;
tableAlias
: (
aliasName FOR TABLE? tableName
)
;
authorization
: (USER hostVariable USING hostVariable)
;
searchedDelete
: (
DELETE FROM tableName periodClause? AS? correlationName? includeColumns?
(SET assignmentClause)? (WHERE searchCondition) fetchClause?
(isolationClause | skipLockedDataClause)* querynoClause?
)
;
positionedDelete
: (
DELETE FROM tableName AS? correlationName? WHERE CURRENT OF cursorName
(FOR ROW (hostVariable | INTEGERLITERAL) OF ROWSET)?
)
;
searchedUpdate
: (
UPDATE tableName periodClause? AS? correlationName? includeColumns?
SET assignmentClause (WHERE searchCondition)?
(isolationClause | skipLockedDataClause)* querynoClause?
)
;
positionedUpdate
: (
UPDATE tableName AS? correlationName?
SET assignmentClause
WHERE CURRENT OF cursorName
(FOR ROW (hostVariable | INTEGERLITERAL) OF ROWSET)?
)
;
sourceValues
: (
LPAREN VALUES
(valuesSingleRow | valuesMultipleRow)
RPAREN
AS? correlationName
LPAREN columnName (COMMA columnName)* RPAREN
)
;
valuesSingleRow
: (
valuesList3 | (LPAREN valuesList3 (COMMA valuesList3)* RPAREN)
)
;
valuesMultipleRow
: (
valuesList4 | (LPAREN valuesList4 (COMMA valuesList4)* RPAREN)
FOR (hostVariable | INTEGERLITERAL) ROWS
)
;
matchingCondition
: (
NOT? MATCHED (AND searchCondition)?
)
;
modificationOperation
: (updateOperation | deleteOperation | insertOperation)
;
assignmentClause
: (
(columnName EQ valuesList1 (COMMA columnName EQ valuesList1)*)
| (LPAREN columnName (COMMA columnName)*
RPAREN EQ
LPAREN ((valuesList1 (COMMA valuesList1)*) | fullSelect)
RPAREN)
)
;
setAssignmentClause
: (
(arrayElementSpecification EQ (expression | NULL))
| (setAssignmentTargetVariable EQ valuesList1 (COMMA setAssignmentTargetVariable EQ valuesList1)*)
| (LPAREN setAssignmentTargetVariable (COMMA setAssignmentTargetVariable)*
RPAREN EQ
LPAREN
(((valuesList1 (COMMA valuesList1)*) | fullSelect)
| subSelect
| (VALUES valuesList1)
| (VALUES LPAREN valuesList1 (COMMA valuesList1)* RPAREN))
RPAREN)
)
;
setAssignmentTargetVariable
: (
globalVariableName
| hostVariable
| sqlParameterName
| sqlVariableName
| transitionVariableName
)
;
updateOperation
: (
UPDATE SET assignmentClause (COMMA assignmentClause)*
)
;
deleteOperation
: (DELETE)
;
insertOperation
: (
INSERT LPAREN columnName (COMMA columnName)* RPAREN
VALUES (valuesList1 |
(LPAREN valuesList1 (COMMA valuesList1)* RPAREN))
)
;
signalInformation
: (
(SET MESSAGE_TEXT EQ expression (operator expression)*)
| (LPAREN NONNUMERICLITERAL RPAREN)
)
;
valuesList1
: ((expression (operator expression)*) | DEFAULT | NULL)
;
valuesList2
: (expression | hostVariable | DEFAULT | NULL)
;
valuesList3
: (expression | NULL)
;
valuesList4
: (expression | hostVariable | NULL)
;
includeColumns
: (INCLUDE LPAREN columnName dataType (COMMA columnName dataType)* RPAREN)
;
multipleRowInsert
: (
VALUES (valuesList2 | (LPAREN valuesList2 (COMMA valuesList2)* RPAREN))
(FOR (hostVariable | INTEGERLITERAL) ROWS)?
(ATOMIC | notAtomicPhrase)
)
;
regenerateClause
: (REGENERATE (USING APPLICATION COMPATIBILITY applCompatValue)?)
;
alterIndexOptions
:(
bufferpoolOption
| closeOption
| copyOption
| dssizeOption
| piecesizeOption
| usingSpecification1
| freeSpecification
| gbpcacheSpecification
| clusterOption
| paddedOption
| compressOption
| (ADD
((COLUMN
LPAREN
columnName (ASC | DESC | RANDOM)?
RPAREN)
| (INCLUDE COLUMN LPAREN columnName RPAREN))
)
)
;
//
bufferpoolOption
: (BUFFERPOOL bpName)
;
closeOption
: (CLOSE (YES | NO))
;
copyOption
: (COPY (YES | NO))
;
dssizeOption
: (DSSIZE SQLIDENTIFIER)
;
piecesizeOption
: (PIECESIZE SQLIDENTIFIER)
;
clusterOption
: (NOT? CLUSTER)
;
paddedOption
: (NOT? PADDED)
;
compressOption
: (COMPRESS ((YES (FIXEDLENGTH | HUFFMAN)?) | NO))
;
defineOption
: (DEFINE (YES | NO))
;
locksizeOption
: (LOCKSIZE (ANY | TABLESPACE | TABLE | PAGE | ROW | LOB))
;
lockmaxOption
: (LOCKMAX (SYSTEM | INTEGERLITERAL))
;
enableDisableOption
: (ENABLE | DISABLE)
;
/*
Although the latter two options are "supported as alternatives,
they are not the preferred syntax."
*/
loggedOption
: ((NOT? LOGGED) | (LOG NO) | (LOG YES))
;
notAtomicPhrase
: (NOT ATOMIC CONTINUE ON SQLEXCEPTION)
;
//
alterIndexPartitionOptions
: (
ALTER partitionElement
(usingSpecification1+
| freeSpecification+
| gbpcacheSpecification
| dssizeOption)*
)
;
usingSpecification1
: (
(USING ((VCAT catalogName) | (STOGROUP stogroupName)))
| (PRIQTY INTEGERLITERAL)
| (SECQTY INTEGERLITERAL)
| (ERASE (YES | NO))
)
;
freeSpecification
: (
(FREEPAGE INTEGERLITERAL)
| (PCTFREE INTEGERLITERAL)
)
;
gbpcacheSpecification
: (
GBPCACHE (CHANGED | ALL | SYSTEM | NONE)
)
;
partitionElement
: (
PARTITION INTEGERLITERAL
(ENDING AT? LPAREN
(literal | MAXVALUE | MINVALUE) (COMMA (literal | MAXVALUE | MINVALUE))*
RPAREN INCLUSIVE?)?
)
;
applCompatValue
: (functionLevel)
;
functionLevel
: SQLIDENTIFIER
;
functionParameterType
: (functionDataType (AS LOCATOR)?)
;
functionDataType
: (functionBuiltInType | distinctTypeName)
;
functionBuiltInType
: (
SMALLINT
| INTEGER
| INT
| BIGINT
| ((DECIMAL | DEC | NUMERIC) (integerInParens | (LPAREN RPAREN)))
| (DECFLOAT (integerInParens | (LPAREN RPAREN)))
| (FLOAT (integerInParens | (LPAREN RPAREN)))
| REAL
| (DOUBLE PRECISION?)
| ((((CHARACTER | CHAR) VARYING? ) | VARCHAR) (length | (LPAREN RPAREN))? ccsidClause1? forDataQualifier?)
| ((((CHARACTER | CHAR) LARGE OBJECT) | CLOB) (length | (LPAREN RPAREN))? ccsidClause1? forDataQualifier?)
| ((GRAPHIC | VARGRAPHIC | DBCLOB) (length | (LPAREN RPAREN))? ccsidClause1?)
| (BINARY (integerInParens | (LPAREN RPAREN))?)
| (((BINARY VARYING?) | VARBINARY) (integerInParens | (LPAREN RPAREN))?)
| (((BINARY LARGE OBJECT) | BLOB) (LPAREN (INTEGERLITERAL SQLIDENTIFIER) RPAREN)?)
| DATE
| TIME
| (TIMESTAMP integerInParens? ((WITH | WITHOUT) TIME ZONE))
| ROWID
| XML
)
;
procedureBuiltinType
: (
SMALLINT
| INTEGER
| INT
| BIGINT
| ((DECIMAL | DEC | NUMERIC) (integerInParens | (LPAREN RPAREN)))
| (DECFLOAT (integerInParens | (LPAREN RPAREN)))
| (FLOAT (integerInParens | (LPAREN RPAREN)))
| REAL
| (DOUBLE PRECISION?)
| ((((CHARACTER | CHAR) VARYING? ) | VARCHAR) (length | (LPAREN RPAREN))? ccsidClause1? forDataQualifier?)
| ((((CHARACTER | CHAR) LARGE OBJECT) | CLOB) (length | (LPAREN RPAREN))? ccsidClause1? forDataQualifier?)
| ((GRAPHIC | VARGRAPHIC | DBCLOB) (length | (LPAREN RPAREN))? ccsidClause1?)
| (BINARY (integerInParens | (LPAREN RPAREN))?)
| (((BINARY VARYING?) | VARBINARY) (integerInParens | (LPAREN RPAREN))?)
| (((BINARY LARGE OBJECT) | BLOB) length?)
| DATE
| TIME
| (TIMESTAMP integerInParens? ((WITH | WITHOUT) TIME ZONE)?)
| ROWID
)
;
createTypeArrayBuiltinType
: (
SMALLINT
| INTEGER
| INT
| BIGINT
| ((DECIMAL | DEC | NUMERIC) (integerInParens | (LPAREN RPAREN)))
| (DECFLOAT (integerInParens | (LPAREN RPAREN)))
| (FLOAT (integerInParens | (LPAREN RPAREN)))
| REAL
| (DOUBLE PRECISION?)
| ((((CHARACTER | CHAR) VARYING? ) | VARCHAR) length? ccsidClause1? forDataQualifier?)
| ((((CHARACTER | CHAR) LARGE OBJECT) | CLOB) length? ccsidClause1? forDataQualifier?)
| ((GRAPHIC | VARGRAPHIC | DBCLOB) (length | (LPAREN RPAREN))? ccsidClause1?)
| (BINARY (integerInParens | (LPAREN RPAREN))?)
| (((BINARY VARYING?) | VARBINARY) (integerInParens | (LPAREN RPAREN))?)
| (((BINARY LARGE OBJECT) | BLOB) length?)
| DATE
| TIME
| (TIMESTAMP integerInParens? ((WITH | WITHOUT) TIME ZONE)?)
)
;
createTypeArrayBuiltinType2
: (
INTEGER
| INT
| ((((CHARACTER | CHAR) VARYING? ) | VARCHAR) length? ccsidClause1? forDataQualifier?)
)
;
createVariableBuiltInType
: (
SMALLINT
| INTEGER
| INT
| BIGINT
| ((DECIMAL | DEC | NUMERIC) (integerInParens | (LPAREN RPAREN)))
| (DECFLOAT (integerInParens | (LPAREN RPAREN)))
| (FLOAT (integerInParens | (LPAREN RPAREN)))
| REAL
| (DOUBLE PRECISION?)
| ((((CHARACTER | CHAR) VARYING? ) | VARCHAR) length? forDataQualifier?)
| ((((CHARACTER | CHAR) LARGE OBJECT) | CLOB) length? forDataQualifier?)
| ((GRAPHIC | VARGRAPHIC | DBCLOB) length?)
| (BINARY (integerInParens | (LPAREN RPAREN))?)
| (((BINARY VARYING?) | VARBINARY) (integerInParens | (LPAREN RPAREN))?)
| (((BINARY LARGE OBJECT) | BLOB) length?)
| DATE
| TIME
| (TIMESTAMP integerInParens? ((WITH | WITHOUT) TIME ZONE)?)
)
;
sourceDataType
: procedureBuiltinType
;
functionOptionList
: (
externalNameOption2
| languageOption4
| parameterStyleOption2
| deterministicOption
| nullInputOption1
| sqlDataOption3
| externalActionOption
| packagePathOption
| scratchpadOption
| finalCallOption
| parallelOption2
| dbinfoOption
| cardinalityOption
| collectionIdOption
| wlmEnvironmentOption2
| asuTimeOption
| stayResidentOption
| programTypeOption
| securityOption
| stopAfterFailureOption
| runOptionsOption
| specialRegistersOption
| dispatchOption
| securedOption
| SPECIFIC
| (PARAMETER CCSID)
)
;
procedureOptionList
: (
dynamicResultSetOption
| parameterOption1
| externalNameOption2
| languageOption5
| parameterStyleOption3
| deterministicOption
| packagePathOption
| sqlDataOption3
| dbinfoOption
| collectionIdOption
| wlmEnvironmentOption2
| asuTimeOption
| stayResidentOption
| programTypeOption
| securityOption
| runOptionsOption
| (COMMIT ON RETURN (NO | YES))
| specialRegistersOption
| (CALLED ON NULL INPUT)
| (NULL CALL)
| stopAfterFailureOption
| ((DISALLOW | ALLOW | DISABLE) DEBUG MODE_)
)
;
createProcedureOptionList
: (
specificNameOption2
| dynamicResultSetOption
| parameterOption1
| externalNameOption1
| languageOption5
| sqlDataOption3
| parameterStyleOption3
| deterministicOption
| packagePathOption
| fencedOption
| dbinfoOption
| collectionIdOption
| wlmEnvironmentOption2
| asuTimeOption
| stayResidentOption
| programTypeOption
| securityOption
| runOptionsOption
| commitOnReturnOption
| specialRegistersOption
| nullInputOption2
| stopAfterFailureOption
| debugOption
)
;
procedureDataType
: (procedureBuiltinType | distinctTypeName)
;
alterSequenceOptionList
: (
restartOption
| incrementOption
| minvalueOption
| maxvalueOption
| cycleOption
| cacheOption
| orderOption
)
;
createSequenceOptionList
: (
asTypeOption
| startOption
| incrementOption
| minvalueOption
| maxvalueOption
| cycleOption
| cacheOption
| orderOption
)
;
//
asTypeOption
: (AS sequenceDataType)
;
startOption
: (START WITH INTEGERLITERAL)
;
restartOption
: (RESTART (WITH INTEGERLITERAL)?)
;
incrementOption
: (INCREMENT BY INTEGERLITERAL)
;
minvalueOption
: ((NO MINVALUE) | (MINVALUE INTEGERLITERAL))
;
maxvalueOption
: ((NO MAXVALUE) | (MAXVALUE INTEGERLITERAL))
;
cycleOption
: (NO? CYCLE)
;
cacheOption
: ((NO CACHE) | (CACHE INTEGERLITERAL))
;
orderOption
: (NO? ORDER)
;
keyLabelOption
: ((NO KEY LABEL) | (KEY LABEL keyLabelName))
;
dataclasOption
: (DATACLAS dcName)
;
mgmtclasOption
: (MGMTCLAS mcName)
;
storclasOption
: (STORCLAS scName)
;
//
alterStogroupOptionList
: (
(ADD VOLUMES LPAREN volumeID (COMMA volumeID)* RPAREN)
| (ADD VOLUMES LPAREN NONNUMERICLITERAL (COMMA NONNUMERICLITERAL)* RPAREN)
| (REMOVE VOLUMES LPAREN volumeID (COMMA volumeID)* RPAREN)
| (REMOVE VOLUMES LPAREN NONNUMERICLITERAL (COMMA NONNUMERICLITERAL)* RPAREN)
| keyLabelOption
| dataclasOption
| mgmtclasOption
| storclasOption
)
;
alterTableOptionList
: (
(ADD COLUMN? alterTableColumnDefinition)
| (ALTER COLUMN? columnAlteration)
| (RENAME COLUMN sourceColumnName TO targetColumnName)
| (DROP COLUMN? columnName RESTRICT)
| (ADD periodDefinition)
| (ADD (uniqueConstraint | referentialConstraint | checkConstraint))
| (DROP ((PRIMARY KEY) | ((UNIQUE | (FOREIGN KEY) | CHECK | CONSTRAINT) constraintName)))
| (ADD partitioningClause)
| (ADD PARTITION partitionClause)
| (ALTER PARTITION INTEGERLITERAL partitionClause)
| (ROTATE PARTITION (FIRST | INTEGERLITERAL) TO LAST rotatePartitionClause)
| (DROP ORGANIZATION)
| (alterHashOrganization)
| (ADD SYSTEM? VERSIONING USE HISTORY TABLE historyTableName extraRowOption?)
| (DROP SYSTEM? VERSIONING)
| (ADD ((MATERIALIZED QUERY) | QUERY)? materializedQueryDefinition)
| (ALTER MATERIALIZED? QUERY materializedQueryAlteration)
| (DROP MATERIALIZED? QUERY)
| dataCaptureClause
| cardinalityClause
| (ADD CLONE cloneTableName)
| (DROP CLONE)
| (ADD RESTRICT ON DROP)
| (DROP RESTRICT ON DROP)
| ((ACTIVATE | DEACTIVATE) ROW ACCESS CONTROL)
| ((ACTIVATE | DEACTIVATE) COLUMN ACCESS CONTROL)
| appendClause
| auditClause
| validprocClause
| (ENABLE ARCHIVE USE archiveTableName)
| (DISABLE ARCHIVE)
| (NO KEY LABEL)
| (KEY LABEL keyLabelName)
)
;
alterTablespaceOptionList
: (
bufferpoolOption
| ccsidClause2
| closeOption
| compressOption
| (DROP PENDING CHANGES)
| dssizeOption
| insertAlgorithmOption
| lockmaxOption
| locksizeOption
| loggedOption
| maxrowsOption
| maxpartitionsOption
| (MEMBER CLUSTER (YES | NO))
| segsizeOption
| trackmodClause
| (usingBlock)
| (freeBlock)
| (gbpcacheBlock)
| (PAGENUM RELATIVE)
)
;
createTablespaceOptionList
: (
inDatabaseOption
| bufferpoolOption
| partitionByGrowthSpecification
| partitionByRangeSpecification
| segsizeOption
| ccsidClause1
| closeOption
| compressOption
| defineOption
| freeBlock
| gbpcacheBlock
| insertAlgorithmOption
| lockmaxOption
| locksizeOption
| loggedOption
| maxrowsOption
| maxpartitionsOption
| memberClause
| trackmodClause
| usingBlock
)
;
/*
This rule does not strictly follow the syntax diagram, as the diagram
is at odds with at least one example and arguably with the narrative.
More specifically, it is unclear where the ALTER keyword is required,
and so this rule makes it optional where its use seems to me to be
ambiguously documented.
*/
trustedContextOptionList
: (
(ALTER SYSTEM AUTHID authorizationName)
| (ALTER NO DEFAULT ROLE)
| (ALTER DEFAULT ROLE roleName
((WITHOUT ROLE AS OBJECT OWNER) | (WITH ROLE AS OBJECT OWNER AND QUALIFIER))?)
| (ALTER? ENABLE)
| (ALTER? DISABLE)
| (ALTER? NO DEFAULT SECURITY LABEL)
| (ALTER? DEFAULT SECURITY LABEL seclabelName)
| (ALTER ATTRIBUTES LPAREN alterAttributesOptions (COMMA alterAttributesOptions)* RPAREN)
| (ADD ATTRIBUTES LPAREN addAttributesOptions (COMMA addAttributesOptions)* RPAREN)
| (DROP ATTRIBUTES LPAREN dropAttributesOptions (COMMA dropAttributesOptions)* RPAREN)
| userClause
)
;
databaseOptionList
: (
bufferpoolOption
| (INDEXBP bpName)
| (AS WORKFILE (FOR memberName)?)
| (STOGROUP ( SYSDEFLT | stogroupName)?)
| ccsidClause1
)
;
createIndexOptionList
: (
(xmlIndexSpecification)
| includeColumnPhrase
| clusterOption
| (PARTITIONED)
| paddedOption
| compressOption
| usingSpecification2
| freeSpecification
| gbpcacheSpecification
| defineOption
| ((INCLUDE | EXCLUDE) NULL KEYS)
| (PARTITION BY RANGE? LPAREN
partitionElement (usingSpecification2 | freeSpecification | gbpcacheSpecification | dssizeOption)*
(COMMA partitionElement (usingSpecification2 | freeSpecification | gbpcacheSpecification | dssizeOption)*)* RPAREN)
| bufferpoolOption
| closeOption
| (DEFER (NO | YES))
| dssizeOption
| piecesizeOption
| copyOption
)
;
createLobTablespaceOptionList
: (
inDatabaseOption
| bufferpoolOption
| closeOption
| compressOption
| defineOption
| dssizeOption
| gbpcacheSpecification
| lockmaxOption
| locksizeOption
| loggedOption
| usingSpecification2
)
;
inDatabaseOption
: (IN databaseName)
;
segsizeOption
: (SEGSIZE INTEGERLITERAL)
;
numpartsOption
: (NUMPARTS INTEGERLITERAL)
;
partitionByGrowthSpecification
: (
(maxpartitionsOption numpartsOption?)
| dssizeOption
)
;
partitionByRangeSpecification
: (
numpartsOption
(
(LPAREN
(partitionByRangePartitionPhrase (COMMA partitionByRangePartitionPhrase)*)*
RPAREN)
| pagenumClause
| dssizeOption
)*
)
;
partitionByRangePartitionPhrase
: (
(PARTITION | PART) INTEGERLITERAL
(
usingBlock
| freeBlock
| gbpcacheBlock
| compressOption
| trackmodClause
| dssizeOption
)*
)
;
insertAlgorithmOption
: (INSERT ALGORITHM INTEGERLITERAL)
;
maxrowsOption
: (MAXROWS INTEGERLITERAL)
;
maxpartitionsOption
: (MAXPARTITIONS INTEGERLITERAL)
;
usingSpecification2
: (
USING
((STOGROUP stogroupName
((PRIQTY INTEGERLITERAL)
| (SECQTY INTEGERLITERAL)
| (ERASE (NO | YES)))*)
| (VCAT catalogName))
)
;
xmlIndexSpecification
: (
GENERATE (KEY | KEYS) USING XMLPATTERN xmlPatternClause AS SQL sqlDataType
)
;
/*
An xmlPatternClause has nontrivial syntax, but for purposes of this
grammar it is simply a quoted string. It probably warrants a grammar
of its own.
*/
xmlPatternClause
: NONNUMERICLITERAL
;
alterAttributesOptions
: (
(ADDRESS addressValue)
| (ENCRYPTION encryptionValue)
| (SERVAUTH servauthValue)
| (JOBNAME jobnameValue)
)
;
addAttributesOptions
: (
(ADDRESS addressValue)
| (SERVAUTH servauthValue)
| (JOBNAME jobnameValue)
)
;
dropAttributesOptions
: (
(ADDRESS addressValue?)
| (SERVAUTH servauthValue?)
| (JOBNAME jobnameValue?)
)
;
includeColumnPhrase
: (INCLUDE LPAREN columnName (COMMA columnName)* RPAREN)
;
userClause
: (
(ADD USE FOR userClauseAddOptions (COMMA userClauseAddOptions)*)
| (REPLACE USE FOR userClauseReplaceOptions (COMMA userClauseReplaceOptions)*)
| (DROP USE FOR userClauseDropOptions (COMMA userClauseDropOptions)*)
)
;
userClauseAddOptions
: (
(authorizationName useOptions?)
| (EXTERNAL SECURITY PROFILE profileName useOptions?)
| (PUBLIC (WITH | WITHOUT) AUTHENTICATION)
)
;
userClauseReplaceOptions
: (userClauseAddOptions)
;
userClauseDropOptions
: (
(authorizationName)
| (EXTERNAL SECURITY PROFILE profileName)
| (PUBLIC)
)
;
useOptions
: (
(ROLE roleName)? (SECURITY LABEL seclabelName)? (WITH | WITHOUT) AUTHENTICATION
)
;
alterPartitionClause
: (
((ALTER? PARTITION) | PART) INTEGERLITERAL
( (usingBlock)
| (freeBlock)
| (gbpcacheBlock)
| compressOption
| dssizeOption
| trackmodClause
)+
)
;
usingBlock
: (
usingSpecification1+
)
;
freeBlock
: (
((FREEPAGE INTEGERLITERAL)
| (PCTFREE INTEGERLITERAL)
| (PCTFREE (INTEGERLITERAL? FOR UPDATE INTEGERLITERAL)?)
)+
)
;
moveTableClause
: (
MOVE TABLE tableName TO TABLESPACE (databaseName DOT)? tablespaceName
)
;
gbpcacheBlock
: (
GBPCACHE (CHANGED | ALL | SYSTEM | NONE)
)
;
aliasDesignator
: (
PUBLIC? ALIAS aliasName FOR (TABLE | SEQUENCE)
)
;
multipleColumnList
: (
tableName LPAREN
columnName IS NONNUMERICLITERAL
(COMMA columnName IS NONNUMERICLITERAL)*
RPAREN
)
;
functionDesignator
: (
(FUNCTION functionName (LPAREN (parameterType (COMMA parameterType)*)? RPAREN)?)
| (SPECIFIC FUNCTION specificName)
)
;
parameterType
: (dataType (AS LOCATOR)?)
;
alterTableColumnDefinitionOptionList1
: (
(defaultClause1)
| (NOT NULL)
| (columnConstraint)
| (generatedClause)
| implicitlyHiddenClause
| asSecurityLabelClause
| fieldprocClause
| inlineLengthClause
)
;
alterTableColumnDefinitionOptionList2
: (
(defaultClause2)
| (NOT NULL)
| (columnConstraint)
| (generatedClause)
| implicitlyHiddenClause
| asSecurityLabelClause
| fieldprocClause
| inlineLengthClause
)
;
columnConstraint
: (referencesClause | checkConstraint)
;
generatedClause
: (
(GENERATED (ALWAYS | (BY DEFAULT))? (asIdentityClause | asRowChangeTimestampClause))
| (GENERATED ALWAYS?
(asRowTransactionStartIDClause
| asRowTransactionTimestampClause
| asGeneratedExpressionClause))
)
;
generatedClause2
: (GENERATED (ALWAYS | (BY DEFAULT)) asIdentityClause?)
;
asIdentityClause
: (
AS IDENTITY (LPAREN
asIdentityClauseOptionList (COMMA? asIdentityClauseOptionList)*
RPAREN)?
)
;
asIdentityClauseOptionList
: (
startOption
| incrementOption
| minvalueOption
| maxvalueOption
| cycleOption
| cacheOption
| orderOption
)
;
asRowChangeTimestampClause
: (FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP)
;
asRowTransactionStartIDClause
: (AS TRANSACTION START ID)
;
asRowTransactionTimestampClause
: (AS ROW (BEGIN | START | END))
;
asGeneratedExpressionClause
: (AS LPAREN nonDeterministicExpression RPAREN)
;
nonDeterministicExpression
: (
(DATA CHANGE OPERATION)
| specialRegister
| nonDeterministicExpressionSessionVariable
)
;
nonDeterministicExpressionSessionVariable
: (
(SYSIBM DOT PACKAGE_NAME)
| (SYSIBM DOT PACKAGE_SCHEMA)
| (SYSIBM DOT PACKAGE_VERSION)
)
;
columnAlteration
: (columnName columnAlterationOptionList+)
;
columnAlterationOptionList
: (
(SET DATA TYPE alteredDataType (INLINE LENGTH INTEGERLITERAL)?)
| (SET defaultClause)
| (SET INLINE LENGTH INTEGERLITERAL)
| (SET GENERATED (ALWAYS | (BY DEFAULT)) identityAlteration?)
| (identityAlteration)
| (SET GENERATED ALWAYS? (asRowTransactionTimestampClause | asRowTransactionStartIDClause))
| (DROP DEFAULT)
)
;
/*
In the IBM documentation, alteredDataType differs from dataType in that
it is a proper subset thereof. The dataType rule includes a provision
for CCSID on CHAR, VARCHAR, CLOB, GRAPHIC, VARGRAPHIC, and DBCLOB types
which is absent from the alteredDataType rule. For purposes of this
grammar, a difference which makes no difference is no difference.
*/
alteredDataType
: dataType
;
/*
The difference between dataType and castDataType is in the coding
of the CCSID and FOR ... DATA qualifiers. Sneaky.
*/
dataType
: (builtInType | distinctTypeName)
;
builtInType
: (
SMALLINT
| INTEGER
| INT
| BIGINT
| ((DECIMAL | DEC | NUMERIC) (integerInParens | (LPAREN RPAREN)))
| (DECFLOAT (integerInParens | (LPAREN RPAREN)))
| (FLOAT (integerInParens | (LPAREN RPAREN)))
| REAL
| (DOUBLE PRECISION?)
| ((((CHARACTER | CHAR) VARYING? ) | VARCHAR) (length | (LPAREN RPAREN))? (forDataQualifier | ccsidClause2)?)
| ((((CHARACTER | CHAR) LARGE OBJECT) | CLOB) (length | (LPAREN RPAREN))? (forDataQualifier | ccsidClause2)?)
| ((GRAPHIC | VARGRAPHIC | DBCLOB) (length | (LPAREN RPAREN))? ccsidClause2?)
| (BINARY (integerInParens | (LPAREN RPAREN))?)
| (((BINARY VARYING?) | VARBINARY) (integerInParens | (LPAREN RPAREN))?)
| (((BINARY LARGE OBJECT) | BLOB) (LPAREN (INTEGERLITERAL | SQLIDENTIFIER) RPAREN)?)
| DATE
| TIME
| (TIMESTAMP integerInParens? ((WITH | WITHOUT) TIME ZONE)?)
| ROWID
| (XML (LPAREN xmlTypeModifier RPAREN)?)
)
;
sequenceDataType
: (sequenceBuiltInType | distinctTypeName)
;
sequenceBuiltInType
: (
SMALLINT
| INTEGER
| INT
| BIGINT
| ((DECIMAL | DEC | NUMERIC) integerInParens?)
)
;
sqlDataType
: (
(VARCHAR LPAREN INTEGERLITERAL RPAREN)
| (DECFLOAT (LPAREN INTEGERLITERAL RPAREN)?)
| DATE
| (TIMESTAMP (LPAREN INTEGERLITERAL RPAREN)?)
)
;
xmlTypeModifier
: (
XMLSCHEMA
xmlSchemaSpecification (ELEMENT xmlElementName)?
(COMMA xmlSchemaSpecification (ELEMENT xmlElementName)?)*
)
;
xmlSchemaSpecification
: (
(ID registeredXmlSchemaName)
| (((URL targetNamespace) | (NO NAMESPACE)) (LOCATION schemaLocation)?)
)
;
/*
Documentation is a bit sketchy on details for the following
four items. Examples would be nice.
*/
xmlElementName
: (identifier | literal)
;
piName
: (NONNUMERICLITERAL)
;
registeredXmlSchemaName
: (
SYSXSR DOT SQLIDENTIFIER
)
;
targetNamespace
: (NONNUMERICLITERAL)
;
schemaLocation
: (NONNUMERICLITERAL)
;
identityAlteration
: (
(RESTART (WITH INTEGERLITERAL)?)
| (SET incrementOption)
| (SET minvalueOption)
| (SET maxvalueOption)
| (SET cycleOption)
| (SET cacheOption)
| (SET orderOption)
)
;
uniqueConstraint
: (
(CONSTRAINT constraintName)?
((PRIMARY KEY) | UNIQUE)
LPAREN
columnName (COMMA columnName)*
(COMMA BUSINESS_TIME WITHOUT OVERLAPS)?
RPAREN
)
;
referentialConstraint
: (
((CONSTRAINT constraintName FOREIGN KEY) | (FOREIGN KEY constraintName?))
LPAREN
columnName (PERIOD BUSINESS_TIME)? (COMMA columnName (PERIOD BUSINESS_TIME)?)*
RPAREN
referencesClause
)
;
referencesClause
: (
REFERENCES tableName
(LPAREN
columnName (PERIOD BUSINESS_TIME)? (COMMA columnName (PERIOD BUSINESS_TIME)?)*
RPAREN)?
(ON DELETE (RESTRICT | (NO ACTION) | CASCADE | (SET NULL)))?
(NOT? ENFORCED)?
(ENABLE QUERY OPTIMIZATION)?
)
;
checkConstraint
: (
(CONSTRAINT constraintName)? CHECK LPAREN checkCondition RPAREN
)
;
partitioningClause
: (
PARTITION BY
((RANGE?
LPAREN
partitionExpression (COMMA partitionExpression)*
RPAREN
LPAREN
partitioningClauseElement (COMMA partitioningClauseElement)*
RPAREN)
| (SIZE (EVERY SQLIDENTIFIER)?))
)
;
partitionExpression
: (
columnName (NULLS LAST)? (ASC | DESC)
)
;
partitionLimitKey
: (INTEGERLITERAL | MAXVALUE | MINVALUE)
;
/*
The partitionHashSpace rule can be before the INCLUSIVE token in
the create table statement, or after the INCLUSIVE token in the
alter table statement. Also, it's deprecated as of Db2 12.
*/
partitioningPhrase
: (ENDING AT? LPAREN partitionLimitKey (COMMA partitionLimitKey)* RPAREN partitionHashSpace? INCLUSIVE? partitionHashSpace?)
;
//deprecated as of Db2 12
partitionHashSpace
: (HASH SPACE SQLIDENTIFIER)
;
//deprecated as of Db2 12
alterHashOrganization
: (
(ADD ORGANIZE BY HASH UNIQUE LPAREN columnName (COMMA columnName)* RPAREN HASH SPACE SQLIDENTIFIER)
| (ALTER ORGANIZATION SET HASH SPACE SQLIDENTIFIER)
)
;
partitioningClauseElement
: (
PARTITION INTEGERLITERAL partitioningPhrase
)
;
partitionClause
: (
partitioningPhrase | partitionHashSpace
)
;
rotatePartitionClause
: (partitioningPhrase RESET)
;
extraRowOption
: (ON DELETE ADD EXTRA ROW)
;
materializedQueryDefinition
: (
LPAREN fullSelect RPAREN refreshableTableOptions
)
;
materializedQueryAlteration
: (SET refreshableTableOptionsList+)
;
refreshableTableOptions
: (dataInitiallyDeferredPhrase refreshDeferredPhrase refreshableTableOptionsList*)
;
dataInitiallyDeferredPhrase
: (DATA INITIALLY DEFERRED)
;
refreshDeferredPhrase
: (REFRESH DEFERRED)
;
refreshableTableOptionsList
: (
(MAINTAINED BY (SYSTEM | USER))
| (enableDisableOption QUERY OPTIMIZATION)
)
;
materializedQueryTableAlteration
: (SET refreshableTableOptionsList+)
;
periodDefinition
: (
PERIOD FOR?
((SYSTEM_TIME LPAREN beginColumnName COMMA endColumnName RPAREN)
| (BUSINESS_TIME LPAREN beginColumnName COMMA endColumnName (EXCLUSIVE | INCLUSIVE) RPAREN))
)
;
alterTableColumnDefinition
: (
(columnName builtInType alterTableColumnDefinitionOptionList1*)
| (columnName distinctTypeName alterTableColumnDefinitionOptionList2*)
)
;
externalProgramName
: (identifier | NONNUMERICLITERAL)
;
packagePath
: (
collectionID
| SESSION_USER
| USER
| (CURRENT PACKAGE PATH)
| (CURRENT PATH)
| hostVariable
| NONNUMERICLITERAL
)
;
collectionID
: identifier
;
runTimeOptions
: NONNUMERICLITERAL
;
comparisonOperator
: (EQ | GT | LT | GE | LE | NE)
;
operator
: (SPLAT | PLUS | MINUS | SLASH | CONCAT | CONCATOP)
;
expression
: (
functionInvocation
| LPAREN expression RPAREN
| labeledDuration
| literal
| specialRegister
| columnName
| hostVariable
| scalarFullSelect
| timeZoneSpecificExpression
| caseExpression
| castSpecification
| xmlCastSpecification
| arrayElementSpecification
| arrayConstructor
| olapSpecification
| rowChangeExpression
| sequenceReference
| ((operator | INTEGERLITERAL) expression)
| ((functionInvocation
| LPAREN expression RPAREN
| labeledDuration
| literal
| specialRegister
| columnName
| hostVariable
| scalarFullSelect
| timeZoneSpecificExpression
| caseExpression
| castSpecification
| xmlCastSpecification
| arrayElementSpecification
| arrayConstructor
| olapSpecification
| rowChangeExpression
| sequenceReference)
((operator | INTEGERLITERAL) expression)*)
)
;
keyExpression
: (expression)
;
rowChangeExpression
: ROW CHANGE (TIMESTAMP | TOKEN) FOR tableName
;
sequenceReference
: (NEXT | PREVIOUS) VALUE FOR tableName
;
functionInvocation
: (
scalarFunctionInvocation
| aggregateFunctionInvocation
| regressionFunctionInvocation
| externalFunctionInvocation
)
;
scalarFunctionInvocation
: (
xmlattributesFunction
| xmlelementFunction
| xmlforestFunction
| xmlmodifyFunction
| xmlnamespaceFunction
| xmlpiFunction
| xmlqueryFunction
| xmlserializeFunction
| ((schemaName DOT)? scalarFunction LPAREN (expression (COMMA expression)*)? RPAREN (AS NONNUMERICLITERAL)?)
)
;
aggregateFunctionInvocation
: (
arrayaggFunction
| correlationFunction
| covarianceFunction
| covarianceSampFunction
| cumeDistFunction
| listaggFunction
| percentileContFunction
| percentileDiscFunction
| percentRankFunction
| xmlaggFunction
| ((schemaName DOT)? aggregateFunction LPAREN DISTINCT? (expression | SPLAT) RPAREN)
)
;
regressionFunctionInvocation
: ((schemaName DOT)? regressionFunction
LPAREN
expression COMMA expression
RPAREN)
;
externalFunctionInvocation
: ((schemaName DOT)? SQLIDENTIFIER
LPAREN
expression (COMMA expression)*
RPAREN)
;
labeledDuration
: (
(functionInvocation
| (LPAREN expression RPAREN)
| INTEGERLITERAL
| columnName
| variable)
durationSuffix
)
;
durationSuffix
: (
YEAR
| YEARS
| MONTH
| MONTHS
| DAY
| DAYS
| HOUR
| HOURS
| MINUTE
| MINUTES
| SECOND
| SECONDS
| MICROSECOND
| MICROSECONDS
)
;
xmlCastSpecification
: XMLCAST (expression | NULL | parameterMarker) AS dataType
;
arrayElementSpecification
: arrayExpression OPENSQBRACKET arrayIndex CLOSESQBRACKET
;
arrayIndex
: expression (operator? expression)*
;
arrayConstructor
: ARRAY
OPENSQBRACKET
(
QUESTIONMARK
| fullSelect
| ((expression | NULL) (COMMA (expression | NULL))*)
)
CLOSESQBRACKET
;
olapSpecification
: orderedOlapSpecification
| numberingSpecification
| aggregationSpecification
;
orderedOlapSpecification
: olapSpecificationFunction
OVER LPAREN windowPartitionClause? windowOrderClause RPAREN
;
olapSpecificationFunction
: (
(CUME_DIST LPAREN RPAREN)
| (PERCENT_RANK LPAREN RPAREN)
| (RANK LPAREN RPAREN)
| (DENSE_RANK LPAREN RPAREN)
| (NTILE LPAREN expression RPAREN)
| lagFunction
| leadFunction
)
;
lagFunction
: LAG LPAREN expression
(
COMMA INTEGERLITERAL
(COMMA expression
(COMMA ((RESPECT NULLS) | (IGNORE NULLS)))?)? RPAREN
)
;
leadFunction
: LEAD LPAREN expression
(
COMMA INTEGERLITERAL
(COMMA expression
(COMMA respectNullsClause)?)? RPAREN
)
;
respectNullsClause
: ((RESPECT NULLS) | (IGNORE NULLS))
;
windowPartitionClause
: (PARTITION BY expression (COMMA expression)*)
;
windowOrderClause
: ORDER BY expression windowOrderClauseQualifier? (COMMA expression windowOrderClauseQualifier?)*
;
windowOrderClauseQualifier
: (ASC | DESC) (NULLS (FIRST | LAST))?
;
numberingSpecification
: ROW_NUMBER LPAREN RPAREN OVER LPAREN windowPartitionClause? windowOrderClause? RPAREN
;
aggregationSpecification
: (aggregateFunctionInvocation | olapColumnFunction) OVER LPAREN windowPartitionClause?
((RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
| (windowOrderClause ((RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) | windowAggregationGroupClause)?))?
RPAREN
;
aggregateFunction
: (
ARRAY_AGG
| AVG
| CORR
| CORRELATION
| COUNT
| COUNT_BIG
| COVAR_POP
| COVARIANCE
| COVAR
| COVAR_SAMP
| COVARIANCE_SAMP
| CUME_DIST
| GROUPING
| LISTAGG
| MAX
| MEDIAN
| MIN
| PERCENTILE_CONT
| PERCENTILE_DISC
| PERCENT_RANK
| STDDEV_POP
| STDDEV
| STDDEV_SAMP
| SUM
| VAR_POP
| VARIANCE
| VAR
| VAR_SAMP
| VARIANCE_SAMP
| XMLAGG
)
;
regressionFunction
: (
REGR_AVGX
| REGR_AVGY
| REGR_COUNT
| REGR_INTERCEPT
| REGR_ICPT
| REGR_R2
| REGR_SLOPE
| REGR_SXX
| REGR_SXY
| REGR_SYY
)
;
olapColumnFunction
: (
firstValueFunction
| lastValueFunction
| nthValueFunction
| ratioToReportFunction
)
;
firstValueFunction
: (FIRST_VALUE LPAREN expression (COMMA respectNullsClause)? RPAREN)
;
lastValueFunction
: (LAST_VALUE LPAREN expression (COMMA respectNullsClause)? RPAREN)
;
nthValueFunction
: (NTH_VALUE LPAREN expression COMMA INTEGERLITERAL RPAREN)
;
ratioToReportFunction
: (RATIO_TO_REPORT LPAREN expression RPAREN)
;
listaggFunction
: (
LISTAGG LPAREN (ALL | DISTINCT)? expression (COMMA NONNUMERICLITERAL)? RPAREN
(WITHIN GROUP LPAREN
ORDER BY sortKey (ASC | DESC)? (COMMA sortKey (ASC | DESC)?)*
RPAREN)?
)
;
arrayaggFunction
: (arrayaggOrdinaryFunction | arrayaggAssociativeFunction)
;
arrayaggOrdinaryFunction
: (
ARRAY_AGG LPAREN expression
(ORDER BY sortKey (ASC | DESC)? (COMMA sortKey (ASC | DESC)?)*)?
RPAREN
)
;
arrayaggAssociativeFunction
: (
ARRAY_AGG LPAREN expression (COMMA expression)? RPAREN
)
;
correlationFunction
: ((CORR | CORRELATION) LPAREN expression COMMA expression RPAREN)
;
covarianceFunction
: ((COVAR_POP | COVARIANCE | COVAR) LPAREN expression COMMA expression RPAREN)
;
covarianceSampFunction
: ((COVAR_SAMP | COVARIANCE_SAMP) LPAREN expression COMMA expression RPAREN)
;
cumeDistFunction
: (
CUME_DIST LPAREN
expression (COMMA expression)*
RPAREN
WITHIN GROUP LPAREN aggregateOrderByClause RPAREN
)
;
percentileContFunction
: (
PERCENTILE_CONT LPAREN expression RPAREN
WITHIN GROUP LPAREN ORDER BY expression (ASC | DESC)? RPAREN
)
;
percentileDiscFunction
: (
PERCENTILE_DISC LPAREN expression RPAREN
WITHIN GROUP LPAREN ORDER BY expression (ASC | DESC)? RPAREN
)
;
percentRankFunction
: (
PERCENT_RANK LPAREN
expression (COMMA expression)*
RPAREN
WITHIN GROUP LPAREN aggregateOrderByClause RPAREN
)
;
xmlaggFunction
: (XMLAGG LPAREN expression xmlaggOrderByClause? RPAREN)
;
xmlaggOrderByClause
: (ORDER BY xmlaggOrderByOption (COMMA xmlaggOrderByOption)*)
;
xmlaggOrderByOption
: (expression (ASC | DESC)?)
;
aggregateOrderByClause
: (ORDER BY aggregateOrderByOption (COMMA aggregateOrderByOption)*)
;
aggregateOrderByOption
: (sortKey (ASC | DESC)? (NULLS (LAST | FIRST))?)
;
windowAggregationGroupClause
: (ROWS | RANGE) (groupStart | groupBetween | groupEnd)
;
groupStart
: (unboundedPreceding | boundedPreceding | currentRow)
;
groupBetween
: BETWEEN groupBound1 AND groupBound2
;
groupEnd
: (unboundedFollowing | boundedFollowing)
;
groupBound1
: (unboundedPreceding | boundedPreceding | boundedFollowing | currentRow)
;
groupBound2
: (unboundedFollowing | boundedPreceding | boundedFollowing | currentRow)
;
unboundedPreceding
: UNBOUNDED PRECEDING
;
unboundedFollowing
: UNBOUNDED FOLLOWING
;
boundedPreceding
: INTEGERLITERAL PRECEDING
;
boundedFollowing
: INTEGERLITERAL FOLLOWING
;
currentRow
: CURRENT ROW
;
scalarFunction
: (
ABS
| ABSVAL
| ACOS
| ADD_DAYS
| ADD_MONTHS
| ARRAY_DELETE
| ARRAY_FIRST
| ARRAY_LAST
| ARRAY_NEXT
| ARRAY_PRIOR
| ARRAY_TRIM
| ASCII
| ASCII_CHR
| ASCIISTR
| ASCII_STR
| ASIN
| ATAN
| ATAN2
| ATANH
| BIGINT
| BINARY
| BITAND
| BITANDNOT
| BITNOT
| BITOR
| BITXOR
| BLOB
| BTRIM
| CARDINALITY
| CCSID_ENCODING
| CEIL
| CEILING
| CHAR
| CHAR9
| CHARACTER_LENGTH
| CHAR_LENGTH
| CHR
| CLOB
| COALESCE
| COLLATION_KEY
| COMPARE_DECFLOAT
| CONCAT
| CONTAINS
| COS
| COSH
| DATE
| DAY
| DAYOFMONTH
| DAYOFWEEK
| DAYOFWEEK_ISO
| DAYOFYEAR
| DAYS
| DAYS_BETWEEN
| DBCLOB
| DEC
| DECFLOAT
| DECFLOAT_FORMAT
| DECFLOAT_SORTKEY
| DECIMAL
| DECODE
| DECRYPT_BINARY
| DECRYPT_BIT
| DECRYPT_CHAR
| DECRYPT_DATAKEY_BIGINT
| DECRYPT_DATAKEY_BIT
| DECRYPT_DATAKEY_CLOB
| DECRYPT_DATAKEY_DBCLOB
| DECRYPT_DATAKEY_DECIMAL
| DECRYPT_DATAKEY_INTEGER
| DECRYPT_DATAKEY_VARCHAR
| DECRYPT_DATAKEY_VARGRAPHIC
| DECRYPT_DB
| DEGREES
| DIFFERENCE
| DIGITS
| DOUBLE
| DOUBLE_PRECISION
| DSN_XMLVALIDATE
| EBCDIC_CHR
| EBCDIC_STR
| ENCRYPT_DATAKEY
| ENCRYPT_TDES
| EXP
| EXTRACT
| FLOAT
| FLOOR
| GENERATE_UNIQUE
| GENERATE_UNIQUE_BINARY
| GETHINT
| GETVARIABLE
| GRAPHIC
| GREATEST
| HASH
| HASH_CRC32
| HASH_MD5
| HASH_SHA1
| HASH_SHA256
| HEX
| HOUR
| IDENTITY_VAL_LOCAL
| IFNULL
| INSERT
| INSTR
| INT
| INTEGER
| JULIAN_DAY
| LAST_DAY
| LCASE
| LEAST
| LEFT
| LENGTH
| LN
| LOCATE
| LOCATE_IN_STRING
| LOG10
| LOWER
| LPAD
| LTRIM
| MAX_CARDINALITY
| MICROSECOND
| MIDNIGHT_SECONDS
| MINUTE
| MOD
| MONTH
| MONTHS_BETWEEN
| MQREAD
| MQREADCLOB
| MQRECEIVE
| MQRECEIVECLOB
| MQSEND
| MULTIPLY_ALT
| NEXT_DAY
| NEXT_MONTH
| NORMALIZE_DECFLOAT
| NORMALIZE_STRING
| NULLIF
| NVL
| OVERLAY
| PACK
| POSITION
| POSSTR
| POW
| POWER
| QUANTIZE
| QUARTER
| RADIANS
| RAISE_ERROR
| RAND
| RANDOM
| REAL
| REGEXP_COUNT
| REGEXP_INSTR
| REGEXP_LIKE
| REGEXP_REPLACE
| REGEXP_SUBSTR
| REPEAT
| REPLACE
| RID
| RIGHT
| ROUND
| ROUND_TIMESTAMP
| ROWID
| RPAD
| RTRIM
| SCORE
| SECOND
| SIGN
| SIN
| SINH
| SMALLINT
| SOAPHTTPC
| SOAPHTTPNC
| SOAPHTTPNV
| SOAPHTTPV
| SOUNDEX
| SPACE
| SQRT
| STRIP
| STRLEFT
| STRPOS
| STRRIGHT
| SUBSTR
| SUBSTRING
| TAN
| TANH
| TIME
| TIMESTAMP
| TIMESTAMPADD
| TIMESTAMPDIFF
| TIMESTAMP_FORMAT
| TIMESTAMP_ISO
| TIMESTAMP_TZ
| TO_CHAR
| TO_CLOB
| TO_DATE
| TO_NUMBER
| TOTALORDER
| TO_TIMESTAMP
| TRANSLATE
| TRIM
| TRIM_ARRAY
| TRUNC
| TRUNCATE
| TRUNC_TIMESTAMP
| UCASE
| UNICODE
| UNICODE_STR
| UNISTR
| UPPER
| VALUE
| VARBINARY
| VARCHAR
| VARCHAR9
| VARCHAR_BIT_FORMAT
| VARCHAR_FORMAT
| VARGRAPHIC
| VERIFY_GROUP_FOR_USER
| VERIFY_ROLE_FOR_USER
| VERIFY_TRUSTED_CONTEXT_ROLE_FOR_USER
| WEEK
| WEEK_ISO
| WRAP
| XMLATTRIBUTES
| XMLCOMMENT
| XMLCONCAT
| XMLDOCUMENT
| XMLELEMENT
| XMLFOREST
| XMLMODIFY
| XMLNAMESPACES
| XMLPARSE
| XMLPI
| XMLQUERY
| XMLSERIALIZE
| XMLTEXT
| XMLXSROBJECTID
| XSLTRANSFORM
| YEAR
)
;
tableFunction
: (
ADMIN_TASK_LIST
| ADMIN_TASK_OUTPUT
| ADMIN_TASK_STATUS
| BLOCKING_THREADS
| MQREADALL
| MQREADALLCLOB
| MQRECEIVEALL
| MQRECEIVEALLCLOB
| XMLTABLE
)
;
specialRegister
: (
CURRENT_ACCELERATOR
| CURRENT_APPLICATION_COMPATIBILITY
| CURRENT_APPLICATION_ENCODING_SCHEME
| CURRENT_CLIENT_ACCTNG
| CURRENT_CLIENT_APPLNAME
| CURRENT_CLIENT_CORR_TOKEN
| CURRENT_CLIENT_USERID
| CURRENT_CLIENT_WRKSTNNAME
| CURRENT_DATE
| CURRENT_DEBUG_MODE
| CURRENT_DECFLOAT_ROUNDING_MODE
| CURRENT_DEGREE
| CURRENT_EXPLAIN_MODE
| CURRENT_GET_ACCEL_ARCHIVE
| CURRENT_LOCALE_LC_CTYPE
| CURRENT_MAINTAINED_TABLE_TYPES_FOR_OPTIMIZATION
| CURRENT_MEMBER
| CURRENT_OPTIMIZATION_HINT
| CURRENT_PACKAGE_PATH
| CURRENT_PACKAGESET
| CURRENT_PATH
| CURRENT_PRECISION
| CURRENT_QUERY_ACCELERATION
| CURRENT_QUERY_ACCELERATION_WAITFORDATA
| CURRENT_REFRESH_AGE
| CURRENT_ROUTINE_VERSION
| CURRENT_RULES
| CURRENT_SCHEMA
| CURRENT_SERVER
| CURRENT_SQLID
| CURRENT_TEMPORAL_BUSINESS_TIME
| CURRENT_TEMPORAL_SYSTEM_TIME
| CURRENT_TIME
| CURRENT_TIMESTAMP
| CURRENT_TIME_ZONE
| ENCRYPTION_PASSWORD
| SESSION_TIME_ZONE
| SESSION_USER
| USER
)
;
xmlelementFunction
: (
XMLELEMENT LPAREN NAME xmlElementName
(COMMA xmlnamespacesDeclaration)?
(COMMA xmlattributesFunction)?
(COMMA expression)*
xmlFunctionOptionClause?
RPAREN
)
;
xmlforestFunction
: (
XMLFOREST LPAREN xmlnamespaceFunction?
elementContentExpression (AS xmlElementName)?
(COMMA elementContentExpression (AS xmlElementName)?)*
xmlFunctionOptionClause?
RPAREN
)
;
xmlmodifyFunction
: (
XMLMODIFY LPAREN expression
(COMMA expression AS (NONNUMERICLITERAL | identifier))*
RPAREN
)
;
xmlpiFunction
: (
XMLPI LPAREN NAME piName (COMMA expression)? RPAREN
)
;
xmlqueryFunction
: (
XMLQUERY LPAREN xqueryExpressionConstant
(PASSING (BY REF)? xqueryArgument (COMMA xqueryArgument)*)?
(RETURNING SEQUENCE (BY REF)?)? (EMPTY ON EMPTY)?
RPAREN
)
;
xmlattributesFunction
: (
XMLATTRIBUTES LPAREN
expression AS NONNUMERICLITERAL (COMMA expression AS NONNUMERICLITERAL)*
RPAREN
)
;
xmlserializeFunction
: (
XMLSERIALIZE LPAREN CONTENT? expression AS dataType
xmlserializeFunctionOptions*
RPAREN
)
;
xmlnamespaceFunction
: (
XMLNAMESPACES LPAREN xmlnamespaceOption (COMMA xmlnamespaceOption)* RPAREN
)
;
xmlnamespaceOption
: (
(namespaceUri AS namespacePrefix)
| (DEFAULT namespaceUri)
| (NO DEFAULT)
)
;
xmlserializeFunctionOptions
: (
(VERSION NONNUMERICLITERAL)
| ((EXCLUDING | INCLUDING) XMLDECLARATION)
)
;
xmlFunctionOptionClause
: (
OPTION xmlFunctionOption+
)
;
xmlFunctionOption
: (
((EMPTY | NULL) ON NULL)
| (XMLBINARY USING? (BASE64 | HEX))
)
;
elementContentExpression
: (expression)
;
xqueryExpressionConstant
: (NONNUMERICLITERAL)
;
xqueryArgument
: (xqueryContextItemExpression | (xqueryVariableExpression AS (identifier | NONNUMERICLITERAL)))
;
xmltableFunctionSpecification
: (
XMLTABLE
LPAREN
(xmlnamespacesDeclaration COMMA)?
rowXqueryExpressionConstant
(PASSING (BY REF)? rowXqueryArgument (COMMA rowXqueryArgument)*)?
(COLUMNS (xmlTableRegularColumnDefinition | xmlTableOrdinalityColumnDefinition)
(COMMA (xmlTableRegularColumnDefinition | xmlTableOrdinalityColumnDefinition))*)?
RPAREN
)
;
rowXqueryExpressionConstant
: (NONNUMERICLITERAL)
;
rowXqueryArgument
: (
(xqueryContextItemExpression | (xqueryVariableExpression AS (identifier | NONNUMERICLITERAL)))
)
;
xqueryContextItemExpression
: (expression)
;
xqueryVariableExpression
: (expression)
;
xmlTableRegularColumnDefinition
: (
columnName
dataType
(defaultClause | (PATH columnXqueryExpressionConstant))?
)
;
defaultClause
: (
WITH? DEFAULT
(defaultClauseAllowables
| (distinctTypeCastFunctionName LPAREN defaultClauseAllowables RPAREN))
)
;
defaultClause1
: (
WITH? DEFAULT defaultClauseAllowables?
)
;
defaultClause2
: (
WITH? DEFAULT
(defaultClauseAllowables
| (distinctTypeCastFunctionName LPAREN defaultClauseAllowables RPAREN))
)
;
defaultClauseAllowables
: (
literal
| SESSION_USER
| USER
| CURRENT_SQLID
| NULL
)
;
distinctTypeCastFunctionName
: (identifier DOT identifier)
;
/*
castFunction
: (
castSpecification
| scalarFunctionInvocation
| charFunctionSpecification
| clobFunctionSpecification
| dbclobFunctionSpecification
| graphicFunctionSpecification1
| graphicFunctionSpecification2
| vargraphicFunctionSpecification1
| vargraphicFunctionSpecification2
)
;
expressionAndCodeUnitsArguments
: (
expression
(COMMA INTEGERLITERAL (COMMA (CODEUNITS16 | CODEUNITS32 | OCTETS))?)?
)
;
clobFunctionSpecification
: (
CLOB
LPAREN
expressionAndCodeUnitsArguments
RPAREN
)
;
dbclobFunctionSpecification
: (
DBCLOB
LPAREN
expressionAndCodeUnitsArguments
RPAREN
)
;
graphicFunctionSpecification1
: (
GRAPHIC
LPAREN
expressionAndCodeUnitsArguments
RPAREN
)
;
graphicFunctionSpecification2
: (
GRAPHIC
LPAREN
expression
NONNUMERICLITERAL?
RPAREN
)
;
vargraphicFunctionSpecification1
: (
GRAPHIC
LPAREN
expressionAndCodeUnitsArguments
RPAREN
)
;
vargraphicFunctionSpecification2
: (
GRAPHIC
LPAREN
expression
NONNUMERICLITERAL?
RPAREN
)
;
*/
columnXqueryExpressionConstant
: (NONNUMERICLITERAL)
;
xmlTableOrdinalityColumnDefinition
: (columnName FOR ORDINALITY)
;
xmlnamespacesDeclaration
: (
xmlnamespacesFunctionSpecification
(COMMA xmlnamespacesFunctionSpecification)*
)
;
xmlnamespacesFunctionSpecification
: (
XMLNAMESPACES
LPAREN
xmlnamespacesFunctionArguments
(COMMA xmlnamespacesFunctionArguments)*
RPAREN
)
;
xmlnamespacesFunctionArguments
: (
((namespaceUri AS namespacePrefix)
| (DEFAULT namespaceUri)
| (NO DEFAULT))
)
;
namespaceUri
: NONNUMERICLITERAL
;
namespacePrefix
: NONNUMERICLITERAL
;
timeZoneSpecificExpression
: timeZoneExpressionSubset
((AT LOCAL) | (AT TIME ZONE timeZoneExpressionSubset))
;
timeZoneExpressionSubset
: (
functionInvocation
| literal
| columnName
| hostVariable
| specialRegister
| scalarFullSelect
| caseExpression
| castSpecification
)
;
caseExpression
: CASE
(searchedWhenClause+ | simpleWhenClause)
((ELSE NULL) | (ELSE resultExpression))?
END
;
resultExpression
: expression
;
searchedWhenClause
: (
WHEN searchCondition THEN (resultExpression | NULL)
)
;
simpleWhenClause
: (
expression
(WHEN expression THEN (resultExpression | NULL))+
)
;
searchCondition
: NOT?
((predicate (SELECTIVITY NUMERICLITERAL)?) | (LPAREN searchCondition RPAREN))
((AND | OR) NOT? (predicate | (LPAREN searchCondition RPAREN)))*
;
checkCondition
: (searchCondition)
;
predicate
: basicPredicate
| quantifiedPredicate
| arrayExistsPredicate
| betweenPredicate
| distinctPredicate
| existsPredicate
| inPredicate
| likePredicate
| nullPredicate
| xmlExistsPredicate
;
basicPredicate
: ((expression comparisonOperator expression)
| (rowValueExpression comparisonOperator rowValueExpression))
;
rowValueExpression
: LPAREN expression
(COMMA expression)*
RPAREN
;
quantifiedPredicate
: ((expression comparisonOperator (SOME | ANY | ALL) LPAREN fullSelect RPAREN)
| (rowValueExpression EQ (SOME | ANY) LPAREN fullSelect RPAREN)
| (rowValueExpression NE ALL LPAREN fullSelect RPAREN))
;
arrayExistsPredicate
: ARRAY_EXISTS
LPAREN
arrayExpression
INTEGERLITERAL
RPAREN
;
betweenPredicate
: expression NOT? BETWEEN expression AND expression
;
distinctPredicate
: expression IS NOT? DISTINCT FROM expression
;
existsPredicate
: EXISTS LPAREN fullSelect RPAREN
;
inPredicate
: expression NOT? IN (
(LPAREN fullSelect RPAREN)
| (LPAREN expression (COMMA expression)* RPAREN)
)
;
likePredicate
: expression NOT? LIKE expression (ESCAPE expression)?
;
nullPredicate
: expression ((IS NOT? NULL) | ISNULL | NOTNULL)
;
xmlExistsPredicate
: XMLEXISTS
LPAREN
NONNUMERICLITERAL
(PASSING (BY REF)? expression (COMMA expression)*)?
RPAREN
;
arrayExpression
: variable
| castSpecification
;
castSpecification
: CAST
LPAREN
(expression | NULL | parameterMarker)
AS
castDataType
RPAREN
;
parameterMarker
: QUESTIONMARK
;
castDataType
: (
castBuiltInType
| distinctTypeName
| arrayType
)
;
castBuiltInType
: (
SMALLINT
| INTEGER
| INT
| BIGINT
| ((DECIMAL | DEC | NUMERIC) (integerInParens | (LPAREN RPAREN)))
| (DECFLOAT (integerInParens | (LPAREN RPAREN)))
| (FLOAT (integerInParens | (LPAREN RPAREN)))
| REAL
| (DOUBLE PRECISION?)
| ((((CHARACTER | CHAR) VARYING? ) | VARCHAR) (length | (LPAREN RPAREN))? ccsidQualifier?)
| ((((CHARACTER | CHAR) LARGE OBJECT) | CLOB) (length | (LPAREN RPAREN))? ccsidQualifier?)
| ((GRAPHIC | VARGRAPHIC | DBCLOB) (length | (LPAREN RPAREN))? ccsidQualifier?)
| (BINARY (integerInParens | (LPAREN RPAREN))?)
| (((BINARY VARYING?) | VARBINARY) (integerInParens | (LPAREN RPAREN))?)
| (((BINARY LARGE OBJECT) | BLOB) (LPAREN (INTEGERLITERAL SQLIDENTIFIER) RPAREN)?)
| DATE
| TIME
| (TIMESTAMP integerInParens? ((WITH | WITHOUT) TIME ZONE)?)
| ROWID
| XML
)
;
integerInParens
: (LPAREN INTEGERLITERAL (COMMA INTEGERLITERAL)? RPAREN)
;
/*
It turns out the lengthQualifier of K or M or G gets lexed
as being part of the INTEGERLITERAL and becomes an SQLIDENTIFIER.
*/
length
: (
LPAREN
(INTEGERLITERAL | SQLIDENTIFIER)
(CODEUNITS16 | CODEUNITS32 | OCTETS)?
RPAREN
)
;
ccsidQualifier
: (
CCSID
(((ASCII | EBCDIC | UNICODE) forDataQualifier?) | INTEGERLITERAL)
)
;
forDataQualifier
: (FOR (SBCS | MIXED | BIT) DATA)
;
distinctTypeName
: (schemaName DOT)? identifier
;
arrayType
: identifier
;
literal
: NUMERICLITERAL
| NONNUMERICLITERAL
| INTEGERLITERAL
;
ccsidValue
: INTEGERLITERAL
;
columnName
: (((correlationName | tableName) DOT)? (identifier1 | NONNUMERICLITERAL))
;
sourceColumnName
: columnName
;
targetColumnName
: columnName
;
newColumnName
: identifier
;
beginColumnName
: identifier
;
endColumnName
: identifier
;
correlationName
: identifier
;
locationName
// : (identifier | NUMERICLITERAL | INTEGERLITERAL) (DOT? (identifier | NUMERICLITERAL | INTEGERLITERAL))*
: SQLIDENTIFIER
;
schemaName
: identifier1
;
tableName
: (((locationName DOT schemaName DOT) | (schemaName DOT))? identifier)
;
alterTableName
: (((locationName DOT schemaName DOT) | (schemaName DOT))? identifier)
;
auxTableName
: (((locationName DOT schemaName DOT) | (schemaName DOT))? identifier)
;
historyTableName
: tableName
;
cloneTableName
: tableName
;
archiveTableName
: tableName
;
viewName
: ((locationName DOT schemaName DOT) | (schemaName DOT))? identifier correlationName?
;
programName
: identifier
;
packageName
: identifier
;
planName
: identifier
;
typeName
: ((schemaName DOT)? identifier)
;
variableName
: ((schemaName DOT)? identifier)
;
arrayTypeName
: ((schemaName DOT)? identifier)
;
jarName
: ((schemaName DOT)? identifier)
;
savepointName
: identifier
;
aliasName
: identifier
;
constraintName
: identifier
;
routineVersionID
: (identifier | NUMERICLITERAL | INTEGERLITERAL) (DOT? (identifier | NUMERICLITERAL | INTEGERLITERAL))*
;
versionID
: (identifier | NUMERICLITERAL | INTEGERLITERAL) (DOT? (identifier | NUMERICLITERAL | INTEGERLITERAL))*
;
indexName
: (schemaName DOT)? identifier
;
maskName
: (schemaName DOT)? identifier
;
permissionName
: (schemaName DOT)? identifier
;
procedureName
: ((locationName DOT schemaName DOT) | (schemaName DOT))? identifier
;
sequenceName
: (schemaName DOT)? identifier
;
memberName
: identifier
;
databaseName
: identifier
;
tablespaceName
: identifier
;
acceleratorName
: identifier
;
catalogName
: identifier
;
triggerName
: identifier
;
contextName
: identifier
;
authorizationName
: identifier
;
profileName
: identifier
;
roleName
: identifier
;
seclabelName
: identifier
;
parameterName
: identifier
;
addressValue
: NONNUMERICLITERAL
;
jobnameValue
: NONNUMERICLITERAL
;
servauthValue
: NONNUMERICLITERAL
;
encryptionValue
: NONNUMERICLITERAL
;
bpName
: identifier
;
stogroupName
: identifier
;
dcName
: identifier
;
mcName
: identifier
;
scName
: identifier
;
volumeID
: identifier
;
keyLabelName
: (identifier | NONNUMERICLITERAL)
;
functionName
: (schemaName DOT)? identifier
;
specificName
: (schemaName DOT)? identifier
;
hostLabel
: identifier
;
hostVariable
: COLON (hostStructure DOT)? hostIdentifier (INDICATOR? COLON (nullIndicatorStructure DOT)? nullIndicator)?
;
hostIdentifier
: identifier
;
hostStructure
: identifier
;
nullIndicator
: identifier
;
nullIndicatorStructure
: identifier
;
globalVariableName
: ((schemaName DOT)? identifier1)
;
sqlParameterName
: ((schemaName DOT)? identifier1)
;
sqlVariableName
: ((schemaName DOT)? identifier1)
;
transitionVariableName
: columnName
;
synonym
: identifier
;
/*
Trigger variables, global variables, SQL variables, all
these conform to the pattern (schemaName DOT)? identifier.
*/
variable
: ((schemaName DOT)? identifier)
| hostVariable
;
intoClause
: INTO
(variable | arrayElementSpecification)
(COMMA variable)*
;
correlationClause
: AS?
correlationName
(LPAREN
newColumnName
(COMMA newColumnName)*
RPAREN)?
;
/*
fromClause
: FROM
tableName correlationClause?
(COMMA tableName correlationClause?)*
;
*/
fromClause
: (
FROM
((LPAREN* tableReference RPAREN*) | collectionDerivedTable)
(COMMA ((LPAREN* tableReference RPAREN*) | collectionDerivedTable))*
)
;
tableReference
: (
singleTableReference
| nestedTableExpression
| dataChangeTableReference
| tableFunctionReference
| tableLocatorReference
| xmltableExpression
| collectionDerivedTable
// | joinedTable
/*
The following is brought to you by the ANTLR 4.9.2 message
"The following sets of rules are mutually left-recursive [tableReference, joinedTable]"
*/
| ((singleTableReference
| nestedTableExpression
| tableFunctionReference
| tableLocatorReference
| xmltableExpression
| collectionDerivedTable
| (LPAREN+ tableReference RPAREN+)
| ((singleTableReference
| nestedTableExpression
| tableFunctionReference
| tableLocatorReference
| xmltableExpression
| (LPAREN+ tableReference RPAREN+)
| collectionDerivedTable)
(INNER | ((LEFT | RIGHT | FULL) OUTER?)) JOIN
tableReference ON joinCondition))
((INNER | ((LEFT | RIGHT | FULL) OUTER?)) JOIN
tableReference ON joinCondition)+)
| ((singleTableReference
| nestedTableExpression
| tableFunctionReference
| tableLocatorReference
| xmltableExpression
| collectionDerivedTable
| (LPAREN+ tableReference RPAREN+)
| ((singleTableReference
| nestedTableExpression
| tableFunctionReference
| tableLocatorReference
| xmltableExpression
| (LPAREN+ tableReference RPAREN+)
| collectionDerivedTable)
(INNER | ((LEFT | RIGHT | FULL) OUTER?)) JOIN
tableReference ON joinCondition)) CROSS JOIN tableReference)
| (LPAREN+ tableReference RPAREN+)
)
;
singleTableReference
: (tableName AS? correlationName? periodSpecification* correlationClause?)
;
periodSpecification
: (
FOR (SYSTEM_TIME | BUSINESS_TIME)
((AS OF expression) | (FROM expression TO expression) | (BETWEEN expression AND expression))
)
;
periodClause
: (
FOR PORTION OF BUSINESS_TIME
((FROM expression TO expression) | (BETWEEN expression AND expression))
)
;
nestedTableExpression
: (TABLE? LPAREN fullSelect RPAREN correlationClause?)
;
/**/
dataChangeTableReference
: (
(FINAL TABLE LPAREN insertStatement RPAREN correlationClause?)
| ((FINAL | OLD) TABLE searchedUpdate)
| (OLD TABLE searchedDelete)
| (FINAL TABLE mergeStatement)
)
;
/**/
tableFunctionReference
: (
TABLE LPAREN
(schemaName DOT)?
(scalarFunction | aggregateFunction | regressionFunction | tableFunction | identifier)
LPAREN
((expression | (TABLE tableName)) (COMMA (expression | (TABLE tableName)))*)?
RPAREN
tableUdfCardinalityClause?
RPAREN
(correlationClause | typedCorrelationClause)?
)
;
tableUdfCardinalityClause
: (
CARDINALITY MULTIPLIER? (INTEGERLITERAL | NUMERICLITERAL)
)
;
typedCorrelationClause
: (
AS? correlationName LPAREN columnName dataType (COMMA columnName dataType)* RPAREN
)
;
tableLocatorReference
: (
TABLE
LPAREN
identifier
LIKE
tableName
RPAREN
correlationName?
)
;
xmltableExpression
: (xmltableFunctionSpecification correlationClause?)
;
/*
correlationClause
: (AS? correlationName (LPAREN columnName (COMMA columnName)* RPAREN)?)
;
*/
collectionDerivedTable
: (
UNNEST
LPAREN
(ordinaryArrayExpression | associativeArrayExpression)
(COMMA (ordinaryArrayExpression | associativeArrayExpression))*
RPAREN
(WITH ORDINALITY)?
correlationClause?
)
;
/* moved to the interior of tableReference due to mutual left-recursion error
joinedTable
: (
(tableReference
(INNER | ((LEFT | RIGHT | FULL) OUTER?))
JOIN
tableReference ON joinCondition)
| (tableReference CROSS JOIN tableReference)
| (LPAREN joinedTable RPAREN)
)
;
*/
joinCondition
: (
searchCondition
| (fullJoinExpression EQ fullJoinExpression)
)
;
fullJoinExpression
: (
(columnName
| castFunction
| (COALESCE LPAREN (columnName | castFunction) (COMMA (columnName | castFunction))* RPAREN))
)
;
castFunction
: (castSpecification)
;
ordinaryArrayExpression
: (expression)
;
associativeArrayExpression
: (expression)
;
comparison
: columnName comparisonOperator (columnName | literal)
;
whereClause
: WHERE searchCondition
;
groupByClause
: GROUP BY
(groupingExpression | groupingSets | superGroups)
;
havingClause
: HAVING searchCondition
;
groupingExpression
: (expression (COMMA expression)*)
;
groupingSets
: GROUPING SETS groupingSetsGroup
;
groupingSetsGroup
: LPAREN
(groupingSetsGroup | groupingExpression | superGroups)
(COMMA (groupingSetsGroup | groupingExpression | superGroups))*
RPAREN
;
superGroups
: (
((ROLLUP | CUBE) LPAREN groupingExpression RPAREN)
| (LPAREN RPAREN)
)
;
selectColumns
: (
(expression ((operator expression) | INTEGERLITERAL)* (AS? (newColumnName | NONNUMERICLITERAL))?)
| (tableName DOT SPLAT)
| unpackedRow
)
;
unpackedRow
: (
UNPACK LPAREN expression RPAREN DOT SPLAT AS
LPAREN
columnName dataType (COMMA columnName dataType)*
RPAREN
)
;
selectClause
: (
SELECT
(ALL | DISTINCT)?
(SPLAT | (selectColumns (COMMA selectColumns)*))
)
;
subSelect
: (
selectClause
fromClause
whereClause?
groupByClause?
havingClause?
orderByClause?
offsetClause?
fetchClause?
)
;
selectIntoStatement
: (
(WITH commonTableExpression (COMMA commonTableExpression)*)?
selectClause
intoClause
fromClause
whereClause?
groupByClause?
havingClause?
orderByClause?
offsetClause?
fetchClause?
(isolationClause | skipLockedDataClause)?
querynoClause?
)
;
selectStatement
: (
(WITH commonTableExpression (COMMA commonTableExpression)*)?
fullSelect
(
updateClause
| readOnlyClause
| optimizeClause
| isolationClause
| skipLockedDataClause
| querynoClause
)*
)
;
commonTableExpression
: tableName
LPAREN
columnName
(COMMA columnName)*
RPAREN
AS LPAREN fullSelect RPAREN
;
updateClause
: (FOR UPDATE (OF columnName (COMMA columnName)*)?)
;
readOnlyClause
: (FOR READ ONLY)
;
optimizeClause
: OPTIMIZE FOR INTEGERLITERAL (ROW | ROWS)
;
isolationClause
: WITH
(
(RR lockClause?)
| (RS lockClause?)
| CS
| UR
)
;
lockClause
: (USE AND KEEP (EXCLUSIVE | UPDATE | SHARE) LOCKS)
;
skipLockedDataClause
: (SKIP_ LOCKED DATA)
;
querynoClause
: (QUERYNO INTEGERLITERAL)
;
scalarFullSelect
: LPAREN
fullSelect
RPAREN
;
fullSelect
: ((LPAREN fullSelect RPAREN) | subSelect | valuesClause)
((UNION | EXCEPT | INTERSECT) (DISTINCT | ALL)? (subSelect | (LPAREN fullSelect RPAREN)))*
orderByClause?
offsetClause?
fetchClause?
;
valuesClause
: VALUES
(sequenceReference
| (LPAREN sequenceReference (COMMA sequenceReference)* RPAREN))
;
orderByClause
: ORDER BY
(
(sortKey (ASC | DESC)? (COMMA sortKey (ASC | DESC)?)*)
| (INPUT SEQUENCE)
| (ORDER OF tableName)
)
;
sortKey
: (columnName | INTEGERLITERAL | expression)
;
offsetClause
: OFFSET INTEGERLITERAL (ROW | ROWS)
;
fetchClause
: FETCH (FIRST | NEXT) INTEGERLITERAL? (ROW | ROWS) ONLY
;
identifier
: SQLIDENTIFIER
| sqlKeyword
| specialRegister
| scalarFunction
| aggregateFunction
| regressionFunction
| tableFunction
;
identifier1
: SQLIDENTIFIER
| sqlKeyword
| scalarFunction
| aggregateFunction
| regressionFunction
| tableFunction
;
sqlKeyword
: (
ADD
| AFTER
| ALL
| ALLOCATE
| ALLOW
| ALTERAND
| ANY
| ARRAY
| ARRAY_EXISTS
| AS
| ASENSITIVE
| ASSOCIATE
| ASUTIME
| AT
| AUDIT
| AUX
| AUXILIARY
| BEFORE
| BEGIN
| BETWEEN
| BUFFERPOOL
| BY
| CALL
| CAPTURE
| CASCADED
| CASE
| CAST
| CCSID
| CHAR
| CHARACTER
| CHECK
| CLONE
| CLOSE
| CLUSTER
| COLLECTION
| COLLID
| COLUMN
| COMMENT
| COMMIT
| CONCAT
| CONDITION
| CONNECT
| CONNECTION
| CONSTRAINT
| CONTAINS
| CONTENT
| CONTINUE
| CREATE
| CUBE
| CURRENT
| CURRENT_DATE
// | CURRENT_LC_CTYPE
| CURRENT_PATH
| CURRENT_SCHEMA
| CURRENT_SERVER
| CURRENT_TIME
| CURRENT_TIMESTAMP
| CURRENT_TIME_ZONE
| CURRVAL
| CURSOR
| DATA
| DATABASE
| DAY
| DAYS
| DBINFO
| DECLARE
| DEFAULT
| DELETE
| DESCRIPTOR
| DETERMINISTIC
| DISABLE
| DISALLOW
| DISTINCT
| DO
| DOCUMENT
| DOUBLE
| DROP
| DSSIZE
| DYNAMIC
| EDITPROC
| ELSE
| ELSEIF
| ENCODING
| ENCRYPTION
| END
| END_EXEC
| ENDING
| ERASE
| ESCAPE
| EXCEPT
| EXCEPTION
| EXEC_SQL
| EXECUTE
| EXISTS
| EXIT
| EXPLAIN
| EXTERNAL
| FENCED
| FETCH
| FIELDPROC
| FINAL
| FIRST
| FOR
| FREE
| FROM
| FULL
| FUNCTION
| GENERATED
| GET
| GLOBAL
| GO
| GOTO
| GRANT
| GROUP
| HANDLER
| HAVING
| HOLD
| HOUR
| HOURS
| IF
| IMMEDIATE
| IN
| INCLUSIVE
| INDEX
| INHERIT
| INNER
| INOUT
| INSENSITIVE
| INSERT
| INTERSECT
| INTO
| IS
| ISOBID
| ITERATE
| JAR
| JOIN
| KEEP
| KEY
| LABEL
| LANGUAGE
| LAST
| LC_CTYPE
| LEAVE
| LEFT
| LIKE
| LIMIT
| LOCAL
| LOCALE
| LOCATOR
| LOCATORS
| LOCK
| LOCKMAX
| LOCKSIZE
| LONG
| LOOP
| MAINTAINED
| MATERIALIZED
| MICROSECOND
| MICROSECONDS
| MINUTE
| MINUTES
| MODIFIES
| MONTH
| MONTHS
| NEXT
| NEXTVAL
| NO
| NONE
| NOT
| NULL
| NULLS
| NUMPARTS
| OBID
| OF
| OFFSET
| OLD
| ON
| OPEN
| OPTIMIZATION
| OPTIMIZE
| OR
| ORDER
| ORGANIZATION
| OUT
| OUTER
| PACKAGE
| PADDED
| PARAMETER
| PART
| PARTITION
| PARTITIONED
| PARTITIONING
| PATH
| PERIOD
| PIECESIZE
| PLAN
| PRECISION
| PREPARE
| PREVVAL
| PRIOR
| PRIQTY
| PRIVILEGES
| PROCEDURE
| PROGRAM
| PSID
| PUBLIC
| QUERY
| QUERYNO
| READS
| REFERENCES
| REFRESH
| RELEASE
| RENAME
| REPEAT
| RESIGNAL
| RESTRICT
| RESULT
| RESULT_SET_LOCATOR
| RETURN
| RETURNS
| REVOKE
| RIGHT
| ROLE
| ROLLBACK
| ROLLUP
| ROUND_CEILING
| ROUND_DOWN
| ROUND_FLOOR
| ROUND_HALF_DOWN
| ROUND_HALF_EVEN
| ROUND_HALF_UP
| ROUND_UP
| ROW
| ROWSET
| RUN
| SAVEPOINT
| SCHEMA
| SCRATCHPAD
| SECOND
| SECONDS
| SECQTY
| SECURITY
| SELECT
| SENSITIVE
| SEQUENCE
| SESSION_USER
| SET
| SIGNAL
| SIMPLE
| SOME
| SOURCE
| SPECIFIC
| STANDARD
| STATEMENT
| STATIC
| STAY
| STOGROUP
| STORES
| STYLE
| SUMMARY
| SYNONYM
| SYSDATE
| SYSTEM
| SYSTIMESTAMP
| TABLE
| TABLESPACE
| THEN
| TO
| TRIGGER
| TRUNCATE
| TYPE
| UNDO
| UNION
| UNIQUE
| UNTIL
| UPDATE
| USER
| USING
| VALIDPROC
| VALUE
| VALUES
| VARIABLE
| VARIANT
| VCAT
| VERSIONING
| VIEW
| VOLATILE
| VOLUMES
| WHEN
| WHENEVER
| WHERE
| WHILE
| WITH
| WLM
| XMLCAST
| XMLEXISTS
| XMLNAMESPACES
| YEAR
| YEARS
| ZONE
| AND
| ARRAY_AGG
| ASC
| AVG
| BIT
| CHANGE
| CODEUNITS16
| CODEUNITS32
| CORR
| CORRELATION
| COVAR
| COVARIANCE
| COVARIANCE_SAMP
| COVAR_POP
| COVAR_SAMP
| CS
| CUME_DIST
| DENSE_RANK
| DESC
| EBCDIC
| EXCLUSIVE
| FIRST_VALUE
| FOLLOWING
| GROUPING
| IGNORE
| INDICATOR
| INPUT
| ISNULL
| LAG
| LARGE
| LAST_VALUE
| LEAD
| LISTAGG
| LOCKED
| LOCKS
| MEDIAN
| MINUTES
| MIXED
| NOTNULL
| NTH_VALUE
| NTILE
| NUMERIC
| OBJECT
| OCTETS
| ONLY
| OVER
| PASSING
| PERCENTILE_CONT
| PERCENTILE_DISC
| PERCENT_RANK
| PRECEDING
| PREVIOUS
| RANGE
| RANK
| RATIO_TO_REPORT
| READ
| REF
| REGR_AVGX
| REGR_AVGY
| REGR_COUNT
| REGR_ICPT
| REGR_INTERCEPT
| REGR_R2
| REGR_SLOPE
| REGR_SXX
| REGR_SXY
| REGR_SYY
| RESPECT
| ROW_NUMBER
| ROWS
| RR
| RS
| SBCS
| SELECTIVITY
| SETS
| SHARE
| SKIP_
| STDDEV
| STDDEV_POP
| STDDEV_SAMP
| SUM
| TOKEN
| UNBOUNDED
| UNPACK
| UR
| USE
| VAR
| VARIANCE
| VARIANCE_SAMP
| VAR_POP
| VAR_SAMP
| VARYING
| WITHOUT
| XML
| XMLAGG
| COLUMNS
| SQLID
| ORDINALITY
| SYSTEM_TIME
| BUSINESS_TIME
| MULTIPLIER
| UNNEST
| CROSS
| CALLER
| CLIENT
| POSITIONING
| SCROLL
| ALTER
| INDEXBP
| ACTION
| ASSEMBLE
| C_
| CALLED
| COBOL
| DB2
| DEFINER
| DISPATCH
| ENVIRONMENT
| FAILURE
| FAILURES
| JAVA
| MAIN
| NAME
| OPTIONS
| PARALLEL
| PLI
| REGISTERS
| RESIDENT
| SECURED
| SPECIAL
| SQL
| STOP
| SUB
| YES
| APPLICATION
| CHANGED
| COMPATIBILITY
| COMPRESS
| COPY
| FREEPAGE
| GBPCACHE
| INCLUDE
| MAXVALUE
| MINVALUE
| PCTFREE
| REGENERATE
| MASK
| ENABLE
| PERMISSION
| ATOMIC
| SQLEXCEPTION
| MERGE
| MATCHED
| SQLSTATE
| MESSAGE_TEXT
| OVERRIDING
| PORTION
| DB2SQL
| DEBUG
| GENERAL
| MODE_
| REXX
| CACHE
| CYCLE
| INCREMENT
| RESTART
| DATACLAS
| MGMTCLAS
| REMOVE
| STORCLAS
| ACCESS
| ACTIVATE
| ALWAYS
| APPEND
| ARCHIVE
| BUSINESS
| CASCADE
| CHANGES
| CONTROL
| DEACTIVATE
| DEFERRED
| EACH
| ENFORCED
| EXTRA
| FOREIGN
| HIDDEN_
| HISTORY
| ID
| IDENTITY
| IMPLICITLY
| INITIALLY
| INLINE
| OPERATION
| ORGANIZE
| OVERLAPS
| PACKAGE_NAME
| PACKAGE_SCHEMA
| PACKAGE_VERSION
| PRIMARY
| RESET
| ROTATE
| START
| SYSIBM
| TRANSACTION
| XMLSCHEMA
| ELEMENT
| URL
| NAMESPACE
| LOCATION
| SYSXSR
| ALGORITHM
| FIXEDLENGTH
| HUFFMAN
| LOB
| LOG
| LOGGED
| MAXPARTITIONS
| MAXROWS
| MEMBER
| MOVE
| PAGE
| PAGENUM
| PENDING
| RELATIVE
| SEGSIZE
| TRACKMOD
| ADDRESS
| ATTRIBUTES
| AUTHENTICATION
| AUTHID
| CONTEXT
| JOBNAME
| OWNER
| PROFILE
| QUALIFIER
| SERVAUTH
| TRUSTED
| SECTION
| ACTIVE
| VERSION
| ALIAS
| WORK
| WORKFILE
| SYSDEFLT
| NULTERM
| STRUCTURE
| GENERIC
| TEMPORARY
| DEFER
| DEFINE
| EXCLUDE
| GENERATE
| KEYS
| XMLPATTERN
| SIZE
| EVERY
| ABSOLUTE
| ACCELERATOR
| EXCLUDING
| INCLUDING
| DEFAULTS
| MODIFIERS
| INSTEAD
| NEW
| NEW_TABLE
| OLD_TABLE
| REFERENCING
| BASED
| UPON
| OPTION
| PRESERVE
| BOTH
| DESCRIBE
| LABELS
| NAMES
| OUTPUT
| EXCHANGE
| STABILIZED
| STMTCACHE
| STMTID
| STMTTOKEN
| STARTING
| CATALOG_NAME
| CONDITION_NUMBER
| CURSOR_NAME
| DB2_AUTHENTICATION_TYPE
| DB2_AUTHORIZATION_ID
| DB2_CONNECTION_STATE
| DB2_CONNECTION_STATUS
| DB2_ENCRYPTION_TYPE
| DB2_ERROR_CODE1
| DB2_ERROR_CODE2
| DB2_ERROR_CODE3
| DB2_ERROR_CODE4
| DB2_GET_DIAGNOSTICS_DIAGNOSTICS
| DB2_INTERNAL_ERROR_POINTER
| DB2_LAST_ROW
| DB2_LINE_NUMBER
| DB2_MESSAGE_ID
| DB2_MODULE_DETECTING_ERROR
| DB2_NUMBER_PARAMETER_MARKERS
| DB2_NUMBER_RESULT_SETS
| DB2_NUMBER_ROWS
| DB2_ORDINAL_TOKEN_
| DB2_PRODUCT_ID
| DB2_REASON_CODE
| DB2_RETURNED_SQLCODE
| DB2_RETURN_STATUS
| DB2_ROW_NUMBER
| DB2_SERVER_CLASS_NAME
| DB2_SQL_ATTR_CURSOR_HOLD
| DB2_SQL_ATTR_CURSOR_ROWSET
| DB2_SQL_ATTR_CURSOR_SCROLLABLE
| DB2_SQL_ATTR_CURSOR_SENSITIVITY
| DB2_SQL_ATTR_CURSOR_TYPE
| DB2_SQLERRD1
| DB2_SQLERRD2
| DB2_SQLERRD3
| DB2_SQLERRD4
| DB2_SQLERRD5
| DB2_SQLERRD6
| DB2_SQLERRD_SET
| DB2_SQL_NESTING_LEVEL
| DB2_TOKEN_COUNT
| DIAGNOSTICS
| MORE_
| NUMBER
| RETURNED_SQLSTATE
| ROW_COUNT
| SERVER_NAME
| STACKED
| CREATETAB
| CREATETS
| DBADM
| DBCTRL
| DBMAINT
| DISPLAYDB
| IMAGCOPY
| LOAD
| PACKADM
| RECOVERDB
| REORG
| REPAIR
| STARTDB
| STATS
| STOPDB
| BIND
| ALTERIN
| CREATEIN
| DROPIN
| USAGE
| ACCESSCTRL
| BINDADD
| BINDAGENT
| BSDS
| CREATEALIAS
| CREATEDBA
| CREATEDBC
| CREATE_SECURE_OBJECT
| CREATESG
| CREATETMTAB
| DATAACCESS
| DEBUGSESSION
| DISPLAY
| MONITOR1
| MONITOR2
| RECOVER
| SQLADM
| STOPALL
| STOSPACE
| SYSADM
| SYSCTRL
| SYSOPR
| TRACE
| UNLOAD
| WRITE
| BUFFERPOOLS
| DEPENDENT
| RETAIN
| CURSORS
| PASSWORD
| HINT
| TIMEZONE
| TRANSFER
| OWNERSHIP
| REUSE
| STORAGE
| TRIGGERS
| FOUND
| SQLERROR
| SQLWARNING
| WITHIN
| EMPTY
| XMLBINARY
| BASE64
| XMLDECLARATION
| REFERENCE
| RETURNING
)
;
|
source/encodings-line_endings-strip_cr.ads | Vovanium/Encodings | 0 | 10386 | <filename>source/encodings-line_endings-strip_cr.ads
with Ada.Characters.Latin_1;
use Ada.Characters.Latin_1;
with Encodings.Line_Endings.Generic_Strip_CR;
package Encodings.Line_Endings.Strip_CR is new Generic_Strip_CR(
Character_Type => Character,
String_Type => String,
Carriage_Return => CR,
Line_Feed => LF,
Coder_Base => Coder_Base
);
|
Univalence/FinEquivPlusTimes.agda | JacquesCarette/pi-dual | 14 | 12144 | {-# OPTIONS --without-K #-}
module FinEquivPlusTimes where
open import Data.Empty using (⊥; ⊥-elim)
open import Data.Unit using (⊤; tt)
open import Data.Sum using (_⊎_; inj₁; inj₂)
open import Data.Product using (_,_; _×_; proj₁; proj₂)
open import Data.Nat
using (ℕ; zero; suc; _+_; _*_; _<_; _≤_; ≤-pred; _≥_; _≤?_;
module ≤-Reasoning)
open import Data.Nat.DivMod using (_divMod_; result)
open import Data.Nat.Properties using (≰⇒>; 1+n≰n; m≤m+n; ¬i+1+j≤i)
open import Data.Nat.Properties.Simple
using (+-assoc; +-suc; +-comm; *-right-zero)
open import Data.Fin
using (Fin; zero; suc; inject+; raise; toℕ; fromℕ≤; reduce≥)
open import Data.Fin.Properties
using (bounded; inject+-lemma; toℕ-raise; toℕ-injective; toℕ-fromℕ≤)
open import Function using (_∘_; id; case_of_)
open import Relation.Nullary using (yes; no)
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; sym; trans; cong; cong₂; subst;
module ≡-Reasoning; inspect; [_])
--
open import Equiv using (_∼_; _≃_; qinv; id≃; sym≃; _●_; _⊎≃_)
open import Proofs using (
-- LeqLemmas
_<?_; cong+r≤; cong+l≤; cong*r≤;
-- FinNatLemmas
inj₁-≡; inj₂-≡; inject+-injective; raise-injective; addMul-lemma
)
------------------------------------------------------------------------------
-- Additive unit and multiplicative unit are Fin 0 and Fin 1 which are
-- equivalent to ⊥ and ⊤
abstract
Fin0-⊥ : Fin 0 → ⊥
Fin0-⊥ ()
F0≃⊥ : Fin 0 ≃ ⊥
F0≃⊥ = f , qinv g α β
where
f : Fin 0 → ⊥
f ()
g : ⊥ → Fin 0
g ()
α : f ∘ g ∼ id
α ()
β : g ∘ f ∼ id
β ()
Fin1≃⊤ : Fin 1 ≃ ⊤
Fin1≃⊤ = f , qinv g α β
where
f : Fin 1 → ⊤
f zero = tt
f (suc ())
g : ⊤ → Fin 1
g tt = zero
α : f ∘ g ∼ id
α tt = refl
β : g ∘ f ∼ id
β zero = refl
β (suc ())
------------------------------------------------------------------------------
-- Additive monoid
module Plus where
-- Main goal is to show (Fin m ⊎ Fin n) ≃ Fin (m + n) It is then
-- fairly easy to show that ⊎ satisfies the commutative monoid
-- axioms
private
fwd : {m n : ℕ} → (Fin m ⊎ Fin n) → Fin (m + n)
fwd {m} {n} (inj₁ x) = inject+ n x
fwd {m} {n} (inj₂ y) = raise m y
bwd : {m n : ℕ} → Fin (m + n) → (Fin m ⊎ Fin n)
bwd {m} {n} = λ i → case (toℕ i <? m) of λ
{ (yes p) → inj₁ (fromℕ≤ p)
; (no ¬p) → inj₂ (reduce≥ i (≤-pred (≰⇒> ¬p)))
}
fwd∘bwd~id : {m n : ℕ} → fwd {m} {n} ∘ bwd ∼ id
fwd∘bwd~id {m} i with toℕ i <? m
fwd∘bwd~id i | yes p = sym (inj₁-≡ i p)
fwd∘bwd~id i | no ¬p = sym (inj₂-≡ i (≤-pred (≰⇒> ¬p)))
bwd∘fwd~id : {m n : ℕ} → bwd {m} {n} ∘ fwd ∼ id
bwd∘fwd~id {m} {n} (inj₁ x) with toℕ (inject+ n x) <? m
bwd∘fwd~id {n = n} (inj₁ x) | yes p =
cong inj₁
(inject+-injective (fromℕ≤ p) x (sym (inj₁-≡ (inject+ n x) p)))
bwd∘fwd~id {m} {n} (inj₁ x) | no ¬p = ⊥-elim (1+n≰n pf)
where
open ≤-Reasoning
pf : suc (toℕ x) ≤ toℕ x
pf = let q = (≤-pred (≰⇒> ¬p)) in
begin (
suc (toℕ x)
≤⟨ bounded x ⟩
m
≤⟨ q ⟩
toℕ (inject+ n x)
≡⟨ sym (inject+-lemma n x) ⟩
toℕ x ∎ )
bwd∘fwd~id {m} {n} (inj₂ y) with toℕ (raise m y) <? m
bwd∘fwd~id {m} {n} (inj₂ y) | yes p = ⊥-elim (1+n≰n pf)
where
open ≤-Reasoning
pf : suc m ≤ m
pf = begin (
suc m
≤⟨ m≤m+n (suc m) (toℕ y) ⟩
suc (m + toℕ y)
≡⟨ cong suc (sym (toℕ-raise m y)) ⟩
suc (toℕ (raise m y))
≤⟨ p ⟩
m ∎)
bwd∘fwd~id {m} {n} (inj₂ y) | no ¬p =
cong inj₂
(raise-injective {m}
(reduce≥ (raise m y) (≤-pred (≰⇒> ¬p)))
y
(sym (inj₂-≡ (raise m y) (≤-pred (≰⇒> ¬p)))))
-- the main equivalence
abstract
fwd-iso : {m n : ℕ} → (Fin m ⊎ Fin n) ≃ Fin (m + n)
fwd-iso {m} {n} = fwd , qinv bwd (fwd∘bwd~id {m}) (bwd∘fwd~id {m})
-- aliases for the above which are more convenient
⊎≃+ : {m n : ℕ} → (Fin m ⊎ Fin n) ≃ Fin (m + n)
⊎≃+ = fwd-iso
+≃⊎ : {m n : ℕ} → Fin (m + n) ≃ (Fin m ⊎ Fin n)
+≃⊎ = sym≃ fwd-iso
-----------------------------------------------------------------------------
-- Multiplicative monoid
module Times where
-- main goal is to show (Fin m × Fin n) ≃ Fin (m * n) It is then
-- fairly easy to show that × satisfies the commutative monoid
-- axioms
private
fwd : {m n : ℕ} → (Fin m × Fin n) → Fin (m * n)
fwd {suc m} {n} (zero , k) = inject+ (m * n) k
fwd {n = n} (suc i , k) = raise n (fwd (i , k))
soundness : ∀ {m n} (i : Fin m) (j : Fin n) →
toℕ (fwd (i , j)) ≡ toℕ i * n + toℕ j
soundness {suc m} {n} zero j = sym (inject+-lemma (m * n) j)
soundness {n = n} (suc i) j
rewrite toℕ-raise n (fwd (i , j)) | soundness i j
= sym (+-assoc n (toℕ i * n) (toℕ j))
absurd-quotient : (m n q : ℕ) (r : Fin (suc n)) (k : Fin (m * suc n))
(k≡r+q*sn : toℕ k ≡ toℕ r + q * suc n) (p : m ≤ q) → ⊥
absurd-quotient m n q r k k≡r+q*sn p = ¬i+1+j≤i (toℕ k) {toℕ r} k≥k+sr
where k≥k+sr : toℕ k ≥ toℕ k + suc (toℕ r)
k≥k+sr = begin (toℕ k + suc (toℕ r)
≡⟨ +-suc (toℕ k) (toℕ r) ⟩
suc (toℕ k) + toℕ r
≤⟨ cong+r≤ (bounded k) (toℕ r) ⟩
(m * suc n) + toℕ r
≡⟨ +-comm (m * suc n) (toℕ r) ⟩
toℕ r + (m * suc n)
≡⟨ refl ⟩
toℕ r + m * suc n
≤⟨ cong+l≤ (cong*r≤ p (suc n)) (toℕ r) ⟩
toℕ r + q * suc n
≡⟨ sym k≡r+q*sn ⟩
toℕ k ∎)
where open ≤-Reasoning
elim-right-zero : ∀ {ℓ} {Whatever : Set ℓ}
(m : ℕ) → Fin (m * 0) → Whatever
elim-right-zero m i = ⊥-elim (Fin0-⊥ (subst Fin (*-right-zero m) i))
bwd : {m n : ℕ} → Fin (m * n) → (Fin m × Fin n)
bwd {m} {0} k = elim-right-zero m k
bwd {m} {suc n} k with toℕ k | inspect toℕ k | (toℕ k) divMod (suc n)
bwd {m} {suc n} k | .(toℕ r + q * suc n) | [ pf ] | result q r refl =
(fromℕ≤ {q} {m} q<m , r)
where q<m : q < m
q<m with suc q ≤? m
... | no ¬p = ⊥-elim (absurd-quotient m n q r k pf (≤-pred (≰⇒> ¬p)))
... | yes p = p
fwd∘bwd~id : {m n : ℕ} → fwd {m} {n} ∘ bwd ∼ id
fwd∘bwd~id {m} {zero} i = elim-right-zero m i
fwd∘bwd~id {m} {suc n} i with toℕ i | inspect toℕ i | (toℕ i) divMod (suc n)
fwd∘bwd~id {m} {suc n} i | .(toℕ r + q * suc n) | [ eq ] | result q r refl
with suc q ≤? m
... | no ¬p = ⊥-elim (absurd-quotient m n q r i eq (≤-pred (≰⇒> ¬p)))
... | yes p = toℕ-injective (
begin (
toℕ (fwd (fromℕ≤ {q} {m} p , r))
≡⟨ soundness (fromℕ≤ p) r ⟩
toℕ (fromℕ≤ p) * (suc n) + toℕ r
≡⟨ cong (λ x → x * (suc n) + toℕ r) (toℕ-fromℕ≤ p) ⟩
q * (suc n) + toℕ r
≡⟨ +-comm _ (toℕ r) ⟩
toℕ r + q * (suc n)
≡⟨ sym eq ⟩
toℕ i ∎))
where open ≡-Reasoning
bwd∘fwd~id : {m n : ℕ} → (x : Fin m × Fin n) →
bwd {m} {n} (fwd x) ≡ id x
bwd∘fwd~id {m} {zero} (b , ())
bwd∘fwd~id {m} {suc n} (b , d) with toℕ (fwd (b , d)) | inspect toℕ (fwd (b , d)) | (toℕ (fwd (b , d)) divMod (suc n))
bwd∘fwd~id {m} {suc n} (b , d) | .(toℕ r + q * suc n) | [ eqk ] | result q r refl with q <? m
... | no ¬p = ⊥-elim (absurd-quotient m n q r (fwd (b , d)) eqk (≤-pred (≰⇒> ¬p)))
... | yes p =
begin (
(fromℕ≤ {q} {m} p , r)
≡⟨ cong₂ _,_ pf₁ (proj₁ same-quot) ⟩
(b , d) ∎)
where
open ≡-Reasoning
eq' : toℕ d + toℕ b * suc n ≡ toℕ r + q * suc n
eq' = begin (
toℕ d + toℕ b * suc n
≡⟨ +-comm (toℕ d) _ ⟩
toℕ b * suc n + toℕ d
≡⟨ sym (soundness b d) ⟩
toℕ (fwd (b , d))
≡⟨ eqk ⟩
toℕ r + q * suc n ∎ )
same-quot : (r ≡ d) × (q ≡ toℕ b)
same-quot = addMul-lemma q (toℕ b) n r d ( sym eq' )
pf₁ = toℕ-injective (trans (toℕ-fromℕ≤ p) (proj₂ same-quot))
abstract
fwd-iso : {m n : ℕ} → (Fin m × Fin n) ≃ Fin (m * n)
fwd-iso {m} {n} = fwd , qinv bwd (fwd∘bwd~id {m}) (bwd∘fwd~id {m})
-- convenient aliases
×≃* : {m n : ℕ} → (Fin m × Fin n) ≃ Fin (m * n)
×≃* = fwd-iso
*≃× : {m n : ℕ} → Fin (m * n) ≃ (Fin m × Fin n)
*≃× = sym≃ ×≃*
------------------------------------------------------------------------------
|
semacts/ShExDoc.g4 | ericprud/grammar-javascript-antlr | 0 | 4981 | <reponame>ericprud/grammar-javascript-antlr
// ANTLR4 Equivalent of accompanying bnf, developed in
// http://www.w3.org/2005/01/yacker/uploads/ShEx3
// Updated to Jul 27 AM ShEx3
// Updated to Aug 23 AM ShEx3 (last change was EGP 20150820)
// Sept 21 AM disallow single internal unary (e.g. {(:p .{2}){3}}
// Change (non-standard) "codeLabel" to "productionName"
// Oct 26 - change annotation predicate to include rdftype (how did this slip in to the production rules?
// Dec 30 - update to match http://www.w3.org/2005/01/yacker/uploads/ShEx2/bnf with last change "EGP 20151120"
// May 23, 2016 - Update to match http://www.w3.org/2005/01/yacker/uploads/ShEx2/bnf with last change "EGP20160520" AND ';' separator and '//' for annotations
// May 24, 2016 - EGP20150424
// Aug 11, 2016 - EGP20160708
// Sep 14, 2016 - Revised to match Eric's latest reshuffle
// Sep 24, 2016 - Switched to TT grammar (vs inner and outer shapes)
// Sep 26, 2016 - Refactored to match https://raw.githubusercontent.com/shexSpec/shex.js/7eb770fe2b5bab9edfe9558dc07bb6f6dcdf5d23/doc/bnf
// Oct 27, 2016 - Added comments to '*', '*' and '?' to facilitate parsing
// Oct 27, 2016 - Added qualifier rule to be reused by shapeDefinition and inlineShapeDefinition
// Oct 27, 2016 - Added negation rule
// Mar 03, 2017 - removed ^^-style facet arguments per shex#41
// Mar 03, 2017 - switch to ~/regexp/
// Apr 09, 2017 - removed WS fragment (unused)
// Apr 09, 2017 - revise REGEXP definition
// Apr 09, 2017 - factor out REGEXP_FLAGS so we don't have to parse them out
// Apr 09, 2017 - literalRange / languageRange additions
// Apr 09, 2017 - factor out shapeRef to match spec
// Apr 09, 2017 - update repeatRange to allow differentiation of {INTEGER} and {INTEGER,}
// Apr 09, 2017 - add STEM_MARK and UNBOUNDED tokens to eliminate lex token parsingf
// Apr 17, 2018 - add 2.1 rules -- extensions, restrictions and ABSTRACT
grammar ShExDoc;
shExDoc
@init {
this.UNBOUNDED = -1;
this.unescapeText = function (string, replacements) {
var regex = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g;
try {
string = string.replace(regex, function (sequence, unicode4, unicode8, escapedChar) {
var charCode;
if (unicode4) {
charCode = parseInt(unicode4, 16);
if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance
return String.fromCharCode(charCode);
}
else if (unicode8) {
charCode = parseInt(unicode8, 16);
if (isNaN(charCode)) throw new Error(); // can never happen (regex), but helps performance
if (charCode < 0xFFFF) return String.fromCharCode(charCode);
return String.fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF));
}
else {
var replacement = replacements[escapedChar];
if (!replacement) throw new Error("no replacement found for '" + escapedChar + "'");
return replacement;
}
});
return string;
}
catch (error) { console.warn(error); return ''; }
};
// Common namespaces and entities
this.RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
this.RDF_TYPE = this.RDF + 'type',
this.RDF_FIRST = this.RDF + 'first',
this.RDF_REST = this.RDF + 'rest',
this.RDF_NIL = this.RDF + 'nil',
this.XSD = 'http://www.w3.org/2001/XMLSchema#',
this.XSD_INTEGER = this.XSD + 'integer',
this.XSD_DECIMAL = this.XSD + 'decimal',
this.XSD_FLOAT = this.XSD + 'float',
this.XSD_DOUBLE = this.XSD + 'double',
this.XSD_BOOLEAN = this.XSD + 'boolean',
this.XSD_TRUE = '"true"^^' + this.XSD_BOOLEAN,
this.XSD_FALSE = '"false"^^' + this.XSD_BOOLEAN,
this.XSD_PATTERN = this.XSD + 'pattern',
this.XSD_MININCLUSIVE = this.XSD + 'minInclusive',
this.XSD_MINEXCLUSIVE = this.XSD + 'minExclusive',
this.XSD_MAXINCLUSIVE = this.XSD + 'maxInclusive',
this.XSD_MAXEXCLUSIVE = this.XSD + 'maxExclusive',
this.XSD_LENGTH = this.XSD + 'length',
this.XSD_MINLENGTH = this.XSD + 'minLength',
this.XSD_MAXLENGTH = this.XSD + 'maxLength',
this.XSD_TOTALDIGITS = this.XSD + 'totalDigits',
this.XSD_FRACTIONDIGITS = this.XSD + 'fractionDigits';
this.numericDatatypes = [
this.XSD + "integer",
this.XSD + "decimal",
this.XSD + "float",
this.XSD + "double",
this.XSD + "string",
this.XSD + "boolean",
this.XSD + "dateTime",
this.XSD + "nonPositiveInteger",
this.XSD + "negativeInteger",
this.XSD + "long",
this.XSD + "int",
this.XSD + "short",
this.XSD + "byte",
this.XSD + "nonNegativeInteger",
this.XSD + "unsignedLong",
this.XSD + "unsignedInt",
this.XSD + "unsignedShort",
this.XSD + "unsignedByte",
this.XSD + "positiveInteger"
];
this.absoluteIRI = /^[a-z][a-z0-9+.-]*:/i,
schemeAuthority = /^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i,
dotSegments = /(?:^|\/)\.\.?(?:$|[\/#?])/;
this.numericFacets = ["mininclusive", "minexclusive",
"maxinclusive", "maxexclusive"];
// Returns a lowercase version of the given string
this.lowercase = function (string) {
return string.toLowerCase();
}
// Appends the item to the array and returns the array
function appendTo(array, item) {
return array.push(item), array;
}
// Appends the items to the array and returns the array
function appendAllTo(array, items) {
return array.push.apply(array, items), array;
}
// Extends a base object with properties of other objects
this.extend = function (base) {
if (!base) base = {};
for (var i = 1, l = arguments.length, arg; i < l && (arg = arguments[i] || {}); i++)
for (var name in arg)
base[name] = arg[name];
return base;
}
// Creates an array that contains all items of the given arrays
this.unionAll = function() {
var union = [];
for (var i = 0, l = arguments.length; i < l; i++)
union = union.concat.apply(union, arguments[i]);
return union;
}
// N3.js:lib/N3Parser.js<0.4.5>:58 with
// s/this\./this./g
// ### `_setBase` sets the base IRI to resolve relative IRIs.
this._setBase = function (baseIRI) {
if (!baseIRI)
baseIRI = null;
// baseIRI '#' check disabled to allow -x 'data:text/shex,...#'
// else if (baseIRI.indexOf('#') >= 0)
// throw new Error('Invalid base IRI ' + baseIRI);
// Set base IRI and its components
if (this._base = baseIRI) {
this._basePath = baseIRI.replace(/[^\/?]*(?:\?.*)?$/, '');
baseIRI = baseIRI.match(schemeAuthority);
this._baseRoot = baseIRI[0];
this._baseScheme = baseIRI[1];
}
}
// N3.js:lib/N3this.js<0.4.5>:576 with
// s/this\./this./g
// s/token/iri/
// ### `_resolveIRI` resolves a relative IRI token against the base path,
// assuming that a base path has been set and that the IRI is indeed relative.
this._resolveIRI = function (iri) {
switch (iri[0]) {
// An empty relative IRI indicates the base IRI
case undefined: return this._base;
// Resolve relative fragment IRIs against the base IRI
case '#': return this._base + iri;
// Resolve relative query string IRIs by replacing the query string
case '?': return this._base.replace(/(?:\?.*)?$/, iri);
// Resolve root-relative IRIs at the root of the base IRI
case '/':
// Resolve scheme-relative IRIs to the scheme
return (iri[1] === '/' ? this._baseScheme : this._baseRoot) + _removeDotSegments(iri);
// Resolve all other IRIs at the base IRI's path
default: {
return _removeDotSegments(this._basePath + iri);
}
}
}
// ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986.
function _removeDotSegments (iri) {
// Don't modify the IRI if it does not contain any dot segments
if (!dotSegments.test(iri))
return iri;
// Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'
var result = '', length = iri.length, i = -1, pathStart = -1, segmentStart = 0, next = '/';
while (i < length) {
switch (next) {
// The path starts with the first slash after the authority
case ':':
if (pathStart < 0) {
// Skip two slashes before the authority
if (iri[++i] === '/' && iri[++i] === '/')
// Skip to slash after the authority
while ((pathStart = i + 1) < length && iri[pathStart] !== '/')
i = pathStart;
}
break;
// Don't modify a query string or fragment
case '?':
case '#':
i = length;
break;
// Handle '/.' or '/..' path segments
case '/':
if (iri[i + 1] === '.') {
next = iri[++i + 1];
switch (next) {
// Remove a '/.' segment
case '/':
result += iri.substring(segmentStart, i - 1);
segmentStart = i + 1;
break;
// Remove a trailing '/.' segment
case undefined:
case '?':
case '#':
return result + iri.substring(segmentStart, i) + iri.substr(i + 1);
// Remove a '/..' segment
case '.':
next = iri[++i + 1];
if (next === undefined || next === '/' || next === '?' || next === '#') {
result += iri.substring(segmentStart, i - 2);
// Try to remove the parent path from result
if ((segmentStart = result.lastIndexOf('/')) >= pathStart)
result = result.substr(0, segmentStart);
// Remove a trailing '/..' segment
if (next !== '/')
return result + '/' + iri.substr(i + 1);
segmentStart = i + 1;
}
}
}
}
next = iri[++i];
}
return result + iri.substring(segmentStart);
}
// Creates an expression with the given type and attributes
function expression(expr, attr) {
var expression = { expression: expr };
if (attr)
for (var a in attr)
expression[a] = attr[a];
return expression;
}
// Creates a path with the given type and items
function path(type, items) {
return { type: 'path', pathType: type, items: items };
}
// Creates a literal with the given value and type
this.createLiteral = function (value, type) {
return { value: value, type: type };
}
// Creates a new blank node identifier
function blank() {
return '_:b' + blankId++;
};
var blankId = 0;
this._resetBlanks = function () { blankId = 0; }
this._reset = function () {
this._prefixes = this._imports = this.valueExprDefns = this._shapes = this.productions = this._start = this.startActs = null; // Reset state.
this._base = this._baseIRI = this._baseIRIPath = this._baseIRIRoot = null;
}
var _fileName; // for debugging
this._setFileName = function (fn) { _fileName = fn; }
// Regular expression and replacement strings to escape strings
this.stringEscapeReplacements = { '\\': '\\', "'": "'", '"': '"',
't': '\t', 'b': '\b', 'n': '\n', 'r': '\r', 'f': '\f' };
this.semactEscapeReplacements = { '\\': '\\', '%': '%' };
this.pnameEscapeReplacements = {
'\\': '\\', "'": "'", '"': '"',
'n': '\n', 'r': '\r', 't': '\t', 'f': '\f', 'b': '\b',
'_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',
'(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',
'/': '/', '?': '?', '#': '#', '@': '@', '%': '%',
};
// Translates string escape codes in the string into their textual equivalent
this.unescapeString = function (string, trimLength) {
string = string.substring(trimLength, string.length - trimLength);
return { value: this.unescapeText(string, this.stringEscapeReplacements) };
}
this.unescapeLangString = function (string, trimLength) {
var at = string.lastIndexOf("@");
var lang = string.substr(at);
string = string.substr(0, at);
var u = unescapeString(string, trimLength);
return this.extend(u, { language: this.lowercase(lang.substr(1)) });
}
// Translates regular expression escape codes in the string into their textual equivalent
this.unescapeRegexp = function (regexp) {
var end = regexp.lastIndexOf("/");
var s = regexp.substr(1, end-1);
var regexpEscapeReplacements = {
'.': "\\.", '\\': "\\\\", '?': "\\?", '*': "\\*", '+': "\\+",
'{': "\\{", '}': "\\}", '(': "\\(", ')': "\\)", '|': "\\|",
'^': "\\^", '$': "\\$", '[': "\\[", ']': "\\]", '/': "\\/",
't': '\\t', 'n': '\\n', 'r': '\\r', '-': "\\-", '/': '/'
};
s = this.unescapeText(s, regexpEscapeReplacements)
var ret = {
pattern: s
};
if (regexp.length > end+1)
ret.flags = regexp.substr(end+1);
return ret;
}
// Convenience function to return object with p1 key, value p2
this.keyValObject = function (key, val) {
var ret = {};
ret[key] = val;
return ret;
}
// Return object with p1 key, p2 string value
this.unescapeSemanticAction = function (key, string) {
string = string.substring(1, string.length - 2);
return {
type: "SemAct",
name: key,
code: this.unescapeText(string, this.semactEscapeReplacements)
};
}
this.error = function (msg) {
this._reset();
throw new Error(msg);
}
// Expand declared prefix or throw Error
this.expandPrefix = function (prefix) {
if (!(prefix in this._prefixes))
this.error('Parse error; unknown prefix: ' + prefix);
return this._prefixes[prefix];
}
// Add a shape to the map
this.addShape = function (label, shape) {
if (this.productions && label in this.productions)
this.error("Structural error: "+label+" is a shape");
if (!this._shapes)
this._shapes = [];
// if (label in this.shapes) {
// if (this.options.duplicateShape === "replace")
// this.shapes[label] = shape;
// else if (this.options.duplicateShape !== "ignore")
// this.error("Parse error: "+label+" already defined");
// } else
shape.id = label
this._shapes.push(shape);
}
// Add a production to the map
this.addProduction = function (label, production) {
if (this.shapes && label in this.shapes)
this.error("Structural error: "+label+" is a shape");
if (!this.productions)
this.productions = {};
if (label in this.productions) {
if (this.options.duplicateShape === "replace")
this.productions[label] = production;
else if (this.options.duplicateShape !== "ignore")
this.error("Parse error: "+label+" already defined");
} else
this.productions[label] = production;
}
this.shapeJunction = function (type, container, elts) {
if (elts.length === 0) {
return container;
} else if (container.type === type) {
container.shapeExprs = container.shapeExprs.concat(elts);
return container;
} else {
return { type: type, shapeExprs: [container].concat(elts) };
}
}
this.EmptyObject = { };
this.EmptyShape = { type: "Shape" };
this.NC = function (l, r) {
let facets = r.reduce((acc, p) => Object.assign(acc, p.$$), {})
return this.extend({ type: "NodeConstraint"}, l, facets)
}
this.$1 = function (ctx) {
ctx.$$ = ctx.children[1-1].$$;
}
this.$2 = function (ctx) {
ctx.$$ = ctx.children[2-1].$$;
}
this._prefixes = Object.create(null);
this._imports = [];
this._setBase('');
this.url = require('url');
}
: directive* ((notStartAction | startActions) statement*)? EOF {
var valueExprDefns = this.valueExprDefns ? { valueExprDefns: this.valueExprDefns } : {};
var startObj = this._start ? { start: this._start } : {};
var startActs = this.startActs ? { startActs: this.startActs } : {};
var ret = this.extend({ type: "Schema"},
Object.keys(this._prefixes).length ? { prefixes: this._prefixes } : {}, // Properties ordered here to
Object.keys(this._imports).length ? { imports: this._imports } : {}, // build return object from
valueExprDefns, startActs, startObj, // components in parser state
this._shapes ? {shapes: this._shapes} : {}, // maintaining intuitve order.
this.productions ? {productions: this.productions} : {});
if (this._base !== null)
ret.base = this._base;
this._reset();
localctx.$$ = ret;
}; // leading CODE
directive : baseDecl
| prefixDecl
| importDecl
;
baseDecl : KW_BASE IRIREF {
this._setBase(this._base === null ||
this.absoluteIRI.test(localctx.children[2-1].getText().slice(1, -1)) ? localctx.children[2-1].getText().slice(1, -1) : this._resolveIRI(localctx.children[2-1].getText().slice(1, -1)))
};
prefixDecl : KW_PREFIX PNAME_NS IRIREF { // t: ShExParser-test.js/with pre-defined prefixes
this._prefixes[localctx.children[2 - 1].getText().slice(0, -1)] = this._base === null ||
this.absoluteIRI.test(localctx.children[3-1].getText().slice(1, -1)) ? localctx.children[3-1].getText().slice(1, -1) : this._resolveIRI(localctx.children[3-1].getText().slice(1, -1));
} ;
importDecl : KW_IMPORT IRIREF {
this._imports.push(this._base === null ||
this.absoluteIRI.test(localctx.children[2-1].getText().slice(1, -1)) ? localctx.children[2-1].getText().slice(1, -1) : this._resolveIRI(localctx.children[2-1].getText().slice(1, -1)));
} ;
notStartAction : start | shapeExprDecl ;
start : KW_START '=' shapeExpression { this._start = localctx.children[3-1].$$ } ;
startActions : semanticAction+ { this.startActs = localctx.children.map(c => c.$$); } ;
statement : directive | notStartAction ;
shapeExprDecl : /* KW_ABSTRACT? */ shapeExprLabel /* restrictions* */ (shapeExpression | KW_EXTERNAL) { // t: 1dot 1val1vsMinusiri3??
this.addShape(localctx.children[0].$$, localctx.KW_EXTERNAL() ? { type: "ShapeExternal" } : localctx.shapeExpression().$$);
} ;
shapeExpression : shapeOr { this.$1(localctx); } ;
inlineShapeExpression : inlineShapeOr { this.$1(localctx); } ;
shapeOr : shapeAnd (KW_OR shapeAnd)* { localctx.$$ = localctx.shapeAnd().length == 1 ? localctx.shapeAnd()[0].$$ : { type: "ShapeOr", shapeExprs: localctx.shapeAnd().map(c => c.$$) }; };
inlineShapeOr : inlineShapeAnd (KW_OR inlineShapeAnd)* { localctx.$$ = localctx.inlineShapeAnd().length == 1 ? localctx.inlineShapeAnd()[0].$$ : { type: "ShapeOr", shapeExprs: localctx.inlineShapeAnd().map(c => c.$$) }; };
shapeAnd : shapeNot (KW_AND shapeNot)* { localctx.$$ = localctx.shapeNot().length == 1 ? localctx.shapeNot()[0].$$ : { type: "ShapeAnd", shapeExprs: localctx.shapeNot().map(c => c.$$) }; } ;
// inlineShapeAnd : inlineShapeNot (KW_AND inlineShapeNot)* { localctx.$$ = localctx.inlineShapeNot().length == 1 ? localctx.inlineShapeNot()[0].$$ : { type: "ShapeAnd", shapeExprs: localctx.inlineShapeNot().map(c => c.$$) }; } ;
inlineShapeAnd : inlineShapeNot (KW_AND inlineShapeNot)* { localctx.$$ = this.shapeJunction("ShapeAnd", localctx.inlineShapeNot()[0].$$, localctx.inlineShapeNot().slice(1).map(c => c.$$)) } ;
shapeNot : KW_NOT? shapeAtom { localctx.$$ = localctx.KW_NOT() ? { type: "ShapeNot", "shapeExpr": localctx.shapeAtom().$$ } : localctx.shapeAtom().$$; } ;
shapeAtom : nonLitNodeConstraint shapeOrRef? {
localctx.$$ = localctx.children[2-1] ? { type: "ShapeAnd", shapeExprs: [ this.extend({ type: "NodeConstraint" }, localctx.children[1-1].$$), localctx.children[2-1].$$ ] } : localctx.children[1-1].$$
} # shapeAtomNonLitNodeConstraint
| litNodeConstraint { this.$1(localctx); } # shapeAtomLitNodeConstraint
| shapeOrRef nonLitNodeConstraint? {
localctx.$$ = localctx.children[2-1] ? this.shapeJunction("ShapeAnd", localctx.children[1-1].$$, localctx.children[2-1].$$) /* t: 1dotRef1 */ : localctx.children[1-1].$$ // t:@@
} # shapeAtomShapeOrRef
| '(' shapeExpression ')' { this.$2(localctx); } # shapeAtomShapeExpression
| '.' { localctx.$$ = this.EmptyShape; } # shapeAtomAny // no constraint
;
inlineShapeAtom : inlineNonLitNodeConstraint inlineShapeOrRef? {
localctx.$$ = localctx.children[2-1] ? { type: "ShapeAnd", shapeExprs: [ this.extend({ type: "NodeConstraint" }, localctx.children[1-1].$$), localctx.children[2-1].$$ ] } : localctx.children[1-1].$$
} # inlineShapeAtomNonLitNodeConstraint
| inlineLitNodeConstraint { this.$1(localctx); } # inlineShapeAtomLitNodeConstraint
| inlineShapeOrRef inlineNonLitNodeConstraint? {
localctx.$$ = localctx.children[2-1] ? this.shapeJunction("ShapeAnd", localctx.children[1-1].$$, localctx.children[2-1].$$) /* t: 1dotRef1 */ : localctx.children[1-1].$$ // t:@@
} # inlineShapeAtomShapeOrRef
| '(' shapeExpression ')' { this.$2(localctx); } # inlineShapeAtomShapeExpression
| '.' { localctx.$$ = this.EmptyShape; } # inlineShapeAtomAny // no constraint
;
shapeOrRef : shapeDefinition { this.$1(localctx); }
| shapeRef { this.$1(localctx); }
;
inlineShapeOrRef : inlineShapeDefinition { this.$1(localctx); }
| shapeRef { this.$1(localctx); }
;
shapeRef : ATPNAME_LN { // t: 1dotRefLNex@@
let ln = localctx.children[1-1].getText();
ln = ln.substr(1, ln.length-1);
var namePos = ln.indexOf(':');
localctx.$$ = this.expandPrefix(ln.substr(0, namePos)) + ln.substr(namePos + 1);
}
| ATPNAME_NS { // t: 1dotRefNS1@@
let ns = localctx.children[1-1].getText();
ns = ns.substr(1, ns.length-1);
localctx.$$ = this.expandPrefix(ns.substr(0, ns.length - 1));
}
| '@' shapeExprLabel { localctx.$$ = localctx.children[2-1].$$; } // t: 1dotRef1, 1dotRefSpaceLNex, 1dotRefSpaceNS1
;
inlineLitNodeConstraint : KW_LITERAL xsFacet* { localctx.$$ = this.NC({nodeKind: "literal"}, localctx.children.slice(1)); } # nodeConstraintLiteral
| nonLiteralKind stringFacet* { localctx.$$ = this.NC(localctx.children[0].$$, localctx.children.slice(1)); } # nodeConstraintNonLiteral
| datatype xsFacet* { localctx.$$ = this.NC({ datatype: localctx.children[0].$$ }, localctx.children.slice(1)); } # nodeConstraintDatatype // t: 1datatype
| valueSet xsFacet* { localctx.$$ = this.NC({ values: localctx.children[0].$$ }, localctx.children.slice(1)); } # nodeConstraintValueSet
| numericFacet+ { localctx.$$ = this.NC({}, localctx.children); } # nodeConstraintNumericFacet
;
litNodeConstraint : inlineLitNodeConstraint annotation* semanticAction* {
this.$1(localctx);
if (localctx.annotation().length) { localctx.$$.annotations = localctx.annotation().map(c => c.$$); }
if (localctx.semanticAction().length) { localctx.$$.semActs = localctx.semanticAction().map(c => c.$$); }
} ;
inlineNonLitNodeConstraint : nonLiteralKind stringFacet* {
localctx.$$ = localctx.children.slice(1).reduce((acc, p) => Object.assign(acc, p.$$), Object.assign({ type: "NodeConstraint" }, localctx.children[0].$$))
} # litNodeConstraintLiteral
| stringFacet+ {
localctx.$$ = localctx.children.reduce((acc, c) => Object.assign(acc, c.$$), {type: "NodeConstraint"});
} # litNodeConstraintStringFacet
;
nonLitNodeConstraint : inlineNonLitNodeConstraint annotation* semanticAction* { // t: !!
localctx.$$ = localctx.children[0].$$;
if (localctx.annotation().length) { localctx.$$.annotations = localctx.annotation().map(c => c.$$); } // t: !!
if (localctx.semanticAction().length) { localctx.$$.semActs = localctx.semanticAction().map(c => c.$$); } // t: !!
} ;
nonLiteralKind : KW_IRI { localctx.$$ = { nodeKind: "iri" }; }
| KW_BNODE { localctx.$$ = { nodeKind: "bnode" }; }
| KW_NONLITERAL { localctx.$$ = { nodeKind: "nonliteral" }; }
;
xsFacet : stringFacet { this.$1(localctx); }
| numericFacet { this.$1(localctx); }
;
stringFacet : stringLength INTEGER { localctx.$$ = this.keyValObject(localctx.children[0].$$, parseInt(localctx.children[1].getText(), 10)); } // t: 1literalLength
| REGEXP REGEXP_FLAGS? { localctx.$$ = this.unescapeRegexp(localctx.children[0].getText()); if (localctx.REGEXP_FLAGS()) {localctx.$$.flags = localctx.REGEXP_FLAGS().getText()} } // t: 1literalPattern
;
stringLength : KW_LENGTH { localctx.$$ = "length"; }
| KW_MINLENGTH { localctx.$$ = "minlength"; }
| KW_MAXLENGTH { localctx.$$ = "maxlength"; }
;
numericFacet : numericRange rawNumeric { localctx.$$ = this.keyValObject(localctx.children[0].$$, localctx.children[1].$$); }
| numericLength INTEGER { localctx.$$ = this.keyValObject(localctx.children[0].$$, parseInt(localctx.children[1].getText(), 10)); }
;
numericRange : KW_MININCLUSIVE { localctx.$$ = "mininclusive"; }
| KW_MINEXCLUSIVE { localctx.$$ = "minexclusive"; }
| KW_MAXINCLUSIVE { localctx.$$ = "maxinclusive"; }
| KW_MAXEXCLUSIVE { localctx.$$ = "maxexclusive"; }
;
numericLength : KW_TOTALDIGITS { localctx.$$ = "totaldigits"; }
| KW_FRACTIONDIGITS { localctx.$$ = "fractiondigits"; }
;
rawNumeric : INTEGER { localctx.$$ = parseInt(localctx.children[0].getText()); }
| DECIMAL { localctx.$$ = parseFloat(localctx.children[0].getText()); }
| DOUBLE { localctx.$$ = parseFloat(localctx.children[0].getText()); }
;
shapeDefinition : inlineShapeDefinition annotation* semanticAction* {
localctx.$$ = localctx.children[0].$$;
if (localctx.annotation().length) { localctx.$$.annotations = localctx.annotation().map(c => c.$$); }
if (localctx.semanticAction().length) { localctx.$$.semActs = localctx.semanticAction().map(c => c.$$); }
} ;
inlineShapeDefinition : qualifier* '{' tripleExpression? '}' {
var exprObj = localctx.tripleExpression() ? { expression: localctx.tripleExpression().$$ } : this.EmptyObject; // t: 0, 0Inherit1
localctx.$$ = (exprObj === this.EmptyObject && localctx.qualifier().length === 0) ?
this.EmptyShape :
this.extend({ type: "Shape" }, localctx.qualifier().reduce((acc, c) => {
let k = Object.keys(c.$$)[0]; // only one key/value in qualifier result
return this.extend(acc, k in acc && k !== "closed" ? this.keyValObject(k, acc[k].concat(c.$$[k])) : c.$$)
}, {}), exprObj);
};
qualifier : /* extension
| */ extraPropertySet { localctx.$$ = { extra: localctx.children[1-1].$$ } }
| KW_CLOSED { localctx.$$ = { closed: true } } ;
extraPropertySet : KW_EXTRA predicate+ { localctx.$$ = localctx.children.slice(1).map(c => c.$$); } ;
tripleExpression : oneOfTripleExpr { this.$1(localctx); } ;
oneOfTripleExpr : groupTripleExpr { this.$1(localctx); }
| multiElementOneOf { this.$1(localctx); }
;
multiElementOneOf : groupTripleExpr ( '|' groupTripleExpr )+ { localctx.$$ = { type: "OneOf", expressions: localctx.groupTripleExpr().map(c => c.$$) }; } ; // t: 2oneOfdot
groupTripleExpr : singleElementGroup { this.$1(localctx); }
| multiElementGroup { this.$1(localctx); }
;
singleElementGroup : unaryTripleExpr ';'? { this.$1(localctx); } ;
multiElementGroup : unaryTripleExpr (';' unaryTripleExpr)+ ';'? { localctx.$$ = { type: "EachOf", expressions: localctx.unaryTripleExpr().map(c => c.$$) }; } ; // t: 2groupOfdot
unaryTripleExpr : ('$' tripleExprLabel)? (tripleConstraint | bracketedTripleExpr) {
let expr = localctx.tripleConstraint() || localctx.bracketedTripleExpr();
if (localctx.tripleExprLabel()) {
localctx.$$ = this.extend({ id: localctx.tripleExprLabel().$$ }, expr.$$);
this.addProduction(localctx.tripleExprLabel().$$, localctx.$$);
} else {
localctx.$$ = expr.$$
}
}
| include { this.$1(localctx); }
;
bracketedTripleExpr : '(' tripleExpression ')' cardinality? /* onShapeExpr? */ annotation* semanticAction* {
localctx.$$ = localctx.tripleExpression().$$;
let card = localctx.cardinality() ? localctx.cardinality().$$ : { };
if ("min" in card) { localctx.$$.min = card.min; } // t: open3groupdotclosecard23Annot3Code2
if ("max" in card) { localctx.$$.max = card.max; } // t: open3groupdotclosecard23Annot3Code2
if (localctx.annotation().length) {
localctx.$$.annotations = (localctx.$$.annotations ? localctx.$$.annotations : []).concat(localctx.annotation().map(c => c.$$));
}
if (localctx.semanticAction().length) {
localctx.$$.semActs = (localctx.$$.semActs ? localctx.$$.semActs : []).concat(localctx.semanticAction().map(c => c.$$));
}
} ;
tripleConstraint : senseFlags? predicate inlineShapeExpression cardinality? /* onShapeExpr? */ annotation* semanticAction* {
// $6: t: 1dotCode1
// %6: t: 1inversedotCode1
localctx.$$ = this.extend({ type: "TripleConstraint" }, localctx.senseFlags() ? localctx.senseFlags().$$ : {}, { predicate: localctx.predicate().$$ }, (localctx.inlineShapeExpression().$$ === this.EmptyShape ? {} : { valueExpr: localctx.inlineShapeExpression().$$ }), localctx.cardinality() ? localctx.cardinality().$$ : {}); // t: 1dot // t: 1inversedot
if (localctx.annotation().length) { localctx.$$.annotations = localctx.annotation().map(c => c.$$); } // t: 1dotAnnot3 // t: 1inversedotAnnot3
if (localctx.semanticAction().length) { localctx.$$.semActs = localctx.semanticAction().map(c => c.$$); }
} ;
cardinality : '*' { localctx.$$ = { min:0, max:this.UNBOUNDED }; } # starCardinality
| '+' { localctx.$$ = { min:1, max:this.UNBOUNDED }; } # plusCardinality
| '?' { localctx.$$ = { min:0, max:1 }; } # optionalCardinality
| repeatRange { this.$1(localctx); } # repeatCardinality
;
// BNF: REPEAT_RANGE ::= '{' INTEGER (',' (INTEGER | '*')?)? '}'
repeatRange : '{' INTEGER '}' {
let i = parseInt(localctx.children[1].getText());
localctx.$$ = { min: i, max: i };
} # exactRange
| '{' INTEGER ',' (INTEGER | UNBOUNDED)? '}' {
let j = parseInt(localctx.children[1].getText());
if (localctx.UNBOUNDED()) {
localctx.$$ = { min: j, max: this.UNBOUNDED };
} else if (localctx.INTEGER().length > 1) {
localctx.$$ = { min: j, max: parseInt(localctx.children[3].getText()) };
} else {
localctx.$$ = { min: j, max: -1 };
}
} # minMaxRange
;
senseFlags : '^' { localctx.$$ = { inverse: true }; } ; // t: 1inversedot
valueSet : '[' valueSetValue* ']' { localctx.$$ = localctx.children.slice(1, localctx.children.length - 1).map(c => c.$$); } ;
valueSetValue : iriRange { this.$1(localctx); }
| literalRange { this.$1(localctx); }
| languageRange { this.$1(localctx); }
| '.' iriExclusion+ { localctx.$$ = { type: "IriStemRange", stem: { type: "Wildcard" }, exclusions: localctx.children.slice(1).map(c => c.$$) }; }
| '.' literalExclusion+ { localctx.$$ = { type: "LiteralStemRange", stem: { type: "Wildcard" }, exclusions: localctx.children.slice(1).map(c => c.$$) }; }
| '.' languageExclusion+ { localctx.$$ = { type: "LanguageStemRange", stem: { type: "Wildcard" }, exclusions: localctx.children.slice(1).map(c => c.$$) }; }
;
iriRange : iri (STEM_MARK iriExclusion*)? {
if (localctx.STEM_MARK()) {
localctx.$$ = { // t: 1val1iriStemMinusiriStem3, 1val1iriStem
type: localctx.iriExclusion().length ? "IriStemRange" : "IriStem",
stem: localctx.children[1-1].$$
};
if (localctx.iriExclusion().length)
localctx.$$.exclusions = localctx.iriExclusion().map(c => c.$$); // t: 1val1iriStemMinusiri3
} else {
localctx.$$ = localctx.children[1-1].$$; // t: 1val1IRI
}
} ;
iriExclusion : '-' iri STEM_MARK? { localctx.$$ = localctx.children[3-1] ? { type: "IriStem", stem: localctx.children[2-1].$$ } /* t: 1val1iriStemMinusiri3 */ : localctx.children[2-1].$$ ; } ; // t: 1val1iriStemMinusiriStem3
literalRange : literal (STEM_MARK literalExclusion*)? {
if (localctx.STEM_MARK()) {
localctx.$$ = { // t: 1val1literalStemMinusliteralStem3, 1val1literalStem
type: localctx.literalExclusion().length ? "LiteralStemRange" : "LiteralStem",
stem: localctx.children[1-1].$$.value
};
if (localctx.literalExclusion().length)
localctx.$$.exclusions = localctx.literalExclusion().map(c => c.$$); // t: 1val1literalStemMinusliteral3
} else {
localctx.$$ = localctx.children[1-1].$$; // t: 1val1LITERAL
}
};
literalExclusion : '-' literal STEM_MARK? { localctx.$$ = localctx.children[3-1] ? { type: "LiteralStem", stem: localctx.children[2-1].$$.value } /* t: 1val1literalStemMinusliteral3 */ : localctx.children[2-1].$$.value ; } ; // t: 1val1literalStemMinusliteralStem3
languageRange : LANGTAG (STEM_MARK languageExclusion*)? {
if (localctx.STEM_MARK()) {
localctx.$$ = { // t: 1val1languageStemMinuslanguageStem3, 1val1languageStem
type: localctx.languageExclusion().length ? "LanguageStemRange" : "LanguageStem",
stem: localctx.children[1-1].getText().substr(1)
};
if (localctx.languageExclusion().length)
localctx.$$.exclusions = localctx.languageExclusion().map(c => c.$$); // t: 1val1languageStemMinuslanguage3
} else {
localctx.$$ = { type: "Language", languageTag: localctx.children[1-1].getText().substr(1) }; // t: 1val1LANGUAGE
}
} ;
languageExclusion : '-' LANGTAG STEM_MARK? { localctx.$$ = localctx.children[3-1] ? { type: "LanguageStem", stem: localctx.children[2-1].getText().substr(1) } /* t: 1val1languageStemMinuslanguage3 */ : localctx.children[2-1].getText().substr(1) ; } ; // t: 1val1languageStemMinuslanguageStem3
include : '&' tripleExprLabel { localctx.$$ = localctx.children[1].$$ } ; // t: 2groupInclude1
annotation : '//' predicate (iri | literal) { localctx.$$ = { type: "Annotation", predicate: localctx.children[1].$$, object: localctx.children[2].$$ } } ; // t: 1dotAnnotIRIREF
semanticAction : '%' iri (CODE | '%') {
let i = localctx.children[1].$$;
localctx.$$ = localctx.CODE() ? this.unescapeSemanticAction(i, localctx.CODE().getText()) /* t: 1dotCode1 */ : { type: "SemAct", name: i } // t: 1dotNoCode1
} ;
literal : rdfLiteral { this.$1(localctx); }
| numericLiteral { this.$1(localctx); }
| booleanLiteral { this.$1(localctx); }
;
// BNF: predicate ::= iri | RDF_TYPE
predicate : iri { this.$1(localctx); } // t: 1dot
| rdfType { localctx.$$ = this.RDF_TYPE; } // t: 1AvalA
;
rdfType : RDF_TYPE { this.$1(localctx); } ;
datatype : iri { this.$1(localctx); } ;
shapeExprLabel : iri { this.$1(localctx); }
| blankNode { this.$1(localctx); }
;
tripleExprLabel : iri { this.$1(localctx); }
| blankNode { this.$1(localctx); }
;
numericLiteral : INTEGER { localctx.$$ = this.createLiteral(localctx.children[0].getText(), this.XSD_INTEGER); } // t: 1val1INTEGER
| DECIMAL { localctx.$$ = this.createLiteral(localctx.children[0].getText(), this.XSD_DECIMAL); } // t: 1val1DECIMAL
| DOUBLE { localctx.$$ = this.createLiteral(localctx.children[0].getText(), this.XSD_DOUBLE); } // t: 1val1DOUBLE
;
rdfLiteral : string (LANGTAG | '^^' datatype)? {
let s = localctx.children[1 - 1].$$
localctx.$$ = localctx.LANGTAG()
? this.extend(s, { language: this.lowercase(localctx.LANGTAG().getText().substr(1)) })
: localctx.datatype()
? this.extend(s, { type: localctx.datatype().$$ })
: s
};
booleanLiteral : KW_TRUE { localctx.$$ = { value: "true", type: this.XSD_BOOLEAN }; } // t: 1val1true
| KW_FALSE { localctx.$$ = { value: "false", type: this.XSD_BOOLEAN }; } // t: 1val1false
;
string : STRING_LITERAL_LONG1 { localctx.$$ = this.unescapeString(localctx.children[1 - 1].getText(), 3); } // t: 1val1LANGTAG
| STRING_LITERAL_LONG2 { localctx.$$ = this.unescapeString(localctx.children[1 - 1].getText(), 3); } // t: 1val1STRING_LITERAL_LONG1
| STRING_LITERAL1 { localctx.$$ = this.unescapeString(localctx.children[1 - 1].getText(), 1); } // t: 1val1STRING_LITERAL2
| STRING_LITERAL2 { localctx.$$ = this.unescapeString(localctx.children[1 - 1].getText(), 1); } // t: 1val1STRING_LITERAL_LONG2
;
inlineShapeNot : KW_NOT? inlineShapeAtom { localctx.$$ = localctx.KW_NOT() ? { type: "ShapeNot", "shapeExpr": localctx.inlineShapeAtom().$$ } : localctx.inlineShapeAtom().$$; } ;
onShapeExpr : KW_ON (KW_SHAPE KW_EXPRESSION)? inlineShapeExpression ;
iri : IRIREF { // t: 1dot
var unesc = this.unescapeText(localctx.children[0].getText().slice(1,-1), {});
localctx.$$ = this._base === null || this.absoluteIRI.test(unesc) ? unesc : this._resolveIRI(unesc)
}
| prefixedName { this.$1(localctx); }
;
prefixedName : PNAME_LN { // t:1dotPNex, 1dotPNdefault, ShExParser-test.js/with pre-defined prefixes
var namePos = localctx.children[0].getText().indexOf(':');
localctx.$$ = this.expandPrefix(localctx.children[0].getText().substr(0, namePos)) + this.unescapeText(localctx.children[0].getText().substr(namePos + 1), this.pnameEscapeReplacements);
}
| PNAME_NS { // t: 1dotNS2, 1dotNSdefault, ShExParser-test.js/PNAME_NS with pre-defined prefixes
localctx.$$ = this.expandPrefix(localctx.children[0].getText().substr(0, localctx.children[0].getText().length - 1));
}
;
blankNode : BLANK_NODE_LABEL { localctx.$$ = localctx.children[0].getText(); } ;
/*
extension : KW_EXTENDS shapeExprLabel
| '&' shapeExprLabel
;
restrictions : KW_RESTRICTS shapeExprLabel
| '-' shapeExprLabel
;
*/
// Keywords
/* KW_ABSTRACT : A B S T R A C T ; */
KW_BASE : B A S E ;
/* KW_EXTENDS : E X T E N D S ; */
KW_IMPORT : I M P O R T ;
/* KW_RESTRICTS : R E S T R I C T S ; */
KW_EXTERNAL : E X T E R N A L ;
KW_PREFIX : P R E F I X ;
KW_START : S T A R T ;
KW_VIRTUAL : V I R T U A L ;
KW_CLOSED : C L O S E D ;
KW_EXTRA : E X T R A ;
KW_LITERAL : L I T E R A L ;
KW_IRI : I R I ;
KW_NONLITERAL : N O N L I T E R A L ;
KW_BNODE : B N O D E ;
KW_AND : A N D ;
KW_OR : O R ;
KW_ON : O N ;
KW_SHAPE : S H A P E ;
KW_EXPRESSION : E X P R E S S I O N ;
KW_MININCLUSIVE : M I N I N C L U S I V E ;
KW_MINEXCLUSIVE : M I N E X C L U S I V E ;
KW_MAXINCLUSIVE : M A X I N C L U S I V E ;
KW_MAXEXCLUSIVE : M A X E X C L U S I V E ;
KW_LENGTH : L E N G T H ;
KW_MINLENGTH : M I N L E N G T H ;
KW_MAXLENGTH : M A X L E N G T H ;
KW_TOTALDIGITS : T O T A L D I G I T S ;
KW_FRACTIONDIGITS : F R A C T I O N D I G I T S ;
KW_NOT : N O T ;
KW_TRUE : 'true' ;
KW_FALSE : 'false' ;
// terminals
PASS : [ \t\r\n]+ -> skip;
COMMENT : ('#' ~[\r\n]*
| '/*' (~[*] | '*' ('\\/' | ~[/]))* '*/') -> skip;
CODE : '{' (~[%\\] | '\\' [%\\] | UCHAR)* '%' '}' ;
RDF_TYPE : 'a' ;
IRIREF : '<' (~[\u0000-\u0020=<>"{}|^`\\] | UCHAR)* '>' ; /* #x00=NULL #01-#x1F=control codes #x20=space */
PNAME_NS : PN_PREFIX? ':' ;
PNAME_LN : PNAME_NS PN_LOCAL ;
ATPNAME_NS : '@' PN_PREFIX? ':' ;
ATPNAME_LN : '@' PNAME_NS PN_LOCAL ;
REGEXP : '/' (~[/\n\r\\] | '\\' [/nrt\\|.?*+(){}[\]$^-] | UCHAR)+ '/' ;
REGEXP_FLAGS : [smix]+ ;
BLANK_NODE_LABEL : '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)? ;
LANGTAG : '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ;
INTEGER : [+-]? [0-9]+ ;
DECIMAL : [+-]? [0-9]* '.' [0-9]+ ;
DOUBLE : [+-]? ([0-9]+ '.' [0-9]* EXPONENT | '.'? [0-9]+ EXPONENT) ;
STEM_MARK : '~' ;
UNBOUNDED : '*' ;
fragment EXPONENT : [eE] [+-]? [0-9]+ ;
STRING_LITERAL1 : '\'' (~[\u0027\u005C\u000A\u000D] | ECHAR | UCHAR)* '\'' ; /* #x27=' #x5C=\ #xA=new line #xD=carriage return */
STRING_LITERAL2 : '"' (~[\u0022\u005C\u000A\u000D] | ECHAR | UCHAR)* '"' ; /* #x22=" #x5C=\ #xA=new line #xD=carriage return */
STRING_LITERAL_LONG1 : '\'\'\'' (('\'' | '\'\'')? (~['\\] | ECHAR | UCHAR))* '\'\'\'' ;
STRING_LITERAL_LONG2 : '"""' (('"' | '""')? (~["\\] | ECHAR | UCHAR))* '"""' ;
fragment UCHAR : '\\u' HEX HEX HEX HEX | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX ;
fragment ECHAR : '\\' [tbnrf\\"'] ;
fragment PN_CHARS_BASE : [A-Z] | [a-z] | [\u00C0-\u00D6] | [\u00D8-\u00F6] | [\u00F8-\u02FF] | [\u0370-\u037D]
| [\u037F-\u1FFF] | [\u200C-\u200D] | [\u2070-\u218F] | [\u2C00-\u2FEF] | [\u3001-\uD7FF]
| [\uF900-\uFDCF] | [\uFDF0-\uFFFD] | [\uD800-\uDB7F][\uDC00-\uDFFF]
;
fragment PN_CHARS_U : PN_CHARS_BASE | '_' ;
fragment PN_CHARS : PN_CHARS_U | '-' | [0-9] | [\u00B7] | [\u0300-\u036F] | [\u203F-\u2040] ;
fragment PN_PREFIX : PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)? ;
fragment PN_LOCAL : (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))? ;
fragment PLX : PERCENT | PN_LOCAL_ESC ;
fragment PERCENT : '%' HEX HEX ;
fragment HEX : [0-9] | [A-F] | [a-f] ;
fragment PN_LOCAL_ESC : '\\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\'' | '(' | ')' | '*' | '+' | ','
| ';' | '=' | '/' | '?' | '#' | '@' | '%') ;
fragment A:('a'|'A');
fragment B:('b'|'B');
fragment C:('c'|'C');
fragment D:('d'|'D');
fragment E:('e'|'E');
fragment F:('f'|'F');
fragment G:('g'|'G');
fragment H:('h'|'H');
fragment I:('i'|'I');
fragment J:('j'|'J');
fragment K:('k'|'K');
fragment L:('l'|'L');
fragment M:('m'|'M');
fragment N:('n'|'N');
fragment O:('o'|'O');
fragment P:('p'|'P');
fragment Q:('q'|'Q');
fragment R:('r'|'R');
fragment S:('s'|'S');
fragment T:('t'|'T');
fragment U:('u'|'U');
fragment V:('v'|'V');
fragment W:('w'|'W');
fragment X:('x'|'X');
fragment Y:('y'|'Y');
fragment Z:('z'|'Z');
|
oeis/296/A296168.asm | neoneye/loda-programs | 11 | 6655 | <filename>oeis/296/A296168.asm
; A296168: Decimal expansion of BesselJ(1,2)/BesselJ(0,2).
; 2,5,7,5,9,2,0,3,2,1,3,6,8,2,2,1,9,5,6,8,5,7,4,9,6,7,8,2,3,1,5,0,4,4,4,9,0,6,1,2,9,8,1,9,5,3,2,6,0,0,1,5,1,4,6,2,7,8,2,7,2,4,1,9,9,3,2,0,0,2,4,9,9,1,3,9,2,2,7,4,2,3,2,1,3,5,1,5,6,4,0,1,0,9,3,0,1,4,5,3
mov $1,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $2,$3
add $1,$2
cmp $4,0
mov $5,$0
div $5,3
add $5,$4
div $1,$5
div $2,$5
sub $3,1
mov $4,$3
cmp $4,0
add $3,$4
div $2,$3
add $2,$1
lpe
mov $6,10
pow $6,$0
div $2,$6
div $1,$2
add $1,$6
mod $1,10
mov $0,$1
|
Cubical/Structures/NAryOp.agda | cmester0/cubical | 1 | 2227 | {-# OPTIONS --cubical --safe #-}
module Cubical.Structures.NAryOp where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Functions.FunExtEquiv
open import Cubical.Data.Nat
open import Cubical.Data.Vec
open import Cubical.Foundations.SIP renaming (SNS-PathP to SNS)
private
variable
ℓ ℓ' : Level
-- TODO: generalize to different target type?
nAryFunStructure : (n : ℕ) → Type (ℓ-max (ℓ-suc ℓ) (nAryLevel ℓ ℓ n))
nAryFunStructure {ℓ = ℓ} n = TypeWithStr _ (λ (X : Type ℓ) → nAryOp n X X)
-- iso for n-ary functions
nAryFunIso : (n : ℕ) → StrIso (λ (X : Type ℓ) → nAryOp n X X) ℓ
nAryFunIso n (X , fX) (Y , fY) f =
(xs : Vec X n) → equivFun f (fX $ⁿ xs) ≡ fY $ⁿ map (equivFun f) xs
nAryFunSNS : (n : ℕ) → SNS {ℓ} _ (nAryFunIso n)
nAryFunSNS n = SNS-≡→SNS-PathP (nAryFunIso n) (nAryFunExtEquiv n)
-- Some specializations that are not used at the moment, but kept as
-- they might become useful later.
private
-- unary
unaryFunIso : StrIso (λ (X : Type ℓ) → nAryOp 1 X X) ℓ
unaryFunIso (A , f) (B , g) e =
(x : A) → equivFun e (f x) ≡ g (equivFun e x)
unaryFunSNS : SNS {ℓ} _ unaryFunIso
unaryFunSNS = SNS-≡→SNS-PathP unaryFunIso (λ s t → compEquiv lem (nAryFunExtEquiv 1 s t))
where
lem : ∀ {X} → {s t : X → X} →
((x : X) → s x ≡ t x) ≃
((xs : Vec X 1) → (s $ⁿ xs) ≡ (t $ⁿ map (λ x → x) xs))
lem {X} {s} {t} = isoToEquiv f
where
f : Iso ((x : X) → s x ≡ t x)
((xs : Vec X 1) → (s $ⁿ xs) ≡ (t $ⁿ map (λ x → x) xs))
Iso.fun f p (x ∷ []) = p x
Iso.inv f p x = p (x ∷ [])
Iso.rightInv f p _ xs@(x ∷ []) = p xs
Iso.leftInv f p _ = p
-- binary
binaryFunIso : StrIso (λ (X : Type ℓ) → nAryOp 2 X X) ℓ
binaryFunIso (A , f) (B , g) e =
(x y : A) → equivFun e (f x y) ≡ g (equivFun e x) (equivFun e y)
binaryFunSNS : SNS {ℓ} _ binaryFunIso
binaryFunSNS = SNS-≡→SNS-PathP binaryFunIso (λ s t → compEquiv lem (nAryFunExtEquiv 2 s t))
where
lem : ∀ {X} → {s t : X → X → X} →
((x y : X) → s x y ≡ t x y) ≃
((xs : Vec X 2) → (s $ⁿ xs) ≡ (t $ⁿ map (λ x → x) xs))
lem {X} {s} {t} = isoToEquiv f
where
f : Iso ((x y : X) → s x y ≡ t x y)
((xs : Vec X 2) → (s $ⁿ xs) ≡ (t $ⁿ map (λ x → x) xs))
Iso.fun f p (x ∷ y ∷ []) = p x y
Iso.inv f p x y = p (x ∷ y ∷ [])
Iso.rightInv f p _ xs@(x ∷ y ∷ []) = p xs
Iso.leftInv f p _ = p
|
oeis/019/A019766.asm | neoneye/loda-programs | 11 | 14930 | <filename>oeis/019/A019766.asm
; A019766: Decimal expansion of 2*e/9.
; 6,0,4,0,6,2,6,2,8,5,4,6,4,5,4,4,9,6,7,4,6,7,3,0,5,4,9,1,8,9,4,8,0,5,5,5,0,5,7,1,6,6,0,2,0,8,2,2,2,1,3,2,3,8,8,8,1,5,4,8,3,6,1,7,1,6,4,6,1,4,7,3,4,1,1,8,9,9,4,6,5,4,6,0,3,0,7,1,5,0,7,8,3,3,7,0,3,1,7,2
add $0,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $2,$3
add $1,$2
cmp $4,0
mov $5,$0
div $5,3
add $5,$4
div $1,$5
div $2,$5
sub $3,1
cmp $4,0
lpe
div $1,9
mul $1,2
mov $6,10
pow $6,$0
div $2,$6
div $1,$2
mod $1,10
mov $0,$1
|
src/main/java/convork.g4 | joaopedrosgs/convork | 3 | 326 | <filename>src/main/java/convork.g4
grammar convork;
@lexer::members {void erroLexico(String msg) { throw new ParseCancellationException(msg); }}
fragment ALGARISMO : '0'..'9';
fragment LETRA: [a-zA-Z];
// Ignorar espacos em branco
WS: (' ') -> skip;
// Ignorar fim de linha
ENDL: ('\n' | '\t' | '\r') -> skip;
program: header? content footer? EOF;
// Ignorar espacos em branco
Identifier: (LETRA|'_') ('_'|ALGARISMO|LETRA)*;
source: header? content footer?;
parameters:parameter*;
parameter: Identifier '=' CADEIA;
header: 'header('parameters')' '{' element* '};';
content: 'content('parameters')' '{' element* '};';
footer: 'footer(' parameters')' '{' element* '};';
element: logo_element|button_element|search_element|spacingParameter|carousel_element|text_element|section_element|row_element|col_element|card_element|container_element|image_element|sizeParameter;
colorParameter: 'color''=' CADEIA;
paddingParameter: 'padding''='CADEIA;
marginParameter: 'margin''='CADEIA;
sizeParameter: 'size''=' CADEIA;
iconParameter: 'icon''=' CADEIA;
hrefParameter: 'href''=' CADEIA;
spacingParameter: 'spacing' '=' CADEIA;
logo_element: 'logo('(sizeParameter|marginParameter|paddingParameter)*')' '{'element*'};';
button_element: 'button('(sizeParameter|marginParameter|paddingParameter|iconParameter|colorParameter)*')''{'element*'};';
search_element: 'search('parameters')''{'element*'};';
carousel_element: 'carousel('parameters')''{'element*'};';
text_element: 'text('CADEIA');';
card_element: 'card('parameters')''{'element*'};';
container_element: 'container('parameters')''{'element*'};';
image_element: 'image('hrefParameter');';
section_element: 'section('parameters')''{'element*'};';
row_element: 'row('spacingParameter?')''{'col_element*'};';
col_element: 'col('spacingParameter?')''{'element*'};';
COMENTARIO: '/*' ~('}'|'\n'|'\r')* '*/' -> skip;
CADEIA : '"' ~('\n' | '\r' | '"')* '"';
COMENTARIO_NAO_FECHADO
: '/*' .*?
{erroLexico("Linha " + (getLine()+1) + ": comentario nao fechado");}
;
ERRO_LEXICO
: .
{erroLexico("Linha " + getLine() + ": " + getText() + " - simbolo nao identificado");}
;
|
arch/ARM/STM32/driver_demos/demo_usart_polling/src/demo_usart_polling.adb | rocher/Ada_Drivers_Library | 192 | 28293 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2017, AdaCore --
-- --
-- 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. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT --
-- HOLDER 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. --
-- --
------------------------------------------------------------------------------
-- The file declares the main procedure for the demonstration.
with HAL; use HAL;
with STM32.GPIO; use STM32.GPIO;
with STM32.USARTs; use STM32.USARTs;
with STM32.Device; use STM32.Device;
procedure Demo_USART_Polling is
TX_Pin : constant GPIO_Point := PB7;
RX_Pin : constant GPIO_Point := PB6;
procedure Initialize_UART_GPIO;
procedure Initialize;
procedure Await_Send_Ready (This : USART) with Inline;
procedure Put_Blocking (This : in out USART; Data : UInt16);
--------------------------
-- Initialize_UART_GPIO --
--------------------------
procedure Initialize_UART_GPIO is
begin
Enable_Clock (USART_1);
Enable_Clock (RX_Pin & TX_Pin);
Configure_IO
(RX_Pin & TX_Pin,
(Mode => Mode_AF,
AF => GPIO_AF_USART1_7,
Resistors => Pull_Up,
AF_Speed => Speed_50MHz,
AF_Output_Type => Push_Pull));
end Initialize_UART_GPIO;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
Initialize_UART_GPIO;
Disable (USART_1);
Set_Baud_Rate (USART_1, 115_200);
Set_Mode (USART_1, Tx_Rx_Mode);
Set_Stop_Bits (USART_1, Stopbits_1);
Set_Word_Length (USART_1, Word_Length_8);
Set_Parity (USART_1, No_Parity);
Set_Flow_Control (USART_1, No_Flow_Control);
Enable (USART_1);
end Initialize;
----------------------
-- Await_Send_Ready --
----------------------
procedure Await_Send_Ready (This : USART) is
begin
loop
exit when Tx_Ready (This);
end loop;
end Await_Send_Ready;
------------------
-- Put_Blocking --
------------------
procedure Put_Blocking (This : in out USART; Data : UInt16) is
begin
Await_Send_Ready (This);
Transmit (This, UInt9 (Data));
end Put_Blocking;
begin
Initialize;
loop
for Next_Char in Character range 'a' .. 'z' loop -- arbitrary
Put_Blocking (USART_1, Character'Pos (Next_Char));
end loop;
end loop;
end Demo_USART_Polling;
|
audio/sfx/cry15_1.asm | opiter09/ASM-Machina | 1 | 80581 | <reponame>opiter09/ASM-Machina<gh_stars>1-10
SFX_Cry15_1_Ch5:
duty_cycle_pattern 3, 3, 0, 0
square_note 4, 15, 3, 1920
square_note 15, 14, 7, 1792
square_note 8, 13, 3, 1808
square_note 4, 12, 2, 1792
square_note 4, 13, 2, 1776
square_note 8, 12, 1, 1760
sound_ret
SFX_Cry15_1_Ch6:
duty_cycle_pattern 1, 1, 2, 2
square_note 6, 12, 3, 1793
square_note 14, 11, 7, 1665
square_note 7, 11, 3, 1682
square_note 3, 10, 2, 1665
square_note 4, 11, 2, 1650
square_note 8, 10, 1, 1633
sound_ret
SFX_Cry15_1_Ch8:
noise_note 6, 14, 3, 92
noise_note 14, 13, 6, 76
noise_note 6, 12, 6, 60
noise_note 3, 11, 3, 76
noise_note 3, 10, 2, 92
noise_note 8, 11, 1, 108
sound_ret
|
asm/mips/progs/program7.asm | TomRegan/synedoche | 1 | 97998 | ##########################################################################
##Author : <NAME> <<EMAIL>> ##
##Last modified : 2011-08-16 ##
##Description : Does an O(n^2) sort on an unsorted list. ##
##Modifies : registers : ##
## memory : Heap at gp (40b in place) ##
##Result : sorted numerical list at $gp ##
##########################################################################
#####################################################
##This block initializes counters and variables. ##
#####################################################
Main:
addi $sp, $sp, -4 #
sw $gp, 0($sp) # save the global pointer
#####################################################
##This block loads the data. ##
#####################################################
addi $s0, $zero, 8 #
sw $s0, 0($gp) #
addi $s0, $zero,0xa #
sw $s0, 4($gp) #
addi $s0, $zero,0x1 #
sw $s0, 8($gp) #
addi $s0, $zero,0x2 #
sw $s0,12($gp) #
addi $s0, $zero,0x7 #
sw $s0,16($gp) #
addi $s0, $zero,0x4 #
sw $s0,20($gp) #
addi $s0, $zero,0x5 #
sw $s0,24($gp) #
addi $s0, $zero,0x3 #
sw $s0,28($gp) #
addi $s0, $zero,0x6 #
sw $s0,32($gp) #
addi $s0, $zero,0x9 #
sw $s0,36($gp) #
addi $s0, $zero,0xa # reset counter
#####################################################
##This is the outer sort-loop. ##
#####################################################
L1:
addi $s1, $zero,0x9 # inner loop counter for sort
addi $s0, $s0, -1 # decrement counter
lw $gp, 0($sp) # load original gp value
addi $gp, $gp, -4 # FIX: fencepost error
#####################################################
##This is the inner sort-loop. ##
#####################################################
L2:
beq $s0, $zero, Exit #
addi $gp, $gp, 4 # increment the gp
beq $s1, $zero, L1 #
addi $s1, $s1, -1 # decrement inner loop counter (delay slot)
lw $a0, 0($gp) #
lw $a1, 4($gp) #
slt $t2, $a1, $a0 # we will sort so t0 is smaller than t1
beq $t2, $zero, L2 # if t0 > t1 goto L2
nop #
addi $sp, $sp, -4 # else swap
jal Swap #
sw $ra, 0($sp) #
sw $v0, 0($gp) #
sw $v1, 4($gp) #
lw $ra, 0($sp) # restore saved values
addi $sp, $sp, 4 #
j L2 #
nop #
#####################################################
##This function swaps 2 arguments. ##
#####################################################
Swap:
add $v0, $zero, $a1 #
jr $ra #
add $v1, $zero, $a0 #
#####################################################
##This block terminates the program. ##
#####################################################
Exit:
addi $v0, $zero, 10 #
syscall #
|
src/Auto/Extensible.agda | wenkokke/AutoInAgda | 22 | 8017 | open import Auto.Core
open import Data.List using (_∷_; []; length)
open import Data.Nat using (ℕ; zero; suc)
open import Data.Product using (_,_)
open import Data.Sum using (inj₁; inj₂)
open import Reflection using (Term; Name; lam; visible; abs; TC; returnTC; bindTC)
module Auto.Extensible (instHintDB : IsHintDB) where
open IsHintDB instHintDB public
open PsExtensible instHintDB public
open Auto.Core public using (dfs; bfs; Exception; throw; searchSpaceExhausted; unsupportedSyntax)
auto : Strategy → ℕ → HintDB → Term → TC Term
auto search depth db type
with agda2goal×premises type
... | inj₁ msg = returnTC (quoteError msg)
... | inj₂ ((n , g) , args)
with search (suc depth) (solve g (fromRules args ∙ db))
... | [] = returnTC (quoteError searchSpaceExhausted)
... | (p ∷ _) = bindTC (reify p) (λ rp → returnTC (intros rp))
where
intros : Term → Term
intros = introsAcc (length args)
where
introsAcc : ℕ → Term → Term
introsAcc zero t = t
introsAcc (suc k) t = lam visible (abs "TODO" (introsAcc k t))
infixl 5 _<<_
_<<_ : HintDB → Name → TC HintDB
db << n = bindTC (name2rule n) (λ
{(inj₁ msg) → returnTC db
; (inj₂ (k , r)) → returnTC (db ∙ return r)})
-- db << n with (name2rule n)
-- db << n | inj₁ msg = db
-- db << n | inj₂ (k , r) = db ∙ return r
|
oeis/152/A152170.asm | neoneye/loda-programs | 11 | 24478 | ; A152170: a(n) is the total size of all the image sets of all functions from [n] to [n]. I.e., a(n) is the sum of the cardinalities of every image set of every function whose domain and co-domain is {1,2,...,n}.
; Submitted by <NAME>
; 0,1,6,57,700,10505,186186,3805249,88099320,2278824849,65132155990,2038428376721,69332064858420,2546464715771353,100444826158022178,4234886922345707265,190053371487946575856,9045570064018726951457,455099825218118626519470
mov $2,$0
sub $0,1
pow $0,$2
mov $1,$2
pow $1,$2
sub $1,$0
mul $1,$2
mov $0,$1
|
30-Fill-the-Floor.size.asm | blueset/7bh-solutions | 0 | 13197 | <reponame>blueset/7bh-solutions
-- 7 Billion Humans --
-- 30: Fill the floor --
-- Size: 6/6 --
-- Speed: 1108/192 --
mem1 = nearest printer
a:
drop
takefrom mem1
if c != nothing:
step nw,w,sw,n,s,ne,e,se
endif
jump a
|
antigo/ap1/grammars/If2.g4 | natalisso/compilers-cin | 24 | 3585 | <reponame>natalisso/compilers-cin
grammar If2;
s : iff
| id
;
id: ID;
iff: IF;
ID: [a-z]+;
IF: 'if';
WS : [ \t\r\n]+ -> skip; |
arch/ARM/NXP/svd/lpc55s6x/nxp_svd-usbhsh.ads | morbos/Ada_Drivers_Library | 2 | 22203 | <reponame>morbos/Ada_Drivers_Library
-- Copyright 2016-2019 NXP
-- All rights reserved.SPDX-License-Identifier: BSD-3-Clause
-- This spec has been automatically generated from LPC55S6x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NXP_SVD.USBHSH is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype CAPLENGTH_CHIPID_CAPLENGTH_Field is HAL.UInt8;
subtype CAPLENGTH_CHIPID_CHIPID_Field is HAL.UInt16;
-- This register contains the offset value towards the start of the
-- operational register space and the version number of the IP block
type CAPLENGTH_CHIPID_Register is record
-- Read-only. Capability Length: This is used as an offset.
CAPLENGTH : CAPLENGTH_CHIPID_CAPLENGTH_Field;
-- unspecified
Reserved_8_15 : HAL.UInt8;
-- Read-only. Chip identification: indicates major and minor revision of
-- the IP: [31:24] = Major revision [23:16] = Minor revision Major
-- revisions used: 0x01: USB2.
CHIPID : CAPLENGTH_CHIPID_CHIPID_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CAPLENGTH_CHIPID_Register use record
CAPLENGTH at 0 range 0 .. 7;
Reserved_8_15 at 0 range 8 .. 15;
CHIPID at 0 range 16 .. 31;
end record;
subtype HCSPARAMS_N_PORTS_Field is HAL.UInt4;
-- Host Controller Structural Parameters
type HCSPARAMS_Register is record
-- Read-only. This register specifies the number of physical downstream
-- ports implemented on this host controller.
N_PORTS : HCSPARAMS_N_PORTS_Field;
-- Read-only. This field indicates whether the host controller
-- implementation includes port power control.
PPC : Boolean;
-- unspecified
Reserved_5_15 : HAL.UInt11;
-- Read-only. This bit indicates whether the ports support port
-- indicator control.
P_INDICATOR : Boolean;
-- unspecified
Reserved_17_31 : HAL.UInt15;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for HCSPARAMS_Register use record
N_PORTS at 0 range 0 .. 3;
PPC at 0 range 4 .. 4;
Reserved_5_15 at 0 range 5 .. 15;
P_INDICATOR at 0 range 16 .. 16;
Reserved_17_31 at 0 range 17 .. 31;
end record;
subtype FLADJ_FRINDEX_FLADJ_Field is HAL.UInt6;
subtype FLADJ_FRINDEX_FRINDEX_Field is HAL.UInt14;
-- Frame Length Adjustment
type FLADJ_FRINDEX_Register is record
-- Frame Length Timing Value.
FLADJ : FLADJ_FRINDEX_FLADJ_Field := 16#20#;
-- unspecified
Reserved_6_15 : HAL.UInt10 := 16#0#;
-- Frame Index: Bits 29 to16 in this register are used for the frame
-- number field in the SOF packet.
FRINDEX : FLADJ_FRINDEX_FRINDEX_Field := 16#0#;
-- unspecified
Reserved_30_31 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FLADJ_FRINDEX_Register use record
FLADJ at 0 range 0 .. 5;
Reserved_6_15 at 0 range 6 .. 15;
FRINDEX at 0 range 16 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
subtype ATLPTD_ATL_CUR_Field is HAL.UInt5;
subtype ATLPTD_ATL_BASE_Field is HAL.UInt23;
-- Memory base address where ATL PTD0 is stored
type ATLPTD_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- This indicates the current PTD that is used by the hardware when it
-- is processing the ATL list.
ATL_CUR : ATLPTD_ATL_CUR_Field := 16#0#;
-- Base address to be used by the hardware to find the start of the ATL
-- list.
ATL_BASE : ATLPTD_ATL_BASE_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ATLPTD_Register use record
Reserved_0_3 at 0 range 0 .. 3;
ATL_CUR at 0 range 4 .. 8;
ATL_BASE at 0 range 9 .. 31;
end record;
subtype ISOPTD_ISO_FIRST_Field is HAL.UInt5;
subtype ISOPTD_ISO_BASE_Field is HAL.UInt22;
-- Memory base address where ISO PTD0 is stored
type ISOPTD_Register is record
-- unspecified
Reserved_0_4 : HAL.UInt5 := 16#0#;
-- This indicates the first PTD that is used by the hardware when it is
-- processing the ISO list.
ISO_FIRST : ISOPTD_ISO_FIRST_Field := 16#0#;
-- Base address to be used by the hardware to find the start of the ISO
-- list.
ISO_BASE : ISOPTD_ISO_BASE_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISOPTD_Register use record
Reserved_0_4 at 0 range 0 .. 4;
ISO_FIRST at 0 range 5 .. 9;
ISO_BASE at 0 range 10 .. 31;
end record;
subtype INTPTD_INT_FIRST_Field is HAL.UInt5;
subtype INTPTD_INT_BASE_Field is HAL.UInt22;
-- Memory base address where INT PTD0 is stored
type INTPTD_Register is record
-- unspecified
Reserved_0_4 : HAL.UInt5 := 16#0#;
-- This indicates the first PTD that is used by the hardware when it is
-- processing the INT list.
INT_FIRST : INTPTD_INT_FIRST_Field := 16#0#;
-- Base address to be used by the hardware to find the start of the INT
-- list.
INT_BASE : INTPTD_INT_BASE_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTPTD_Register use record
Reserved_0_4 at 0 range 0 .. 4;
INT_FIRST at 0 range 5 .. 9;
INT_BASE at 0 range 10 .. 31;
end record;
subtype DATAPAYLOAD_DAT_BASE_Field is HAL.UInt16;
-- Memory base address that indicates the start of the data payload buffers
type DATAPAYLOAD_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- Base address to be used by the hardware to find the start of the data
-- payload section.
DAT_BASE : DATAPAYLOAD_DAT_BASE_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DATAPAYLOAD_Register use record
Reserved_0_15 at 0 range 0 .. 15;
DAT_BASE at 0 range 16 .. 31;
end record;
subtype USBCMD_FLS_Field is HAL.UInt2;
-- USB Command register
type USBCMD_Register is record
-- Run/Stop: 1b = Run.
RS : Boolean := False;
-- Host Controller Reset: This control bit is used by the software to
-- reset the host controller.
HCRESET : Boolean := False;
-- Frame List Size: This field specifies the size of the frame list.
FLS : USBCMD_FLS_Field := 16#0#;
-- unspecified
Reserved_4_6 : HAL.UInt3 := 16#0#;
-- Light Host Controller Reset: This bit allows the driver software to
-- reset the host controller without affecting the state of the ports.
LHCR : Boolean := False;
-- ATL List enabled.
ATL_EN : Boolean := False;
-- ISO List enabled.
ISO_EN : Boolean := False;
-- INT List enabled.
INT_EN : Boolean := False;
-- unspecified
Reserved_11_31 : HAL.UInt21 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USBCMD_Register use record
RS at 0 range 0 .. 0;
HCRESET at 0 range 1 .. 1;
FLS at 0 range 2 .. 3;
Reserved_4_6 at 0 range 4 .. 6;
LHCR at 0 range 7 .. 7;
ATL_EN at 0 range 8 .. 8;
ISO_EN at 0 range 9 .. 9;
INT_EN at 0 range 10 .. 10;
Reserved_11_31 at 0 range 11 .. 31;
end record;
-- USB Interrupt Status register
type USBSTS_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Port Change Detect: The host controller sets this bit to logic 1 when
-- any port has a change bit transition from a 0 to a one or a Force
-- Port Resume bit transition from a 0 to a 1 as a result of a J-K
-- transition detected on a suspended port.
PCD : Boolean := False;
-- Frame List Rollover: The host controller sets this bit to logic 1
-- when the frame list index rolls over its maximum value to 0.
FLR : Boolean := False;
-- unspecified
Reserved_4_15 : HAL.UInt12 := 16#0#;
-- ATL IRQ: Indicates that an ATL PTD (with I-bit set) was completed.
ATL_IRQ : Boolean := False;
-- ISO IRQ: Indicates that an ISO PTD (with I-bit set) was completed.
ISO_IRQ : Boolean := False;
-- INT IRQ: Indicates that an INT PTD (with I-bit set) was completed.
INT_IRQ : Boolean := False;
-- SOF interrupt: Every time when the host sends a Start of Frame token
-- on the USB bus, this bit is set.
SOF_IRQ : Boolean := False;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USBSTS_Register use record
Reserved_0_1 at 0 range 0 .. 1;
PCD at 0 range 2 .. 2;
FLR at 0 range 3 .. 3;
Reserved_4_15 at 0 range 4 .. 15;
ATL_IRQ at 0 range 16 .. 16;
ISO_IRQ at 0 range 17 .. 17;
INT_IRQ at 0 range 18 .. 18;
SOF_IRQ at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- USB Interrupt Enable register
type USBINTR_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- Port Change Detect Interrupt Enable: 1: enable 0: disable.
PCDE : Boolean := False;
-- Frame List Rollover Interrupt Enable: 1: enable 0: disable.
FLRE : Boolean := False;
-- unspecified
Reserved_4_15 : HAL.UInt12 := 16#0#;
-- ATL IRQ Enable bit: 1: enable 0: disable.
ATL_IRQ_E : Boolean := False;
-- ISO IRQ Enable bit: 1: enable 0: disable.
ISO_IRQ_E : Boolean := False;
-- INT IRQ Enable bit: 1: enable 0: disable.
INT_IRQ_E : Boolean := False;
-- SOF Interrupt Enable bit: 1: enable 0: disable.
SOF_E : Boolean := False;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for USBINTR_Register use record
Reserved_0_1 at 0 range 0 .. 1;
PCDE at 0 range 2 .. 2;
FLRE at 0 range 3 .. 3;
Reserved_4_15 at 0 range 4 .. 15;
ATL_IRQ_E at 0 range 16 .. 16;
ISO_IRQ_E at 0 range 17 .. 17;
INT_IRQ_E at 0 range 18 .. 18;
SOF_E at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
subtype PORTSC1_LS_Field is HAL.UInt2;
subtype PORTSC1_PIC_Field is HAL.UInt2;
subtype PORTSC1_PTC_Field is HAL.UInt4;
subtype PORTSC1_PSPD_Field is HAL.UInt2;
-- Port Status and Control register
type PORTSC1_Register is record
-- Current Connect Status: Logic 1 indicates a device is present on the
-- port.
CCS : Boolean := False;
-- Connect Status Change: Logic 1 means that the value of CCS has
-- changed.
CSC : Boolean := False;
-- Port Enabled/Disabled.
PED : Boolean := False;
-- Port Enabled/Disabled Change: Logic 1 means that the value of PED has
-- changed.
PEDC : Boolean := False;
-- Over-current active: Logic 1 means that this port has an over-current
-- condition.
OCA : Boolean := False;
-- Over-current change: Logic 1 means that the value of OCA has changed.
OCC : Boolean := False;
-- Force Port Resume: Logic 1 means resume (K-state) detected or driven
-- on the port.
FPR : Boolean := False;
-- Suspend: Logic 1 means port is in the suspend state.
SUSP : Boolean := False;
-- Port Reset: Logic 1 means the port is in the reset state.
PR : Boolean := False;
-- unspecified
Reserved_9_9 : HAL.Bit := 16#0#;
-- Read-only. Line Status: This field reflects the current logical
-- levels of the DP (bit 11) and DM (bit 10) signal lines.
LS : PORTSC1_LS_Field := 16#0#;
-- Port Power: The function of this bit depends on the value of the Port
-- Power Control (PPC) bit in the HCSPARAMS register.
PP : Boolean := False;
-- unspecified
Reserved_13_13 : HAL.Bit := 16#0#;
-- Port Indicator Control : Writing to this field has no effect if the
-- P_INDICATOR bit in the HCSPARAMS register is logic 0.
PIC : PORTSC1_PIC_Field := 16#0#;
-- Port Test Control: A non-zero value indicates that the port is
-- operating in the test mode as indicated by the value.
PTC : PORTSC1_PTC_Field := 16#0#;
-- Port Speed: 00b: Low-speed 01b: Full-speed 10b: High-speed 11b:
-- Reserved.
PSPD : PORTSC1_PSPD_Field := 16#0#;
-- Wake on overcurrent enable: Writing this bit to a one enables the
-- port to be sensitive to overcurrent conditions as wake-up events.
WOO : Boolean := False;
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PORTSC1_Register use record
CCS at 0 range 0 .. 0;
CSC at 0 range 1 .. 1;
PED at 0 range 2 .. 2;
PEDC at 0 range 3 .. 3;
OCA at 0 range 4 .. 4;
OCC at 0 range 5 .. 5;
FPR at 0 range 6 .. 6;
SUSP at 0 range 7 .. 7;
PR at 0 range 8 .. 8;
Reserved_9_9 at 0 range 9 .. 9;
LS at 0 range 10 .. 11;
PP at 0 range 12 .. 12;
Reserved_13_13 at 0 range 13 .. 13;
PIC at 0 range 14 .. 15;
PTC at 0 range 16 .. 19;
PSPD at 0 range 20 .. 21;
WOO at 0 range 22 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
subtype LASTPTD_ATL_LAST_Field is HAL.UInt5;
subtype LASTPTD_ISO_LAST_Field is HAL.UInt5;
subtype LASTPTD_INT_LAST_Field is HAL.UInt5;
-- Marks the last PTD in the list for ISO, INT and ATL
type LASTPTD_Register is record
-- If hardware has reached this PTD and the J bit is not set, it will go
-- to PTD0 as the next PTD to be processed.
ATL_LAST : LASTPTD_ATL_LAST_Field := 16#0#;
-- unspecified
Reserved_5_7 : HAL.UInt3 := 16#0#;
-- This indicates the last PTD in the ISO list.
ISO_LAST : LASTPTD_ISO_LAST_Field := 16#0#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- This indicates the last PTD in the INT list.
INT_LAST : LASTPTD_INT_LAST_Field := 16#0#;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for LASTPTD_Register use record
ATL_LAST at 0 range 0 .. 4;
Reserved_5_7 at 0 range 5 .. 7;
ISO_LAST at 0 range 8 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
INT_LAST at 0 range 16 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Controls the port if it is attached to the host block or the device
-- block
type PORTMODE_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
-- If this bit is set to one, one of the ports will behave as a USB
-- device.
DEV_ENABLE : Boolean := False;
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- This bit indicates if the PHY power-down input is controlled by
-- software or by hardware.
SW_CTRL_PDCOM : Boolean := True;
-- This bit is only used when SW_CTRL_PDCOM is set to 1b.
SW_PDCOM : Boolean := False;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PORTMODE_Register use record
Reserved_0_15 at 0 range 0 .. 15;
DEV_ENABLE at 0 range 16 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
SW_CTRL_PDCOM at 0 range 18 .. 18;
SW_PDCOM at 0 range 19 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- USB1 High-speed Host Controller
type USBHSH_Peripheral is record
-- This register contains the offset value towards the start of the
-- operational register space and the version number of the IP block
CAPLENGTH_CHIPID : aliased CAPLENGTH_CHIPID_Register;
-- Host Controller Structural Parameters
HCSPARAMS : aliased HCSPARAMS_Register;
-- Frame Length Adjustment
FLADJ_FRINDEX : aliased FLADJ_FRINDEX_Register;
-- Memory base address where ATL PTD0 is stored
ATLPTD : aliased ATLPTD_Register;
-- Memory base address where ISO PTD0 is stored
ISOPTD : aliased ISOPTD_Register;
-- Memory base address where INT PTD0 is stored
INTPTD : aliased INTPTD_Register;
-- Memory base address that indicates the start of the data payload
-- buffers
DATAPAYLOAD : aliased DATAPAYLOAD_Register;
-- USB Command register
USBCMD : aliased USBCMD_Register;
-- USB Interrupt Status register
USBSTS : aliased USBSTS_Register;
-- USB Interrupt Enable register
USBINTR : aliased USBINTR_Register;
-- Port Status and Control register
PORTSC1 : aliased PORTSC1_Register;
-- Done map for each ATL PTD
ATLPTDD : aliased HAL.UInt32;
-- Skip map for each ATL PTD
ATLPTDS : aliased HAL.UInt32;
-- Done map for each ISO PTD
ISOPTDD : aliased HAL.UInt32;
-- Skip map for each ISO PTD
ISOPTDS : aliased HAL.UInt32;
-- Done map for each INT PTD
INTPTDD : aliased HAL.UInt32;
-- Skip map for each INT PTD
INTPTDS : aliased HAL.UInt32;
-- Marks the last PTD in the list for ISO, INT and ATL
LASTPTD : aliased LASTPTD_Register;
-- Controls the port if it is attached to the host block or the device
-- block
PORTMODE : aliased PORTMODE_Register;
end record
with Volatile;
for USBHSH_Peripheral use record
CAPLENGTH_CHIPID at 16#0# range 0 .. 31;
HCSPARAMS at 16#4# range 0 .. 31;
FLADJ_FRINDEX at 16#C# range 0 .. 31;
ATLPTD at 16#10# range 0 .. 31;
ISOPTD at 16#14# range 0 .. 31;
INTPTD at 16#18# range 0 .. 31;
DATAPAYLOAD at 16#1C# range 0 .. 31;
USBCMD at 16#20# range 0 .. 31;
USBSTS at 16#24# range 0 .. 31;
USBINTR at 16#28# range 0 .. 31;
PORTSC1 at 16#2C# range 0 .. 31;
ATLPTDD at 16#30# range 0 .. 31;
ATLPTDS at 16#34# range 0 .. 31;
ISOPTDD at 16#38# range 0 .. 31;
ISOPTDS at 16#3C# range 0 .. 31;
INTPTDD at 16#40# range 0 .. 31;
INTPTDS at 16#44# range 0 .. 31;
LASTPTD at 16#48# range 0 .. 31;
PORTMODE at 16#50# range 0 .. 31;
end record;
-- USB1 High-speed Host Controller
USBHSH_Periph : aliased USBHSH_Peripheral
with Import, Address => System'To_Address (16#400A3000#);
end NXP_SVD.USBHSH;
|
botsing-parsers/src/main/antlr4/eu/stamp/botsing/parsers/StackTracesParser.g4 | MattSkala/botsing | 23 | 3740 | parser grammar StackTracesParser;
options { tokenVocab = StackTracesLexer; }
stackTraces: ( content )* EOF;
content: stackTrace # RootStackTrace
| . # MiscContent
;
stackTrace: messageLine atLine+ ellipsisLine? causedByLine?;
atLine: AT qualifiedMethod LPAR classFile RPAR;
ellipsisLine: ELLIPSIS NUMBER MORE_;
causedByLine: CAUSED_BY stackTrace;
messageLine: qualifiedClass (COLON message)?;
qualifiedClass: packagePath? className innerClassName*;
innerClassName: DOLLAR (NUMBER | className);
classFile: fileLocation
| isNative
| isUnknown
;
fileLocation: fileName COLON NUMBER;
isNative: NATIVE_METHOD;
isUnknown: UNKNOWN_SOURCE;
fileName: className FILEEXTENSION;
qualifiedMethod: qualifiedClass DOT (methodName | constructor);
constructor: INIT;
methodName: ID;
packagePath: (ID DOT) +;
className: ID;
message: .*?;
|
programs/oeis/247/A247617.asm | neoneye/loda | 22 | 17108 | ; A247617: a(4n) = n + 1/2 - (-1)^n/2 + (-1)^n, a(2n+1) = 2*n + 5, a(4n+2) = 2*n + 3.
; 1,5,3,7,1,9,5,11,3,13,7,15,3,17,9,19,5,21,11,23,5,25,13,27,7,29,15,31,7,33,17,35,9,37,19,39,9,41,21,43,11,45,23,47,11,49,25,51,13,53,27,55,13,57,29,59,15,61,31,63,15,65,33,67,17,69,35,71,17,73,37,75,19,77,39,79,19,81,41,83,21,85,43,87,21,89,45,91,23,93,47,95,23,97,49,99,25,101,51,103
mov $1,3
add $1,$0
mov $2,$0
gcd $2,4
div $1,$2
div $1,2
mul $1,2
add $1,1
mov $0,$1
|
dcf/src/dcf-zip-create.adb | onox/dcf-ada | 5 | 27169 | -- SPDX-License-Identifier: MIT
--
-- Copyright (c) 2000 - 2018 <NAME> (maintainer)
-- SWITZERLAND
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
with Ada.Unchecked_Deallocation;
package body DCF.Zip.Create is
Four_GB : constant := 4 * 1024 ** 3;
Zip_32_Exceeded_Message : constant String :=
"Zip file larger than 4 GB limit of Zip_32 archive format";
procedure Create
(Info : in out Zip_Create_Info;
Stream : not null Zipstream_Class_Access;
Compress : Zip.Compress.Compression_Method := Zip.Compress.Deflate_1) is
begin
Info.Stream := Stream;
Info.Compress := Compress;
end Create;
function Is_Created (Info : Zip_Create_Info) return Boolean is
(Info.Stream /= null);
procedure Set (Info : in out Zip_Create_Info; New_Method : Zip.Compress.Compression_Method) is
begin
Info.Compress := New_Method;
end Set;
procedure Set_Comment (Info : in out Zip_Create_Info; Comment : String) is
begin
Info.Comment := SU.To_Unbounded_String (Comment);
end Set_Comment;
function Name (Info : Zip_Create_Info) return String is
(Get_Name (Info.Stream.all));
procedure Dispose is new Ada.Unchecked_Deallocation (Dir_Entries, Pdir_Entries);
procedure Resize (A : in out Pdir_Entries; Size : Integer) is
Hlp : constant Pdir_Entries := new Dir_Entries (1 .. Size);
begin
if A = null then
A := Hlp;
else
Hlp (1 .. Integer'Min (Size, A'Length)) := A (1 .. Integer'Min (Size, A'Length));
Dispose (A);
A := Hlp;
end if;
end Resize;
-- Internal - add the catalogue entry corresponding to a
-- compressed file in the Zip archive.
-- The entire catalogue will be written at the end of the zip stream,
-- and the entry as a local header just before the compressed data.
-- The entry's is mostly incomplete in the end (name, size, ...); stream
-- operations on the archive being built are not performed here,
-- see Add_Stream for that.
procedure Add_Catalogue_Entry (Info : in out Zip_Create_Info) is
begin
if Info.Last_Entry = 0 then
Info.Last_Entry := 1;
Resize (Info.Contains, 32);
else
Info.Last_Entry := Info.Last_Entry + 1;
if Info.Last_Entry > Info.Contains'Last then
-- Info.Contains is full, time to resize it!
-- We do nothing less than double the size - better than
-- whatever offer you'd get in your e-mails.
Resize (Info.Contains, Info.Contains'Last * 2);
end if;
end if;
declare
Cfh : Central_File_Header renames Info.Contains (Info.Last_Entry).Head;
begin
-- Administration
Cfh.Made_By_Version := 20; -- Version 2.0
Cfh.Comment_Length := 0;
Cfh.Disk_Number_Start := 0;
Cfh.Internal_Attributes := 0; -- 0: binary; 1: text
Cfh.External_Attributes := 0;
Cfh.Short_Info.Needed_Extract_Version := 10; -- Value put by Zip/PKZip
Cfh.Short_Info.Bit_Flag := 0;
end;
end Add_Catalogue_Entry;
-- This is just for detecting duplicates
procedure Insert_To_Name_Dictionary (File_Name : String; M : in out Name_Mapping.Map) is
Cm : Name_Mapping.Cursor;
Ok : Boolean;
begin
M.Insert (SU.To_Unbounded_String (File_Name), Cm, Ok);
if not Ok then
-- Name already registered
raise Duplicate_Name with "Entry name '" & File_Name & "' already in archive";
end if;
end Insert_To_Name_Dictionary;
procedure Add_Stream
(Info : in out Zip_Create_Info;
Stream : in out Root_Zipstream_Type'Class;
Feedback : in Feedback_Proc;
Compressed_Size : out Zip.File_Size_Type;
Final_Method : out Natural)
is
function To_File_Name (Path : String) return String is
Name : String := Path;
begin
-- Appnote: 4.4.17.1, slashes must be forward slashes '/' instead of '\'
for C of Name loop
if C = '\' then
C := '/';
end if;
end loop;
return Name;
end To_File_Name;
Mem1, Mem2 : Zs_Index_Type := Zs_Index_Type'First;
Last : Positive;
Entry_Name : constant String := To_File_Name (Get_Name (Stream));
Is_Folder : constant Boolean := Entry_Name (Entry_Name'Last) = '/';
begin
if Is_Folder and then Stream.Size > 0 then
raise Constraint_Error;
end if;
-- Check for duplicates; raises Duplicate_name in this case
Insert_To_Name_Dictionary (Entry_Name, Info.Dir);
Add_Catalogue_Entry (Info);
Last := Info.Last_Entry;
declare
Cfh : Central_File_Header renames Info.Contains (Last).Head;
Shi : Local_File_Header renames Cfh.Short_Info;
begin
pragma Assert (Zip.Headers.Encryption_Flag_Bit not in Shi.Bit_Flag);
if Stream.UTF_8_Encoding then
Shi.Bit_Flag := Shi.Bit_Flag or Zip.Headers.Language_Encoding_Flag_Bit;
end if;
Shi.File_Timedate := Get_Time (Stream);
Shi.Dd.Uncompressed_Size := Unsigned_32 (Size (Stream));
Shi.Filename_Length := Entry_Name'Length;
Info.Contains (Last).Name := new String'(Entry_Name);
Shi.Extra_Field_Length := 0;
Mem1 := Index (Info.Stream.all);
Cfh.Local_Header_Offset := Unsigned_32 (Mem1) - 1;
-- Write the local header with incomplete informations
Zip.Headers.Write (Info.Stream.all, Shi);
String'Write (Info.Stream, Entry_Name);
-- Write compressed file
Zip.Compress.Compress_Data
(Input => Stream,
Output => Info.Stream.all,
Input_Size => Shi.Dd.Uncompressed_Size,
Method => (if Is_Folder then Zip.Compress.Store else Info.Compress),
Feedback => Feedback,
CRC => Shi.Dd.Crc_32,
Output_Size => Shi.Dd.Compressed_Size,
Zip_Type => Shi.Zip_Type);
Mem2 := Index (Info.Stream.all);
if Info.Zip_Archive_Format = Zip_32 and then Mem2 > Four_GB then
raise Zip_Capacity_Exceeded with Zip_32_Exceeded_Message;
end if;
-- Go back to the local header to rewrite it with complete informations
-- known after the compression: CRC value, compressed size, actual compression format.
Set_Index (Info.Stream.all, Mem1);
Zip.Headers.Write (Info.Stream.all, Shi);
-- Return to momentaneous end of file
Set_Index (Info.Stream.all, Mem2);
Compressed_Size := Shi.Dd.Compressed_Size;
Final_Method := Natural (Shi.Zip_Type);
end;
end Add_Stream;
procedure Add_Stream
(Info : in out Zip_Create_Info;
Stream : in out Root_Zipstream_Type'Class)
is
Compressed_Size : Zip.File_Size_Type; -- Dummy
Final_Method : Natural; -- Dummy
begin
Add_Stream (Info, Stream, null, Compressed_Size, Final_Method);
end Add_Stream;
procedure Add_Compressed_Stream
(Info : in out Zip_Create_Info; -- Destination
Stream : in out Root_Zipstream_Type'Class; -- Source
Feedback : in Feedback_Proc)
is
Lh : Zip.Headers.Local_File_Header;
Data_Descriptor_After_Data : Boolean;
begin
Zip.Headers.Read_And_Check (Stream, Lh);
Data_Descriptor_After_Data := (Lh.Bit_Flag and 8) /= 0;
-- Copy name and ignore extra field
declare
Name : String (1 .. Positive (Lh.Filename_Length));
Extra : String (1 .. Natural (Lh.Extra_Field_Length));
begin
String'Read (Stream'Access, Name);
String'Read (Stream'Access, Extra);
-- Check for duplicates; raises Duplicate_name in this case:
Insert_To_Name_Dictionary (Name, Info.Dir);
Add_Catalogue_Entry (Info);
Info.Contains (Info.Last_Entry).Head.Local_Header_Offset :=
Unsigned_32 (Index (Info.Stream.all)) - 1;
Info.Contains (Info.Last_Entry).Name := new String'(Name);
Lh.Extra_Field_Length := 0; -- Extra field is zeroed (causes problems if not)
Zip.Headers.Write (Info.Stream.all, Lh); -- Copy local header to new stream
String'Write (Info.Stream, Name); -- Copy entry name to new stream
end;
Zip.Copy_Chunk
(Stream,
Info.Stream.all,
Ada.Streams.Stream_Element_Count (Lh.Dd.Compressed_Size),
Feedback => Feedback);
-- Postfixed data descriptor contains the correct values for
-- CRC and sizes. Example of Zip files using that descriptor: those
-- created by Microsoft's OneDrive cloud storage (for downloading
-- more than one file), in 2018.
if Data_Descriptor_After_Data then
-- NB: some faulty JAR files may fail with Read_and_check.
-- See UnZip.Decompress, Process_descriptor.
Zip.Headers.Read_And_Check (Stream, Lh.Dd);
-- lh's values have been corrected on the way.
Zip.Headers.Write (Info.Stream.all, Lh.Dd); -- Copy descriptor to new stream.
end if;
Info.Contains (Info.Last_Entry).Head.Short_Info := Lh;
end Add_Compressed_Stream;
procedure Finish (Info : in out Zip_Create_Info) is
procedure Dispose is new Ada.Unchecked_Deallocation (String, P_String);
Ed : Zip.Headers.End_Of_Central_Dir;
Current_Index : Zs_Index_Type;
procedure Get_Index_And_Check_Zip_32_Limit is
begin
Current_Index := Index (Info.Stream.all);
if Info.Zip_Archive_Format = Zip_32 and then Current_Index > Four_GB then
raise Zip_Capacity_Exceeded with Zip_32_Exceeded_Message;
end if;
end Get_Index_And_Check_Zip_32_Limit;
begin
-- 2/ Almost done - write Central Directory
Get_Index_And_Check_Zip_32_Limit;
Ed.Central_Dir_Offset := Unsigned_32 (Current_Index) - 1;
Ed.Total_Entries := 0;
Ed.Central_Dir_Size := 0;
Ed.Main_Comment_Length := Unsigned_16 (SU.Length (Info.Comment));
if Info.Zip_Archive_Format = Zip_32
and then Info.Last_Entry > Integer (Unsigned_16'Last)
then
raise Zip_Capacity_Exceeded with
"Too many entries (for Zip_32 archive format): more than 65535.";
end if;
if Info.Contains /= null then
for E in 1 .. Info.Last_Entry loop
Ed.Total_Entries := Ed.Total_Entries + 1;
Zip.Headers.Write (Info.Stream.all, Info.Contains (E).Head);
String'Write (Info.Stream, Info.Contains (E).Name.all);
-- The extra field here is assumed to be empty!
Ed.Central_Dir_Size :=
Ed.Central_Dir_Size +
Zip.Headers.Central_Header_Length +
Unsigned_32 (Info.Contains (E).Head.Short_Info.Filename_Length);
Dispose (Info.Contains (E).Name);
Get_Index_And_Check_Zip_32_Limit;
end loop;
Dispose (Info.Contains);
end if;
Info.Last_Entry := 0;
Ed.Disknum := 0;
Ed.Disknum_With_Start := 0;
Ed.Disk_Total_Entries := Ed.Total_Entries;
Zip.Headers.Write (Info.Stream.all, Ed);
if Ed.Main_Comment_Length > 0 then
String'Write (Info.Stream, SU.To_String (Info.Comment));
end if;
Get_Index_And_Check_Zip_32_Limit;
-- File will be closed automatically when stream goes out of scope
Info.Stream := null;
end Finish;
end DCF.Zip.Create;
|
data/pokemon/dex_entries/jabetta.asm | AtmaBuster/pokeplat-gen2 | 6 | 5092 | <reponame>AtmaBuster/pokeplat-gen2<filename>data/pokemon/dex_entries/jabetta.asm
db "FLYINGFISH@" ; species name
db "It often settles"
next "territorial feuds"
next "with a duel."
page "Their fights may"
next "damage nearby"
next "coral reefs.@"
|
libsrc/_DEVELOPMENT/sound/bit/c/sdcc_iy/bit_beep_raw_callee.asm | jpoikela/z88dk | 640 | 240599 |
; void bit_beep_raw_callee(uint16_t num_cycles, uint16_t tone_period_T)
SECTION code_clib
SECTION code_sound_bit
PUBLIC _bit_beep_raw_callee
EXTERN asm_bit_beep_raw
_bit_beep_raw_callee:
pop af
pop hl
pop de
push af
jp asm_bit_beep_raw
|
src/testprogram.asm | drdanick/apricot-os | 0 | 98599 | <reponame>drdanick/apricot-os<filename>src/testprogram.asm
; asmsyntax=apricos
; Sample program for ApricotOS
;
; To execute this program, assemble it along with
; the rest of the OS, and execute it by entering
; 'memexec 1500' ino the shell.
#segment 0x15
#name "testprogram"
#include "apricotos.asm"
#include "disp.asm"
LDI MESSAGE
ASET 8
LDah
ASET 9
LDal
ASET 10
OS_CALLFUNC LIBDISP_PUTSTR
OS_PROG_EXIT
MESSAGE: .stringz "Hello! You have just executed ApricotOS' first program!\n"
|
src/Ch2-5.agda | banacorn/hott | 0 | 5591 | {-# OPTIONS --without-K #-}
module Ch2-5 where
open import Level hiding (lift)
open import Ch2-1
open import Ch2-2
open import Ch2-3
open import Ch2-4
open import Data.Product
open import Function using (_∘_; id)
-- Example 2.5.1 (equivalence)
Example-2-5-1 : ∀ {a b} {A : Set a} {B : Set b}
→ (a a' : A) (b b' : B)
→ ((a , b) ≡ (a' , b')) ≅ ((a ≡ a') × (b ≡ b'))
Example-2-5-1 {_} {_} {A} {B} a a' b b' = f , f-isequiv
where
f : ∀ {a b a' b'} → (a , b) ≡ (a' , b') → a ≡ a' × b ≡ b'
f {a} {b} {a'} {b'} eq = J (A × B) D d (a , b) (a' , b') eq
where
D : (x y : A × B) → (p : x ≡ y) → Set _
D (a , b) (a' , b') p = a ≡ a' × b ≡ b'
d : (x : A × B) → D x x refl
d x = refl , refl
f-isequiv : isequiv f
f-isequiv = (g , α) , (g , β)
where
g : ∀ {a b a' b'} → a ≡ a' × b ≡ b' → (a , b) ≡ (a' , b')
g {a} {b} {a'} {b'} (fst , snd) = J A D d a a' fst b b' snd
where
D : (a a' : A) → (p : a ≡ a') → Set _
D a a' p = (b b' : B) (q : b ≡ b') → (a , b) ≡ (a' , b')
d : (x : A) → D x x refl
d x b b' q = J B E e b b' q
where
E : (b b' : B) → (q : b ≡ b') → Set _
E b b' q = (x , b) ≡ (x , b')
e : (x : B) → E x x refl
e x = refl
α : f ∘ g ~ id
α (fst , snd) = J A D d a a' fst b b' snd
where
D : (x y : A) (p : x ≡ y) → Set _
D x y p = (x' y' : B) (snd : x' ≡ y')
→ (f ∘ g) (p , snd) ≡ ((p , snd))
d : (x : A) → D x x refl
d x x' y' q = J B E e x' y' q
where
E : (x' y' : B) (q : x' ≡ y') → Set _
E x' y' q = (f ∘ g) (refl , q) ≡ ((refl , q))
e : (x' : B) → E x' x' refl
e x' = refl
β : g ∘ f ~ id
β p = J (A × B) D d (a , b) (a' , b') p
where
D : (x y : A × B) (p : x ≡ y) → Set _
D x y p = (g ∘ f) p ≡ p
d : (x : A × B) → D x x refl
d x = refl
|
src/render.adb | thomas070605/shoot-n-loot | 0 | 2129 | <filename>src/render.adb
-- Shoot'n'loot
-- Copyright (c) 2020 <NAME>
with HAL; use HAL;
with PyGamer.Screen;
with PyGamer.Time;
with PyGamer.Controls;
use PyGamer;
with Sound;
package body Render is
Buffer_Size : constant Positive :=
PyGamer.Screen.Width * PyGamer.Screen.Height;
Render_Buffer : GESTE.Output_Buffer (1 .. Buffer_Size);
-----------------
-- Push_Pixels --
-----------------
procedure Push_Pixels (Buffer : GESTE.Output_Buffer) is
begin
PyGamer.Screen.Push_Pixels (Buffer'Address, Buffer'Length);
end Push_Pixels;
----------------------
-- Set_Drawing_Area --
----------------------
procedure Set_Drawing_Area (Area : GESTE.Pix_Rect) is
begin
PyGamer.Screen.End_Pixel_TX;
PyGamer.Screen.Set_Address (X_Start => HAL.UInt16 (Area.TL.X),
X_End => HAL.UInt16 (Area.BR.X),
Y_Start => HAL.UInt16 (Area.TL.Y),
Y_End => HAL.UInt16 (Area.BR.Y));
PyGamer.Screen.Start_Pixel_TX;
end Set_Drawing_Area;
----------------
-- Render_All --
----------------
procedure Render_All (Background : GESTE_Config.Output_Color) is
begin
GESTE.Render_All
(((0, 0), (Screen.Width - 1, Screen.Height - 1)),
Background,
Render_Buffer,
Push_Pixels'Access,
Set_Drawing_Area'Access);
PyGamer.Screen.End_Pixel_TX;
end Render_All;
------------------
-- Render_Dirty --
------------------
procedure Render_Dirty (Background : GESTE_Config.Output_Color) is
begin
GESTE.Render_Dirty
(((0, 0), (Screen.Width - 1, Screen.Height - 1)),
Background,
Render_Buffer,
Push_Pixels'Access,
Set_Drawing_Area'Access);
PyGamer.Screen.End_Pixel_TX;
end Render_Dirty;
----------------------
-- Scroll_New_Scene --
----------------------
procedure Scroll_New_Scene (Background : GESTE_Config.Output_Color)
is
Period : constant Time.Time_Ms := 1000 / 60;
Next_Release : Time.Time_Ms := Time.Clock + Period;
Scroll : UInt8 := PyGamer.Screen.Width;
Step : constant := 2;
X : Natural := 0;
begin
for Count in 1 .. PyGamer.Screen.Width / Step loop
Scroll := Scroll - Step;
Screen.Scroll (Scroll);
-- Render one column of pixel at Width - Scroll
GESTE.Render_All
(((X, 0),
(X + Step - 1, Screen.Height - 1)),
Background,
Render_Buffer,
Push_Pixels'Access,
Set_Drawing_Area'Access);
X := X + Step;
Screen.End_Pixel_TX;
Sound.Tick;
Controls.Scan;
Time.Delay_Until (Next_Release);
Next_Release := Next_Release + Period;
end loop;
end Scroll_New_Scene;
----------------------
-- Background_Color --
----------------------
function Background_Color return GESTE_Config.Output_Color
is (To_RGB565 (51, 153, 204));
---------------
-- To_RGB565 --
---------------
function To_RGB565 (R, G, B : Unsigned_8) return Unsigned_16 is
R16 : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (R), 3) and 16#1F#;
G16 : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (G), 2) and 16#3F#;
B16 : constant Unsigned_16 :=
Shift_Right (Unsigned_16 (B), 3) and 16#1F#;
RGB : constant Unsigned_16 :=
(Shift_Left (R16, 11) or Shift_Left (G16, 5) or B16);
begin
return Shift_Right (RGB and 16#FF00#, 8) or
(Shift_Left (RGB, 8) and 16#FF00#);
end To_RGB565;
end Render;
|
test_programs/cycle_count.asm | mfkiwl/QNICE-FPGA-hyperRAM | 53 | 81680 | <reponame>mfkiwl/QNICE-FPGA-hyperRAM
; tests the hardware clock cycle counter and is meant to
; run as rom within the simululator
; done by sy2002 in May 2016
#include "../dist_kit/sysdef.asm"
#include "../dist_kit/monitor.def"
.ORG 0x0000
; excecute some arbitrary MOVES to get the counter going
MOVE 0x0023, R0
MOVE 0x8000, R1
MOVE R0, @R1
; read the lower 16 bit of the counter into R3
MOVE IO$CYC_LO, R2
MOVE @R2, R3
; stop the counter
MOVE IO$CYC_STATE, R4
MOVE 0, @R4
MOVE @R2, R5
; test if stop worked
NOP
NOP
MOVE @R2, R6 ; R5 must be equal to R6
; restart the counter
MOVE 2, @R4
; test if the restart worked
NOP
NOP
MOVE @R2, R7 ; R7 must be higher than R6
; stop the counter again
MOVE 0, @R4
; reset (and therefore automatically restart) the counter
MOVE 1, @R4
; test if the reset and restart worked
NOP
NOP
MOVE @R2, R8 ; R8 must be lower than R7
HALT
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt49.adb | best08618/asylo | 7 | 11772 | <gh_stars>1-10
-- { dg-do run }
-- { dg-options "-O -fstack-check" }
procedure Opt49 is
function Ident (I : Integer) return Integer;
pragma No_Inline (Ident);
function Ident (I : Integer) return Integer is
begin
return I;
end;
Int_0 : Integer := Ident (0);
Int_4 : Integer := Ident (4);
A : array (-4 .. Int_4) of Integer;
begin
A := (-4 , -3 , -2 , -1 , 100 , 1 , 2 , 3 , 4);
A (-4 .. Int_0) := A (Int_0 .. 4);
if A /= (100 , 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4) then
raise Program_Error;
end if;
A := (-4 , -3 , -2 , -1 , 100 , 1 , 2 , 3 , 4);
A (Int_0 .. 4) := A (-4 .. Int_0);
if A /= (-4 , -3 , -2 , -1 , -4 , -3 , -2 , -1 , 100) then
raise Program_Error;
end if;
end;
|
disjointness.agda | hazelgrove/hazelnut-agda | 0 | 15885 | <filename>disjointness.agda
open import Prelude
open import Nat
open import contexts
open import dom-eq
open import dynamics-core
open import lemmas-disjointness
open import statics-core
module disjointness where
-- if a hole name is new in a term, then the resultant context is
-- disjoint from any singleton context with that hole name
mutual
elab-new-disjoint-synth : ∀ {e u τ d Δ Γ Γ' τ'} →
hole-name-new e u →
Γ ⊢ e ⇒ τ ~> d ⊣ Δ →
Δ ## (■ (u , Γ' , τ'))
elab-new-disjoint-synth HNNum ESNum = empty-disj _
elab-new-disjoint-synth (HNPlus hn hn₁) (ESPlus apt x x₁ x₂) = disjoint-parts (elab-new-disjoint-ana hn x₁) (elab-new-disjoint-ana hn₁ x₂)
elab-new-disjoint-synth (HNAsc hn) (ESAsc x) = elab-new-disjoint-ana hn x
elab-new-disjoint-synth HNVar (ESVar x₁) = empty-disj (■ (_ , _ , _))
elab-new-disjoint-synth (HNLam2 hn) (ESLam x₁ exp) = elab-new-disjoint-synth hn exp
elab-new-disjoint-synth (HNHole x) ESEHole = disjoint-singles x
elab-new-disjoint-synth (HNNEHole x hn) (ESNEHole x₁ exp) = disjoint-parts (disjoint-singles x) (elab-new-disjoint-synth hn exp)
elab-new-disjoint-synth (HNAp hn hn₁) (ESAp x x₁ x₂ x₃ x₄ x₅) =
disjoint-parts (elab-new-disjoint-ana hn x₄)
(elab-new-disjoint-ana hn₁ x₅)
elab-new-disjoint-synth (HNPair hn hn₁) (ESPair x x₁ exp exp₁) = disjoint-parts (elab-new-disjoint-synth hn exp) (elab-new-disjoint-synth hn₁ exp₁)
elab-new-disjoint-synth (HNLam1 hn) ()
elab-new-disjoint-synth (HNInl hn) ()
elab-new-disjoint-synth (HNInr hn) ()
elab-new-disjoint-synth (HNCase hn hn₁ hn₂) ()
elab-new-disjoint-synth (HNFst hn) (ESFst x x₁ x₂) = elab-new-disjoint-ana hn x₂
elab-new-disjoint-synth (HNSnd hn) (ESSnd x x₁ x₂) = elab-new-disjoint-ana hn x₂
elab-new-disjoint-ana : ∀{e u τ d Δ Γ Γ' τ' τ2} →
hole-name-new e u →
Γ ⊢ e ⇐ τ ~> d :: τ2 ⊣ Δ →
Δ ## (■ (u , Γ' , τ'))
elab-new-disjoint-ana hn (EASubsume x x₁ x₂ x₃) = elab-new-disjoint-synth hn x₂
elab-new-disjoint-ana (HNLam1 hn) (EALam x₁ x₂ ex) = elab-new-disjoint-ana hn ex
elab-new-disjoint-ana (HNHole x) EAEHole = disjoint-singles x
elab-new-disjoint-ana (HNNEHole x hn) (EANEHole x₁ x₂) = disjoint-parts (disjoint-singles x) (elab-new-disjoint-synth hn x₂)
elab-new-disjoint-ana (HNInl hn) (EAInl x x₁) = elab-new-disjoint-ana hn x₁
elab-new-disjoint-ana (HNInr hn) (EAInr x x₁) = elab-new-disjoint-ana hn x₁
elab-new-disjoint-ana (HNCase hn hn₁ hn₂) (EACase x x₁ x₂ x₃ x₄ x₅ _ _ x₆ x₇ x₈ x₉) = disjoint-parts (elab-new-disjoint-synth hn x₆) (disjoint-parts (elab-new-disjoint-ana hn₁ x₈) (elab-new-disjoint-ana hn₂ x₉))
-- dual of the above: if elaborating a term produces a context that's
-- disjoint with a singleton context, it must be that the index is a new
-- hole name in the original term
mutual
elab-disjoint-new-synth : ∀{e τ d Δ u Γ Γ' τ'} →
Γ ⊢ e ⇒ τ ~> d ⊣ Δ →
Δ ## (■ (u , Γ' , τ')) →
hole-name-new e u
elab-disjoint-new-synth ESNum disj = HNNum
elab-disjoint-new-synth (ESPlus {Δ1 = Δ1} apt x x₁ x₂) disj
with elab-disjoint-new-ana x₁ (disjoint-union1 disj) | elab-disjoint-new-ana x₂ (disjoint-union2 {Γ1 = Δ1} disj)
... | ih1 | ih2 = HNPlus ih1 ih2
elab-disjoint-new-synth (ESVar x₁) disj = HNVar
elab-disjoint-new-synth (ESLam x₁ ex) disj = HNLam2 (elab-disjoint-new-synth ex disj)
elab-disjoint-new-synth (ESAp {Δ1 = Δ1} x x₁ x₂ x₃ x₄ x₅) disj
with elab-disjoint-new-ana x₄ (disjoint-union1 disj) | elab-disjoint-new-ana x₅ (disjoint-union2 {Γ1 = Δ1} disj)
... | ih1 | ih2 = HNAp ih1 ih2
elab-disjoint-new-synth {Γ = Γ} ESEHole disj = HNHole (singles-notequal disj)
elab-disjoint-new-synth {Γ = Γ} (ESNEHole {u = u} {Δ = Δ} x ex) disj = HNNEHole (singles-notequal (disjoint-union1 {Γ2 = Δ} disj)) (elab-disjoint-new-synth ex (disjoint-union2 {Γ1 = ■ (u , Γ , ⦇-⦈)} {Γ2 = Δ} disj))
elab-disjoint-new-synth (ESAsc x) disj = HNAsc (elab-disjoint-new-ana x disj)
elab-disjoint-new-synth (ESPair {Δ1 = Δ1} {Δ2 = Δ2} x x₁ x₂ x₃) disj = HNPair (elab-disjoint-new-synth x₂ (disjoint-union1 {Γ1 = Δ1} {Γ2 = Δ2} disj)) (elab-disjoint-new-synth x₃ (disjoint-union2 {Γ1 = Δ1} {Γ2 = Δ2} disj))
elab-disjoint-new-synth (ESFst x x₁ x₂) disj = HNFst (elab-disjoint-new-ana x₂ disj)
elab-disjoint-new-synth (ESSnd x x₁ x₂) disj = HNSnd (elab-disjoint-new-ana x₂ disj)
elab-disjoint-new-ana : ∀{e τ d Δ u Γ Γ' τ2 τ'} →
Γ ⊢ e ⇐ τ ~> d :: τ2 ⊣ Δ →
Δ ## (■ (u , Γ' , τ')) →
hole-name-new e u
elab-disjoint-new-ana (EALam x₁ x₂ ex) disj = HNLam1 (elab-disjoint-new-ana ex disj)
elab-disjoint-new-ana (EASubsume x x₁ x₂ x₃) disj = elab-disjoint-new-synth x₂ disj
elab-disjoint-new-ana EAEHole disj = HNHole (singles-notequal disj)
elab-disjoint-new-ana {Γ = Γ} (EANEHole {u = u} {τ = τ} {Δ = Δ} x x₁) disj = HNNEHole (singles-notequal (disjoint-union1 {Γ2 = Δ} disj)) (elab-disjoint-new-synth x₁ (disjoint-union2 {Γ1 = ■ (u , Γ , τ)} {Γ2 = Δ} disj))
elab-disjoint-new-ana (EAInl x x₁) disj = HNInl (elab-disjoint-new-ana x₁ disj)
elab-disjoint-new-ana (EAInr x x₁) disj = HNInr (elab-disjoint-new-ana x₁ disj)
elab-disjoint-new-ana {Γ = Γ} (EACase {Δ = Δ} {Δ1 = Δ1} {Δ2 = Δ2} x x₁ x₂ x₃ x₄ x₅ _ _ x₆ x₇ x₈ x₉) disj = HNCase (elab-disjoint-new-synth x₆ (disjoint-union1 disj)) (elab-disjoint-new-ana x₈ (disjoint-union1 {Γ2 = Δ2} (disjoint-union2 {Γ1 = Δ} disj))) (elab-disjoint-new-ana x₉ (disjoint-union2 {Γ1 = Δ1} (disjoint-union2 {Γ1 = Δ} disj)))
-- collect up the hole names of a term as the indices of a trivial context
data holes : (e : hexp) (H : ⊤ ctx) → Set where
HNum : ∀{n} → holes (N n) ∅
HPlus : ∀{e1 e2 H1 H2} → holes e1 H1 → holes e2 H2 → holes (e1 ·+ e2) (H1 ∪ H2)
HAsc : ∀{e τ H} → holes e H → holes (e ·: τ) H
HVar : ∀{x} → holes (X x) ∅
HLam1 : ∀{x e H} → holes e H → holes (·λ x e) H
HLam2 : ∀{x e τ H} → holes e H → holes (·λ x ·[ τ ] e) H
HAp : ∀{e1 e2 H1 H2} → holes e1 H1 → holes e2 H2 → holes (e1 ∘ e2) (H1 ∪ H2)
HInl : ∀{e H} → holes e H → holes (inl e) H
HInr : ∀{e H} → holes e H → holes (inr e) H
HCase : ∀{e x e1 y e2 H H1 H2} → holes e H → holes e1 H1 → holes e2 H2 → holes (case e x e1 y e2) (H ∪ (H1 ∪ H2))
HPair : ∀{e1 e2 H1 H2} → holes e1 H1 → holes e2 H2 → holes ⟨ e1 , e2 ⟩ (H1 ∪ H2)
HFst : ∀{e H} → holes e H → holes (fst e) H
HSnd : ∀{e H} → holes e H → holes (snd e) H
HEHole : ∀{u} → holes (⦇-⦈[ u ]) (■ (u , <>))
HNEHole : ∀{e u H} → holes e H → holes (⦇⌜ e ⌟⦈[ u ]) (H ,, (u , <>))
-- the above judgement has mode (∀,∃). this doesn't prove uniqueness; any
-- context that extends the one computed here will be indistinguishable
-- but we'll treat this one as canonical
find-holes : (e : hexp) → Σ[ H ∈ ⊤ ctx ](holes e H)
find-holes (N n) = ∅ , HNum
find-holes (e1 ·+ e2) with find-holes e1 | find-holes e2
... | (h1 , d1) | (h2 , d2) = (h1 ∪ h2 ) , (HPlus d1 d2)
find-holes (e ·: x) with find-holes e
... | (h , d) = h , (HAsc d)
find-holes (X x) = ∅ , HVar
find-holes (·λ x e) with find-holes e
... | (h , d) = h , HLam1 d
find-holes (·λ x ·[ x₁ ] e) with find-holes e
... | (h , d) = h , HLam2 d
find-holes (e1 ∘ e2) with find-holes e1 | find-holes e2
... | (h1 , d1) | (h2 , d2) = (h1 ∪ h2 ) , (HAp d1 d2)
find-holes ⦇-⦈[ x ] = (■ (x , <>)) , HEHole
find-holes ⦇⌜ e ⌟⦈[ x ] with find-holes e
... | (h , d) = h ,, (x , <>) , HNEHole d
find-holes (inl e) with find-holes e
... | (h , d) = h , HInl d
find-holes (inr e) with find-holes e
... | (h , d) = h , HInr d
find-holes (case e x e₁ x₁ e₂) with find-holes e | find-holes e₁ | find-holes e₂
... | (h , d) | (h1 , d1) | (h2 , d2) = (h ∪ (h1 ∪ h2)) , HCase d d1 d2
find-holes ⟨ e , e₁ ⟩ with find-holes e | find-holes e₁
... | (h , d) | (h1 , d1) = h ∪ h1 , HPair d d1
find-holes (fst e) with find-holes e
... | (h , d) = h , HFst d
find-holes (snd e) with find-holes e
... | (h , d) = h , HSnd d
-- if a hole name is new then it's apart from the collection of hole
-- names
lem-apart-new : ∀{e H u} → holes e H → hole-name-new e u → u # H
lem-apart-new HNum x = refl
lem-apart-new (HPlus {H1 = H1} {H2 = H2} h h₁) (HNPlus hn hn₁) = apart-parts H1 H2 _ (lem-apart-new h hn) (lem-apart-new h₁ hn₁)
lem-apart-new (HAsc h) (HNAsc hn) = lem-apart-new h hn
lem-apart-new HVar HNVar = refl
lem-apart-new (HLam1 h) (HNLam1 hn) = lem-apart-new h hn
lem-apart-new (HLam2 h) (HNLam2 hn) = lem-apart-new h hn
lem-apart-new (HAp {H1 = H1} {H2 = H2} h h₁) (HNAp hn hn₁) = apart-parts H1 H2 _ (lem-apart-new h hn) (lem-apart-new h₁ hn₁)
lem-apart-new HEHole (HNHole x) = apart-singleton (flip x)
lem-apart-new (HNEHole {u = u'} {H = H} h) (HNNEHole {u = u} x hn) = apart-parts (■ (u' , <>)) H u (apart-singleton (flip x)) (lem-apart-new h hn)
lem-apart-new (HInl h) (HNInl hn) = lem-apart-new h hn
lem-apart-new (HInr h) (HNInr hn) = lem-apart-new h hn
lem-apart-new (HCase {H = H} {H1 = H1} {H2 = H2} h h₁ h₂) (HNCase {u = u'} hn hn₁ hn₂) = apart-parts H (H1 ∪ H2) u' (lem-apart-new h hn) (apart-parts H1 H2 u' (lem-apart-new h₁ hn₁) (lem-apart-new h₂ hn₂))
lem-apart-new (HPair {H1 = H1} {H2 = H2} h h₁) (HNPair {u = u} hn hn₁) = apart-parts H1 H2 u (lem-apart-new h hn) (lem-apart-new h₁ hn₁)
lem-apart-new (HFst h) (HNFst hn) = lem-apart-new h hn
lem-apart-new (HSnd h) (HNSnd hn) = lem-apart-new h hn
-- if the holes of two expressions are disjoint, so are their collections
-- of hole names
holes-disjoint-disjoint : ∀{e1 e2 H1 H2} →
holes e1 H1 →
holes e2 H2 →
holes-disjoint e1 e2 →
H1 ## H2
holes-disjoint-disjoint HNum he2 HDNum = empty-disj _
holes-disjoint-disjoint (HPlus he1 he2) he3 (HDPlus hd hd₁) = disjoint-parts (holes-disjoint-disjoint he1 he3 hd) (holes-disjoint-disjoint he2 he3 hd₁)
holes-disjoint-disjoint (HAsc he1) he2 (HDAsc hd) = holes-disjoint-disjoint he1 he2 hd
holes-disjoint-disjoint HVar he2 HDVar = empty-disj _
holes-disjoint-disjoint (HLam1 he1) he2 (HDLam1 hd) = holes-disjoint-disjoint he1 he2 hd
holes-disjoint-disjoint (HLam2 he1) he2 (HDLam2 hd) = holes-disjoint-disjoint he1 he2 hd
holes-disjoint-disjoint (HAp he1 he2) he3 (HDAp hd hd₁) = disjoint-parts (holes-disjoint-disjoint he1 he3 hd) (holes-disjoint-disjoint he2 he3 hd₁)
holes-disjoint-disjoint HEHole he2 (HDHole x) = lem-apart-sing-disj (lem-apart-new he2 x)
holes-disjoint-disjoint (HNEHole he1) he2 (HDNEHole x hd) = disjoint-parts (lem-apart-sing-disj (lem-apart-new he2 x)) (holes-disjoint-disjoint he1 he2 hd)
holes-disjoint-disjoint (HInl he1) he2 (HDInl hd) = holes-disjoint-disjoint he1 he2 hd
holes-disjoint-disjoint (HInr he1) he2 (HDInr hd) = holes-disjoint-disjoint he1 he2 hd
holes-disjoint-disjoint (HCase he1 he3 he4) he2 (HDCase hd hd₁ hd₂) = disjoint-parts (holes-disjoint-disjoint he1 he2 hd) (disjoint-parts (holes-disjoint-disjoint he3 he2 hd₁) (holes-disjoint-disjoint he4 he2 hd₂))
holes-disjoint-disjoint (HPair he1 he3) he2 (HDPair hd hd₁) = disjoint-parts (holes-disjoint-disjoint he1 he2 hd) (holes-disjoint-disjoint he3 he2 hd₁)
holes-disjoint-disjoint (HFst he1) he2 (HDFst hd) = holes-disjoint-disjoint he1 he2 hd
holes-disjoint-disjoint (HSnd he1) he2 (HDSnd hd) = holes-disjoint-disjoint he1 he2 hd
-- the holes of an expression have the same domain as the context
-- produced during expansion; that is, we don't add anything we don't
-- find in the term during expansion.
mutual
holes-delta-ana : ∀{Γ H e τ d τ' Δ} →
holes e H →
Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ →
dom-eq Δ H
holes-delta-ana (HLam1 h) (EALam x₁ x₂ exp) = holes-delta-ana h exp
holes-delta-ana h (EASubsume x x₁ x₂ x₃) = holes-delta-synth h x₂
holes-delta-ana (HEHole {u = u}) EAEHole = dom-single u
holes-delta-ana (HNEHole {u = u} h) (EANEHole x x₁) = dom-union (lem-apart-sing-disj (lem-apart-new h (elab-disjoint-new-synth x₁ x))) (dom-single u) (holes-delta-synth h x₁)
holes-delta-ana (HInl h) (EAInl x x₁) = holes-delta-ana h x₁
holes-delta-ana (HInr h) (EAInr x x₁) = holes-delta-ana h x₁
holes-delta-ana (HCase h h₁ h₂) (EACase {Δ = Δ} x x₁ x₂ x₃ x₄ x₅ _ _ x₆ x₇ x₈ x₉) = dom-union (##-comm (disjoint-parts (##-comm (holes-disjoint-disjoint h h₁ x)) (##-comm (holes-disjoint-disjoint h h₂ x₁)))) (holes-delta-synth h x₆) (dom-union (holes-disjoint-disjoint h₁ h₂ x₂) (holes-delta-ana h₁ x₈) (holes-delta-ana h₂ x₉))
holes-delta-synth : ∀{Γ H e τ d Δ} →
holes e H →
Γ ⊢ e ⇒ τ ~> d ⊣ Δ →
dom-eq Δ H
holes-delta-synth HNum ESNum = dom-∅
holes-delta-synth (HPlus h h₁) (ESPlus x apt x₁ x₂) = dom-union (holes-disjoint-disjoint h h₁ x) (holes-delta-ana h x₁) (holes-delta-ana h₁ x₂)
holes-delta-synth (HAsc h) (ESAsc x) = holes-delta-ana h x
holes-delta-synth HVar (ESVar x₁) = dom-∅
holes-delta-synth (HLam2 h) (ESLam x₁ exp) = holes-delta-synth h exp
holes-delta-synth (HAp h h₁) (ESAp x x₁ x₂ x₃ x₄ x₅) = dom-union (holes-disjoint-disjoint h h₁ x) (holes-delta-ana h x₄) (holes-delta-ana h₁ x₅)
holes-delta-synth (HEHole {u = u}) ESEHole = dom-single u
holes-delta-synth (HNEHole {u = u} h) (ESNEHole x exp) = dom-union (lem-apart-sing-disj (lem-apart-new h (elab-disjoint-new-synth exp x))) (dom-single u) (holes-delta-synth h exp)
holes-delta-synth (HPair h h₁) (ESPair x x₁ exp exp₁) = dom-union (holes-disjoint-disjoint h h₁ x) (holes-delta-synth h exp) (holes-delta-synth h₁ exp₁)
holes-delta-synth (HLam1 hn) ()
holes-delta-synth (HInl hn) ()
holes-delta-synth (HInr hn) ()
holes-delta-synth (HCase hn hn₁ hn₂) ()
holes-delta-synth (HFst hn) (ESFst x x₁ x₂) = holes-delta-ana hn x₂
holes-delta-synth (HSnd hn) (ESSnd x x₁ x₂) = holes-delta-ana hn x₂
-- this is one of the main results of this file:
--
-- if you elaborate two hole-disjoint expressions analytically, the Δs
-- produced are disjoint.
--
-- the proof technique here is explcitly *not* structurally inductive on the
-- expansion judgement, because that approach relies on weakening of
-- expansion, which is false because of the substitution contexts. giving
-- expansion weakning would take away unicity, so we avoid the whole
-- question.
elab-ana-disjoint : ∀{e1 e2 τ1 τ2 e1' e2' τ1' τ2' Γ1 Γ2 Δ1 Δ2} →
holes-disjoint e1 e2 →
Γ1 ⊢ e1 ⇐ τ1 ~> e1' :: τ1' ⊣ Δ1 →
Γ2 ⊢ e2 ⇐ τ2 ~> e2' :: τ2' ⊣ Δ2 →
Δ1 ## Δ2
elab-ana-disjoint {e1} {e2} hd ana1 ana2
with find-holes e1 | find-holes e2
... | (_ , he1) | (_ , he2) = dom-eq-disj (holes-disjoint-disjoint he1 he2 hd)
(holes-delta-ana he1 ana1)
(holes-delta-ana he2 ana2)
elab-synth-disjoint : ∀{e1 e2 τ1 τ2 e1' e2' Γ1 Γ2 Δ1 Δ2} →
holes-disjoint e1 e2 →
Γ1 ⊢ e1 ⇒ τ1 ~> e1' ⊣ Δ1 →
Γ2 ⊢ e2 ⇒ τ2 ~> e2' ⊣ Δ2 →
Δ1 ## Δ2
elab-synth-disjoint {e1} {e2} hd synth1 synth2
with find-holes e1 | find-holes e2
... | (_ , he1) | (_ , he2) = dom-eq-disj (holes-disjoint-disjoint he1 he2 hd)
(holes-delta-synth he1 synth1)
(holes-delta-synth he2 synth2)
elab-synth-ana-disjoint : ∀{e1 e2 τ1 τ2 e1' e2' τ2' Γ1 Γ2 Δ1 Δ2} →
holes-disjoint e1 e2 →
Γ1 ⊢ e1 ⇒ τ1 ~> e1' ⊣ Δ1 →
Γ2 ⊢ e2 ⇐ τ2 ~> e2' :: τ2' ⊣ Δ2 →
Δ1 ## Δ2
elab-synth-ana-disjoint {e1} {e2} hd synth ana
with find-holes e1 | find-holes e2
... | (_ , he1) | (_ , he2) = dom-eq-disj (holes-disjoint-disjoint he1 he2 hd)
(holes-delta-synth he1 synth)
(holes-delta-ana he2 ana)
|
Engine/Irq/IrqPsgRaster.asm | wide-dot/thomson-to8-game-engine | 11 | 247597 | <reponame>wide-dot/thomson-to8-game-engine
* ---------------------------------------------------------------------------
* IrqPsgRaster/IrqPsg
* ------
* IRQ Subroutine to play sound with SN76489 and render some Raster lines
*
* input REG : [dp] with value E7 (from Monitor ROM)
* reset REG : none
*
* IrqOn
* reset REG : [a]
*
* IrqOff
* reset REG : [a]
*
* IrqSync
* input REG : [a] screen line (0-199)
* [x] timer value
* reset REG : [d]
*
* IrqSync
* reset REG : [d]
* ---------------------------------------------------------------------------
irq_routine equ $6027
irq_timer_ctrl equ $E7C5
irq_timer equ $E7C6
irq_one_frame equ 312*64-1 ; one frame timer (lines*cycles_per_lines-1), timer launch at -1
Irq_Raster_Page fdb $00
Irq_Raster_Start fdb $0000
Irq_Raster_End fdb $0000
IrqOn
lda $6019
ora #$20
sta $6019 ; STATUS register
andcc #$EF ; tell 6809 to activate irq
rts
IrqOff
lda $6019
anda #$DF
sta $6019 ; STATUS register
orcc #$10 ; tell 6809 to activate irq
rts
IrqSync
ldb #$42
stb irq_timer_ctrl
ldb #8 ; ligne * 64 (cycles par ligne) / 8 (nb cycles boucle tempo)
mul
tfr d,y
leay -32,y ; manual adjustment
IrqSync_1
tst $E7E7 ;
bmi IrqSync_1 ; while spot is in a visible screen line
IrqSync_2
tst $E7E7 ;
bpl IrqSync_2 ; while spot is not in a visible screen line
IrqSync_3
leay -1,y ;
bne IrqSync_3 ; wait until desired line
stx irq_timer ; spot is at the end of desired line
rts
IrqPsg
_GetCartPageA
sta IrqPsg_end+1 ; backup data page
ldd Vint_runcount
addd #1
std Vint_runcount
jsr PSGFrame
* jsr PSGSFXFrame
IrqPsg_end
lda #$00
_SetCartPageA ; restore data page
jmp $E830 ; return to caller
IrqPsgRaster
_GetCartPageA
sta IrqPsgRaster_end+1 ; backup data page
lda Irq_Raster_Page
_SetCartPageA ; load Raster data page
ldx Irq_Raster_Start
lda #32
IrqPsgRaster_1
bita <$E7
beq IrqPsgRaster_1 ; while spot is not in a visible screen col
IrqPsgRaster_2
bita <$E7
bne IrqPsgRaster_2 ; while spot is in a visible screen col
mul ; tempo
mul ; tempo
nop
IrqPsgRaster_render
tfr a,b ; tempo
tfr a,b ; tempo
tfr a,b ; tempo
ldd 1,x
std >*+8
lda ,x
sta <$DB
ldd #$0000
stb <$DA
sta <$DA
leax 3,x
cmpx Irq_Raster_End
bne IrqPsgRaster_render
ldd Vint_runcount
addd #1
std Vint_runcount
jsr PSGFrame
* jsr PSGSFXFrame
IrqPsgRaster_end
lda #$00
_SetCartPageA ; restore data page
jmp $E830 ; return to caller
|
oeis/164/A164267.asm | neoneye/loda-programs | 11 | 27940 | ; A164267: A Fibonacci convolution.
; Submitted by <NAME>(s4)
; 0,1,2,7,16,46,114,309,792,2101,5456,14356,37468,98281,256998,673323,1761984,4614226,12078110,31624285,82787980,216750601,567446112,1485616392,3889356696,10182528721,26658108074,69791991919,182717549872,478361171926,1252365133866,3278735575941,8583839415648,22472786195581,58834513468208,154030763436508,403257761910964,1055742546454201,2763969838363470,7236167031882195,18944531154948960,49597426598544826,129847748372771222,339945818953263277,889989707785609876,2330023305538469521
mov $2,$0
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
add $3,$1
lpb $0
mov $0,$2
add $1,1
add $3,2
lpe
add $3,$0
add $1,$3
lpe
mov $0,$3
div $0,2
|
source/image/required/s-valenu.ads | ytomino/drake | 33 | 10534 | pragma License (Unrestricted);
-- implementation unit required by compiler
package System.Val_Enum is
pragma Pure;
-- required for Enum'Value by compiler (s-valenu.ads)
function Value_Enumeration_8 (
Names : String;
Indexes : Address;
Num : Natural;
Str : String)
return Natural;
function Value_Enumeration_16 (
Names : String;
Indexes : Address;
Num : Natural;
Str : String)
return Natural;
function Value_Enumeration_32 (
Names : String;
Indexes : Address;
Num : Natural;
Str : String)
return Natural;
pragma Pure_Function (Value_Enumeration_8);
pragma Pure_Function (Value_Enumeration_16);
pragma Pure_Function (Value_Enumeration_32);
-- helper
procedure Trim (S : String; First : out Positive; Last : out Natural);
procedure To_Upper (S : in out String);
end System.Val_Enum;
|
alloy4fun_models/trainstlt/models/4/oQ7dH4k3uHJ3yGNWn.als | Kaixi26/org.alloytools.alloy | 0 | 2627 | open main
pred idoQ7dH4k3uHJ3yGNWn_prop5 {
all t:Train |{
always (t.pos in Exit implies no t.pos')
}
}
pred __repair { idoQ7dH4k3uHJ3yGNWn_prop5 }
check __repair { idoQ7dH4k3uHJ3yGNWn_prop5 <=> prop5o } |
source/interfaces/machine-w64-mingw32/s-cencod.ads | ytomino/drake | 33 | 14882 | <filename>source/interfaces/machine-w64-mingw32/s-cencod.ads
pragma License (Unrestricted);
-- implementation unit specialized for Windows
with C;
package System.C_Encoding is
pragma Preelaborate;
-- Character (UTF-8) from/to char (MBCS)
function To_char (
Item : Character;
Substitute : C.char)
return C.char;
function To_Character (
Item : C.char;
Substitute : Character)
return Character;
procedure To_Non_Nul_Terminated (
Item : String;
Target : out C.char_array;
Count : out C.size_t;
Substitute : C.char_array);
procedure From_Non_Nul_Terminated (
Item : C.char_array;
Target : out String;
Count : out Natural;
Substitute : String); -- unreferenced
Expanding_To_char : constant := 1;
Expanding_To_Character : constant := 3; -- halfwidth kana
-- Wide_Character (UTF-16) from/to wchar_t (UTF-16)
function To_wchar_t (
Item : Wide_Character;
Substitute : C.wchar_t) -- unreferenced
return C.wchar_t;
pragma Inline (To_wchar_t);
function To_Wide_Character (
Item : C.wchar_t;
Substitute : Wide_Character) -- unreferenced
return Wide_Character;
pragma Inline (To_Wide_Character);
procedure To_Non_Nul_Terminated (
Item : Wide_String;
Target : out C.wchar_t_array;
Count : out C.size_t;
Substitute : C.wchar_t_array); -- unreferenced
procedure From_Non_Nul_Terminated (
Item : C.wchar_t_array;
Target : out Wide_String;
Count : out Natural;
Substitute : Wide_String); -- unreferenced
Expanding_From_Wide_To_wchar_t : constant := 1;
Expanding_From_wchar_t_To_Wide : constant := 1;
-- Wide_Wide_Character (UTF-32) from/to wchar_t (UTF-16)
function To_wchar_t (
Item : Wide_Wide_Character;
Substitute : C.wchar_t)
return C.wchar_t;
function To_Wide_Wide_Character (
Item : C.wchar_t;
Substitute : Wide_Wide_Character)
return Wide_Wide_Character;
procedure To_Non_Nul_Terminated (
Item : Wide_Wide_String;
Target : out C.wchar_t_array;
Count : out C.size_t;
Substitute : C.wchar_t_array);
procedure From_Non_Nul_Terminated (
Item : C.wchar_t_array;
Target : out Wide_Wide_String;
Count : out Natural;
Substitute : Wide_Wide_String);
Expanding_From_Wide_Wide_To_wchar_t : constant :=
2; -- Expanding_From_32_To_16
Expanding_From_wchar_t_To_Wide_Wide : constant :=
1; -- Expanding_From_16_To_32
end System.C_Encoding;
|
tests/typing/bad/testfile-type-3.adb | xuedong/mini-ada | 0 | 1162 | with Ada.Text_IO; use Ada.Text_IO;
procedure P is type t; type t; begin put('a'); end;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_62_377.asm | ljhsiun2/medusa | 9 | 21030 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0.log_62_377.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x14115, %rsi
lea addresses_normal_ht+0x1c315, %rdi
clflush (%rdi)
nop
nop
sub $8682, %r15
mov $43, %rcx
rep movsq
add %rax, %rax
lea addresses_UC_ht+0x15e95, %r10
nop
nop
nop
xor $28743, %rbp
movb (%r10), %al
nop
nop
nop
nop
nop
inc %r10
lea addresses_UC_ht+0xfd15, %rsi
lea addresses_WT_ht+0x1c515, %rdi
nop
nop
sub $61482, %r9
mov $108, %rcx
rep movsl
nop
nop
nop
nop
sub %r10, %r10
lea addresses_WT_ht+0x10855, %rax
nop
nop
nop
and $4869, %rbp
movb (%rax), %r10b
sub $36179, %rsi
lea addresses_A_ht+0x14d5, %r15
add $21926, %r9
movl $0x61626364, (%r15)
nop
inc %rax
lea addresses_WT_ht+0x3ca5, %rsi
lea addresses_normal_ht+0x585, %rdi
inc %rax
mov $99, %rcx
rep movsl
nop
nop
nop
nop
nop
xor %r10, %r10
lea addresses_WT_ht+0xf4c5, %r15
nop
nop
dec %rcx
mov (%r15), %r9d
inc %rcx
lea addresses_A_ht+0x1db15, %rbp
nop
nop
nop
nop
nop
dec %r9
mov (%rbp), %si
nop
nop
sub %rdi, %rdi
lea addresses_A_ht+0x1308d, %rsi
inc %rax
mov $0x6162636465666768, %r10
movq %r10, %xmm0
movups %xmm0, (%rsi)
nop
nop
nop
cmp $35612, %rsi
lea addresses_A_ht+0x19915, %r9
nop
nop
add %rdi, %rdi
mov (%r9), %ax
nop
nop
nop
inc %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r9
push %rax
push %rbp
push %rcx
push %rdi
// Store
lea addresses_US+0x1ae15, %rbp
nop
nop
nop
nop
and $46891, %rax
mov $0x5152535455565758, %r9
movq %r9, %xmm4
vmovups %ymm4, (%rbp)
nop
inc %rcx
// Load
lea addresses_RW+0x7715, %r12
nop
nop
nop
nop
nop
add $44266, %rax
mov (%r12), %rcx
nop
nop
nop
nop
nop
and $10372, %rax
// Store
lea addresses_WT+0x1e095, %rcx
nop
nop
nop
and $32874, %rdi
movw $0x5152, (%rcx)
nop
nop
nop
add $59031, %r12
// Store
lea addresses_PSE+0x1db15, %rcx
nop
nop
nop
and %rdi, %rdi
mov $0x5152535455565758, %r9
movq %r9, %xmm3
vmovntdq %ymm3, (%rcx)
cmp %r13, %r13
// Load
lea addresses_D+0x3ac6, %r12
clflush (%r12)
nop
nop
nop
nop
and $15576, %r13
mov (%r12), %edi
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %rbp
inc %rcx
// Store
lea addresses_A+0x10235, %rdi
clflush (%rdi)
nop
nop
xor $21156, %rax
movb $0x51, (%rdi)
nop
nop
nop
dec %r12
// Load
mov $0x7df0120000000a61, %rax
inc %rcx
mov (%rax), %rdi
nop
nop
nop
inc %r13
// Faulty Load
lea addresses_normal+0x7b15, %r13
nop
xor $49398, %r12
vmovntdqa (%r13), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rcx
lea oracles, %rax
and $0xff, %rcx
shlq $12, %rcx
mov (%rax,%rcx,1), %rcx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_US', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_RW', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WT', 'AVXalign': True, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 6, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': True, 'congruent': 9, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 9, 'type': 'addresses_WT_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': True, 'same': True, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'00': 62}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
archive/agda-2/Oscar/Property/Preservativity.agda | m0davis/oscar | 0 | 16122 |
module Oscar.Property.Preservativity where
open import Oscar.Level
open import Oscar.Relation
record Preservativity
{a} {A : Set a} {b} {B : A → Set b} {c} {C : (x : A) → B x → Set c}
(_▻₁_ : (x : A) → (y : B x) → C x y)
{d} {D : Set d} {e} {E : D → Set e} {f} {F : (x : D) → E x → Set f}
(_▻₂_ : (x : D) → (y : E x) → F x y)
{ℓ}
(_≤_ : ∀ {x y} → F x y → F x y → Set ℓ)
(◽ : A → D)
(◻ : ∀ {x} → B x → E (◽ x))
(□ : ∀ {x y} → C x y → F (◽ x) (◻ y))
: Set (a ⊔ b ⊔ c ⊔ d ⊔ e ⊔ f ⊔ ℓ) where
field
preservativity : ∀ (x : A) (y : B x) → □ (x ▻₁ y) ≤ (◽ x ▻₂ ◻ y)
open Preservativity ⦃ … ⦄ public
-- -- record Preservativity
-- -- {𝔞₁} {𝔄₁ : Set 𝔞₁} {𝔰₁} {_►₁_ : 𝔄₁ → 𝔄₁ → Set 𝔰₁}
-- -- (_◅₁_ : ∀ {m n} → m ►₁ n → ∀ {l} → m ⟨ l ►₁_ ⟩→ n)
-- -- {𝔞₂} {𝔄₂ : Set 𝔞₂} {𝔰₂} (_►₂_ : 𝔄₂ → 𝔄₂ → Set 𝔰₂)
-- -- (_◅₂_ : ∀ {m n} → m ►₂ n → ∀ {l} → m ⟨ l ►₂_ ⟩→ n)
-- -- {ℓ}
-- -- (_≤_ : ∀ {m n} → m ►₂ n → m ►₂ n → Set ℓ)
-- -- {μ : 𝔄₁ → 𝔄₂}
-- -- (◽ : ∀ {m n} → m ►₁ n → μ m ►₂ μ n)
-- -- : Set (𝔞₁ ⊔ 𝔰₁ ⊔ 𝔞₂ ⊔ 𝔰₂ ⊔ ℓ) where
-- -- field
-- -- preservativity : ∀ {l m} (f : l ►₁ m) {n} (g : m ►₁ n) → ◽ (g ◅₁ f) ≤ (◽ g ◅₂ ◽ f)
-- -- open Preservativity ⦃ … ⦄ public
-- -- -- record Preservativity
-- -- -- {𝔞₁} {𝔄₁ : Set 𝔞₁} {𝔰₁}
-- -- -- (_►₁_ : 𝔄₁ → 𝔄₁ → Set 𝔰₁) {𝔱₁}
-- -- -- {▸₁ : 𝔄₁ → Set 𝔱₁}
-- -- -- (_◃₁_ : ∀ {m n} → m ►₁ n → m ⟨ ▸₁ ⟩→ n)
-- -- -- {𝔞₂} {𝔄₂ : Set 𝔞₂} {𝔰₂}
-- -- -- (_►₂_ : 𝔄₂ → 𝔄₂ → Set 𝔰₂) {𝔱₂}
-- -- -- {▸₂ : 𝔄₂ → Set 𝔱₂}
-- -- -- (_◃₂_ : ∀ {m n} → m ►₂ n → m ⟨ ▸₂ ⟩→ n)
-- -- -- {ℓ}
-- -- -- (_≤_ : ∀ {n} → ▸₂ n → ▸₂ n → Set ℓ)
-- -- -- {μ : 𝔄₁ → 𝔄₂}
-- -- -- (◽ : ∀ {n} → ▸₁ n → ▸₂ (μ n))
-- -- -- (□ : ∀ {m n} → m ►₁ n → μ m ►₂ μ n)
-- -- -- : Set (𝔞₁ ⊔ 𝔰₁ ⊔ 𝔱₁ ⊔ 𝔞₂ ⊔ 𝔰₂ ⊔ 𝔱₂ ⊔ ℓ) where
-- -- -- field
-- -- -- preservativity : ∀ {m n} (f : ▸₁ m) (g : m ►₁ n) → ◽ (g ◃₁ f) ≤ (□ g ◃₂ ◽ f)
-- -- -- open Preservativity ⦃ … ⦄ public
-- -- -- open import Oscar.Class.Associativity
-- -- -- open import Oscar.Class.Symmetry
-- -- -- open import Oscar.Function
-- -- -- instance
-- -- -- Preservativity⋆ : ∀
-- -- -- {𝔞} {𝔄 : Set 𝔞} {𝔰} {_►_ : 𝔄 → 𝔄 → Set 𝔰}
-- -- -- {_◅_ : ∀ {m n} → m ► n → ∀ {l} → m ⟨ l ►_ ⟩→ n}
-- -- -- {𝔱} {▸ : 𝔄 → Set 𝔱}
-- -- -- {_◃_ : ∀ {m n} → m ► n → m ⟨ ▸ ⟩→ n}
-- -- -- {ℓ}
-- -- -- {_≤_ : ∀ {n} → ▸ n → ▸ n → Set ℓ}
-- -- -- ⦃ _ : Associativity _◅_ _◃_ _≤_ ⦄
-- -- -- → ∀ {n} {x : ▸ n}
-- -- -- → Preservativity _►_ (λ ⋆ → _◅_ ⋆) _►_ _◃_ (flip _≤_) (_◃ x) id
-- -- -- Preservativity.preservativity (Preservativity⋆ {_◅_ = _◅_} {_◃_ = _◃_} {_≤_ = _≤_} ⦃ ′associativity ⦄ {x = x}) f = associativity {_◅_ = _◅_} {_◃_ = _◃_} {_≤_ = _≤_} ⦃ {-′associativity-}_ ⦄ x f
-- -- -- preservation : ∀
-- -- -- {𝔞₁} {𝔄₁ : Set 𝔞₁} {𝔰₁} {_►₁_ : 𝔄₁ → 𝔄₁ → Set 𝔰₁} {𝔱₁} {▸₁ : 𝔄₁ → Set 𝔱₁}
-- -- -- (_◃₁_ : ∀ {m n} → m ►₁ n → m ⟨ ▸₁ ⟩→ n)
-- -- -- {𝔞₂} {𝔄₂ : Set 𝔞₂} {𝔰₂} {_►₂_ : 𝔄₂ → 𝔄₂ → Set 𝔰₂} {𝔱₂} {▸₂ : 𝔄₂ → Set 𝔱₂}
-- -- -- (_◃₂_ : ∀ {m n} → m ►₂ n → m ⟨ ▸₂ ⟩→ n)
-- -- -- {ℓ}
-- -- -- (_≤_ : ∀ {n} → ▸₂ n → ▸₂ n → Set ℓ)
-- -- -- {μ : 𝔄₁ → 𝔄₂}
-- -- -- {◽ : ∀ {n} → ▸₁ n → ▸₂ (μ n)}
-- -- -- {□ : ∀ {m n} → m ►₁ n → μ m ►₂ μ n}
-- -- -- ⦃ _ : Preservativity _►₁_ _◃₁_ _►₂_ _◃₂_ _≤_ ◽ □ ⦄
-- -- -- {m n} (f : ▸₁ m) (g : m ►₁ n) → ◽ (g ◃₁ f) ≤ (□ g ◃₂ ◽ f)
-- -- -- preservation _◃₁_ _◃₂_ _≤_ f g = preservativity {_◃₁_ = _◃₁_} {_◃₂_ = _◃₂_} {_≤_ = _≤_} f g
|
mod_player/mod_effect.asm | mikedailly/mod_player | 16 | 160555 | ; Mod player
; By <NAME>, (c) Copyright 2020 all rights reserved.
; *********************************************************************************************
;
; Handle all "effect" setup - or deal with them directly
;
; D = effect[e]
; E = param[x][y] (2 nibbles)
;
; *********************************************************************************************
DoEffects:
push hl
ld a,d
add a,a
ld hl,EffectJump
add hl,a
ld a,(hl)
ld (JumpPrt+1),a
inc hl
ld a,(hl)
ld (JumpPrt+2),a
JumpPrt:
jp $0000
NoEffect:
pop hl
ret
EffectJump:
dw NoEffect ; 00 Arpeggio
dw PitchBendUp ; 01 Pitch bend slide note up (actually a subtract)
dw PitchBendDOwn ; 02 Pitch bend slide note down (actually an add)
dw NoEffect ; 03 Pitch bend slide to specific note
dw NoEffect ; 04 Vibrato
dw NoEffect ; 05 Continue Slide to note
dw NoEffect ; 06 Contiune Vibrato
dw NoEffect ; 07 Tremolo
dw NoEffect ; 08 Set panning position (unused by most trackers - we don't use it either)
dw NoEffect ; 09 Set sample offset
dw NoEffect ; 10 Volume Slide
dw PositionJump ; 11 Position Jump
dw SetVolume ; 12 Set volume
dw PatternBreak ; 13 Pattern break
dw NoEffect ; 14 multi-effect
dw SetModSpeed ; 15 Set Speed
Effect14Jump:
dw 0
;------------------------------------------------------------------------------------------
; $01 - Setup a positive Pitch bend delta (up)
; Where [1][x][y] means "smoothly decrease the period of current
; sample by x*16+y after each tick in the division". The
; ticks/division are set with the 'set speed' effect (see below). If
; the period of the note being played is z, then the final period
; will be z - (x*16 + y)*(ticks - 1). As the slide rate depends on
; the speed, changing the speed will change the slide. You cannot
; slide beyond the note B3 (period 113).
;------------------------------------------------------------------------------------------
PitchBendUp:
ld (ix+note_pitch_bend),e
xor a
ld (ix+(note_pitch_bend+1)),a
jp NoEffect
;------------------------------------------------------------------------------------------
; $02 - Setup a negative Pitch bend delta (down)
; Where [2][x][y] means "smoothly increase the period of current
; sample by x*16+y after each tick in the division". Similar to [1],
; but lowers the pitch. You cannot slide beyond the note C1 (period 856).
;------------------------------------------------------------------------------------------
PitchBendDown:
ld d,0
NEG_DE
ld (ix+note_pitch_bend),e
xor a
ld (ix+(note_pitch_bend+1)),e
jp NoEffect
;------------------------------------------------------------------------------------------
; $0B - Position jump
; Where [11][x][y] means "stop the pattern after this division, and
; continue the song at song-position x*16+y". This shifts the
; 'pattern-cursor' in the pattern table (see above). Legal values for
; x*16+y are from 0 to 127.
;------------------------------------------------------------------------------------------
PositionJump:
ld a,$3f
ld (ModSequenceIndex),a
ld a,e
or $80 ; flag as don't inc pattern, use new one...
ld (ModPatternIndex),a
jp NoEffect
;------------------------------------------------------------------------------------------
; $0c - Set channel volume - we can only handle 0-63
;------------------------------------------------------------------------------------------
SetVolume:
ld a,e
cp $40
jr c,@InRange
ld a,$40
@InRange:
ld (ix+note_volume_channel),a
call UpdateChennelVolume
jp NoEffect
;------------------------------------------------------------------------------------------
; $0d - Break to Next Pattern
; Where [13][x][y] means "stop the pattern after this division, and
; continue the song at the next pattern at division x*10+y"
; (the 10 is not a typo). Legal divisions are from 0 to 63.
;------------------------------------------------------------------------------------------
PatternBreak:
ld a,$3f
ld (ModSequenceIndex),a
; setup sequence JUMP....
ld a,e
swapnib
and $f
ld d,a
ld a,e
and $f
ld e,10
mul
add de,a
; de hold the sequence number (0-63)
ld a,(ModNumChan) ; seqNum*chan (1-8)
ld d,a
mul
ex de,hl
add hl,hl ; *2
add hl,hl ; *4 (4 bytes per note)
ex de,hl
ld a,e
ld (ModSequanceOffset),a ; reset offset
ld a,d
ld (ModSequanceOffset+1),a ; reset offset
jp NoEffect
;------------------------------------------------------------------------------------------
; $0f - Set the mod playback speed
;------------------------------------------------------------------------------------------
SetModSpeed:
ld a,e
cp $1f
jr c,@Nomral
jp NoEffect
@Nomral:
ld (ModDelayCurrent),a
ld (ModDelayMax),a
jp NoEffect
|
oeis/006/A006327.asm | neoneye/loda-programs | 11 | 97420 | ; A006327: a(n) = Fibonacci(n) - 3. Number of total preorders.
; Submitted by <NAME>
; 0,2,5,10,18,31,52,86,141,230,374,607,984,1594,2581,4178,6762,10943,17708,28654,46365,75022,121390,196415,317808,514226,832037,1346266,2178306,3524575,5702884,9227462,14930349,24157814,39088166,63245983,102334152,165580138,267914293,433494434,701408730,1134903167,1836311900,2971215070,4807526973,7778742046,12586269022,20365011071,32951280096,53316291170,86267571269,139583862442,225851433714,365435296159,591286729876,956722026038,1548008755917,2504730781958,4052739537878,6557470319839
mov $1,1
mov $3,2
lpb $0
sub $0,1
mov $2,$3
add $3,$1
mov $1,$2
lpe
add $3,$1
mov $0,$3
sub $0,3
|
programs/oeis/219/A219395.asm | neoneye/loda | 22 | 102089 | ; A219395: Numbers k such that 18*k+1 is a square.
; 0,16,20,68,76,156,168,280,296,440,460,636,660,868,896,1136,1168,1440,1476,1780,1820,2156,2200,2568,2616,3016,3068,3500,3556,4020,4080,4576,4640,5168,5236,5796,5868,6460,6536,7160,7240,7896,7980,8668,8756,9476,9568,10320,10416,11200,11300,12116,12220,13068,13176,14056,14168,15080,15196,16140,16260,17236,17360,18368,18496,19536,19668,20740,20876,21980,22120,23256,23400,24568,24716,25916,26068,27300,27456,28720,28880,30176,30340,31668,31836,33196,33368,34760,34936,36360,36540,37996,38180,39668,39856,41376,41568,43120,43316,44900
mov $2,$0
lpb $2
add $0,5
add $1,$0
sub $1,2
trn $2,2
lpe
mul $1,4
mov $0,$1
|
libsrc/_DEVELOPMENT/stdlib/c/sdcc_iy/_random_uniform_xor_32__fastcall.asm | jpoikela/z88dk | 640 | 10125 |
; uint32_t _random_uniform_xor_32__fastcall(uint32_t *seed)
SECTION code_clib
SECTION code_stdlib
PUBLIC __random_uniform_xor_32__fastcall
EXTERN asm_random_uniform_xor_32, l_long_load_mhl, l_long_store_mhl
__random_uniform_xor_32__fastcall:
push hl
call l_long_load_mhl ; dehl = seed
call asm_random_uniform_xor_32
ld c,l
ld b,h
pop hl
call l_long_store_mhl
ld l,c
ld h,b
ret
|
alloy4fun_models/trashltl/models/5/txnkQYFkbTm669C5Q.als | Kaixi26/org.alloytools.alloy | 0 | 5027 | <gh_stars>0
open main
pred idtxnkQYFkbTm669C5Q_prop6 {
all f : File | eventually f in Trash implies always f in Trash
}
pred __repair { idtxnkQYFkbTm669C5Q_prop6 }
check __repair { idtxnkQYFkbTm669C5Q_prop6 <=> prop6o } |
src/filtering_functions_h.ads | JeremyGrosser/arm_cmsis_dsp | 0 | 28980 | pragma Ada_2012;
pragma Style_Checks (Off);
pragma Warnings ("U");
with Interfaces.C; use Interfaces.C;
with sys_ustdint_h;
with arm_math_types_h;
package filtering_functions_h is
-- unsupported macro: DELTA_Q31 ((q31_t)(0x100))
-- unsupported macro: DELTA_Q15 ((q15_t)0x5)
type arm_fir_instance_q7 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:58
pState : access arm_math_types_h.q7_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:59
pCoeffs : access arm_math_types_h.q7_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:60
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:61
type arm_fir_instance_q15 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:68
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:69
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:70
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:71
type arm_fir_instance_q31 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:78
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:79
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:80
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:81
type arm_fir_instance_f32 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:88
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:89
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:90
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:91
type arm_fir_instance_f64 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:98
pState : access arm_math_types_h.float64_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:99
pCoeffs : access arm_math_types_h.float64_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:100
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:101
procedure arm_fir_q7
(S : access constant arm_fir_instance_q7;
pSrc : access arm_math_types_h.q7_t;
pDst : access arm_math_types_h.q7_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:110
with Import => True,
Convention => C,
External_Name => "arm_fir_q7";
procedure arm_fir_init_q7
(S : access arm_fir_instance_q7;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q7_t;
pState : access arm_math_types_h.q7_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:127
with Import => True,
Convention => C,
External_Name => "arm_fir_init_q7";
procedure arm_fir_q15
(S : access constant arm_fir_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:141
with Import => True,
Convention => C,
External_Name => "arm_fir_q15";
procedure arm_fir_fast_q15
(S : access constant arm_fir_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:154
with Import => True,
Convention => C,
External_Name => "arm_fir_fast_q15";
function arm_fir_init_q15
(S : access arm_fir_instance_q15;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:175
with Import => True,
Convention => C,
External_Name => "arm_fir_init_q15";
procedure arm_fir_q31
(S : access constant arm_fir_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:189
with Import => True,
Convention => C,
External_Name => "arm_fir_q31";
procedure arm_fir_fast_q31
(S : access constant arm_fir_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:202
with Import => True,
Convention => C,
External_Name => "arm_fir_fast_q31";
procedure arm_fir_init_q31
(S : access arm_fir_instance_q31;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:219
with Import => True,
Convention => C,
External_Name => "arm_fir_init_q31";
procedure arm_fir_f32
(S : access constant arm_fir_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:233
with Import => True,
Convention => C,
External_Name => "arm_fir_f32";
procedure arm_fir_f64
(S : access constant arm_fir_instance_f64;
pSrc : access arm_math_types_h.float64_t;
pDst : access arm_math_types_h.float64_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:246
with Import => True,
Convention => C,
External_Name => "arm_fir_f64";
procedure arm_fir_init_f32
(S : access arm_fir_instance_f32;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:260
with Import => True,
Convention => C,
External_Name => "arm_fir_init_f32";
procedure arm_fir_init_f64
(S : access arm_fir_instance_f64;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.float64_t;
pState : access arm_math_types_h.float64_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:275
with Import => True,
Convention => C,
External_Name => "arm_fir_init_f64";
type arm_biquad_casd_df1_inst_q15 is record
numStages : aliased sys_ustdint_h.int8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:287
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:288
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:289
postShift : aliased sys_ustdint_h.int8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:290
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:291
type arm_biquad_casd_df1_inst_q31 is record
numStages : aliased sys_ustdint_h.uint32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:298
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:299
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:300
postShift : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:301
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:302
type arm_biquad_casd_df1_inst_f32 is record
numStages : aliased sys_ustdint_h.uint32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:309
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:310
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:311
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:312
procedure arm_biquad_cascade_df1_q15
(S : access constant arm_biquad_casd_df1_inst_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:331
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_q15";
procedure arm_biquad_cascade_df1_init_q15
(S : access arm_biquad_casd_df1_inst_q15;
numStages : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
postShift : sys_ustdint_h.int8_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:345
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_init_q15";
procedure arm_biquad_cascade_df1_fast_q15
(S : access constant arm_biquad_casd_df1_inst_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:359
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_fast_q15";
procedure arm_biquad_cascade_df1_q31
(S : access constant arm_biquad_casd_df1_inst_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:372
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_q31";
procedure arm_biquad_cascade_df1_fast_q31
(S : access constant arm_biquad_casd_df1_inst_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:385
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_fast_q31";
procedure arm_biquad_cascade_df1_init_q31
(S : access arm_biquad_casd_df1_inst_q31;
numStages : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
postShift : sys_ustdint_h.int8_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:399
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_init_q31";
procedure arm_biquad_cascade_df1_f32
(S : access constant arm_biquad_casd_df1_inst_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:413
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_f32";
procedure arm_biquad_cascade_df1_init_f32
(S : access arm_biquad_casd_df1_inst_f32;
numStages : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:436
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df1_init_f32";
procedure arm_conv_f32
(pSrcA : access arm_math_types_h.float32_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.float32_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:451
with Import => True,
Convention => C,
External_Name => "arm_conv_f32";
procedure arm_conv_opt_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
pScratch1 : access arm_math_types_h.q15_t;
pScratch2 : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:469
with Import => True,
Convention => C,
External_Name => "arm_conv_opt_q15";
procedure arm_conv_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:487
with Import => True,
Convention => C,
External_Name => "arm_conv_q15";
procedure arm_conv_fast_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:503
with Import => True,
Convention => C,
External_Name => "arm_conv_fast_q15";
procedure arm_conv_fast_opt_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
pScratch1 : access arm_math_types_h.q15_t;
pScratch2 : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:521
with Import => True,
Convention => C,
External_Name => "arm_conv_fast_opt_q15";
procedure arm_conv_q31
(pSrcA : access arm_math_types_h.q31_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q31_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q31_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:539
with Import => True,
Convention => C,
External_Name => "arm_conv_q31";
procedure arm_conv_fast_q31
(pSrcA : access arm_math_types_h.q31_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q31_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q31_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:555
with Import => True,
Convention => C,
External_Name => "arm_conv_fast_q31";
procedure arm_conv_opt_q7
(pSrcA : access arm_math_types_h.q7_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q7_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q7_t;
pScratch1 : access arm_math_types_h.q15_t;
pScratch2 : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:573
with Import => True,
Convention => C,
External_Name => "arm_conv_opt_q7";
procedure arm_conv_q7
(pSrcA : access arm_math_types_h.q7_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q7_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q7_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:591
with Import => True,
Convention => C,
External_Name => "arm_conv_q7";
function arm_conv_partial_f32
(pSrcA : access arm_math_types_h.float32_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.float32_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.float32_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:610
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_f32";
function arm_conv_partial_opt_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t;
pScratch1 : access arm_math_types_h.q15_t;
pScratch2 : access arm_math_types_h.q15_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:633
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_opt_q15";
function arm_conv_partial_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:656
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_q15";
function arm_conv_partial_fast_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:677
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_fast_q15";
function arm_conv_partial_fast_opt_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t;
pScratch1 : access arm_math_types_h.q15_t;
pScratch2 : access arm_math_types_h.q15_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:700
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_fast_opt_q15";
function arm_conv_partial_q31
(pSrcA : access arm_math_types_h.q31_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q31_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q31_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:723
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_q31";
function arm_conv_partial_fast_q31
(pSrcA : access arm_math_types_h.q31_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q31_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q31_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:744
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_fast_q31";
function arm_conv_partial_opt_q7
(pSrcA : access arm_math_types_h.q7_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q7_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q7_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t;
pScratch1 : access arm_math_types_h.q15_t;
pScratch2 : access arm_math_types_h.q15_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:767
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_opt_q7";
function arm_conv_partial_q7
(pSrcA : access arm_math_types_h.q7_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q7_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q7_t;
firstIndex : sys_ustdint_h.uint32_t;
numPoints : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:790
with Import => True,
Convention => C,
External_Name => "arm_conv_partial_q7";
type arm_fir_decimate_instance_q15 is record
M : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:805
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:806
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:807
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:808
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:809
type arm_fir_decimate_instance_q31 is record
M : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:816
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:817
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:818
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:819
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:820
type arm_fir_decimate_instance_f32 is record
M : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:827
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:828
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:829
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:830
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:831
procedure arm_fir_decimate_f32
(S : access constant arm_fir_decimate_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:841
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_f32";
function arm_fir_decimate_init_f32
(S : access arm_fir_decimate_instance_f32;
numTaps : sys_ustdint_h.uint16_t;
M : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:860
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_init_f32";
procedure arm_fir_decimate_q15
(S : access constant arm_fir_decimate_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:876
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_q15";
procedure arm_fir_decimate_fast_q15
(S : access constant arm_fir_decimate_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:890
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_fast_q15";
function arm_fir_decimate_init_q15
(S : access arm_fir_decimate_instance_q15;
numTaps : sys_ustdint_h.uint16_t;
M : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:908
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_init_q15";
procedure arm_fir_decimate_q31
(S : access constant arm_fir_decimate_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:924
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_q31";
procedure arm_fir_decimate_fast_q31
(S : access constant arm_fir_decimate_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:937
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_fast_q31";
function arm_fir_decimate_init_q31
(S : access arm_fir_decimate_instance_q31;
numTaps : sys_ustdint_h.uint16_t;
M : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:955
with Import => True,
Convention => C,
External_Name => "arm_fir_decimate_init_q31";
type arm_fir_interpolate_instance_q15 is record
L : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:969
phaseLength : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:970
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:971
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:972
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:973
type arm_fir_interpolate_instance_q31 is record
L : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:980
phaseLength : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:981
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:982
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:983
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:984
type arm_fir_interpolate_instance_f32 is record
L : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:991
phaseLength : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:992
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:993
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:994
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:995
procedure arm_fir_interpolate_q15
(S : access constant arm_fir_interpolate_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1005
with Import => True,
Convention => C,
External_Name => "arm_fir_interpolate_q15";
function arm_fir_interpolate_init_q15
(S : access arm_fir_interpolate_instance_q15;
L : sys_ustdint_h.uint8_t;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1023
with Import => True,
Convention => C,
External_Name => "arm_fir_interpolate_init_q15";
procedure arm_fir_interpolate_q31
(S : access constant arm_fir_interpolate_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1039
with Import => True,
Convention => C,
External_Name => "arm_fir_interpolate_q31";
function arm_fir_interpolate_init_q31
(S : access arm_fir_interpolate_instance_q31;
L : sys_ustdint_h.uint8_t;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1057
with Import => True,
Convention => C,
External_Name => "arm_fir_interpolate_init_q31";
procedure arm_fir_interpolate_f32
(S : access constant arm_fir_interpolate_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1073
with Import => True,
Convention => C,
External_Name => "arm_fir_interpolate_f32";
function arm_fir_interpolate_init_f32
(S : access arm_fir_interpolate_instance_f32;
L : sys_ustdint_h.uint8_t;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1091
with Import => True,
Convention => C,
External_Name => "arm_fir_interpolate_init_f32";
type arm_biquad_cas_df1_32x64_ins_q31 is record
numStages : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1105
pState : access arm_math_types_h.q63_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1106
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1107
postShift : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1108
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1109
procedure arm_biquad_cas_df1_32x64_q31
(S : access constant arm_biquad_cas_df1_32x64_ins_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1118
with Import => True,
Convention => C,
External_Name => "arm_biquad_cas_df1_32x64_q31";
procedure arm_biquad_cas_df1_32x64_init_q31
(S : access arm_biquad_cas_df1_32x64_ins_q31;
numStages : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q63_t;
postShift : sys_ustdint_h.uint8_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1132
with Import => True,
Convention => C,
External_Name => "arm_biquad_cas_df1_32x64_init_q31";
type arm_biquad_cascade_df2T_instance_f32 is record
numStages : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1145
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1146
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1147
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1148
type arm_biquad_cascade_stereo_df2T_instance_f32 is record
numStages : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1155
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1156
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1157
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1158
type arm_biquad_cascade_df2T_instance_f64 is record
numStages : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1165
pState : access arm_math_types_h.float64_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1166
pCoeffs : access arm_math_types_h.float64_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1167
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1168
procedure arm_biquad_cascade_df2T_f32
(S : access constant arm_biquad_cascade_df2T_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1178
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df2T_f32";
procedure arm_biquad_cascade_stereo_df2T_f32
(S : access constant arm_biquad_cascade_stereo_df2T_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1192
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_stereo_df2T_f32";
procedure arm_biquad_cascade_df2T_f64
(S : access constant arm_biquad_cascade_df2T_instance_f64;
pSrc : access arm_math_types_h.float64_t;
pDst : access arm_math_types_h.float64_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1206
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df2T_f64";
procedure arm_biquad_cascade_df2T_init_f32
(S : access arm_biquad_cascade_df2T_instance_f32;
numStages : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1233
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df2T_init_f32";
procedure arm_biquad_cascade_stereo_df2T_init_f32
(S : access arm_biquad_cascade_stereo_df2T_instance_f32;
numStages : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1247
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_stereo_df2T_init_f32";
procedure arm_biquad_cascade_df2T_init_f64
(S : access arm_biquad_cascade_df2T_instance_f64;
numStages : sys_ustdint_h.uint8_t;
pCoeffs : access arm_math_types_h.float64_t;
pState : access arm_math_types_h.float64_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1261
with Import => True,
Convention => C,
External_Name => "arm_biquad_cascade_df2T_init_f64";
type arm_fir_lattice_instance_q15 is record
numStages : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1273
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1274
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1275
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1276
type arm_fir_lattice_instance_q31 is record
numStages : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1283
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1284
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1285
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1286
type arm_fir_lattice_instance_f32 is record
numStages : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1293
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1294
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1295
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1296
procedure arm_fir_lattice_init_q15
(S : access arm_fir_lattice_instance_q15;
numStages : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1306
with Import => True,
Convention => C,
External_Name => "arm_fir_lattice_init_q15";
procedure arm_fir_lattice_q15
(S : access constant arm_fir_lattice_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1320
with Import => True,
Convention => C,
External_Name => "arm_fir_lattice_q15";
procedure arm_fir_lattice_init_q31
(S : access arm_fir_lattice_instance_q31;
numStages : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1334
with Import => True,
Convention => C,
External_Name => "arm_fir_lattice_init_q31";
procedure arm_fir_lattice_q31
(S : access constant arm_fir_lattice_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1348
with Import => True,
Convention => C,
External_Name => "arm_fir_lattice_q31";
procedure arm_fir_lattice_init_f32
(S : access arm_fir_lattice_instance_f32;
numStages : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1362
with Import => True,
Convention => C,
External_Name => "arm_fir_lattice_init_f32";
procedure arm_fir_lattice_f32
(S : access constant arm_fir_lattice_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1376
with Import => True,
Convention => C,
External_Name => "arm_fir_lattice_f32";
type arm_iir_lattice_instance_q15 is record
numStages : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1388
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1389
pkCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1390
pvCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1391
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1392
type arm_iir_lattice_instance_q31 is record
numStages : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1399
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1400
pkCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1401
pvCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1402
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1403
type arm_iir_lattice_instance_f32 is record
numStages : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1410
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1411
pkCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1412
pvCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1413
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1414
procedure arm_iir_lattice_f32
(S : access constant arm_iir_lattice_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1424
with Import => True,
Convention => C,
External_Name => "arm_iir_lattice_f32";
procedure arm_iir_lattice_init_f32
(S : access arm_iir_lattice_instance_f32;
numStages : sys_ustdint_h.uint16_t;
pkCoeffs : access arm_math_types_h.float32_t;
pvCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1440
with Import => True,
Convention => C,
External_Name => "arm_iir_lattice_init_f32";
procedure arm_iir_lattice_q31
(S : access constant arm_iir_lattice_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1456
with Import => True,
Convention => C,
External_Name => "arm_iir_lattice_q31";
procedure arm_iir_lattice_init_q31
(S : access arm_iir_lattice_instance_q31;
numStages : sys_ustdint_h.uint16_t;
pkCoeffs : access arm_math_types_h.q31_t;
pvCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1472
with Import => True,
Convention => C,
External_Name => "arm_iir_lattice_init_q31";
procedure arm_iir_lattice_q15
(S : access constant arm_iir_lattice_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1488
with Import => True,
Convention => C,
External_Name => "arm_iir_lattice_q15";
procedure arm_iir_lattice_init_q15
(S : access arm_iir_lattice_instance_q15;
numStages : sys_ustdint_h.uint16_t;
pkCoeffs : access arm_math_types_h.q15_t;
pvCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1504
with Import => True,
Convention => C,
External_Name => "arm_iir_lattice_init_q15";
type arm_lms_instance_f32 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1518
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1519
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1520
mu : aliased arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1521
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1522
procedure arm_lms_f32
(S : access constant arm_lms_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pRef : access arm_math_types_h.float32_t;
pOut : access arm_math_types_h.float32_t;
pErr : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1534
with Import => True,
Convention => C,
External_Name => "arm_lms_f32";
procedure arm_lms_init_f32
(S : access arm_lms_instance_f32;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t;
mu : arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1552
with Import => True,
Convention => C,
External_Name => "arm_lms_init_f32";
type arm_lms_instance_q15 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1566
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1567
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1568
mu : aliased arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1569
postShift : aliased sys_ustdint_h.uint32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1570
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1571
procedure arm_lms_init_q15
(S : access arm_lms_instance_q15;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
mu : arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t;
postShift : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1584
with Import => True,
Convention => C,
External_Name => "arm_lms_init_q15";
procedure arm_lms_q15
(S : access constant arm_lms_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pRef : access arm_math_types_h.q15_t;
pOut : access arm_math_types_h.q15_t;
pErr : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1603
with Import => True,
Convention => C,
External_Name => "arm_lms_q15";
type arm_lms_instance_q31 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1617
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1618
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1619
mu : aliased arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1620
postShift : aliased sys_ustdint_h.uint32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1621
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1622
procedure arm_lms_q31
(S : access constant arm_lms_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pRef : access arm_math_types_h.q31_t;
pOut : access arm_math_types_h.q31_t;
pErr : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1634
with Import => True,
Convention => C,
External_Name => "arm_lms_q31";
procedure arm_lms_init_q31
(S : access arm_lms_instance_q31;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
mu : arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t;
postShift : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1653
with Import => True,
Convention => C,
External_Name => "arm_lms_init_q31";
type arm_lms_norm_instance_f32 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1668
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1669
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1670
mu : aliased arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1671
energy : aliased arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1672
x0 : aliased arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1673
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1674
procedure arm_lms_norm_f32
(S : access arm_lms_norm_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pRef : access arm_math_types_h.float32_t;
pOut : access arm_math_types_h.float32_t;
pErr : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1686
with Import => True,
Convention => C,
External_Name => "arm_lms_norm_f32";
procedure arm_lms_norm_init_f32
(S : access arm_lms_norm_instance_f32;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t;
mu : arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1704
with Import => True,
Convention => C,
External_Name => "arm_lms_norm_init_f32";
type arm_lms_norm_instance_q31 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1718
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1719
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1720
mu : aliased arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1721
postShift : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1722
recipTable : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1723
energy : aliased arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1724
x0 : aliased arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1725
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1726
procedure arm_lms_norm_q31
(S : access arm_lms_norm_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pRef : access arm_math_types_h.q31_t;
pOut : access arm_math_types_h.q31_t;
pErr : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1738
with Import => True,
Convention => C,
External_Name => "arm_lms_norm_q31";
procedure arm_lms_norm_init_q31
(S : access arm_lms_norm_instance_q31;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
mu : arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t;
postShift : sys_ustdint_h.uint8_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1757
with Import => True,
Convention => C,
External_Name => "arm_lms_norm_init_q31";
type arm_lms_norm_instance_q15 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1772
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1773
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1774
mu : aliased arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1775
postShift : aliased sys_ustdint_h.uint8_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1776
recipTable : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1777
energy : aliased arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1778
x0 : aliased arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1779
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1780
procedure arm_lms_norm_q15
(S : access arm_lms_norm_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pRef : access arm_math_types_h.q15_t;
pOut : access arm_math_types_h.q15_t;
pErr : access arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1792
with Import => True,
Convention => C,
External_Name => "arm_lms_norm_q15";
procedure arm_lms_norm_init_q15
(S : access arm_lms_norm_instance_q15;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
mu : arm_math_types_h.q15_t;
blockSize : sys_ustdint_h.uint32_t;
postShift : sys_ustdint_h.uint8_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1811
with Import => True,
Convention => C,
External_Name => "arm_lms_norm_init_q15";
procedure arm_correlate_f32
(pSrcA : access arm_math_types_h.float32_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.float32_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1829
with Import => True,
Convention => C,
External_Name => "arm_correlate_f32";
procedure arm_correlate_f64
(pSrcA : access arm_math_types_h.float64_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.float64_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.float64_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1845
with Import => True,
Convention => C,
External_Name => "arm_correlate_f64";
procedure arm_correlate_opt_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
pScratch : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1862
with Import => True,
Convention => C,
External_Name => "arm_correlate_opt_q15";
procedure arm_correlate_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1879
with Import => True,
Convention => C,
External_Name => "arm_correlate_q15";
procedure arm_correlate_fast_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1896
with Import => True,
Convention => C,
External_Name => "arm_correlate_fast_q15";
procedure arm_correlate_fast_opt_q15
(pSrcA : access arm_math_types_h.q15_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q15_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q15_t;
pScratch : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1913
with Import => True,
Convention => C,
External_Name => "arm_correlate_fast_opt_q15";
procedure arm_correlate_q31
(pSrcA : access arm_math_types_h.q31_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q31_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q31_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1930
with Import => True,
Convention => C,
External_Name => "arm_correlate_q31";
procedure arm_correlate_fast_q31
(pSrcA : access arm_math_types_h.q31_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q31_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q31_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1946
with Import => True,
Convention => C,
External_Name => "arm_correlate_fast_q31";
procedure arm_correlate_opt_q7
(pSrcA : access arm_math_types_h.q7_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q7_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q7_t;
pScratch1 : access arm_math_types_h.q15_t;
pScratch2 : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1964
with Import => True,
Convention => C,
External_Name => "arm_correlate_opt_q7";
procedure arm_correlate_q7
(pSrcA : access arm_math_types_h.q7_t;
srcALen : sys_ustdint_h.uint32_t;
pSrcB : access arm_math_types_h.q7_t;
srcBLen : sys_ustdint_h.uint32_t;
pDst : access arm_math_types_h.q7_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1982
with Import => True,
Convention => C,
External_Name => "arm_correlate_q7";
type arm_fir_sparse_instance_f32 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1995
stateIndex : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1996
pState : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1997
pCoeffs : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1998
maxDelay : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:1999
pTapDelay : access sys_ustdint_h.int32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2000
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2001
type arm_fir_sparse_instance_q31 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2008
stateIndex : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2009
pState : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2010
pCoeffs : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2011
maxDelay : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2012
pTapDelay : access sys_ustdint_h.int32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2013
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2014
type arm_fir_sparse_instance_q15 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2021
stateIndex : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2022
pState : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2023
pCoeffs : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2024
maxDelay : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2025
pTapDelay : access sys_ustdint_h.int32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2026
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2027
type arm_fir_sparse_instance_q7 is record
numTaps : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2034
stateIndex : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2035
pState : access arm_math_types_h.q7_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2036
pCoeffs : access arm_math_types_h.q7_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2037
maxDelay : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2038
pTapDelay : access sys_ustdint_h.int32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2039
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2040
procedure arm_fir_sparse_f32
(S : access arm_fir_sparse_instance_f32;
pSrc : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t;
pScratchIn : access arm_math_types_h.float32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2051
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_f32";
procedure arm_fir_sparse_init_f32
(S : access arm_fir_sparse_instance_f32;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.float32_t;
pState : access arm_math_types_h.float32_t;
pTapDelay : access sys_ustdint_h.int32_t;
maxDelay : sys_ustdint_h.uint16_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2069
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_init_f32";
procedure arm_fir_sparse_q31
(S : access arm_fir_sparse_instance_q31;
pSrc : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t;
pScratchIn : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2087
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_q31";
procedure arm_fir_sparse_init_q31
(S : access arm_fir_sparse_instance_q31;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q31_t;
pState : access arm_math_types_h.q31_t;
pTapDelay : access sys_ustdint_h.int32_t;
maxDelay : sys_ustdint_h.uint16_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2105
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_init_q31";
procedure arm_fir_sparse_q15
(S : access arm_fir_sparse_instance_q15;
pSrc : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t;
pScratchIn : access arm_math_types_h.q15_t;
pScratchOut : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2124
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_q15";
procedure arm_fir_sparse_init_q15
(S : access arm_fir_sparse_instance_q15;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q15_t;
pState : access arm_math_types_h.q15_t;
pTapDelay : access sys_ustdint_h.int32_t;
maxDelay : sys_ustdint_h.uint16_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2143
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_init_q15";
procedure arm_fir_sparse_q7
(S : access arm_fir_sparse_instance_q7;
pSrc : access arm_math_types_h.q7_t;
pDst : access arm_math_types_h.q7_t;
pScratchIn : access arm_math_types_h.q7_t;
pScratchOut : access arm_math_types_h.q31_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2162
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_q7";
procedure arm_fir_sparse_init_q7
(S : access arm_fir_sparse_instance_q7;
numTaps : sys_ustdint_h.uint16_t;
pCoeffs : access arm_math_types_h.q7_t;
pState : access arm_math_types_h.q7_t;
pTapDelay : access sys_ustdint_h.int32_t;
maxDelay : sys_ustdint_h.uint16_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2181
with Import => True,
Convention => C,
External_Name => "arm_fir_sparse_init_q7";
procedure arm_circularWrite_f32
(circBuffer : access sys_ustdint_h.int32_t;
L : sys_ustdint_h.int32_t;
writeOffset : access sys_ustdint_h.uint16_t;
bufferInc : sys_ustdint_h.int32_t;
src : access sys_ustdint_h.int32_t;
srcInc : sys_ustdint_h.int32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2198
with Import => True,
Convention => C,
External_Name => "arm_circularWrite_f32";
procedure arm_circularRead_f32
(circBuffer : access sys_ustdint_h.int32_t;
L : sys_ustdint_h.int32_t;
readOffset : access sys_ustdint_h.int32_t;
bufferInc : sys_ustdint_h.int32_t;
dst : access sys_ustdint_h.int32_t;
dst_base : access sys_ustdint_h.int32_t;
dst_length : sys_ustdint_h.int32_t;
dstInc : sys_ustdint_h.int32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2243
with Import => True,
Convention => C,
External_Name => "arm_circularRead_f32";
procedure arm_circularWrite_q15
(circBuffer : access arm_math_types_h.q15_t;
L : sys_ustdint_h.int32_t;
writeOffset : access sys_ustdint_h.uint16_t;
bufferInc : sys_ustdint_h.int32_t;
src : access arm_math_types_h.q15_t;
srcInc : sys_ustdint_h.int32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2299
with Import => True,
Convention => C,
External_Name => "arm_circularWrite_q15";
procedure arm_circularRead_q15
(circBuffer : access arm_math_types_h.q15_t;
L : sys_ustdint_h.int32_t;
readOffset : access sys_ustdint_h.int32_t;
bufferInc : sys_ustdint_h.int32_t;
dst : access arm_math_types_h.q15_t;
dst_base : access arm_math_types_h.q15_t;
dst_length : sys_ustdint_h.int32_t;
dstInc : sys_ustdint_h.int32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2343
with Import => True,
Convention => C,
External_Name => "arm_circularRead_q15";
procedure arm_circularWrite_q7
(circBuffer : access arm_math_types_h.q7_t;
L : sys_ustdint_h.int32_t;
writeOffset : access sys_ustdint_h.uint16_t;
bufferInc : sys_ustdint_h.int32_t;
src : access arm_math_types_h.q7_t;
srcInc : sys_ustdint_h.int32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2400
with Import => True,
Convention => C,
External_Name => "arm_circularWrite_q7";
procedure arm_circularRead_q7
(circBuffer : access arm_math_types_h.q7_t;
L : sys_ustdint_h.int32_t;
readOffset : access sys_ustdint_h.int32_t;
bufferInc : sys_ustdint_h.int32_t;
dst : access arm_math_types_h.q7_t;
dst_base : access arm_math_types_h.q7_t;
dst_length : sys_ustdint_h.int32_t;
dstInc : sys_ustdint_h.int32_t;
blockSize : sys_ustdint_h.uint32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2444
with Import => True,
Convention => C,
External_Name => "arm_circularRead_q7";
procedure arm_levinson_durbin_f32
(phi : access arm_math_types_h.float32_t;
a : access arm_math_types_h.float32_t;
err : access arm_math_types_h.float32_t;
nbCoefs : int) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2506
with Import => True,
Convention => C,
External_Name => "arm_levinson_durbin_f32";
procedure arm_levinson_durbin_q31
(phi : access arm_math_types_h.q31_t;
a : access arm_math_types_h.q31_t;
err : access arm_math_types_h.q31_t;
nbCoefs : int) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/filtering_functions.h:2520
with Import => True,
Convention => C,
External_Name => "arm_levinson_durbin_q31";
end filtering_functions_h;
|
programs/oeis/129/A129831.asm | jmorken/loda | 1 | 85739 | ; A129831: Alternating sum of double factorials: n!! - (n-1)!! + (n-2)!! - ... 1!!.
; 1,1,2,6,9,39,66,318,627,3213,7182,38898,96237,548883,1478142,8843778,25615647,160178913,494550162,3221341038,10527969537,71221636863,245012506362,1716978047238,6188875533387,44822878860213
mov $2,$0
add $2,1
mov $6,$0
lpb $2
mov $0,$6
sub $2,1
sub $0,$2
mov $11,$0
mov $13,2
lpb $13
mov $0,$11
sub $13,1
add $0,$13
sub $0,1
mov $7,$0
mov $9,2
lpb $9
mov $0,$7
sub $9,1
add $0,$9
mov $4,1
trn $4,$3
lpb $0
mov $3,$4
add $3,6
mul $3,$0
trn $0,2
trn $3,$4
add $4,$3
lpe
mov $5,$4
mov $10,$9
lpb $10
mov $8,$5
sub $10,1
lpe
lpe
lpb $7
mov $7,0
sub $8,$5
lpe
mov $5,$8
mov $14,$13
lpb $14
mov $12,$5
sub $14,1
lpe
lpe
lpb $11
mov $11,0
sub $12,$5
lpe
mov $5,$12
div $5,6
add $1,$5
lpe
|
legend-engine-language-pure-grammar/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/CodeParserGrammar.g4 | dave-wathen/legend-engine | 32 | 3107 | parser grammar CodeParserGrammar;
options
{
tokenVocab = CodeLexerGrammar;
}
definition: (section)*
EOF
;
section: SECTION_START (sectionContent)*
;
sectionContent: HASH | NON_HASH
; |
base/Kernel/Native/arm/Crt/except.asm | sphinxlogic/Singularity-RDK-2.0 | 0 | 23342 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Microsoft Research Singularity
;;;
;;; Copyright (c) Microsoft Corporation. All rights reserved.
;;;
;;; This file contains ARM-specific assembly code.
;;;
; except.s
;
; Copyright (C) Advanced RISC Machines Limited, 1994. All rights reserved.
;
; RCS Revision: 1
; Checkin Date: 2007/06/29 02:59:16
; Revising Author
;==============================================================================
;Error generation - from ANSI library
GET fpe.asm
GET h_errors.asm
[ :DEF: liberror_s
AREA |.text|, CODE, READONLY
Export_32 __fp_edom
Export_32 __fp_erange
; __fp_edom(ulong sign_bit, boolean huge_val);
; __fp_erange(ulong sign_bit, boolean huge_val);
;
; set errno to EDOM/ERANGE and return sign_bit | (huge_val ? HUGE_VAL : 0)
__fp_edom EnterWithLR
MOV a3, #EDOM
B skip
__fp_erange EnterWithLR
MOV a3, #ERANGE
skip
AND a4, a1, #Sign_bit
[ :DEF:EMBEDDED_CLIB
IMPORT __rt_errno_addr
LDR a1, =__rt_errno_addr
CMP a1, #0
BEQ %FT1
STMDB sp!, {a2-a4, lr}
BL __rt_errno_addr
LDMIA sp!, {a2-a4, lr}
STR a3, [a1]
1
|
LDR a1, errno
STR a3, [a1]
]
TEQ a2, #0
MOVEQ a1, #0 ; generate +/- 0.0 in a1/a2
LDRNE a1, huge_val
LDMNEIA a1, {a1, a2} ; load HUGE_VAL into a1/a2
ORR a1, a1, a4 ; add in sign bit
ReturnToLR
[ :LNOT::DEF:EMBEDDED_CLIB
errno
IMPORT __errno
DCD __errno
]
huge_val
IMPORT __huge_val
DCD __huge_val
]
;==============================================================================
;Setting/returning status flags.
[ :DEF: status_s
AREA |.text|, CODE, READONLY
EXPORT __fp_status
; extern unsigned int __fp_status(unsigned int mask,unsigned int flags)
__fp_status
[ :DEF: thumb
CODE16
; mask "mask" to an acceptable value
MOV a4,#&e0
LSL a3,a1,#32-FPExceptE_pos-Except_len
LSR a3,a3,#32-FPExceptE_pos-Except_len
BIC a3,a4
LSR a4,#8
BIC a3,a4
AND a4,a1
ORR a3,a1
AND a2,a3
; mask in a3, masked flags in a2
LDR a4,status_ptr
LDR a1,[a4]
; **** *WARNING* is ip spare under the TPCS ????? ****
MOV ip,a1 ; store value
BIC a1,a3
EOR a1,a2
STR a1,[a4]
MOV a1,ip ; restore value
BX lr
ALIGN
|
; mask "mask" to an acceptable value
MOV a3,a1,LSL #32-FPExceptE_pos-Except_len
BIC a3,a3,#&e0:SHL:(32-FPExceptE_pos-Except_len)
BIC a3,a3,#&e0:SHL:(32-FPExceptE_pos-Except_len+8)
AND a2,a2,a3,LSR #32-FPExceptE_pos-Except_len
; mask in a3, masked flags in a2.
LDR a4,status_ptr
LDR a1,[a4] ; load old flags
BIC a3,a1,a3,LSR #32-FPExceptE_pos-Except_len
EOR a3,a3,a2 ; clear/set/toggle flags and
STR a3,[a4] ; write back.
IF Interworking :LOR: Thumbing
BX lr
ELSE
MOV pc,lr ; return
ENDIF
]
status_ptr
IMPORT __fp_status_flags
DCD __fp_status_flags
]
;==============================================================================
;Error checking - from fplib code
[ :DEF: fcheck_s
AREA |.text|, CODE, READONLY
[ :DEF: thumb
CODE32
]
EXPORT __fp_fcheck_NaN2
EXPORT __fp_dcheck_NaN2
EXPORT __fp_return_NaN
EXPORT __fp_return_Inf
IMPORT __fp_exception
; Check fOP1 and fOP2 for signalling NaN, IP contains exception flags.
__fp_fcheck_NaN2
MOV a4, #0x01000000
CMN a4, fOP1, LSL #1
BLS fcheck_opnd2_NaN
fcheck_opnd1_NaN
TST fOP1, #fSignalBit
BEQ __fp_exception
CMN a4, fOP2, LSL #1
BLS __fp_return_NaN
fcheck_opnd2_NaN
MOV fOP1, fOP2
TST fOP1, #fSignalBit
BNE __fp_return_NaN ;; RDCFix: Do we really want to do this?
; BEQ __fp_return_NaN
B __fp_exception
; Check dOP1 and dOP2 for signalling NaN, IP contains exception flags.
__fp_dcheck_NaN2
STMFD sp!, {ip}
MOV tmp, #0x00200000
CMN tmp, dOP1h, LSL #1
CMPEQ dOP1l, #0
BLS dcheck_opnd2_NaN
dcheck_opnd1_NaN
TST dOP1h, #dSignalBit
LDMEQFD sp!, {ip}
BEQ __fp_exception
CMN tmp, dOP2h, LSL #1
CMPEQ dOP2l, #0
LDMLSFD sp!, {ip}
BLS __fp_return_NaN
dcheck_opnd2_NaN
LDMFD sp!, {ip}
MOV dOP1h, dOP2h
MOV dOP1l, dOP2l
TST dOP1h, #dSignalBit
BNE __fp_return_NaN ;; RDCFix: Do we really want to do this?
; BEQ __fp_return_NaN
B __fp_exception
; Return NaN in fOP / dOP, except for non-float returning functions.
; IP contains exception flags.
__fp_return_NaN
; test for special cases
;;
;; RDCFix: Will need to fix this once new defines are in. May want to
;; do some performance enhancements to keep from needing to check
;; each _Fp* operation code. Maybe a jump table. Maybe forget
;; this garbage and make the core emulation routines pack up
;; their proper results instead of hacking them up here.
;;
; AND a4, ip, #Fn_mask
; CMP a4, #CompareFalseFn
; CMPNE a4, #FixZeroFn
; BEQ return_zero
; CMP a4, #CompareTrueFn
; BEQ return_one
; CMP a4, #CmpLessFn
; BEQ return_HI
; CMP a4, #CmpGreaterFn
; BEQ return_LO
; CMP a4, #CmpEqualFn
; BEQ return_NE
; CMP a4, #FixFn
; BEQ return_smaxint
; CMP a4, #FixuFn
; BEQ return_umaxint
ReturnToLR
return_HI
MOV a1, #1
CMP a1, #0
ReturnToLR_flg
return_LO
MOV a1, #0
CMP a1, #1
ReturnToLR_flg
return_NE
MOVS a1, #1
ReturnToLR_flg
return_one
MOV a1, #1
ReturnToLR
return_zero
MOV a1, #0
MOV a2, #0
ReturnToLR
return_smaxint
MOV a3, a1
TST ip, #LongLong_bit
MOVEQ a1, #0x7fffffff
MOVNE a1, #0xffffffff
MOVNE a2, #0x7fffffff
TST a3, #Sign_bit
MVNNE a1, a1
MVNNE a2, a2
ReturnToLR
return_umaxint
MOV a1, #0xffffffff
MOV a2, #0xffffffff
ReturnToLR
__fp_return_Inf
; no special cases
ReturnToLR
]
;==============================================================================
;Error generation - from fplib code
[ :DEF: except_s
AREA |.text|, CODE, READONLY
; SWI Names
[ :DEF: thumb
CODE32
]
EXPORT __fp_veneer_error
EXPORT __fp_nonveneer_error
EXPORT __fp_exception
IMPORT __fp_return_NaN
IMPORT __fp_return_Inf
__fp_veneer_error ; a4 contains the exception flags
__fp_nonveneer_error ; a4 contains the exception flags OBSOLETE
MOV ip, a4
; fallthrough
; fp_exception is called when an IEEE exception has occurred
; a1 contains the sign of the NaN to be returned if the exception is disabled
; ip contains the exception flags (see fpe.s for a list)
__fp_exception
IMPORT FPE_Raise
STMDB sp!,{lr}
TST ip,#OVF_bit
BNE overflow
TST ip,#UNF_bit
BNE underflow
TST ip,#DVZ_bit
BNE divide_by_zero
TST ip,#INX_bit
BNE divide_by_zero
invalid_operation
BL return_NaN
B callraise
overflow
BL return_Inf
B callraise
underflow
MOV a1, #0
MOV a2, #0
B callraise
inexact
B callraise
divide_by_zero
BL return_Inf
callraise
IF Interworking :LOR: Thumbing
LDMIA sp!, {lr}
BX lr
ELSE
LDMIA sp!, {pc}
ENDIF
;GenerateError
; IMPORT RaiseException
; [ :DEF:EMBEDDED_CLIB
; STMDB sp!, {r0-r15}
; SUB lr, lr, #4
; STR lr, [sp, #15*4]
; MOV r1, sp
; |
; LDR r1,ErrBlock
; SUB lr,lr,#4
; STR lr,[r1,#15*4]
; MOV lr,#&de00
; ORR lr,lr,#&00ad
; ORR lr,lr,lr,LSL #16
; STMIA r1,{r0-r14}
; B RaiseException
status_ptr
IMPORT __fp_status_flags
DCD __fp_status_flags
ErrBlock
IMPORT __fp_errblock
DCD __fp_errblock
trap
; ]
IMPORT __rt_trap
LDR ip, =__rt_trap
CMP ip, #0
[ Interworking :LOR:(:DEF:thumb)
BXNE ip
|
MOVNE pc, ip
]
DCD 0xe6000010
ErrorBlock FP_IVO, "Floating Point Exception: Invalid Operation"
ErrorBlock FP_OFL, "Floating Point Exception: Overflow"
ErrorBlock FP_DVZ, "Floating Point Exception: Divide By Zero"
return_Inf
AND a3,a1,#Sign_bit
TST ip,#Double_bit
ADRNE a1,prototype_double_Inf
LDMNEIA a1,{a1,a2}
LDREQ a1,prototype_single_Inf
ORR a1,a1,a3
B __fp_return_Inf
return_NaN
AND a3, a1, #Sign_bit
TST ip, #Double_bit
ADRNE a1,prototype_double_NaN
LDMNEIA a1,{a1,a2}
LDREQ a1,prototype_single_NaN
ORR a1, a1, a3
B __fp_return_NaN
prototype_double_Inf
DCD &7ff00000,&00000000
prototype_single_Inf
DCD &7f800000
prototype_double_NaN
DCD &7ff00000,&00000001
prototype_single_NaN
DCD &7f800001
]
;------------------------------------------------------------------------------
[ :DEF: fpdata_s
AREA |.data|, DATA
EXPORT __fp_status_flags
__fp_status_flags
; default - all flags enabled.
DCD (&40:SHL:SysID_pos):OR:(((1:SHL:Except_len)-1):SHL:FPExceptE_pos)
EXPORT __fp_errblock
__fp_errblock
DCD 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0
EXPORT __rt_trap
__rt_trap
DCD 0
]
;==============================================================================
END
|
assets/assembly/IA32/linux_nasm_progs/nasm_linux_ORG_CH10/module1.asm | edassis/SB-Tradutor | 1 | 95466 | ;Multimodule program for string length MODULE1.ASM
;
; Objective: To show parameter passing via registers.
; Input: Requests two integers from keyboard.
; Output: Outputs the sum of the input integers.
BUF_SIZE EQU 41 ; string buffer size
%include "io.mac"
.DATA
prompt_msg db "Please input a string: ",0
length_msg db "String length is: ",0
.UDATA
string1 resb BUF_SIZE
.CODE
extern string_length
.STARTUP
PutStr prompt_msg ; request a string
GetStr string1,BUF_SIZE ; read string input
mov EBX,string1 ; EBX := string pointer
call string_length ; returns string length in AX
PutStr length_msg ; display string length
PutInt AX
nwln
done:
.EXIT
|
kernel/kernel.asm | noakrams/OS-assignment1 | 0 | 19136 |
kernel/kernel: file format elf64-littleriscv
Disassembly of section .text:
0000000080000000 <_entry>:
80000000: 00009117 auipc sp,0x9
80000004: 18010113 addi sp,sp,384 # 80009180 <stack0>
80000008: 6505 lui a0,0x1
8000000a: f14025f3 csrr a1,mhartid
8000000e: 0585 addi a1,a1,1
80000010: 02b50533 mul a0,a0,a1
80000014: 912a add sp,sp,a0
80000016: 078000ef jal ra,8000008e <start>
000000008000001a <spin>:
8000001a: a001 j 8000001a <spin>
000000008000001c <timerinit>:
// which arrive at timervec in kernelvec.S,
// which turns them into software interrupts for
// devintr() in trap.c.
void
timerinit()
{
8000001c: 1141 addi sp,sp,-16
8000001e: e422 sd s0,8(sp)
80000020: 0800 addi s0,sp,16
// which hart (core) is this?
static inline uint64
r_mhartid()
{
uint64 x;
asm volatile("csrr %0, mhartid" : "=r" (x) );
80000022: f14027f3 csrr a5,mhartid
// each CPU has a separate source of timer interrupts.
int id = r_mhartid();
80000026: 0007869b sext.w a3,a5
// ask the CLINT for a timer interrupt.
int interval = 1000000; // cycles; about 1/10th second in qemu.
*(uint64*)CLINT_MTIMECMP(id) = *(uint64*)CLINT_MTIME + interval;
8000002a: 0037979b slliw a5,a5,0x3
8000002e: 02004737 lui a4,0x2004
80000032: 97ba add a5,a5,a4
80000034: 0200c737 lui a4,0x200c
80000038: ff873583 ld a1,-8(a4) # 200bff8 <_entry-0x7dff4008>
8000003c: 000f4637 lui a2,0xf4
80000040: 24060613 addi a2,a2,576 # f4240 <_entry-0x7ff0bdc0>
80000044: 95b2 add a1,a1,a2
80000046: e38c sd a1,0(a5)
// prepare information in scratch[] for timervec.
// scratch[0..2] : space for timervec to save registers.
// scratch[3] : address of CLINT MTIMECMP register.
// scratch[4] : desired interval (in cycles) between timer interrupts.
uint64 *scratch = &timer_scratch[id][0];
80000048: 00269713 slli a4,a3,0x2
8000004c: 9736 add a4,a4,a3
8000004e: 00371693 slli a3,a4,0x3
80000052: 00009717 auipc a4,0x9
80000056: fee70713 addi a4,a4,-18 # 80009040 <timer_scratch>
8000005a: 9736 add a4,a4,a3
scratch[3] = CLINT_MTIMECMP(id);
8000005c: ef1c sd a5,24(a4)
scratch[4] = interval;
8000005e: f310 sd a2,32(a4)
}
static inline void
w_mscratch(uint64 x)
{
asm volatile("csrw mscratch, %0" : : "r" (x));
80000060: 34071073 csrw mscratch,a4
asm volatile("csrw mtvec, %0" : : "r" (x));
80000064: 00006797 auipc a5,0x6
80000068: fbc78793 addi a5,a5,-68 # 80006020 <timervec>
8000006c: 30579073 csrw mtvec,a5
asm volatile("csrr %0, mstatus" : "=r" (x) );
80000070: 300027f3 csrr a5,mstatus
// set the machine-mode trap handler.
w_mtvec((uint64)timervec);
// enable machine-mode interrupts.
w_mstatus(r_mstatus() | MSTATUS_MIE);
80000074: 0087e793 ori a5,a5,8
asm volatile("csrw mstatus, %0" : : "r" (x));
80000078: 30079073 csrw mstatus,a5
asm volatile("csrr %0, mie" : "=r" (x) );
8000007c: 304027f3 csrr a5,mie
// enable machine-mode timer interrupts.
w_mie(r_mie() | MIE_MTIE);
80000080: 0807e793 ori a5,a5,128
asm volatile("csrw mie, %0" : : "r" (x));
80000084: 30479073 csrw mie,a5
}
80000088: 6422 ld s0,8(sp)
8000008a: 0141 addi sp,sp,16
8000008c: 8082 ret
000000008000008e <start>:
{
8000008e: 1141 addi sp,sp,-16
80000090: e406 sd ra,8(sp)
80000092: e022 sd s0,0(sp)
80000094: 0800 addi s0,sp,16
asm volatile("csrr %0, mstatus" : "=r" (x) );
80000096: 300027f3 csrr a5,mstatus
x &= ~MSTATUS_MPP_MASK;
8000009a: 7779 lui a4,0xffffe
8000009c: 7ff70713 addi a4,a4,2047 # ffffffffffffe7ff <end+0xffffffff7ffd77ff>
800000a0: 8ff9 and a5,a5,a4
x |= MSTATUS_MPP_S;
800000a2: 6705 lui a4,0x1
800000a4: 80070713 addi a4,a4,-2048 # 800 <_entry-0x7ffff800>
800000a8: 8fd9 or a5,a5,a4
asm volatile("csrw mstatus, %0" : : "r" (x));
800000aa: 30079073 csrw mstatus,a5
asm volatile("csrw mepc, %0" : : "r" (x));
800000ae: 00001797 auipc a5,0x1
800000b2: dbe78793 addi a5,a5,-578 # 80000e6c <main>
800000b6: 34179073 csrw mepc,a5
asm volatile("csrw satp, %0" : : "r" (x));
800000ba: 4781 li a5,0
800000bc: 18079073 csrw satp,a5
asm volatile("csrw medeleg, %0" : : "r" (x));
800000c0: 67c1 lui a5,0x10
800000c2: 17fd addi a5,a5,-1
800000c4: 30279073 csrw medeleg,a5
asm volatile("csrw mideleg, %0" : : "r" (x));
800000c8: 30379073 csrw mideleg,a5
asm volatile("csrr %0, sie" : "=r" (x) );
800000cc: 104027f3 csrr a5,sie
w_sie(r_sie() | SIE_SEIE | SIE_STIE | SIE_SSIE);
800000d0: 2227e793 ori a5,a5,546
asm volatile("csrw sie, %0" : : "r" (x));
800000d4: 10479073 csrw sie,a5
timerinit();
800000d8: 00000097 auipc ra,0x0
800000dc: f44080e7 jalr -188(ra) # 8000001c <timerinit>
asm volatile("csrr %0, mhartid" : "=r" (x) );
800000e0: f14027f3 csrr a5,mhartid
w_tp(id);
800000e4: 2781 sext.w a5,a5
}
static inline void
w_tp(uint64 x)
{
asm volatile("mv tp, %0" : : "r" (x));
800000e6: 823e mv tp,a5
asm volatile("mret");
800000e8: 30200073 mret
}
800000ec: 60a2 ld ra,8(sp)
800000ee: 6402 ld s0,0(sp)
800000f0: 0141 addi sp,sp,16
800000f2: 8082 ret
00000000800000f4 <consolewrite>:
//
// user write()s to the console go here.
//
int
consolewrite(int user_src, uint64 src, int n)
{
800000f4: 715d addi sp,sp,-80
800000f6: e486 sd ra,72(sp)
800000f8: e0a2 sd s0,64(sp)
800000fa: fc26 sd s1,56(sp)
800000fc: f84a sd s2,48(sp)
800000fe: f44e sd s3,40(sp)
80000100: f052 sd s4,32(sp)
80000102: ec56 sd s5,24(sp)
80000104: 0880 addi s0,sp,80
int i;
for(i = 0; i < n; i++){
80000106: 04c05663 blez a2,80000152 <consolewrite+0x5e>
8000010a: 8a2a mv s4,a0
8000010c: 84ae mv s1,a1
8000010e: 89b2 mv s3,a2
80000110: 4901 li s2,0
char c;
if(either_copyin(&c, user_src, src+i, 1) == -1)
80000112: 5afd li s5,-1
80000114: 4685 li a3,1
80000116: 8626 mv a2,s1
80000118: 85d2 mv a1,s4
8000011a: fbf40513 addi a0,s0,-65
8000011e: 00002097 auipc ra,0x2
80000122: 5da080e7 jalr 1498(ra) # 800026f8 <either_copyin>
80000126: 01550c63 beq a0,s5,8000013e <consolewrite+0x4a>
break;
uartputc(c);
8000012a: fbf44503 lbu a0,-65(s0)
8000012e: 00000097 auipc ra,0x0
80000132: 77a080e7 jalr 1914(ra) # 800008a8 <uartputc>
for(i = 0; i < n; i++){
80000136: 2905 addiw s2,s2,1
80000138: 0485 addi s1,s1,1
8000013a: fd299de3 bne s3,s2,80000114 <consolewrite+0x20>
}
return i;
}
8000013e: 854a mv a0,s2
80000140: 60a6 ld ra,72(sp)
80000142: 6406 ld s0,64(sp)
80000144: 74e2 ld s1,56(sp)
80000146: 7942 ld s2,48(sp)
80000148: 79a2 ld s3,40(sp)
8000014a: 7a02 ld s4,32(sp)
8000014c: 6ae2 ld s5,24(sp)
8000014e: 6161 addi sp,sp,80
80000150: 8082 ret
for(i = 0; i < n; i++){
80000152: 4901 li s2,0
80000154: b7ed j 8000013e <consolewrite+0x4a>
0000000080000156 <consoleread>:
// user_dist indicates whether dst is a user
// or kernel address.
//
int
consoleread(int user_dst, uint64 dst, int n)
{
80000156: 7159 addi sp,sp,-112
80000158: f486 sd ra,104(sp)
8000015a: f0a2 sd s0,96(sp)
8000015c: eca6 sd s1,88(sp)
8000015e: e8ca sd s2,80(sp)
80000160: e4ce sd s3,72(sp)
80000162: e0d2 sd s4,64(sp)
80000164: fc56 sd s5,56(sp)
80000166: f85a sd s6,48(sp)
80000168: f45e sd s7,40(sp)
8000016a: f062 sd s8,32(sp)
8000016c: ec66 sd s9,24(sp)
8000016e: e86a sd s10,16(sp)
80000170: 1880 addi s0,sp,112
80000172: 8aaa mv s5,a0
80000174: 8a2e mv s4,a1
80000176: 89b2 mv s3,a2
uint target;
int c;
char cbuf;
target = n;
80000178: 00060b1b sext.w s6,a2
acquire(&cons.lock);
8000017c: 00011517 auipc a0,0x11
80000180: 00450513 addi a0,a0,4 # 80011180 <cons>
80000184: 00001097 auipc ra,0x1
80000188: a3e080e7 jalr -1474(ra) # 80000bc2 <acquire>
while(n > 0){
// wait until interrupt handler has put some
// input into cons.buffer.
while(cons.r == cons.w){
8000018c: 00011497 auipc s1,0x11
80000190: ff448493 addi s1,s1,-12 # 80011180 <cons>
if(myproc()->killed){
release(&cons.lock);
return -1;
}
sleep(&cons.r, &cons.lock);
80000194: 00011917 auipc s2,0x11
80000198: 08490913 addi s2,s2,132 # 80011218 <cons+0x98>
}
c = cons.buf[cons.r++ % INPUT_BUF];
if(c == C('D')){ // end-of-file
8000019c: 4b91 li s7,4
break;
}
// copy the input byte to the user-space buffer.
cbuf = c;
if(either_copyout(user_dst, dst, &cbuf, 1) == -1)
8000019e: 5c7d li s8,-1
break;
dst++;
--n;
if(c == '\n'){
800001a0: 4ca9 li s9,10
while(n > 0){
800001a2: 07305863 blez s3,80000212 <consoleread+0xbc>
while(cons.r == cons.w){
800001a6: 0984a783 lw a5,152(s1)
800001aa: 09c4a703 lw a4,156(s1)
800001ae: 02f71463 bne a4,a5,800001d6 <consoleread+0x80>
if(myproc()->killed){
800001b2: 00001097 auipc ra,0x1
800001b6: 7cc080e7 jalr 1996(ra) # 8000197e <myproc>
800001ba: 551c lw a5,40(a0)
800001bc: e7b5 bnez a5,80000228 <consoleread+0xd2>
sleep(&cons.r, &cons.lock);
800001be: 85a6 mv a1,s1
800001c0: 854a mv a0,s2
800001c2: 00002097 auipc ra,0x2
800001c6: f32080e7 jalr -206(ra) # 800020f4 <sleep>
while(cons.r == cons.w){
800001ca: 0984a783 lw a5,152(s1)
800001ce: 09c4a703 lw a4,156(s1)
800001d2: fef700e3 beq a4,a5,800001b2 <consoleread+0x5c>
c = cons.buf[cons.r++ % INPUT_BUF];
800001d6: 0017871b addiw a4,a5,1
800001da: 08e4ac23 sw a4,152(s1)
800001de: 07f7f713 andi a4,a5,127
800001e2: 9726 add a4,a4,s1
800001e4: 01874703 lbu a4,24(a4)
800001e8: 00070d1b sext.w s10,a4
if(c == C('D')){ // end-of-file
800001ec: 077d0563 beq s10,s7,80000256 <consoleread+0x100>
cbuf = c;
800001f0: f8e40fa3 sb a4,-97(s0)
if(either_copyout(user_dst, dst, &cbuf, 1) == -1)
800001f4: 4685 li a3,1
800001f6: f9f40613 addi a2,s0,-97
800001fa: 85d2 mv a1,s4
800001fc: 8556 mv a0,s5
800001fe: 00002097 auipc ra,0x2
80000202: 4a4080e7 jalr 1188(ra) # 800026a2 <either_copyout>
80000206: 01850663 beq a0,s8,80000212 <consoleread+0xbc>
dst++;
8000020a: 0a05 addi s4,s4,1
--n;
8000020c: 39fd addiw s3,s3,-1
if(c == '\n'){
8000020e: f99d1ae3 bne s10,s9,800001a2 <consoleread+0x4c>
// a whole line has arrived, return to
// the user-level read().
break;
}
}
release(&cons.lock);
80000212: 00011517 auipc a0,0x11
80000216: f6e50513 addi a0,a0,-146 # 80011180 <cons>
8000021a: 00001097 auipc ra,0x1
8000021e: a5c080e7 jalr -1444(ra) # 80000c76 <release>
return target - n;
80000222: 413b053b subw a0,s6,s3
80000226: a811 j 8000023a <consoleread+0xe4>
release(&cons.lock);
80000228: 00011517 auipc a0,0x11
8000022c: f5850513 addi a0,a0,-168 # 80011180 <cons>
80000230: 00001097 auipc ra,0x1
80000234: a46080e7 jalr -1466(ra) # 80000c76 <release>
return -1;
80000238: 557d li a0,-1
}
8000023a: 70a6 ld ra,104(sp)
8000023c: 7406 ld s0,96(sp)
8000023e: 64e6 ld s1,88(sp)
80000240: 6946 ld s2,80(sp)
80000242: 69a6 ld s3,72(sp)
80000244: 6a06 ld s4,64(sp)
80000246: 7ae2 ld s5,56(sp)
80000248: 7b42 ld s6,48(sp)
8000024a: 7ba2 ld s7,40(sp)
8000024c: 7c02 ld s8,32(sp)
8000024e: 6ce2 ld s9,24(sp)
80000250: 6d42 ld s10,16(sp)
80000252: 6165 addi sp,sp,112
80000254: 8082 ret
if(n < target){
80000256: 0009871b sext.w a4,s3
8000025a: fb677ce3 bgeu a4,s6,80000212 <consoleread+0xbc>
cons.r--;
8000025e: 00011717 auipc a4,0x11
80000262: faf72d23 sw a5,-70(a4) # 80011218 <cons+0x98>
80000266: b775 j 80000212 <consoleread+0xbc>
0000000080000268 <consputc>:
{
80000268: 1141 addi sp,sp,-16
8000026a: e406 sd ra,8(sp)
8000026c: e022 sd s0,0(sp)
8000026e: 0800 addi s0,sp,16
if(c == BACKSPACE){
80000270: 10000793 li a5,256
80000274: 00f50a63 beq a0,a5,80000288 <consputc+0x20>
uartputc_sync(c);
80000278: 00000097 auipc ra,0x0
8000027c: 55e080e7 jalr 1374(ra) # 800007d6 <uartputc_sync>
}
80000280: 60a2 ld ra,8(sp)
80000282: 6402 ld s0,0(sp)
80000284: 0141 addi sp,sp,16
80000286: 8082 ret
uartputc_sync('\b'); uartputc_sync(' '); uartputc_sync('\b');
80000288: 4521 li a0,8
8000028a: 00000097 auipc ra,0x0
8000028e: 54c080e7 jalr 1356(ra) # 800007d6 <uartputc_sync>
80000292: 02000513 li a0,32
80000296: 00000097 auipc ra,0x0
8000029a: 540080e7 jalr 1344(ra) # 800007d6 <uartputc_sync>
8000029e: 4521 li a0,8
800002a0: 00000097 auipc ra,0x0
800002a4: 536080e7 jalr 1334(ra) # 800007d6 <uartputc_sync>
800002a8: bfe1 j 80000280 <consputc+0x18>
00000000800002aa <consoleintr>:
// do erase/kill processing, append to cons.buf,
// wake up consoleread() if a whole line has arrived.
//
void
consoleintr(int c)
{
800002aa: 1101 addi sp,sp,-32
800002ac: ec06 sd ra,24(sp)
800002ae: e822 sd s0,16(sp)
800002b0: e426 sd s1,8(sp)
800002b2: e04a sd s2,0(sp)
800002b4: 1000 addi s0,sp,32
800002b6: 84aa mv s1,a0
acquire(&cons.lock);
800002b8: 00011517 auipc a0,0x11
800002bc: ec850513 addi a0,a0,-312 # 80011180 <cons>
800002c0: 00001097 auipc ra,0x1
800002c4: 902080e7 jalr -1790(ra) # 80000bc2 <acquire>
switch(c){
800002c8: 47d5 li a5,21
800002ca: 0af48663 beq s1,a5,80000376 <consoleintr+0xcc>
800002ce: 0297ca63 blt a5,s1,80000302 <consoleintr+0x58>
800002d2: 47a1 li a5,8
800002d4: 0ef48763 beq s1,a5,800003c2 <consoleintr+0x118>
800002d8: 47c1 li a5,16
800002da: 10f49a63 bne s1,a5,800003ee <consoleintr+0x144>
case C('P'): // Print process list.
procdump();
800002de: 00002097 auipc ra,0x2
800002e2: 470080e7 jalr 1136(ra) # 8000274e <procdump>
}
}
break;
}
release(&cons.lock);
800002e6: 00011517 auipc a0,0x11
800002ea: e9a50513 addi a0,a0,-358 # 80011180 <cons>
800002ee: 00001097 auipc ra,0x1
800002f2: 988080e7 jalr -1656(ra) # 80000c76 <release>
}
800002f6: 60e2 ld ra,24(sp)
800002f8: 6442 ld s0,16(sp)
800002fa: 64a2 ld s1,8(sp)
800002fc: 6902 ld s2,0(sp)
800002fe: 6105 addi sp,sp,32
80000300: 8082 ret
switch(c){
80000302: 07f00793 li a5,127
80000306: 0af48e63 beq s1,a5,800003c2 <consoleintr+0x118>
if(c != 0 && cons.e-cons.r < INPUT_BUF){
8000030a: 00011717 auipc a4,0x11
8000030e: e7670713 addi a4,a4,-394 # 80011180 <cons>
80000312: 0a072783 lw a5,160(a4)
80000316: 09872703 lw a4,152(a4)
8000031a: 9f99 subw a5,a5,a4
8000031c: 07f00713 li a4,127
80000320: fcf763e3 bltu a4,a5,800002e6 <consoleintr+0x3c>
c = (c == '\r') ? '\n' : c;
80000324: 47b5 li a5,13
80000326: 0cf48763 beq s1,a5,800003f4 <consoleintr+0x14a>
consputc(c);
8000032a: 8526 mv a0,s1
8000032c: 00000097 auipc ra,0x0
80000330: f3c080e7 jalr -196(ra) # 80000268 <consputc>
cons.buf[cons.e++ % INPUT_BUF] = c;
80000334: 00011797 auipc a5,0x11
80000338: e4c78793 addi a5,a5,-436 # 80011180 <cons>
8000033c: 0a07a703 lw a4,160(a5)
80000340: 0017069b addiw a3,a4,1
80000344: 0006861b sext.w a2,a3
80000348: 0ad7a023 sw a3,160(a5)
8000034c: 07f77713 andi a4,a4,127
80000350: 97ba add a5,a5,a4
80000352: 00978c23 sb s1,24(a5)
if(c == '\n' || c == C('D') || cons.e == cons.r+INPUT_BUF){
80000356: 47a9 li a5,10
80000358: 0cf48563 beq s1,a5,80000422 <consoleintr+0x178>
8000035c: 4791 li a5,4
8000035e: 0cf48263 beq s1,a5,80000422 <consoleintr+0x178>
80000362: 00011797 auipc a5,0x11
80000366: eb67a783 lw a5,-330(a5) # 80011218 <cons+0x98>
8000036a: 0807879b addiw a5,a5,128
8000036e: f6f61ce3 bne a2,a5,800002e6 <consoleintr+0x3c>
cons.buf[cons.e++ % INPUT_BUF] = c;
80000372: 863e mv a2,a5
80000374: a07d j 80000422 <consoleintr+0x178>
while(cons.e != cons.w &&
80000376: 00011717 auipc a4,0x11
8000037a: e0a70713 addi a4,a4,-502 # 80011180 <cons>
8000037e: 0a072783 lw a5,160(a4)
80000382: 09c72703 lw a4,156(a4)
cons.buf[(cons.e-1) % INPUT_BUF] != '\n'){
80000386: 00011497 auipc s1,0x11
8000038a: dfa48493 addi s1,s1,-518 # 80011180 <cons>
while(cons.e != cons.w &&
8000038e: 4929 li s2,10
80000390: f4f70be3 beq a4,a5,800002e6 <consoleintr+0x3c>
cons.buf[(cons.e-1) % INPUT_BUF] != '\n'){
80000394: 37fd addiw a5,a5,-1
80000396: 07f7f713 andi a4,a5,127
8000039a: 9726 add a4,a4,s1
while(cons.e != cons.w &&
8000039c: 01874703 lbu a4,24(a4)
800003a0: f52703e3 beq a4,s2,800002e6 <consoleintr+0x3c>
cons.e--;
800003a4: 0af4a023 sw a5,160(s1)
consputc(BACKSPACE);
800003a8: 10000513 li a0,256
800003ac: 00000097 auipc ra,0x0
800003b0: ebc080e7 jalr -324(ra) # 80000268 <consputc>
while(cons.e != cons.w &&
800003b4: 0a04a783 lw a5,160(s1)
800003b8: 09c4a703 lw a4,156(s1)
800003bc: fcf71ce3 bne a4,a5,80000394 <consoleintr+0xea>
800003c0: b71d j 800002e6 <consoleintr+0x3c>
if(cons.e != cons.w){
800003c2: 00011717 auipc a4,0x11
800003c6: dbe70713 addi a4,a4,-578 # 80011180 <cons>
800003ca: 0a072783 lw a5,160(a4)
800003ce: 09c72703 lw a4,156(a4)
800003d2: f0f70ae3 beq a4,a5,800002e6 <consoleintr+0x3c>
cons.e--;
800003d6: 37fd addiw a5,a5,-1
800003d8: 00011717 auipc a4,0x11
800003dc: e4f72423 sw a5,-440(a4) # 80011220 <cons+0xa0>
consputc(BACKSPACE);
800003e0: 10000513 li a0,256
800003e4: 00000097 auipc ra,0x0
800003e8: e84080e7 jalr -380(ra) # 80000268 <consputc>
800003ec: bded j 800002e6 <consoleintr+0x3c>
if(c != 0 && cons.e-cons.r < INPUT_BUF){
800003ee: ee048ce3 beqz s1,800002e6 <consoleintr+0x3c>
800003f2: bf21 j 8000030a <consoleintr+0x60>
consputc(c);
800003f4: 4529 li a0,10
800003f6: 00000097 auipc ra,0x0
800003fa: e72080e7 jalr -398(ra) # 80000268 <consputc>
cons.buf[cons.e++ % INPUT_BUF] = c;
800003fe: 00011797 auipc a5,0x11
80000402: d8278793 addi a5,a5,-638 # 80011180 <cons>
80000406: 0a07a703 lw a4,160(a5)
8000040a: 0017069b addiw a3,a4,1
8000040e: 0006861b sext.w a2,a3
80000412: 0ad7a023 sw a3,160(a5)
80000416: 07f77713 andi a4,a4,127
8000041a: 97ba add a5,a5,a4
8000041c: 4729 li a4,10
8000041e: 00e78c23 sb a4,24(a5)
cons.w = cons.e;
80000422: 00011797 auipc a5,0x11
80000426: dec7ad23 sw a2,-518(a5) # 8001121c <cons+0x9c>
wakeup(&cons.r);
8000042a: 00011517 auipc a0,0x11
8000042e: dee50513 addi a0,a0,-530 # 80011218 <cons+0x98>
80000432: 00002097 auipc ra,0x2
80000436: f36080e7 jalr -202(ra) # 80002368 <wakeup>
8000043a: b575 j 800002e6 <consoleintr+0x3c>
000000008000043c <consoleinit>:
void
consoleinit(void)
{
8000043c: 1141 addi sp,sp,-16
8000043e: e406 sd ra,8(sp)
80000440: e022 sd s0,0(sp)
80000442: 0800 addi s0,sp,16
initlock(&cons.lock, "cons");
80000444: 00008597 auipc a1,0x8
80000448: bcc58593 addi a1,a1,-1076 # 80008010 <etext+0x10>
8000044c: 00011517 auipc a0,0x11
80000450: d3450513 addi a0,a0,-716 # 80011180 <cons>
80000454: 00000097 auipc ra,0x0
80000458: 6de080e7 jalr 1758(ra) # 80000b32 <initlock>
uartinit();
8000045c: 00000097 auipc ra,0x0
80000460: 32a080e7 jalr 810(ra) # 80000786 <uartinit>
// connect read and write system calls
// to consoleread and consolewrite.
devsw[CONSOLE].read = consoleread;
80000464: 00022797 auipc a5,0x22
80000468: cb478793 addi a5,a5,-844 # 80022118 <devsw>
8000046c: 00000717 auipc a4,0x0
80000470: cea70713 addi a4,a4,-790 # 80000156 <consoleread>
80000474: eb98 sd a4,16(a5)
devsw[CONSOLE].write = consolewrite;
80000476: 00000717 auipc a4,0x0
8000047a: c7e70713 addi a4,a4,-898 # 800000f4 <consolewrite>
8000047e: ef98 sd a4,24(a5)
}
80000480: 60a2 ld ra,8(sp)
80000482: 6402 ld s0,0(sp)
80000484: 0141 addi sp,sp,16
80000486: 8082 ret
0000000080000488 <printint>:
static char digits[] = "0123456789abcdef";
static void
printint(int xx, int base, int sign)
{
80000488: 7179 addi sp,sp,-48
8000048a: f406 sd ra,40(sp)
8000048c: f022 sd s0,32(sp)
8000048e: ec26 sd s1,24(sp)
80000490: e84a sd s2,16(sp)
80000492: 1800 addi s0,sp,48
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
80000494: c219 beqz a2,8000049a <printint+0x12>
80000496: 08054663 bltz a0,80000522 <printint+0x9a>
x = -xx;
else
x = xx;
8000049a: 2501 sext.w a0,a0
8000049c: 4881 li a7,0
8000049e: fd040693 addi a3,s0,-48
i = 0;
800004a2: 4701 li a4,0
do {
buf[i++] = digits[x % base];
800004a4: 2581 sext.w a1,a1
800004a6: 00008617 auipc a2,0x8
800004aa: b9a60613 addi a2,a2,-1126 # 80008040 <digits>
800004ae: 883a mv a6,a4
800004b0: 2705 addiw a4,a4,1
800004b2: 02b577bb remuw a5,a0,a1
800004b6: 1782 slli a5,a5,0x20
800004b8: 9381 srli a5,a5,0x20
800004ba: 97b2 add a5,a5,a2
800004bc: 0007c783 lbu a5,0(a5)
800004c0: 00f68023 sb a5,0(a3)
} while((x /= base) != 0);
800004c4: 0005079b sext.w a5,a0
800004c8: 02b5553b divuw a0,a0,a1
800004cc: 0685 addi a3,a3,1
800004ce: feb7f0e3 bgeu a5,a1,800004ae <printint+0x26>
if(sign)
800004d2: 00088b63 beqz a7,800004e8 <printint+0x60>
buf[i++] = '-';
800004d6: fe040793 addi a5,s0,-32
800004da: 973e add a4,a4,a5
800004dc: 02d00793 li a5,45
800004e0: fef70823 sb a5,-16(a4)
800004e4: 0028071b addiw a4,a6,2
while(--i >= 0)
800004e8: 02e05763 blez a4,80000516 <printint+0x8e>
800004ec: fd040793 addi a5,s0,-48
800004f0: 00e784b3 add s1,a5,a4
800004f4: fff78913 addi s2,a5,-1
800004f8: 993a add s2,s2,a4
800004fa: 377d addiw a4,a4,-1
800004fc: 1702 slli a4,a4,0x20
800004fe: 9301 srli a4,a4,0x20
80000500: 40e90933 sub s2,s2,a4
consputc(buf[i]);
80000504: fff4c503 lbu a0,-1(s1)
80000508: 00000097 auipc ra,0x0
8000050c: d60080e7 jalr -672(ra) # 80000268 <consputc>
while(--i >= 0)
80000510: 14fd addi s1,s1,-1
80000512: ff2499e3 bne s1,s2,80000504 <printint+0x7c>
}
80000516: 70a2 ld ra,40(sp)
80000518: 7402 ld s0,32(sp)
8000051a: 64e2 ld s1,24(sp)
8000051c: 6942 ld s2,16(sp)
8000051e: 6145 addi sp,sp,48
80000520: 8082 ret
x = -xx;
80000522: 40a0053b negw a0,a0
if(sign && (sign = xx < 0))
80000526: 4885 li a7,1
x = -xx;
80000528: bf9d j 8000049e <printint+0x16>
000000008000052a <panic>:
release(&pr.lock);
}
void
panic(char *s)
{
8000052a: 1101 addi sp,sp,-32
8000052c: ec06 sd ra,24(sp)
8000052e: e822 sd s0,16(sp)
80000530: e426 sd s1,8(sp)
80000532: 1000 addi s0,sp,32
80000534: 84aa mv s1,a0
pr.locking = 0;
80000536: 00011797 auipc a5,0x11
8000053a: d007a523 sw zero,-758(a5) # 80011240 <pr+0x18>
printf("panic: ");
8000053e: 00008517 auipc a0,0x8
80000542: ada50513 addi a0,a0,-1318 # 80008018 <etext+0x18>
80000546: 00000097 auipc ra,0x0
8000054a: 02e080e7 jalr 46(ra) # 80000574 <printf>
printf(s);
8000054e: 8526 mv a0,s1
80000550: 00000097 auipc ra,0x0
80000554: 024080e7 jalr 36(ra) # 80000574 <printf>
printf("\n");
80000558: 00008517 auipc a0,0x8
8000055c: b7050513 addi a0,a0,-1168 # 800080c8 <digits+0x88>
80000560: 00000097 auipc ra,0x0
80000564: 014080e7 jalr 20(ra) # 80000574 <printf>
panicked = 1; // freeze uart output from other CPUs
80000568: 4785 li a5,1
8000056a: 00009717 auipc a4,0x9
8000056e: a8f72b23 sw a5,-1386(a4) # 80009000 <panicked>
for(;;)
80000572: a001 j 80000572 <panic+0x48>
0000000080000574 <printf>:
{
80000574: 7131 addi sp,sp,-192
80000576: fc86 sd ra,120(sp)
80000578: f8a2 sd s0,112(sp)
8000057a: f4a6 sd s1,104(sp)
8000057c: f0ca sd s2,96(sp)
8000057e: ecce sd s3,88(sp)
80000580: e8d2 sd s4,80(sp)
80000582: e4d6 sd s5,72(sp)
80000584: e0da sd s6,64(sp)
80000586: fc5e sd s7,56(sp)
80000588: f862 sd s8,48(sp)
8000058a: f466 sd s9,40(sp)
8000058c: f06a sd s10,32(sp)
8000058e: ec6e sd s11,24(sp)
80000590: 0100 addi s0,sp,128
80000592: 8a2a mv s4,a0
80000594: e40c sd a1,8(s0)
80000596: e810 sd a2,16(s0)
80000598: ec14 sd a3,24(s0)
8000059a: f018 sd a4,32(s0)
8000059c: f41c sd a5,40(s0)
8000059e: 03043823 sd a6,48(s0)
800005a2: 03143c23 sd a7,56(s0)
locking = pr.locking;
800005a6: 00011d97 auipc s11,0x11
800005aa: c9adad83 lw s11,-870(s11) # 80011240 <pr+0x18>
if(locking)
800005ae: 020d9b63 bnez s11,800005e4 <printf+0x70>
if (fmt == 0)
800005b2: 040a0263 beqz s4,800005f6 <printf+0x82>
va_start(ap, fmt);
800005b6: 00840793 addi a5,s0,8
800005ba: f8f43423 sd a5,-120(s0)
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
800005be: 000a4503 lbu a0,0(s4)
800005c2: 14050f63 beqz a0,80000720 <printf+0x1ac>
800005c6: 4981 li s3,0
if(c != '%'){
800005c8: 02500a93 li s5,37
switch(c){
800005cc: 07000b93 li s7,112
consputc('x');
800005d0: 4d41 li s10,16
consputc(digits[x >> (sizeof(uint64) * 8 - 4)]);
800005d2: 00008b17 auipc s6,0x8
800005d6: a6eb0b13 addi s6,s6,-1426 # 80008040 <digits>
switch(c){
800005da: 07300c93 li s9,115
800005de: 06400c13 li s8,100
800005e2: a82d j 8000061c <printf+0xa8>
acquire(&pr.lock);
800005e4: 00011517 auipc a0,0x11
800005e8: c4450513 addi a0,a0,-956 # 80011228 <pr>
800005ec: 00000097 auipc ra,0x0
800005f0: 5d6080e7 jalr 1494(ra) # 80000bc2 <acquire>
800005f4: bf7d j 800005b2 <printf+0x3e>
panic("null fmt");
800005f6: 00008517 auipc a0,0x8
800005fa: a3250513 addi a0,a0,-1486 # 80008028 <etext+0x28>
800005fe: 00000097 auipc ra,0x0
80000602: f2c080e7 jalr -212(ra) # 8000052a <panic>
consputc(c);
80000606: 00000097 auipc ra,0x0
8000060a: c62080e7 jalr -926(ra) # 80000268 <consputc>
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
8000060e: 2985 addiw s3,s3,1
80000610: 013a07b3 add a5,s4,s3
80000614: 0007c503 lbu a0,0(a5)
80000618: 10050463 beqz a0,80000720 <printf+0x1ac>
if(c != '%'){
8000061c: ff5515e3 bne a0,s5,80000606 <printf+0x92>
c = fmt[++i] & 0xff;
80000620: 2985 addiw s3,s3,1
80000622: 013a07b3 add a5,s4,s3
80000626: 0007c783 lbu a5,0(a5)
8000062a: 0007849b sext.w s1,a5
if(c == 0)
8000062e: cbed beqz a5,80000720 <printf+0x1ac>
switch(c){
80000630: 05778a63 beq a5,s7,80000684 <printf+0x110>
80000634: 02fbf663 bgeu s7,a5,80000660 <printf+0xec>
80000638: 09978863 beq a5,s9,800006c8 <printf+0x154>
8000063c: 07800713 li a4,120
80000640: 0ce79563 bne a5,a4,8000070a <printf+0x196>
printint(va_arg(ap, int), 16, 1);
80000644: f8843783 ld a5,-120(s0)
80000648: 00878713 addi a4,a5,8
8000064c: f8e43423 sd a4,-120(s0)
80000650: 4605 li a2,1
80000652: 85ea mv a1,s10
80000654: 4388 lw a0,0(a5)
80000656: 00000097 auipc ra,0x0
8000065a: e32080e7 jalr -462(ra) # 80000488 <printint>
break;
8000065e: bf45 j 8000060e <printf+0x9a>
switch(c){
80000660: 09578f63 beq a5,s5,800006fe <printf+0x18a>
80000664: 0b879363 bne a5,s8,8000070a <printf+0x196>
printint(va_arg(ap, int), 10, 1);
80000668: f8843783 ld a5,-120(s0)
8000066c: 00878713 addi a4,a5,8
80000670: f8e43423 sd a4,-120(s0)
80000674: 4605 li a2,1
80000676: 45a9 li a1,10
80000678: 4388 lw a0,0(a5)
8000067a: 00000097 auipc ra,0x0
8000067e: e0e080e7 jalr -498(ra) # 80000488 <printint>
break;
80000682: b771 j 8000060e <printf+0x9a>
printptr(va_arg(ap, uint64));
80000684: f8843783 ld a5,-120(s0)
80000688: 00878713 addi a4,a5,8
8000068c: f8e43423 sd a4,-120(s0)
80000690: 0007b903 ld s2,0(a5)
consputc('0');
80000694: 03000513 li a0,48
80000698: 00000097 auipc ra,0x0
8000069c: bd0080e7 jalr -1072(ra) # 80000268 <consputc>
consputc('x');
800006a0: 07800513 li a0,120
800006a4: 00000097 auipc ra,0x0
800006a8: bc4080e7 jalr -1084(ra) # 80000268 <consputc>
800006ac: 84ea mv s1,s10
consputc(digits[x >> (sizeof(uint64) * 8 - 4)]);
800006ae: 03c95793 srli a5,s2,0x3c
800006b2: 97da add a5,a5,s6
800006b4: 0007c503 lbu a0,0(a5)
800006b8: 00000097 auipc ra,0x0
800006bc: bb0080e7 jalr -1104(ra) # 80000268 <consputc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
800006c0: 0912 slli s2,s2,0x4
800006c2: 34fd addiw s1,s1,-1
800006c4: f4ed bnez s1,800006ae <printf+0x13a>
800006c6: b7a1 j 8000060e <printf+0x9a>
if((s = va_arg(ap, char*)) == 0)
800006c8: f8843783 ld a5,-120(s0)
800006cc: 00878713 addi a4,a5,8
800006d0: f8e43423 sd a4,-120(s0)
800006d4: 6384 ld s1,0(a5)
800006d6: cc89 beqz s1,800006f0 <printf+0x17c>
for(; *s; s++)
800006d8: 0004c503 lbu a0,0(s1)
800006dc: d90d beqz a0,8000060e <printf+0x9a>
consputc(*s);
800006de: 00000097 auipc ra,0x0
800006e2: b8a080e7 jalr -1142(ra) # 80000268 <consputc>
for(; *s; s++)
800006e6: 0485 addi s1,s1,1
800006e8: 0004c503 lbu a0,0(s1)
800006ec: f96d bnez a0,800006de <printf+0x16a>
800006ee: b705 j 8000060e <printf+0x9a>
s = "(null)";
800006f0: 00008497 auipc s1,0x8
800006f4: 93048493 addi s1,s1,-1744 # 80008020 <etext+0x20>
for(; *s; s++)
800006f8: 02800513 li a0,40
800006fc: b7cd j 800006de <printf+0x16a>
consputc('%');
800006fe: 8556 mv a0,s5
80000700: 00000097 auipc ra,0x0
80000704: b68080e7 jalr -1176(ra) # 80000268 <consputc>
break;
80000708: b719 j 8000060e <printf+0x9a>
consputc('%');
8000070a: 8556 mv a0,s5
8000070c: 00000097 auipc ra,0x0
80000710: b5c080e7 jalr -1188(ra) # 80000268 <consputc>
consputc(c);
80000714: 8526 mv a0,s1
80000716: 00000097 auipc ra,0x0
8000071a: b52080e7 jalr -1198(ra) # 80000268 <consputc>
break;
8000071e: bdc5 j 8000060e <printf+0x9a>
if(locking)
80000720: 020d9163 bnez s11,80000742 <printf+0x1ce>
}
80000724: 70e6 ld ra,120(sp)
80000726: 7446 ld s0,112(sp)
80000728: 74a6 ld s1,104(sp)
8000072a: 7906 ld s2,96(sp)
8000072c: 69e6 ld s3,88(sp)
8000072e: 6a46 ld s4,80(sp)
80000730: 6aa6 ld s5,72(sp)
80000732: 6b06 ld s6,64(sp)
80000734: 7be2 ld s7,56(sp)
80000736: 7c42 ld s8,48(sp)
80000738: 7ca2 ld s9,40(sp)
8000073a: 7d02 ld s10,32(sp)
8000073c: 6de2 ld s11,24(sp)
8000073e: 6129 addi sp,sp,192
80000740: 8082 ret
release(&pr.lock);
80000742: 00011517 auipc a0,0x11
80000746: ae650513 addi a0,a0,-1306 # 80011228 <pr>
8000074a: 00000097 auipc ra,0x0
8000074e: 52c080e7 jalr 1324(ra) # 80000c76 <release>
}
80000752: bfc9 j 80000724 <printf+0x1b0>
0000000080000754 <printfinit>:
;
}
void
printfinit(void)
{
80000754: 1101 addi sp,sp,-32
80000756: ec06 sd ra,24(sp)
80000758: e822 sd s0,16(sp)
8000075a: e426 sd s1,8(sp)
8000075c: 1000 addi s0,sp,32
initlock(&pr.lock, "pr");
8000075e: 00011497 auipc s1,0x11
80000762: aca48493 addi s1,s1,-1334 # 80011228 <pr>
80000766: 00008597 auipc a1,0x8
8000076a: 8d258593 addi a1,a1,-1838 # 80008038 <etext+0x38>
8000076e: 8526 mv a0,s1
80000770: 00000097 auipc ra,0x0
80000774: 3c2080e7 jalr 962(ra) # 80000b32 <initlock>
pr.locking = 1;
80000778: 4785 li a5,1
8000077a: cc9c sw a5,24(s1)
}
8000077c: 60e2 ld ra,24(sp)
8000077e: 6442 ld s0,16(sp)
80000780: 64a2 ld s1,8(sp)
80000782: 6105 addi sp,sp,32
80000784: 8082 ret
0000000080000786 <uartinit>:
void uartstart();
void
uartinit(void)
{
80000786: 1141 addi sp,sp,-16
80000788: e406 sd ra,8(sp)
8000078a: e022 sd s0,0(sp)
8000078c: 0800 addi s0,sp,16
// disable interrupts.
WriteReg(IER, 0x00);
8000078e: 100007b7 lui a5,0x10000
80000792: 000780a3 sb zero,1(a5) # 10000001 <_entry-0x6fffffff>
// special mode to set baud rate.
WriteReg(LCR, LCR_BAUD_LATCH);
80000796: f8000713 li a4,-128
8000079a: 00e781a3 sb a4,3(a5)
// LSB for baud rate of 38.4K.
WriteReg(0, 0x03);
8000079e: 470d li a4,3
800007a0: 00e78023 sb a4,0(a5)
// MSB for baud rate of 38.4K.
WriteReg(1, 0x00);
800007a4: 000780a3 sb zero,1(a5)
// leave set-baud mode,
// and set word length to 8 bits, no parity.
WriteReg(LCR, LCR_EIGHT_BITS);
800007a8: 00e781a3 sb a4,3(a5)
// reset and enable FIFOs.
WriteReg(FCR, FCR_FIFO_ENABLE | FCR_FIFO_CLEAR);
800007ac: 469d li a3,7
800007ae: 00d78123 sb a3,2(a5)
// enable transmit and receive interrupts.
WriteReg(IER, IER_TX_ENABLE | IER_RX_ENABLE);
800007b2: 00e780a3 sb a4,1(a5)
initlock(&uart_tx_lock, "uart");
800007b6: 00008597 auipc a1,0x8
800007ba: 8a258593 addi a1,a1,-1886 # 80008058 <digits+0x18>
800007be: 00011517 auipc a0,0x11
800007c2: a8a50513 addi a0,a0,-1398 # 80011248 <uart_tx_lock>
800007c6: 00000097 auipc ra,0x0
800007ca: 36c080e7 jalr 876(ra) # 80000b32 <initlock>
}
800007ce: 60a2 ld ra,8(sp)
800007d0: 6402 ld s0,0(sp)
800007d2: 0141 addi sp,sp,16
800007d4: 8082 ret
00000000800007d6 <uartputc_sync>:
// use interrupts, for use by kernel printf() and
// to echo characters. it spins waiting for the uart's
// output register to be empty.
void
uartputc_sync(int c)
{
800007d6: 1101 addi sp,sp,-32
800007d8: ec06 sd ra,24(sp)
800007da: e822 sd s0,16(sp)
800007dc: e426 sd s1,8(sp)
800007de: 1000 addi s0,sp,32
800007e0: 84aa mv s1,a0
push_off();
800007e2: 00000097 auipc ra,0x0
800007e6: 394080e7 jalr 916(ra) # 80000b76 <push_off>
if(panicked){
800007ea: 00009797 auipc a5,0x9
800007ee: 8167a783 lw a5,-2026(a5) # 80009000 <panicked>
for(;;)
;
}
// wait for Transmit Holding Empty to be set in LSR.
while((ReadReg(LSR) & LSR_TX_IDLE) == 0)
800007f2: 10000737 lui a4,0x10000
if(panicked){
800007f6: c391 beqz a5,800007fa <uartputc_sync+0x24>
for(;;)
800007f8: a001 j 800007f8 <uartputc_sync+0x22>
while((ReadReg(LSR) & LSR_TX_IDLE) == 0)
800007fa: 00574783 lbu a5,5(a4) # 10000005 <_entry-0x6ffffffb>
800007fe: 0207f793 andi a5,a5,32
80000802: dfe5 beqz a5,800007fa <uartputc_sync+0x24>
;
WriteReg(THR, c);
80000804: 0ff4f513 andi a0,s1,255
80000808: 100007b7 lui a5,0x10000
8000080c: 00a78023 sb a0,0(a5) # 10000000 <_entry-0x70000000>
pop_off();
80000810: 00000097 auipc ra,0x0
80000814: 406080e7 jalr 1030(ra) # 80000c16 <pop_off>
}
80000818: 60e2 ld ra,24(sp)
8000081a: 6442 ld s0,16(sp)
8000081c: 64a2 ld s1,8(sp)
8000081e: 6105 addi sp,sp,32
80000820: 8082 ret
0000000080000822 <uartstart>:
// called from both the top- and bottom-half.
void
uartstart()
{
while(1){
if(uart_tx_w == uart_tx_r){
80000822: 00008797 auipc a5,0x8
80000826: 7e67b783 ld a5,2022(a5) # 80009008 <uart_tx_r>
8000082a: 00008717 auipc a4,0x8
8000082e: 7e673703 ld a4,2022(a4) # 80009010 <uart_tx_w>
80000832: 06f70a63 beq a4,a5,800008a6 <uartstart+0x84>
{
80000836: 7139 addi sp,sp,-64
80000838: fc06 sd ra,56(sp)
8000083a: f822 sd s0,48(sp)
8000083c: f426 sd s1,40(sp)
8000083e: f04a sd s2,32(sp)
80000840: ec4e sd s3,24(sp)
80000842: e852 sd s4,16(sp)
80000844: e456 sd s5,8(sp)
80000846: 0080 addi s0,sp,64
// transmit buffer is empty.
return;
}
if((ReadReg(LSR) & LSR_TX_IDLE) == 0){
80000848: 10000937 lui s2,0x10000
// so we cannot give it another byte.
// it will interrupt when it's ready for a new byte.
return;
}
int c = uart_tx_buf[uart_tx_r % UART_TX_BUF_SIZE];
8000084c: 00011a17 auipc s4,0x11
80000850: 9fca0a13 addi s4,s4,-1540 # 80011248 <uart_tx_lock>
uart_tx_r += 1;
80000854: 00008497 auipc s1,0x8
80000858: 7b448493 addi s1,s1,1972 # 80009008 <uart_tx_r>
if(uart_tx_w == uart_tx_r){
8000085c: 00008997 auipc s3,0x8
80000860: 7b498993 addi s3,s3,1972 # 80009010 <uart_tx_w>
if((ReadReg(LSR) & LSR_TX_IDLE) == 0){
80000864: 00594703 lbu a4,5(s2) # 10000005 <_entry-0x6ffffffb>
80000868: 02077713 andi a4,a4,32
8000086c: c705 beqz a4,80000894 <uartstart+0x72>
int c = uart_tx_buf[uart_tx_r % UART_TX_BUF_SIZE];
8000086e: 01f7f713 andi a4,a5,31
80000872: 9752 add a4,a4,s4
80000874: 01874a83 lbu s5,24(a4)
uart_tx_r += 1;
80000878: 0785 addi a5,a5,1
8000087a: e09c sd a5,0(s1)
// maybe uartputc() is waiting for space in the buffer.
wakeup(&uart_tx_r);
8000087c: 8526 mv a0,s1
8000087e: 00002097 auipc ra,0x2
80000882: aea080e7 jalr -1302(ra) # 80002368 <wakeup>
WriteReg(THR, c);
80000886: 01590023 sb s5,0(s2)
if(uart_tx_w == uart_tx_r){
8000088a: 609c ld a5,0(s1)
8000088c: 0009b703 ld a4,0(s3)
80000890: fcf71ae3 bne a4,a5,80000864 <uartstart+0x42>
}
}
80000894: 70e2 ld ra,56(sp)
80000896: 7442 ld s0,48(sp)
80000898: 74a2 ld s1,40(sp)
8000089a: 7902 ld s2,32(sp)
8000089c: 69e2 ld s3,24(sp)
8000089e: 6a42 ld s4,16(sp)
800008a0: 6aa2 ld s5,8(sp)
800008a2: 6121 addi sp,sp,64
800008a4: 8082 ret
800008a6: 8082 ret
00000000800008a8 <uartputc>:
{
800008a8: 7179 addi sp,sp,-48
800008aa: f406 sd ra,40(sp)
800008ac: f022 sd s0,32(sp)
800008ae: ec26 sd s1,24(sp)
800008b0: e84a sd s2,16(sp)
800008b2: e44e sd s3,8(sp)
800008b4: e052 sd s4,0(sp)
800008b6: 1800 addi s0,sp,48
800008b8: 8a2a mv s4,a0
acquire(&uart_tx_lock);
800008ba: 00011517 auipc a0,0x11
800008be: 98e50513 addi a0,a0,-1650 # 80011248 <uart_tx_lock>
800008c2: 00000097 auipc ra,0x0
800008c6: 300080e7 jalr 768(ra) # 80000bc2 <acquire>
if(panicked){
800008ca: 00008797 auipc a5,0x8
800008ce: 7367a783 lw a5,1846(a5) # 80009000 <panicked>
800008d2: c391 beqz a5,800008d6 <uartputc+0x2e>
for(;;)
800008d4: a001 j 800008d4 <uartputc+0x2c>
if(uart_tx_w == uart_tx_r + UART_TX_BUF_SIZE){
800008d6: 00008717 auipc a4,0x8
800008da: 73a73703 ld a4,1850(a4) # 80009010 <uart_tx_w>
800008de: 00008797 auipc a5,0x8
800008e2: 72a7b783 ld a5,1834(a5) # 80009008 <uart_tx_r>
800008e6: 02078793 addi a5,a5,32
800008ea: 02e79b63 bne a5,a4,80000920 <uartputc+0x78>
sleep(&uart_tx_r, &uart_tx_lock);
800008ee: 00011997 auipc s3,0x11
800008f2: 95a98993 addi s3,s3,-1702 # 80011248 <uart_tx_lock>
800008f6: 00008497 auipc s1,0x8
800008fa: 71248493 addi s1,s1,1810 # 80009008 <uart_tx_r>
if(uart_tx_w == uart_tx_r + UART_TX_BUF_SIZE){
800008fe: 00008917 auipc s2,0x8
80000902: 71290913 addi s2,s2,1810 # 80009010 <uart_tx_w>
sleep(&uart_tx_r, &uart_tx_lock);
80000906: 85ce mv a1,s3
80000908: 8526 mv a0,s1
8000090a: 00001097 auipc ra,0x1
8000090e: 7ea080e7 jalr 2026(ra) # 800020f4 <sleep>
if(uart_tx_w == uart_tx_r + UART_TX_BUF_SIZE){
80000912: 00093703 ld a4,0(s2)
80000916: 609c ld a5,0(s1)
80000918: 02078793 addi a5,a5,32
8000091c: fee785e3 beq a5,a4,80000906 <uartputc+0x5e>
uart_tx_buf[uart_tx_w % UART_TX_BUF_SIZE] = c;
80000920: 00011497 auipc s1,0x11
80000924: 92848493 addi s1,s1,-1752 # 80011248 <uart_tx_lock>
80000928: 01f77793 andi a5,a4,31
8000092c: 97a6 add a5,a5,s1
8000092e: 01478c23 sb s4,24(a5)
uart_tx_w += 1;
80000932: 0705 addi a4,a4,1
80000934: 00008797 auipc a5,0x8
80000938: 6ce7be23 sd a4,1756(a5) # 80009010 <uart_tx_w>
uartstart();
8000093c: 00000097 auipc ra,0x0
80000940: ee6080e7 jalr -282(ra) # 80000822 <uartstart>
release(&uart_tx_lock);
80000944: 8526 mv a0,s1
80000946: 00000097 auipc ra,0x0
8000094a: 330080e7 jalr 816(ra) # 80000c76 <release>
}
8000094e: 70a2 ld ra,40(sp)
80000950: 7402 ld s0,32(sp)
80000952: 64e2 ld s1,24(sp)
80000954: 6942 ld s2,16(sp)
80000956: 69a2 ld s3,8(sp)
80000958: 6a02 ld s4,0(sp)
8000095a: 6145 addi sp,sp,48
8000095c: 8082 ret
000000008000095e <uartgetc>:
// read one input character from the UART.
// return -1 if none is waiting.
int
uartgetc(void)
{
8000095e: 1141 addi sp,sp,-16
80000960: e422 sd s0,8(sp)
80000962: 0800 addi s0,sp,16
if(ReadReg(LSR) & 0x01){
80000964: 100007b7 lui a5,0x10000
80000968: 0057c783 lbu a5,5(a5) # 10000005 <_entry-0x6ffffffb>
8000096c: 8b85 andi a5,a5,1
8000096e: cb91 beqz a5,80000982 <uartgetc+0x24>
// input data is ready.
return ReadReg(RHR);
80000970: 100007b7 lui a5,0x10000
80000974: 0007c503 lbu a0,0(a5) # 10000000 <_entry-0x70000000>
80000978: 0ff57513 andi a0,a0,255
} else {
return -1;
}
}
8000097c: 6422 ld s0,8(sp)
8000097e: 0141 addi sp,sp,16
80000980: 8082 ret
return -1;
80000982: 557d li a0,-1
80000984: bfe5 j 8000097c <uartgetc+0x1e>
0000000080000986 <uartintr>:
// handle a uart interrupt, raised because input has
// arrived, or the uart is ready for more output, or
// both. called from trap.c.
void
uartintr(void)
{
80000986: 1101 addi sp,sp,-32
80000988: ec06 sd ra,24(sp)
8000098a: e822 sd s0,16(sp)
8000098c: e426 sd s1,8(sp)
8000098e: 1000 addi s0,sp,32
// read and process incoming characters.
while(1){
int c = uartgetc();
if(c == -1)
80000990: 54fd li s1,-1
80000992: a029 j 8000099c <uartintr+0x16>
break;
consoleintr(c);
80000994: 00000097 auipc ra,0x0
80000998: 916080e7 jalr -1770(ra) # 800002aa <consoleintr>
int c = uartgetc();
8000099c: 00000097 auipc ra,0x0
800009a0: fc2080e7 jalr -62(ra) # 8000095e <uartgetc>
if(c == -1)
800009a4: fe9518e3 bne a0,s1,80000994 <uartintr+0xe>
}
// send buffered characters.
acquire(&uart_tx_lock);
800009a8: 00011497 auipc s1,0x11
800009ac: 8a048493 addi s1,s1,-1888 # 80011248 <uart_tx_lock>
800009b0: 8526 mv a0,s1
800009b2: 00000097 auipc ra,0x0
800009b6: 210080e7 jalr 528(ra) # 80000bc2 <acquire>
uartstart();
800009ba: 00000097 auipc ra,0x0
800009be: e68080e7 jalr -408(ra) # 80000822 <uartstart>
release(&uart_tx_lock);
800009c2: 8526 mv a0,s1
800009c4: 00000097 auipc ra,0x0
800009c8: 2b2080e7 jalr 690(ra) # 80000c76 <release>
}
800009cc: 60e2 ld ra,24(sp)
800009ce: 6442 ld s0,16(sp)
800009d0: 64a2 ld s1,8(sp)
800009d2: 6105 addi sp,sp,32
800009d4: 8082 ret
00000000800009d6 <kfree>:
// which normally should have been returned by a
// call to kalloc(). (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(void *pa)
{
800009d6: 1101 addi sp,sp,-32
800009d8: ec06 sd ra,24(sp)
800009da: e822 sd s0,16(sp)
800009dc: e426 sd s1,8(sp)
800009de: e04a sd s2,0(sp)
800009e0: 1000 addi s0,sp,32
struct run *r;
if(((uint64)pa % PGSIZE) != 0 || (char*)pa < end || (uint64)pa >= PHYSTOP)
800009e2: 03451793 slli a5,a0,0x34
800009e6: ebb9 bnez a5,80000a3c <kfree+0x66>
800009e8: 84aa mv s1,a0
800009ea: 00026797 auipc a5,0x26
800009ee: 61678793 addi a5,a5,1558 # 80027000 <end>
800009f2: 04f56563 bltu a0,a5,80000a3c <kfree+0x66>
800009f6: 47c5 li a5,17
800009f8: 07ee slli a5,a5,0x1b
800009fa: 04f57163 bgeu a0,a5,80000a3c <kfree+0x66>
panic("kfree");
// Fill with junk to catch dangling refs.
memset(pa, 1, PGSIZE);
800009fe: 6605 lui a2,0x1
80000a00: 4585 li a1,1
80000a02: 00000097 auipc ra,0x0
80000a06: 2bc080e7 jalr 700(ra) # 80000cbe <memset>
r = (struct run*)pa;
acquire(&kmem.lock);
80000a0a: 00011917 auipc s2,0x11
80000a0e: 87690913 addi s2,s2,-1930 # 80011280 <kmem>
80000a12: 854a mv a0,s2
80000a14: 00000097 auipc ra,0x0
80000a18: 1ae080e7 jalr 430(ra) # 80000bc2 <acquire>
r->next = kmem.freelist;
80000a1c: 01893783 ld a5,24(s2)
80000a20: e09c sd a5,0(s1)
kmem.freelist = r;
80000a22: 00993c23 sd s1,24(s2)
release(&kmem.lock);
80000a26: 854a mv a0,s2
80000a28: 00000097 auipc ra,0x0
80000a2c: 24e080e7 jalr 590(ra) # 80000c76 <release>
}
80000a30: 60e2 ld ra,24(sp)
80000a32: 6442 ld s0,16(sp)
80000a34: 64a2 ld s1,8(sp)
80000a36: 6902 ld s2,0(sp)
80000a38: 6105 addi sp,sp,32
80000a3a: 8082 ret
panic("kfree");
80000a3c: 00007517 auipc a0,0x7
80000a40: 62450513 addi a0,a0,1572 # 80008060 <digits+0x20>
80000a44: 00000097 auipc ra,0x0
80000a48: ae6080e7 jalr -1306(ra) # 8000052a <panic>
0000000080000a4c <freerange>:
{
80000a4c: 7179 addi sp,sp,-48
80000a4e: f406 sd ra,40(sp)
80000a50: f022 sd s0,32(sp)
80000a52: ec26 sd s1,24(sp)
80000a54: e84a sd s2,16(sp)
80000a56: e44e sd s3,8(sp)
80000a58: e052 sd s4,0(sp)
80000a5a: 1800 addi s0,sp,48
p = (char*)PGROUNDUP((uint64)pa_start);
80000a5c: 6785 lui a5,0x1
80000a5e: fff78493 addi s1,a5,-1 # fff <_entry-0x7ffff001>
80000a62: 94aa add s1,s1,a0
80000a64: 757d lui a0,0xfffff
80000a66: 8ce9 and s1,s1,a0
for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE)
80000a68: 94be add s1,s1,a5
80000a6a: 0095ee63 bltu a1,s1,80000a86 <freerange+0x3a>
80000a6e: 892e mv s2,a1
kfree(p);
80000a70: 7a7d lui s4,0xfffff
for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE)
80000a72: 6985 lui s3,0x1
kfree(p);
80000a74: 01448533 add a0,s1,s4
80000a78: 00000097 auipc ra,0x0
80000a7c: f5e080e7 jalr -162(ra) # 800009d6 <kfree>
for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE)
80000a80: 94ce add s1,s1,s3
80000a82: fe9979e3 bgeu s2,s1,80000a74 <freerange+0x28>
}
80000a86: 70a2 ld ra,40(sp)
80000a88: 7402 ld s0,32(sp)
80000a8a: 64e2 ld s1,24(sp)
80000a8c: 6942 ld s2,16(sp)
80000a8e: 69a2 ld s3,8(sp)
80000a90: 6a02 ld s4,0(sp)
80000a92: 6145 addi sp,sp,48
80000a94: 8082 ret
0000000080000a96 <kinit>:
{
80000a96: 1141 addi sp,sp,-16
80000a98: e406 sd ra,8(sp)
80000a9a: e022 sd s0,0(sp)
80000a9c: 0800 addi s0,sp,16
initlock(&kmem.lock, "kmem");
80000a9e: 00007597 auipc a1,0x7
80000aa2: 5ca58593 addi a1,a1,1482 # 80008068 <digits+0x28>
80000aa6: 00010517 auipc a0,0x10
80000aaa: 7da50513 addi a0,a0,2010 # 80011280 <kmem>
80000aae: 00000097 auipc ra,0x0
80000ab2: 084080e7 jalr 132(ra) # 80000b32 <initlock>
freerange(end, (void*)PHYSTOP);
80000ab6: 45c5 li a1,17
80000ab8: 05ee slli a1,a1,0x1b
80000aba: 00026517 auipc a0,0x26
80000abe: 54650513 addi a0,a0,1350 # 80027000 <end>
80000ac2: 00000097 auipc ra,0x0
80000ac6: f8a080e7 jalr -118(ra) # 80000a4c <freerange>
}
80000aca: 60a2 ld ra,8(sp)
80000acc: 6402 ld s0,0(sp)
80000ace: 0141 addi sp,sp,16
80000ad0: 8082 ret
0000000080000ad2 <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
void *
kalloc(void)
{
80000ad2: 1101 addi sp,sp,-32
80000ad4: ec06 sd ra,24(sp)
80000ad6: e822 sd s0,16(sp)
80000ad8: e426 sd s1,8(sp)
80000ada: 1000 addi s0,sp,32
struct run *r;
acquire(&kmem.lock);
80000adc: 00010497 auipc s1,0x10
80000ae0: 7a448493 addi s1,s1,1956 # 80011280 <kmem>
80000ae4: 8526 mv a0,s1
80000ae6: 00000097 auipc ra,0x0
80000aea: 0dc080e7 jalr 220(ra) # 80000bc2 <acquire>
r = kmem.freelist;
80000aee: 6c84 ld s1,24(s1)
if(r)
80000af0: c885 beqz s1,80000b20 <kalloc+0x4e>
kmem.freelist = r->next;
80000af2: 609c ld a5,0(s1)
80000af4: 00010517 auipc a0,0x10
80000af8: 78c50513 addi a0,a0,1932 # 80011280 <kmem>
80000afc: ed1c sd a5,24(a0)
release(&kmem.lock);
80000afe: 00000097 auipc ra,0x0
80000b02: 178080e7 jalr 376(ra) # 80000c76 <release>
if(r)
memset((char*)r, 5, PGSIZE); // fill with junk
80000b06: 6605 lui a2,0x1
80000b08: 4595 li a1,5
80000b0a: 8526 mv a0,s1
80000b0c: 00000097 auipc ra,0x0
80000b10: 1b2080e7 jalr 434(ra) # 80000cbe <memset>
return (void*)r;
}
80000b14: 8526 mv a0,s1
80000b16: 60e2 ld ra,24(sp)
80000b18: 6442 ld s0,16(sp)
80000b1a: 64a2 ld s1,8(sp)
80000b1c: 6105 addi sp,sp,32
80000b1e: 8082 ret
release(&kmem.lock);
80000b20: 00010517 auipc a0,0x10
80000b24: 76050513 addi a0,a0,1888 # 80011280 <kmem>
80000b28: 00000097 auipc ra,0x0
80000b2c: 14e080e7 jalr 334(ra) # 80000c76 <release>
if(r)
80000b30: b7d5 j 80000b14 <kalloc+0x42>
0000000080000b32 <initlock>:
#include "proc.h"
#include "defs.h"
void
initlock(struct spinlock *lk, char *name)
{
80000b32: 1141 addi sp,sp,-16
80000b34: e422 sd s0,8(sp)
80000b36: 0800 addi s0,sp,16
lk->name = name;
80000b38: e50c sd a1,8(a0)
lk->locked = 0;
80000b3a: 00052023 sw zero,0(a0)
lk->cpu = 0;
80000b3e: 00053823 sd zero,16(a0)
}
80000b42: 6422 ld s0,8(sp)
80000b44: 0141 addi sp,sp,16
80000b46: 8082 ret
0000000080000b48 <holding>:
// Interrupts must be off.
int
holding(struct spinlock *lk)
{
int r;
r = (lk->locked && lk->cpu == mycpu());
80000b48: 411c lw a5,0(a0)
80000b4a: e399 bnez a5,80000b50 <holding+0x8>
80000b4c: 4501 li a0,0
return r;
}
80000b4e: 8082 ret
{
80000b50: 1101 addi sp,sp,-32
80000b52: ec06 sd ra,24(sp)
80000b54: e822 sd s0,16(sp)
80000b56: e426 sd s1,8(sp)
80000b58: 1000 addi s0,sp,32
r = (lk->locked && lk->cpu == mycpu());
80000b5a: 6904 ld s1,16(a0)
80000b5c: 00001097 auipc ra,0x1
80000b60: e06080e7 jalr -506(ra) # 80001962 <mycpu>
80000b64: 40a48533 sub a0,s1,a0
80000b68: 00153513 seqz a0,a0
}
80000b6c: 60e2 ld ra,24(sp)
80000b6e: 6442 ld s0,16(sp)
80000b70: 64a2 ld s1,8(sp)
80000b72: 6105 addi sp,sp,32
80000b74: 8082 ret
0000000080000b76 <push_off>:
// it takes two pop_off()s to undo two push_off()s. Also, if interrupts
// are initially off, then push_off, pop_off leaves them off.
void
push_off(void)
{
80000b76: 1101 addi sp,sp,-32
80000b78: ec06 sd ra,24(sp)
80000b7a: e822 sd s0,16(sp)
80000b7c: e426 sd s1,8(sp)
80000b7e: 1000 addi s0,sp,32
asm volatile("csrr %0, sstatus" : "=r" (x) );
80000b80: 100024f3 csrr s1,sstatus
80000b84: 100027f3 csrr a5,sstatus
w_sstatus(r_sstatus() & ~SSTATUS_SIE);
80000b88: 9bf5 andi a5,a5,-3
asm volatile("csrw sstatus, %0" : : "r" (x));
80000b8a: 10079073 csrw sstatus,a5
int old = intr_get();
intr_off();
if(mycpu()->noff == 0)
80000b8e: 00001097 auipc ra,0x1
80000b92: dd4080e7 jalr -556(ra) # 80001962 <mycpu>
80000b96: 5d3c lw a5,120(a0)
80000b98: cf89 beqz a5,80000bb2 <push_off+0x3c>
mycpu()->intena = old;
mycpu()->noff += 1;
80000b9a: 00001097 auipc ra,0x1
80000b9e: dc8080e7 jalr -568(ra) # 80001962 <mycpu>
80000ba2: 5d3c lw a5,120(a0)
80000ba4: 2785 addiw a5,a5,1
80000ba6: dd3c sw a5,120(a0)
}
80000ba8: 60e2 ld ra,24(sp)
80000baa: 6442 ld s0,16(sp)
80000bac: 64a2 ld s1,8(sp)
80000bae: 6105 addi sp,sp,32
80000bb0: 8082 ret
mycpu()->intena = old;
80000bb2: 00001097 auipc ra,0x1
80000bb6: db0080e7 jalr -592(ra) # 80001962 <mycpu>
return (x & SSTATUS_SIE) != 0;
80000bba: 8085 srli s1,s1,0x1
80000bbc: 8885 andi s1,s1,1
80000bbe: dd64 sw s1,124(a0)
80000bc0: bfe9 j 80000b9a <push_off+0x24>
0000000080000bc2 <acquire>:
{
80000bc2: 1101 addi sp,sp,-32
80000bc4: ec06 sd ra,24(sp)
80000bc6: e822 sd s0,16(sp)
80000bc8: e426 sd s1,8(sp)
80000bca: 1000 addi s0,sp,32
80000bcc: 84aa mv s1,a0
push_off(); // disable interrupts to avoid deadlock.
80000bce: 00000097 auipc ra,0x0
80000bd2: fa8080e7 jalr -88(ra) # 80000b76 <push_off>
if(holding(lk))
80000bd6: 8526 mv a0,s1
80000bd8: 00000097 auipc ra,0x0
80000bdc: f70080e7 jalr -144(ra) # 80000b48 <holding>
while(__sync_lock_test_and_set(&lk->locked, 1) != 0)
80000be0: 4705 li a4,1
if(holding(lk))
80000be2: e115 bnez a0,80000c06 <acquire+0x44>
while(__sync_lock_test_and_set(&lk->locked, 1) != 0)
80000be4: 87ba mv a5,a4
80000be6: 0cf4a7af amoswap.w.aq a5,a5,(s1)
80000bea: 2781 sext.w a5,a5
80000bec: ffe5 bnez a5,80000be4 <acquire+0x22>
__sync_synchronize();
80000bee: 0ff0000f fence
lk->cpu = mycpu();
80000bf2: 00001097 auipc ra,0x1
80000bf6: d70080e7 jalr -656(ra) # 80001962 <mycpu>
80000bfa: e888 sd a0,16(s1)
}
80000bfc: 60e2 ld ra,24(sp)
80000bfe: 6442 ld s0,16(sp)
80000c00: 64a2 ld s1,8(sp)
80000c02: 6105 addi sp,sp,32
80000c04: 8082 ret
panic("acquire");
80000c06: 00007517 auipc a0,0x7
80000c0a: 46a50513 addi a0,a0,1130 # 80008070 <digits+0x30>
80000c0e: 00000097 auipc ra,0x0
80000c12: 91c080e7 jalr -1764(ra) # 8000052a <panic>
0000000080000c16 <pop_off>:
void
pop_off(void)
{
80000c16: 1141 addi sp,sp,-16
80000c18: e406 sd ra,8(sp)
80000c1a: e022 sd s0,0(sp)
80000c1c: 0800 addi s0,sp,16
struct cpu *c = mycpu();
80000c1e: 00001097 auipc ra,0x1
80000c22: d44080e7 jalr -700(ra) # 80001962 <mycpu>
asm volatile("csrr %0, sstatus" : "=r" (x) );
80000c26: 100027f3 csrr a5,sstatus
return (x & SSTATUS_SIE) != 0;
80000c2a: 8b89 andi a5,a5,2
if(intr_get())
80000c2c: e78d bnez a5,80000c56 <pop_off+0x40>
panic("pop_off - interruptible");
if(c->noff < 1)
80000c2e: 5d3c lw a5,120(a0)
80000c30: 02f05b63 blez a5,80000c66 <pop_off+0x50>
panic("pop_off");
c->noff -= 1;
80000c34: 37fd addiw a5,a5,-1
80000c36: 0007871b sext.w a4,a5
80000c3a: dd3c sw a5,120(a0)
if(c->noff == 0 && c->intena)
80000c3c: eb09 bnez a4,80000c4e <pop_off+0x38>
80000c3e: 5d7c lw a5,124(a0)
80000c40: c799 beqz a5,80000c4e <pop_off+0x38>
asm volatile("csrr %0, sstatus" : "=r" (x) );
80000c42: 100027f3 csrr a5,sstatus
w_sstatus(r_sstatus() | SSTATUS_SIE);
80000c46: 0027e793 ori a5,a5,2
asm volatile("csrw sstatus, %0" : : "r" (x));
80000c4a: 10079073 csrw sstatus,a5
intr_on();
}
80000c4e: 60a2 ld ra,8(sp)
80000c50: 6402 ld s0,0(sp)
80000c52: 0141 addi sp,sp,16
80000c54: 8082 ret
panic("pop_off - interruptible");
80000c56: 00007517 auipc a0,0x7
80000c5a: 42250513 addi a0,a0,1058 # 80008078 <digits+0x38>
80000c5e: 00000097 auipc ra,0x0
80000c62: 8cc080e7 jalr -1844(ra) # 8000052a <panic>
panic("pop_off");
80000c66: 00007517 auipc a0,0x7
80000c6a: 42a50513 addi a0,a0,1066 # 80008090 <digits+0x50>
80000c6e: 00000097 auipc ra,0x0
80000c72: 8bc080e7 jalr -1860(ra) # 8000052a <panic>
0000000080000c76 <release>:
{
80000c76: 1101 addi sp,sp,-32
80000c78: ec06 sd ra,24(sp)
80000c7a: e822 sd s0,16(sp)
80000c7c: e426 sd s1,8(sp)
80000c7e: 1000 addi s0,sp,32
80000c80: 84aa mv s1,a0
if(!holding(lk))
80000c82: 00000097 auipc ra,0x0
80000c86: ec6080e7 jalr -314(ra) # 80000b48 <holding>
80000c8a: c115 beqz a0,80000cae <release+0x38>
lk->cpu = 0;
80000c8c: 0004b823 sd zero,16(s1)
__sync_synchronize();
80000c90: 0ff0000f fence
__sync_lock_release(&lk->locked);
80000c94: 0f50000f fence iorw,ow
80000c98: 0804a02f amoswap.w zero,zero,(s1)
pop_off();
80000c9c: 00000097 auipc ra,0x0
80000ca0: f7a080e7 jalr -134(ra) # 80000c16 <pop_off>
}
80000ca4: 60e2 ld ra,24(sp)
80000ca6: 6442 ld s0,16(sp)
80000ca8: 64a2 ld s1,8(sp)
80000caa: 6105 addi sp,sp,32
80000cac: 8082 ret
panic("release");
80000cae: 00007517 auipc a0,0x7
80000cb2: 3ea50513 addi a0,a0,1002 # 80008098 <digits+0x58>
80000cb6: 00000097 auipc ra,0x0
80000cba: 874080e7 jalr -1932(ra) # 8000052a <panic>
0000000080000cbe <memset>:
#include "types.h"
void*
memset(void *dst, int c, uint n)
{
80000cbe: 1141 addi sp,sp,-16
80000cc0: e422 sd s0,8(sp)
80000cc2: 0800 addi s0,sp,16
char *cdst = (char *) dst;
int i;
for(i = 0; i < n; i++){
80000cc4: ca19 beqz a2,80000cda <memset+0x1c>
80000cc6: 87aa mv a5,a0
80000cc8: 1602 slli a2,a2,0x20
80000cca: 9201 srli a2,a2,0x20
80000ccc: 00a60733 add a4,a2,a0
cdst[i] = c;
80000cd0: 00b78023 sb a1,0(a5)
for(i = 0; i < n; i++){
80000cd4: 0785 addi a5,a5,1
80000cd6: fee79de3 bne a5,a4,80000cd0 <memset+0x12>
}
return dst;
}
80000cda: 6422 ld s0,8(sp)
80000cdc: 0141 addi sp,sp,16
80000cde: 8082 ret
0000000080000ce0 <memcmp>:
int
memcmp(const void *v1, const void *v2, uint n)
{
80000ce0: 1141 addi sp,sp,-16
80000ce2: e422 sd s0,8(sp)
80000ce4: 0800 addi s0,sp,16
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
80000ce6: ca05 beqz a2,80000d16 <memcmp+0x36>
80000ce8: fff6069b addiw a3,a2,-1
80000cec: 1682 slli a3,a3,0x20
80000cee: 9281 srli a3,a3,0x20
80000cf0: 0685 addi a3,a3,1
80000cf2: 96aa add a3,a3,a0
if(*s1 != *s2)
80000cf4: 00054783 lbu a5,0(a0)
80000cf8: 0005c703 lbu a4,0(a1)
80000cfc: 00e79863 bne a5,a4,80000d0c <memcmp+0x2c>
return *s1 - *s2;
s1++, s2++;
80000d00: 0505 addi a0,a0,1
80000d02: 0585 addi a1,a1,1
while(n-- > 0){
80000d04: fed518e3 bne a0,a3,80000cf4 <memcmp+0x14>
}
return 0;
80000d08: 4501 li a0,0
80000d0a: a019 j 80000d10 <memcmp+0x30>
return *s1 - *s2;
80000d0c: 40e7853b subw a0,a5,a4
}
80000d10: 6422 ld s0,8(sp)
80000d12: 0141 addi sp,sp,16
80000d14: 8082 ret
return 0;
80000d16: 4501 li a0,0
80000d18: bfe5 j 80000d10 <memcmp+0x30>
0000000080000d1a <memmove>:
void*
memmove(void *dst, const void *src, uint n)
{
80000d1a: 1141 addi sp,sp,-16
80000d1c: e422 sd s0,8(sp)
80000d1e: 0800 addi s0,sp,16
const char *s;
char *d;
s = src;
d = dst;
if(s < d && s + n > d){
80000d20: 02a5e563 bltu a1,a0,80000d4a <memmove+0x30>
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
80000d24: fff6069b addiw a3,a2,-1
80000d28: ce11 beqz a2,80000d44 <memmove+0x2a>
80000d2a: 1682 slli a3,a3,0x20
80000d2c: 9281 srli a3,a3,0x20
80000d2e: 0685 addi a3,a3,1
80000d30: 96ae add a3,a3,a1
80000d32: 87aa mv a5,a0
*d++ = *s++;
80000d34: 0585 addi a1,a1,1
80000d36: 0785 addi a5,a5,1
80000d38: fff5c703 lbu a4,-1(a1)
80000d3c: fee78fa3 sb a4,-1(a5)
while(n-- > 0)
80000d40: fed59ae3 bne a1,a3,80000d34 <memmove+0x1a>
return dst;
}
80000d44: 6422 ld s0,8(sp)
80000d46: 0141 addi sp,sp,16
80000d48: 8082 ret
if(s < d && s + n > d){
80000d4a: 02061713 slli a4,a2,0x20
80000d4e: 9301 srli a4,a4,0x20
80000d50: 00e587b3 add a5,a1,a4
80000d54: fcf578e3 bgeu a0,a5,80000d24 <memmove+0xa>
d += n;
80000d58: 972a add a4,a4,a0
while(n-- > 0)
80000d5a: fff6069b addiw a3,a2,-1
80000d5e: d27d beqz a2,80000d44 <memmove+0x2a>
80000d60: 02069613 slli a2,a3,0x20
80000d64: 9201 srli a2,a2,0x20
80000d66: fff64613 not a2,a2
80000d6a: 963e add a2,a2,a5
*--d = *--s;
80000d6c: 17fd addi a5,a5,-1
80000d6e: 177d addi a4,a4,-1
80000d70: 0007c683 lbu a3,0(a5)
80000d74: 00d70023 sb a3,0(a4)
while(n-- > 0)
80000d78: fef61ae3 bne a2,a5,80000d6c <memmove+0x52>
80000d7c: b7e1 j 80000d44 <memmove+0x2a>
0000000080000d7e <memcpy>:
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
80000d7e: 1141 addi sp,sp,-16
80000d80: e406 sd ra,8(sp)
80000d82: e022 sd s0,0(sp)
80000d84: 0800 addi s0,sp,16
return memmove(dst, src, n);
80000d86: 00000097 auipc ra,0x0
80000d8a: f94080e7 jalr -108(ra) # 80000d1a <memmove>
}
80000d8e: 60a2 ld ra,8(sp)
80000d90: 6402 ld s0,0(sp)
80000d92: 0141 addi sp,sp,16
80000d94: 8082 ret
0000000080000d96 <strncmp>:
int
strncmp(const char *p, const char *q, uint n)
{
80000d96: 1141 addi sp,sp,-16
80000d98: e422 sd s0,8(sp)
80000d9a: 0800 addi s0,sp,16
while(n > 0 && *p && *p == *q)
80000d9c: ce11 beqz a2,80000db8 <strncmp+0x22>
80000d9e: 00054783 lbu a5,0(a0)
80000da2: cf89 beqz a5,80000dbc <strncmp+0x26>
80000da4: 0005c703 lbu a4,0(a1)
80000da8: 00f71a63 bne a4,a5,80000dbc <strncmp+0x26>
n--, p++, q++;
80000dac: 367d addiw a2,a2,-1
80000dae: 0505 addi a0,a0,1
80000db0: 0585 addi a1,a1,1
while(n > 0 && *p && *p == *q)
80000db2: f675 bnez a2,80000d9e <strncmp+0x8>
if(n == 0)
return 0;
80000db4: 4501 li a0,0
80000db6: a809 j 80000dc8 <strncmp+0x32>
80000db8: 4501 li a0,0
80000dba: a039 j 80000dc8 <strncmp+0x32>
if(n == 0)
80000dbc: ca09 beqz a2,80000dce <strncmp+0x38>
return (uchar)*p - (uchar)*q;
80000dbe: 00054503 lbu a0,0(a0)
80000dc2: 0005c783 lbu a5,0(a1)
80000dc6: 9d1d subw a0,a0,a5
}
80000dc8: 6422 ld s0,8(sp)
80000dca: 0141 addi sp,sp,16
80000dcc: 8082 ret
return 0;
80000dce: 4501 li a0,0
80000dd0: bfe5 j 80000dc8 <strncmp+0x32>
0000000080000dd2 <strncpy>:
char*
strncpy(char *s, const char *t, int n)
{
80000dd2: 1141 addi sp,sp,-16
80000dd4: e422 sd s0,8(sp)
80000dd6: 0800 addi s0,sp,16
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
80000dd8: 872a mv a4,a0
80000dda: 8832 mv a6,a2
80000ddc: 367d addiw a2,a2,-1
80000dde: 01005963 blez a6,80000df0 <strncpy+0x1e>
80000de2: 0705 addi a4,a4,1
80000de4: 0005c783 lbu a5,0(a1)
80000de8: fef70fa3 sb a5,-1(a4)
80000dec: 0585 addi a1,a1,1
80000dee: f7f5 bnez a5,80000dda <strncpy+0x8>
;
while(n-- > 0)
80000df0: 86ba mv a3,a4
80000df2: 00c05c63 blez a2,80000e0a <strncpy+0x38>
*s++ = 0;
80000df6: 0685 addi a3,a3,1
80000df8: fe068fa3 sb zero,-1(a3)
while(n-- > 0)
80000dfc: fff6c793 not a5,a3
80000e00: 9fb9 addw a5,a5,a4
80000e02: 010787bb addw a5,a5,a6
80000e06: fef048e3 bgtz a5,80000df6 <strncpy+0x24>
return os;
}
80000e0a: 6422 ld s0,8(sp)
80000e0c: 0141 addi sp,sp,16
80000e0e: 8082 ret
0000000080000e10 <safestrcpy>:
// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
80000e10: 1141 addi sp,sp,-16
80000e12: e422 sd s0,8(sp)
80000e14: 0800 addi s0,sp,16
char *os;
os = s;
if(n <= 0)
80000e16: 02c05363 blez a2,80000e3c <safestrcpy+0x2c>
80000e1a: fff6069b addiw a3,a2,-1
80000e1e: 1682 slli a3,a3,0x20
80000e20: 9281 srli a3,a3,0x20
80000e22: 96ae add a3,a3,a1
80000e24: 87aa mv a5,a0
return os;
while(--n > 0 && (*s++ = *t++) != 0)
80000e26: 00d58963 beq a1,a3,80000e38 <safestrcpy+0x28>
80000e2a: 0585 addi a1,a1,1
80000e2c: 0785 addi a5,a5,1
80000e2e: fff5c703 lbu a4,-1(a1)
80000e32: fee78fa3 sb a4,-1(a5)
80000e36: fb65 bnez a4,80000e26 <safestrcpy+0x16>
;
*s = 0;
80000e38: 00078023 sb zero,0(a5)
return os;
}
80000e3c: 6422 ld s0,8(sp)
80000e3e: 0141 addi sp,sp,16
80000e40: 8082 ret
0000000080000e42 <strlen>:
int
strlen(const char *s)
{
80000e42: 1141 addi sp,sp,-16
80000e44: e422 sd s0,8(sp)
80000e46: 0800 addi s0,sp,16
int n;
for(n = 0; s[n]; n++)
80000e48: 00054783 lbu a5,0(a0)
80000e4c: cf91 beqz a5,80000e68 <strlen+0x26>
80000e4e: 0505 addi a0,a0,1
80000e50: 87aa mv a5,a0
80000e52: 4685 li a3,1
80000e54: 9e89 subw a3,a3,a0
80000e56: 00f6853b addw a0,a3,a5
80000e5a: 0785 addi a5,a5,1
80000e5c: fff7c703 lbu a4,-1(a5)
80000e60: fb7d bnez a4,80000e56 <strlen+0x14>
;
return n;
}
80000e62: 6422 ld s0,8(sp)
80000e64: 0141 addi sp,sp,16
80000e66: 8082 ret
for(n = 0; s[n]; n++)
80000e68: 4501 li a0,0
80000e6a: bfe5 j 80000e62 <strlen+0x20>
0000000080000e6c <main>:
volatile static int started = 0;
// start() jumps here in supervisor mode on all CPUs.
void
main()
{
80000e6c: 1141 addi sp,sp,-16
80000e6e: e406 sd ra,8(sp)
80000e70: e022 sd s0,0(sp)
80000e72: 0800 addi s0,sp,16
if(cpuid() == 0){
80000e74: 00001097 auipc ra,0x1
80000e78: ade080e7 jalr -1314(ra) # 80001952 <cpuid>
virtio_disk_init(); // emulated hard disk
userinit(); // first user process
__sync_synchronize();
started = 1;
} else {
while(started == 0)
80000e7c: 00008717 auipc a4,0x8
80000e80: 19c70713 addi a4,a4,412 # 80009018 <started>
if(cpuid() == 0){
80000e84: c139 beqz a0,80000eca <main+0x5e>
while(started == 0)
80000e86: 431c lw a5,0(a4)
80000e88: 2781 sext.w a5,a5
80000e8a: dff5 beqz a5,80000e86 <main+0x1a>
;
__sync_synchronize();
80000e8c: 0ff0000f fence
printf("hart %d starting\n", cpuid());
80000e90: 00001097 auipc ra,0x1
80000e94: ac2080e7 jalr -1342(ra) # 80001952 <cpuid>
80000e98: 85aa mv a1,a0
80000e9a: 00007517 auipc a0,0x7
80000e9e: 21e50513 addi a0,a0,542 # 800080b8 <digits+0x78>
80000ea2: fffff097 auipc ra,0xfffff
80000ea6: 6d2080e7 jalr 1746(ra) # 80000574 <printf>
kvminithart(); // turn on paging
80000eaa: 00000097 auipc ra,0x0
80000eae: 0d8080e7 jalr 216(ra) # 80000f82 <kvminithart>
trapinithart(); // install kernel trap vector
80000eb2: 00002097 auipc ra,0x2
80000eb6: a98080e7 jalr -1384(ra) # 8000294a <trapinithart>
plicinithart(); // ask PLIC for device interrupts
80000eba: 00005097 auipc ra,0x5
80000ebe: 1a6080e7 jalr 422(ra) # 80006060 <plicinithart>
}
scheduler();
80000ec2: 00001097 auipc ra,0x1
80000ec6: 03c080e7 jalr 60(ra) # 80001efe <scheduler>
consoleinit();
80000eca: fffff097 auipc ra,0xfffff
80000ece: 572080e7 jalr 1394(ra) # 8000043c <consoleinit>
printfinit();
80000ed2: 00000097 auipc ra,0x0
80000ed6: 882080e7 jalr -1918(ra) # 80000754 <printfinit>
printf("\n");
80000eda: 00007517 auipc a0,0x7
80000ede: 1ee50513 addi a0,a0,494 # 800080c8 <digits+0x88>
80000ee2: fffff097 auipc ra,0xfffff
80000ee6: 692080e7 jalr 1682(ra) # 80000574 <printf>
printf("xv6 kernel is booting\n");
80000eea: 00007517 auipc a0,0x7
80000eee: 1b650513 addi a0,a0,438 # 800080a0 <digits+0x60>
80000ef2: fffff097 auipc ra,0xfffff
80000ef6: 682080e7 jalr 1666(ra) # 80000574 <printf>
printf("\n");
80000efa: 00007517 auipc a0,0x7
80000efe: 1ce50513 addi a0,a0,462 # 800080c8 <digits+0x88>
80000f02: fffff097 auipc ra,0xfffff
80000f06: 672080e7 jalr 1650(ra) # 80000574 <printf>
kinit(); // physical page allocator
80000f0a: 00000097 auipc ra,0x0
80000f0e: b8c080e7 jalr -1140(ra) # 80000a96 <kinit>
kvminit(); // create kernel page table
80000f12: 00000097 auipc ra,0x0
80000f16: 310080e7 jalr 784(ra) # 80001222 <kvminit>
kvminithart(); // turn on paging
80000f1a: 00000097 auipc ra,0x0
80000f1e: 068080e7 jalr 104(ra) # 80000f82 <kvminithart>
procinit(); // process table
80000f22: 00001097 auipc ra,0x1
80000f26: 980080e7 jalr -1664(ra) # 800018a2 <procinit>
trapinit(); // trap vectors
80000f2a: 00002097 auipc ra,0x2
80000f2e: 9f8080e7 jalr -1544(ra) # 80002922 <trapinit>
trapinithart(); // install kernel trap vector
80000f32: 00002097 auipc ra,0x2
80000f36: a18080e7 jalr -1512(ra) # 8000294a <trapinithart>
plicinit(); // set up interrupt controller
80000f3a: 00005097 auipc ra,0x5
80000f3e: 110080e7 jalr 272(ra) # 8000604a <plicinit>
plicinithart(); // ask PLIC for device interrupts
80000f42: 00005097 auipc ra,0x5
80000f46: 11e080e7 jalr 286(ra) # 80006060 <plicinithart>
binit(); // buffer cache
80000f4a: 00002097 auipc ra,0x2
80000f4e: 2de080e7 jalr 734(ra) # 80003228 <binit>
iinit(); // inode cache
80000f52: 00003097 auipc ra,0x3
80000f56: 970080e7 jalr -1680(ra) # 800038c2 <iinit>
fileinit(); // file table
80000f5a: 00004097 auipc ra,0x4
80000f5e: 91e080e7 jalr -1762(ra) # 80004878 <fileinit>
virtio_disk_init(); // emulated hard disk
80000f62: 00005097 auipc ra,0x5
80000f66: 220080e7 jalr 544(ra) # 80006182 <virtio_disk_init>
userinit(); // first user process
80000f6a: 00001097 auipc ra,0x1
80000f6e: d2c080e7 jalr -724(ra) # 80001c96 <userinit>
__sync_synchronize();
80000f72: 0ff0000f fence
started = 1;
80000f76: 4785 li a5,1
80000f78: 00008717 auipc a4,0x8
80000f7c: 0af72023 sw a5,160(a4) # 80009018 <started>
80000f80: b789 j 80000ec2 <main+0x56>
0000000080000f82 <kvminithart>:
// Switch h/w page table register to the kernel's page table,
// and enable paging.
void
kvminithart()
{
80000f82: 1141 addi sp,sp,-16
80000f84: e422 sd s0,8(sp)
80000f86: 0800 addi s0,sp,16
w_satp(MAKE_SATP(kernel_pagetable));
80000f88: 00008797 auipc a5,0x8
80000f8c: 0987b783 ld a5,152(a5) # 80009020 <kernel_pagetable>
80000f90: 83b1 srli a5,a5,0xc
80000f92: 577d li a4,-1
80000f94: 177e slli a4,a4,0x3f
80000f96: 8fd9 or a5,a5,a4
asm volatile("csrw satp, %0" : : "r" (x));
80000f98: 18079073 csrw satp,a5
// flush the TLB.
static inline void
sfence_vma()
{
// the zero, zero means flush all TLB entries.
asm volatile("sfence.vma zero, zero");
80000f9c: 12000073 sfence.vma
sfence_vma();
}
80000fa0: 6422 ld s0,8(sp)
80000fa2: 0141 addi sp,sp,16
80000fa4: 8082 ret
0000000080000fa6 <walk>:
// 21..29 -- 9 bits of level-1 index.
// 12..20 -- 9 bits of level-0 index.
// 0..11 -- 12 bits of byte offset within the page.
pte_t *
walk(pagetable_t pagetable, uint64 va, int alloc)
{
80000fa6: 7139 addi sp,sp,-64
80000fa8: fc06 sd ra,56(sp)
80000faa: f822 sd s0,48(sp)
80000fac: f426 sd s1,40(sp)
80000fae: f04a sd s2,32(sp)
80000fb0: ec4e sd s3,24(sp)
80000fb2: e852 sd s4,16(sp)
80000fb4: e456 sd s5,8(sp)
80000fb6: e05a sd s6,0(sp)
80000fb8: 0080 addi s0,sp,64
80000fba: 84aa mv s1,a0
80000fbc: 89ae mv s3,a1
80000fbe: 8ab2 mv s5,a2
if(va >= MAXVA)
80000fc0: 57fd li a5,-1
80000fc2: 83e9 srli a5,a5,0x1a
80000fc4: 4a79 li s4,30
panic("walk");
for(int level = 2; level > 0; level--) {
80000fc6: 4b31 li s6,12
if(va >= MAXVA)
80000fc8: 04b7f263 bgeu a5,a1,8000100c <walk+0x66>
panic("walk");
80000fcc: 00007517 auipc a0,0x7
80000fd0: 10450513 addi a0,a0,260 # 800080d0 <digits+0x90>
80000fd4: fffff097 auipc ra,0xfffff
80000fd8: 556080e7 jalr 1366(ra) # 8000052a <panic>
pte_t *pte = &pagetable[PX(level, va)];
if(*pte & PTE_V) {
pagetable = (pagetable_t)PTE2PA(*pte);
} else {
if(!alloc || (pagetable = (pde_t*)kalloc()) == 0)
80000fdc: 060a8663 beqz s5,80001048 <walk+0xa2>
80000fe0: 00000097 auipc ra,0x0
80000fe4: af2080e7 jalr -1294(ra) # 80000ad2 <kalloc>
80000fe8: 84aa mv s1,a0
80000fea: c529 beqz a0,80001034 <walk+0x8e>
return 0;
memset(pagetable, 0, PGSIZE);
80000fec: 6605 lui a2,0x1
80000fee: 4581 li a1,0
80000ff0: 00000097 auipc ra,0x0
80000ff4: cce080e7 jalr -818(ra) # 80000cbe <memset>
*pte = PA2PTE(pagetable) | PTE_V;
80000ff8: 00c4d793 srli a5,s1,0xc
80000ffc: 07aa slli a5,a5,0xa
80000ffe: 0017e793 ori a5,a5,1
80001002: 00f93023 sd a5,0(s2)
for(int level = 2; level > 0; level--) {
80001006: 3a5d addiw s4,s4,-9
80001008: 036a0063 beq s4,s6,80001028 <walk+0x82>
pte_t *pte = &pagetable[PX(level, va)];
8000100c: 0149d933 srl s2,s3,s4
80001010: 1ff97913 andi s2,s2,511
80001014: 090e slli s2,s2,0x3
80001016: 9926 add s2,s2,s1
if(*pte & PTE_V) {
80001018: 00093483 ld s1,0(s2)
8000101c: 0014f793 andi a5,s1,1
80001020: dfd5 beqz a5,80000fdc <walk+0x36>
pagetable = (pagetable_t)PTE2PA(*pte);
80001022: 80a9 srli s1,s1,0xa
80001024: 04b2 slli s1,s1,0xc
80001026: b7c5 j 80001006 <walk+0x60>
}
}
return &pagetable[PX(0, va)];
80001028: 00c9d513 srli a0,s3,0xc
8000102c: 1ff57513 andi a0,a0,511
80001030: 050e slli a0,a0,0x3
80001032: 9526 add a0,a0,s1
}
80001034: 70e2 ld ra,56(sp)
80001036: 7442 ld s0,48(sp)
80001038: 74a2 ld s1,40(sp)
8000103a: 7902 ld s2,32(sp)
8000103c: 69e2 ld s3,24(sp)
8000103e: 6a42 ld s4,16(sp)
80001040: 6aa2 ld s5,8(sp)
80001042: 6b02 ld s6,0(sp)
80001044: 6121 addi sp,sp,64
80001046: 8082 ret
return 0;
80001048: 4501 li a0,0
8000104a: b7ed j 80001034 <walk+0x8e>
000000008000104c <walkaddr>:
walkaddr(pagetable_t pagetable, uint64 va)
{
pte_t *pte;
uint64 pa;
if(va >= MAXVA)
8000104c: 57fd li a5,-1
8000104e: 83e9 srli a5,a5,0x1a
80001050: 00b7f463 bgeu a5,a1,80001058 <walkaddr+0xc>
return 0;
80001054: 4501 li a0,0
return 0;
if((*pte & PTE_U) == 0)
return 0;
pa = PTE2PA(*pte);
return pa;
}
80001056: 8082 ret
{
80001058: 1141 addi sp,sp,-16
8000105a: e406 sd ra,8(sp)
8000105c: e022 sd s0,0(sp)
8000105e: 0800 addi s0,sp,16
pte = walk(pagetable, va, 0);
80001060: 4601 li a2,0
80001062: 00000097 auipc ra,0x0
80001066: f44080e7 jalr -188(ra) # 80000fa6 <walk>
if(pte == 0)
8000106a: c105 beqz a0,8000108a <walkaddr+0x3e>
if((*pte & PTE_V) == 0)
8000106c: 611c ld a5,0(a0)
if((*pte & PTE_U) == 0)
8000106e: 0117f693 andi a3,a5,17
80001072: 4745 li a4,17
return 0;
80001074: 4501 li a0,0
if((*pte & PTE_U) == 0)
80001076: 00e68663 beq a3,a4,80001082 <walkaddr+0x36>
}
8000107a: 60a2 ld ra,8(sp)
8000107c: 6402 ld s0,0(sp)
8000107e: 0141 addi sp,sp,16
80001080: 8082 ret
pa = PTE2PA(*pte);
80001082: 00a7d513 srli a0,a5,0xa
80001086: 0532 slli a0,a0,0xc
return pa;
80001088: bfcd j 8000107a <walkaddr+0x2e>
return 0;
8000108a: 4501 li a0,0
8000108c: b7fd j 8000107a <walkaddr+0x2e>
000000008000108e <mappages>:
// physical addresses starting at pa. va and size might not
// be page-aligned. Returns 0 on success, -1 if walk() couldn't
// allocate a needed page-table page.
int
mappages(pagetable_t pagetable, uint64 va, uint64 size, uint64 pa, int perm)
{
8000108e: 715d addi sp,sp,-80
80001090: e486 sd ra,72(sp)
80001092: e0a2 sd s0,64(sp)
80001094: fc26 sd s1,56(sp)
80001096: f84a sd s2,48(sp)
80001098: f44e sd s3,40(sp)
8000109a: f052 sd s4,32(sp)
8000109c: ec56 sd s5,24(sp)
8000109e: e85a sd s6,16(sp)
800010a0: e45e sd s7,8(sp)
800010a2: 0880 addi s0,sp,80
800010a4: 8aaa mv s5,a0
800010a6: 8b3a mv s6,a4
uint64 a, last;
pte_t *pte;
a = PGROUNDDOWN(va);
800010a8: 777d lui a4,0xfffff
800010aa: 00e5f7b3 and a5,a1,a4
last = PGROUNDDOWN(va + size - 1);
800010ae: 167d addi a2,a2,-1
800010b0: 00b609b3 add s3,a2,a1
800010b4: 00e9f9b3 and s3,s3,a4
a = PGROUNDDOWN(va);
800010b8: 893e mv s2,a5
800010ba: 40f68a33 sub s4,a3,a5
if(*pte & PTE_V)
panic("remap");
*pte = PA2PTE(pa) | perm | PTE_V;
if(a == last)
break;
a += PGSIZE;
800010be: 6b85 lui s7,0x1
800010c0: 012a04b3 add s1,s4,s2
if((pte = walk(pagetable, a, 1)) == 0)
800010c4: 4605 li a2,1
800010c6: 85ca mv a1,s2
800010c8: 8556 mv a0,s5
800010ca: 00000097 auipc ra,0x0
800010ce: edc080e7 jalr -292(ra) # 80000fa6 <walk>
800010d2: c51d beqz a0,80001100 <mappages+0x72>
if(*pte & PTE_V)
800010d4: 611c ld a5,0(a0)
800010d6: 8b85 andi a5,a5,1
800010d8: ef81 bnez a5,800010f0 <mappages+0x62>
*pte = PA2PTE(pa) | perm | PTE_V;
800010da: 80b1 srli s1,s1,0xc
800010dc: 04aa slli s1,s1,0xa
800010de: 0164e4b3 or s1,s1,s6
800010e2: 0014e493 ori s1,s1,1
800010e6: e104 sd s1,0(a0)
if(a == last)
800010e8: 03390863 beq s2,s3,80001118 <mappages+0x8a>
a += PGSIZE;
800010ec: 995e add s2,s2,s7
if((pte = walk(pagetable, a, 1)) == 0)
800010ee: bfc9 j 800010c0 <mappages+0x32>
panic("remap");
800010f0: 00007517 auipc a0,0x7
800010f4: fe850513 addi a0,a0,-24 # 800080d8 <digits+0x98>
800010f8: fffff097 auipc ra,0xfffff
800010fc: 432080e7 jalr 1074(ra) # 8000052a <panic>
return -1;
80001100: 557d li a0,-1
pa += PGSIZE;
}
return 0;
}
80001102: 60a6 ld ra,72(sp)
80001104: 6406 ld s0,64(sp)
80001106: 74e2 ld s1,56(sp)
80001108: 7942 ld s2,48(sp)
8000110a: 79a2 ld s3,40(sp)
8000110c: 7a02 ld s4,32(sp)
8000110e: 6ae2 ld s5,24(sp)
80001110: 6b42 ld s6,16(sp)
80001112: 6ba2 ld s7,8(sp)
80001114: 6161 addi sp,sp,80
80001116: 8082 ret
return 0;
80001118: 4501 li a0,0
8000111a: b7e5 j 80001102 <mappages+0x74>
000000008000111c <kvmmap>:
{
8000111c: 1141 addi sp,sp,-16
8000111e: e406 sd ra,8(sp)
80001120: e022 sd s0,0(sp)
80001122: 0800 addi s0,sp,16
80001124: 87b6 mv a5,a3
if(mappages(kpgtbl, va, sz, pa, perm) != 0)
80001126: 86b2 mv a3,a2
80001128: 863e mv a2,a5
8000112a: 00000097 auipc ra,0x0
8000112e: f64080e7 jalr -156(ra) # 8000108e <mappages>
80001132: e509 bnez a0,8000113c <kvmmap+0x20>
}
80001134: 60a2 ld ra,8(sp)
80001136: 6402 ld s0,0(sp)
80001138: 0141 addi sp,sp,16
8000113a: 8082 ret
panic("kvmmap");
8000113c: 00007517 auipc a0,0x7
80001140: fa450513 addi a0,a0,-92 # 800080e0 <digits+0xa0>
80001144: fffff097 auipc ra,0xfffff
80001148: 3e6080e7 jalr 998(ra) # 8000052a <panic>
000000008000114c <kvmmake>:
{
8000114c: 1101 addi sp,sp,-32
8000114e: ec06 sd ra,24(sp)
80001150: e822 sd s0,16(sp)
80001152: e426 sd s1,8(sp)
80001154: e04a sd s2,0(sp)
80001156: 1000 addi s0,sp,32
kpgtbl = (pagetable_t) kalloc();
80001158: 00000097 auipc ra,0x0
8000115c: 97a080e7 jalr -1670(ra) # 80000ad2 <kalloc>
80001160: 84aa mv s1,a0
memset(kpgtbl, 0, PGSIZE);
80001162: 6605 lui a2,0x1
80001164: 4581 li a1,0
80001166: 00000097 auipc ra,0x0
8000116a: b58080e7 jalr -1192(ra) # 80000cbe <memset>
kvmmap(kpgtbl, UART0, UART0, PGSIZE, PTE_R | PTE_W);
8000116e: 4719 li a4,6
80001170: 6685 lui a3,0x1
80001172: 10000637 lui a2,0x10000
80001176: 100005b7 lui a1,0x10000
8000117a: 8526 mv a0,s1
8000117c: 00000097 auipc ra,0x0
80001180: fa0080e7 jalr -96(ra) # 8000111c <kvmmap>
kvmmap(kpgtbl, VIRTIO0, VIRTIO0, PGSIZE, PTE_R | PTE_W);
80001184: 4719 li a4,6
80001186: 6685 lui a3,0x1
80001188: 10001637 lui a2,0x10001
8000118c: 100015b7 lui a1,0x10001
80001190: 8526 mv a0,s1
80001192: 00000097 auipc ra,0x0
80001196: f8a080e7 jalr -118(ra) # 8000111c <kvmmap>
kvmmap(kpgtbl, PLIC, PLIC, 0x400000, PTE_R | PTE_W);
8000119a: 4719 li a4,6
8000119c: 004006b7 lui a3,0x400
800011a0: 0c000637 lui a2,0xc000
800011a4: 0c0005b7 lui a1,0xc000
800011a8: 8526 mv a0,s1
800011aa: 00000097 auipc ra,0x0
800011ae: f72080e7 jalr -142(ra) # 8000111c <kvmmap>
kvmmap(kpgtbl, KERNBASE, KERNBASE, (uint64)etext-KERNBASE, PTE_R | PTE_X);
800011b2: 00007917 auipc s2,0x7
800011b6: e4e90913 addi s2,s2,-434 # 80008000 <etext>
800011ba: 4729 li a4,10
800011bc: 80007697 auipc a3,0x80007
800011c0: e4468693 addi a3,a3,-444 # 8000 <_entry-0x7fff8000>
800011c4: 4605 li a2,1
800011c6: 067e slli a2,a2,0x1f
800011c8: 85b2 mv a1,a2
800011ca: 8526 mv a0,s1
800011cc: 00000097 auipc ra,0x0
800011d0: f50080e7 jalr -176(ra) # 8000111c <kvmmap>
kvmmap(kpgtbl, (uint64)etext, (uint64)etext, PHYSTOP-(uint64)etext, PTE_R | PTE_W);
800011d4: 4719 li a4,6
800011d6: 46c5 li a3,17
800011d8: 06ee slli a3,a3,0x1b
800011da: 412686b3 sub a3,a3,s2
800011de: 864a mv a2,s2
800011e0: 85ca mv a1,s2
800011e2: 8526 mv a0,s1
800011e4: 00000097 auipc ra,0x0
800011e8: f38080e7 jalr -200(ra) # 8000111c <kvmmap>
kvmmap(kpgtbl, TRAMPOLINE, (uint64)trampoline, PGSIZE, PTE_R | PTE_X);
800011ec: 4729 li a4,10
800011ee: 6685 lui a3,0x1
800011f0: 00006617 auipc a2,0x6
800011f4: e1060613 addi a2,a2,-496 # 80007000 <_trampoline>
800011f8: 040005b7 lui a1,0x4000
800011fc: 15fd addi a1,a1,-1
800011fe: 05b2 slli a1,a1,0xc
80001200: 8526 mv a0,s1
80001202: 00000097 auipc ra,0x0
80001206: f1a080e7 jalr -230(ra) # 8000111c <kvmmap>
proc_mapstacks(kpgtbl);
8000120a: 8526 mv a0,s1
8000120c: 00000097 auipc ra,0x0
80001210: 600080e7 jalr 1536(ra) # 8000180c <proc_mapstacks>
}
80001214: 8526 mv a0,s1
80001216: 60e2 ld ra,24(sp)
80001218: 6442 ld s0,16(sp)
8000121a: 64a2 ld s1,8(sp)
8000121c: 6902 ld s2,0(sp)
8000121e: 6105 addi sp,sp,32
80001220: 8082 ret
0000000080001222 <kvminit>:
{
80001222: 1141 addi sp,sp,-16
80001224: e406 sd ra,8(sp)
80001226: e022 sd s0,0(sp)
80001228: 0800 addi s0,sp,16
kernel_pagetable = kvmmake();
8000122a: 00000097 auipc ra,0x0
8000122e: f22080e7 jalr -222(ra) # 8000114c <kvmmake>
80001232: 00008797 auipc a5,0x8
80001236: dea7b723 sd a0,-530(a5) # 80009020 <kernel_pagetable>
}
8000123a: 60a2 ld ra,8(sp)
8000123c: 6402 ld s0,0(sp)
8000123e: 0141 addi sp,sp,16
80001240: 8082 ret
0000000080001242 <uvmunmap>:
// Remove npages of mappings starting from va. va must be
// page-aligned. The mappings must exist.
// Optionally free the physical memory.
void
uvmunmap(pagetable_t pagetable, uint64 va, uint64 npages, int do_free)
{
80001242: 715d addi sp,sp,-80
80001244: e486 sd ra,72(sp)
80001246: e0a2 sd s0,64(sp)
80001248: fc26 sd s1,56(sp)
8000124a: f84a sd s2,48(sp)
8000124c: f44e sd s3,40(sp)
8000124e: f052 sd s4,32(sp)
80001250: ec56 sd s5,24(sp)
80001252: e85a sd s6,16(sp)
80001254: e45e sd s7,8(sp)
80001256: 0880 addi s0,sp,80
uint64 a;
pte_t *pte;
if((va % PGSIZE) != 0)
80001258: 03459793 slli a5,a1,0x34
8000125c: e795 bnez a5,80001288 <uvmunmap+0x46>
8000125e: 8a2a mv s4,a0
80001260: 892e mv s2,a1
80001262: 8ab6 mv s5,a3
panic("uvmunmap: not aligned");
for(a = va; a < va + npages*PGSIZE; a += PGSIZE){
80001264: 0632 slli a2,a2,0xc
80001266: 00b609b3 add s3,a2,a1
if((pte = walk(pagetable, a, 0)) == 0)
panic("uvmunmap: walk");
if((*pte & PTE_V) == 0)
panic("uvmunmap: not mapped");
if(PTE_FLAGS(*pte) == PTE_V)
8000126a: 4b85 li s7,1
for(a = va; a < va + npages*PGSIZE; a += PGSIZE){
8000126c: 6b05 lui s6,0x1
8000126e: 0735e263 bltu a1,s3,800012d2 <uvmunmap+0x90>
uint64 pa = PTE2PA(*pte);
kfree((void*)pa);
}
*pte = 0;
}
}
80001272: 60a6 ld ra,72(sp)
80001274: 6406 ld s0,64(sp)
80001276: 74e2 ld s1,56(sp)
80001278: 7942 ld s2,48(sp)
8000127a: 79a2 ld s3,40(sp)
8000127c: 7a02 ld s4,32(sp)
8000127e: 6ae2 ld s5,24(sp)
80001280: 6b42 ld s6,16(sp)
80001282: 6ba2 ld s7,8(sp)
80001284: 6161 addi sp,sp,80
80001286: 8082 ret
panic("uvmunmap: not aligned");
80001288: 00007517 auipc a0,0x7
8000128c: e6050513 addi a0,a0,-416 # 800080e8 <digits+0xa8>
80001290: fffff097 auipc ra,0xfffff
80001294: 29a080e7 jalr 666(ra) # 8000052a <panic>
panic("uvmunmap: walk");
80001298: 00007517 auipc a0,0x7
8000129c: e6850513 addi a0,a0,-408 # 80008100 <digits+0xc0>
800012a0: fffff097 auipc ra,0xfffff
800012a4: 28a080e7 jalr 650(ra) # 8000052a <panic>
panic("uvmunmap: not mapped");
800012a8: 00007517 auipc a0,0x7
800012ac: e6850513 addi a0,a0,-408 # 80008110 <digits+0xd0>
800012b0: fffff097 auipc ra,0xfffff
800012b4: 27a080e7 jalr 634(ra) # 8000052a <panic>
panic("uvmunmap: not a leaf");
800012b8: 00007517 auipc a0,0x7
800012bc: e7050513 addi a0,a0,-400 # 80008128 <digits+0xe8>
800012c0: fffff097 auipc ra,0xfffff
800012c4: 26a080e7 jalr 618(ra) # 8000052a <panic>
*pte = 0;
800012c8: 0004b023 sd zero,0(s1)
for(a = va; a < va + npages*PGSIZE; a += PGSIZE){
800012cc: 995a add s2,s2,s6
800012ce: fb3972e3 bgeu s2,s3,80001272 <uvmunmap+0x30>
if((pte = walk(pagetable, a, 0)) == 0)
800012d2: 4601 li a2,0
800012d4: 85ca mv a1,s2
800012d6: 8552 mv a0,s4
800012d8: 00000097 auipc ra,0x0
800012dc: cce080e7 jalr -818(ra) # 80000fa6 <walk>
800012e0: 84aa mv s1,a0
800012e2: d95d beqz a0,80001298 <uvmunmap+0x56>
if((*pte & PTE_V) == 0)
800012e4: 6108 ld a0,0(a0)
800012e6: 00157793 andi a5,a0,1
800012ea: dfdd beqz a5,800012a8 <uvmunmap+0x66>
if(PTE_FLAGS(*pte) == PTE_V)
800012ec: 3ff57793 andi a5,a0,1023
800012f0: fd7784e3 beq a5,s7,800012b8 <uvmunmap+0x76>
if(do_free){
800012f4: fc0a8ae3 beqz s5,800012c8 <uvmunmap+0x86>
uint64 pa = PTE2PA(*pte);
800012f8: 8129 srli a0,a0,0xa
kfree((void*)pa);
800012fa: 0532 slli a0,a0,0xc
800012fc: fffff097 auipc ra,0xfffff
80001300: 6da080e7 jalr 1754(ra) # 800009d6 <kfree>
80001304: b7d1 j 800012c8 <uvmunmap+0x86>
0000000080001306 <uvmcreate>:
// create an empty user page table.
// returns 0 if out of memory.
pagetable_t
uvmcreate()
{
80001306: 1101 addi sp,sp,-32
80001308: ec06 sd ra,24(sp)
8000130a: e822 sd s0,16(sp)
8000130c: e426 sd s1,8(sp)
8000130e: 1000 addi s0,sp,32
pagetable_t pagetable;
pagetable = (pagetable_t) kalloc();
80001310: fffff097 auipc ra,0xfffff
80001314: 7c2080e7 jalr 1986(ra) # 80000ad2 <kalloc>
80001318: 84aa mv s1,a0
if(pagetable == 0)
8000131a: c519 beqz a0,80001328 <uvmcreate+0x22>
return 0;
memset(pagetable, 0, PGSIZE);
8000131c: 6605 lui a2,0x1
8000131e: 4581 li a1,0
80001320: 00000097 auipc ra,0x0
80001324: 99e080e7 jalr -1634(ra) # 80000cbe <memset>
return pagetable;
}
80001328: 8526 mv a0,s1
8000132a: 60e2 ld ra,24(sp)
8000132c: 6442 ld s0,16(sp)
8000132e: 64a2 ld s1,8(sp)
80001330: 6105 addi sp,sp,32
80001332: 8082 ret
0000000080001334 <uvminit>:
// Load the user initcode into address 0 of pagetable,
// for the very first process.
// sz must be less than a page.
void
uvminit(pagetable_t pagetable, uchar *src, uint sz)
{
80001334: 7179 addi sp,sp,-48
80001336: f406 sd ra,40(sp)
80001338: f022 sd s0,32(sp)
8000133a: ec26 sd s1,24(sp)
8000133c: e84a sd s2,16(sp)
8000133e: e44e sd s3,8(sp)
80001340: e052 sd s4,0(sp)
80001342: 1800 addi s0,sp,48
char *mem;
if(sz >= PGSIZE)
80001344: 6785 lui a5,0x1
80001346: 04f67863 bgeu a2,a5,80001396 <uvminit+0x62>
8000134a: 8a2a mv s4,a0
8000134c: 89ae mv s3,a1
8000134e: 84b2 mv s1,a2
panic("inituvm: more than a page");
mem = kalloc();
80001350: fffff097 auipc ra,0xfffff
80001354: 782080e7 jalr 1922(ra) # 80000ad2 <kalloc>
80001358: 892a mv s2,a0
memset(mem, 0, PGSIZE);
8000135a: 6605 lui a2,0x1
8000135c: 4581 li a1,0
8000135e: 00000097 auipc ra,0x0
80001362: 960080e7 jalr -1696(ra) # 80000cbe <memset>
mappages(pagetable, 0, PGSIZE, (uint64)mem, PTE_W|PTE_R|PTE_X|PTE_U);
80001366: 4779 li a4,30
80001368: 86ca mv a3,s2
8000136a: 6605 lui a2,0x1
8000136c: 4581 li a1,0
8000136e: 8552 mv a0,s4
80001370: 00000097 auipc ra,0x0
80001374: d1e080e7 jalr -738(ra) # 8000108e <mappages>
memmove(mem, src, sz);
80001378: 8626 mv a2,s1
8000137a: 85ce mv a1,s3
8000137c: 854a mv a0,s2
8000137e: 00000097 auipc ra,0x0
80001382: 99c080e7 jalr -1636(ra) # 80000d1a <memmove>
}
80001386: 70a2 ld ra,40(sp)
80001388: 7402 ld s0,32(sp)
8000138a: 64e2 ld s1,24(sp)
8000138c: 6942 ld s2,16(sp)
8000138e: 69a2 ld s3,8(sp)
80001390: 6a02 ld s4,0(sp)
80001392: 6145 addi sp,sp,48
80001394: 8082 ret
panic("inituvm: more than a page");
80001396: 00007517 auipc a0,0x7
8000139a: daa50513 addi a0,a0,-598 # 80008140 <digits+0x100>
8000139e: fffff097 auipc ra,0xfffff
800013a2: 18c080e7 jalr 396(ra) # 8000052a <panic>
00000000800013a6 <uvmdealloc>:
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
uint64
uvmdealloc(pagetable_t pagetable, uint64 oldsz, uint64 newsz)
{
800013a6: 1101 addi sp,sp,-32
800013a8: ec06 sd ra,24(sp)
800013aa: e822 sd s0,16(sp)
800013ac: e426 sd s1,8(sp)
800013ae: 1000 addi s0,sp,32
if(newsz >= oldsz)
return oldsz;
800013b0: 84ae mv s1,a1
if(newsz >= oldsz)
800013b2: 00b67d63 bgeu a2,a1,800013cc <uvmdealloc+0x26>
800013b6: 84b2 mv s1,a2
if(PGROUNDUP(newsz) < PGROUNDUP(oldsz)){
800013b8: 6785 lui a5,0x1
800013ba: 17fd addi a5,a5,-1
800013bc: 00f60733 add a4,a2,a5
800013c0: 767d lui a2,0xfffff
800013c2: 8f71 and a4,a4,a2
800013c4: 97ae add a5,a5,a1
800013c6: 8ff1 and a5,a5,a2
800013c8: 00f76863 bltu a4,a5,800013d8 <uvmdealloc+0x32>
int npages = (PGROUNDUP(oldsz) - PGROUNDUP(newsz)) / PGSIZE;
uvmunmap(pagetable, PGROUNDUP(newsz), npages, 1);
}
return newsz;
}
800013cc: 8526 mv a0,s1
800013ce: 60e2 ld ra,24(sp)
800013d0: 6442 ld s0,16(sp)
800013d2: 64a2 ld s1,8(sp)
800013d4: 6105 addi sp,sp,32
800013d6: 8082 ret
int npages = (PGROUNDUP(oldsz) - PGROUNDUP(newsz)) / PGSIZE;
800013d8: 8f99 sub a5,a5,a4
800013da: 83b1 srli a5,a5,0xc
uvmunmap(pagetable, PGROUNDUP(newsz), npages, 1);
800013dc: 4685 li a3,1
800013de: 0007861b sext.w a2,a5
800013e2: 85ba mv a1,a4
800013e4: 00000097 auipc ra,0x0
800013e8: e5e080e7 jalr -418(ra) # 80001242 <uvmunmap>
800013ec: b7c5 j 800013cc <uvmdealloc+0x26>
00000000800013ee <uvmalloc>:
if(newsz < oldsz)
800013ee: 0ab66163 bltu a2,a1,80001490 <uvmalloc+0xa2>
{
800013f2: 7139 addi sp,sp,-64
800013f4: fc06 sd ra,56(sp)
800013f6: f822 sd s0,48(sp)
800013f8: f426 sd s1,40(sp)
800013fa: f04a sd s2,32(sp)
800013fc: ec4e sd s3,24(sp)
800013fe: e852 sd s4,16(sp)
80001400: e456 sd s5,8(sp)
80001402: 0080 addi s0,sp,64
80001404: 8aaa mv s5,a0
80001406: 8a32 mv s4,a2
oldsz = PGROUNDUP(oldsz);
80001408: 6985 lui s3,0x1
8000140a: 19fd addi s3,s3,-1
8000140c: 95ce add a1,a1,s3
8000140e: 79fd lui s3,0xfffff
80001410: 0135f9b3 and s3,a1,s3
for(a = oldsz; a < newsz; a += PGSIZE){
80001414: 08c9f063 bgeu s3,a2,80001494 <uvmalloc+0xa6>
80001418: 894e mv s2,s3
mem = kalloc();
8000141a: fffff097 auipc ra,0xfffff
8000141e: 6b8080e7 jalr 1720(ra) # 80000ad2 <kalloc>
80001422: 84aa mv s1,a0
if(mem == 0){
80001424: c51d beqz a0,80001452 <uvmalloc+0x64>
memset(mem, 0, PGSIZE);
80001426: 6605 lui a2,0x1
80001428: 4581 li a1,0
8000142a: 00000097 auipc ra,0x0
8000142e: 894080e7 jalr -1900(ra) # 80000cbe <memset>
if(mappages(pagetable, a, PGSIZE, (uint64)mem, PTE_W|PTE_X|PTE_R|PTE_U) != 0){
80001432: 4779 li a4,30
80001434: 86a6 mv a3,s1
80001436: 6605 lui a2,0x1
80001438: 85ca mv a1,s2
8000143a: 8556 mv a0,s5
8000143c: 00000097 auipc ra,0x0
80001440: c52080e7 jalr -942(ra) # 8000108e <mappages>
80001444: e905 bnez a0,80001474 <uvmalloc+0x86>
for(a = oldsz; a < newsz; a += PGSIZE){
80001446: 6785 lui a5,0x1
80001448: 993e add s2,s2,a5
8000144a: fd4968e3 bltu s2,s4,8000141a <uvmalloc+0x2c>
return newsz;
8000144e: 8552 mv a0,s4
80001450: a809 j 80001462 <uvmalloc+0x74>
uvmdealloc(pagetable, a, oldsz);
80001452: 864e mv a2,s3
80001454: 85ca mv a1,s2
80001456: 8556 mv a0,s5
80001458: 00000097 auipc ra,0x0
8000145c: f4e080e7 jalr -178(ra) # 800013a6 <uvmdealloc>
return 0;
80001460: 4501 li a0,0
}
80001462: 70e2 ld ra,56(sp)
80001464: 7442 ld s0,48(sp)
80001466: 74a2 ld s1,40(sp)
80001468: 7902 ld s2,32(sp)
8000146a: 69e2 ld s3,24(sp)
8000146c: 6a42 ld s4,16(sp)
8000146e: 6aa2 ld s5,8(sp)
80001470: 6121 addi sp,sp,64
80001472: 8082 ret
kfree(mem);
80001474: 8526 mv a0,s1
80001476: fffff097 auipc ra,0xfffff
8000147a: 560080e7 jalr 1376(ra) # 800009d6 <kfree>
uvmdealloc(pagetable, a, oldsz);
8000147e: 864e mv a2,s3
80001480: 85ca mv a1,s2
80001482: 8556 mv a0,s5
80001484: 00000097 auipc ra,0x0
80001488: f22080e7 jalr -222(ra) # 800013a6 <uvmdealloc>
return 0;
8000148c: 4501 li a0,0
8000148e: bfd1 j 80001462 <uvmalloc+0x74>
return oldsz;
80001490: 852e mv a0,a1
}
80001492: 8082 ret
return newsz;
80001494: 8532 mv a0,a2
80001496: b7f1 j 80001462 <uvmalloc+0x74>
0000000080001498 <freewalk>:
// Recursively free page-table pages.
// All leaf mappings must already have been removed.
void
freewalk(pagetable_t pagetable)
{
80001498: 7179 addi sp,sp,-48
8000149a: f406 sd ra,40(sp)
8000149c: f022 sd s0,32(sp)
8000149e: ec26 sd s1,24(sp)
800014a0: e84a sd s2,16(sp)
800014a2: e44e sd s3,8(sp)
800014a4: e052 sd s4,0(sp)
800014a6: 1800 addi s0,sp,48
800014a8: 8a2a mv s4,a0
// there are 2^9 = 512 PTEs in a page table.
for(int i = 0; i < 512; i++){
800014aa: 84aa mv s1,a0
800014ac: 6905 lui s2,0x1
800014ae: 992a add s2,s2,a0
pte_t pte = pagetable[i];
if((pte & PTE_V) && (pte & (PTE_R|PTE_W|PTE_X)) == 0){
800014b0: 4985 li s3,1
800014b2: a821 j 800014ca <freewalk+0x32>
// this PTE points to a lower-level page table.
uint64 child = PTE2PA(pte);
800014b4: 8129 srli a0,a0,0xa
freewalk((pagetable_t)child);
800014b6: 0532 slli a0,a0,0xc
800014b8: 00000097 auipc ra,0x0
800014bc: fe0080e7 jalr -32(ra) # 80001498 <freewalk>
pagetable[i] = 0;
800014c0: 0004b023 sd zero,0(s1)
for(int i = 0; i < 512; i++){
800014c4: 04a1 addi s1,s1,8
800014c6: 03248163 beq s1,s2,800014e8 <freewalk+0x50>
pte_t pte = pagetable[i];
800014ca: 6088 ld a0,0(s1)
if((pte & PTE_V) && (pte & (PTE_R|PTE_W|PTE_X)) == 0){
800014cc: 00f57793 andi a5,a0,15
800014d0: ff3782e3 beq a5,s3,800014b4 <freewalk+0x1c>
} else if(pte & PTE_V){
800014d4: 8905 andi a0,a0,1
800014d6: d57d beqz a0,800014c4 <freewalk+0x2c>
panic("freewalk: leaf");
800014d8: 00007517 auipc a0,0x7
800014dc: c8850513 addi a0,a0,-888 # 80008160 <digits+0x120>
800014e0: fffff097 auipc ra,0xfffff
800014e4: 04a080e7 jalr 74(ra) # 8000052a <panic>
}
}
kfree((void*)pagetable);
800014e8: 8552 mv a0,s4
800014ea: fffff097 auipc ra,0xfffff
800014ee: 4ec080e7 jalr 1260(ra) # 800009d6 <kfree>
}
800014f2: 70a2 ld ra,40(sp)
800014f4: 7402 ld s0,32(sp)
800014f6: 64e2 ld s1,24(sp)
800014f8: 6942 ld s2,16(sp)
800014fa: 69a2 ld s3,8(sp)
800014fc: 6a02 ld s4,0(sp)
800014fe: 6145 addi sp,sp,48
80001500: 8082 ret
0000000080001502 <uvmfree>:
// Free user memory pages,
// then free page-table pages.
void
uvmfree(pagetable_t pagetable, uint64 sz)
{
80001502: 1101 addi sp,sp,-32
80001504: ec06 sd ra,24(sp)
80001506: e822 sd s0,16(sp)
80001508: e426 sd s1,8(sp)
8000150a: 1000 addi s0,sp,32
8000150c: 84aa mv s1,a0
if(sz > 0)
8000150e: e999 bnez a1,80001524 <uvmfree+0x22>
uvmunmap(pagetable, 0, PGROUNDUP(sz)/PGSIZE, 1);
freewalk(pagetable);
80001510: 8526 mv a0,s1
80001512: 00000097 auipc ra,0x0
80001516: f86080e7 jalr -122(ra) # 80001498 <freewalk>
}
8000151a: 60e2 ld ra,24(sp)
8000151c: 6442 ld s0,16(sp)
8000151e: 64a2 ld s1,8(sp)
80001520: 6105 addi sp,sp,32
80001522: 8082 ret
uvmunmap(pagetable, 0, PGROUNDUP(sz)/PGSIZE, 1);
80001524: 6605 lui a2,0x1
80001526: 167d addi a2,a2,-1
80001528: 962e add a2,a2,a1
8000152a: 4685 li a3,1
8000152c: 8231 srli a2,a2,0xc
8000152e: 4581 li a1,0
80001530: 00000097 auipc ra,0x0
80001534: d12080e7 jalr -750(ra) # 80001242 <uvmunmap>
80001538: bfe1 j 80001510 <uvmfree+0xe>
000000008000153a <uvmcopy>:
pte_t *pte;
uint64 pa, i;
uint flags;
char *mem;
for(i = 0; i < sz; i += PGSIZE){
8000153a: c679 beqz a2,80001608 <uvmcopy+0xce>
{
8000153c: 715d addi sp,sp,-80
8000153e: e486 sd ra,72(sp)
80001540: e0a2 sd s0,64(sp)
80001542: fc26 sd s1,56(sp)
80001544: f84a sd s2,48(sp)
80001546: f44e sd s3,40(sp)
80001548: f052 sd s4,32(sp)
8000154a: ec56 sd s5,24(sp)
8000154c: e85a sd s6,16(sp)
8000154e: e45e sd s7,8(sp)
80001550: 0880 addi s0,sp,80
80001552: 8b2a mv s6,a0
80001554: 8aae mv s5,a1
80001556: 8a32 mv s4,a2
for(i = 0; i < sz; i += PGSIZE){
80001558: 4981 li s3,0
if((pte = walk(old, i, 0)) == 0)
8000155a: 4601 li a2,0
8000155c: 85ce mv a1,s3
8000155e: 855a mv a0,s6
80001560: 00000097 auipc ra,0x0
80001564: a46080e7 jalr -1466(ra) # 80000fa6 <walk>
80001568: c531 beqz a0,800015b4 <uvmcopy+0x7a>
panic("uvmcopy: pte should exist");
if((*pte & PTE_V) == 0)
8000156a: 6118 ld a4,0(a0)
8000156c: 00177793 andi a5,a4,1
80001570: cbb1 beqz a5,800015c4 <uvmcopy+0x8a>
panic("uvmcopy: page not present");
pa = PTE2PA(*pte);
80001572: 00a75593 srli a1,a4,0xa
80001576: 00c59b93 slli s7,a1,0xc
flags = PTE_FLAGS(*pte);
8000157a: 3ff77493 andi s1,a4,1023
if((mem = kalloc()) == 0)
8000157e: fffff097 auipc ra,0xfffff
80001582: 554080e7 jalr 1364(ra) # 80000ad2 <kalloc>
80001586: 892a mv s2,a0
80001588: c939 beqz a0,800015de <uvmcopy+0xa4>
goto err;
memmove(mem, (char*)pa, PGSIZE);
8000158a: 6605 lui a2,0x1
8000158c: 85de mv a1,s7
8000158e: fffff097 auipc ra,0xfffff
80001592: 78c080e7 jalr 1932(ra) # 80000d1a <memmove>
if(mappages(new, i, PGSIZE, (uint64)mem, flags) != 0){
80001596: 8726 mv a4,s1
80001598: 86ca mv a3,s2
8000159a: 6605 lui a2,0x1
8000159c: 85ce mv a1,s3
8000159e: 8556 mv a0,s5
800015a0: 00000097 auipc ra,0x0
800015a4: aee080e7 jalr -1298(ra) # 8000108e <mappages>
800015a8: e515 bnez a0,800015d4 <uvmcopy+0x9a>
for(i = 0; i < sz; i += PGSIZE){
800015aa: 6785 lui a5,0x1
800015ac: 99be add s3,s3,a5
800015ae: fb49e6e3 bltu s3,s4,8000155a <uvmcopy+0x20>
800015b2: a081 j 800015f2 <uvmcopy+0xb8>
panic("uvmcopy: pte should exist");
800015b4: 00007517 auipc a0,0x7
800015b8: bbc50513 addi a0,a0,-1092 # 80008170 <digits+0x130>
800015bc: fffff097 auipc ra,0xfffff
800015c0: f6e080e7 jalr -146(ra) # 8000052a <panic>
panic("uvmcopy: page not present");
800015c4: 00007517 auipc a0,0x7
800015c8: bcc50513 addi a0,a0,-1076 # 80008190 <digits+0x150>
800015cc: fffff097 auipc ra,0xfffff
800015d0: f5e080e7 jalr -162(ra) # 8000052a <panic>
kfree(mem);
800015d4: 854a mv a0,s2
800015d6: fffff097 auipc ra,0xfffff
800015da: 400080e7 jalr 1024(ra) # 800009d6 <kfree>
}
}
return 0;
err:
uvmunmap(new, 0, i / PGSIZE, 1);
800015de: 4685 li a3,1
800015e0: 00c9d613 srli a2,s3,0xc
800015e4: 4581 li a1,0
800015e6: 8556 mv a0,s5
800015e8: 00000097 auipc ra,0x0
800015ec: c5a080e7 jalr -934(ra) # 80001242 <uvmunmap>
return -1;
800015f0: 557d li a0,-1
}
800015f2: 60a6 ld ra,72(sp)
800015f4: 6406 ld s0,64(sp)
800015f6: 74e2 ld s1,56(sp)
800015f8: 7942 ld s2,48(sp)
800015fa: 79a2 ld s3,40(sp)
800015fc: 7a02 ld s4,32(sp)
800015fe: 6ae2 ld s5,24(sp)
80001600: 6b42 ld s6,16(sp)
80001602: 6ba2 ld s7,8(sp)
80001604: 6161 addi sp,sp,80
80001606: 8082 ret
return 0;
80001608: 4501 li a0,0
}
8000160a: 8082 ret
000000008000160c <uvmclear>:
// mark a PTE invalid for user access.
// used by exec for the user stack guard page.
void
uvmclear(pagetable_t pagetable, uint64 va)
{
8000160c: 1141 addi sp,sp,-16
8000160e: e406 sd ra,8(sp)
80001610: e022 sd s0,0(sp)
80001612: 0800 addi s0,sp,16
pte_t *pte;
pte = walk(pagetable, va, 0);
80001614: 4601 li a2,0
80001616: 00000097 auipc ra,0x0
8000161a: 990080e7 jalr -1648(ra) # 80000fa6 <walk>
if(pte == 0)
8000161e: c901 beqz a0,8000162e <uvmclear+0x22>
panic("uvmclear");
*pte &= ~PTE_U;
80001620: 611c ld a5,0(a0)
80001622: 9bbd andi a5,a5,-17
80001624: e11c sd a5,0(a0)
}
80001626: 60a2 ld ra,8(sp)
80001628: 6402 ld s0,0(sp)
8000162a: 0141 addi sp,sp,16
8000162c: 8082 ret
panic("uvmclear");
8000162e: 00007517 auipc a0,0x7
80001632: b8250513 addi a0,a0,-1150 # 800081b0 <digits+0x170>
80001636: fffff097 auipc ra,0xfffff
8000163a: ef4080e7 jalr -268(ra) # 8000052a <panic>
000000008000163e <copyout>:
int
copyout(pagetable_t pagetable, uint64 dstva, char *src, uint64 len)
{
uint64 n, va0, pa0;
while(len > 0){
8000163e: c6bd beqz a3,800016ac <copyout+0x6e>
{
80001640: 715d addi sp,sp,-80
80001642: e486 sd ra,72(sp)
80001644: e0a2 sd s0,64(sp)
80001646: fc26 sd s1,56(sp)
80001648: f84a sd s2,48(sp)
8000164a: f44e sd s3,40(sp)
8000164c: f052 sd s4,32(sp)
8000164e: ec56 sd s5,24(sp)
80001650: e85a sd s6,16(sp)
80001652: e45e sd s7,8(sp)
80001654: e062 sd s8,0(sp)
80001656: 0880 addi s0,sp,80
80001658: 8b2a mv s6,a0
8000165a: 8c2e mv s8,a1
8000165c: 8a32 mv s4,a2
8000165e: 89b6 mv s3,a3
va0 = PGROUNDDOWN(dstva);
80001660: 7bfd lui s7,0xfffff
pa0 = walkaddr(pagetable, va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (dstva - va0);
80001662: 6a85 lui s5,0x1
80001664: a015 j 80001688 <copyout+0x4a>
if(n > len)
n = len;
memmove((void *)(pa0 + (dstva - va0)), src, n);
80001666: 9562 add a0,a0,s8
80001668: 0004861b sext.w a2,s1
8000166c: 85d2 mv a1,s4
8000166e: 41250533 sub a0,a0,s2
80001672: fffff097 auipc ra,0xfffff
80001676: 6a8080e7 jalr 1704(ra) # 80000d1a <memmove>
len -= n;
8000167a: 409989b3 sub s3,s3,s1
src += n;
8000167e: 9a26 add s4,s4,s1
dstva = va0 + PGSIZE;
80001680: 01590c33 add s8,s2,s5
while(len > 0){
80001684: 02098263 beqz s3,800016a8 <copyout+0x6a>
va0 = PGROUNDDOWN(dstva);
80001688: 017c7933 and s2,s8,s7
pa0 = walkaddr(pagetable, va0);
8000168c: 85ca mv a1,s2
8000168e: 855a mv a0,s6
80001690: 00000097 auipc ra,0x0
80001694: 9bc080e7 jalr -1604(ra) # 8000104c <walkaddr>
if(pa0 == 0)
80001698: cd01 beqz a0,800016b0 <copyout+0x72>
n = PGSIZE - (dstva - va0);
8000169a: 418904b3 sub s1,s2,s8
8000169e: 94d6 add s1,s1,s5
if(n > len)
800016a0: fc99f3e3 bgeu s3,s1,80001666 <copyout+0x28>
800016a4: 84ce mv s1,s3
800016a6: b7c1 j 80001666 <copyout+0x28>
}
return 0;
800016a8: 4501 li a0,0
800016aa: a021 j 800016b2 <copyout+0x74>
800016ac: 4501 li a0,0
}
800016ae: 8082 ret
return -1;
800016b0: 557d li a0,-1
}
800016b2: 60a6 ld ra,72(sp)
800016b4: 6406 ld s0,64(sp)
800016b6: 74e2 ld s1,56(sp)
800016b8: 7942 ld s2,48(sp)
800016ba: 79a2 ld s3,40(sp)
800016bc: 7a02 ld s4,32(sp)
800016be: 6ae2 ld s5,24(sp)
800016c0: 6b42 ld s6,16(sp)
800016c2: 6ba2 ld s7,8(sp)
800016c4: 6c02 ld s8,0(sp)
800016c6: 6161 addi sp,sp,80
800016c8: 8082 ret
00000000800016ca <copyin>:
int
copyin(pagetable_t pagetable, char *dst, uint64 srcva, uint64 len)
{
uint64 n, va0, pa0;
while(len > 0){
800016ca: caa5 beqz a3,8000173a <copyin+0x70>
{
800016cc: 715d addi sp,sp,-80
800016ce: e486 sd ra,72(sp)
800016d0: e0a2 sd s0,64(sp)
800016d2: fc26 sd s1,56(sp)
800016d4: f84a sd s2,48(sp)
800016d6: f44e sd s3,40(sp)
800016d8: f052 sd s4,32(sp)
800016da: ec56 sd s5,24(sp)
800016dc: e85a sd s6,16(sp)
800016de: e45e sd s7,8(sp)
800016e0: e062 sd s8,0(sp)
800016e2: 0880 addi s0,sp,80
800016e4: 8b2a mv s6,a0
800016e6: 8a2e mv s4,a1
800016e8: 8c32 mv s8,a2
800016ea: 89b6 mv s3,a3
va0 = PGROUNDDOWN(srcva);
800016ec: 7bfd lui s7,0xfffff
pa0 = walkaddr(pagetable, va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (srcva - va0);
800016ee: 6a85 lui s5,0x1
800016f0: a01d j 80001716 <copyin+0x4c>
if(n > len)
n = len;
memmove(dst, (void *)(pa0 + (srcva - va0)), n);
800016f2: 018505b3 add a1,a0,s8
800016f6: 0004861b sext.w a2,s1
800016fa: 412585b3 sub a1,a1,s2
800016fe: 8552 mv a0,s4
80001700: fffff097 auipc ra,0xfffff
80001704: 61a080e7 jalr 1562(ra) # 80000d1a <memmove>
len -= n;
80001708: 409989b3 sub s3,s3,s1
dst += n;
8000170c: 9a26 add s4,s4,s1
srcva = va0 + PGSIZE;
8000170e: 01590c33 add s8,s2,s5
while(len > 0){
80001712: 02098263 beqz s3,80001736 <copyin+0x6c>
va0 = PGROUNDDOWN(srcva);
80001716: 017c7933 and s2,s8,s7
pa0 = walkaddr(pagetable, va0);
8000171a: 85ca mv a1,s2
8000171c: 855a mv a0,s6
8000171e: 00000097 auipc ra,0x0
80001722: 92e080e7 jalr -1746(ra) # 8000104c <walkaddr>
if(pa0 == 0)
80001726: cd01 beqz a0,8000173e <copyin+0x74>
n = PGSIZE - (srcva - va0);
80001728: 418904b3 sub s1,s2,s8
8000172c: 94d6 add s1,s1,s5
if(n > len)
8000172e: fc99f2e3 bgeu s3,s1,800016f2 <copyin+0x28>
80001732: 84ce mv s1,s3
80001734: bf7d j 800016f2 <copyin+0x28>
}
return 0;
80001736: 4501 li a0,0
80001738: a021 j 80001740 <copyin+0x76>
8000173a: 4501 li a0,0
}
8000173c: 8082 ret
return -1;
8000173e: 557d li a0,-1
}
80001740: 60a6 ld ra,72(sp)
80001742: 6406 ld s0,64(sp)
80001744: 74e2 ld s1,56(sp)
80001746: 7942 ld s2,48(sp)
80001748: 79a2 ld s3,40(sp)
8000174a: 7a02 ld s4,32(sp)
8000174c: 6ae2 ld s5,24(sp)
8000174e: 6b42 ld s6,16(sp)
80001750: 6ba2 ld s7,8(sp)
80001752: 6c02 ld s8,0(sp)
80001754: 6161 addi sp,sp,80
80001756: 8082 ret
0000000080001758 <copyinstr>:
copyinstr(pagetable_t pagetable, char *dst, uint64 srcva, uint64 max)
{
uint64 n, va0, pa0;
int got_null = 0;
while(got_null == 0 && max > 0){
80001758: c6c5 beqz a3,80001800 <copyinstr+0xa8>
{
8000175a: 715d addi sp,sp,-80
8000175c: e486 sd ra,72(sp)
8000175e: e0a2 sd s0,64(sp)
80001760: fc26 sd s1,56(sp)
80001762: f84a sd s2,48(sp)
80001764: f44e sd s3,40(sp)
80001766: f052 sd s4,32(sp)
80001768: ec56 sd s5,24(sp)
8000176a: e85a sd s6,16(sp)
8000176c: e45e sd s7,8(sp)
8000176e: 0880 addi s0,sp,80
80001770: 8a2a mv s4,a0
80001772: 8b2e mv s6,a1
80001774: 8bb2 mv s7,a2
80001776: 84b6 mv s1,a3
va0 = PGROUNDDOWN(srcva);
80001778: 7afd lui s5,0xfffff
pa0 = walkaddr(pagetable, va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (srcva - va0);
8000177a: 6985 lui s3,0x1
8000177c: a035 j 800017a8 <copyinstr+0x50>
n = max;
char *p = (char *) (pa0 + (srcva - va0));
while(n > 0){
if(*p == '\0'){
*dst = '\0';
8000177e: 00078023 sb zero,0(a5) # 1000 <_entry-0x7ffff000>
80001782: 4785 li a5,1
dst++;
}
srcva = va0 + PGSIZE;
}
if(got_null){
80001784: 0017b793 seqz a5,a5
80001788: 40f00533 neg a0,a5
return 0;
} else {
return -1;
}
}
8000178c: 60a6 ld ra,72(sp)
8000178e: 6406 ld s0,64(sp)
80001790: 74e2 ld s1,56(sp)
80001792: 7942 ld s2,48(sp)
80001794: 79a2 ld s3,40(sp)
80001796: 7a02 ld s4,32(sp)
80001798: 6ae2 ld s5,24(sp)
8000179a: 6b42 ld s6,16(sp)
8000179c: 6ba2 ld s7,8(sp)
8000179e: 6161 addi sp,sp,80
800017a0: 8082 ret
srcva = va0 + PGSIZE;
800017a2: 01390bb3 add s7,s2,s3
while(got_null == 0 && max > 0){
800017a6: c8a9 beqz s1,800017f8 <copyinstr+0xa0>
va0 = PGROUNDDOWN(srcva);
800017a8: 015bf933 and s2,s7,s5
pa0 = walkaddr(pagetable, va0);
800017ac: 85ca mv a1,s2
800017ae: 8552 mv a0,s4
800017b0: 00000097 auipc ra,0x0
800017b4: 89c080e7 jalr -1892(ra) # 8000104c <walkaddr>
if(pa0 == 0)
800017b8: c131 beqz a0,800017fc <copyinstr+0xa4>
n = PGSIZE - (srcva - va0);
800017ba: 41790833 sub a6,s2,s7
800017be: 984e add a6,a6,s3
if(n > max)
800017c0: 0104f363 bgeu s1,a6,800017c6 <copyinstr+0x6e>
800017c4: 8826 mv a6,s1
char *p = (char *) (pa0 + (srcva - va0));
800017c6: 955e add a0,a0,s7
800017c8: 41250533 sub a0,a0,s2
while(n > 0){
800017cc: fc080be3 beqz a6,800017a2 <copyinstr+0x4a>
800017d0: 985a add a6,a6,s6
800017d2: 87da mv a5,s6
if(*p == '\0'){
800017d4: 41650633 sub a2,a0,s6
800017d8: 14fd addi s1,s1,-1
800017da: 9b26 add s6,s6,s1
800017dc: 00f60733 add a4,a2,a5
800017e0: 00074703 lbu a4,0(a4) # fffffffffffff000 <end+0xffffffff7ffd8000>
800017e4: df49 beqz a4,8000177e <copyinstr+0x26>
*dst = *p;
800017e6: 00e78023 sb a4,0(a5)
--max;
800017ea: 40fb04b3 sub s1,s6,a5
dst++;
800017ee: 0785 addi a5,a5,1
while(n > 0){
800017f0: ff0796e3 bne a5,a6,800017dc <copyinstr+0x84>
dst++;
800017f4: 8b42 mv s6,a6
800017f6: b775 j 800017a2 <copyinstr+0x4a>
800017f8: 4781 li a5,0
800017fa: b769 j 80001784 <copyinstr+0x2c>
return -1;
800017fc: 557d li a0,-1
800017fe: b779 j 8000178c <copyinstr+0x34>
int got_null = 0;
80001800: 4781 li a5,0
if(got_null){
80001802: 0017b793 seqz a5,a5
80001806: 40f00533 neg a0,a5
}
8000180a: 8082 ret
000000008000180c <proc_mapstacks>:
// Allocate a page for each process's kernel stack.
// Map it high in memory, followed by an invalid
// guard page.
void
proc_mapstacks(pagetable_t kpgtbl) {
8000180c: 7139 addi sp,sp,-64
8000180e: fc06 sd ra,56(sp)
80001810: f822 sd s0,48(sp)
80001812: f426 sd s1,40(sp)
80001814: f04a sd s2,32(sp)
80001816: ec4e sd s3,24(sp)
80001818: e852 sd s4,16(sp)
8000181a: e456 sd s5,8(sp)
8000181c: e05a sd s6,0(sp)
8000181e: 0080 addi s0,sp,64
80001820: 89aa mv s3,a0
struct proc *p;
for(p = proc; p < &proc[NPROC]; p++) {
80001822: 00010497 auipc s1,0x10
80001826: eae48493 addi s1,s1,-338 # 800116d0 <proc>
char *pa = kalloc();
if(pa == 0)
panic("kalloc");
uint64 va = KSTACK((int) (p - proc));
8000182a: 8b26 mv s6,s1
8000182c: 00006a97 auipc s5,0x6
80001830: 7d4a8a93 addi s5,s5,2004 # 80008000 <etext>
80001834: 04000937 lui s2,0x4000
80001838: 197d addi s2,s2,-1
8000183a: 0932 slli s2,s2,0xc
for(p = proc; p < &proc[NPROC]; p++) {
8000183c: 00016a17 auipc s4,0x16
80001840: 694a0a13 addi s4,s4,1684 # 80017ed0 <tickslock>
char *pa = kalloc();
80001844: fffff097 auipc ra,0xfffff
80001848: 28e080e7 jalr 654(ra) # 80000ad2 <kalloc>
8000184c: 862a mv a2,a0
if(pa == 0)
8000184e: c131 beqz a0,80001892 <proc_mapstacks+0x86>
uint64 va = KSTACK((int) (p - proc));
80001850: 416485b3 sub a1,s1,s6
80001854: 8595 srai a1,a1,0x5
80001856: 000ab783 ld a5,0(s5)
8000185a: 02f585b3 mul a1,a1,a5
8000185e: 2585 addiw a1,a1,1
80001860: 00d5959b slliw a1,a1,0xd
kvmmap(kpgtbl, va, (uint64)pa, PGSIZE, PTE_R | PTE_W);
80001864: 4719 li a4,6
80001866: 6685 lui a3,0x1
80001868: 40b905b3 sub a1,s2,a1
8000186c: 854e mv a0,s3
8000186e: 00000097 auipc ra,0x0
80001872: 8ae080e7 jalr -1874(ra) # 8000111c <kvmmap>
for(p = proc; p < &proc[NPROC]; p++) {
80001876: 1a048493 addi s1,s1,416
8000187a: fd4495e3 bne s1,s4,80001844 <proc_mapstacks+0x38>
}
}
8000187e: 70e2 ld ra,56(sp)
80001880: 7442 ld s0,48(sp)
80001882: 74a2 ld s1,40(sp)
80001884: 7902 ld s2,32(sp)
80001886: 69e2 ld s3,24(sp)
80001888: 6a42 ld s4,16(sp)
8000188a: 6aa2 ld s5,8(sp)
8000188c: 6b02 ld s6,0(sp)
8000188e: 6121 addi sp,sp,64
80001890: 8082 ret
panic("kalloc");
80001892: 00007517 auipc a0,0x7
80001896: 92e50513 addi a0,a0,-1746 # 800081c0 <digits+0x180>
8000189a: fffff097 auipc ra,0xfffff
8000189e: c90080e7 jalr -880(ra) # 8000052a <panic>
00000000800018a2 <procinit>:
}
// initialize the proc table at boot time.
void
procinit(void)
{
800018a2: 7139 addi sp,sp,-64
800018a4: fc06 sd ra,56(sp)
800018a6: f822 sd s0,48(sp)
800018a8: f426 sd s1,40(sp)
800018aa: f04a sd s2,32(sp)
800018ac: ec4e sd s3,24(sp)
800018ae: e852 sd s4,16(sp)
800018b0: e456 sd s5,8(sp)
800018b2: e05a sd s6,0(sp)
800018b4: 0080 addi s0,sp,64
struct proc *p;
initlock(&pid_lock, "nextpid");
800018b6: 00007597 auipc a1,0x7
800018ba: 91258593 addi a1,a1,-1774 # 800081c8 <digits+0x188>
800018be: 00010517 auipc a0,0x10
800018c2: 9e250513 addi a0,a0,-1566 # 800112a0 <pid_lock>
800018c6: fffff097 auipc ra,0xfffff
800018ca: 26c080e7 jalr 620(ra) # 80000b32 <initlock>
initlock(&wait_lock, "wait_lock");
800018ce: 00007597 auipc a1,0x7
800018d2: 90258593 addi a1,a1,-1790 # 800081d0 <digits+0x190>
800018d6: 00010517 auipc a0,0x10
800018da: 9e250513 addi a0,a0,-1566 # 800112b8 <wait_lock>
800018de: fffff097 auipc ra,0xfffff
800018e2: 254080e7 jalr 596(ra) # 80000b32 <initlock>
for(p = proc; p < &proc[NPROC]; p++) {
800018e6: 00010497 auipc s1,0x10
800018ea: dea48493 addi s1,s1,-534 # 800116d0 <proc>
initlock(&p->lock, "proc");
800018ee: 00007b17 auipc s6,0x7
800018f2: 8f2b0b13 addi s6,s6,-1806 # 800081e0 <digits+0x1a0>
p->kstack = KSTACK((int) (p - proc));
800018f6: 8aa6 mv s5,s1
800018f8: 00006a17 auipc s4,0x6
800018fc: 708a0a13 addi s4,s4,1800 # 80008000 <etext>
80001900: 04000937 lui s2,0x4000
80001904: 197d addi s2,s2,-1
80001906: 0932 slli s2,s2,0xc
for(p = proc; p < &proc[NPROC]; p++) {
80001908: 00016997 auipc s3,0x16
8000190c: 5c898993 addi s3,s3,1480 # 80017ed0 <tickslock>
initlock(&p->lock, "proc");
80001910: 85da mv a1,s6
80001912: 8526 mv a0,s1
80001914: fffff097 auipc ra,0xfffff
80001918: 21e080e7 jalr 542(ra) # 80000b32 <initlock>
p->kstack = KSTACK((int) (p - proc));
8000191c: 415487b3 sub a5,s1,s5
80001920: 8795 srai a5,a5,0x5
80001922: 000a3703 ld a4,0(s4)
80001926: 02e787b3 mul a5,a5,a4
8000192a: 2785 addiw a5,a5,1
8000192c: 00d7979b slliw a5,a5,0xd
80001930: 40f907b3 sub a5,s2,a5
80001934: fcbc sd a5,120(s1)
for(p = proc; p < &proc[NPROC]; p++) {
80001936: 1a048493 addi s1,s1,416
8000193a: fd349be3 bne s1,s3,80001910 <procinit+0x6e>
}
}
8000193e: 70e2 ld ra,56(sp)
80001940: 7442 ld s0,48(sp)
80001942: 74a2 ld s1,40(sp)
80001944: 7902 ld s2,32(sp)
80001946: 69e2 ld s3,24(sp)
80001948: 6a42 ld s4,16(sp)
8000194a: 6aa2 ld s5,8(sp)
8000194c: 6b02 ld s6,0(sp)
8000194e: 6121 addi sp,sp,64
80001950: 8082 ret
0000000080001952 <cpuid>:
// Must be called with interrupts disabled,
// to prevent race with process being moved
// to a different CPU.
int
cpuid()
{
80001952: 1141 addi sp,sp,-16
80001954: e422 sd s0,8(sp)
80001956: 0800 addi s0,sp,16
asm volatile("mv %0, tp" : "=r" (x) );
80001958: 8512 mv a0,tp
int id = r_tp();
return id;
}
8000195a: 2501 sext.w a0,a0
8000195c: 6422 ld s0,8(sp)
8000195e: 0141 addi sp,sp,16
80001960: 8082 ret
0000000080001962 <mycpu>:
// Return this CPU's cpu struct.
// Interrupts must be disabled.
struct cpu*
mycpu(void) {
80001962: 1141 addi sp,sp,-16
80001964: e422 sd s0,8(sp)
80001966: 0800 addi s0,sp,16
80001968: 8792 mv a5,tp
int id = cpuid();
struct cpu *c = &cpus[id];
8000196a: 2781 sext.w a5,a5
8000196c: 079e slli a5,a5,0x7
return c;
}
8000196e: 00010517 auipc a0,0x10
80001972: 96250513 addi a0,a0,-1694 # 800112d0 <cpus>
80001976: 953e add a0,a0,a5
80001978: 6422 ld s0,8(sp)
8000197a: 0141 addi sp,sp,16
8000197c: 8082 ret
000000008000197e <myproc>:
// Return the current struct proc *, or zero if none.
struct proc*
myproc(void) {
8000197e: 1101 addi sp,sp,-32
80001980: ec06 sd ra,24(sp)
80001982: e822 sd s0,16(sp)
80001984: e426 sd s1,8(sp)
80001986: 1000 addi s0,sp,32
push_off();
80001988: fffff097 auipc ra,0xfffff
8000198c: 1ee080e7 jalr 494(ra) # 80000b76 <push_off>
80001990: 8792 mv a5,tp
struct cpu *c = mycpu();
struct proc *p = c->proc;
80001992: 2781 sext.w a5,a5
80001994: 079e slli a5,a5,0x7
80001996: 00010717 auipc a4,0x10
8000199a: 90a70713 addi a4,a4,-1782 # 800112a0 <pid_lock>
8000199e: 97ba add a5,a5,a4
800019a0: 7b84 ld s1,48(a5)
pop_off();
800019a2: fffff097 auipc ra,0xfffff
800019a6: 274080e7 jalr 628(ra) # 80000c16 <pop_off>
return p;
}
800019aa: 8526 mv a0,s1
800019ac: 60e2 ld ra,24(sp)
800019ae: 6442 ld s0,16(sp)
800019b0: 64a2 ld s1,8(sp)
800019b2: 6105 addi sp,sp,32
800019b4: 8082 ret
00000000800019b6 <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch to forkret.
void
forkret(void)
{
800019b6: 1141 addi sp,sp,-16
800019b8: e406 sd ra,8(sp)
800019ba: e022 sd s0,0(sp)
800019bc: 0800 addi s0,sp,16
static int first = 1;
// Still holding p->lock from scheduler.
release(&myproc()->lock);
800019be: 00000097 auipc ra,0x0
800019c2: fc0080e7 jalr -64(ra) # 8000197e <myproc>
800019c6: fffff097 auipc ra,0xfffff
800019ca: 2b0080e7 jalr 688(ra) # 80000c76 <release>
if (first) {
800019ce: 00007797 auipc a5,0x7
800019d2: f627a783 lw a5,-158(a5) # 80008930 <first.1>
800019d6: eb89 bnez a5,800019e8 <forkret+0x32>
// be run from main().
first = 0;
fsinit(ROOTDEV);
}
usertrapret();
800019d8: 00001097 auipc ra,0x1
800019dc: f8a080e7 jalr -118(ra) # 80002962 <usertrapret>
}
800019e0: 60a2 ld ra,8(sp)
800019e2: 6402 ld s0,0(sp)
800019e4: 0141 addi sp,sp,16
800019e6: 8082 ret
first = 0;
800019e8: 00007797 auipc a5,0x7
800019ec: f407a423 sw zero,-184(a5) # 80008930 <first.1>
fsinit(ROOTDEV);
800019f0: 4505 li a0,1
800019f2: 00002097 auipc ra,0x2
800019f6: e50080e7 jalr -432(ra) # 80003842 <fsinit>
800019fa: bff9 j 800019d8 <forkret+0x22>
00000000800019fc <allocpid>:
allocpid() {
800019fc: 1101 addi sp,sp,-32
800019fe: ec06 sd ra,24(sp)
80001a00: e822 sd s0,16(sp)
80001a02: e426 sd s1,8(sp)
80001a04: e04a sd s2,0(sp)
80001a06: 1000 addi s0,sp,32
acquire(&pid_lock);
80001a08: 00010917 auipc s2,0x10
80001a0c: 89890913 addi s2,s2,-1896 # 800112a0 <pid_lock>
80001a10: 854a mv a0,s2
80001a12: fffff097 auipc ra,0xfffff
80001a16: 1b0080e7 jalr 432(ra) # 80000bc2 <acquire>
pid = nextpid;
80001a1a: 00007797 auipc a5,0x7
80001a1e: f1a78793 addi a5,a5,-230 # 80008934 <nextpid>
80001a22: 4384 lw s1,0(a5)
nextpid = nextpid + 1;
80001a24: 0014871b addiw a4,s1,1
80001a28: c398 sw a4,0(a5)
release(&pid_lock);
80001a2a: 854a mv a0,s2
80001a2c: fffff097 auipc ra,0xfffff
80001a30: 24a080e7 jalr 586(ra) # 80000c76 <release>
}
80001a34: 8526 mv a0,s1
80001a36: 60e2 ld ra,24(sp)
80001a38: 6442 ld s0,16(sp)
80001a3a: 64a2 ld s1,8(sp)
80001a3c: 6902 ld s2,0(sp)
80001a3e: 6105 addi sp,sp,32
80001a40: 8082 ret
0000000080001a42 <proc_pagetable>:
{
80001a42: 1101 addi sp,sp,-32
80001a44: ec06 sd ra,24(sp)
80001a46: e822 sd s0,16(sp)
80001a48: e426 sd s1,8(sp)
80001a4a: e04a sd s2,0(sp)
80001a4c: 1000 addi s0,sp,32
80001a4e: 892a mv s2,a0
pagetable = uvmcreate();
80001a50: 00000097 auipc ra,0x0
80001a54: 8b6080e7 jalr -1866(ra) # 80001306 <uvmcreate>
80001a58: 84aa mv s1,a0
if(pagetable == 0)
80001a5a: c121 beqz a0,80001a9a <proc_pagetable+0x58>
if(mappages(pagetable, TRAMPOLINE, PGSIZE,
80001a5c: 4729 li a4,10
80001a5e: 00005697 auipc a3,0x5
80001a62: 5a268693 addi a3,a3,1442 # 80007000 <_trampoline>
80001a66: 6605 lui a2,0x1
80001a68: 040005b7 lui a1,0x4000
80001a6c: 15fd addi a1,a1,-1
80001a6e: 05b2 slli a1,a1,0xc
80001a70: fffff097 auipc ra,0xfffff
80001a74: 61e080e7 jalr 1566(ra) # 8000108e <mappages>
80001a78: 02054863 bltz a0,80001aa8 <proc_pagetable+0x66>
if(mappages(pagetable, TRAPFRAME, PGSIZE,
80001a7c: 4719 li a4,6
80001a7e: 09093683 ld a3,144(s2)
80001a82: 6605 lui a2,0x1
80001a84: 020005b7 lui a1,0x2000
80001a88: 15fd addi a1,a1,-1
80001a8a: 05b6 slli a1,a1,0xd
80001a8c: 8526 mv a0,s1
80001a8e: fffff097 auipc ra,0xfffff
80001a92: 600080e7 jalr 1536(ra) # 8000108e <mappages>
80001a96: 02054163 bltz a0,80001ab8 <proc_pagetable+0x76>
}
80001a9a: 8526 mv a0,s1
80001a9c: 60e2 ld ra,24(sp)
80001a9e: 6442 ld s0,16(sp)
80001aa0: 64a2 ld s1,8(sp)
80001aa2: 6902 ld s2,0(sp)
80001aa4: 6105 addi sp,sp,32
80001aa6: 8082 ret
uvmfree(pagetable, 0);
80001aa8: 4581 li a1,0
80001aaa: 8526 mv a0,s1
80001aac: 00000097 auipc ra,0x0
80001ab0: a56080e7 jalr -1450(ra) # 80001502 <uvmfree>
return 0;
80001ab4: 4481 li s1,0
80001ab6: b7d5 j 80001a9a <proc_pagetable+0x58>
uvmunmap(pagetable, TRAMPOLINE, 1, 0);
80001ab8: 4681 li a3,0
80001aba: 4605 li a2,1
80001abc: 040005b7 lui a1,0x4000
80001ac0: 15fd addi a1,a1,-1
80001ac2: 05b2 slli a1,a1,0xc
80001ac4: 8526 mv a0,s1
80001ac6: fffff097 auipc ra,0xfffff
80001aca: 77c080e7 jalr 1916(ra) # 80001242 <uvmunmap>
uvmfree(pagetable, 0);
80001ace: 4581 li a1,0
80001ad0: 8526 mv a0,s1
80001ad2: 00000097 auipc ra,0x0
80001ad6: a30080e7 jalr -1488(ra) # 80001502 <uvmfree>
return 0;
80001ada: 4481 li s1,0
80001adc: bf7d j 80001a9a <proc_pagetable+0x58>
0000000080001ade <proc_freepagetable>:
{
80001ade: 1101 addi sp,sp,-32
80001ae0: ec06 sd ra,24(sp)
80001ae2: e822 sd s0,16(sp)
80001ae4: e426 sd s1,8(sp)
80001ae6: e04a sd s2,0(sp)
80001ae8: 1000 addi s0,sp,32
80001aea: 84aa mv s1,a0
80001aec: 892e mv s2,a1
uvmunmap(pagetable, TRAMPOLINE, 1, 0);
80001aee: 4681 li a3,0
80001af0: 4605 li a2,1
80001af2: 040005b7 lui a1,0x4000
80001af6: 15fd addi a1,a1,-1
80001af8: 05b2 slli a1,a1,0xc
80001afa: fffff097 auipc ra,0xfffff
80001afe: 748080e7 jalr 1864(ra) # 80001242 <uvmunmap>
uvmunmap(pagetable, TRAPFRAME, 1, 0);
80001b02: 4681 li a3,0
80001b04: 4605 li a2,1
80001b06: 020005b7 lui a1,0x2000
80001b0a: 15fd addi a1,a1,-1
80001b0c: 05b6 slli a1,a1,0xd
80001b0e: 8526 mv a0,s1
80001b10: fffff097 auipc ra,0xfffff
80001b14: 732080e7 jalr 1842(ra) # 80001242 <uvmunmap>
uvmfree(pagetable, sz);
80001b18: 85ca mv a1,s2
80001b1a: 8526 mv a0,s1
80001b1c: 00000097 auipc ra,0x0
80001b20: 9e6080e7 jalr -1562(ra) # 80001502 <uvmfree>
}
80001b24: 60e2 ld ra,24(sp)
80001b26: 6442 ld s0,16(sp)
80001b28: 64a2 ld s1,8(sp)
80001b2a: 6902 ld s2,0(sp)
80001b2c: 6105 addi sp,sp,32
80001b2e: 8082 ret
0000000080001b30 <freeproc>:
{
80001b30: 1101 addi sp,sp,-32
80001b32: ec06 sd ra,24(sp)
80001b34: e822 sd s0,16(sp)
80001b36: e426 sd s1,8(sp)
80001b38: 1000 addi s0,sp,32
80001b3a: 84aa mv s1,a0
if(p->trapframe)
80001b3c: 6948 ld a0,144(a0)
80001b3e: c509 beqz a0,80001b48 <freeproc+0x18>
kfree((void*)p->trapframe);
80001b40: fffff097 auipc ra,0xfffff
80001b44: e96080e7 jalr -362(ra) # 800009d6 <kfree>
p->trapframe = 0;
80001b48: 0804b823 sd zero,144(s1)
if(p->pagetable)
80001b4c: 64c8 ld a0,136(s1)
80001b4e: c511 beqz a0,80001b5a <freeproc+0x2a>
proc_freepagetable(p->pagetable, p->sz);
80001b50: 60cc ld a1,128(s1)
80001b52: 00000097 auipc ra,0x0
80001b56: f8c080e7 jalr -116(ra) # 80001ade <proc_freepagetable>
p->pagetable = 0;
80001b5a: 0804b423 sd zero,136(s1)
p->sz = 0;
80001b5e: 0804b023 sd zero,128(s1)
p->pid = 0;
80001b62: 0204a823 sw zero,48(s1)
p->parent = 0;
80001b66: 0604b823 sd zero,112(s1)
p->name[0] = 0;
80001b6a: 18048823 sb zero,400(s1)
p->chan = 0;
80001b6e: 0204b023 sd zero,32(s1)
p->killed = 0;
80001b72: 0204a423 sw zero,40(s1)
p->xstate = 0;
80001b76: 0204a623 sw zero,44(s1)
p->ctime = 0;
80001b7a: 0404a023 sw zero,64(s1)
p->ttime = 0;
80001b7e: 0404a223 sw zero,68(s1)
p->stime = 0;
80001b82: 0404a423 sw zero,72(s1)
p->retime = 0;
80001b86: 0404a623 sw zero,76(s1)
p->rutime = 0;
80001b8a: 0404a823 sw zero,80(s1)
p->average_bursttime = 0;
80001b8e: 0404aa23 sw zero,84(s1)
p->state = UNUSED;
80001b92: 0004ac23 sw zero,24(s1)
}
80001b96: 60e2 ld ra,24(sp)
80001b98: 6442 ld s0,16(sp)
80001b9a: 64a2 ld s1,8(sp)
80001b9c: 6105 addi sp,sp,32
80001b9e: 8082 ret
0000000080001ba0 <allocproc>:
{
80001ba0: 1101 addi sp,sp,-32
80001ba2: ec06 sd ra,24(sp)
80001ba4: e822 sd s0,16(sp)
80001ba6: e426 sd s1,8(sp)
80001ba8: e04a sd s2,0(sp)
80001baa: 1000 addi s0,sp,32
for(p = proc; p < &proc[NPROC]; p++) {
80001bac: 00010497 auipc s1,0x10
80001bb0: b2448493 addi s1,s1,-1244 # 800116d0 <proc>
80001bb4: 00016917 auipc s2,0x16
80001bb8: 31c90913 addi s2,s2,796 # 80017ed0 <tickslock>
acquire(&p->lock);
80001bbc: 8526 mv a0,s1
80001bbe: fffff097 auipc ra,0xfffff
80001bc2: 004080e7 jalr 4(ra) # 80000bc2 <acquire>
if(p->state == UNUSED) {
80001bc6: 4c9c lw a5,24(s1)
80001bc8: cf81 beqz a5,80001be0 <allocproc+0x40>
release(&p->lock);
80001bca: 8526 mv a0,s1
80001bcc: fffff097 auipc ra,0xfffff
80001bd0: 0aa080e7 jalr 170(ra) # 80000c76 <release>
for(p = proc; p < &proc[NPROC]; p++) {
80001bd4: 1a048493 addi s1,s1,416
80001bd8: ff2492e3 bne s1,s2,80001bbc <allocproc+0x1c>
return 0;
80001bdc: 4481 li s1,0
80001bde: a8ad j 80001c58 <allocproc+0xb8>
p->pid = allocpid();
80001be0: 00000097 auipc ra,0x0
80001be4: e1c080e7 jalr -484(ra) # 800019fc <allocpid>
80001be8: d888 sw a0,48(s1)
p->state = USED;
80001bea: 4785 li a5,1
80001bec: cc9c sw a5,24(s1)
p->mask = 0;
80001bee: 0204aa23 sw zero,52(s1)
p->tickcounter = 0;
80001bf2: 0204ac23 sw zero,56(s1)
p->priority = NORMAL_PRIORITY;
80001bf6: 4795 li a5,5
80001bf8: dcdc sw a5,60(s1)
p->average_bursttime = QUANTUM * 100;
80001bfa: 1f400793 li a5,500
80001bfe: c8fc sw a5,84(s1)
p->ctime = ticks;
80001c00: 00007797 auipc a5,0x7
80001c04: 4307a783 lw a5,1072(a5) # 80009030 <ticks>
80001c08: c0bc sw a5,64(s1)
p->readyTime = 0;
80001c0a: 0404bc23 sd zero,88(s1)
p->rutime = 0;
80001c0e: 0404a823 sw zero,80(s1)
p->stime = 0;
80001c12: 0404a423 sw zero,72(s1)
if((p->trapframe = (struct trapframe *)kalloc()) == 0){
80001c16: fffff097 auipc ra,0xfffff
80001c1a: ebc080e7 jalr -324(ra) # 80000ad2 <kalloc>
80001c1e: 892a mv s2,a0
80001c20: e8c8 sd a0,144(s1)
80001c22: c131 beqz a0,80001c66 <allocproc+0xc6>
p->pagetable = proc_pagetable(p);
80001c24: 8526 mv a0,s1
80001c26: 00000097 auipc ra,0x0
80001c2a: e1c080e7 jalr -484(ra) # 80001a42 <proc_pagetable>
80001c2e: 892a mv s2,a0
80001c30: e4c8 sd a0,136(s1)
if(p->pagetable == 0){
80001c32: c531 beqz a0,80001c7e <allocproc+0xde>
memset(&p->context, 0, sizeof(p->context));
80001c34: 07000613 li a2,112
80001c38: 4581 li a1,0
80001c3a: 09848513 addi a0,s1,152
80001c3e: fffff097 auipc ra,0xfffff
80001c42: 080080e7 jalr 128(ra) # 80000cbe <memset>
p->context.ra = (uint64)forkret;
80001c46: 00000797 auipc a5,0x0
80001c4a: d7078793 addi a5,a5,-656 # 800019b6 <forkret>
80001c4e: ecdc sd a5,152(s1)
p->context.sp = p->kstack + PGSIZE;
80001c50: 7cbc ld a5,120(s1)
80001c52: 6705 lui a4,0x1
80001c54: 97ba add a5,a5,a4
80001c56: f0dc sd a5,160(s1)
}
80001c58: 8526 mv a0,s1
80001c5a: 60e2 ld ra,24(sp)
80001c5c: 6442 ld s0,16(sp)
80001c5e: 64a2 ld s1,8(sp)
80001c60: 6902 ld s2,0(sp)
80001c62: 6105 addi sp,sp,32
80001c64: 8082 ret
freeproc(p);
80001c66: 8526 mv a0,s1
80001c68: 00000097 auipc ra,0x0
80001c6c: ec8080e7 jalr -312(ra) # 80001b30 <freeproc>
release(&p->lock);
80001c70: 8526 mv a0,s1
80001c72: fffff097 auipc ra,0xfffff
80001c76: 004080e7 jalr 4(ra) # 80000c76 <release>
return 0;
80001c7a: 84ca mv s1,s2
80001c7c: bff1 j 80001c58 <allocproc+0xb8>
freeproc(p);
80001c7e: 8526 mv a0,s1
80001c80: 00000097 auipc ra,0x0
80001c84: eb0080e7 jalr -336(ra) # 80001b30 <freeproc>
release(&p->lock);
80001c88: 8526 mv a0,s1
80001c8a: fffff097 auipc ra,0xfffff
80001c8e: fec080e7 jalr -20(ra) # 80000c76 <release>
return 0;
80001c92: 84ca mv s1,s2
80001c94: b7d1 j 80001c58 <allocproc+0xb8>
0000000080001c96 <userinit>:
{
80001c96: 1101 addi sp,sp,-32
80001c98: ec06 sd ra,24(sp)
80001c9a: e822 sd s0,16(sp)
80001c9c: e426 sd s1,8(sp)
80001c9e: 1000 addi s0,sp,32
p = allocproc();
80001ca0: 00000097 auipc ra,0x0
80001ca4: f00080e7 jalr -256(ra) # 80001ba0 <allocproc>
80001ca8: 84aa mv s1,a0
initproc = p;
80001caa: 00007797 auipc a5,0x7
80001cae: 36a7bf23 sd a0,894(a5) # 80009028 <initproc>
uvminit(p->pagetable, initcode, sizeof(initcode));
80001cb2: 03400613 li a2,52
80001cb6: 00007597 auipc a1,0x7
80001cba: c8a58593 addi a1,a1,-886 # 80008940 <initcode>
80001cbe: 6548 ld a0,136(a0)
80001cc0: fffff097 auipc ra,0xfffff
80001cc4: 674080e7 jalr 1652(ra) # 80001334 <uvminit>
p->sz = PGSIZE;
80001cc8: 6785 lui a5,0x1
80001cca: e0dc sd a5,128(s1)
p->trapframe->epc = 0; // user program counter
80001ccc: 68d8 ld a4,144(s1)
80001cce: 00073c23 sd zero,24(a4) # 1018 <_entry-0x7fffefe8>
p->trapframe->sp = PGSIZE; // user stack pointer
80001cd2: 68d8 ld a4,144(s1)
80001cd4: fb1c sd a5,48(a4)
safestrcpy(p->name, "initcode", sizeof(p->name));
80001cd6: 4641 li a2,16
80001cd8: 00006597 auipc a1,0x6
80001cdc: 51058593 addi a1,a1,1296 # 800081e8 <digits+0x1a8>
80001ce0: 19048513 addi a0,s1,400
80001ce4: fffff097 auipc ra,0xfffff
80001ce8: 12c080e7 jalr 300(ra) # 80000e10 <safestrcpy>
p->cwd = namei("/");
80001cec: 00006517 auipc a0,0x6
80001cf0: 50c50513 addi a0,a0,1292 # 800081f8 <digits+0x1b8>
80001cf4: 00002097 auipc ra,0x2
80001cf8: 57c080e7 jalr 1404(ra) # 80004270 <namei>
80001cfc: 18a4b423 sd a0,392(s1)
p->state = RUNNABLE;
80001d00: 478d li a5,3
80001d02: cc9c sw a5,24(s1)
p->readyTime = ticks;
80001d04: 00007797 auipc a5,0x7
80001d08: 32c7e783 lwu a5,812(a5) # 80009030 <ticks>
80001d0c: ecbc sd a5,88(s1)
release(&p->lock);
80001d0e: 8526 mv a0,s1
80001d10: fffff097 auipc ra,0xfffff
80001d14: f66080e7 jalr -154(ra) # 80000c76 <release>
}
80001d18: 60e2 ld ra,24(sp)
80001d1a: 6442 ld s0,16(sp)
80001d1c: 64a2 ld s1,8(sp)
80001d1e: 6105 addi sp,sp,32
80001d20: 8082 ret
0000000080001d22 <growproc>:
{
80001d22: 1101 addi sp,sp,-32
80001d24: ec06 sd ra,24(sp)
80001d26: e822 sd s0,16(sp)
80001d28: e426 sd s1,8(sp)
80001d2a: e04a sd s2,0(sp)
80001d2c: 1000 addi s0,sp,32
80001d2e: 84aa mv s1,a0
struct proc *p = myproc();
80001d30: 00000097 auipc ra,0x0
80001d34: c4e080e7 jalr -946(ra) # 8000197e <myproc>
80001d38: 892a mv s2,a0
sz = p->sz;
80001d3a: 614c ld a1,128(a0)
80001d3c: 0005861b sext.w a2,a1
if(n > 0){
80001d40: 00904f63 bgtz s1,80001d5e <growproc+0x3c>
} else if(n < 0){
80001d44: 0204cc63 bltz s1,80001d7c <growproc+0x5a>
p->sz = sz;
80001d48: 1602 slli a2,a2,0x20
80001d4a: 9201 srli a2,a2,0x20
80001d4c: 08c93023 sd a2,128(s2)
return 0;
80001d50: 4501 li a0,0
}
80001d52: 60e2 ld ra,24(sp)
80001d54: 6442 ld s0,16(sp)
80001d56: 64a2 ld s1,8(sp)
80001d58: 6902 ld s2,0(sp)
80001d5a: 6105 addi sp,sp,32
80001d5c: 8082 ret
if((sz = uvmalloc(p->pagetable, sz, sz + n)) == 0) {
80001d5e: 9e25 addw a2,a2,s1
80001d60: 1602 slli a2,a2,0x20
80001d62: 9201 srli a2,a2,0x20
80001d64: 1582 slli a1,a1,0x20
80001d66: 9181 srli a1,a1,0x20
80001d68: 6548 ld a0,136(a0)
80001d6a: fffff097 auipc ra,0xfffff
80001d6e: 684080e7 jalr 1668(ra) # 800013ee <uvmalloc>
80001d72: 0005061b sext.w a2,a0
80001d76: fa69 bnez a2,80001d48 <growproc+0x26>
return -1;
80001d78: 557d li a0,-1
80001d7a: bfe1 j 80001d52 <growproc+0x30>
sz = uvmdealloc(p->pagetable, sz, sz + n);
80001d7c: 9e25 addw a2,a2,s1
80001d7e: 1602 slli a2,a2,0x20
80001d80: 9201 srli a2,a2,0x20
80001d82: 1582 slli a1,a1,0x20
80001d84: 9181 srli a1,a1,0x20
80001d86: 6548 ld a0,136(a0)
80001d88: fffff097 auipc ra,0xfffff
80001d8c: 61e080e7 jalr 1566(ra) # 800013a6 <uvmdealloc>
80001d90: 0005061b sext.w a2,a0
80001d94: bf55 j 80001d48 <growproc+0x26>
0000000080001d96 <fork>:
{
80001d96: 7139 addi sp,sp,-64
80001d98: fc06 sd ra,56(sp)
80001d9a: f822 sd s0,48(sp)
80001d9c: f426 sd s1,40(sp)
80001d9e: f04a sd s2,32(sp)
80001da0: ec4e sd s3,24(sp)
80001da2: e852 sd s4,16(sp)
80001da4: e456 sd s5,8(sp)
80001da6: 0080 addi s0,sp,64
struct proc *p = myproc();
80001da8: 00000097 auipc ra,0x0
80001dac: bd6080e7 jalr -1066(ra) # 8000197e <myproc>
80001db0: 8aaa mv s5,a0
if((np = allocproc()) == 0){
80001db2: 00000097 auipc ra,0x0
80001db6: dee080e7 jalr -530(ra) # 80001ba0 <allocproc>
80001dba: 14050063 beqz a0,80001efa <fork+0x164>
80001dbe: 89aa mv s3,a0
if(uvmcopy(p->pagetable, np->pagetable, p->sz) < 0){
80001dc0: 080ab603 ld a2,128(s5)
80001dc4: 654c ld a1,136(a0)
80001dc6: 088ab503 ld a0,136(s5)
80001dca: fffff097 auipc ra,0xfffff
80001dce: 770080e7 jalr 1904(ra) # 8000153a <uvmcopy>
80001dd2: 06054663 bltz a0,80001e3e <fork+0xa8>
np->sz = p->sz;
80001dd6: 080ab783 ld a5,128(s5)
80001dda: 08f9b023 sd a5,128(s3)
np->mask = p->mask;
80001dde: 034aa783 lw a5,52(s5)
80001de2: 02f9aa23 sw a5,52(s3)
np->priority = p->priority;
80001de6: 03caa783 lw a5,60(s5)
80001dea: 02f9ae23 sw a5,60(s3)
np->tickcounter = 0;
80001dee: 0209ac23 sw zero,56(s3)
np->average_bursttime = QUANTUM * 100;
80001df2: 1f400793 li a5,500
80001df6: 04f9aa23 sw a5,84(s3)
*(np->trapframe) = *(p->trapframe);
80001dfa: 090ab683 ld a3,144(s5)
80001dfe: 87b6 mv a5,a3
80001e00: 0909b703 ld a4,144(s3)
80001e04: 12068693 addi a3,a3,288
80001e08: 0007b803 ld a6,0(a5)
80001e0c: 6788 ld a0,8(a5)
80001e0e: 6b8c ld a1,16(a5)
80001e10: 6f90 ld a2,24(a5)
80001e12: 01073023 sd a6,0(a4)
80001e16: e708 sd a0,8(a4)
80001e18: eb0c sd a1,16(a4)
80001e1a: ef10 sd a2,24(a4)
80001e1c: 02078793 addi a5,a5,32
80001e20: 02070713 addi a4,a4,32
80001e24: fed792e3 bne a5,a3,80001e08 <fork+0x72>
np->trapframe->a0 = 0;
80001e28: 0909b783 ld a5,144(s3)
80001e2c: 0607b823 sd zero,112(a5)
for(i = 0; i < NOFILE; i++)
80001e30: 108a8493 addi s1,s5,264
80001e34: 10898913 addi s2,s3,264
80001e38: 188a8a13 addi s4,s5,392
80001e3c: a00d j 80001e5e <fork+0xc8>
freeproc(np);
80001e3e: 854e mv a0,s3
80001e40: 00000097 auipc ra,0x0
80001e44: cf0080e7 jalr -784(ra) # 80001b30 <freeproc>
release(&np->lock);
80001e48: 854e mv a0,s3
80001e4a: fffff097 auipc ra,0xfffff
80001e4e: e2c080e7 jalr -468(ra) # 80000c76 <release>
return -1;
80001e52: 597d li s2,-1
80001e54: a849 j 80001ee6 <fork+0x150>
for(i = 0; i < NOFILE; i++)
80001e56: 04a1 addi s1,s1,8
80001e58: 0921 addi s2,s2,8
80001e5a: 01448b63 beq s1,s4,80001e70 <fork+0xda>
if(p->ofile[i])
80001e5e: 6088 ld a0,0(s1)
80001e60: d97d beqz a0,80001e56 <fork+0xc0>
np->ofile[i] = filedup(p->ofile[i]);
80001e62: 00003097 auipc ra,0x3
80001e66: aa8080e7 jalr -1368(ra) # 8000490a <filedup>
80001e6a: 00a93023 sd a0,0(s2)
80001e6e: b7e5 j 80001e56 <fork+0xc0>
np->cwd = idup(p->cwd);
80001e70: 188ab503 ld a0,392(s5)
80001e74: 00002097 auipc ra,0x2
80001e78: c08080e7 jalr -1016(ra) # 80003a7c <idup>
80001e7c: 18a9b423 sd a0,392(s3)
safestrcpy(np->name, p->name, sizeof(p->name));
80001e80: 4641 li a2,16
80001e82: 190a8593 addi a1,s5,400
80001e86: 19098513 addi a0,s3,400
80001e8a: fffff097 auipc ra,0xfffff
80001e8e: f86080e7 jalr -122(ra) # 80000e10 <safestrcpy>
pid = np->pid;
80001e92: 0309a903 lw s2,48(s3)
release(&np->lock);
80001e96: 854e mv a0,s3
80001e98: fffff097 auipc ra,0xfffff
80001e9c: dde080e7 jalr -546(ra) # 80000c76 <release>
acquire(&wait_lock);
80001ea0: 0000f497 auipc s1,0xf
80001ea4: 41848493 addi s1,s1,1048 # 800112b8 <wait_lock>
80001ea8: 8526 mv a0,s1
80001eaa: fffff097 auipc ra,0xfffff
80001eae: d18080e7 jalr -744(ra) # 80000bc2 <acquire>
np->parent = p;
80001eb2: 0759b823 sd s5,112(s3)
release(&wait_lock);
80001eb6: 8526 mv a0,s1
80001eb8: fffff097 auipc ra,0xfffff
80001ebc: dbe080e7 jalr -578(ra) # 80000c76 <release>
acquire(&np->lock);
80001ec0: 854e mv a0,s3
80001ec2: fffff097 auipc ra,0xfffff
80001ec6: d00080e7 jalr -768(ra) # 80000bc2 <acquire>
np->state = RUNNABLE;
80001eca: 478d li a5,3
80001ecc: 00f9ac23 sw a5,24(s3)
np->readyTime = ticks;
80001ed0: 00007797 auipc a5,0x7
80001ed4: 1607e783 lwu a5,352(a5) # 80009030 <ticks>
80001ed8: 04f9bc23 sd a5,88(s3)
release(&np->lock);
80001edc: 854e mv a0,s3
80001ede: fffff097 auipc ra,0xfffff
80001ee2: d98080e7 jalr -616(ra) # 80000c76 <release>
}
80001ee6: 854a mv a0,s2
80001ee8: 70e2 ld ra,56(sp)
80001eea: 7442 ld s0,48(sp)
80001eec: 74a2 ld s1,40(sp)
80001eee: 7902 ld s2,32(sp)
80001ef0: 69e2 ld s3,24(sp)
80001ef2: 6a42 ld s4,16(sp)
80001ef4: 6aa2 ld s5,8(sp)
80001ef6: 6121 addi sp,sp,64
80001ef8: 8082 ret
return -1;
80001efa: 597d li s2,-1
80001efc: b7ed j 80001ee6 <fork+0x150>
0000000080001efe <scheduler>:
{
80001efe: 715d addi sp,sp,-80
80001f00: e486 sd ra,72(sp)
80001f02: e0a2 sd s0,64(sp)
80001f04: fc26 sd s1,56(sp)
80001f06: f84a sd s2,48(sp)
80001f08: f44e sd s3,40(sp)
80001f0a: f052 sd s4,32(sp)
80001f0c: ec56 sd s5,24(sp)
80001f0e: e85a sd s6,16(sp)
80001f10: e45e sd s7,8(sp)
80001f12: 0880 addi s0,sp,80
80001f14: 8792 mv a5,tp
int id = r_tp();
80001f16: 2781 sext.w a5,a5
c->proc = 0;
80001f18: 00779b13 slli s6,a5,0x7
80001f1c: 0000f717 auipc a4,0xf
80001f20: 38470713 addi a4,a4,900 # 800112a0 <pid_lock>
80001f24: 975a add a4,a4,s6
80001f26: 02073823 sd zero,48(a4)
swtch(&c->context, &p->context);
80001f2a: 0000f717 auipc a4,0xf
80001f2e: 3ae70713 addi a4,a4,942 # 800112d8 <cpus+0x8>
80001f32: 9b3a add s6,s6,a4
if(p->state != RUNNABLE) {
80001f34: 498d li s3,3
p->runningTime = ticks;
80001f36: 00007b97 auipc s7,0x7
80001f3a: 0fab8b93 addi s7,s7,250 # 80009030 <ticks>
c->proc = p;
80001f3e: 079e slli a5,a5,0x7
80001f40: 0000fa17 auipc s4,0xf
80001f44: 360a0a13 addi s4,s4,864 # 800112a0 <pid_lock>
80001f48: 9a3e add s4,s4,a5
for(p = proc; p < &proc[NPROC]; p++) {
80001f4a: 00016917 auipc s2,0x16
80001f4e: f8690913 addi s2,s2,-122 # 80017ed0 <tickslock>
asm volatile("csrr %0, sstatus" : "=r" (x) );
80001f52: 100027f3 csrr a5,sstatus
w_sstatus(r_sstatus() | SSTATUS_SIE);
80001f56: 0027e793 ori a5,a5,2
asm volatile("csrw sstatus, %0" : : "r" (x));
80001f5a: 10079073 csrw sstatus,a5
80001f5e: 0000f497 auipc s1,0xf
80001f62: 77248493 addi s1,s1,1906 # 800116d0 <proc>
p->state = RUNNING;
80001f66: 4a91 li s5,4
80001f68: a811 j 80001f7c <scheduler+0x7e>
release(&p->lock);
80001f6a: 8526 mv a0,s1
80001f6c: fffff097 auipc ra,0xfffff
80001f70: d0a080e7 jalr -758(ra) # 80000c76 <release>
for(p = proc; p < &proc[NPROC]; p++) {
80001f74: 1a048493 addi s1,s1,416
80001f78: fd248de3 beq s1,s2,80001f52 <scheduler+0x54>
acquire(&p->lock);
80001f7c: 8526 mv a0,s1
80001f7e: fffff097 auipc ra,0xfffff
80001f82: c44080e7 jalr -956(ra) # 80000bc2 <acquire>
if(p->state != RUNNABLE) {
80001f86: 4c9c lw a5,24(s1)
80001f88: ff3791e3 bne a5,s3,80001f6a <scheduler+0x6c>
p->state = RUNNING;
80001f8c: 0154ac23 sw s5,24(s1)
p->runningTime = ticks;
80001f90: 000ba703 lw a4,0(s7)
80001f94: 02071793 slli a5,a4,0x20
80001f98: 9381 srli a5,a5,0x20
80001f9a: f0bc sd a5,96(s1)
p->retime += ticks - p->readyTime;
80001f9c: 44fc lw a5,76(s1)
80001f9e: 9fb9 addw a5,a5,a4
80001fa0: 6cb8 ld a4,88(s1)
80001fa2: 9f99 subw a5,a5,a4
80001fa4: c4fc sw a5,76(s1)
c->proc = p;
80001fa6: 029a3823 sd s1,48(s4)
swtch(&c->context, &p->context);
80001faa: 09848593 addi a1,s1,152
80001fae: 855a mv a0,s6
80001fb0: 00001097 auipc ra,0x1
80001fb4: 908080e7 jalr -1784(ra) # 800028b8 <swtch>
c->proc = 0;
80001fb8: 020a3823 sd zero,48(s4)
release(&p->lock);
80001fbc: 8526 mv a0,s1
80001fbe: fffff097 auipc ra,0xfffff
80001fc2: cb8080e7 jalr -840(ra) # 80000c76 <release>
80001fc6: b77d j 80001f74 <scheduler+0x76>
0000000080001fc8 <sched>:
{
80001fc8: 7179 addi sp,sp,-48
80001fca: f406 sd ra,40(sp)
80001fcc: f022 sd s0,32(sp)
80001fce: ec26 sd s1,24(sp)
80001fd0: e84a sd s2,16(sp)
80001fd2: e44e sd s3,8(sp)
80001fd4: 1800 addi s0,sp,48
struct proc *p = myproc();
80001fd6: 00000097 auipc ra,0x0
80001fda: 9a8080e7 jalr -1624(ra) # 8000197e <myproc>
80001fde: 84aa mv s1,a0
if(!holding(&p->lock))
80001fe0: fffff097 auipc ra,0xfffff
80001fe4: b68080e7 jalr -1176(ra) # 80000b48 <holding>
80001fe8: c93d beqz a0,8000205e <sched+0x96>
asm volatile("mv %0, tp" : "=r" (x) );
80001fea: 8792 mv a5,tp
if(mycpu()->noff != 1)
80001fec: 2781 sext.w a5,a5
80001fee: 079e slli a5,a5,0x7
80001ff0: 0000f717 auipc a4,0xf
80001ff4: 2b070713 addi a4,a4,688 # 800112a0 <pid_lock>
80001ff8: 97ba add a5,a5,a4
80001ffa: 0a87a703 lw a4,168(a5)
80001ffe: 4785 li a5,1
80002000: 06f71763 bne a4,a5,8000206e <sched+0xa6>
if(p->state == RUNNING)
80002004: 4c98 lw a4,24(s1)
80002006: 4791 li a5,4
80002008: 06f70b63 beq a4,a5,8000207e <sched+0xb6>
asm volatile("csrr %0, sstatus" : "=r" (x) );
8000200c: 100027f3 csrr a5,sstatus
return (x & SSTATUS_SIE) != 0;
80002010: 8b89 andi a5,a5,2
if(intr_get())
80002012: efb5 bnez a5,8000208e <sched+0xc6>
asm volatile("mv %0, tp" : "=r" (x) );
80002014: 8792 mv a5,tp
intena = mycpu()->intena;
80002016: 0000f917 auipc s2,0xf
8000201a: 28a90913 addi s2,s2,650 # 800112a0 <pid_lock>
8000201e: 2781 sext.w a5,a5
80002020: 079e slli a5,a5,0x7
80002022: 97ca add a5,a5,s2
80002024: 0ac7a983 lw s3,172(a5)
80002028: 8792 mv a5,tp
swtch(&p->context, &mycpu()->context);
8000202a: 2781 sext.w a5,a5
8000202c: 079e slli a5,a5,0x7
8000202e: 0000f597 auipc a1,0xf
80002032: 2aa58593 addi a1,a1,682 # 800112d8 <cpus+0x8>
80002036: 95be add a1,a1,a5
80002038: 09848513 addi a0,s1,152
8000203c: 00001097 auipc ra,0x1
80002040: 87c080e7 jalr -1924(ra) # 800028b8 <swtch>
80002044: 8792 mv a5,tp
mycpu()->intena = intena;
80002046: 2781 sext.w a5,a5
80002048: 079e slli a5,a5,0x7
8000204a: 97ca add a5,a5,s2
8000204c: 0b37a623 sw s3,172(a5)
}
80002050: 70a2 ld ra,40(sp)
80002052: 7402 ld s0,32(sp)
80002054: 64e2 ld s1,24(sp)
80002056: 6942 ld s2,16(sp)
80002058: 69a2 ld s3,8(sp)
8000205a: 6145 addi sp,sp,48
8000205c: 8082 ret
panic("sched p->lock");
8000205e: 00006517 auipc a0,0x6
80002062: 1a250513 addi a0,a0,418 # 80008200 <digits+0x1c0>
80002066: ffffe097 auipc ra,0xffffe
8000206a: 4c4080e7 jalr 1220(ra) # 8000052a <panic>
panic("sched locks");
8000206e: 00006517 auipc a0,0x6
80002072: 1a250513 addi a0,a0,418 # 80008210 <digits+0x1d0>
80002076: ffffe097 auipc ra,0xffffe
8000207a: 4b4080e7 jalr 1204(ra) # 8000052a <panic>
panic("sched running");
8000207e: 00006517 auipc a0,0x6
80002082: 1a250513 addi a0,a0,418 # 80008220 <digits+0x1e0>
80002086: ffffe097 auipc ra,0xffffe
8000208a: 4a4080e7 jalr 1188(ra) # 8000052a <panic>
panic("sched interruptible");
8000208e: 00006517 auipc a0,0x6
80002092: 1a250513 addi a0,a0,418 # 80008230 <digits+0x1f0>
80002096: ffffe097 auipc ra,0xffffe
8000209a: 494080e7 jalr 1172(ra) # 8000052a <panic>
000000008000209e <yield>:
{
8000209e: 1101 addi sp,sp,-32
800020a0: ec06 sd ra,24(sp)
800020a2: e822 sd s0,16(sp)
800020a4: e426 sd s1,8(sp)
800020a6: 1000 addi s0,sp,32
struct proc *p = myproc();
800020a8: 00000097 auipc ra,0x0
800020ac: 8d6080e7 jalr -1834(ra) # 8000197e <myproc>
800020b0: 84aa mv s1,a0
acquire(&p->lock);
800020b2: fffff097 auipc ra,0xfffff
800020b6: b10080e7 jalr -1264(ra) # 80000bc2 <acquire>
p->state = RUNNABLE;
800020ba: 478d li a5,3
800020bc: cc9c sw a5,24(s1)
p->readyTime = ticks;
800020be: 00007717 auipc a4,0x7
800020c2: f7272703 lw a4,-142(a4) # 80009030 <ticks>
800020c6: 02071793 slli a5,a4,0x20
800020ca: 9381 srli a5,a5,0x20
800020cc: ecbc sd a5,88(s1)
p->rutime += ticks - p->runningTime;
800020ce: 48bc lw a5,80(s1)
800020d0: 9fb9 addw a5,a5,a4
800020d2: 70b8 ld a4,96(s1)
800020d4: 9f99 subw a5,a5,a4
800020d6: c8bc sw a5,80(s1)
sched();
800020d8: 00000097 auipc ra,0x0
800020dc: ef0080e7 jalr -272(ra) # 80001fc8 <sched>
release(&p->lock);
800020e0: 8526 mv a0,s1
800020e2: fffff097 auipc ra,0xfffff
800020e6: b94080e7 jalr -1132(ra) # 80000c76 <release>
}
800020ea: 60e2 ld ra,24(sp)
800020ec: 6442 ld s0,16(sp)
800020ee: 64a2 ld s1,8(sp)
800020f0: 6105 addi sp,sp,32
800020f2: 8082 ret
00000000800020f4 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
800020f4: 7179 addi sp,sp,-48
800020f6: f406 sd ra,40(sp)
800020f8: f022 sd s0,32(sp)
800020fa: ec26 sd s1,24(sp)
800020fc: e84a sd s2,16(sp)
800020fe: e44e sd s3,8(sp)
80002100: 1800 addi s0,sp,48
80002102: 89aa mv s3,a0
80002104: 892e mv s2,a1
struct proc *p = myproc();
80002106: 00000097 auipc ra,0x0
8000210a: 878080e7 jalr -1928(ra) # 8000197e <myproc>
8000210e: 84aa mv s1,a0
// Once we hold p->lock, we can be
// guaranteed that we won't miss any wakeup
// (wakeup locks p->lock),
// so it's okay to release lk.
acquire(&p->lock); //DOC: sleeplock1
80002110: fffff097 auipc ra,0xfffff
80002114: ab2080e7 jalr -1358(ra) # 80000bc2 <acquire>
release(lk);
80002118: 854a mv a0,s2
8000211a: fffff097 auipc ra,0xfffff
8000211e: b5c080e7 jalr -1188(ra) # 80000c76 <release>
// Go to sleep.
p->chan = chan;
80002122: 0334b023 sd s3,32(s1)
p->rutime += ticks - p->runningTime;
80002126: 48bc lw a5,80(s1)
80002128: 00007717 auipc a4,0x7
8000212c: f0872703 lw a4,-248(a4) # 80009030 <ticks>
80002130: 9fb9 addw a5,a5,a4
80002132: 70b8 ld a4,96(s1)
80002134: 9f99 subw a5,a5,a4
80002136: c8bc sw a5,80(s1)
p->state = SLEEPING;
80002138: 4789 li a5,2
8000213a: cc9c sw a5,24(s1)
sched();
8000213c: 00000097 auipc ra,0x0
80002140: e8c080e7 jalr -372(ra) # 80001fc8 <sched>
// Tidy up.
p->chan = 0;
80002144: 0204b023 sd zero,32(s1)
// Reacquire original lock.
release(&p->lock);
80002148: 8526 mv a0,s1
8000214a: fffff097 auipc ra,0xfffff
8000214e: b2c080e7 jalr -1236(ra) # 80000c76 <release>
acquire(lk);
80002152: 854a mv a0,s2
80002154: fffff097 auipc ra,0xfffff
80002158: a6e080e7 jalr -1426(ra) # 80000bc2 <acquire>
}
8000215c: 70a2 ld ra,40(sp)
8000215e: 7402 ld s0,32(sp)
80002160: 64e2 ld s1,24(sp)
80002162: 6942 ld s2,16(sp)
80002164: 69a2 ld s3,8(sp)
80002166: 6145 addi sp,sp,48
80002168: 8082 ret
000000008000216a <wait_extension>:
{
8000216a: 711d addi sp,sp,-96
8000216c: ec86 sd ra,88(sp)
8000216e: e8a2 sd s0,80(sp)
80002170: e4a6 sd s1,72(sp)
80002172: e0ca sd s2,64(sp)
80002174: fc4e sd s3,56(sp)
80002176: f852 sd s4,48(sp)
80002178: f456 sd s5,40(sp)
8000217a: f05a sd s6,32(sp)
8000217c: ec5e sd s7,24(sp)
8000217e: e862 sd s8,16(sp)
80002180: e466 sd s9,8(sp)
80002182: 1080 addi s0,sp,96
80002184: 8baa mv s7,a0
80002186: 8b2e mv s6,a1
struct proc *p = myproc();
80002188: fffff097 auipc ra,0xfffff
8000218c: 7f6080e7 jalr 2038(ra) # 8000197e <myproc>
80002190: 892a mv s2,a0
acquire(&wait_lock);
80002192: 0000f517 auipc a0,0xf
80002196: 12650513 addi a0,a0,294 # 800112b8 <wait_lock>
8000219a: fffff097 auipc ra,0xfffff
8000219e: a28080e7 jalr -1496(ra) # 80000bc2 <acquire>
havekids = 0;
800021a2: 4c01 li s8,0
if(np->state == ZOMBIE){
800021a4: 4a15 li s4,5
havekids = 1;
800021a6: 4a85 li s5,1
for(np = proc; np < &proc[NPROC]; np++){
800021a8: 00016997 auipc s3,0x16
800021ac: d2898993 addi s3,s3,-728 # 80017ed0 <tickslock>
sleep(p, &wait_lock); //DOC: wait-sleep
800021b0: 0000fc97 auipc s9,0xf
800021b4: 108c8c93 addi s9,s9,264 # 800112b8 <wait_lock>
havekids = 0;
800021b8: 8762 mv a4,s8
for(np = proc; np < &proc[NPROC]; np++){
800021ba: 0000f497 auipc s1,0xf
800021be: 51648493 addi s1,s1,1302 # 800116d0 <proc>
800021c2: a231 j 800022ce <wait_extension+0x164>
pid = np->pid;
800021c4: 0304a983 lw s3,48(s1)
if(addr != 0 && copyout(p->pagetable, addr, (char *)&np->xstate,
800021c8: 0c0b9463 bnez s7,80002290 <wait_extension+0x126>
if (performance){
800021cc: 080b0f63 beqz s6,8000226a <wait_extension+0x100>
copyout(p->pagetable, (uint64) performance, (char*)&np->ctime, sizeof(int))< 0 ||
800021d0: 4691 li a3,4
800021d2: 04048613 addi a2,s1,64
800021d6: 85da mv a1,s6
800021d8: 08893503 ld a0,136(s2)
800021dc: fffff097 auipc ra,0xfffff
800021e0: 462080e7 jalr 1122(ra) # 8000163e <copyout>
if(
800021e4: 14054963 bltz a0,80002336 <wait_extension+0x1cc>
copyout(p->pagetable, (uint64) performance+4, (char*)&np->ttime, sizeof(int))< 0 ||
800021e8: 4691 li a3,4
800021ea: 04448613 addi a2,s1,68
800021ee: 004b0593 addi a1,s6,4
800021f2: 08893503 ld a0,136(s2)
800021f6: fffff097 auipc ra,0xfffff
800021fa: 448080e7 jalr 1096(ra) # 8000163e <copyout>
copyout(p->pagetable, (uint64) performance, (char*)&np->ctime, sizeof(int))< 0 ||
800021fe: 12054e63 bltz a0,8000233a <wait_extension+0x1d0>
copyout(p->pagetable, (uint64) performance+8, (char*)&np->stime, sizeof(int))< 0 ||
80002202: 4691 li a3,4
80002204: 04848613 addi a2,s1,72
80002208: 008b0593 addi a1,s6,8
8000220c: 08893503 ld a0,136(s2)
80002210: fffff097 auipc ra,0xfffff
80002214: 42e080e7 jalr 1070(ra) # 8000163e <copyout>
copyout(p->pagetable, (uint64) performance+4, (char*)&np->ttime, sizeof(int))< 0 ||
80002218: 12054363 bltz a0,8000233e <wait_extension+0x1d4>
copyout(p->pagetable, (uint64) performance+12, (char*)&np->retime, sizeof(int))< 0 ||
8000221c: 4691 li a3,4
8000221e: 04c48613 addi a2,s1,76
80002222: 00cb0593 addi a1,s6,12
80002226: 08893503 ld a0,136(s2)
8000222a: fffff097 auipc ra,0xfffff
8000222e: 414080e7 jalr 1044(ra) # 8000163e <copyout>
copyout(p->pagetable, (uint64) performance+8, (char*)&np->stime, sizeof(int))< 0 ||
80002232: 10054863 bltz a0,80002342 <wait_extension+0x1d8>
copyout(p->pagetable, (uint64) performance+16, (char*)&np->rutime, sizeof(int))< 0 ||
80002236: 4691 li a3,4
80002238: 05048613 addi a2,s1,80
8000223c: 010b0593 addi a1,s6,16
80002240: 08893503 ld a0,136(s2)
80002244: fffff097 auipc ra,0xfffff
80002248: 3fa080e7 jalr 1018(ra) # 8000163e <copyout>
copyout(p->pagetable, (uint64) performance+12, (char*)&np->retime, sizeof(int))< 0 ||
8000224c: 0e054d63 bltz a0,80002346 <wait_extension+0x1dc>
copyout(p->pagetable, (uint64) performance+20, (char*)&np->average_bursttime, sizeof(int))< 0
80002250: 4691 li a3,4
80002252: 05448613 addi a2,s1,84
80002256: 014b0593 addi a1,s6,20
8000225a: 08893503 ld a0,136(s2)
8000225e: fffff097 auipc ra,0xfffff
80002262: 3e0080e7 jalr 992(ra) # 8000163e <copyout>
copyout(p->pagetable, (uint64) performance+16, (char*)&np->rutime, sizeof(int))< 0 ||
80002266: 0e054263 bltz a0,8000234a <wait_extension+0x1e0>
freeproc(np);
8000226a: 8526 mv a0,s1
8000226c: 00000097 auipc ra,0x0
80002270: 8c4080e7 jalr -1852(ra) # 80001b30 <freeproc>
release(&np->lock);
80002274: 8526 mv a0,s1
80002276: fffff097 auipc ra,0xfffff
8000227a: a00080e7 jalr -1536(ra) # 80000c76 <release>
release(&wait_lock);
8000227e: 0000f517 auipc a0,0xf
80002282: 03a50513 addi a0,a0,58 # 800112b8 <wait_lock>
80002286: fffff097 auipc ra,0xfffff
8000228a: 9f0080e7 jalr -1552(ra) # 80000c76 <release>
return pid;
8000228e: a8bd j 8000230c <wait_extension+0x1a2>
if(addr != 0 && copyout(p->pagetable, addr, (char *)&np->xstate,
80002290: 4691 li a3,4
80002292: 02c48613 addi a2,s1,44
80002296: 85de mv a1,s7
80002298: 08893503 ld a0,136(s2)
8000229c: fffff097 auipc ra,0xfffff
800022a0: 3a2080e7 jalr 930(ra) # 8000163e <copyout>
800022a4: f20554e3 bgez a0,800021cc <wait_extension+0x62>
release(&np->lock);
800022a8: 8526 mv a0,s1
800022aa: fffff097 auipc ra,0xfffff
800022ae: 9cc080e7 jalr -1588(ra) # 80000c76 <release>
release(&wait_lock);
800022b2: 0000f517 auipc a0,0xf
800022b6: 00650513 addi a0,a0,6 # 800112b8 <wait_lock>
800022ba: fffff097 auipc ra,0xfffff
800022be: 9bc080e7 jalr -1604(ra) # 80000c76 <release>
return -1;
800022c2: 59fd li s3,-1
800022c4: a0a1 j 8000230c <wait_extension+0x1a2>
for(np = proc; np < &proc[NPROC]; np++){
800022c6: 1a048493 addi s1,s1,416
800022ca: 03348463 beq s1,s3,800022f2 <wait_extension+0x188>
if(np->parent == p){
800022ce: 78bc ld a5,112(s1)
800022d0: ff279be3 bne a5,s2,800022c6 <wait_extension+0x15c>
acquire(&np->lock);
800022d4: 8526 mv a0,s1
800022d6: fffff097 auipc ra,0xfffff
800022da: 8ec080e7 jalr -1812(ra) # 80000bc2 <acquire>
if(np->state == ZOMBIE){
800022de: 4c9c lw a5,24(s1)
800022e0: ef4782e3 beq a5,s4,800021c4 <wait_extension+0x5a>
release(&np->lock);
800022e4: 8526 mv a0,s1
800022e6: fffff097 auipc ra,0xfffff
800022ea: 990080e7 jalr -1648(ra) # 80000c76 <release>
havekids = 1;
800022ee: 8756 mv a4,s5
800022f0: bfd9 j 800022c6 <wait_extension+0x15c>
if(!havekids || p->killed){
800022f2: c701 beqz a4,800022fa <wait_extension+0x190>
800022f4: 02892783 lw a5,40(s2)
800022f8: cb85 beqz a5,80002328 <wait_extension+0x1be>
release(&wait_lock);
800022fa: 0000f517 auipc a0,0xf
800022fe: fbe50513 addi a0,a0,-66 # 800112b8 <wait_lock>
80002302: fffff097 auipc ra,0xfffff
80002306: 974080e7 jalr -1676(ra) # 80000c76 <release>
return -1;
8000230a: 59fd li s3,-1
}
8000230c: 854e mv a0,s3
8000230e: 60e6 ld ra,88(sp)
80002310: 6446 ld s0,80(sp)
80002312: 64a6 ld s1,72(sp)
80002314: 6906 ld s2,64(sp)
80002316: 79e2 ld s3,56(sp)
80002318: 7a42 ld s4,48(sp)
8000231a: 7aa2 ld s5,40(sp)
8000231c: 7b02 ld s6,32(sp)
8000231e: 6be2 ld s7,24(sp)
80002320: 6c42 ld s8,16(sp)
80002322: 6ca2 ld s9,8(sp)
80002324: 6125 addi sp,sp,96
80002326: 8082 ret
sleep(p, &wait_lock); //DOC: wait-sleep
80002328: 85e6 mv a1,s9
8000232a: 854a mv a0,s2
8000232c: 00000097 auipc ra,0x0
80002330: dc8080e7 jalr -568(ra) # 800020f4 <sleep>
havekids = 0;
80002334: b551 j 800021b8 <wait_extension+0x4e>
return -1;
80002336: 59fd li s3,-1
80002338: bfd1 j 8000230c <wait_extension+0x1a2>
8000233a: 59fd li s3,-1
8000233c: bfc1 j 8000230c <wait_extension+0x1a2>
8000233e: 59fd li s3,-1
80002340: b7f1 j 8000230c <wait_extension+0x1a2>
80002342: 59fd li s3,-1
80002344: b7e1 j 8000230c <wait_extension+0x1a2>
80002346: 59fd li s3,-1
80002348: b7d1 j 8000230c <wait_extension+0x1a2>
8000234a: 59fd li s3,-1
8000234c: b7c1 j 8000230c <wait_extension+0x1a2>
000000008000234e <wait>:
{
8000234e: 1141 addi sp,sp,-16
80002350: e406 sd ra,8(sp)
80002352: e022 sd s0,0(sp)
80002354: 0800 addi s0,sp,16
return wait_extension (addr, 0);
80002356: 4581 li a1,0
80002358: 00000097 auipc ra,0x0
8000235c: e12080e7 jalr -494(ra) # 8000216a <wait_extension>
}
80002360: 60a2 ld ra,8(sp)
80002362: 6402 ld s0,0(sp)
80002364: 0141 addi sp,sp,16
80002366: 8082 ret
0000000080002368 <wakeup>:
// Wake up all processes sleeping on chan.
// Must be called without any p->lock.
void
wakeup(void *chan)
{
80002368: 7139 addi sp,sp,-64
8000236a: fc06 sd ra,56(sp)
8000236c: f822 sd s0,48(sp)
8000236e: f426 sd s1,40(sp)
80002370: f04a sd s2,32(sp)
80002372: ec4e sd s3,24(sp)
80002374: e852 sd s4,16(sp)
80002376: e456 sd s5,8(sp)
80002378: e05a sd s6,0(sp)
8000237a: 0080 addi s0,sp,64
8000237c: 8a2a mv s4,a0
struct proc *p;
for(p = proc; p < &proc[NPROC]; p++) {
8000237e: 0000f497 auipc s1,0xf
80002382: 35248493 addi s1,s1,850 # 800116d0 <proc>
if(p != myproc()){
acquire(&p->lock);
if(p->state == SLEEPING && p->chan == chan) {
80002386: 4989 li s3,2
p->state = RUNNABLE;
80002388: 4b0d li s6,3
p->stime += ticks - p->sleepTime;
8000238a: 00007a97 auipc s5,0x7
8000238e: ca6a8a93 addi s5,s5,-858 # 80009030 <ticks>
for(p = proc; p < &proc[NPROC]; p++) {
80002392: 00016917 auipc s2,0x16
80002396: b3e90913 addi s2,s2,-1218 # 80017ed0 <tickslock>
8000239a: a811 j 800023ae <wakeup+0x46>
p->readyTime = ticks;
}
release(&p->lock);
8000239c: 8526 mv a0,s1
8000239e: fffff097 auipc ra,0xfffff
800023a2: 8d8080e7 jalr -1832(ra) # 80000c76 <release>
for(p = proc; p < &proc[NPROC]; p++) {
800023a6: 1a048493 addi s1,s1,416
800023aa: 05248063 beq s1,s2,800023ea <wakeup+0x82>
if(p != myproc()){
800023ae: fffff097 auipc ra,0xfffff
800023b2: 5d0080e7 jalr 1488(ra) # 8000197e <myproc>
800023b6: fea488e3 beq s1,a0,800023a6 <wakeup+0x3e>
acquire(&p->lock);
800023ba: 8526 mv a0,s1
800023bc: fffff097 auipc ra,0xfffff
800023c0: 806080e7 jalr -2042(ra) # 80000bc2 <acquire>
if(p->state == SLEEPING && p->chan == chan) {
800023c4: 4c9c lw a5,24(s1)
800023c6: fd379be3 bne a5,s3,8000239c <wakeup+0x34>
800023ca: 709c ld a5,32(s1)
800023cc: fd4798e3 bne a5,s4,8000239c <wakeup+0x34>
p->state = RUNNABLE;
800023d0: 0164ac23 sw s6,24(s1)
p->stime += ticks - p->sleepTime;
800023d4: 000aa703 lw a4,0(s5)
800023d8: 44bc lw a5,72(s1)
800023da: 9fb9 addw a5,a5,a4
800023dc: 74b4 ld a3,104(s1)
800023de: 9f95 subw a5,a5,a3
800023e0: c4bc sw a5,72(s1)
p->readyTime = ticks;
800023e2: 1702 slli a4,a4,0x20
800023e4: 9301 srli a4,a4,0x20
800023e6: ecb8 sd a4,88(s1)
800023e8: bf55 j 8000239c <wakeup+0x34>
}
}
}
800023ea: 70e2 ld ra,56(sp)
800023ec: 7442 ld s0,48(sp)
800023ee: 74a2 ld s1,40(sp)
800023f0: 7902 ld s2,32(sp)
800023f2: 69e2 ld s3,24(sp)
800023f4: 6a42 ld s4,16(sp)
800023f6: 6aa2 ld s5,8(sp)
800023f8: 6b02 ld s6,0(sp)
800023fa: 6121 addi sp,sp,64
800023fc: 8082 ret
00000000800023fe <reparent>:
{
800023fe: 7179 addi sp,sp,-48
80002400: f406 sd ra,40(sp)
80002402: f022 sd s0,32(sp)
80002404: ec26 sd s1,24(sp)
80002406: e84a sd s2,16(sp)
80002408: e44e sd s3,8(sp)
8000240a: e052 sd s4,0(sp)
8000240c: 1800 addi s0,sp,48
8000240e: 892a mv s2,a0
for(pp = proc; pp < &proc[NPROC]; pp++){
80002410: 0000f497 auipc s1,0xf
80002414: 2c048493 addi s1,s1,704 # 800116d0 <proc>
pp->parent = initproc;
80002418: 00007a17 auipc s4,0x7
8000241c: c10a0a13 addi s4,s4,-1008 # 80009028 <initproc>
for(pp = proc; pp < &proc[NPROC]; pp++){
80002420: 00016997 auipc s3,0x16
80002424: ab098993 addi s3,s3,-1360 # 80017ed0 <tickslock>
80002428: a029 j 80002432 <reparent+0x34>
8000242a: 1a048493 addi s1,s1,416
8000242e: 01348d63 beq s1,s3,80002448 <reparent+0x4a>
if(pp->parent == p){
80002432: 78bc ld a5,112(s1)
80002434: ff279be3 bne a5,s2,8000242a <reparent+0x2c>
pp->parent = initproc;
80002438: 000a3503 ld a0,0(s4)
8000243c: f8a8 sd a0,112(s1)
wakeup(initproc);
8000243e: 00000097 auipc ra,0x0
80002442: f2a080e7 jalr -214(ra) # 80002368 <wakeup>
80002446: b7d5 j 8000242a <reparent+0x2c>
}
80002448: 70a2 ld ra,40(sp)
8000244a: 7402 ld s0,32(sp)
8000244c: 64e2 ld s1,24(sp)
8000244e: 6942 ld s2,16(sp)
80002450: 69a2 ld s3,8(sp)
80002452: 6a02 ld s4,0(sp)
80002454: 6145 addi sp,sp,48
80002456: 8082 ret
0000000080002458 <exit>:
{
80002458: 7179 addi sp,sp,-48
8000245a: f406 sd ra,40(sp)
8000245c: f022 sd s0,32(sp)
8000245e: ec26 sd s1,24(sp)
80002460: e84a sd s2,16(sp)
80002462: e44e sd s3,8(sp)
80002464: e052 sd s4,0(sp)
80002466: 1800 addi s0,sp,48
80002468: 8a2a mv s4,a0
struct proc *p = myproc();
8000246a: fffff097 auipc ra,0xfffff
8000246e: 514080e7 jalr 1300(ra) # 8000197e <myproc>
80002472: 892a mv s2,a0
p->ttime = ticks;
80002474: 00007797 auipc a5,0x7
80002478: bbc7a783 lw a5,-1092(a5) # 80009030 <ticks>
8000247c: c17c sw a5,68(a0)
if(p == initproc)
8000247e: 00007797 auipc a5,0x7
80002482: baa7b783 ld a5,-1110(a5) # 80009028 <initproc>
80002486: 10850493 addi s1,a0,264
8000248a: 18850993 addi s3,a0,392
8000248e: 02a79363 bne a5,a0,800024b4 <exit+0x5c>
panic("init exiting");
80002492: 00006517 auipc a0,0x6
80002496: db650513 addi a0,a0,-586 # 80008248 <digits+0x208>
8000249a: ffffe097 auipc ra,0xffffe
8000249e: 090080e7 jalr 144(ra) # 8000052a <panic>
fileclose(f);
800024a2: 00002097 auipc ra,0x2
800024a6: 4ba080e7 jalr 1210(ra) # 8000495c <fileclose>
p->ofile[fd] = 0;
800024aa: 0004b023 sd zero,0(s1)
for(int fd = 0; fd < NOFILE; fd++){
800024ae: 04a1 addi s1,s1,8
800024b0: 01348563 beq s1,s3,800024ba <exit+0x62>
if(p->ofile[fd]){
800024b4: 6088 ld a0,0(s1)
800024b6: f575 bnez a0,800024a2 <exit+0x4a>
800024b8: bfdd j 800024ae <exit+0x56>
begin_op();
800024ba: 00002097 auipc ra,0x2
800024be: fd6080e7 jalr -42(ra) # 80004490 <begin_op>
iput(p->cwd);
800024c2: 18893503 ld a0,392(s2)
800024c6: 00001097 auipc ra,0x1
800024ca: 7ae080e7 jalr 1966(ra) # 80003c74 <iput>
end_op();
800024ce: 00002097 auipc ra,0x2
800024d2: 042080e7 jalr 66(ra) # 80004510 <end_op>
p->cwd = 0;
800024d6: 18093423 sd zero,392(s2)
acquire(&wait_lock);
800024da: 0000f517 auipc a0,0xf
800024de: dde50513 addi a0,a0,-546 # 800112b8 <wait_lock>
800024e2: ffffe097 auipc ra,0xffffe
800024e6: 6e0080e7 jalr 1760(ra) # 80000bc2 <acquire>
reparent(p);
800024ea: 854a mv a0,s2
800024ec: 00000097 auipc ra,0x0
800024f0: f12080e7 jalr -238(ra) # 800023fe <reparent>
wakeup(p->parent);
800024f4: 07093503 ld a0,112(s2)
800024f8: 00000097 auipc ra,0x0
800024fc: e70080e7 jalr -400(ra) # 80002368 <wakeup>
acquire(&p->lock);
80002500: 854a mv a0,s2
80002502: ffffe097 auipc ra,0xffffe
80002506: 6c0080e7 jalr 1728(ra) # 80000bc2 <acquire>
p->xstate = status;
8000250a: 03492623 sw s4,44(s2)
if(p->state == RUNNING)
8000250e: 01892703 lw a4,24(s2)
80002512: 4791 li a5,4
80002514: 02f70963 beq a4,a5,80002546 <exit+0xee>
p->state = ZOMBIE;
80002518: 4795 li a5,5
8000251a: 00f92c23 sw a5,24(s2)
release(&wait_lock);
8000251e: 0000f517 auipc a0,0xf
80002522: d9a50513 addi a0,a0,-614 # 800112b8 <wait_lock>
80002526: ffffe097 auipc ra,0xffffe
8000252a: 750080e7 jalr 1872(ra) # 80000c76 <release>
sched();
8000252e: 00000097 auipc ra,0x0
80002532: a9a080e7 jalr -1382(ra) # 80001fc8 <sched>
panic("zombie exit");
80002536: 00006517 auipc a0,0x6
8000253a: d2250513 addi a0,a0,-734 # 80008258 <digits+0x218>
8000253e: ffffe097 auipc ra,0xffffe
80002542: fec080e7 jalr -20(ra) # 8000052a <panic>
p->rutime += ticks - p->runningTime;
80002546: 05092783 lw a5,80(s2)
8000254a: 00007717 auipc a4,0x7
8000254e: ae672703 lw a4,-1306(a4) # 80009030 <ticks>
80002552: 9fb9 addw a5,a5,a4
80002554: 06093703 ld a4,96(s2)
80002558: 9f99 subw a5,a5,a4
8000255a: 04f92823 sw a5,80(s2)
8000255e: bf6d j 80002518 <exit+0xc0>
0000000080002560 <set_priority>:
int
set_priority(int prio)
{
if(prio != TEST_HIGH_PRIORITY && prio != HIGH_PRIORITY && prio != NORMAL_PRIORITY
80002560: 47e5 li a5,25
80002562: 04a7e963 bltu a5,a0,800025b4 <set_priority+0x54>
{
80002566: 1101 addi sp,sp,-32
80002568: ec06 sd ra,24(sp)
8000256a: e822 sd s0,16(sp)
8000256c: e426 sd s1,8(sp)
8000256e: e04a sd s2,0(sp)
80002570: 1000 addi s0,sp,32
80002572: 892a mv s2,a0
if(prio != TEST_HIGH_PRIORITY && prio != HIGH_PRIORITY && prio != NORMAL_PRIORITY
80002574: 020007b7 lui a5,0x2000
80002578: 0aa78793 addi a5,a5,170 # 20000aa <_entry-0x7dffff56>
8000257c: 00a7d7b3 srl a5,a5,a0
80002580: 8b85 andi a5,a5,1
&& prio != LOW_PRIORITY && prio != TEST_LOW_PRIORITY){
return -1;
80002582: 557d li a0,-1
if(prio != TEST_HIGH_PRIORITY && prio != HIGH_PRIORITY && prio != NORMAL_PRIORITY
80002584: c395 beqz a5,800025a8 <set_priority+0x48>
}
struct proc *p = myproc();
80002586: fffff097 auipc ra,0xfffff
8000258a: 3f8080e7 jalr 1016(ra) # 8000197e <myproc>
8000258e: 84aa mv s1,a0
acquire(&p->lock);
80002590: ffffe097 auipc ra,0xffffe
80002594: 632080e7 jalr 1586(ra) # 80000bc2 <acquire>
p->priority = prio;
80002598: 0324ae23 sw s2,60(s1)
release(&p->lock);
8000259c: 8526 mv a0,s1
8000259e: ffffe097 auipc ra,0xffffe
800025a2: 6d8080e7 jalr 1752(ra) # 80000c76 <release>
return 0;
800025a6: 4501 li a0,0
}
800025a8: 60e2 ld ra,24(sp)
800025aa: 6442 ld s0,16(sp)
800025ac: 64a2 ld s1,8(sp)
800025ae: 6902 ld s2,0(sp)
800025b0: 6105 addi sp,sp,32
800025b2: 8082 ret
return -1;
800025b4: 557d li a0,-1
}
800025b6: 8082 ret
00000000800025b8 <trace>:
int
trace(int mask_input, int pid)
{
800025b8: 7179 addi sp,sp,-48
800025ba: f406 sd ra,40(sp)
800025bc: f022 sd s0,32(sp)
800025be: ec26 sd s1,24(sp)
800025c0: e84a sd s2,16(sp)
800025c2: e44e sd s3,8(sp)
800025c4: e052 sd s4,0(sp)
800025c6: 1800 addi s0,sp,48
800025c8: 8a2a mv s4,a0
800025ca: 892e mv s2,a1
struct proc *p;
for(p = proc; p < &proc[NPROC]; p++){
800025cc: 0000f497 auipc s1,0xf
800025d0: 10448493 addi s1,s1,260 # 800116d0 <proc>
800025d4: 00016997 auipc s3,0x16
800025d8: 8fc98993 addi s3,s3,-1796 # 80017ed0 <tickslock>
800025dc: a811 j 800025f0 <trace+0x38>
acquire(&p->lock);
if(p->pid == pid)
p->mask = mask_input;
release(&p->lock);
800025de: 8526 mv a0,s1
800025e0: ffffe097 auipc ra,0xffffe
800025e4: 696080e7 jalr 1686(ra) # 80000c76 <release>
for(p = proc; p < &proc[NPROC]; p++){
800025e8: 1a048493 addi s1,s1,416
800025ec: 01348d63 beq s1,s3,80002606 <trace+0x4e>
acquire(&p->lock);
800025f0: 8526 mv a0,s1
800025f2: ffffe097 auipc ra,0xffffe
800025f6: 5d0080e7 jalr 1488(ra) # 80000bc2 <acquire>
if(p->pid == pid)
800025fa: 589c lw a5,48(s1)
800025fc: ff2791e3 bne a5,s2,800025de <trace+0x26>
p->mask = mask_input;
80002600: 0344aa23 sw s4,52(s1)
80002604: bfe9 j 800025de <trace+0x26>
}
return 0;
}
80002606: 4501 li a0,0
80002608: 70a2 ld ra,40(sp)
8000260a: 7402 ld s0,32(sp)
8000260c: 64e2 ld s1,24(sp)
8000260e: 6942 ld s2,16(sp)
80002610: 69a2 ld s3,8(sp)
80002612: 6a02 ld s4,0(sp)
80002614: 6145 addi sp,sp,48
80002616: 8082 ret
0000000080002618 <kill>:
// Kill the process with the given pid.
// The victim won't exit until it tries to return
// to user space (see usertrap() in trap.c).
int
kill(int pid)
{
80002618: 7179 addi sp,sp,-48
8000261a: f406 sd ra,40(sp)
8000261c: f022 sd s0,32(sp)
8000261e: ec26 sd s1,24(sp)
80002620: e84a sd s2,16(sp)
80002622: e44e sd s3,8(sp)
80002624: 1800 addi s0,sp,48
80002626: 892a mv s2,a0
struct proc *p;
for(p = proc; p < &proc[NPROC]; p++){
80002628: 0000f497 auipc s1,0xf
8000262c: 0a848493 addi s1,s1,168 # 800116d0 <proc>
80002630: 00016997 auipc s3,0x16
80002634: 8a098993 addi s3,s3,-1888 # 80017ed0 <tickslock>
acquire(&p->lock);
80002638: 8526 mv a0,s1
8000263a: ffffe097 auipc ra,0xffffe
8000263e: 588080e7 jalr 1416(ra) # 80000bc2 <acquire>
if(p->pid == pid){
80002642: 589c lw a5,48(s1)
80002644: 01278d63 beq a5,s2,8000265e <kill+0x46>
p->readyTime = ticks;
}
release(&p->lock);
return 0;
}
release(&p->lock);
80002648: 8526 mv a0,s1
8000264a: ffffe097 auipc ra,0xffffe
8000264e: 62c080e7 jalr 1580(ra) # 80000c76 <release>
for(p = proc; p < &proc[NPROC]; p++){
80002652: 1a048493 addi s1,s1,416
80002656: ff3491e3 bne s1,s3,80002638 <kill+0x20>
}
return -1;
8000265a: 557d li a0,-1
8000265c: a829 j 80002676 <kill+0x5e>
p->killed = 1;
8000265e: 4785 li a5,1
80002660: d49c sw a5,40(s1)
if(p->state == SLEEPING){
80002662: 4c98 lw a4,24(s1)
80002664: 4789 li a5,2
80002666: 00f70f63 beq a4,a5,80002684 <kill+0x6c>
release(&p->lock);
8000266a: 8526 mv a0,s1
8000266c: ffffe097 auipc ra,0xffffe
80002670: 60a080e7 jalr 1546(ra) # 80000c76 <release>
return 0;
80002674: 4501 li a0,0
}
80002676: 70a2 ld ra,40(sp)
80002678: 7402 ld s0,32(sp)
8000267a: 64e2 ld s1,24(sp)
8000267c: 6942 ld s2,16(sp)
8000267e: 69a2 ld s3,8(sp)
80002680: 6145 addi sp,sp,48
80002682: 8082 ret
p->state = RUNNABLE;
80002684: 478d li a5,3
80002686: cc9c sw a5,24(s1)
p->stime += ticks - p->sleepTime;
80002688: 00007717 auipc a4,0x7
8000268c: 9a872703 lw a4,-1624(a4) # 80009030 <ticks>
80002690: 44bc lw a5,72(s1)
80002692: 9fb9 addw a5,a5,a4
80002694: 74b4 ld a3,104(s1)
80002696: 9f95 subw a5,a5,a3
80002698: c4bc sw a5,72(s1)
p->readyTime = ticks;
8000269a: 1702 slli a4,a4,0x20
8000269c: 9301 srli a4,a4,0x20
8000269e: ecb8 sd a4,88(s1)
800026a0: b7e9 j 8000266a <kill+0x52>
00000000800026a2 <either_copyout>:
// Copy to either a user address, or kernel address,
// depending on usr_dst.
// Returns 0 on success, -1 on error.
int
either_copyout(int user_dst, uint64 dst, void *src, uint64 len)
{
800026a2: 7179 addi sp,sp,-48
800026a4: f406 sd ra,40(sp)
800026a6: f022 sd s0,32(sp)
800026a8: ec26 sd s1,24(sp)
800026aa: e84a sd s2,16(sp)
800026ac: e44e sd s3,8(sp)
800026ae: e052 sd s4,0(sp)
800026b0: 1800 addi s0,sp,48
800026b2: 84aa mv s1,a0
800026b4: 892e mv s2,a1
800026b6: 89b2 mv s3,a2
800026b8: 8a36 mv s4,a3
struct proc *p = myproc();
800026ba: fffff097 auipc ra,0xfffff
800026be: 2c4080e7 jalr 708(ra) # 8000197e <myproc>
if(user_dst){
800026c2: c08d beqz s1,800026e4 <either_copyout+0x42>
return copyout(p->pagetable, dst, src, len);
800026c4: 86d2 mv a3,s4
800026c6: 864e mv a2,s3
800026c8: 85ca mv a1,s2
800026ca: 6548 ld a0,136(a0)
800026cc: fffff097 auipc ra,0xfffff
800026d0: f72080e7 jalr -142(ra) # 8000163e <copyout>
} else {
memmove((char *)dst, src, len);
return 0;
}
}
800026d4: 70a2 ld ra,40(sp)
800026d6: 7402 ld s0,32(sp)
800026d8: 64e2 ld s1,24(sp)
800026da: 6942 ld s2,16(sp)
800026dc: 69a2 ld s3,8(sp)
800026de: 6a02 ld s4,0(sp)
800026e0: 6145 addi sp,sp,48
800026e2: 8082 ret
memmove((char *)dst, src, len);
800026e4: 000a061b sext.w a2,s4
800026e8: 85ce mv a1,s3
800026ea: 854a mv a0,s2
800026ec: ffffe097 auipc ra,0xffffe
800026f0: 62e080e7 jalr 1582(ra) # 80000d1a <memmove>
return 0;
800026f4: 8526 mv a0,s1
800026f6: bff9 j 800026d4 <either_copyout+0x32>
00000000800026f8 <either_copyin>:
// Copy from either a user address, or kernel address,
// depending on usr_src.
// Returns 0 on success, -1 on error.
int
either_copyin(void *dst, int user_src, uint64 src, uint64 len)
{
800026f8: 7179 addi sp,sp,-48
800026fa: f406 sd ra,40(sp)
800026fc: f022 sd s0,32(sp)
800026fe: ec26 sd s1,24(sp)
80002700: e84a sd s2,16(sp)
80002702: e44e sd s3,8(sp)
80002704: e052 sd s4,0(sp)
80002706: 1800 addi s0,sp,48
80002708: 892a mv s2,a0
8000270a: 84ae mv s1,a1
8000270c: 89b2 mv s3,a2
8000270e: 8a36 mv s4,a3
struct proc *p = myproc();
80002710: fffff097 auipc ra,0xfffff
80002714: 26e080e7 jalr 622(ra) # 8000197e <myproc>
if(user_src){
80002718: c08d beqz s1,8000273a <either_copyin+0x42>
return copyin(p->pagetable, dst, src, len);
8000271a: 86d2 mv a3,s4
8000271c: 864e mv a2,s3
8000271e: 85ca mv a1,s2
80002720: 6548 ld a0,136(a0)
80002722: fffff097 auipc ra,0xfffff
80002726: fa8080e7 jalr -88(ra) # 800016ca <copyin>
} else {
memmove(dst, (char*)src, len);
return 0;
}
}
8000272a: 70a2 ld ra,40(sp)
8000272c: 7402 ld s0,32(sp)
8000272e: 64e2 ld s1,24(sp)
80002730: 6942 ld s2,16(sp)
80002732: 69a2 ld s3,8(sp)
80002734: 6a02 ld s4,0(sp)
80002736: 6145 addi sp,sp,48
80002738: 8082 ret
memmove(dst, (char*)src, len);
8000273a: 000a061b sext.w a2,s4
8000273e: 85ce mv a1,s3
80002740: 854a mv a0,s2
80002742: ffffe097 auipc ra,0xffffe
80002746: 5d8080e7 jalr 1496(ra) # 80000d1a <memmove>
return 0;
8000274a: 8526 mv a0,s1
8000274c: bff9 j 8000272a <either_copyin+0x32>
000000008000274e <procdump>:
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
8000274e: 715d addi sp,sp,-80
80002750: e486 sd ra,72(sp)
80002752: e0a2 sd s0,64(sp)
80002754: fc26 sd s1,56(sp)
80002756: f84a sd s2,48(sp)
80002758: f44e sd s3,40(sp)
8000275a: f052 sd s4,32(sp)
8000275c: ec56 sd s5,24(sp)
8000275e: e85a sd s6,16(sp)
80002760: e45e sd s7,8(sp)
80002762: 0880 addi s0,sp,80
[ZOMBIE] "zombie"
};
struct proc *p;
char *state;
printf("\n");
80002764: 00006517 auipc a0,0x6
80002768: 96450513 addi a0,a0,-1692 # 800080c8 <digits+0x88>
8000276c: ffffe097 auipc ra,0xffffe
80002770: e08080e7 jalr -504(ra) # 80000574 <printf>
for(p = proc; p < &proc[NPROC]; p++){
80002774: 0000f497 auipc s1,0xf
80002778: 0ec48493 addi s1,s1,236 # 80011860 <proc+0x190>
8000277c: 00016917 auipc s2,0x16
80002780: 8e490913 addi s2,s2,-1820 # 80018060 <bcache+0x178>
if(p->state == UNUSED)
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80002784: 4b15 li s6,5
state = states[p->state];
else
state = "???";
80002786: 00006997 auipc s3,0x6
8000278a: ae298993 addi s3,s3,-1310 # 80008268 <digits+0x228>
printf("%d %s %s", p->pid, state, p->name);
8000278e: 00006a97 auipc s5,0x6
80002792: ae2a8a93 addi s5,s5,-1310 # 80008270 <digits+0x230>
printf("\n");
80002796: 00006a17 auipc s4,0x6
8000279a: 932a0a13 addi s4,s4,-1742 # 800080c8 <digits+0x88>
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
8000279e: 00006b97 auipc s7,0x6
800027a2: b0ab8b93 addi s7,s7,-1270 # 800082a8 <states.0>
800027a6: a00d j 800027c8 <procdump+0x7a>
printf("%d %s %s", p->pid, state, p->name);
800027a8: ea06a583 lw a1,-352(a3)
800027ac: 8556 mv a0,s5
800027ae: ffffe097 auipc ra,0xffffe
800027b2: dc6080e7 jalr -570(ra) # 80000574 <printf>
printf("\n");
800027b6: 8552 mv a0,s4
800027b8: ffffe097 auipc ra,0xffffe
800027bc: dbc080e7 jalr -580(ra) # 80000574 <printf>
for(p = proc; p < &proc[NPROC]; p++){
800027c0: 1a048493 addi s1,s1,416
800027c4: 03248263 beq s1,s2,800027e8 <procdump+0x9a>
if(p->state == UNUSED)
800027c8: 86a6 mv a3,s1
800027ca: e884a783 lw a5,-376(s1)
800027ce: dbed beqz a5,800027c0 <procdump+0x72>
state = "???";
800027d0: 864e mv a2,s3
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
800027d2: fcfb6be3 bltu s6,a5,800027a8 <procdump+0x5a>
800027d6: 02079713 slli a4,a5,0x20
800027da: 01d75793 srli a5,a4,0x1d
800027de: 97de add a5,a5,s7
800027e0: 6390 ld a2,0(a5)
800027e2: f279 bnez a2,800027a8 <procdump+0x5a>
state = "???";
800027e4: 864e mv a2,s3
800027e6: b7c9 j 800027a8 <procdump+0x5a>
}
}
800027e8: 60a6 ld ra,72(sp)
800027ea: 6406 ld s0,64(sp)
800027ec: 74e2 ld s1,56(sp)
800027ee: 7942 ld s2,48(sp)
800027f0: 79a2 ld s3,40(sp)
800027f2: 7a02 ld s4,32(sp)
800027f4: 6ae2 ld s5,24(sp)
800027f6: 6b42 ld s6,16(sp)
800027f8: 6ba2 ld s7,8(sp)
800027fa: 6161 addi sp,sp,80
800027fc: 8082 ret
00000000800027fe <wait_stat>:
int
wait_stat(int* status, struct perf* performance)
{
800027fe: 1141 addi sp,sp,-16
80002800: e406 sd ra,8(sp)
80002802: e022 sd s0,0(sp)
80002804: 0800 addi s0,sp,16
return wait_extension ((uint64)*status, performance);
80002806: 4108 lw a0,0(a0)
80002808: 00000097 auipc ra,0x0
8000280c: 962080e7 jalr -1694(ra) # 8000216a <wait_extension>
}
80002810: 60a2 ld ra,8(sp)
80002812: 6402 ld s0,0(sp)
80002814: 0141 addi sp,sp,16
80002816: 8082 ret
0000000080002818 <inctickcounter>:
int inctickcounter() {
80002818: 1101 addi sp,sp,-32
8000281a: ec06 sd ra,24(sp)
8000281c: e822 sd s0,16(sp)
8000281e: e426 sd s1,8(sp)
80002820: e04a sd s2,0(sp)
80002822: 1000 addi s0,sp,32
int res;
struct proc *p = myproc();
80002824: fffff097 auipc ra,0xfffff
80002828: 15a080e7 jalr 346(ra) # 8000197e <myproc>
8000282c: 84aa mv s1,a0
acquire(&p->lock);
8000282e: ffffe097 auipc ra,0xffffe
80002832: 394080e7 jalr 916(ra) # 80000bc2 <acquire>
res = proc->tickcounter;
80002836: 0000f917 auipc s2,0xf
8000283a: ed292903 lw s2,-302(s2) # 80011708 <proc+0x38>
res++;
release(&p->lock);
8000283e: 8526 mv a0,s1
80002840: ffffe097 auipc ra,0xffffe
80002844: 436080e7 jalr 1078(ra) # 80000c76 <release>
return res;
}
80002848: 0019051b addiw a0,s2,1
8000284c: 60e2 ld ra,24(sp)
8000284e: 6442 ld s0,16(sp)
80002850: 64a2 ld s1,8(sp)
80002852: 6902 ld s2,0(sp)
80002854: 6105 addi sp,sp,32
80002856: 8082 ret
0000000080002858 <switch_to_process>:
void switch_to_process(struct proc *p, struct cpu *c){
80002858: 1101 addi sp,sp,-32
8000285a: ec06 sd ra,24(sp)
8000285c: e822 sd s0,16(sp)
8000285e: e426 sd s1,8(sp)
80002860: 1000 addi s0,sp,32
80002862: 84ae mv s1,a1
// Switch to chosen process. It is the process's job
// to release its lock and then reacquire it
// before jumping back to us.
p->state = RUNNING;
80002864: 4791 li a5,4
80002866: cd1c sw a5,24(a0)
p->retime += ticks - p->readyTime;
80002868: 457c lw a5,76(a0)
8000286a: 00006717 auipc a4,0x6
8000286e: 7c672703 lw a4,1990(a4) # 80009030 <ticks>
80002872: 9fb9 addw a5,a5,a4
80002874: 6d38 ld a4,88(a0)
80002876: 9f99 subw a5,a5,a4
80002878: c57c sw a5,76(a0)
p->average_bursttime = (ALPHA * p->tickcounter) + (((100 - ALPHA) * p->average_bursttime) / 100);
8000287a: 5d18 lw a4,56(a0)
8000287c: 03200793 li a5,50
80002880: 02e787bb mulw a5,a5,a4
80002884: 4974 lw a3,84(a0)
80002886: 01f6d71b srliw a4,a3,0x1f
8000288a: 9f35 addw a4,a4,a3
8000288c: 4017571b sraiw a4,a4,0x1
80002890: 9fb9 addw a5,a5,a4
80002892: c97c sw a5,84(a0)
p->tickcounter = 0;
80002894: 02052c23 sw zero,56(a0)
c->proc = p;
80002898: e188 sd a0,0(a1)
swtch(&c->context, &p->context);
8000289a: 09850593 addi a1,a0,152
8000289e: 00848513 addi a0,s1,8
800028a2: 00000097 auipc ra,0x0
800028a6: 016080e7 jalr 22(ra) # 800028b8 <swtch>
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
800028aa: 0004b023 sd zero,0(s1)
}
800028ae: 60e2 ld ra,24(sp)
800028b0: 6442 ld s0,16(sp)
800028b2: 64a2 ld s1,8(sp)
800028b4: 6105 addi sp,sp,32
800028b6: 8082 ret
00000000800028b8 <swtch>:
800028b8: 00153023 sd ra,0(a0)
800028bc: 00253423 sd sp,8(a0)
800028c0: e900 sd s0,16(a0)
800028c2: ed04 sd s1,24(a0)
800028c4: 03253023 sd s2,32(a0)
800028c8: 03353423 sd s3,40(a0)
800028cc: 03453823 sd s4,48(a0)
800028d0: 03553c23 sd s5,56(a0)
800028d4: 05653023 sd s6,64(a0)
800028d8: 05753423 sd s7,72(a0)
800028dc: 05853823 sd s8,80(a0)
800028e0: 05953c23 sd s9,88(a0)
800028e4: 07a53023 sd s10,96(a0)
800028e8: 07b53423 sd s11,104(a0)
800028ec: 0005b083 ld ra,0(a1)
800028f0: 0085b103 ld sp,8(a1)
800028f4: 6980 ld s0,16(a1)
800028f6: 6d84 ld s1,24(a1)
800028f8: 0205b903 ld s2,32(a1)
800028fc: 0285b983 ld s3,40(a1)
80002900: 0305ba03 ld s4,48(a1)
80002904: 0385ba83 ld s5,56(a1)
80002908: 0405bb03 ld s6,64(a1)
8000290c: 0485bb83 ld s7,72(a1)
80002910: 0505bc03 ld s8,80(a1)
80002914: 0585bc83 ld s9,88(a1)
80002918: 0605bd03 ld s10,96(a1)
8000291c: 0685bd83 ld s11,104(a1)
80002920: 8082 ret
0000000080002922 <trapinit>:
extern int devintr();
void
trapinit(void)
{
80002922: 1141 addi sp,sp,-16
80002924: e406 sd ra,8(sp)
80002926: e022 sd s0,0(sp)
80002928: 0800 addi s0,sp,16
initlock(&tickslock, "time");
8000292a: 00006597 auipc a1,0x6
8000292e: 9ae58593 addi a1,a1,-1618 # 800082d8 <states.0+0x30>
80002932: 00015517 auipc a0,0x15
80002936: 59e50513 addi a0,a0,1438 # 80017ed0 <tickslock>
8000293a: ffffe097 auipc ra,0xffffe
8000293e: 1f8080e7 jalr 504(ra) # 80000b32 <initlock>
}
80002942: 60a2 ld ra,8(sp)
80002944: 6402 ld s0,0(sp)
80002946: 0141 addi sp,sp,16
80002948: 8082 ret
000000008000294a <trapinithart>:
// set up to take exceptions and traps while in the kernel.
void
trapinithart(void)
{
8000294a: 1141 addi sp,sp,-16
8000294c: e422 sd s0,8(sp)
8000294e: 0800 addi s0,sp,16
asm volatile("csrw stvec, %0" : : "r" (x));
80002950: 00003797 auipc a5,0x3
80002954: 64078793 addi a5,a5,1600 # 80005f90 <kernelvec>
80002958: 10579073 csrw stvec,a5
w_stvec((uint64)kernelvec);
}
8000295c: 6422 ld s0,8(sp)
8000295e: 0141 addi sp,sp,16
80002960: 8082 ret
0000000080002962 <usertrapret>:
//
// return to user space
//
void
usertrapret(void)
{
80002962: 1141 addi sp,sp,-16
80002964: e406 sd ra,8(sp)
80002966: e022 sd s0,0(sp)
80002968: 0800 addi s0,sp,16
struct proc *p = myproc();
8000296a: fffff097 auipc ra,0xfffff
8000296e: 014080e7 jalr 20(ra) # 8000197e <myproc>
asm volatile("csrr %0, sstatus" : "=r" (x) );
80002972: 100027f3 csrr a5,sstatus
w_sstatus(r_sstatus() & ~SSTATUS_SIE);
80002976: 9bf5 andi a5,a5,-3
asm volatile("csrw sstatus, %0" : : "r" (x));
80002978: 10079073 csrw sstatus,a5
// kerneltrap() to usertrap(), so turn off interrupts until
// we're back in user space, where usertrap() is correct.
intr_off();
// send syscalls, interrupts, and exceptions to trampoline.S
w_stvec(TRAMPOLINE + (uservec - trampoline));
8000297c: 00004617 auipc a2,0x4
80002980: 68460613 addi a2,a2,1668 # 80007000 <_trampoline>
80002984: 00004697 auipc a3,0x4
80002988: 67c68693 addi a3,a3,1660 # 80007000 <_trampoline>
8000298c: 8e91 sub a3,a3,a2
8000298e: 040007b7 lui a5,0x4000
80002992: 17fd addi a5,a5,-1
80002994: 07b2 slli a5,a5,0xc
80002996: 96be add a3,a3,a5
asm volatile("csrw stvec, %0" : : "r" (x));
80002998: 10569073 csrw stvec,a3
// set up trapframe values that uservec will need when
// the process next re-enters the kernel.
p->trapframe->kernel_satp = r_satp(); // kernel page table
8000299c: 6958 ld a4,144(a0)
asm volatile("csrr %0, satp" : "=r" (x) );
8000299e: 180026f3 csrr a3,satp
800029a2: e314 sd a3,0(a4)
p->trapframe->kernel_sp = p->kstack + PGSIZE; // process's kernel stack
800029a4: 6958 ld a4,144(a0)
800029a6: 7d34 ld a3,120(a0)
800029a8: 6585 lui a1,0x1
800029aa: 96ae add a3,a3,a1
800029ac: e714 sd a3,8(a4)
p->trapframe->kernel_trap = (uint64)usertrap;
800029ae: 6958 ld a4,144(a0)
800029b0: 00000697 auipc a3,0x0
800029b4: 13868693 addi a3,a3,312 # 80002ae8 <usertrap>
800029b8: eb14 sd a3,16(a4)
p->trapframe->kernel_hartid = r_tp(); // hartid for cpuid()
800029ba: 6958 ld a4,144(a0)
asm volatile("mv %0, tp" : "=r" (x) );
800029bc: 8692 mv a3,tp
800029be: f314 sd a3,32(a4)
asm volatile("csrr %0, sstatus" : "=r" (x) );
800029c0: 100026f3 csrr a3,sstatus
// set up the registers that trampoline.S's sret will use
// to get to user space.
// set S Previous Privilege mode to User.
unsigned long x = r_sstatus();
x &= ~SSTATUS_SPP; // clear SPP to 0 for user mode
800029c4: eff6f693 andi a3,a3,-257
x |= SSTATUS_SPIE; // enable interrupts in user mode
800029c8: 0206e693 ori a3,a3,32
asm volatile("csrw sstatus, %0" : : "r" (x));
800029cc: 10069073 csrw sstatus,a3
w_sstatus(x);
// set S Exception Program Counter to the saved user pc.
w_sepc(p->trapframe->epc);
800029d0: 6958 ld a4,144(a0)
asm volatile("csrw sepc, %0" : : "r" (x));
800029d2: 6f18 ld a4,24(a4)
800029d4: 14171073 csrw sepc,a4
// tell trampoline.S the user page table to switch to.
uint64 satp = MAKE_SATP(p->pagetable);
800029d8: 654c ld a1,136(a0)
800029da: 81b1 srli a1,a1,0xc
// jump to trampoline.S at the top of memory, which
// switches to the user page table, restores user registers,
// and switches to user mode with sret.
uint64 fn = TRAMPOLINE + (userret - trampoline);
800029dc: 00004717 auipc a4,0x4
800029e0: 6b470713 addi a4,a4,1716 # 80007090 <userret>
800029e4: 8f11 sub a4,a4,a2
800029e6: 97ba add a5,a5,a4
((void (*)(uint64,uint64))fn)(TRAPFRAME, satp);
800029e8: 577d li a4,-1
800029ea: 177e slli a4,a4,0x3f
800029ec: 8dd9 or a1,a1,a4
800029ee: 02000537 lui a0,0x2000
800029f2: 157d addi a0,a0,-1
800029f4: 0536 slli a0,a0,0xd
800029f6: 9782 jalr a5
}
800029f8: 60a2 ld ra,8(sp)
800029fa: 6402 ld s0,0(sp)
800029fc: 0141 addi sp,sp,16
800029fe: 8082 ret
0000000080002a00 <clockintr>:
w_sstatus(sstatus);
}
void
clockintr()
{
80002a00: 1101 addi sp,sp,-32
80002a02: ec06 sd ra,24(sp)
80002a04: e822 sd s0,16(sp)
80002a06: e426 sd s1,8(sp)
80002a08: 1000 addi s0,sp,32
acquire(&tickslock);
80002a0a: 00015497 auipc s1,0x15
80002a0e: 4c648493 addi s1,s1,1222 # 80017ed0 <tickslock>
80002a12: 8526 mv a0,s1
80002a14: ffffe097 auipc ra,0xffffe
80002a18: 1ae080e7 jalr 430(ra) # 80000bc2 <acquire>
ticks++;
80002a1c: 00006517 auipc a0,0x6
80002a20: 61450513 addi a0,a0,1556 # 80009030 <ticks>
80002a24: 411c lw a5,0(a0)
80002a26: 2785 addiw a5,a5,1
80002a28: c11c sw a5,0(a0)
wakeup(&ticks);
80002a2a: 00000097 auipc ra,0x0
80002a2e: 93e080e7 jalr -1730(ra) # 80002368 <wakeup>
release(&tickslock);
80002a32: 8526 mv a0,s1
80002a34: ffffe097 auipc ra,0xffffe
80002a38: 242080e7 jalr 578(ra) # 80000c76 <release>
}
80002a3c: 60e2 ld ra,24(sp)
80002a3e: 6442 ld s0,16(sp)
80002a40: 64a2 ld s1,8(sp)
80002a42: 6105 addi sp,sp,32
80002a44: 8082 ret
0000000080002a46 <devintr>:
// returns 2 if timer interrupt,
// 1 if other device,
// 0 if not recognized.
int
devintr()
{
80002a46: 1101 addi sp,sp,-32
80002a48: ec06 sd ra,24(sp)
80002a4a: e822 sd s0,16(sp)
80002a4c: e426 sd s1,8(sp)
80002a4e: 1000 addi s0,sp,32
asm volatile("csrr %0, scause" : "=r" (x) );
80002a50: 14202773 csrr a4,scause
uint64 scause = r_scause();
if((scause & 0x8000000000000000L) &&
80002a54: 00074d63 bltz a4,80002a6e <devintr+0x28>
// now allowed to interrupt again.
if(irq)
plic_complete(irq);
return 1;
} else if(scause == 0x8000000000000001L){
80002a58: 57fd li a5,-1
80002a5a: 17fe slli a5,a5,0x3f
80002a5c: 0785 addi a5,a5,1
// the SSIP bit in sip.
w_sip(r_sip() & ~2);
return 2;
} else {
return 0;
80002a5e: 4501 li a0,0
} else if(scause == 0x8000000000000001L){
80002a60: 06f70363 beq a4,a5,80002ac6 <devintr+0x80>
}
}
80002a64: 60e2 ld ra,24(sp)
80002a66: 6442 ld s0,16(sp)
80002a68: 64a2 ld s1,8(sp)
80002a6a: 6105 addi sp,sp,32
80002a6c: 8082 ret
(scause & 0xff) == 9){
80002a6e: 0ff77793 andi a5,a4,255
if((scause & 0x8000000000000000L) &&
80002a72: 46a5 li a3,9
80002a74: fed792e3 bne a5,a3,80002a58 <devintr+0x12>
int irq = plic_claim();
80002a78: 00003097 auipc ra,0x3
80002a7c: 620080e7 jalr 1568(ra) # 80006098 <plic_claim>
80002a80: 84aa mv s1,a0
if(irq == UART0_IRQ){
80002a82: 47a9 li a5,10
80002a84: 02f50763 beq a0,a5,80002ab2 <devintr+0x6c>
} else if(irq == VIRTIO0_IRQ){
80002a88: 4785 li a5,1
80002a8a: 02f50963 beq a0,a5,80002abc <devintr+0x76>
return 1;
80002a8e: 4505 li a0,1
} else if(irq){
80002a90: d8f1 beqz s1,80002a64 <devintr+0x1e>
printf("unexpected interrupt irq=%d\n", irq);
80002a92: 85a6 mv a1,s1
80002a94: 00006517 auipc a0,0x6
80002a98: 84c50513 addi a0,a0,-1972 # 800082e0 <states.0+0x38>
80002a9c: ffffe097 auipc ra,0xffffe
80002aa0: ad8080e7 jalr -1320(ra) # 80000574 <printf>
plic_complete(irq);
80002aa4: 8526 mv a0,s1
80002aa6: 00003097 auipc ra,0x3
80002aaa: 616080e7 jalr 1558(ra) # 800060bc <plic_complete>
return 1;
80002aae: 4505 li a0,1
80002ab0: bf55 j 80002a64 <devintr+0x1e>
uartintr();
80002ab2: ffffe097 auipc ra,0xffffe
80002ab6: ed4080e7 jalr -300(ra) # 80000986 <uartintr>
80002aba: b7ed j 80002aa4 <devintr+0x5e>
virtio_disk_intr();
80002abc: 00004097 auipc ra,0x4
80002ac0: a92080e7 jalr -1390(ra) # 8000654e <virtio_disk_intr>
80002ac4: b7c5 j 80002aa4 <devintr+0x5e>
if(cpuid() == 0){
80002ac6: fffff097 auipc ra,0xfffff
80002aca: e8c080e7 jalr -372(ra) # 80001952 <cpuid>
80002ace: c901 beqz a0,80002ade <devintr+0x98>
asm volatile("csrr %0, sip" : "=r" (x) );
80002ad0: 144027f3 csrr a5,sip
w_sip(r_sip() & ~2);
80002ad4: 9bf5 andi a5,a5,-3
asm volatile("csrw sip, %0" : : "r" (x));
80002ad6: 14479073 csrw sip,a5
return 2;
80002ada: 4509 li a0,2
80002adc: b761 j 80002a64 <devintr+0x1e>
clockintr();
80002ade: 00000097 auipc ra,0x0
80002ae2: f22080e7 jalr -222(ra) # 80002a00 <clockintr>
80002ae6: b7ed j 80002ad0 <devintr+0x8a>
0000000080002ae8 <usertrap>:
{
80002ae8: 1101 addi sp,sp,-32
80002aea: ec06 sd ra,24(sp)
80002aec: e822 sd s0,16(sp)
80002aee: e426 sd s1,8(sp)
80002af0: e04a sd s2,0(sp)
80002af2: 1000 addi s0,sp,32
asm volatile("csrr %0, sstatus" : "=r" (x) );
80002af4: 100027f3 csrr a5,sstatus
if((r_sstatus() & SSTATUS_SPP) != 0)
80002af8: 1007f793 andi a5,a5,256
80002afc: e3ad bnez a5,80002b5e <usertrap+0x76>
asm volatile("csrw stvec, %0" : : "r" (x));
80002afe: 00003797 auipc a5,0x3
80002b02: 49278793 addi a5,a5,1170 # 80005f90 <kernelvec>
80002b06: 10579073 csrw stvec,a5
struct proc *p = myproc();
80002b0a: fffff097 auipc ra,0xfffff
80002b0e: e74080e7 jalr -396(ra) # 8000197e <myproc>
80002b12: 84aa mv s1,a0
p->trapframe->epc = r_sepc();
80002b14: 695c ld a5,144(a0)
asm volatile("csrr %0, sepc" : "=r" (x) );
80002b16: 14102773 csrr a4,sepc
80002b1a: ef98 sd a4,24(a5)
asm volatile("csrr %0, scause" : "=r" (x) );
80002b1c: 14202773 csrr a4,scause
if(r_scause() == 8){
80002b20: 47a1 li a5,8
80002b22: 04f71c63 bne a4,a5,80002b7a <usertrap+0x92>
if(p->killed)
80002b26: 551c lw a5,40(a0)
80002b28: e3b9 bnez a5,80002b6e <usertrap+0x86>
p->trapframe->epc += 4;
80002b2a: 68d8 ld a4,144(s1)
80002b2c: 6f1c ld a5,24(a4)
80002b2e: 0791 addi a5,a5,4
80002b30: ef1c sd a5,24(a4)
asm volatile("csrr %0, sstatus" : "=r" (x) );
80002b32: 100027f3 csrr a5,sstatus
w_sstatus(r_sstatus() | SSTATUS_SIE);
80002b36: 0027e793 ori a5,a5,2
asm volatile("csrw sstatus, %0" : : "r" (x));
80002b3a: 10079073 csrw sstatus,a5
syscall();
80002b3e: 00000097 auipc ra,0x0
80002b42: 2fc080e7 jalr 764(ra) # 80002e3a <syscall>
if(p->killed)
80002b46: 549c lw a5,40(s1)
80002b48: efd9 bnez a5,80002be6 <usertrap+0xfe>
usertrapret();
80002b4a: 00000097 auipc ra,0x0
80002b4e: e18080e7 jalr -488(ra) # 80002962 <usertrapret>
}
80002b52: 60e2 ld ra,24(sp)
80002b54: 6442 ld s0,16(sp)
80002b56: 64a2 ld s1,8(sp)
80002b58: 6902 ld s2,0(sp)
80002b5a: 6105 addi sp,sp,32
80002b5c: 8082 ret
panic("usertrap: not from user mode");
80002b5e: 00005517 auipc a0,0x5
80002b62: 7a250513 addi a0,a0,1954 # 80008300 <states.0+0x58>
80002b66: ffffe097 auipc ra,0xffffe
80002b6a: 9c4080e7 jalr -1596(ra) # 8000052a <panic>
exit(-1);
80002b6e: 557d li a0,-1
80002b70: 00000097 auipc ra,0x0
80002b74: 8e8080e7 jalr -1816(ra) # 80002458 <exit>
80002b78: bf4d j 80002b2a <usertrap+0x42>
} else if((which_dev = devintr()) != 0){
80002b7a: 00000097 auipc ra,0x0
80002b7e: ecc080e7 jalr -308(ra) # 80002a46 <devintr>
80002b82: 892a mv s2,a0
80002b84: c501 beqz a0,80002b8c <usertrap+0xa4>
if(p->killed)
80002b86: 549c lw a5,40(s1)
80002b88: c3a1 beqz a5,80002bc8 <usertrap+0xe0>
80002b8a: a815 j 80002bbe <usertrap+0xd6>
asm volatile("csrr %0, scause" : "=r" (x) );
80002b8c: 142025f3 csrr a1,scause
printf("usertrap(): unexpected scause %p pid=%d\n", r_scause(), p->pid);
80002b90: 5890 lw a2,48(s1)
80002b92: 00005517 auipc a0,0x5
80002b96: 78e50513 addi a0,a0,1934 # 80008320 <states.0+0x78>
80002b9a: ffffe097 auipc ra,0xffffe
80002b9e: 9da080e7 jalr -1574(ra) # 80000574 <printf>
asm volatile("csrr %0, sepc" : "=r" (x) );
80002ba2: 141025f3 csrr a1,sepc
asm volatile("csrr %0, stval" : "=r" (x) );
80002ba6: 14302673 csrr a2,stval
printf(" sepc=%p stval=%p\n", r_sepc(), r_stval());
80002baa: 00005517 auipc a0,0x5
80002bae: 7a650513 addi a0,a0,1958 # 80008350 <states.0+0xa8>
80002bb2: ffffe097 auipc ra,0xffffe
80002bb6: 9c2080e7 jalr -1598(ra) # 80000574 <printf>
p->killed = 1;
80002bba: 4785 li a5,1
80002bbc: d49c sw a5,40(s1)
exit(-1);
80002bbe: 557d li a0,-1
80002bc0: 00000097 auipc ra,0x0
80002bc4: 898080e7 jalr -1896(ra) # 80002458 <exit>
if(which_dev == 2){
80002bc8: 4789 li a5,2
80002bca: f8f910e3 bne s2,a5,80002b4a <usertrap+0x62>
if(inctickcounter() == QUANTUM){
80002bce: 00000097 auipc ra,0x0
80002bd2: c4a080e7 jalr -950(ra) # 80002818 <inctickcounter>
80002bd6: 4795 li a5,5
80002bd8: f6f519e3 bne a0,a5,80002b4a <usertrap+0x62>
yield();
80002bdc: fffff097 auipc ra,0xfffff
80002be0: 4c2080e7 jalr 1218(ra) # 8000209e <yield>
80002be4: b79d j 80002b4a <usertrap+0x62>
int which_dev = 0;
80002be6: 4901 li s2,0
80002be8: bfd9 j 80002bbe <usertrap+0xd6>
0000000080002bea <kerneltrap>:
{
80002bea: 7179 addi sp,sp,-48
80002bec: f406 sd ra,40(sp)
80002bee: f022 sd s0,32(sp)
80002bf0: ec26 sd s1,24(sp)
80002bf2: e84a sd s2,16(sp)
80002bf4: e44e sd s3,8(sp)
80002bf6: 1800 addi s0,sp,48
asm volatile("csrr %0, sepc" : "=r" (x) );
80002bf8: 14102973 csrr s2,sepc
asm volatile("csrr %0, sstatus" : "=r" (x) );
80002bfc: 100024f3 csrr s1,sstatus
asm volatile("csrr %0, scause" : "=r" (x) );
80002c00: 142029f3 csrr s3,scause
if((sstatus & SSTATUS_SPP) == 0)
80002c04: 1004f793 andi a5,s1,256
80002c08: cb85 beqz a5,80002c38 <kerneltrap+0x4e>
asm volatile("csrr %0, sstatus" : "=r" (x) );
80002c0a: 100027f3 csrr a5,sstatus
return (x & SSTATUS_SIE) != 0;
80002c0e: 8b89 andi a5,a5,2
if(intr_get() != 0)
80002c10: ef85 bnez a5,80002c48 <kerneltrap+0x5e>
if((which_dev = devintr()) == 0){
80002c12: 00000097 auipc ra,0x0
80002c16: e34080e7 jalr -460(ra) # 80002a46 <devintr>
80002c1a: cd1d beqz a0,80002c58 <kerneltrap+0x6e>
if(which_dev == 2 && myproc() != 0 && myproc()->state == RUNNING && inctickcounter() == QUANTUM){
80002c1c: 4789 li a5,2
80002c1e: 06f50a63 beq a0,a5,80002c92 <kerneltrap+0xa8>
asm volatile("csrw sepc, %0" : : "r" (x));
80002c22: 14191073 csrw sepc,s2
asm volatile("csrw sstatus, %0" : : "r" (x));
80002c26: 10049073 csrw sstatus,s1
}
80002c2a: 70a2 ld ra,40(sp)
80002c2c: 7402 ld s0,32(sp)
80002c2e: 64e2 ld s1,24(sp)
80002c30: 6942 ld s2,16(sp)
80002c32: 69a2 ld s3,8(sp)
80002c34: 6145 addi sp,sp,48
80002c36: 8082 ret
panic("kerneltrap: not from supervisor mode");
80002c38: 00005517 auipc a0,0x5
80002c3c: 73850513 addi a0,a0,1848 # 80008370 <states.0+0xc8>
80002c40: ffffe097 auipc ra,0xffffe
80002c44: 8ea080e7 jalr -1814(ra) # 8000052a <panic>
panic("kerneltrap: interrupts enabled");
80002c48: 00005517 auipc a0,0x5
80002c4c: 75050513 addi a0,a0,1872 # 80008398 <states.0+0xf0>
80002c50: ffffe097 auipc ra,0xffffe
80002c54: 8da080e7 jalr -1830(ra) # 8000052a <panic>
printf("scause %p\n", scause);
80002c58: 85ce mv a1,s3
80002c5a: 00005517 auipc a0,0x5
80002c5e: 75e50513 addi a0,a0,1886 # 800083b8 <states.0+0x110>
80002c62: ffffe097 auipc ra,0xffffe
80002c66: 912080e7 jalr -1774(ra) # 80000574 <printf>
asm volatile("csrr %0, sepc" : "=r" (x) );
80002c6a: 141025f3 csrr a1,sepc
asm volatile("csrr %0, stval" : "=r" (x) );
80002c6e: 14302673 csrr a2,stval
printf("sepc=%p stval=%p\n", r_sepc(), r_stval());
80002c72: 00005517 auipc a0,0x5
80002c76: 75650513 addi a0,a0,1878 # 800083c8 <states.0+0x120>
80002c7a: ffffe097 auipc ra,0xffffe
80002c7e: 8fa080e7 jalr -1798(ra) # 80000574 <printf>
panic("kerneltrap");
80002c82: 00005517 auipc a0,0x5
80002c86: 75e50513 addi a0,a0,1886 # 800083e0 <states.0+0x138>
80002c8a: ffffe097 auipc ra,0xffffe
80002c8e: 8a0080e7 jalr -1888(ra) # 8000052a <panic>
if(which_dev == 2 && myproc() != 0 && myproc()->state == RUNNING && inctickcounter() == QUANTUM){
80002c92: fffff097 auipc ra,0xfffff
80002c96: cec080e7 jalr -788(ra) # 8000197e <myproc>
80002c9a: d541 beqz a0,80002c22 <kerneltrap+0x38>
80002c9c: fffff097 auipc ra,0xfffff
80002ca0: ce2080e7 jalr -798(ra) # 8000197e <myproc>
80002ca4: 4d18 lw a4,24(a0)
80002ca6: 4791 li a5,4
80002ca8: f6f71de3 bne a4,a5,80002c22 <kerneltrap+0x38>
80002cac: 00000097 auipc ra,0x0
80002cb0: b6c080e7 jalr -1172(ra) # 80002818 <inctickcounter>
80002cb4: 4795 li a5,5
80002cb6: f6f516e3 bne a0,a5,80002c22 <kerneltrap+0x38>
yield();
80002cba: fffff097 auipc ra,0xfffff
80002cbe: 3e4080e7 jalr 996(ra) # 8000209e <yield>
80002cc2: b785 j 80002c22 <kerneltrap+0x38>
0000000080002cc4 <argraw>:
return strlen(buf);
}
static uint64
argraw(int n)
{
80002cc4: 1101 addi sp,sp,-32
80002cc6: ec06 sd ra,24(sp)
80002cc8: e822 sd s0,16(sp)
80002cca: e426 sd s1,8(sp)
80002ccc: 1000 addi s0,sp,32
80002cce: 84aa mv s1,a0
struct proc *p = myproc();
80002cd0: fffff097 auipc ra,0xfffff
80002cd4: cae080e7 jalr -850(ra) # 8000197e <myproc>
switch (n) {
80002cd8: 4795 li a5,5
80002cda: 0497e163 bltu a5,s1,80002d1c <argraw+0x58>
80002cde: 048a slli s1,s1,0x2
80002ce0: 00006717 auipc a4,0x6
80002ce4: 85870713 addi a4,a4,-1960 # 80008538 <states.0+0x290>
80002ce8: 94ba add s1,s1,a4
80002cea: 409c lw a5,0(s1)
80002cec: 97ba add a5,a5,a4
80002cee: 8782 jr a5
case 0:
return p->trapframe->a0;
80002cf0: 695c ld a5,144(a0)
80002cf2: 7ba8 ld a0,112(a5)
case 5:
return p->trapframe->a5;
}
panic("argraw");
return -1;
}
80002cf4: 60e2 ld ra,24(sp)
80002cf6: 6442 ld s0,16(sp)
80002cf8: 64a2 ld s1,8(sp)
80002cfa: 6105 addi sp,sp,32
80002cfc: 8082 ret
return p->trapframe->a1;
80002cfe: 695c ld a5,144(a0)
80002d00: 7fa8 ld a0,120(a5)
80002d02: bfcd j 80002cf4 <argraw+0x30>
return p->trapframe->a2;
80002d04: 695c ld a5,144(a0)
80002d06: 63c8 ld a0,128(a5)
80002d08: b7f5 j 80002cf4 <argraw+0x30>
return p->trapframe->a3;
80002d0a: 695c ld a5,144(a0)
80002d0c: 67c8 ld a0,136(a5)
80002d0e: b7dd j 80002cf4 <argraw+0x30>
return p->trapframe->a4;
80002d10: 695c ld a5,144(a0)
80002d12: 6bc8 ld a0,144(a5)
80002d14: b7c5 j 80002cf4 <argraw+0x30>
return p->trapframe->a5;
80002d16: 695c ld a5,144(a0)
80002d18: 6fc8 ld a0,152(a5)
80002d1a: bfe9 j 80002cf4 <argraw+0x30>
panic("argraw");
80002d1c: 00005517 auipc a0,0x5
80002d20: 6d450513 addi a0,a0,1748 # 800083f0 <states.0+0x148>
80002d24: ffffe097 auipc ra,0xffffe
80002d28: 806080e7 jalr -2042(ra) # 8000052a <panic>
0000000080002d2c <fetchaddr>:
{
80002d2c: 1101 addi sp,sp,-32
80002d2e: ec06 sd ra,24(sp)
80002d30: e822 sd s0,16(sp)
80002d32: e426 sd s1,8(sp)
80002d34: e04a sd s2,0(sp)
80002d36: 1000 addi s0,sp,32
80002d38: 84aa mv s1,a0
80002d3a: 892e mv s2,a1
struct proc *p = myproc();
80002d3c: fffff097 auipc ra,0xfffff
80002d40: c42080e7 jalr -958(ra) # 8000197e <myproc>
if(addr >= p->sz || addr+sizeof(uint64) > p->sz)
80002d44: 615c ld a5,128(a0)
80002d46: 02f4f863 bgeu s1,a5,80002d76 <fetchaddr+0x4a>
80002d4a: 00848713 addi a4,s1,8
80002d4e: 02e7e663 bltu a5,a4,80002d7a <fetchaddr+0x4e>
if(copyin(p->pagetable, (char *)ip, addr, sizeof(*ip)) != 0)
80002d52: 46a1 li a3,8
80002d54: 8626 mv a2,s1
80002d56: 85ca mv a1,s2
80002d58: 6548 ld a0,136(a0)
80002d5a: fffff097 auipc ra,0xfffff
80002d5e: 970080e7 jalr -1680(ra) # 800016ca <copyin>
80002d62: 00a03533 snez a0,a0
80002d66: 40a00533 neg a0,a0
}
80002d6a: 60e2 ld ra,24(sp)
80002d6c: 6442 ld s0,16(sp)
80002d6e: 64a2 ld s1,8(sp)
80002d70: 6902 ld s2,0(sp)
80002d72: 6105 addi sp,sp,32
80002d74: 8082 ret
return -1;
80002d76: 557d li a0,-1
80002d78: bfcd j 80002d6a <fetchaddr+0x3e>
80002d7a: 557d li a0,-1
80002d7c: b7fd j 80002d6a <fetchaddr+0x3e>
0000000080002d7e <fetchstr>:
{
80002d7e: 7179 addi sp,sp,-48
80002d80: f406 sd ra,40(sp)
80002d82: f022 sd s0,32(sp)
80002d84: ec26 sd s1,24(sp)
80002d86: e84a sd s2,16(sp)
80002d88: e44e sd s3,8(sp)
80002d8a: 1800 addi s0,sp,48
80002d8c: 892a mv s2,a0
80002d8e: 84ae mv s1,a1
80002d90: 89b2 mv s3,a2
struct proc *p = myproc();
80002d92: fffff097 auipc ra,0xfffff
80002d96: bec080e7 jalr -1044(ra) # 8000197e <myproc>
int err = copyinstr(p->pagetable, buf, addr, max);
80002d9a: 86ce mv a3,s3
80002d9c: 864a mv a2,s2
80002d9e: 85a6 mv a1,s1
80002da0: 6548 ld a0,136(a0)
80002da2: fffff097 auipc ra,0xfffff
80002da6: 9b6080e7 jalr -1610(ra) # 80001758 <copyinstr>
if(err < 0)
80002daa: 00054763 bltz a0,80002db8 <fetchstr+0x3a>
return strlen(buf);
80002dae: 8526 mv a0,s1
80002db0: ffffe097 auipc ra,0xffffe
80002db4: 092080e7 jalr 146(ra) # 80000e42 <strlen>
}
80002db8: 70a2 ld ra,40(sp)
80002dba: 7402 ld s0,32(sp)
80002dbc: 64e2 ld s1,24(sp)
80002dbe: 6942 ld s2,16(sp)
80002dc0: 69a2 ld s3,8(sp)
80002dc2: 6145 addi sp,sp,48
80002dc4: 8082 ret
0000000080002dc6 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
80002dc6: 1101 addi sp,sp,-32
80002dc8: ec06 sd ra,24(sp)
80002dca: e822 sd s0,16(sp)
80002dcc: e426 sd s1,8(sp)
80002dce: 1000 addi s0,sp,32
80002dd0: 84ae mv s1,a1
*ip = argraw(n);
80002dd2: 00000097 auipc ra,0x0
80002dd6: ef2080e7 jalr -270(ra) # 80002cc4 <argraw>
80002dda: c088 sw a0,0(s1)
return 0;
}
80002ddc: 4501 li a0,0
80002dde: 60e2 ld ra,24(sp)
80002de0: 6442 ld s0,16(sp)
80002de2: 64a2 ld s1,8(sp)
80002de4: 6105 addi sp,sp,32
80002de6: 8082 ret
0000000080002de8 <argaddr>:
// Retrieve an argument as a pointer.
// Doesn't check for legality, since
// copyin/copyout will do that.
int
argaddr(int n, uint64 *ip)
{
80002de8: 1101 addi sp,sp,-32
80002dea: ec06 sd ra,24(sp)
80002dec: e822 sd s0,16(sp)
80002dee: e426 sd s1,8(sp)
80002df0: 1000 addi s0,sp,32
80002df2: 84ae mv s1,a1
*ip = argraw(n);
80002df4: 00000097 auipc ra,0x0
80002df8: ed0080e7 jalr -304(ra) # 80002cc4 <argraw>
80002dfc: e088 sd a0,0(s1)
return 0;
}
80002dfe: 4501 li a0,0
80002e00: 60e2 ld ra,24(sp)
80002e02: 6442 ld s0,16(sp)
80002e04: 64a2 ld s1,8(sp)
80002e06: 6105 addi sp,sp,32
80002e08: 8082 ret
0000000080002e0a <argstr>:
// Fetch the nth word-sized system call argument as a null-terminated string.
// Copies into buf, at most max.
// Returns string length if OK (including nul), -1 if error.
int
argstr(int n, char *buf, int max)
{
80002e0a: 1101 addi sp,sp,-32
80002e0c: ec06 sd ra,24(sp)
80002e0e: e822 sd s0,16(sp)
80002e10: e426 sd s1,8(sp)
80002e12: e04a sd s2,0(sp)
80002e14: 1000 addi s0,sp,32
80002e16: 84ae mv s1,a1
80002e18: 8932 mv s2,a2
*ip = argraw(n);
80002e1a: 00000097 auipc ra,0x0
80002e1e: eaa080e7 jalr -342(ra) # 80002cc4 <argraw>
uint64 addr;
if(argaddr(n, &addr) < 0)
return -1;
return fetchstr(addr, buf, max);
80002e22: 864a mv a2,s2
80002e24: 85a6 mv a1,s1
80002e26: 00000097 auipc ra,0x0
80002e2a: f58080e7 jalr -168(ra) # 80002d7e <fetchstr>
}
80002e2e: 60e2 ld ra,24(sp)
80002e30: 6442 ld s0,16(sp)
80002e32: 64a2 ld s1,8(sp)
80002e34: 6902 ld s2,0(sp)
80002e36: 6105 addi sp,sp,32
80002e38: 8082 ret
0000000080002e3a <syscall>:
"unlink", "link", "mkdir", "close", "trace" ,"wait_stat", "set_priority"};
void
syscall(void)
{
80002e3a: 7139 addi sp,sp,-64
80002e3c: fc06 sd ra,56(sp)
80002e3e: f822 sd s0,48(sp)
80002e40: f426 sd s1,40(sp)
80002e42: f04a sd s2,32(sp)
80002e44: ec4e sd s3,24(sp)
80002e46: 0080 addi s0,sp,64
int num;
struct proc *p = myproc();
80002e48: fffff097 auipc ra,0xfffff
80002e4c: b36080e7 jalr -1226(ra) # 8000197e <myproc>
80002e50: 892a mv s2,a0
num = p->trapframe->a7;
80002e52: 695c ld a5,144(a0)
80002e54: 0a87a483 lw s1,168(a5)
int argument = 0;
80002e58: fc042623 sw zero,-52(s0)
if(num == SYS_fork || num == SYS_kill || num == SYS_sbrk)
80002e5c: 47b1 li a5,12
80002e5e: 0297e063 bltu a5,s1,80002e7e <syscall+0x44>
80002e62: 6785 lui a5,0x1
80002e64: 04278793 addi a5,a5,66 # 1042 <_entry-0x7fffefbe>
80002e68: 0097d7b3 srl a5,a5,s1
80002e6c: 8b85 andi a5,a5,1
80002e6e: cb81 beqz a5,80002e7e <syscall+0x44>
argint(0, &argument);
80002e70: fcc40593 addi a1,s0,-52
80002e74: 4501 li a0,0
80002e76: 00000097 auipc ra,0x0
80002e7a: f50080e7 jalr -176(ra) # 80002dc6 <argint>
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80002e7e: fff4879b addiw a5,s1,-1
80002e82: 475d li a4,23
80002e84: 02f76163 bltu a4,a5,80002ea6 <syscall+0x6c>
80002e88: 00349713 slli a4,s1,0x3
80002e8c: 00005797 auipc a5,0x5
80002e90: 6c478793 addi a5,a5,1732 # 80008550 <syscalls>
80002e94: 97ba add a5,a5,a4
80002e96: 639c ld a5,0(a5)
80002e98: c799 beqz a5,80002ea6 <syscall+0x6c>
p->trapframe->a0 = syscalls[num]();
80002e9a: 09093983 ld s3,144(s2)
80002e9e: 9782 jalr a5
80002ea0: 06a9b823 sd a0,112(s3)
80002ea4: a015 j 80002ec8 <syscall+0x8e>
} else {
printf("%d %s: unknown sys call %d\n",
80002ea6: 86a6 mv a3,s1
80002ea8: 19090613 addi a2,s2,400
80002eac: 03092583 lw a1,48(s2)
80002eb0: 00005517 auipc a0,0x5
80002eb4: 54850513 addi a0,a0,1352 # 800083f8 <states.0+0x150>
80002eb8: ffffd097 auipc ra,0xffffd
80002ebc: 6bc080e7 jalr 1724(ra) # 80000574 <printf>
p->pid, p->name, num);
p->trapframe->a0 = -1;
80002ec0: 09093783 ld a5,144(s2)
80002ec4: 577d li a4,-1
80002ec6: fbb8 sd a4,112(a5)
int ret = p->trapframe->a0;
/* If the system calls bit is on in the mask of the process,
then print the trace of the system call. */
if(p->mask & (1 << num)){
80002ec8: 03492783 lw a5,52(s2)
80002ecc: 4097d7bb sraw a5,a5,s1
80002ed0: 8b85 andi a5,a5,1
80002ed2: c3a9 beqz a5,80002f14 <syscall+0xda>
int ret = p->trapframe->a0;
80002ed4: 09093783 ld a5,144(s2)
80002ed8: 5bb4 lw a3,112(a5)
if(num == SYS_fork)
80002eda: 4785 li a5,1
80002edc: 04f48363 beq s1,a5,80002f22 <syscall+0xe8>
printf("%d: syscall %s NULL -> %d\n", p->pid, sys_calls_names[num], ret);
else if(num == SYS_kill || num == SYS_sbrk)
80002ee0: 4799 li a5,6
80002ee2: 00f48563 beq s1,a5,80002eec <syscall+0xb2>
80002ee6: 47b1 li a5,12
80002ee8: 04f49c63 bne s1,a5,80002f40 <syscall+0x106>
printf("%d: syscall %s %d -> %d\n", p->pid, sys_calls_names[num], argument, ret);
80002eec: 048e slli s1,s1,0x3
80002eee: 00006797 auipc a5,0x6
80002ef2: a8a78793 addi a5,a5,-1398 # 80008978 <sys_calls_names>
80002ef6: 94be add s1,s1,a5
80002ef8: 8736 mv a4,a3
80002efa: fcc42683 lw a3,-52(s0)
80002efe: 6090 ld a2,0(s1)
80002f00: 03092583 lw a1,48(s2)
80002f04: 00005517 auipc a0,0x5
80002f08: 53450513 addi a0,a0,1332 # 80008438 <states.0+0x190>
80002f0c: ffffd097 auipc ra,0xffffd
80002f10: 668080e7 jalr 1640(ra) # 80000574 <printf>
else
printf("%d: syscall %s -> %d\n", p->pid, sys_calls_names[num], ret);
}
}
80002f14: 70e2 ld ra,56(sp)
80002f16: 7442 ld s0,48(sp)
80002f18: 74a2 ld s1,40(sp)
80002f1a: 7902 ld s2,32(sp)
80002f1c: 69e2 ld s3,24(sp)
80002f1e: 6121 addi sp,sp,64
80002f20: 8082 ret
printf("%d: syscall %s NULL -> %d\n", p->pid, sys_calls_names[num], ret);
80002f22: 00006617 auipc a2,0x6
80002f26: a5e63603 ld a2,-1442(a2) # 80008980 <sys_calls_names+0x8>
80002f2a: 03092583 lw a1,48(s2)
80002f2e: 00005517 auipc a0,0x5
80002f32: 4ea50513 addi a0,a0,1258 # 80008418 <states.0+0x170>
80002f36: ffffd097 auipc ra,0xffffd
80002f3a: 63e080e7 jalr 1598(ra) # 80000574 <printf>
80002f3e: bfd9 j 80002f14 <syscall+0xda>
printf("%d: syscall %s -> %d\n", p->pid, sys_calls_names[num], ret);
80002f40: 048e slli s1,s1,0x3
80002f42: 00006797 auipc a5,0x6
80002f46: a3678793 addi a5,a5,-1482 # 80008978 <sys_calls_names>
80002f4a: 94be add s1,s1,a5
80002f4c: 6090 ld a2,0(s1)
80002f4e: 03092583 lw a1,48(s2)
80002f52: 00005517 auipc a0,0x5
80002f56: 50650513 addi a0,a0,1286 # 80008458 <states.0+0x1b0>
80002f5a: ffffd097 auipc ra,0xffffd
80002f5e: 61a080e7 jalr 1562(ra) # 80000574 <printf>
}
80002f62: bf4d j 80002f14 <syscall+0xda>
0000000080002f64 <sys_exit>:
#include "perf.h"
uint64
sys_exit(void)
{
80002f64: 1101 addi sp,sp,-32
80002f66: ec06 sd ra,24(sp)
80002f68: e822 sd s0,16(sp)
80002f6a: 1000 addi s0,sp,32
int n;
if(argint(0, &n) < 0)
80002f6c: fec40593 addi a1,s0,-20
80002f70: 4501 li a0,0
80002f72: 00000097 auipc ra,0x0
80002f76: e54080e7 jalr -428(ra) # 80002dc6 <argint>
return -1;
80002f7a: 57fd li a5,-1
if(argint(0, &n) < 0)
80002f7c: 00054963 bltz a0,80002f8e <sys_exit+0x2a>
exit(n);
80002f80: fec42503 lw a0,-20(s0)
80002f84: fffff097 auipc ra,0xfffff
80002f88: 4d4080e7 jalr 1236(ra) # 80002458 <exit>
return 0; // not reached
80002f8c: 4781 li a5,0
}
80002f8e: 853e mv a0,a5
80002f90: 60e2 ld ra,24(sp)
80002f92: 6442 ld s0,16(sp)
80002f94: 6105 addi sp,sp,32
80002f96: 8082 ret
0000000080002f98 <sys_getpid>:
uint64
sys_getpid(void)
{
80002f98: 1141 addi sp,sp,-16
80002f9a: e406 sd ra,8(sp)
80002f9c: e022 sd s0,0(sp)
80002f9e: 0800 addi s0,sp,16
return myproc()->pid;
80002fa0: fffff097 auipc ra,0xfffff
80002fa4: 9de080e7 jalr -1570(ra) # 8000197e <myproc>
}
80002fa8: 5908 lw a0,48(a0)
80002faa: 60a2 ld ra,8(sp)
80002fac: 6402 ld s0,0(sp)
80002fae: 0141 addi sp,sp,16
80002fb0: 8082 ret
0000000080002fb2 <sys_fork>:
uint64
sys_fork(void)
{
80002fb2: 1141 addi sp,sp,-16
80002fb4: e406 sd ra,8(sp)
80002fb6: e022 sd s0,0(sp)
80002fb8: 0800 addi s0,sp,16
return fork();
80002fba: fffff097 auipc ra,0xfffff
80002fbe: ddc080e7 jalr -548(ra) # 80001d96 <fork>
}
80002fc2: 60a2 ld ra,8(sp)
80002fc4: 6402 ld s0,0(sp)
80002fc6: 0141 addi sp,sp,16
80002fc8: 8082 ret
0000000080002fca <sys_wait>:
uint64
sys_wait(void)
{
80002fca: 1101 addi sp,sp,-32
80002fcc: ec06 sd ra,24(sp)
80002fce: e822 sd s0,16(sp)
80002fd0: 1000 addi s0,sp,32
uint64 p;
if(argaddr(0, &p) < 0)
80002fd2: fe840593 addi a1,s0,-24
80002fd6: 4501 li a0,0
80002fd8: 00000097 auipc ra,0x0
80002fdc: e10080e7 jalr -496(ra) # 80002de8 <argaddr>
80002fe0: 87aa mv a5,a0
return -1;
80002fe2: 557d li a0,-1
if(argaddr(0, &p) < 0)
80002fe4: 0007c863 bltz a5,80002ff4 <sys_wait+0x2a>
return wait(p);
80002fe8: fe843503 ld a0,-24(s0)
80002fec: fffff097 auipc ra,0xfffff
80002ff0: 362080e7 jalr 866(ra) # 8000234e <wait>
}
80002ff4: 60e2 ld ra,24(sp)
80002ff6: 6442 ld s0,16(sp)
80002ff8: 6105 addi sp,sp,32
80002ffa: 8082 ret
0000000080002ffc <sys_sbrk>:
uint64
sys_sbrk(void)
{
80002ffc: 7179 addi sp,sp,-48
80002ffe: f406 sd ra,40(sp)
80003000: f022 sd s0,32(sp)
80003002: ec26 sd s1,24(sp)
80003004: 1800 addi s0,sp,48
int addr;
int n;
if(argint(0, &n) < 0)
80003006: fdc40593 addi a1,s0,-36
8000300a: 4501 li a0,0
8000300c: 00000097 auipc ra,0x0
80003010: dba080e7 jalr -582(ra) # 80002dc6 <argint>
return -1;
80003014: 54fd li s1,-1
if(argint(0, &n) < 0)
80003016: 02054063 bltz a0,80003036 <sys_sbrk+0x3a>
addr = myproc()->sz;
8000301a: fffff097 auipc ra,0xfffff
8000301e: 964080e7 jalr -1692(ra) # 8000197e <myproc>
80003022: 08052483 lw s1,128(a0)
if(growproc(n) < 0)
80003026: fdc42503 lw a0,-36(s0)
8000302a: fffff097 auipc ra,0xfffff
8000302e: cf8080e7 jalr -776(ra) # 80001d22 <growproc>
80003032: 00054863 bltz a0,80003042 <sys_sbrk+0x46>
return -1;
return addr;
}
80003036: 8526 mv a0,s1
80003038: 70a2 ld ra,40(sp)
8000303a: 7402 ld s0,32(sp)
8000303c: 64e2 ld s1,24(sp)
8000303e: 6145 addi sp,sp,48
80003040: 8082 ret
return -1;
80003042: 54fd li s1,-1
80003044: bfcd j 80003036 <sys_sbrk+0x3a>
0000000080003046 <sys_sleep>:
uint64
sys_sleep(void)
{
80003046: 7139 addi sp,sp,-64
80003048: fc06 sd ra,56(sp)
8000304a: f822 sd s0,48(sp)
8000304c: f426 sd s1,40(sp)
8000304e: f04a sd s2,32(sp)
80003050: ec4e sd s3,24(sp)
80003052: 0080 addi s0,sp,64
int n;
uint ticks0;
if(argint(0, &n) < 0)
80003054: fcc40593 addi a1,s0,-52
80003058: 4501 li a0,0
8000305a: 00000097 auipc ra,0x0
8000305e: d6c080e7 jalr -660(ra) # 80002dc6 <argint>
return -1;
80003062: 57fd li a5,-1
if(argint(0, &n) < 0)
80003064: 06054563 bltz a0,800030ce <sys_sleep+0x88>
acquire(&tickslock);
80003068: 00015517 auipc a0,0x15
8000306c: e6850513 addi a0,a0,-408 # 80017ed0 <tickslock>
80003070: ffffe097 auipc ra,0xffffe
80003074: b52080e7 jalr -1198(ra) # 80000bc2 <acquire>
ticks0 = ticks;
80003078: 00006917 auipc s2,0x6
8000307c: fb892903 lw s2,-72(s2) # 80009030 <ticks>
while(ticks - ticks0 < n){
80003080: fcc42783 lw a5,-52(s0)
80003084: cf85 beqz a5,800030bc <sys_sleep+0x76>
if(myproc()->killed){
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
80003086: 00015997 auipc s3,0x15
8000308a: e4a98993 addi s3,s3,-438 # 80017ed0 <tickslock>
8000308e: 00006497 auipc s1,0x6
80003092: fa248493 addi s1,s1,-94 # 80009030 <ticks>
if(myproc()->killed){
80003096: fffff097 auipc ra,0xfffff
8000309a: 8e8080e7 jalr -1816(ra) # 8000197e <myproc>
8000309e: 551c lw a5,40(a0)
800030a0: ef9d bnez a5,800030de <sys_sleep+0x98>
sleep(&ticks, &tickslock);
800030a2: 85ce mv a1,s3
800030a4: 8526 mv a0,s1
800030a6: fffff097 auipc ra,0xfffff
800030aa: 04e080e7 jalr 78(ra) # 800020f4 <sleep>
while(ticks - ticks0 < n){
800030ae: 409c lw a5,0(s1)
800030b0: 412787bb subw a5,a5,s2
800030b4: fcc42703 lw a4,-52(s0)
800030b8: fce7efe3 bltu a5,a4,80003096 <sys_sleep+0x50>
}
release(&tickslock);
800030bc: 00015517 auipc a0,0x15
800030c0: e1450513 addi a0,a0,-492 # 80017ed0 <tickslock>
800030c4: ffffe097 auipc ra,0xffffe
800030c8: bb2080e7 jalr -1102(ra) # 80000c76 <release>
return 0;
800030cc: 4781 li a5,0
}
800030ce: 853e mv a0,a5
800030d0: 70e2 ld ra,56(sp)
800030d2: 7442 ld s0,48(sp)
800030d4: 74a2 ld s1,40(sp)
800030d6: 7902 ld s2,32(sp)
800030d8: 69e2 ld s3,24(sp)
800030da: 6121 addi sp,sp,64
800030dc: 8082 ret
release(&tickslock);
800030de: 00015517 auipc a0,0x15
800030e2: df250513 addi a0,a0,-526 # 80017ed0 <tickslock>
800030e6: ffffe097 auipc ra,0xffffe
800030ea: b90080e7 jalr -1136(ra) # 80000c76 <release>
return -1;
800030ee: 57fd li a5,-1
800030f0: bff9 j 800030ce <sys_sleep+0x88>
00000000800030f2 <sys_set_priority>:
uint64
sys_set_priority(void)
{
800030f2: 1101 addi sp,sp,-32
800030f4: ec06 sd ra,24(sp)
800030f6: e822 sd s0,16(sp)
800030f8: 1000 addi s0,sp,32
int prio;
if(argint(0, &prio) < 0)
800030fa: fec40593 addi a1,s0,-20
800030fe: 4501 li a0,0
80003100: 00000097 auipc ra,0x0
80003104: cc6080e7 jalr -826(ra) # 80002dc6 <argint>
80003108: 87aa mv a5,a0
return -1;
8000310a: 557d li a0,-1
if(argint(0, &prio) < 0)
8000310c: 0007c863 bltz a5,8000311c <sys_set_priority+0x2a>
return set_priority(prio);
80003110: fec42503 lw a0,-20(s0)
80003114: fffff097 auipc ra,0xfffff
80003118: 44c080e7 jalr 1100(ra) # 80002560 <set_priority>
}
8000311c: 60e2 ld ra,24(sp)
8000311e: 6442 ld s0,16(sp)
80003120: 6105 addi sp,sp,32
80003122: 8082 ret
0000000080003124 <sys_trace>:
uint64
sys_trace(void)
{
80003124: 1101 addi sp,sp,-32
80003126: ec06 sd ra,24(sp)
80003128: e822 sd s0,16(sp)
8000312a: 1000 addi s0,sp,32
int mask;
int pid;
if(argint(0, &mask) < 0 || argint(1, &pid) < 0)
8000312c: fec40593 addi a1,s0,-20
80003130: 4501 li a0,0
80003132: 00000097 auipc ra,0x0
80003136: c94080e7 jalr -876(ra) # 80002dc6 <argint>
return -1;
8000313a: 57fd li a5,-1
if(argint(0, &mask) < 0 || argint(1, &pid) < 0)
8000313c: 02054563 bltz a0,80003166 <sys_trace+0x42>
80003140: fe840593 addi a1,s0,-24
80003144: 4505 li a0,1
80003146: 00000097 auipc ra,0x0
8000314a: c80080e7 jalr -896(ra) # 80002dc6 <argint>
return -1;
8000314e: 57fd li a5,-1
if(argint(0, &mask) < 0 || argint(1, &pid) < 0)
80003150: 00054b63 bltz a0,80003166 <sys_trace+0x42>
return trace(mask, pid);
80003154: fe842583 lw a1,-24(s0)
80003158: fec42503 lw a0,-20(s0)
8000315c: fffff097 auipc ra,0xfffff
80003160: 45c080e7 jalr 1116(ra) # 800025b8 <trace>
80003164: 87aa mv a5,a0
}
80003166: 853e mv a0,a5
80003168: 60e2 ld ra,24(sp)
8000316a: 6442 ld s0,16(sp)
8000316c: 6105 addi sp,sp,32
8000316e: 8082 ret
0000000080003170 <sys_kill>:
uint64
sys_kill(void)
{
80003170: 1101 addi sp,sp,-32
80003172: ec06 sd ra,24(sp)
80003174: e822 sd s0,16(sp)
80003176: 1000 addi s0,sp,32
int pid;
if(argint(0, &pid) < 0)
80003178: fec40593 addi a1,s0,-20
8000317c: 4501 li a0,0
8000317e: 00000097 auipc ra,0x0
80003182: c48080e7 jalr -952(ra) # 80002dc6 <argint>
80003186: 87aa mv a5,a0
return -1;
80003188: 557d li a0,-1
if(argint(0, &pid) < 0)
8000318a: 0007c863 bltz a5,8000319a <sys_kill+0x2a>
return kill(pid);
8000318e: fec42503 lw a0,-20(s0)
80003192: fffff097 auipc ra,0xfffff
80003196: 486080e7 jalr 1158(ra) # 80002618 <kill>
}
8000319a: 60e2 ld ra,24(sp)
8000319c: 6442 ld s0,16(sp)
8000319e: 6105 addi sp,sp,32
800031a0: 8082 ret
00000000800031a2 <sys_uptime>:
// return how many clock tick interrupts have occurred
// since start.
uint64
sys_uptime(void)
{
800031a2: 1101 addi sp,sp,-32
800031a4: ec06 sd ra,24(sp)
800031a6: e822 sd s0,16(sp)
800031a8: e426 sd s1,8(sp)
800031aa: 1000 addi s0,sp,32
uint xticks;
acquire(&tickslock);
800031ac: 00015517 auipc a0,0x15
800031b0: d2450513 addi a0,a0,-732 # 80017ed0 <tickslock>
800031b4: ffffe097 auipc ra,0xffffe
800031b8: a0e080e7 jalr -1522(ra) # 80000bc2 <acquire>
xticks = ticks;
800031bc: 00006497 auipc s1,0x6
800031c0: e744a483 lw s1,-396(s1) # 80009030 <ticks>
release(&tickslock);
800031c4: 00015517 auipc a0,0x15
800031c8: d0c50513 addi a0,a0,-756 # 80017ed0 <tickslock>
800031cc: ffffe097 auipc ra,0xffffe
800031d0: aaa080e7 jalr -1366(ra) # 80000c76 <release>
return xticks;
}
800031d4: 02049513 slli a0,s1,0x20
800031d8: 9101 srli a0,a0,0x20
800031da: 60e2 ld ra,24(sp)
800031dc: 6442 ld s0,16(sp)
800031de: 64a2 ld s1,8(sp)
800031e0: 6105 addi sp,sp,32
800031e2: 8082 ret
00000000800031e4 <sys_wait_stat>:
uint64
sys_wait_stat(void)
{
800031e4: 7179 addi sp,sp,-48
800031e6: f406 sd ra,40(sp)
800031e8: f022 sd s0,32(sp)
800031ea: ec26 sd s1,24(sp)
800031ec: 1800 addi s0,sp,48
int status;
struct perf* tmp = (struct perf*) myproc()->trapframe->a1;
800031ee: ffffe097 auipc ra,0xffffe
800031f2: 790080e7 jalr 1936(ra) # 8000197e <myproc>
800031f6: 695c ld a5,144(a0)
800031f8: 7fa4 ld s1,120(a5)
if(argint(0, &status) < 0)
800031fa: fdc40593 addi a1,s0,-36
800031fe: 4501 li a0,0
80003200: 00000097 auipc ra,0x0
80003204: bc6080e7 jalr -1082(ra) # 80002dc6 <argint>
80003208: 87aa mv a5,a0
return -1;
8000320a: 557d li a0,-1
if(argint(0, &status) < 0)
8000320c: 0007c963 bltz a5,8000321e <sys_wait_stat+0x3a>
int x = wait_stat(&status, tmp);
80003210: 85a6 mv a1,s1
80003212: fdc40513 addi a0,s0,-36
80003216: fffff097 auipc ra,0xfffff
8000321a: 5e8080e7 jalr 1512(ra) # 800027fe <wait_stat>
return x;
}
8000321e: 70a2 ld ra,40(sp)
80003220: 7402 ld s0,32(sp)
80003222: 64e2 ld s1,24(sp)
80003224: 6145 addi sp,sp,48
80003226: 8082 ret
0000000080003228 <binit>:
struct buf head;
} bcache;
void
binit(void)
{
80003228: 7179 addi sp,sp,-48
8000322a: f406 sd ra,40(sp)
8000322c: f022 sd s0,32(sp)
8000322e: ec26 sd s1,24(sp)
80003230: e84a sd s2,16(sp)
80003232: e44e sd s3,8(sp)
80003234: e052 sd s4,0(sp)
80003236: 1800 addi s0,sp,48
struct buf *b;
initlock(&bcache.lock, "bcache");
80003238: 00005597 auipc a1,0x5
8000323c: 3e058593 addi a1,a1,992 # 80008618 <syscalls+0xc8>
80003240: 00015517 auipc a0,0x15
80003244: ca850513 addi a0,a0,-856 # 80017ee8 <bcache>
80003248: ffffe097 auipc ra,0xffffe
8000324c: 8ea080e7 jalr -1814(ra) # 80000b32 <initlock>
// Create linked list of buffers
bcache.head.prev = &bcache.head;
80003250: 0001d797 auipc a5,0x1d
80003254: c9878793 addi a5,a5,-872 # 8001fee8 <bcache+0x8000>
80003258: 0001d717 auipc a4,0x1d
8000325c: ef870713 addi a4,a4,-264 # 80020150 <bcache+0x8268>
80003260: 2ae7b823 sd a4,688(a5)
bcache.head.next = &bcache.head;
80003264: 2ae7bc23 sd a4,696(a5)
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80003268: 00015497 auipc s1,0x15
8000326c: c9848493 addi s1,s1,-872 # 80017f00 <bcache+0x18>
b->next = bcache.head.next;
80003270: 893e mv s2,a5
b->prev = &bcache.head;
80003272: 89ba mv s3,a4
initsleeplock(&b->lock, "buffer");
80003274: 00005a17 auipc s4,0x5
80003278: 3aca0a13 addi s4,s4,940 # 80008620 <syscalls+0xd0>
b->next = bcache.head.next;
8000327c: 2b893783 ld a5,696(s2)
80003280: e8bc sd a5,80(s1)
b->prev = &bcache.head;
80003282: 0534b423 sd s3,72(s1)
initsleeplock(&b->lock, "buffer");
80003286: 85d2 mv a1,s4
80003288: 01048513 addi a0,s1,16
8000328c: 00001097 auipc ra,0x1
80003290: 4c2080e7 jalr 1218(ra) # 8000474e <initsleeplock>
bcache.head.next->prev = b;
80003294: 2b893783 ld a5,696(s2)
80003298: e7a4 sd s1,72(a5)
bcache.head.next = b;
8000329a: 2a993c23 sd s1,696(s2)
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8000329e: 45848493 addi s1,s1,1112
800032a2: fd349de3 bne s1,s3,8000327c <binit+0x54>
}
}
800032a6: 70a2 ld ra,40(sp)
800032a8: 7402 ld s0,32(sp)
800032aa: 64e2 ld s1,24(sp)
800032ac: 6942 ld s2,16(sp)
800032ae: 69a2 ld s3,8(sp)
800032b0: 6a02 ld s4,0(sp)
800032b2: 6145 addi sp,sp,48
800032b4: 8082 ret
00000000800032b6 <bread>:
}
// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
800032b6: 7179 addi sp,sp,-48
800032b8: f406 sd ra,40(sp)
800032ba: f022 sd s0,32(sp)
800032bc: ec26 sd s1,24(sp)
800032be: e84a sd s2,16(sp)
800032c0: e44e sd s3,8(sp)
800032c2: 1800 addi s0,sp,48
800032c4: 892a mv s2,a0
800032c6: 89ae mv s3,a1
acquire(&bcache.lock);
800032c8: 00015517 auipc a0,0x15
800032cc: c2050513 addi a0,a0,-992 # 80017ee8 <bcache>
800032d0: ffffe097 auipc ra,0xffffe
800032d4: 8f2080e7 jalr -1806(ra) # 80000bc2 <acquire>
for(b = bcache.head.next; b != &bcache.head; b = b->next){
800032d8: 0001d497 auipc s1,0x1d
800032dc: ec84b483 ld s1,-312(s1) # 800201a0 <bcache+0x82b8>
800032e0: 0001d797 auipc a5,0x1d
800032e4: e7078793 addi a5,a5,-400 # 80020150 <bcache+0x8268>
800032e8: 02f48f63 beq s1,a5,80003326 <bread+0x70>
800032ec: 873e mv a4,a5
800032ee: a021 j 800032f6 <bread+0x40>
800032f0: 68a4 ld s1,80(s1)
800032f2: 02e48a63 beq s1,a4,80003326 <bread+0x70>
if(b->dev == dev && b->blockno == blockno){
800032f6: 449c lw a5,8(s1)
800032f8: ff279ce3 bne a5,s2,800032f0 <bread+0x3a>
800032fc: 44dc lw a5,12(s1)
800032fe: ff3799e3 bne a5,s3,800032f0 <bread+0x3a>
b->refcnt++;
80003302: 40bc lw a5,64(s1)
80003304: 2785 addiw a5,a5,1
80003306: c0bc sw a5,64(s1)
release(&bcache.lock);
80003308: 00015517 auipc a0,0x15
8000330c: be050513 addi a0,a0,-1056 # 80017ee8 <bcache>
80003310: ffffe097 auipc ra,0xffffe
80003314: 966080e7 jalr -1690(ra) # 80000c76 <release>
acquiresleep(&b->lock);
80003318: 01048513 addi a0,s1,16
8000331c: 00001097 auipc ra,0x1
80003320: 46c080e7 jalr 1132(ra) # 80004788 <acquiresleep>
return b;
80003324: a8b9 j 80003382 <bread+0xcc>
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80003326: 0001d497 auipc s1,0x1d
8000332a: e724b483 ld s1,-398(s1) # 80020198 <bcache+0x82b0>
8000332e: 0001d797 auipc a5,0x1d
80003332: e2278793 addi a5,a5,-478 # 80020150 <bcache+0x8268>
80003336: 00f48863 beq s1,a5,80003346 <bread+0x90>
8000333a: 873e mv a4,a5
if(b->refcnt == 0) {
8000333c: 40bc lw a5,64(s1)
8000333e: cf81 beqz a5,80003356 <bread+0xa0>
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80003340: 64a4 ld s1,72(s1)
80003342: fee49de3 bne s1,a4,8000333c <bread+0x86>
panic("bget: no buffers");
80003346: 00005517 auipc a0,0x5
8000334a: 2e250513 addi a0,a0,738 # 80008628 <syscalls+0xd8>
8000334e: ffffd097 auipc ra,0xffffd
80003352: 1dc080e7 jalr 476(ra) # 8000052a <panic>
b->dev = dev;
80003356: 0124a423 sw s2,8(s1)
b->blockno = blockno;
8000335a: 0134a623 sw s3,12(s1)
b->valid = 0;
8000335e: 0004a023 sw zero,0(s1)
b->refcnt = 1;
80003362: 4785 li a5,1
80003364: c0bc sw a5,64(s1)
release(&bcache.lock);
80003366: 00015517 auipc a0,0x15
8000336a: b8250513 addi a0,a0,-1150 # 80017ee8 <bcache>
8000336e: ffffe097 auipc ra,0xffffe
80003372: 908080e7 jalr -1784(ra) # 80000c76 <release>
acquiresleep(&b->lock);
80003376: 01048513 addi a0,s1,16
8000337a: 00001097 auipc ra,0x1
8000337e: 40e080e7 jalr 1038(ra) # 80004788 <acquiresleep>
struct buf *b;
b = bget(dev, blockno);
if(!b->valid) {
80003382: 409c lw a5,0(s1)
80003384: cb89 beqz a5,80003396 <bread+0xe0>
virtio_disk_rw(b, 0);
b->valid = 1;
}
return b;
}
80003386: 8526 mv a0,s1
80003388: 70a2 ld ra,40(sp)
8000338a: 7402 ld s0,32(sp)
8000338c: 64e2 ld s1,24(sp)
8000338e: 6942 ld s2,16(sp)
80003390: 69a2 ld s3,8(sp)
80003392: 6145 addi sp,sp,48
80003394: 8082 ret
virtio_disk_rw(b, 0);
80003396: 4581 li a1,0
80003398: 8526 mv a0,s1
8000339a: 00003097 auipc ra,0x3
8000339e: f2c080e7 jalr -212(ra) # 800062c6 <virtio_disk_rw>
b->valid = 1;
800033a2: 4785 li a5,1
800033a4: c09c sw a5,0(s1)
return b;
800033a6: b7c5 j 80003386 <bread+0xd0>
00000000800033a8 <bwrite>:
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
800033a8: 1101 addi sp,sp,-32
800033aa: ec06 sd ra,24(sp)
800033ac: e822 sd s0,16(sp)
800033ae: e426 sd s1,8(sp)
800033b0: 1000 addi s0,sp,32
800033b2: 84aa mv s1,a0
if(!holdingsleep(&b->lock))
800033b4: 0541 addi a0,a0,16
800033b6: 00001097 auipc ra,0x1
800033ba: 46c080e7 jalr 1132(ra) # 80004822 <holdingsleep>
800033be: cd01 beqz a0,800033d6 <bwrite+0x2e>
panic("bwrite");
virtio_disk_rw(b, 1);
800033c0: 4585 li a1,1
800033c2: 8526 mv a0,s1
800033c4: 00003097 auipc ra,0x3
800033c8: f02080e7 jalr -254(ra) # 800062c6 <virtio_disk_rw>
}
800033cc: 60e2 ld ra,24(sp)
800033ce: 6442 ld s0,16(sp)
800033d0: 64a2 ld s1,8(sp)
800033d2: 6105 addi sp,sp,32
800033d4: 8082 ret
panic("bwrite");
800033d6: 00005517 auipc a0,0x5
800033da: 26a50513 addi a0,a0,618 # 80008640 <syscalls+0xf0>
800033de: ffffd097 auipc ra,0xffffd
800033e2: 14c080e7 jalr 332(ra) # 8000052a <panic>
00000000800033e6 <brelse>:
// Release a locked buffer.
// Move to the head of the most-recently-used list.
void
brelse(struct buf *b)
{
800033e6: 1101 addi sp,sp,-32
800033e8: ec06 sd ra,24(sp)
800033ea: e822 sd s0,16(sp)
800033ec: e426 sd s1,8(sp)
800033ee: e04a sd s2,0(sp)
800033f0: 1000 addi s0,sp,32
800033f2: 84aa mv s1,a0
if(!holdingsleep(&b->lock))
800033f4: 01050913 addi s2,a0,16
800033f8: 854a mv a0,s2
800033fa: 00001097 auipc ra,0x1
800033fe: 428080e7 jalr 1064(ra) # 80004822 <holdingsleep>
80003402: c92d beqz a0,80003474 <brelse+0x8e>
panic("brelse");
releasesleep(&b->lock);
80003404: 854a mv a0,s2
80003406: 00001097 auipc ra,0x1
8000340a: 3d8080e7 jalr 984(ra) # 800047de <releasesleep>
acquire(&bcache.lock);
8000340e: 00015517 auipc a0,0x15
80003412: ada50513 addi a0,a0,-1318 # 80017ee8 <bcache>
80003416: ffffd097 auipc ra,0xffffd
8000341a: 7ac080e7 jalr 1964(ra) # 80000bc2 <acquire>
b->refcnt--;
8000341e: 40bc lw a5,64(s1)
80003420: 37fd addiw a5,a5,-1
80003422: 0007871b sext.w a4,a5
80003426: c0bc sw a5,64(s1)
if (b->refcnt == 0) {
80003428: eb05 bnez a4,80003458 <brelse+0x72>
// no one is waiting for it.
b->next->prev = b->prev;
8000342a: 68bc ld a5,80(s1)
8000342c: 64b8 ld a4,72(s1)
8000342e: e7b8 sd a4,72(a5)
b->prev->next = b->next;
80003430: 64bc ld a5,72(s1)
80003432: 68b8 ld a4,80(s1)
80003434: ebb8 sd a4,80(a5)
b->next = bcache.head.next;
80003436: 0001d797 auipc a5,0x1d
8000343a: ab278793 addi a5,a5,-1358 # 8001fee8 <bcache+0x8000>
8000343e: 2b87b703 ld a4,696(a5)
80003442: e8b8 sd a4,80(s1)
b->prev = &bcache.head;
80003444: 0001d717 auipc a4,0x1d
80003448: d0c70713 addi a4,a4,-756 # 80020150 <bcache+0x8268>
8000344c: e4b8 sd a4,72(s1)
bcache.head.next->prev = b;
8000344e: 2b87b703 ld a4,696(a5)
80003452: e724 sd s1,72(a4)
bcache.head.next = b;
80003454: 2a97bc23 sd s1,696(a5)
}
release(&bcache.lock);
80003458: 00015517 auipc a0,0x15
8000345c: a9050513 addi a0,a0,-1392 # 80017ee8 <bcache>
80003460: ffffe097 auipc ra,0xffffe
80003464: 816080e7 jalr -2026(ra) # 80000c76 <release>
}
80003468: 60e2 ld ra,24(sp)
8000346a: 6442 ld s0,16(sp)
8000346c: 64a2 ld s1,8(sp)
8000346e: 6902 ld s2,0(sp)
80003470: 6105 addi sp,sp,32
80003472: 8082 ret
panic("brelse");
80003474: 00005517 auipc a0,0x5
80003478: 1d450513 addi a0,a0,468 # 80008648 <syscalls+0xf8>
8000347c: ffffd097 auipc ra,0xffffd
80003480: 0ae080e7 jalr 174(ra) # 8000052a <panic>
0000000080003484 <bpin>:
void
bpin(struct buf *b) {
80003484: 1101 addi sp,sp,-32
80003486: ec06 sd ra,24(sp)
80003488: e822 sd s0,16(sp)
8000348a: e426 sd s1,8(sp)
8000348c: 1000 addi s0,sp,32
8000348e: 84aa mv s1,a0
acquire(&bcache.lock);
80003490: 00015517 auipc a0,0x15
80003494: a5850513 addi a0,a0,-1448 # 80017ee8 <bcache>
80003498: ffffd097 auipc ra,0xffffd
8000349c: 72a080e7 jalr 1834(ra) # 80000bc2 <acquire>
b->refcnt++;
800034a0: 40bc lw a5,64(s1)
800034a2: 2785 addiw a5,a5,1
800034a4: c0bc sw a5,64(s1)
release(&bcache.lock);
800034a6: 00015517 auipc a0,0x15
800034aa: a4250513 addi a0,a0,-1470 # 80017ee8 <bcache>
800034ae: ffffd097 auipc ra,0xffffd
800034b2: 7c8080e7 jalr 1992(ra) # 80000c76 <release>
}
800034b6: 60e2 ld ra,24(sp)
800034b8: 6442 ld s0,16(sp)
800034ba: 64a2 ld s1,8(sp)
800034bc: 6105 addi sp,sp,32
800034be: 8082 ret
00000000800034c0 <bunpin>:
void
bunpin(struct buf *b) {
800034c0: 1101 addi sp,sp,-32
800034c2: ec06 sd ra,24(sp)
800034c4: e822 sd s0,16(sp)
800034c6: e426 sd s1,8(sp)
800034c8: 1000 addi s0,sp,32
800034ca: 84aa mv s1,a0
acquire(&bcache.lock);
800034cc: 00015517 auipc a0,0x15
800034d0: a1c50513 addi a0,a0,-1508 # 80017ee8 <bcache>
800034d4: ffffd097 auipc ra,0xffffd
800034d8: 6ee080e7 jalr 1774(ra) # 80000bc2 <acquire>
b->refcnt--;
800034dc: 40bc lw a5,64(s1)
800034de: 37fd addiw a5,a5,-1
800034e0: c0bc sw a5,64(s1)
release(&bcache.lock);
800034e2: 00015517 auipc a0,0x15
800034e6: a0650513 addi a0,a0,-1530 # 80017ee8 <bcache>
800034ea: ffffd097 auipc ra,0xffffd
800034ee: 78c080e7 jalr 1932(ra) # 80000c76 <release>
}
800034f2: 60e2 ld ra,24(sp)
800034f4: 6442 ld s0,16(sp)
800034f6: 64a2 ld s1,8(sp)
800034f8: 6105 addi sp,sp,32
800034fa: 8082 ret
00000000800034fc <bfree>:
}
// Free a disk block.
static void
bfree(int dev, uint b)
{
800034fc: 1101 addi sp,sp,-32
800034fe: ec06 sd ra,24(sp)
80003500: e822 sd s0,16(sp)
80003502: e426 sd s1,8(sp)
80003504: e04a sd s2,0(sp)
80003506: 1000 addi s0,sp,32
80003508: 84ae mv s1,a1
struct buf *bp;
int bi, m;
bp = bread(dev, BBLOCK(b, sb));
8000350a: 00d5d59b srliw a1,a1,0xd
8000350e: 0001d797 auipc a5,0x1d
80003512: 0b67a783 lw a5,182(a5) # 800205c4 <sb+0x1c>
80003516: 9dbd addw a1,a1,a5
80003518: 00000097 auipc ra,0x0
8000351c: d9e080e7 jalr -610(ra) # 800032b6 <bread>
bi = b % BPB;
m = 1 << (bi % 8);
80003520: 0074f713 andi a4,s1,7
80003524: 4785 li a5,1
80003526: 00e797bb sllw a5,a5,a4
if((bp->data[bi/8] & m) == 0)
8000352a: 14ce slli s1,s1,0x33
8000352c: 90d9 srli s1,s1,0x36
8000352e: 00950733 add a4,a0,s1
80003532: 05874703 lbu a4,88(a4)
80003536: 00e7f6b3 and a3,a5,a4
8000353a: c69d beqz a3,80003568 <bfree+0x6c>
8000353c: 892a mv s2,a0
panic("freeing free block");
bp->data[bi/8] &= ~m;
8000353e: 94aa add s1,s1,a0
80003540: fff7c793 not a5,a5
80003544: 8ff9 and a5,a5,a4
80003546: 04f48c23 sb a5,88(s1)
log_write(bp);
8000354a: 00001097 auipc ra,0x1
8000354e: 11e080e7 jalr 286(ra) # 80004668 <log_write>
brelse(bp);
80003552: 854a mv a0,s2
80003554: 00000097 auipc ra,0x0
80003558: e92080e7 jalr -366(ra) # 800033e6 <brelse>
}
8000355c: 60e2 ld ra,24(sp)
8000355e: 6442 ld s0,16(sp)
80003560: 64a2 ld s1,8(sp)
80003562: 6902 ld s2,0(sp)
80003564: 6105 addi sp,sp,32
80003566: 8082 ret
panic("freeing free block");
80003568: 00005517 auipc a0,0x5
8000356c: 0e850513 addi a0,a0,232 # 80008650 <syscalls+0x100>
80003570: ffffd097 auipc ra,0xffffd
80003574: fba080e7 jalr -70(ra) # 8000052a <panic>
0000000080003578 <balloc>:
{
80003578: 711d addi sp,sp,-96
8000357a: ec86 sd ra,88(sp)
8000357c: e8a2 sd s0,80(sp)
8000357e: e4a6 sd s1,72(sp)
80003580: e0ca sd s2,64(sp)
80003582: fc4e sd s3,56(sp)
80003584: f852 sd s4,48(sp)
80003586: f456 sd s5,40(sp)
80003588: f05a sd s6,32(sp)
8000358a: ec5e sd s7,24(sp)
8000358c: e862 sd s8,16(sp)
8000358e: e466 sd s9,8(sp)
80003590: 1080 addi s0,sp,96
for(b = 0; b < sb.size; b += BPB){
80003592: 0001d797 auipc a5,0x1d
80003596: 01a7a783 lw a5,26(a5) # 800205ac <sb+0x4>
8000359a: cbd1 beqz a5,8000362e <balloc+0xb6>
8000359c: 8baa mv s7,a0
8000359e: 4a81 li s5,0
bp = bread(dev, BBLOCK(b, sb));
800035a0: 0001db17 auipc s6,0x1d
800035a4: 008b0b13 addi s6,s6,8 # 800205a8 <sb>
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
800035a8: 4c01 li s8,0
m = 1 << (bi % 8);
800035aa: 4985 li s3,1
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
800035ac: 6a09 lui s4,0x2
for(b = 0; b < sb.size; b += BPB){
800035ae: 6c89 lui s9,0x2
800035b0: a831 j 800035cc <balloc+0x54>
brelse(bp);
800035b2: 854a mv a0,s2
800035b4: 00000097 auipc ra,0x0
800035b8: e32080e7 jalr -462(ra) # 800033e6 <brelse>
for(b = 0; b < sb.size; b += BPB){
800035bc: 015c87bb addw a5,s9,s5
800035c0: 00078a9b sext.w s5,a5
800035c4: 004b2703 lw a4,4(s6)
800035c8: 06eaf363 bgeu s5,a4,8000362e <balloc+0xb6>
bp = bread(dev, BBLOCK(b, sb));
800035cc: 41fad79b sraiw a5,s5,0x1f
800035d0: 0137d79b srliw a5,a5,0x13
800035d4: 015787bb addw a5,a5,s5
800035d8: 40d7d79b sraiw a5,a5,0xd
800035dc: 01cb2583 lw a1,28(s6)
800035e0: 9dbd addw a1,a1,a5
800035e2: 855e mv a0,s7
800035e4: 00000097 auipc ra,0x0
800035e8: cd2080e7 jalr -814(ra) # 800032b6 <bread>
800035ec: 892a mv s2,a0
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
800035ee: 004b2503 lw a0,4(s6)
800035f2: 000a849b sext.w s1,s5
800035f6: 8662 mv a2,s8
800035f8: faa4fde3 bgeu s1,a0,800035b2 <balloc+0x3a>
m = 1 << (bi % 8);
800035fc: 41f6579b sraiw a5,a2,0x1f
80003600: 01d7d69b srliw a3,a5,0x1d
80003604: 00c6873b addw a4,a3,a2
80003608: 00777793 andi a5,a4,7
8000360c: 9f95 subw a5,a5,a3
8000360e: 00f997bb sllw a5,s3,a5
if((bp->data[bi/8] & m) == 0){ // Is block free?
80003612: 4037571b sraiw a4,a4,0x3
80003616: 00e906b3 add a3,s2,a4
8000361a: 0586c683 lbu a3,88(a3)
8000361e: 00d7f5b3 and a1,a5,a3
80003622: cd91 beqz a1,8000363e <balloc+0xc6>
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80003624: 2605 addiw a2,a2,1
80003626: 2485 addiw s1,s1,1
80003628: fd4618e3 bne a2,s4,800035f8 <balloc+0x80>
8000362c: b759 j 800035b2 <balloc+0x3a>
panic("balloc: out of blocks");
8000362e: 00005517 auipc a0,0x5
80003632: 03a50513 addi a0,a0,58 # 80008668 <syscalls+0x118>
80003636: ffffd097 auipc ra,0xffffd
8000363a: ef4080e7 jalr -268(ra) # 8000052a <panic>
bp->data[bi/8] |= m; // Mark block in use.
8000363e: 974a add a4,a4,s2
80003640: 8fd5 or a5,a5,a3
80003642: 04f70c23 sb a5,88(a4)
log_write(bp);
80003646: 854a mv a0,s2
80003648: 00001097 auipc ra,0x1
8000364c: 020080e7 jalr 32(ra) # 80004668 <log_write>
brelse(bp);
80003650: 854a mv a0,s2
80003652: 00000097 auipc ra,0x0
80003656: d94080e7 jalr -620(ra) # 800033e6 <brelse>
bp = bread(dev, bno);
8000365a: 85a6 mv a1,s1
8000365c: 855e mv a0,s7
8000365e: 00000097 auipc ra,0x0
80003662: c58080e7 jalr -936(ra) # 800032b6 <bread>
80003666: 892a mv s2,a0
memset(bp->data, 0, BSIZE);
80003668: 40000613 li a2,1024
8000366c: 4581 li a1,0
8000366e: 05850513 addi a0,a0,88
80003672: ffffd097 auipc ra,0xffffd
80003676: 64c080e7 jalr 1612(ra) # 80000cbe <memset>
log_write(bp);
8000367a: 854a mv a0,s2
8000367c: 00001097 auipc ra,0x1
80003680: fec080e7 jalr -20(ra) # 80004668 <log_write>
brelse(bp);
80003684: 854a mv a0,s2
80003686: 00000097 auipc ra,0x0
8000368a: d60080e7 jalr -672(ra) # 800033e6 <brelse>
}
8000368e: 8526 mv a0,s1
80003690: 60e6 ld ra,88(sp)
80003692: 6446 ld s0,80(sp)
80003694: 64a6 ld s1,72(sp)
80003696: 6906 ld s2,64(sp)
80003698: 79e2 ld s3,56(sp)
8000369a: 7a42 ld s4,48(sp)
8000369c: 7aa2 ld s5,40(sp)
8000369e: 7b02 ld s6,32(sp)
800036a0: 6be2 ld s7,24(sp)
800036a2: 6c42 ld s8,16(sp)
800036a4: 6ca2 ld s9,8(sp)
800036a6: 6125 addi sp,sp,96
800036a8: 8082 ret
00000000800036aa <bmap>:
// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
800036aa: 7179 addi sp,sp,-48
800036ac: f406 sd ra,40(sp)
800036ae: f022 sd s0,32(sp)
800036b0: ec26 sd s1,24(sp)
800036b2: e84a sd s2,16(sp)
800036b4: e44e sd s3,8(sp)
800036b6: e052 sd s4,0(sp)
800036b8: 1800 addi s0,sp,48
800036ba: 892a mv s2,a0
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
800036bc: 47ad li a5,11
800036be: 04b7fe63 bgeu a5,a1,8000371a <bmap+0x70>
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
return addr;
}
bn -= NDIRECT;
800036c2: ff45849b addiw s1,a1,-12
800036c6: 0004871b sext.w a4,s1
if(bn < NINDIRECT){
800036ca: 0ff00793 li a5,255
800036ce: 0ae7e463 bltu a5,a4,80003776 <bmap+0xcc>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
800036d2: 08052583 lw a1,128(a0)
800036d6: c5b5 beqz a1,80003742 <bmap+0x98>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
800036d8: 00092503 lw a0,0(s2)
800036dc: 00000097 auipc ra,0x0
800036e0: bda080e7 jalr -1062(ra) # 800032b6 <bread>
800036e4: 8a2a mv s4,a0
a = (uint*)bp->data;
800036e6: 05850793 addi a5,a0,88
if((addr = a[bn]) == 0){
800036ea: 02049713 slli a4,s1,0x20
800036ee: 01e75593 srli a1,a4,0x1e
800036f2: 00b784b3 add s1,a5,a1
800036f6: 0004a983 lw s3,0(s1)
800036fa: 04098e63 beqz s3,80003756 <bmap+0xac>
a[bn] = addr = balloc(ip->dev);
log_write(bp);
}
brelse(bp);
800036fe: 8552 mv a0,s4
80003700: 00000097 auipc ra,0x0
80003704: ce6080e7 jalr -794(ra) # 800033e6 <brelse>
return addr;
}
panic("bmap: out of range");
}
80003708: 854e mv a0,s3
8000370a: 70a2 ld ra,40(sp)
8000370c: 7402 ld s0,32(sp)
8000370e: 64e2 ld s1,24(sp)
80003710: 6942 ld s2,16(sp)
80003712: 69a2 ld s3,8(sp)
80003714: 6a02 ld s4,0(sp)
80003716: 6145 addi sp,sp,48
80003718: 8082 ret
if((addr = ip->addrs[bn]) == 0)
8000371a: 02059793 slli a5,a1,0x20
8000371e: 01e7d593 srli a1,a5,0x1e
80003722: 00b504b3 add s1,a0,a1
80003726: 0504a983 lw s3,80(s1)
8000372a: fc099fe3 bnez s3,80003708 <bmap+0x5e>
ip->addrs[bn] = addr = balloc(ip->dev);
8000372e: 4108 lw a0,0(a0)
80003730: 00000097 auipc ra,0x0
80003734: e48080e7 jalr -440(ra) # 80003578 <balloc>
80003738: 0005099b sext.w s3,a0
8000373c: 0534a823 sw s3,80(s1)
80003740: b7e1 j 80003708 <bmap+0x5e>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80003742: 4108 lw a0,0(a0)
80003744: 00000097 auipc ra,0x0
80003748: e34080e7 jalr -460(ra) # 80003578 <balloc>
8000374c: 0005059b sext.w a1,a0
80003750: 08b92023 sw a1,128(s2)
80003754: b751 j 800036d8 <bmap+0x2e>
a[bn] = addr = balloc(ip->dev);
80003756: 00092503 lw a0,0(s2)
8000375a: 00000097 auipc ra,0x0
8000375e: e1e080e7 jalr -482(ra) # 80003578 <balloc>
80003762: 0005099b sext.w s3,a0
80003766: 0134a023 sw s3,0(s1)
log_write(bp);
8000376a: 8552 mv a0,s4
8000376c: 00001097 auipc ra,0x1
80003770: efc080e7 jalr -260(ra) # 80004668 <log_write>
80003774: b769 j 800036fe <bmap+0x54>
panic("bmap: out of range");
80003776: 00005517 auipc a0,0x5
8000377a: f0a50513 addi a0,a0,-246 # 80008680 <syscalls+0x130>
8000377e: ffffd097 auipc ra,0xffffd
80003782: dac080e7 jalr -596(ra) # 8000052a <panic>
0000000080003786 <iget>:
{
80003786: 7179 addi sp,sp,-48
80003788: f406 sd ra,40(sp)
8000378a: f022 sd s0,32(sp)
8000378c: ec26 sd s1,24(sp)
8000378e: e84a sd s2,16(sp)
80003790: e44e sd s3,8(sp)
80003792: e052 sd s4,0(sp)
80003794: 1800 addi s0,sp,48
80003796: 89aa mv s3,a0
80003798: 8a2e mv s4,a1
acquire(&itable.lock);
8000379a: 0001d517 auipc a0,0x1d
8000379e: e2e50513 addi a0,a0,-466 # 800205c8 <itable>
800037a2: ffffd097 auipc ra,0xffffd
800037a6: 420080e7 jalr 1056(ra) # 80000bc2 <acquire>
empty = 0;
800037aa: 4901 li s2,0
for(ip = &itable.inode[0]; ip < &itable.inode[NINODE]; ip++){
800037ac: 0001d497 auipc s1,0x1d
800037b0: e3448493 addi s1,s1,-460 # 800205e0 <itable+0x18>
800037b4: 0001f697 auipc a3,0x1f
800037b8: 8bc68693 addi a3,a3,-1860 # 80022070 <log>
800037bc: a039 j 800037ca <iget+0x44>
if(empty == 0 && ip->ref == 0) // Remember empty slot.
800037be: 02090b63 beqz s2,800037f4 <iget+0x6e>
for(ip = &itable.inode[0]; ip < &itable.inode[NINODE]; ip++){
800037c2: 08848493 addi s1,s1,136
800037c6: 02d48a63 beq s1,a3,800037fa <iget+0x74>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
800037ca: 449c lw a5,8(s1)
800037cc: fef059e3 blez a5,800037be <iget+0x38>
800037d0: 4098 lw a4,0(s1)
800037d2: ff3716e3 bne a4,s3,800037be <iget+0x38>
800037d6: 40d8 lw a4,4(s1)
800037d8: ff4713e3 bne a4,s4,800037be <iget+0x38>
ip->ref++;
800037dc: 2785 addiw a5,a5,1
800037de: c49c sw a5,8(s1)
release(&itable.lock);
800037e0: 0001d517 auipc a0,0x1d
800037e4: de850513 addi a0,a0,-536 # 800205c8 <itable>
800037e8: ffffd097 auipc ra,0xffffd
800037ec: 48e080e7 jalr 1166(ra) # 80000c76 <release>
return ip;
800037f0: 8926 mv s2,s1
800037f2: a03d j 80003820 <iget+0x9a>
if(empty == 0 && ip->ref == 0) // Remember empty slot.
800037f4: f7f9 bnez a5,800037c2 <iget+0x3c>
800037f6: 8926 mv s2,s1
800037f8: b7e9 j 800037c2 <iget+0x3c>
if(empty == 0)
800037fa: 02090c63 beqz s2,80003832 <iget+0xac>
ip->dev = dev;
800037fe: 01392023 sw s3,0(s2)
ip->inum = inum;
80003802: 01492223 sw s4,4(s2)
ip->ref = 1;
80003806: 4785 li a5,1
80003808: 00f92423 sw a5,8(s2)
ip->valid = 0;
8000380c: 04092023 sw zero,64(s2)
release(&itable.lock);
80003810: 0001d517 auipc a0,0x1d
80003814: db850513 addi a0,a0,-584 # 800205c8 <itable>
80003818: ffffd097 auipc ra,0xffffd
8000381c: 45e080e7 jalr 1118(ra) # 80000c76 <release>
}
80003820: 854a mv a0,s2
80003822: 70a2 ld ra,40(sp)
80003824: 7402 ld s0,32(sp)
80003826: 64e2 ld s1,24(sp)
80003828: 6942 ld s2,16(sp)
8000382a: 69a2 ld s3,8(sp)
8000382c: 6a02 ld s4,0(sp)
8000382e: 6145 addi sp,sp,48
80003830: 8082 ret
panic("iget: no inodes");
80003832: 00005517 auipc a0,0x5
80003836: e6650513 addi a0,a0,-410 # 80008698 <syscalls+0x148>
8000383a: ffffd097 auipc ra,0xffffd
8000383e: cf0080e7 jalr -784(ra) # 8000052a <panic>
0000000080003842 <fsinit>:
fsinit(int dev) {
80003842: 7179 addi sp,sp,-48
80003844: f406 sd ra,40(sp)
80003846: f022 sd s0,32(sp)
80003848: ec26 sd s1,24(sp)
8000384a: e84a sd s2,16(sp)
8000384c: e44e sd s3,8(sp)
8000384e: 1800 addi s0,sp,48
80003850: 892a mv s2,a0
bp = bread(dev, 1);
80003852: 4585 li a1,1
80003854: 00000097 auipc ra,0x0
80003858: a62080e7 jalr -1438(ra) # 800032b6 <bread>
8000385c: 84aa mv s1,a0
memmove(sb, bp->data, sizeof(*sb));
8000385e: 0001d997 auipc s3,0x1d
80003862: d4a98993 addi s3,s3,-694 # 800205a8 <sb>
80003866: 02000613 li a2,32
8000386a: 05850593 addi a1,a0,88
8000386e: 854e mv a0,s3
80003870: ffffd097 auipc ra,0xffffd
80003874: 4aa080e7 jalr 1194(ra) # 80000d1a <memmove>
brelse(bp);
80003878: 8526 mv a0,s1
8000387a: 00000097 auipc ra,0x0
8000387e: b6c080e7 jalr -1172(ra) # 800033e6 <brelse>
if(sb.magic != FSMAGIC)
80003882: 0009a703 lw a4,0(s3)
80003886: 102037b7 lui a5,0x10203
8000388a: 04078793 addi a5,a5,64 # 10203040 <_entry-0x6fdfcfc0>
8000388e: 02f71263 bne a4,a5,800038b2 <fsinit+0x70>
initlog(dev, &sb);
80003892: 0001d597 auipc a1,0x1d
80003896: d1658593 addi a1,a1,-746 # 800205a8 <sb>
8000389a: 854a mv a0,s2
8000389c: 00001097 auipc ra,0x1
800038a0: b4e080e7 jalr -1202(ra) # 800043ea <initlog>
}
800038a4: 70a2 ld ra,40(sp)
800038a6: 7402 ld s0,32(sp)
800038a8: 64e2 ld s1,24(sp)
800038aa: 6942 ld s2,16(sp)
800038ac: 69a2 ld s3,8(sp)
800038ae: 6145 addi sp,sp,48
800038b0: 8082 ret
panic("invalid file system");
800038b2: 00005517 auipc a0,0x5
800038b6: df650513 addi a0,a0,-522 # 800086a8 <syscalls+0x158>
800038ba: ffffd097 auipc ra,0xffffd
800038be: c70080e7 jalr -912(ra) # 8000052a <panic>
00000000800038c2 <iinit>:
{
800038c2: 7179 addi sp,sp,-48
800038c4: f406 sd ra,40(sp)
800038c6: f022 sd s0,32(sp)
800038c8: ec26 sd s1,24(sp)
800038ca: e84a sd s2,16(sp)
800038cc: e44e sd s3,8(sp)
800038ce: 1800 addi s0,sp,48
initlock(&itable.lock, "itable");
800038d0: 00005597 auipc a1,0x5
800038d4: df058593 addi a1,a1,-528 # 800086c0 <syscalls+0x170>
800038d8: 0001d517 auipc a0,0x1d
800038dc: cf050513 addi a0,a0,-784 # 800205c8 <itable>
800038e0: ffffd097 auipc ra,0xffffd
800038e4: 252080e7 jalr 594(ra) # 80000b32 <initlock>
for(i = 0; i < NINODE; i++) {
800038e8: 0001d497 auipc s1,0x1d
800038ec: d0848493 addi s1,s1,-760 # 800205f0 <itable+0x28>
800038f0: 0001e997 auipc s3,0x1e
800038f4: 79098993 addi s3,s3,1936 # 80022080 <log+0x10>
initsleeplock(&itable.inode[i].lock, "inode");
800038f8: 00005917 auipc s2,0x5
800038fc: dd090913 addi s2,s2,-560 # 800086c8 <syscalls+0x178>
80003900: 85ca mv a1,s2
80003902: 8526 mv a0,s1
80003904: 00001097 auipc ra,0x1
80003908: e4a080e7 jalr -438(ra) # 8000474e <initsleeplock>
for(i = 0; i < NINODE; i++) {
8000390c: 08848493 addi s1,s1,136
80003910: ff3498e3 bne s1,s3,80003900 <iinit+0x3e>
}
80003914: 70a2 ld ra,40(sp)
80003916: 7402 ld s0,32(sp)
80003918: 64e2 ld s1,24(sp)
8000391a: 6942 ld s2,16(sp)
8000391c: 69a2 ld s3,8(sp)
8000391e: 6145 addi sp,sp,48
80003920: 8082 ret
0000000080003922 <ialloc>:
{
80003922: 715d addi sp,sp,-80
80003924: e486 sd ra,72(sp)
80003926: e0a2 sd s0,64(sp)
80003928: fc26 sd s1,56(sp)
8000392a: f84a sd s2,48(sp)
8000392c: f44e sd s3,40(sp)
8000392e: f052 sd s4,32(sp)
80003930: ec56 sd s5,24(sp)
80003932: e85a sd s6,16(sp)
80003934: e45e sd s7,8(sp)
80003936: 0880 addi s0,sp,80
for(inum = 1; inum < sb.ninodes; inum++){
80003938: 0001d717 auipc a4,0x1d
8000393c: c7c72703 lw a4,-900(a4) # 800205b4 <sb+0xc>
80003940: 4785 li a5,1
80003942: 04e7fa63 bgeu a5,a4,80003996 <ialloc+0x74>
80003946: 8aaa mv s5,a0
80003948: 8bae mv s7,a1
8000394a: 4485 li s1,1
bp = bread(dev, IBLOCK(inum, sb));
8000394c: 0001da17 auipc s4,0x1d
80003950: c5ca0a13 addi s4,s4,-932 # 800205a8 <sb>
80003954: 00048b1b sext.w s6,s1
80003958: 0044d793 srli a5,s1,0x4
8000395c: 018a2583 lw a1,24(s4)
80003960: 9dbd addw a1,a1,a5
80003962: 8556 mv a0,s5
80003964: 00000097 auipc ra,0x0
80003968: 952080e7 jalr -1710(ra) # 800032b6 <bread>
8000396c: 892a mv s2,a0
dip = (struct dinode*)bp->data + inum%IPB;
8000396e: 05850993 addi s3,a0,88
80003972: 00f4f793 andi a5,s1,15
80003976: 079a slli a5,a5,0x6
80003978: 99be add s3,s3,a5
if(dip->type == 0){ // a free inode
8000397a: 00099783 lh a5,0(s3)
8000397e: c785 beqz a5,800039a6 <ialloc+0x84>
brelse(bp);
80003980: 00000097 auipc ra,0x0
80003984: a66080e7 jalr -1434(ra) # 800033e6 <brelse>
for(inum = 1; inum < sb.ninodes; inum++){
80003988: 0485 addi s1,s1,1
8000398a: 00ca2703 lw a4,12(s4)
8000398e: 0004879b sext.w a5,s1
80003992: fce7e1e3 bltu a5,a4,80003954 <ialloc+0x32>
panic("ialloc: no inodes");
80003996: 00005517 auipc a0,0x5
8000399a: d3a50513 addi a0,a0,-710 # 800086d0 <syscalls+0x180>
8000399e: ffffd097 auipc ra,0xffffd
800039a2: b8c080e7 jalr -1140(ra) # 8000052a <panic>
memset(dip, 0, sizeof(*dip));
800039a6: 04000613 li a2,64
800039aa: 4581 li a1,0
800039ac: 854e mv a0,s3
800039ae: ffffd097 auipc ra,0xffffd
800039b2: 310080e7 jalr 784(ra) # 80000cbe <memset>
dip->type = type;
800039b6: 01799023 sh s7,0(s3)
log_write(bp); // mark it allocated on the disk
800039ba: 854a mv a0,s2
800039bc: 00001097 auipc ra,0x1
800039c0: cac080e7 jalr -852(ra) # 80004668 <log_write>
brelse(bp);
800039c4: 854a mv a0,s2
800039c6: 00000097 auipc ra,0x0
800039ca: a20080e7 jalr -1504(ra) # 800033e6 <brelse>
return iget(dev, inum);
800039ce: 85da mv a1,s6
800039d0: 8556 mv a0,s5
800039d2: 00000097 auipc ra,0x0
800039d6: db4080e7 jalr -588(ra) # 80003786 <iget>
}
800039da: 60a6 ld ra,72(sp)
800039dc: 6406 ld s0,64(sp)
800039de: 74e2 ld s1,56(sp)
800039e0: 7942 ld s2,48(sp)
800039e2: 79a2 ld s3,40(sp)
800039e4: 7a02 ld s4,32(sp)
800039e6: 6ae2 ld s5,24(sp)
800039e8: 6b42 ld s6,16(sp)
800039ea: 6ba2 ld s7,8(sp)
800039ec: 6161 addi sp,sp,80
800039ee: 8082 ret
00000000800039f0 <iupdate>:
{
800039f0: 1101 addi sp,sp,-32
800039f2: ec06 sd ra,24(sp)
800039f4: e822 sd s0,16(sp)
800039f6: e426 sd s1,8(sp)
800039f8: e04a sd s2,0(sp)
800039fa: 1000 addi s0,sp,32
800039fc: 84aa mv s1,a0
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
800039fe: 415c lw a5,4(a0)
80003a00: 0047d79b srliw a5,a5,0x4
80003a04: 0001d597 auipc a1,0x1d
80003a08: bbc5a583 lw a1,-1092(a1) # 800205c0 <sb+0x18>
80003a0c: 9dbd addw a1,a1,a5
80003a0e: 4108 lw a0,0(a0)
80003a10: 00000097 auipc ra,0x0
80003a14: 8a6080e7 jalr -1882(ra) # 800032b6 <bread>
80003a18: 892a mv s2,a0
dip = (struct dinode*)bp->data + ip->inum%IPB;
80003a1a: 05850793 addi a5,a0,88
80003a1e: 40c8 lw a0,4(s1)
80003a20: 893d andi a0,a0,15
80003a22: 051a slli a0,a0,0x6
80003a24: 953e add a0,a0,a5
dip->type = ip->type;
80003a26: 04449703 lh a4,68(s1)
80003a2a: 00e51023 sh a4,0(a0)
dip->major = ip->major;
80003a2e: 04649703 lh a4,70(s1)
80003a32: 00e51123 sh a4,2(a0)
dip->minor = ip->minor;
80003a36: 04849703 lh a4,72(s1)
80003a3a: 00e51223 sh a4,4(a0)
dip->nlink = ip->nlink;
80003a3e: 04a49703 lh a4,74(s1)
80003a42: 00e51323 sh a4,6(a0)
dip->size = ip->size;
80003a46: 44f8 lw a4,76(s1)
80003a48: c518 sw a4,8(a0)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80003a4a: 03400613 li a2,52
80003a4e: 05048593 addi a1,s1,80
80003a52: 0531 addi a0,a0,12
80003a54: ffffd097 auipc ra,0xffffd
80003a58: 2c6080e7 jalr 710(ra) # 80000d1a <memmove>
log_write(bp);
80003a5c: 854a mv a0,s2
80003a5e: 00001097 auipc ra,0x1
80003a62: c0a080e7 jalr -1014(ra) # 80004668 <log_write>
brelse(bp);
80003a66: 854a mv a0,s2
80003a68: 00000097 auipc ra,0x0
80003a6c: 97e080e7 jalr -1666(ra) # 800033e6 <brelse>
}
80003a70: 60e2 ld ra,24(sp)
80003a72: 6442 ld s0,16(sp)
80003a74: 64a2 ld s1,8(sp)
80003a76: 6902 ld s2,0(sp)
80003a78: 6105 addi sp,sp,32
80003a7a: 8082 ret
0000000080003a7c <idup>:
{
80003a7c: 1101 addi sp,sp,-32
80003a7e: ec06 sd ra,24(sp)
80003a80: e822 sd s0,16(sp)
80003a82: e426 sd s1,8(sp)
80003a84: 1000 addi s0,sp,32
80003a86: 84aa mv s1,a0
acquire(&itable.lock);
80003a88: 0001d517 auipc a0,0x1d
80003a8c: b4050513 addi a0,a0,-1216 # 800205c8 <itable>
80003a90: ffffd097 auipc ra,0xffffd
80003a94: 132080e7 jalr 306(ra) # 80000bc2 <acquire>
ip->ref++;
80003a98: 449c lw a5,8(s1)
80003a9a: 2785 addiw a5,a5,1
80003a9c: c49c sw a5,8(s1)
release(&itable.lock);
80003a9e: 0001d517 auipc a0,0x1d
80003aa2: b2a50513 addi a0,a0,-1238 # 800205c8 <itable>
80003aa6: ffffd097 auipc ra,0xffffd
80003aaa: 1d0080e7 jalr 464(ra) # 80000c76 <release>
}
80003aae: 8526 mv a0,s1
80003ab0: 60e2 ld ra,24(sp)
80003ab2: 6442 ld s0,16(sp)
80003ab4: 64a2 ld s1,8(sp)
80003ab6: 6105 addi sp,sp,32
80003ab8: 8082 ret
0000000080003aba <ilock>:
{
80003aba: 1101 addi sp,sp,-32
80003abc: ec06 sd ra,24(sp)
80003abe: e822 sd s0,16(sp)
80003ac0: e426 sd s1,8(sp)
80003ac2: e04a sd s2,0(sp)
80003ac4: 1000 addi s0,sp,32
if(ip == 0 || ip->ref < 1)
80003ac6: c115 beqz a0,80003aea <ilock+0x30>
80003ac8: 84aa mv s1,a0
80003aca: 451c lw a5,8(a0)
80003acc: 00f05f63 blez a5,80003aea <ilock+0x30>
acquiresleep(&ip->lock);
80003ad0: 0541 addi a0,a0,16
80003ad2: 00001097 auipc ra,0x1
80003ad6: cb6080e7 jalr -842(ra) # 80004788 <acquiresleep>
if(ip->valid == 0){
80003ada: 40bc lw a5,64(s1)
80003adc: cf99 beqz a5,80003afa <ilock+0x40>
}
80003ade: 60e2 ld ra,24(sp)
80003ae0: 6442 ld s0,16(sp)
80003ae2: 64a2 ld s1,8(sp)
80003ae4: 6902 ld s2,0(sp)
80003ae6: 6105 addi sp,sp,32
80003ae8: 8082 ret
panic("ilock");
80003aea: 00005517 auipc a0,0x5
80003aee: bfe50513 addi a0,a0,-1026 # 800086e8 <syscalls+0x198>
80003af2: ffffd097 auipc ra,0xffffd
80003af6: a38080e7 jalr -1480(ra) # 8000052a <panic>
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80003afa: 40dc lw a5,4(s1)
80003afc: 0047d79b srliw a5,a5,0x4
80003b00: 0001d597 auipc a1,0x1d
80003b04: ac05a583 lw a1,-1344(a1) # 800205c0 <sb+0x18>
80003b08: 9dbd addw a1,a1,a5
80003b0a: 4088 lw a0,0(s1)
80003b0c: fffff097 auipc ra,0xfffff
80003b10: 7aa080e7 jalr 1962(ra) # 800032b6 <bread>
80003b14: 892a mv s2,a0
dip = (struct dinode*)bp->data + ip->inum%IPB;
80003b16: 05850593 addi a1,a0,88
80003b1a: 40dc lw a5,4(s1)
80003b1c: 8bbd andi a5,a5,15
80003b1e: 079a slli a5,a5,0x6
80003b20: 95be add a1,a1,a5
ip->type = dip->type;
80003b22: 00059783 lh a5,0(a1)
80003b26: 04f49223 sh a5,68(s1)
ip->major = dip->major;
80003b2a: 00259783 lh a5,2(a1)
80003b2e: 04f49323 sh a5,70(s1)
ip->minor = dip->minor;
80003b32: 00459783 lh a5,4(a1)
80003b36: 04f49423 sh a5,72(s1)
ip->nlink = dip->nlink;
80003b3a: 00659783 lh a5,6(a1)
80003b3e: 04f49523 sh a5,74(s1)
ip->size = dip->size;
80003b42: 459c lw a5,8(a1)
80003b44: c4fc sw a5,76(s1)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80003b46: 03400613 li a2,52
80003b4a: 05b1 addi a1,a1,12
80003b4c: 05048513 addi a0,s1,80
80003b50: ffffd097 auipc ra,0xffffd
80003b54: 1ca080e7 jalr 458(ra) # 80000d1a <memmove>
brelse(bp);
80003b58: 854a mv a0,s2
80003b5a: 00000097 auipc ra,0x0
80003b5e: 88c080e7 jalr -1908(ra) # 800033e6 <brelse>
ip->valid = 1;
80003b62: 4785 li a5,1
80003b64: c0bc sw a5,64(s1)
if(ip->type == 0)
80003b66: 04449783 lh a5,68(s1)
80003b6a: fbb5 bnez a5,80003ade <ilock+0x24>
panic("ilock: no type");
80003b6c: 00005517 auipc a0,0x5
80003b70: b8450513 addi a0,a0,-1148 # 800086f0 <syscalls+0x1a0>
80003b74: ffffd097 auipc ra,0xffffd
80003b78: 9b6080e7 jalr -1610(ra) # 8000052a <panic>
0000000080003b7c <iunlock>:
{
80003b7c: 1101 addi sp,sp,-32
80003b7e: ec06 sd ra,24(sp)
80003b80: e822 sd s0,16(sp)
80003b82: e426 sd s1,8(sp)
80003b84: e04a sd s2,0(sp)
80003b86: 1000 addi s0,sp,32
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
80003b88: c905 beqz a0,80003bb8 <iunlock+0x3c>
80003b8a: 84aa mv s1,a0
80003b8c: 01050913 addi s2,a0,16
80003b90: 854a mv a0,s2
80003b92: 00001097 auipc ra,0x1
80003b96: c90080e7 jalr -880(ra) # 80004822 <holdingsleep>
80003b9a: cd19 beqz a0,80003bb8 <iunlock+0x3c>
80003b9c: 449c lw a5,8(s1)
80003b9e: 00f05d63 blez a5,80003bb8 <iunlock+0x3c>
releasesleep(&ip->lock);
80003ba2: 854a mv a0,s2
80003ba4: 00001097 auipc ra,0x1
80003ba8: c3a080e7 jalr -966(ra) # 800047de <releasesleep>
}
80003bac: 60e2 ld ra,24(sp)
80003bae: 6442 ld s0,16(sp)
80003bb0: 64a2 ld s1,8(sp)
80003bb2: 6902 ld s2,0(sp)
80003bb4: 6105 addi sp,sp,32
80003bb6: 8082 ret
panic("iunlock");
80003bb8: 00005517 auipc a0,0x5
80003bbc: b4850513 addi a0,a0,-1208 # 80008700 <syscalls+0x1b0>
80003bc0: ffffd097 auipc ra,0xffffd
80003bc4: 96a080e7 jalr -1686(ra) # 8000052a <panic>
0000000080003bc8 <itrunc>:
// Truncate inode (discard contents).
// Caller must hold ip->lock.
void
itrunc(struct inode *ip)
{
80003bc8: 7179 addi sp,sp,-48
80003bca: f406 sd ra,40(sp)
80003bcc: f022 sd s0,32(sp)
80003bce: ec26 sd s1,24(sp)
80003bd0: e84a sd s2,16(sp)
80003bd2: e44e sd s3,8(sp)
80003bd4: e052 sd s4,0(sp)
80003bd6: 1800 addi s0,sp,48
80003bd8: 89aa mv s3,a0
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80003bda: 05050493 addi s1,a0,80
80003bde: 08050913 addi s2,a0,128
80003be2: a021 j 80003bea <itrunc+0x22>
80003be4: 0491 addi s1,s1,4
80003be6: 01248d63 beq s1,s2,80003c00 <itrunc+0x38>
if(ip->addrs[i]){
80003bea: 408c lw a1,0(s1)
80003bec: dde5 beqz a1,80003be4 <itrunc+0x1c>
bfree(ip->dev, ip->addrs[i]);
80003bee: 0009a503 lw a0,0(s3)
80003bf2: 00000097 auipc ra,0x0
80003bf6: 90a080e7 jalr -1782(ra) # 800034fc <bfree>
ip->addrs[i] = 0;
80003bfa: 0004a023 sw zero,0(s1)
80003bfe: b7dd j 80003be4 <itrunc+0x1c>
}
}
if(ip->addrs[NDIRECT]){
80003c00: 0809a583 lw a1,128(s3)
80003c04: e185 bnez a1,80003c24 <itrunc+0x5c>
brelse(bp);
bfree(ip->dev, ip->addrs[NDIRECT]);
ip->addrs[NDIRECT] = 0;
}
ip->size = 0;
80003c06: 0409a623 sw zero,76(s3)
iupdate(ip);
80003c0a: 854e mv a0,s3
80003c0c: 00000097 auipc ra,0x0
80003c10: de4080e7 jalr -540(ra) # 800039f0 <iupdate>
}
80003c14: 70a2 ld ra,40(sp)
80003c16: 7402 ld s0,32(sp)
80003c18: 64e2 ld s1,24(sp)
80003c1a: 6942 ld s2,16(sp)
80003c1c: 69a2 ld s3,8(sp)
80003c1e: 6a02 ld s4,0(sp)
80003c20: 6145 addi sp,sp,48
80003c22: 8082 ret
bp = bread(ip->dev, ip->addrs[NDIRECT]);
80003c24: 0009a503 lw a0,0(s3)
80003c28: fffff097 auipc ra,0xfffff
80003c2c: 68e080e7 jalr 1678(ra) # 800032b6 <bread>
80003c30: 8a2a mv s4,a0
for(j = 0; j < NINDIRECT; j++){
80003c32: 05850493 addi s1,a0,88
80003c36: 45850913 addi s2,a0,1112
80003c3a: a021 j 80003c42 <itrunc+0x7a>
80003c3c: 0491 addi s1,s1,4
80003c3e: 01248b63 beq s1,s2,80003c54 <itrunc+0x8c>
if(a[j])
80003c42: 408c lw a1,0(s1)
80003c44: dde5 beqz a1,80003c3c <itrunc+0x74>
bfree(ip->dev, a[j]);
80003c46: 0009a503 lw a0,0(s3)
80003c4a: 00000097 auipc ra,0x0
80003c4e: 8b2080e7 jalr -1870(ra) # 800034fc <bfree>
80003c52: b7ed j 80003c3c <itrunc+0x74>
brelse(bp);
80003c54: 8552 mv a0,s4
80003c56: fffff097 auipc ra,0xfffff
80003c5a: 790080e7 jalr 1936(ra) # 800033e6 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
80003c5e: 0809a583 lw a1,128(s3)
80003c62: 0009a503 lw a0,0(s3)
80003c66: 00000097 auipc ra,0x0
80003c6a: 896080e7 jalr -1898(ra) # 800034fc <bfree>
ip->addrs[NDIRECT] = 0;
80003c6e: 0809a023 sw zero,128(s3)
80003c72: bf51 j 80003c06 <itrunc+0x3e>
0000000080003c74 <iput>:
{
80003c74: 1101 addi sp,sp,-32
80003c76: ec06 sd ra,24(sp)
80003c78: e822 sd s0,16(sp)
80003c7a: e426 sd s1,8(sp)
80003c7c: e04a sd s2,0(sp)
80003c7e: 1000 addi s0,sp,32
80003c80: 84aa mv s1,a0
acquire(&itable.lock);
80003c82: 0001d517 auipc a0,0x1d
80003c86: 94650513 addi a0,a0,-1722 # 800205c8 <itable>
80003c8a: ffffd097 auipc ra,0xffffd
80003c8e: f38080e7 jalr -200(ra) # 80000bc2 <acquire>
if(ip->ref == 1 && ip->valid && ip->nlink == 0){
80003c92: 4498 lw a4,8(s1)
80003c94: 4785 li a5,1
80003c96: 02f70363 beq a4,a5,80003cbc <iput+0x48>
ip->ref--;
80003c9a: 449c lw a5,8(s1)
80003c9c: 37fd addiw a5,a5,-1
80003c9e: c49c sw a5,8(s1)
release(&itable.lock);
80003ca0: 0001d517 auipc a0,0x1d
80003ca4: 92850513 addi a0,a0,-1752 # 800205c8 <itable>
80003ca8: ffffd097 auipc ra,0xffffd
80003cac: fce080e7 jalr -50(ra) # 80000c76 <release>
}
80003cb0: 60e2 ld ra,24(sp)
80003cb2: 6442 ld s0,16(sp)
80003cb4: 64a2 ld s1,8(sp)
80003cb6: 6902 ld s2,0(sp)
80003cb8: 6105 addi sp,sp,32
80003cba: 8082 ret
if(ip->ref == 1 && ip->valid && ip->nlink == 0){
80003cbc: 40bc lw a5,64(s1)
80003cbe: dff1 beqz a5,80003c9a <iput+0x26>
80003cc0: 04a49783 lh a5,74(s1)
80003cc4: fbf9 bnez a5,80003c9a <iput+0x26>
acquiresleep(&ip->lock);
80003cc6: 01048913 addi s2,s1,16
80003cca: 854a mv a0,s2
80003ccc: 00001097 auipc ra,0x1
80003cd0: abc080e7 jalr -1348(ra) # 80004788 <acquiresleep>
release(&itable.lock);
80003cd4: 0001d517 auipc a0,0x1d
80003cd8: 8f450513 addi a0,a0,-1804 # 800205c8 <itable>
80003cdc: ffffd097 auipc ra,0xffffd
80003ce0: f9a080e7 jalr -102(ra) # 80000c76 <release>
itrunc(ip);
80003ce4: 8526 mv a0,s1
80003ce6: 00000097 auipc ra,0x0
80003cea: ee2080e7 jalr -286(ra) # 80003bc8 <itrunc>
ip->type = 0;
80003cee: 04049223 sh zero,68(s1)
iupdate(ip);
80003cf2: 8526 mv a0,s1
80003cf4: 00000097 auipc ra,0x0
80003cf8: cfc080e7 jalr -772(ra) # 800039f0 <iupdate>
ip->valid = 0;
80003cfc: 0404a023 sw zero,64(s1)
releasesleep(&ip->lock);
80003d00: 854a mv a0,s2
80003d02: 00001097 auipc ra,0x1
80003d06: adc080e7 jalr -1316(ra) # 800047de <releasesleep>
acquire(&itable.lock);
80003d0a: 0001d517 auipc a0,0x1d
80003d0e: 8be50513 addi a0,a0,-1858 # 800205c8 <itable>
80003d12: ffffd097 auipc ra,0xffffd
80003d16: eb0080e7 jalr -336(ra) # 80000bc2 <acquire>
80003d1a: b741 j 80003c9a <iput+0x26>
0000000080003d1c <iunlockput>:
{
80003d1c: 1101 addi sp,sp,-32
80003d1e: ec06 sd ra,24(sp)
80003d20: e822 sd s0,16(sp)
80003d22: e426 sd s1,8(sp)
80003d24: 1000 addi s0,sp,32
80003d26: 84aa mv s1,a0
iunlock(ip);
80003d28: 00000097 auipc ra,0x0
80003d2c: e54080e7 jalr -428(ra) # 80003b7c <iunlock>
iput(ip);
80003d30: 8526 mv a0,s1
80003d32: 00000097 auipc ra,0x0
80003d36: f42080e7 jalr -190(ra) # 80003c74 <iput>
}
80003d3a: 60e2 ld ra,24(sp)
80003d3c: 6442 ld s0,16(sp)
80003d3e: 64a2 ld s1,8(sp)
80003d40: 6105 addi sp,sp,32
80003d42: 8082 ret
0000000080003d44 <stati>:
// Copy stat information from inode.
// Caller must hold ip->lock.
void
stati(struct inode *ip, struct stat *st)
{
80003d44: 1141 addi sp,sp,-16
80003d46: e422 sd s0,8(sp)
80003d48: 0800 addi s0,sp,16
st->dev = ip->dev;
80003d4a: 411c lw a5,0(a0)
80003d4c: c19c sw a5,0(a1)
st->ino = ip->inum;
80003d4e: 415c lw a5,4(a0)
80003d50: c1dc sw a5,4(a1)
st->type = ip->type;
80003d52: 04451783 lh a5,68(a0)
80003d56: 00f59423 sh a5,8(a1)
st->nlink = ip->nlink;
80003d5a: 04a51783 lh a5,74(a0)
80003d5e: 00f59523 sh a5,10(a1)
st->size = ip->size;
80003d62: 04c56783 lwu a5,76(a0)
80003d66: e99c sd a5,16(a1)
}
80003d68: 6422 ld s0,8(sp)
80003d6a: 0141 addi sp,sp,16
80003d6c: 8082 ret
0000000080003d6e <readi>:
readi(struct inode *ip, int user_dst, uint64 dst, uint off, uint n)
{
uint tot, m;
struct buf *bp;
if(off > ip->size || off + n < off)
80003d6e: 457c lw a5,76(a0)
80003d70: 0ed7e963 bltu a5,a3,80003e62 <readi+0xf4>
{
80003d74: 7159 addi sp,sp,-112
80003d76: f486 sd ra,104(sp)
80003d78: f0a2 sd s0,96(sp)
80003d7a: eca6 sd s1,88(sp)
80003d7c: e8ca sd s2,80(sp)
80003d7e: e4ce sd s3,72(sp)
80003d80: e0d2 sd s4,64(sp)
80003d82: fc56 sd s5,56(sp)
80003d84: f85a sd s6,48(sp)
80003d86: f45e sd s7,40(sp)
80003d88: f062 sd s8,32(sp)
80003d8a: ec66 sd s9,24(sp)
80003d8c: e86a sd s10,16(sp)
80003d8e: e46e sd s11,8(sp)
80003d90: 1880 addi s0,sp,112
80003d92: 8baa mv s7,a0
80003d94: 8c2e mv s8,a1
80003d96: 8ab2 mv s5,a2
80003d98: 84b6 mv s1,a3
80003d9a: 8b3a mv s6,a4
if(off > ip->size || off + n < off)
80003d9c: 9f35 addw a4,a4,a3
return 0;
80003d9e: 4501 li a0,0
if(off > ip->size || off + n < off)
80003da0: 0ad76063 bltu a4,a3,80003e40 <readi+0xd2>
if(off + n > ip->size)
80003da4: 00e7f463 bgeu a5,a4,80003dac <readi+0x3e>
n = ip->size - off;
80003da8: 40d78b3b subw s6,a5,a3
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80003dac: 0a0b0963 beqz s6,80003e5e <readi+0xf0>
80003db0: 4981 li s3,0
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
80003db2: 40000d13 li s10,1024
if(either_copyout(user_dst, dst, bp->data + (off % BSIZE), m) == -1) {
80003db6: 5cfd li s9,-1
80003db8: a82d j 80003df2 <readi+0x84>
80003dba: 020a1d93 slli s11,s4,0x20
80003dbe: 020ddd93 srli s11,s11,0x20
80003dc2: 05890793 addi a5,s2,88
80003dc6: 86ee mv a3,s11
80003dc8: 963e add a2,a2,a5
80003dca: 85d6 mv a1,s5
80003dcc: 8562 mv a0,s8
80003dce: fffff097 auipc ra,0xfffff
80003dd2: 8d4080e7 jalr -1836(ra) # 800026a2 <either_copyout>
80003dd6: 05950d63 beq a0,s9,80003e30 <readi+0xc2>
brelse(bp);
tot = -1;
break;
}
brelse(bp);
80003dda: 854a mv a0,s2
80003ddc: fffff097 auipc ra,0xfffff
80003de0: 60a080e7 jalr 1546(ra) # 800033e6 <brelse>
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80003de4: 013a09bb addw s3,s4,s3
80003de8: 009a04bb addw s1,s4,s1
80003dec: 9aee add s5,s5,s11
80003dee: 0569f763 bgeu s3,s6,80003e3c <readi+0xce>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80003df2: 000ba903 lw s2,0(s7)
80003df6: 00a4d59b srliw a1,s1,0xa
80003dfa: 855e mv a0,s7
80003dfc: 00000097 auipc ra,0x0
80003e00: 8ae080e7 jalr -1874(ra) # 800036aa <bmap>
80003e04: 0005059b sext.w a1,a0
80003e08: 854a mv a0,s2
80003e0a: fffff097 auipc ra,0xfffff
80003e0e: 4ac080e7 jalr 1196(ra) # 800032b6 <bread>
80003e12: 892a mv s2,a0
m = min(n - tot, BSIZE - off%BSIZE);
80003e14: 3ff4f613 andi a2,s1,1023
80003e18: 40cd07bb subw a5,s10,a2
80003e1c: 413b073b subw a4,s6,s3
80003e20: 8a3e mv s4,a5
80003e22: 2781 sext.w a5,a5
80003e24: 0007069b sext.w a3,a4
80003e28: f8f6f9e3 bgeu a3,a5,80003dba <readi+0x4c>
80003e2c: 8a3a mv s4,a4
80003e2e: b771 j 80003dba <readi+0x4c>
brelse(bp);
80003e30: 854a mv a0,s2
80003e32: fffff097 auipc ra,0xfffff
80003e36: 5b4080e7 jalr 1460(ra) # 800033e6 <brelse>
tot = -1;
80003e3a: 59fd li s3,-1
}
return tot;
80003e3c: 0009851b sext.w a0,s3
}
80003e40: 70a6 ld ra,104(sp)
80003e42: 7406 ld s0,96(sp)
80003e44: 64e6 ld s1,88(sp)
80003e46: 6946 ld s2,80(sp)
80003e48: 69a6 ld s3,72(sp)
80003e4a: 6a06 ld s4,64(sp)
80003e4c: 7ae2 ld s5,56(sp)
80003e4e: 7b42 ld s6,48(sp)
80003e50: 7ba2 ld s7,40(sp)
80003e52: 7c02 ld s8,32(sp)
80003e54: 6ce2 ld s9,24(sp)
80003e56: 6d42 ld s10,16(sp)
80003e58: 6da2 ld s11,8(sp)
80003e5a: 6165 addi sp,sp,112
80003e5c: 8082 ret
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80003e5e: 89da mv s3,s6
80003e60: bff1 j 80003e3c <readi+0xce>
return 0;
80003e62: 4501 li a0,0
}
80003e64: 8082 ret
0000000080003e66 <writei>:
writei(struct inode *ip, int user_src, uint64 src, uint off, uint n)
{
uint tot, m;
struct buf *bp;
if(off > ip->size || off + n < off)
80003e66: 457c lw a5,76(a0)
80003e68: 10d7e863 bltu a5,a3,80003f78 <writei+0x112>
{
80003e6c: 7159 addi sp,sp,-112
80003e6e: f486 sd ra,104(sp)
80003e70: f0a2 sd s0,96(sp)
80003e72: eca6 sd s1,88(sp)
80003e74: e8ca sd s2,80(sp)
80003e76: e4ce sd s3,72(sp)
80003e78: e0d2 sd s4,64(sp)
80003e7a: fc56 sd s5,56(sp)
80003e7c: f85a sd s6,48(sp)
80003e7e: f45e sd s7,40(sp)
80003e80: f062 sd s8,32(sp)
80003e82: ec66 sd s9,24(sp)
80003e84: e86a sd s10,16(sp)
80003e86: e46e sd s11,8(sp)
80003e88: 1880 addi s0,sp,112
80003e8a: 8b2a mv s6,a0
80003e8c: 8c2e mv s8,a1
80003e8e: 8ab2 mv s5,a2
80003e90: 8936 mv s2,a3
80003e92: 8bba mv s7,a4
if(off > ip->size || off + n < off)
80003e94: 00e687bb addw a5,a3,a4
80003e98: 0ed7e263 bltu a5,a3,80003f7c <writei+0x116>
return -1;
if(off + n > MAXFILE*BSIZE)
80003e9c: 00043737 lui a4,0x43
80003ea0: 0ef76063 bltu a4,a5,80003f80 <writei+0x11a>
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80003ea4: 0c0b8863 beqz s7,80003f74 <writei+0x10e>
80003ea8: 4a01 li s4,0
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
80003eaa: 40000d13 li s10,1024
if(either_copyin(bp->data + (off % BSIZE), user_src, src, m) == -1) {
80003eae: 5cfd li s9,-1
80003eb0: a091 j 80003ef4 <writei+0x8e>
80003eb2: 02099d93 slli s11,s3,0x20
80003eb6: 020ddd93 srli s11,s11,0x20
80003eba: 05848793 addi a5,s1,88
80003ebe: 86ee mv a3,s11
80003ec0: 8656 mv a2,s5
80003ec2: 85e2 mv a1,s8
80003ec4: 953e add a0,a0,a5
80003ec6: fffff097 auipc ra,0xfffff
80003eca: 832080e7 jalr -1998(ra) # 800026f8 <either_copyin>
80003ece: 07950263 beq a0,s9,80003f32 <writei+0xcc>
brelse(bp);
break;
}
log_write(bp);
80003ed2: 8526 mv a0,s1
80003ed4: 00000097 auipc ra,0x0
80003ed8: 794080e7 jalr 1940(ra) # 80004668 <log_write>
brelse(bp);
80003edc: 8526 mv a0,s1
80003ede: fffff097 auipc ra,0xfffff
80003ee2: 508080e7 jalr 1288(ra) # 800033e6 <brelse>
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80003ee6: 01498a3b addw s4,s3,s4
80003eea: 0129893b addw s2,s3,s2
80003eee: 9aee add s5,s5,s11
80003ef0: 057a7663 bgeu s4,s7,80003f3c <writei+0xd6>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80003ef4: 000b2483 lw s1,0(s6)
80003ef8: 00a9559b srliw a1,s2,0xa
80003efc: 855a mv a0,s6
80003efe: fffff097 auipc ra,0xfffff
80003f02: 7ac080e7 jalr 1964(ra) # 800036aa <bmap>
80003f06: 0005059b sext.w a1,a0
80003f0a: 8526 mv a0,s1
80003f0c: fffff097 auipc ra,0xfffff
80003f10: 3aa080e7 jalr 938(ra) # 800032b6 <bread>
80003f14: 84aa mv s1,a0
m = min(n - tot, BSIZE - off%BSIZE);
80003f16: 3ff97513 andi a0,s2,1023
80003f1a: 40ad07bb subw a5,s10,a0
80003f1e: 414b873b subw a4,s7,s4
80003f22: 89be mv s3,a5
80003f24: 2781 sext.w a5,a5
80003f26: 0007069b sext.w a3,a4
80003f2a: f8f6f4e3 bgeu a3,a5,80003eb2 <writei+0x4c>
80003f2e: 89ba mv s3,a4
80003f30: b749 j 80003eb2 <writei+0x4c>
brelse(bp);
80003f32: 8526 mv a0,s1
80003f34: fffff097 auipc ra,0xfffff
80003f38: 4b2080e7 jalr 1202(ra) # 800033e6 <brelse>
}
if(off > ip->size)
80003f3c: 04cb2783 lw a5,76(s6)
80003f40: 0127f463 bgeu a5,s2,80003f48 <writei+0xe2>
ip->size = off;
80003f44: 052b2623 sw s2,76(s6)
// write the i-node back to disk even if the size didn't change
// because the loop above might have called bmap() and added a new
// block to ip->addrs[].
iupdate(ip);
80003f48: 855a mv a0,s6
80003f4a: 00000097 auipc ra,0x0
80003f4e: aa6080e7 jalr -1370(ra) # 800039f0 <iupdate>
return tot;
80003f52: 000a051b sext.w a0,s4
}
80003f56: 70a6 ld ra,104(sp)
80003f58: 7406 ld s0,96(sp)
80003f5a: 64e6 ld s1,88(sp)
80003f5c: 6946 ld s2,80(sp)
80003f5e: 69a6 ld s3,72(sp)
80003f60: 6a06 ld s4,64(sp)
80003f62: 7ae2 ld s5,56(sp)
80003f64: 7b42 ld s6,48(sp)
80003f66: 7ba2 ld s7,40(sp)
80003f68: 7c02 ld s8,32(sp)
80003f6a: 6ce2 ld s9,24(sp)
80003f6c: 6d42 ld s10,16(sp)
80003f6e: 6da2 ld s11,8(sp)
80003f70: 6165 addi sp,sp,112
80003f72: 8082 ret
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80003f74: 8a5e mv s4,s7
80003f76: bfc9 j 80003f48 <writei+0xe2>
return -1;
80003f78: 557d li a0,-1
}
80003f7a: 8082 ret
return -1;
80003f7c: 557d li a0,-1
80003f7e: bfe1 j 80003f56 <writei+0xf0>
return -1;
80003f80: 557d li a0,-1
80003f82: bfd1 j 80003f56 <writei+0xf0>
0000000080003f84 <namecmp>:
// Directories
int
namecmp(const char *s, const char *t)
{
80003f84: 1141 addi sp,sp,-16
80003f86: e406 sd ra,8(sp)
80003f88: e022 sd s0,0(sp)
80003f8a: 0800 addi s0,sp,16
return strncmp(s, t, DIRSIZ);
80003f8c: 4639 li a2,14
80003f8e: ffffd097 auipc ra,0xffffd
80003f92: e08080e7 jalr -504(ra) # 80000d96 <strncmp>
}
80003f96: 60a2 ld ra,8(sp)
80003f98: 6402 ld s0,0(sp)
80003f9a: 0141 addi sp,sp,16
80003f9c: 8082 ret
0000000080003f9e <dirlookup>:
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
80003f9e: 7139 addi sp,sp,-64
80003fa0: fc06 sd ra,56(sp)
80003fa2: f822 sd s0,48(sp)
80003fa4: f426 sd s1,40(sp)
80003fa6: f04a sd s2,32(sp)
80003fa8: ec4e sd s3,24(sp)
80003faa: e852 sd s4,16(sp)
80003fac: 0080 addi s0,sp,64
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
80003fae: 04451703 lh a4,68(a0)
80003fb2: 4785 li a5,1
80003fb4: 00f71a63 bne a4,a5,80003fc8 <dirlookup+0x2a>
80003fb8: 892a mv s2,a0
80003fba: 89ae mv s3,a1
80003fbc: 8a32 mv s4,a2
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80003fbe: 457c lw a5,76(a0)
80003fc0: 4481 li s1,0
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
80003fc2: 4501 li a0,0
for(off = 0; off < dp->size; off += sizeof(de)){
80003fc4: e79d bnez a5,80003ff2 <dirlookup+0x54>
80003fc6: a8a5 j 8000403e <dirlookup+0xa0>
panic("dirlookup not DIR");
80003fc8: 00004517 auipc a0,0x4
80003fcc: 74050513 addi a0,a0,1856 # 80008708 <syscalls+0x1b8>
80003fd0: ffffc097 auipc ra,0xffffc
80003fd4: 55a080e7 jalr 1370(ra) # 8000052a <panic>
panic("dirlookup read");
80003fd8: 00004517 auipc a0,0x4
80003fdc: 74850513 addi a0,a0,1864 # 80008720 <syscalls+0x1d0>
80003fe0: ffffc097 auipc ra,0xffffc
80003fe4: 54a080e7 jalr 1354(ra) # 8000052a <panic>
for(off = 0; off < dp->size; off += sizeof(de)){
80003fe8: 24c1 addiw s1,s1,16
80003fea: 04c92783 lw a5,76(s2)
80003fee: 04f4f763 bgeu s1,a5,8000403c <dirlookup+0x9e>
if(readi(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de))
80003ff2: 4741 li a4,16
80003ff4: 86a6 mv a3,s1
80003ff6: fc040613 addi a2,s0,-64
80003ffa: 4581 li a1,0
80003ffc: 854a mv a0,s2
80003ffe: 00000097 auipc ra,0x0
80004002: d70080e7 jalr -656(ra) # 80003d6e <readi>
80004006: 47c1 li a5,16
80004008: fcf518e3 bne a0,a5,80003fd8 <dirlookup+0x3a>
if(de.inum == 0)
8000400c: fc045783 lhu a5,-64(s0)
80004010: dfe1 beqz a5,80003fe8 <dirlookup+0x4a>
if(namecmp(name, de.name) == 0){
80004012: fc240593 addi a1,s0,-62
80004016: 854e mv a0,s3
80004018: 00000097 auipc ra,0x0
8000401c: f6c080e7 jalr -148(ra) # 80003f84 <namecmp>
80004020: f561 bnez a0,80003fe8 <dirlookup+0x4a>
if(poff)
80004022: 000a0463 beqz s4,8000402a <dirlookup+0x8c>
*poff = off;
80004026: 009a2023 sw s1,0(s4)
return iget(dp->dev, inum);
8000402a: fc045583 lhu a1,-64(s0)
8000402e: 00092503 lw a0,0(s2)
80004032: fffff097 auipc ra,0xfffff
80004036: 754080e7 jalr 1876(ra) # 80003786 <iget>
8000403a: a011 j 8000403e <dirlookup+0xa0>
return 0;
8000403c: 4501 li a0,0
}
8000403e: 70e2 ld ra,56(sp)
80004040: 7442 ld s0,48(sp)
80004042: 74a2 ld s1,40(sp)
80004044: 7902 ld s2,32(sp)
80004046: 69e2 ld s3,24(sp)
80004048: 6a42 ld s4,16(sp)
8000404a: 6121 addi sp,sp,64
8000404c: 8082 ret
000000008000404e <namex>:
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
8000404e: 711d addi sp,sp,-96
80004050: ec86 sd ra,88(sp)
80004052: e8a2 sd s0,80(sp)
80004054: e4a6 sd s1,72(sp)
80004056: e0ca sd s2,64(sp)
80004058: fc4e sd s3,56(sp)
8000405a: f852 sd s4,48(sp)
8000405c: f456 sd s5,40(sp)
8000405e: f05a sd s6,32(sp)
80004060: ec5e sd s7,24(sp)
80004062: e862 sd s8,16(sp)
80004064: e466 sd s9,8(sp)
80004066: 1080 addi s0,sp,96
80004068: 84aa mv s1,a0
8000406a: 8aae mv s5,a1
8000406c: 8a32 mv s4,a2
struct inode *ip, *next;
if(*path == '/')
8000406e: 00054703 lbu a4,0(a0)
80004072: 02f00793 li a5,47
80004076: 02f70363 beq a4,a5,8000409c <namex+0x4e>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(myproc()->cwd);
8000407a: ffffe097 auipc ra,0xffffe
8000407e: 904080e7 jalr -1788(ra) # 8000197e <myproc>
80004082: 18853503 ld a0,392(a0)
80004086: 00000097 auipc ra,0x0
8000408a: 9f6080e7 jalr -1546(ra) # 80003a7c <idup>
8000408e: 89aa mv s3,a0
while(*path == '/')
80004090: 02f00913 li s2,47
len = path - s;
80004094: 4b01 li s6,0
if(len >= DIRSIZ)
80004096: 4c35 li s8,13
while((path = skipelem(path, name)) != 0){
ilock(ip);
if(ip->type != T_DIR){
80004098: 4b85 li s7,1
8000409a: a865 j 80004152 <namex+0x104>
ip = iget(ROOTDEV, ROOTINO);
8000409c: 4585 li a1,1
8000409e: 4505 li a0,1
800040a0: fffff097 auipc ra,0xfffff
800040a4: 6e6080e7 jalr 1766(ra) # 80003786 <iget>
800040a8: 89aa mv s3,a0
800040aa: b7dd j 80004090 <namex+0x42>
iunlockput(ip);
800040ac: 854e mv a0,s3
800040ae: 00000097 auipc ra,0x0
800040b2: c6e080e7 jalr -914(ra) # 80003d1c <iunlockput>
return 0;
800040b6: 4981 li s3,0
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
800040b8: 854e mv a0,s3
800040ba: 60e6 ld ra,88(sp)
800040bc: 6446 ld s0,80(sp)
800040be: 64a6 ld s1,72(sp)
800040c0: 6906 ld s2,64(sp)
800040c2: 79e2 ld s3,56(sp)
800040c4: 7a42 ld s4,48(sp)
800040c6: 7aa2 ld s5,40(sp)
800040c8: 7b02 ld s6,32(sp)
800040ca: 6be2 ld s7,24(sp)
800040cc: 6c42 ld s8,16(sp)
800040ce: 6ca2 ld s9,8(sp)
800040d0: 6125 addi sp,sp,96
800040d2: 8082 ret
iunlock(ip);
800040d4: 854e mv a0,s3
800040d6: 00000097 auipc ra,0x0
800040da: aa6080e7 jalr -1370(ra) # 80003b7c <iunlock>
return ip;
800040de: bfe9 j 800040b8 <namex+0x6a>
iunlockput(ip);
800040e0: 854e mv a0,s3
800040e2: 00000097 auipc ra,0x0
800040e6: c3a080e7 jalr -966(ra) # 80003d1c <iunlockput>
return 0;
800040ea: 89e6 mv s3,s9
800040ec: b7f1 j 800040b8 <namex+0x6a>
len = path - s;
800040ee: 40b48633 sub a2,s1,a1
800040f2: 00060c9b sext.w s9,a2
if(len >= DIRSIZ)
800040f6: 099c5463 bge s8,s9,8000417e <namex+0x130>
memmove(name, s, DIRSIZ);
800040fa: 4639 li a2,14
800040fc: 8552 mv a0,s4
800040fe: ffffd097 auipc ra,0xffffd
80004102: c1c080e7 jalr -996(ra) # 80000d1a <memmove>
while(*path == '/')
80004106: 0004c783 lbu a5,0(s1)
8000410a: 01279763 bne a5,s2,80004118 <namex+0xca>
path++;
8000410e: 0485 addi s1,s1,1
while(*path == '/')
80004110: 0004c783 lbu a5,0(s1)
80004114: ff278de3 beq a5,s2,8000410e <namex+0xc0>
ilock(ip);
80004118: 854e mv a0,s3
8000411a: 00000097 auipc ra,0x0
8000411e: 9a0080e7 jalr -1632(ra) # 80003aba <ilock>
if(ip->type != T_DIR){
80004122: 04499783 lh a5,68(s3)
80004126: f97793e3 bne a5,s7,800040ac <namex+0x5e>
if(nameiparent && *path == '\0'){
8000412a: 000a8563 beqz s5,80004134 <namex+0xe6>
8000412e: 0004c783 lbu a5,0(s1)
80004132: d3cd beqz a5,800040d4 <namex+0x86>
if((next = dirlookup(ip, name, 0)) == 0){
80004134: 865a mv a2,s6
80004136: 85d2 mv a1,s4
80004138: 854e mv a0,s3
8000413a: 00000097 auipc ra,0x0
8000413e: e64080e7 jalr -412(ra) # 80003f9e <dirlookup>
80004142: 8caa mv s9,a0
80004144: dd51 beqz a0,800040e0 <namex+0x92>
iunlockput(ip);
80004146: 854e mv a0,s3
80004148: 00000097 auipc ra,0x0
8000414c: bd4080e7 jalr -1068(ra) # 80003d1c <iunlockput>
ip = next;
80004150: 89e6 mv s3,s9
while(*path == '/')
80004152: 0004c783 lbu a5,0(s1)
80004156: 05279763 bne a5,s2,800041a4 <namex+0x156>
path++;
8000415a: 0485 addi s1,s1,1
while(*path == '/')
8000415c: 0004c783 lbu a5,0(s1)
80004160: ff278de3 beq a5,s2,8000415a <namex+0x10c>
if(*path == 0)
80004164: c79d beqz a5,80004192 <namex+0x144>
path++;
80004166: 85a6 mv a1,s1
len = path - s;
80004168: 8cda mv s9,s6
8000416a: 865a mv a2,s6
while(*path != '/' && *path != 0)
8000416c: 01278963 beq a5,s2,8000417e <namex+0x130>
80004170: dfbd beqz a5,800040ee <namex+0xa0>
path++;
80004172: 0485 addi s1,s1,1
while(*path != '/' && *path != 0)
80004174: 0004c783 lbu a5,0(s1)
80004178: ff279ce3 bne a5,s2,80004170 <namex+0x122>
8000417c: bf8d j 800040ee <namex+0xa0>
memmove(name, s, len);
8000417e: 2601 sext.w a2,a2
80004180: 8552 mv a0,s4
80004182: ffffd097 auipc ra,0xffffd
80004186: b98080e7 jalr -1128(ra) # 80000d1a <memmove>
name[len] = 0;
8000418a: 9cd2 add s9,s9,s4
8000418c: 000c8023 sb zero,0(s9) # 2000 <_entry-0x7fffe000>
80004190: bf9d j 80004106 <namex+0xb8>
if(nameiparent){
80004192: f20a83e3 beqz s5,800040b8 <namex+0x6a>
iput(ip);
80004196: 854e mv a0,s3
80004198: 00000097 auipc ra,0x0
8000419c: adc080e7 jalr -1316(ra) # 80003c74 <iput>
return 0;
800041a0: 4981 li s3,0
800041a2: bf19 j 800040b8 <namex+0x6a>
if(*path == 0)
800041a4: d7fd beqz a5,80004192 <namex+0x144>
while(*path != '/' && *path != 0)
800041a6: 0004c783 lbu a5,0(s1)
800041aa: 85a6 mv a1,s1
800041ac: b7d1 j 80004170 <namex+0x122>
00000000800041ae <dirlink>:
{
800041ae: 7139 addi sp,sp,-64
800041b0: fc06 sd ra,56(sp)
800041b2: f822 sd s0,48(sp)
800041b4: f426 sd s1,40(sp)
800041b6: f04a sd s2,32(sp)
800041b8: ec4e sd s3,24(sp)
800041ba: e852 sd s4,16(sp)
800041bc: 0080 addi s0,sp,64
800041be: 892a mv s2,a0
800041c0: 8a2e mv s4,a1
800041c2: 89b2 mv s3,a2
if((ip = dirlookup(dp, name, 0)) != 0){
800041c4: 4601 li a2,0
800041c6: 00000097 auipc ra,0x0
800041ca: dd8080e7 jalr -552(ra) # 80003f9e <dirlookup>
800041ce: e93d bnez a0,80004244 <dirlink+0x96>
for(off = 0; off < dp->size; off += sizeof(de)){
800041d0: 04c92483 lw s1,76(s2)
800041d4: c49d beqz s1,80004202 <dirlink+0x54>
800041d6: 4481 li s1,0
if(readi(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de))
800041d8: 4741 li a4,16
800041da: 86a6 mv a3,s1
800041dc: fc040613 addi a2,s0,-64
800041e0: 4581 li a1,0
800041e2: 854a mv a0,s2
800041e4: 00000097 auipc ra,0x0
800041e8: b8a080e7 jalr -1142(ra) # 80003d6e <readi>
800041ec: 47c1 li a5,16
800041ee: 06f51163 bne a0,a5,80004250 <dirlink+0xa2>
if(de.inum == 0)
800041f2: fc045783 lhu a5,-64(s0)
800041f6: c791 beqz a5,80004202 <dirlink+0x54>
for(off = 0; off < dp->size; off += sizeof(de)){
800041f8: 24c1 addiw s1,s1,16
800041fa: 04c92783 lw a5,76(s2)
800041fe: fcf4ede3 bltu s1,a5,800041d8 <dirlink+0x2a>
strncpy(de.name, name, DIRSIZ);
80004202: 4639 li a2,14
80004204: 85d2 mv a1,s4
80004206: fc240513 addi a0,s0,-62
8000420a: ffffd097 auipc ra,0xffffd
8000420e: bc8080e7 jalr -1080(ra) # 80000dd2 <strncpy>
de.inum = inum;
80004212: fd341023 sh s3,-64(s0)
if(writei(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de))
80004216: 4741 li a4,16
80004218: 86a6 mv a3,s1
8000421a: fc040613 addi a2,s0,-64
8000421e: 4581 li a1,0
80004220: 854a mv a0,s2
80004222: 00000097 auipc ra,0x0
80004226: c44080e7 jalr -956(ra) # 80003e66 <writei>
8000422a: 872a mv a4,a0
8000422c: 47c1 li a5,16
return 0;
8000422e: 4501 li a0,0
if(writei(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de))
80004230: 02f71863 bne a4,a5,80004260 <dirlink+0xb2>
}
80004234: 70e2 ld ra,56(sp)
80004236: 7442 ld s0,48(sp)
80004238: 74a2 ld s1,40(sp)
8000423a: 7902 ld s2,32(sp)
8000423c: 69e2 ld s3,24(sp)
8000423e: 6a42 ld s4,16(sp)
80004240: 6121 addi sp,sp,64
80004242: 8082 ret
iput(ip);
80004244: 00000097 auipc ra,0x0
80004248: a30080e7 jalr -1488(ra) # 80003c74 <iput>
return -1;
8000424c: 557d li a0,-1
8000424e: b7dd j 80004234 <dirlink+0x86>
panic("dirlink read");
80004250: 00004517 auipc a0,0x4
80004254: 4e050513 addi a0,a0,1248 # 80008730 <syscalls+0x1e0>
80004258: ffffc097 auipc ra,0xffffc
8000425c: 2d2080e7 jalr 722(ra) # 8000052a <panic>
panic("dirlink");
80004260: 00004517 auipc a0,0x4
80004264: 5d850513 addi a0,a0,1496 # 80008838 <syscalls+0x2e8>
80004268: ffffc097 auipc ra,0xffffc
8000426c: 2c2080e7 jalr 706(ra) # 8000052a <panic>
0000000080004270 <namei>:
struct inode*
namei(char *path)
{
80004270: 1101 addi sp,sp,-32
80004272: ec06 sd ra,24(sp)
80004274: e822 sd s0,16(sp)
80004276: 1000 addi s0,sp,32
char name[DIRSIZ];
return namex(path, 0, name);
80004278: fe040613 addi a2,s0,-32
8000427c: 4581 li a1,0
8000427e: 00000097 auipc ra,0x0
80004282: dd0080e7 jalr -560(ra) # 8000404e <namex>
}
80004286: 60e2 ld ra,24(sp)
80004288: 6442 ld s0,16(sp)
8000428a: 6105 addi sp,sp,32
8000428c: 8082 ret
000000008000428e <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
8000428e: 1141 addi sp,sp,-16
80004290: e406 sd ra,8(sp)
80004292: e022 sd s0,0(sp)
80004294: 0800 addi s0,sp,16
80004296: 862e mv a2,a1
return namex(path, 1, name);
80004298: 4585 li a1,1
8000429a: 00000097 auipc ra,0x0
8000429e: db4080e7 jalr -588(ra) # 8000404e <namex>
}
800042a2: 60a2 ld ra,8(sp)
800042a4: 6402 ld s0,0(sp)
800042a6: 0141 addi sp,sp,16
800042a8: 8082 ret
00000000800042aa <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
800042aa: 1101 addi sp,sp,-32
800042ac: ec06 sd ra,24(sp)
800042ae: e822 sd s0,16(sp)
800042b0: e426 sd s1,8(sp)
800042b2: e04a sd s2,0(sp)
800042b4: 1000 addi s0,sp,32
struct buf *buf = bread(log.dev, log.start);
800042b6: 0001e917 auipc s2,0x1e
800042ba: dba90913 addi s2,s2,-582 # 80022070 <log>
800042be: 01892583 lw a1,24(s2)
800042c2: 02892503 lw a0,40(s2)
800042c6: fffff097 auipc ra,0xfffff
800042ca: ff0080e7 jalr -16(ra) # 800032b6 <bread>
800042ce: 84aa mv s1,a0
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
800042d0: 02c92683 lw a3,44(s2)
800042d4: cd34 sw a3,88(a0)
for (i = 0; i < log.lh.n; i++) {
800042d6: 02d05863 blez a3,80004306 <write_head+0x5c>
800042da: 0001e797 auipc a5,0x1e
800042de: dc678793 addi a5,a5,-570 # 800220a0 <log+0x30>
800042e2: 05c50713 addi a4,a0,92
800042e6: 36fd addiw a3,a3,-1
800042e8: 02069613 slli a2,a3,0x20
800042ec: 01e65693 srli a3,a2,0x1e
800042f0: 0001e617 auipc a2,0x1e
800042f4: db460613 addi a2,a2,-588 # 800220a4 <log+0x34>
800042f8: 96b2 add a3,a3,a2
hb->block[i] = log.lh.block[i];
800042fa: 4390 lw a2,0(a5)
800042fc: c310 sw a2,0(a4)
for (i = 0; i < log.lh.n; i++) {
800042fe: 0791 addi a5,a5,4
80004300: 0711 addi a4,a4,4
80004302: fed79ce3 bne a5,a3,800042fa <write_head+0x50>
}
bwrite(buf);
80004306: 8526 mv a0,s1
80004308: fffff097 auipc ra,0xfffff
8000430c: 0a0080e7 jalr 160(ra) # 800033a8 <bwrite>
brelse(buf);
80004310: 8526 mv a0,s1
80004312: fffff097 auipc ra,0xfffff
80004316: 0d4080e7 jalr 212(ra) # 800033e6 <brelse>
}
8000431a: 60e2 ld ra,24(sp)
8000431c: 6442 ld s0,16(sp)
8000431e: 64a2 ld s1,8(sp)
80004320: 6902 ld s2,0(sp)
80004322: 6105 addi sp,sp,32
80004324: 8082 ret
0000000080004326 <install_trans>:
for (tail = 0; tail < log.lh.n; tail++) {
80004326: 0001e797 auipc a5,0x1e
8000432a: d767a783 lw a5,-650(a5) # 8002209c <log+0x2c>
8000432e: 0af05d63 blez a5,800043e8 <install_trans+0xc2>
{
80004332: 7139 addi sp,sp,-64
80004334: fc06 sd ra,56(sp)
80004336: f822 sd s0,48(sp)
80004338: f426 sd s1,40(sp)
8000433a: f04a sd s2,32(sp)
8000433c: ec4e sd s3,24(sp)
8000433e: e852 sd s4,16(sp)
80004340: e456 sd s5,8(sp)
80004342: e05a sd s6,0(sp)
80004344: 0080 addi s0,sp,64
80004346: 8b2a mv s6,a0
80004348: 0001ea97 auipc s5,0x1e
8000434c: d58a8a93 addi s5,s5,-680 # 800220a0 <log+0x30>
for (tail = 0; tail < log.lh.n; tail++) {
80004350: 4a01 li s4,0
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
80004352: 0001e997 auipc s3,0x1e
80004356: d1e98993 addi s3,s3,-738 # 80022070 <log>
8000435a: a00d j 8000437c <install_trans+0x56>
brelse(lbuf);
8000435c: 854a mv a0,s2
8000435e: fffff097 auipc ra,0xfffff
80004362: 088080e7 jalr 136(ra) # 800033e6 <brelse>
brelse(dbuf);
80004366: 8526 mv a0,s1
80004368: fffff097 auipc ra,0xfffff
8000436c: 07e080e7 jalr 126(ra) # 800033e6 <brelse>
for (tail = 0; tail < log.lh.n; tail++) {
80004370: 2a05 addiw s4,s4,1
80004372: 0a91 addi s5,s5,4
80004374: 02c9a783 lw a5,44(s3)
80004378: 04fa5e63 bge s4,a5,800043d4 <install_trans+0xae>
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
8000437c: 0189a583 lw a1,24(s3)
80004380: 014585bb addw a1,a1,s4
80004384: 2585 addiw a1,a1,1
80004386: 0289a503 lw a0,40(s3)
8000438a: fffff097 auipc ra,0xfffff
8000438e: f2c080e7 jalr -212(ra) # 800032b6 <bread>
80004392: 892a mv s2,a0
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80004394: 000aa583 lw a1,0(s5)
80004398: 0289a503 lw a0,40(s3)
8000439c: fffff097 auipc ra,0xfffff
800043a0: f1a080e7 jalr -230(ra) # 800032b6 <bread>
800043a4: 84aa mv s1,a0
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
800043a6: 40000613 li a2,1024
800043aa: 05890593 addi a1,s2,88
800043ae: 05850513 addi a0,a0,88
800043b2: ffffd097 auipc ra,0xffffd
800043b6: 968080e7 jalr -1688(ra) # 80000d1a <memmove>
bwrite(dbuf); // write dst to disk
800043ba: 8526 mv a0,s1
800043bc: fffff097 auipc ra,0xfffff
800043c0: fec080e7 jalr -20(ra) # 800033a8 <bwrite>
if(recovering == 0)
800043c4: f80b1ce3 bnez s6,8000435c <install_trans+0x36>
bunpin(dbuf);
800043c8: 8526 mv a0,s1
800043ca: fffff097 auipc ra,0xfffff
800043ce: 0f6080e7 jalr 246(ra) # 800034c0 <bunpin>
800043d2: b769 j 8000435c <install_trans+0x36>
}
800043d4: 70e2 ld ra,56(sp)
800043d6: 7442 ld s0,48(sp)
800043d8: 74a2 ld s1,40(sp)
800043da: 7902 ld s2,32(sp)
800043dc: 69e2 ld s3,24(sp)
800043de: 6a42 ld s4,16(sp)
800043e0: 6aa2 ld s5,8(sp)
800043e2: 6b02 ld s6,0(sp)
800043e4: 6121 addi sp,sp,64
800043e6: 8082 ret
800043e8: 8082 ret
00000000800043ea <initlog>:
{
800043ea: 7179 addi sp,sp,-48
800043ec: f406 sd ra,40(sp)
800043ee: f022 sd s0,32(sp)
800043f0: ec26 sd s1,24(sp)
800043f2: e84a sd s2,16(sp)
800043f4: e44e sd s3,8(sp)
800043f6: 1800 addi s0,sp,48
800043f8: 892a mv s2,a0
800043fa: 89ae mv s3,a1
initlock(&log.lock, "log");
800043fc: 0001e497 auipc s1,0x1e
80004400: c7448493 addi s1,s1,-908 # 80022070 <log>
80004404: 00004597 auipc a1,0x4
80004408: 33c58593 addi a1,a1,828 # 80008740 <syscalls+0x1f0>
8000440c: 8526 mv a0,s1
8000440e: ffffc097 auipc ra,0xffffc
80004412: 724080e7 jalr 1828(ra) # 80000b32 <initlock>
log.start = sb->logstart;
80004416: 0149a583 lw a1,20(s3)
8000441a: cc8c sw a1,24(s1)
log.size = sb->nlog;
8000441c: 0109a783 lw a5,16(s3)
80004420: ccdc sw a5,28(s1)
log.dev = dev;
80004422: 0324a423 sw s2,40(s1)
struct buf *buf = bread(log.dev, log.start);
80004426: 854a mv a0,s2
80004428: fffff097 auipc ra,0xfffff
8000442c: e8e080e7 jalr -370(ra) # 800032b6 <bread>
log.lh.n = lh->n;
80004430: 4d34 lw a3,88(a0)
80004432: d4d4 sw a3,44(s1)
for (i = 0; i < log.lh.n; i++) {
80004434: 02d05663 blez a3,80004460 <initlog+0x76>
80004438: 05c50793 addi a5,a0,92
8000443c: 0001e717 auipc a4,0x1e
80004440: c6470713 addi a4,a4,-924 # 800220a0 <log+0x30>
80004444: 36fd addiw a3,a3,-1
80004446: 02069613 slli a2,a3,0x20
8000444a: 01e65693 srli a3,a2,0x1e
8000444e: 06050613 addi a2,a0,96
80004452: 96b2 add a3,a3,a2
log.lh.block[i] = lh->block[i];
80004454: 4390 lw a2,0(a5)
80004456: c310 sw a2,0(a4)
for (i = 0; i < log.lh.n; i++) {
80004458: 0791 addi a5,a5,4
8000445a: 0711 addi a4,a4,4
8000445c: fed79ce3 bne a5,a3,80004454 <initlog+0x6a>
brelse(buf);
80004460: fffff097 auipc ra,0xfffff
80004464: f86080e7 jalr -122(ra) # 800033e6 <brelse>
static void
recover_from_log(void)
{
read_head();
install_trans(1); // if committed, copy from log to disk
80004468: 4505 li a0,1
8000446a: 00000097 auipc ra,0x0
8000446e: ebc080e7 jalr -324(ra) # 80004326 <install_trans>
log.lh.n = 0;
80004472: 0001e797 auipc a5,0x1e
80004476: c207a523 sw zero,-982(a5) # 8002209c <log+0x2c>
write_head(); // clear the log
8000447a: 00000097 auipc ra,0x0
8000447e: e30080e7 jalr -464(ra) # 800042aa <write_head>
}
80004482: 70a2 ld ra,40(sp)
80004484: 7402 ld s0,32(sp)
80004486: 64e2 ld s1,24(sp)
80004488: 6942 ld s2,16(sp)
8000448a: 69a2 ld s3,8(sp)
8000448c: 6145 addi sp,sp,48
8000448e: 8082 ret
0000000080004490 <begin_op>:
}
// called at the start of each FS system call.
void
begin_op(void)
{
80004490: 1101 addi sp,sp,-32
80004492: ec06 sd ra,24(sp)
80004494: e822 sd s0,16(sp)
80004496: e426 sd s1,8(sp)
80004498: e04a sd s2,0(sp)
8000449a: 1000 addi s0,sp,32
acquire(&log.lock);
8000449c: 0001e517 auipc a0,0x1e
800044a0: bd450513 addi a0,a0,-1068 # 80022070 <log>
800044a4: ffffc097 auipc ra,0xffffc
800044a8: 71e080e7 jalr 1822(ra) # 80000bc2 <acquire>
while(1){
if(log.committing){
800044ac: 0001e497 auipc s1,0x1e
800044b0: bc448493 addi s1,s1,-1084 # 80022070 <log>
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
800044b4: 4979 li s2,30
800044b6: a039 j 800044c4 <begin_op+0x34>
sleep(&log, &log.lock);
800044b8: 85a6 mv a1,s1
800044ba: 8526 mv a0,s1
800044bc: ffffe097 auipc ra,0xffffe
800044c0: c38080e7 jalr -968(ra) # 800020f4 <sleep>
if(log.committing){
800044c4: 50dc lw a5,36(s1)
800044c6: fbed bnez a5,800044b8 <begin_op+0x28>
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
800044c8: 509c lw a5,32(s1)
800044ca: 0017871b addiw a4,a5,1
800044ce: 0007069b sext.w a3,a4
800044d2: 0027179b slliw a5,a4,0x2
800044d6: 9fb9 addw a5,a5,a4
800044d8: 0017979b slliw a5,a5,0x1
800044dc: 54d8 lw a4,44(s1)
800044de: 9fb9 addw a5,a5,a4
800044e0: 00f95963 bge s2,a5,800044f2 <begin_op+0x62>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
800044e4: 85a6 mv a1,s1
800044e6: 8526 mv a0,s1
800044e8: ffffe097 auipc ra,0xffffe
800044ec: c0c080e7 jalr -1012(ra) # 800020f4 <sleep>
800044f0: bfd1 j 800044c4 <begin_op+0x34>
} else {
log.outstanding += 1;
800044f2: 0001e517 auipc a0,0x1e
800044f6: b7e50513 addi a0,a0,-1154 # 80022070 <log>
800044fa: d114 sw a3,32(a0)
release(&log.lock);
800044fc: ffffc097 auipc ra,0xffffc
80004500: 77a080e7 jalr 1914(ra) # 80000c76 <release>
break;
}
}
}
80004504: 60e2 ld ra,24(sp)
80004506: 6442 ld s0,16(sp)
80004508: 64a2 ld s1,8(sp)
8000450a: 6902 ld s2,0(sp)
8000450c: 6105 addi sp,sp,32
8000450e: 8082 ret
0000000080004510 <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
80004510: 7139 addi sp,sp,-64
80004512: fc06 sd ra,56(sp)
80004514: f822 sd s0,48(sp)
80004516: f426 sd s1,40(sp)
80004518: f04a sd s2,32(sp)
8000451a: ec4e sd s3,24(sp)
8000451c: e852 sd s4,16(sp)
8000451e: e456 sd s5,8(sp)
80004520: 0080 addi s0,sp,64
int do_commit = 0;
acquire(&log.lock);
80004522: 0001e497 auipc s1,0x1e
80004526: b4e48493 addi s1,s1,-1202 # 80022070 <log>
8000452a: 8526 mv a0,s1
8000452c: ffffc097 auipc ra,0xffffc
80004530: 696080e7 jalr 1686(ra) # 80000bc2 <acquire>
log.outstanding -= 1;
80004534: 509c lw a5,32(s1)
80004536: 37fd addiw a5,a5,-1
80004538: 0007891b sext.w s2,a5
8000453c: d09c sw a5,32(s1)
if(log.committing)
8000453e: 50dc lw a5,36(s1)
80004540: e7b9 bnez a5,8000458e <end_op+0x7e>
panic("log.committing");
if(log.outstanding == 0){
80004542: 04091e63 bnez s2,8000459e <end_op+0x8e>
do_commit = 1;
log.committing = 1;
80004546: 0001e497 auipc s1,0x1e
8000454a: b2a48493 addi s1,s1,-1238 # 80022070 <log>
8000454e: 4785 li a5,1
80004550: d0dc sw a5,36(s1)
// begin_op() may be waiting for log space,
// and decrementing log.outstanding has decreased
// the amount of reserved space.
wakeup(&log);
}
release(&log.lock);
80004552: 8526 mv a0,s1
80004554: ffffc097 auipc ra,0xffffc
80004558: 722080e7 jalr 1826(ra) # 80000c76 <release>
}
static void
commit()
{
if (log.lh.n > 0) {
8000455c: 54dc lw a5,44(s1)
8000455e: 06f04763 bgtz a5,800045cc <end_op+0xbc>
acquire(&log.lock);
80004562: 0001e497 auipc s1,0x1e
80004566: b0e48493 addi s1,s1,-1266 # 80022070 <log>
8000456a: 8526 mv a0,s1
8000456c: ffffc097 auipc ra,0xffffc
80004570: 656080e7 jalr 1622(ra) # 80000bc2 <acquire>
log.committing = 0;
80004574: 0204a223 sw zero,36(s1)
wakeup(&log);
80004578: 8526 mv a0,s1
8000457a: ffffe097 auipc ra,0xffffe
8000457e: dee080e7 jalr -530(ra) # 80002368 <wakeup>
release(&log.lock);
80004582: 8526 mv a0,s1
80004584: ffffc097 auipc ra,0xffffc
80004588: 6f2080e7 jalr 1778(ra) # 80000c76 <release>
}
8000458c: a03d j 800045ba <end_op+0xaa>
panic("log.committing");
8000458e: 00004517 auipc a0,0x4
80004592: 1ba50513 addi a0,a0,442 # 80008748 <syscalls+0x1f8>
80004596: ffffc097 auipc ra,0xffffc
8000459a: f94080e7 jalr -108(ra) # 8000052a <panic>
wakeup(&log);
8000459e: 0001e497 auipc s1,0x1e
800045a2: ad248493 addi s1,s1,-1326 # 80022070 <log>
800045a6: 8526 mv a0,s1
800045a8: ffffe097 auipc ra,0xffffe
800045ac: dc0080e7 jalr -576(ra) # 80002368 <wakeup>
release(&log.lock);
800045b0: 8526 mv a0,s1
800045b2: ffffc097 auipc ra,0xffffc
800045b6: 6c4080e7 jalr 1732(ra) # 80000c76 <release>
}
800045ba: 70e2 ld ra,56(sp)
800045bc: 7442 ld s0,48(sp)
800045be: 74a2 ld s1,40(sp)
800045c0: 7902 ld s2,32(sp)
800045c2: 69e2 ld s3,24(sp)
800045c4: 6a42 ld s4,16(sp)
800045c6: 6aa2 ld s5,8(sp)
800045c8: 6121 addi sp,sp,64
800045ca: 8082 ret
for (tail = 0; tail < log.lh.n; tail++) {
800045cc: 0001ea97 auipc s5,0x1e
800045d0: ad4a8a93 addi s5,s5,-1324 # 800220a0 <log+0x30>
struct buf *to = bread(log.dev, log.start+tail+1); // log block
800045d4: 0001ea17 auipc s4,0x1e
800045d8: a9ca0a13 addi s4,s4,-1380 # 80022070 <log>
800045dc: 018a2583 lw a1,24(s4)
800045e0: 012585bb addw a1,a1,s2
800045e4: 2585 addiw a1,a1,1
800045e6: 028a2503 lw a0,40(s4)
800045ea: fffff097 auipc ra,0xfffff
800045ee: ccc080e7 jalr -820(ra) # 800032b6 <bread>
800045f2: 84aa mv s1,a0
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
800045f4: 000aa583 lw a1,0(s5)
800045f8: 028a2503 lw a0,40(s4)
800045fc: fffff097 auipc ra,0xfffff
80004600: cba080e7 jalr -838(ra) # 800032b6 <bread>
80004604: 89aa mv s3,a0
memmove(to->data, from->data, BSIZE);
80004606: 40000613 li a2,1024
8000460a: 05850593 addi a1,a0,88
8000460e: 05848513 addi a0,s1,88
80004612: ffffc097 auipc ra,0xffffc
80004616: 708080e7 jalr 1800(ra) # 80000d1a <memmove>
bwrite(to); // write the log
8000461a: 8526 mv a0,s1
8000461c: fffff097 auipc ra,0xfffff
80004620: d8c080e7 jalr -628(ra) # 800033a8 <bwrite>
brelse(from);
80004624: 854e mv a0,s3
80004626: fffff097 auipc ra,0xfffff
8000462a: dc0080e7 jalr -576(ra) # 800033e6 <brelse>
brelse(to);
8000462e: 8526 mv a0,s1
80004630: fffff097 auipc ra,0xfffff
80004634: db6080e7 jalr -586(ra) # 800033e6 <brelse>
for (tail = 0; tail < log.lh.n; tail++) {
80004638: 2905 addiw s2,s2,1
8000463a: 0a91 addi s5,s5,4
8000463c: 02ca2783 lw a5,44(s4)
80004640: f8f94ee3 blt s2,a5,800045dc <end_op+0xcc>
write_log(); // Write modified blocks from cache to log
write_head(); // Write header to disk -- the real commit
80004644: 00000097 auipc ra,0x0
80004648: c66080e7 jalr -922(ra) # 800042aa <write_head>
install_trans(0); // Now install writes to home locations
8000464c: 4501 li a0,0
8000464e: 00000097 auipc ra,0x0
80004652: cd8080e7 jalr -808(ra) # 80004326 <install_trans>
log.lh.n = 0;
80004656: 0001e797 auipc a5,0x1e
8000465a: a407a323 sw zero,-1466(a5) # 8002209c <log+0x2c>
write_head(); // Erase the transaction from the log
8000465e: 00000097 auipc ra,0x0
80004662: c4c080e7 jalr -948(ra) # 800042aa <write_head>
80004666: bdf5 j 80004562 <end_op+0x52>
0000000080004668 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80004668: 1101 addi sp,sp,-32
8000466a: ec06 sd ra,24(sp)
8000466c: e822 sd s0,16(sp)
8000466e: e426 sd s1,8(sp)
80004670: e04a sd s2,0(sp)
80004672: 1000 addi s0,sp,32
80004674: 84aa mv s1,a0
int i;
acquire(&log.lock);
80004676: 0001e917 auipc s2,0x1e
8000467a: 9fa90913 addi s2,s2,-1542 # 80022070 <log>
8000467e: 854a mv a0,s2
80004680: ffffc097 auipc ra,0xffffc
80004684: 542080e7 jalr 1346(ra) # 80000bc2 <acquire>
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80004688: 02c92603 lw a2,44(s2)
8000468c: 47f5 li a5,29
8000468e: 06c7c563 blt a5,a2,800046f8 <log_write+0x90>
80004692: 0001e797 auipc a5,0x1e
80004696: 9fa7a783 lw a5,-1542(a5) # 8002208c <log+0x1c>
8000469a: 37fd addiw a5,a5,-1
8000469c: 04f65e63 bge a2,a5,800046f8 <log_write+0x90>
panic("too big a transaction");
if (log.outstanding < 1)
800046a0: 0001e797 auipc a5,0x1e
800046a4: 9f07a783 lw a5,-1552(a5) # 80022090 <log+0x20>
800046a8: 06f05063 blez a5,80004708 <log_write+0xa0>
panic("log_write outside of trans");
for (i = 0; i < log.lh.n; i++) {
800046ac: 4781 li a5,0
800046ae: 06c05563 blez a2,80004718 <log_write+0xb0>
if (log.lh.block[i] == b->blockno) // log absorbtion
800046b2: 44cc lw a1,12(s1)
800046b4: 0001e717 auipc a4,0x1e
800046b8: 9ec70713 addi a4,a4,-1556 # 800220a0 <log+0x30>
for (i = 0; i < log.lh.n; i++) {
800046bc: 4781 li a5,0
if (log.lh.block[i] == b->blockno) // log absorbtion
800046be: 4314 lw a3,0(a4)
800046c0: 04b68c63 beq a3,a1,80004718 <log_write+0xb0>
for (i = 0; i < log.lh.n; i++) {
800046c4: 2785 addiw a5,a5,1
800046c6: 0711 addi a4,a4,4
800046c8: fef61be3 bne a2,a5,800046be <log_write+0x56>
break;
}
log.lh.block[i] = b->blockno;
800046cc: 0621 addi a2,a2,8
800046ce: 060a slli a2,a2,0x2
800046d0: 0001e797 auipc a5,0x1e
800046d4: 9a078793 addi a5,a5,-1632 # 80022070 <log>
800046d8: 963e add a2,a2,a5
800046da: 44dc lw a5,12(s1)
800046dc: ca1c sw a5,16(a2)
if (i == log.lh.n) { // Add new block to log?
bpin(b);
800046de: 8526 mv a0,s1
800046e0: fffff097 auipc ra,0xfffff
800046e4: da4080e7 jalr -604(ra) # 80003484 <bpin>
log.lh.n++;
800046e8: 0001e717 auipc a4,0x1e
800046ec: 98870713 addi a4,a4,-1656 # 80022070 <log>
800046f0: 575c lw a5,44(a4)
800046f2: 2785 addiw a5,a5,1
800046f4: d75c sw a5,44(a4)
800046f6: a835 j 80004732 <log_write+0xca>
panic("too big a transaction");
800046f8: 00004517 auipc a0,0x4
800046fc: 06050513 addi a0,a0,96 # 80008758 <syscalls+0x208>
80004700: ffffc097 auipc ra,0xffffc
80004704: e2a080e7 jalr -470(ra) # 8000052a <panic>
panic("log_write outside of trans");
80004708: 00004517 auipc a0,0x4
8000470c: 06850513 addi a0,a0,104 # 80008770 <syscalls+0x220>
80004710: ffffc097 auipc ra,0xffffc
80004714: e1a080e7 jalr -486(ra) # 8000052a <panic>
log.lh.block[i] = b->blockno;
80004718: 00878713 addi a4,a5,8
8000471c: 00271693 slli a3,a4,0x2
80004720: 0001e717 auipc a4,0x1e
80004724: 95070713 addi a4,a4,-1712 # 80022070 <log>
80004728: 9736 add a4,a4,a3
8000472a: 44d4 lw a3,12(s1)
8000472c: cb14 sw a3,16(a4)
if (i == log.lh.n) { // Add new block to log?
8000472e: faf608e3 beq a2,a5,800046de <log_write+0x76>
}
release(&log.lock);
80004732: 0001e517 auipc a0,0x1e
80004736: 93e50513 addi a0,a0,-1730 # 80022070 <log>
8000473a: ffffc097 auipc ra,0xffffc
8000473e: 53c080e7 jalr 1340(ra) # 80000c76 <release>
}
80004742: 60e2 ld ra,24(sp)
80004744: 6442 ld s0,16(sp)
80004746: 64a2 ld s1,8(sp)
80004748: 6902 ld s2,0(sp)
8000474a: 6105 addi sp,sp,32
8000474c: 8082 ret
000000008000474e <initsleeplock>:
#include "proc.h"
#include "sleeplock.h"
void
initsleeplock(struct sleeplock *lk, char *name)
{
8000474e: 1101 addi sp,sp,-32
80004750: ec06 sd ra,24(sp)
80004752: e822 sd s0,16(sp)
80004754: e426 sd s1,8(sp)
80004756: e04a sd s2,0(sp)
80004758: 1000 addi s0,sp,32
8000475a: 84aa mv s1,a0
8000475c: 892e mv s2,a1
initlock(&lk->lk, "sleep lock");
8000475e: 00004597 auipc a1,0x4
80004762: 03258593 addi a1,a1,50 # 80008790 <syscalls+0x240>
80004766: 0521 addi a0,a0,8
80004768: ffffc097 auipc ra,0xffffc
8000476c: 3ca080e7 jalr 970(ra) # 80000b32 <initlock>
lk->name = name;
80004770: 0324b023 sd s2,32(s1)
lk->locked = 0;
80004774: 0004a023 sw zero,0(s1)
lk->pid = 0;
80004778: 0204a423 sw zero,40(s1)
}
8000477c: 60e2 ld ra,24(sp)
8000477e: 6442 ld s0,16(sp)
80004780: 64a2 ld s1,8(sp)
80004782: 6902 ld s2,0(sp)
80004784: 6105 addi sp,sp,32
80004786: 8082 ret
0000000080004788 <acquiresleep>:
void
acquiresleep(struct sleeplock *lk)
{
80004788: 1101 addi sp,sp,-32
8000478a: ec06 sd ra,24(sp)
8000478c: e822 sd s0,16(sp)
8000478e: e426 sd s1,8(sp)
80004790: e04a sd s2,0(sp)
80004792: 1000 addi s0,sp,32
80004794: 84aa mv s1,a0
acquire(&lk->lk);
80004796: 00850913 addi s2,a0,8
8000479a: 854a mv a0,s2
8000479c: ffffc097 auipc ra,0xffffc
800047a0: 426080e7 jalr 1062(ra) # 80000bc2 <acquire>
while (lk->locked) {
800047a4: 409c lw a5,0(s1)
800047a6: cb89 beqz a5,800047b8 <acquiresleep+0x30>
sleep(lk, &lk->lk);
800047a8: 85ca mv a1,s2
800047aa: 8526 mv a0,s1
800047ac: ffffe097 auipc ra,0xffffe
800047b0: 948080e7 jalr -1720(ra) # 800020f4 <sleep>
while (lk->locked) {
800047b4: 409c lw a5,0(s1)
800047b6: fbed bnez a5,800047a8 <acquiresleep+0x20>
}
lk->locked = 1;
800047b8: 4785 li a5,1
800047ba: c09c sw a5,0(s1)
lk->pid = myproc()->pid;
800047bc: ffffd097 auipc ra,0xffffd
800047c0: 1c2080e7 jalr 450(ra) # 8000197e <myproc>
800047c4: 591c lw a5,48(a0)
800047c6: d49c sw a5,40(s1)
release(&lk->lk);
800047c8: 854a mv a0,s2
800047ca: ffffc097 auipc ra,0xffffc
800047ce: 4ac080e7 jalr 1196(ra) # 80000c76 <release>
}
800047d2: 60e2 ld ra,24(sp)
800047d4: 6442 ld s0,16(sp)
800047d6: 64a2 ld s1,8(sp)
800047d8: 6902 ld s2,0(sp)
800047da: 6105 addi sp,sp,32
800047dc: 8082 ret
00000000800047de <releasesleep>:
void
releasesleep(struct sleeplock *lk)
{
800047de: 1101 addi sp,sp,-32
800047e0: ec06 sd ra,24(sp)
800047e2: e822 sd s0,16(sp)
800047e4: e426 sd s1,8(sp)
800047e6: e04a sd s2,0(sp)
800047e8: 1000 addi s0,sp,32
800047ea: 84aa mv s1,a0
acquire(&lk->lk);
800047ec: 00850913 addi s2,a0,8
800047f0: 854a mv a0,s2
800047f2: ffffc097 auipc ra,0xffffc
800047f6: 3d0080e7 jalr 976(ra) # 80000bc2 <acquire>
lk->locked = 0;
800047fa: 0004a023 sw zero,0(s1)
lk->pid = 0;
800047fe: 0204a423 sw zero,40(s1)
wakeup(lk);
80004802: 8526 mv a0,s1
80004804: ffffe097 auipc ra,0xffffe
80004808: b64080e7 jalr -1180(ra) # 80002368 <wakeup>
release(&lk->lk);
8000480c: 854a mv a0,s2
8000480e: ffffc097 auipc ra,0xffffc
80004812: 468080e7 jalr 1128(ra) # 80000c76 <release>
}
80004816: 60e2 ld ra,24(sp)
80004818: 6442 ld s0,16(sp)
8000481a: 64a2 ld s1,8(sp)
8000481c: 6902 ld s2,0(sp)
8000481e: 6105 addi sp,sp,32
80004820: 8082 ret
0000000080004822 <holdingsleep>:
int
holdingsleep(struct sleeplock *lk)
{
80004822: 7179 addi sp,sp,-48
80004824: f406 sd ra,40(sp)
80004826: f022 sd s0,32(sp)
80004828: ec26 sd s1,24(sp)
8000482a: e84a sd s2,16(sp)
8000482c: e44e sd s3,8(sp)
8000482e: 1800 addi s0,sp,48
80004830: 84aa mv s1,a0
int r;
acquire(&lk->lk);
80004832: 00850913 addi s2,a0,8
80004836: 854a mv a0,s2
80004838: ffffc097 auipc ra,0xffffc
8000483c: 38a080e7 jalr 906(ra) # 80000bc2 <acquire>
r = lk->locked && (lk->pid == myproc()->pid);
80004840: 409c lw a5,0(s1)
80004842: ef99 bnez a5,80004860 <holdingsleep+0x3e>
80004844: 4481 li s1,0
release(&lk->lk);
80004846: 854a mv a0,s2
80004848: ffffc097 auipc ra,0xffffc
8000484c: 42e080e7 jalr 1070(ra) # 80000c76 <release>
return r;
}
80004850: 8526 mv a0,s1
80004852: 70a2 ld ra,40(sp)
80004854: 7402 ld s0,32(sp)
80004856: 64e2 ld s1,24(sp)
80004858: 6942 ld s2,16(sp)
8000485a: 69a2 ld s3,8(sp)
8000485c: 6145 addi sp,sp,48
8000485e: 8082 ret
r = lk->locked && (lk->pid == myproc()->pid);
80004860: 0284a983 lw s3,40(s1)
80004864: ffffd097 auipc ra,0xffffd
80004868: 11a080e7 jalr 282(ra) # 8000197e <myproc>
8000486c: 5904 lw s1,48(a0)
8000486e: 413484b3 sub s1,s1,s3
80004872: 0014b493 seqz s1,s1
80004876: bfc1 j 80004846 <holdingsleep+0x24>
0000000080004878 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80004878: 1141 addi sp,sp,-16
8000487a: e406 sd ra,8(sp)
8000487c: e022 sd s0,0(sp)
8000487e: 0800 addi s0,sp,16
initlock(&ftable.lock, "ftable");
80004880: 00004597 auipc a1,0x4
80004884: f2058593 addi a1,a1,-224 # 800087a0 <syscalls+0x250>
80004888: 0001e517 auipc a0,0x1e
8000488c: 93050513 addi a0,a0,-1744 # 800221b8 <ftable>
80004890: ffffc097 auipc ra,0xffffc
80004894: 2a2080e7 jalr 674(ra) # 80000b32 <initlock>
}
80004898: 60a2 ld ra,8(sp)
8000489a: 6402 ld s0,0(sp)
8000489c: 0141 addi sp,sp,16
8000489e: 8082 ret
00000000800048a0 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
800048a0: 1101 addi sp,sp,-32
800048a2: ec06 sd ra,24(sp)
800048a4: e822 sd s0,16(sp)
800048a6: e426 sd s1,8(sp)
800048a8: 1000 addi s0,sp,32
struct file *f;
acquire(&ftable.lock);
800048aa: 0001e517 auipc a0,0x1e
800048ae: 90e50513 addi a0,a0,-1778 # 800221b8 <ftable>
800048b2: ffffc097 auipc ra,0xffffc
800048b6: 310080e7 jalr 784(ra) # 80000bc2 <acquire>
for(f = ftable.file; f < ftable.file + NFILE; f++){
800048ba: 0001e497 auipc s1,0x1e
800048be: 91648493 addi s1,s1,-1770 # 800221d0 <ftable+0x18>
800048c2: 0001f717 auipc a4,0x1f
800048c6: 8ae70713 addi a4,a4,-1874 # 80023170 <ftable+0xfb8>
if(f->ref == 0){
800048ca: 40dc lw a5,4(s1)
800048cc: cf99 beqz a5,800048ea <filealloc+0x4a>
for(f = ftable.file; f < ftable.file + NFILE; f++){
800048ce: 02848493 addi s1,s1,40
800048d2: fee49ce3 bne s1,a4,800048ca <filealloc+0x2a>
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
800048d6: 0001e517 auipc a0,0x1e
800048da: 8e250513 addi a0,a0,-1822 # 800221b8 <ftable>
800048de: ffffc097 auipc ra,0xffffc
800048e2: 398080e7 jalr 920(ra) # 80000c76 <release>
return 0;
800048e6: 4481 li s1,0
800048e8: a819 j 800048fe <filealloc+0x5e>
f->ref = 1;
800048ea: 4785 li a5,1
800048ec: c0dc sw a5,4(s1)
release(&ftable.lock);
800048ee: 0001e517 auipc a0,0x1e
800048f2: 8ca50513 addi a0,a0,-1846 # 800221b8 <ftable>
800048f6: ffffc097 auipc ra,0xffffc
800048fa: 380080e7 jalr 896(ra) # 80000c76 <release>
}
800048fe: 8526 mv a0,s1
80004900: 60e2 ld ra,24(sp)
80004902: 6442 ld s0,16(sp)
80004904: 64a2 ld s1,8(sp)
80004906: 6105 addi sp,sp,32
80004908: 8082 ret
000000008000490a <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
8000490a: 1101 addi sp,sp,-32
8000490c: ec06 sd ra,24(sp)
8000490e: e822 sd s0,16(sp)
80004910: e426 sd s1,8(sp)
80004912: 1000 addi s0,sp,32
80004914: 84aa mv s1,a0
acquire(&ftable.lock);
80004916: 0001e517 auipc a0,0x1e
8000491a: 8a250513 addi a0,a0,-1886 # 800221b8 <ftable>
8000491e: ffffc097 auipc ra,0xffffc
80004922: 2a4080e7 jalr 676(ra) # 80000bc2 <acquire>
if(f->ref < 1)
80004926: 40dc lw a5,4(s1)
80004928: 02f05263 blez a5,8000494c <filedup+0x42>
panic("filedup");
f->ref++;
8000492c: 2785 addiw a5,a5,1
8000492e: c0dc sw a5,4(s1)
release(&ftable.lock);
80004930: 0001e517 auipc a0,0x1e
80004934: 88850513 addi a0,a0,-1912 # 800221b8 <ftable>
80004938: ffffc097 auipc ra,0xffffc
8000493c: 33e080e7 jalr 830(ra) # 80000c76 <release>
return f;
}
80004940: 8526 mv a0,s1
80004942: 60e2 ld ra,24(sp)
80004944: 6442 ld s0,16(sp)
80004946: 64a2 ld s1,8(sp)
80004948: 6105 addi sp,sp,32
8000494a: 8082 ret
panic("filedup");
8000494c: 00004517 auipc a0,0x4
80004950: e5c50513 addi a0,a0,-420 # 800087a8 <syscalls+0x258>
80004954: ffffc097 auipc ra,0xffffc
80004958: bd6080e7 jalr -1066(ra) # 8000052a <panic>
000000008000495c <fileclose>:
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
8000495c: 7139 addi sp,sp,-64
8000495e: fc06 sd ra,56(sp)
80004960: f822 sd s0,48(sp)
80004962: f426 sd s1,40(sp)
80004964: f04a sd s2,32(sp)
80004966: ec4e sd s3,24(sp)
80004968: e852 sd s4,16(sp)
8000496a: e456 sd s5,8(sp)
8000496c: 0080 addi s0,sp,64
8000496e: 84aa mv s1,a0
struct file ff;
acquire(&ftable.lock);
80004970: 0001e517 auipc a0,0x1e
80004974: 84850513 addi a0,a0,-1976 # 800221b8 <ftable>
80004978: ffffc097 auipc ra,0xffffc
8000497c: 24a080e7 jalr 586(ra) # 80000bc2 <acquire>
if(f->ref < 1)
80004980: 40dc lw a5,4(s1)
80004982: 06f05163 blez a5,800049e4 <fileclose+0x88>
panic("fileclose");
if(--f->ref > 0){
80004986: 37fd addiw a5,a5,-1
80004988: 0007871b sext.w a4,a5
8000498c: c0dc sw a5,4(s1)
8000498e: 06e04363 bgtz a4,800049f4 <fileclose+0x98>
release(&ftable.lock);
return;
}
ff = *f;
80004992: 0004a903 lw s2,0(s1)
80004996: 0094ca83 lbu s5,9(s1)
8000499a: 0104ba03 ld s4,16(s1)
8000499e: 0184b983 ld s3,24(s1)
f->ref = 0;
800049a2: 0004a223 sw zero,4(s1)
f->type = FD_NONE;
800049a6: 0004a023 sw zero,0(s1)
release(&ftable.lock);
800049aa: 0001e517 auipc a0,0x1e
800049ae: 80e50513 addi a0,a0,-2034 # 800221b8 <ftable>
800049b2: ffffc097 auipc ra,0xffffc
800049b6: 2c4080e7 jalr 708(ra) # 80000c76 <release>
if(ff.type == FD_PIPE){
800049ba: 4785 li a5,1
800049bc: 04f90d63 beq s2,a5,80004a16 <fileclose+0xba>
pipeclose(ff.pipe, ff.writable);
} else if(ff.type == FD_INODE || ff.type == FD_DEVICE){
800049c0: 3979 addiw s2,s2,-2
800049c2: 4785 li a5,1
800049c4: 0527e063 bltu a5,s2,80004a04 <fileclose+0xa8>
begin_op();
800049c8: 00000097 auipc ra,0x0
800049cc: ac8080e7 jalr -1336(ra) # 80004490 <begin_op>
iput(ff.ip);
800049d0: 854e mv a0,s3
800049d2: fffff097 auipc ra,0xfffff
800049d6: 2a2080e7 jalr 674(ra) # 80003c74 <iput>
end_op();
800049da: 00000097 auipc ra,0x0
800049de: b36080e7 jalr -1226(ra) # 80004510 <end_op>
800049e2: a00d j 80004a04 <fileclose+0xa8>
panic("fileclose");
800049e4: 00004517 auipc a0,0x4
800049e8: dcc50513 addi a0,a0,-564 # 800087b0 <syscalls+0x260>
800049ec: ffffc097 auipc ra,0xffffc
800049f0: b3e080e7 jalr -1218(ra) # 8000052a <panic>
release(&ftable.lock);
800049f4: 0001d517 auipc a0,0x1d
800049f8: 7c450513 addi a0,a0,1988 # 800221b8 <ftable>
800049fc: ffffc097 auipc ra,0xffffc
80004a00: 27a080e7 jalr 634(ra) # 80000c76 <release>
}
}
80004a04: 70e2 ld ra,56(sp)
80004a06: 7442 ld s0,48(sp)
80004a08: 74a2 ld s1,40(sp)
80004a0a: 7902 ld s2,32(sp)
80004a0c: 69e2 ld s3,24(sp)
80004a0e: 6a42 ld s4,16(sp)
80004a10: 6aa2 ld s5,8(sp)
80004a12: 6121 addi sp,sp,64
80004a14: 8082 ret
pipeclose(ff.pipe, ff.writable);
80004a16: 85d6 mv a1,s5
80004a18: 8552 mv a0,s4
80004a1a: 00000097 auipc ra,0x0
80004a1e: 34c080e7 jalr 844(ra) # 80004d66 <pipeclose>
80004a22: b7cd j 80004a04 <fileclose+0xa8>
0000000080004a24 <filestat>:
// Get metadata about file f.
// addr is a user virtual address, pointing to a struct stat.
int
filestat(struct file *f, uint64 addr)
{
80004a24: 715d addi sp,sp,-80
80004a26: e486 sd ra,72(sp)
80004a28: e0a2 sd s0,64(sp)
80004a2a: fc26 sd s1,56(sp)
80004a2c: f84a sd s2,48(sp)
80004a2e: f44e sd s3,40(sp)
80004a30: 0880 addi s0,sp,80
80004a32: 84aa mv s1,a0
80004a34: 89ae mv s3,a1
struct proc *p = myproc();
80004a36: ffffd097 auipc ra,0xffffd
80004a3a: f48080e7 jalr -184(ra) # 8000197e <myproc>
struct stat st;
if(f->type == FD_INODE || f->type == FD_DEVICE){
80004a3e: 409c lw a5,0(s1)
80004a40: 37f9 addiw a5,a5,-2
80004a42: 4705 li a4,1
80004a44: 04f76763 bltu a4,a5,80004a92 <filestat+0x6e>
80004a48: 892a mv s2,a0
ilock(f->ip);
80004a4a: 6c88 ld a0,24(s1)
80004a4c: fffff097 auipc ra,0xfffff
80004a50: 06e080e7 jalr 110(ra) # 80003aba <ilock>
stati(f->ip, &st);
80004a54: fb840593 addi a1,s0,-72
80004a58: 6c88 ld a0,24(s1)
80004a5a: fffff097 auipc ra,0xfffff
80004a5e: 2ea080e7 jalr 746(ra) # 80003d44 <stati>
iunlock(f->ip);
80004a62: 6c88 ld a0,24(s1)
80004a64: fffff097 auipc ra,0xfffff
80004a68: 118080e7 jalr 280(ra) # 80003b7c <iunlock>
if(copyout(p->pagetable, addr, (char *)&st, sizeof(st)) < 0)
80004a6c: 46e1 li a3,24
80004a6e: fb840613 addi a2,s0,-72
80004a72: 85ce mv a1,s3
80004a74: 08893503 ld a0,136(s2)
80004a78: ffffd097 auipc ra,0xffffd
80004a7c: bc6080e7 jalr -1082(ra) # 8000163e <copyout>
80004a80: 41f5551b sraiw a0,a0,0x1f
return -1;
return 0;
}
return -1;
}
80004a84: 60a6 ld ra,72(sp)
80004a86: 6406 ld s0,64(sp)
80004a88: 74e2 ld s1,56(sp)
80004a8a: 7942 ld s2,48(sp)
80004a8c: 79a2 ld s3,40(sp)
80004a8e: 6161 addi sp,sp,80
80004a90: 8082 ret
return -1;
80004a92: 557d li a0,-1
80004a94: bfc5 j 80004a84 <filestat+0x60>
0000000080004a96 <fileread>:
// Read from file f.
// addr is a user virtual address.
int
fileread(struct file *f, uint64 addr, int n)
{
80004a96: 7179 addi sp,sp,-48
80004a98: f406 sd ra,40(sp)
80004a9a: f022 sd s0,32(sp)
80004a9c: ec26 sd s1,24(sp)
80004a9e: e84a sd s2,16(sp)
80004aa0: e44e sd s3,8(sp)
80004aa2: 1800 addi s0,sp,48
int r = 0;
if(f->readable == 0)
80004aa4: 00854783 lbu a5,8(a0)
80004aa8: c3d5 beqz a5,80004b4c <fileread+0xb6>
80004aaa: 84aa mv s1,a0
80004aac: 89ae mv s3,a1
80004aae: 8932 mv s2,a2
return -1;
if(f->type == FD_PIPE){
80004ab0: 411c lw a5,0(a0)
80004ab2: 4705 li a4,1
80004ab4: 04e78963 beq a5,a4,80004b06 <fileread+0x70>
r = piperead(f->pipe, addr, n);
} else if(f->type == FD_DEVICE){
80004ab8: 470d li a4,3
80004aba: 04e78d63 beq a5,a4,80004b14 <fileread+0x7e>
if(f->major < 0 || f->major >= NDEV || !devsw[f->major].read)
return -1;
r = devsw[f->major].read(1, addr, n);
} else if(f->type == FD_INODE){
80004abe: 4709 li a4,2
80004ac0: 06e79e63 bne a5,a4,80004b3c <fileread+0xa6>
ilock(f->ip);
80004ac4: 6d08 ld a0,24(a0)
80004ac6: fffff097 auipc ra,0xfffff
80004aca: ff4080e7 jalr -12(ra) # 80003aba <ilock>
if((r = readi(f->ip, 1, addr, f->off, n)) > 0)
80004ace: 874a mv a4,s2
80004ad0: 5094 lw a3,32(s1)
80004ad2: 864e mv a2,s3
80004ad4: 4585 li a1,1
80004ad6: 6c88 ld a0,24(s1)
80004ad8: fffff097 auipc ra,0xfffff
80004adc: 296080e7 jalr 662(ra) # 80003d6e <readi>
80004ae0: 892a mv s2,a0
80004ae2: 00a05563 blez a0,80004aec <fileread+0x56>
f->off += r;
80004ae6: 509c lw a5,32(s1)
80004ae8: 9fa9 addw a5,a5,a0
80004aea: d09c sw a5,32(s1)
iunlock(f->ip);
80004aec: 6c88 ld a0,24(s1)
80004aee: fffff097 auipc ra,0xfffff
80004af2: 08e080e7 jalr 142(ra) # 80003b7c <iunlock>
} else {
panic("fileread");
}
return r;
}
80004af6: 854a mv a0,s2
80004af8: 70a2 ld ra,40(sp)
80004afa: 7402 ld s0,32(sp)
80004afc: 64e2 ld s1,24(sp)
80004afe: 6942 ld s2,16(sp)
80004b00: 69a2 ld s3,8(sp)
80004b02: 6145 addi sp,sp,48
80004b04: 8082 ret
r = piperead(f->pipe, addr, n);
80004b06: 6908 ld a0,16(a0)
80004b08: 00000097 auipc ra,0x0
80004b0c: 3c0080e7 jalr 960(ra) # 80004ec8 <piperead>
80004b10: 892a mv s2,a0
80004b12: b7d5 j 80004af6 <fileread+0x60>
if(f->major < 0 || f->major >= NDEV || !devsw[f->major].read)
80004b14: 02451783 lh a5,36(a0)
80004b18: 03079693 slli a3,a5,0x30
80004b1c: 92c1 srli a3,a3,0x30
80004b1e: 4725 li a4,9
80004b20: 02d76863 bltu a4,a3,80004b50 <fileread+0xba>
80004b24: 0792 slli a5,a5,0x4
80004b26: 0001d717 auipc a4,0x1d
80004b2a: 5f270713 addi a4,a4,1522 # 80022118 <devsw>
80004b2e: 97ba add a5,a5,a4
80004b30: 639c ld a5,0(a5)
80004b32: c38d beqz a5,80004b54 <fileread+0xbe>
r = devsw[f->major].read(1, addr, n);
80004b34: 4505 li a0,1
80004b36: 9782 jalr a5
80004b38: 892a mv s2,a0
80004b3a: bf75 j 80004af6 <fileread+0x60>
panic("fileread");
80004b3c: 00004517 auipc a0,0x4
80004b40: c8450513 addi a0,a0,-892 # 800087c0 <syscalls+0x270>
80004b44: ffffc097 auipc ra,0xffffc
80004b48: 9e6080e7 jalr -1562(ra) # 8000052a <panic>
return -1;
80004b4c: 597d li s2,-1
80004b4e: b765 j 80004af6 <fileread+0x60>
return -1;
80004b50: 597d li s2,-1
80004b52: b755 j 80004af6 <fileread+0x60>
80004b54: 597d li s2,-1
80004b56: b745 j 80004af6 <fileread+0x60>
0000000080004b58 <filewrite>:
// Write to file f.
// addr is a user virtual address.
int
filewrite(struct file *f, uint64 addr, int n)
{
80004b58: 715d addi sp,sp,-80
80004b5a: e486 sd ra,72(sp)
80004b5c: e0a2 sd s0,64(sp)
80004b5e: fc26 sd s1,56(sp)
80004b60: f84a sd s2,48(sp)
80004b62: f44e sd s3,40(sp)
80004b64: f052 sd s4,32(sp)
80004b66: ec56 sd s5,24(sp)
80004b68: e85a sd s6,16(sp)
80004b6a: e45e sd s7,8(sp)
80004b6c: e062 sd s8,0(sp)
80004b6e: 0880 addi s0,sp,80
int r, ret = 0;
if(f->writable == 0)
80004b70: 00954783 lbu a5,9(a0)
80004b74: 10078663 beqz a5,80004c80 <filewrite+0x128>
80004b78: 892a mv s2,a0
80004b7a: 8aae mv s5,a1
80004b7c: 8a32 mv s4,a2
return -1;
if(f->type == FD_PIPE){
80004b7e: 411c lw a5,0(a0)
80004b80: 4705 li a4,1
80004b82: 02e78263 beq a5,a4,80004ba6 <filewrite+0x4e>
ret = pipewrite(f->pipe, addr, n);
} else if(f->type == FD_DEVICE){
80004b86: 470d li a4,3
80004b88: 02e78663 beq a5,a4,80004bb4 <filewrite+0x5c>
if(f->major < 0 || f->major >= NDEV || !devsw[f->major].write)
return -1;
ret = devsw[f->major].write(1, addr, n);
} else if(f->type == FD_INODE){
80004b8c: 4709 li a4,2
80004b8e: 0ee79163 bne a5,a4,80004c70 <filewrite+0x118>
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((MAXOPBLOCKS-1-1-2) / 2) * BSIZE;
int i = 0;
while(i < n){
80004b92: 0ac05d63 blez a2,80004c4c <filewrite+0xf4>
int i = 0;
80004b96: 4981 li s3,0
80004b98: 6b05 lui s6,0x1
80004b9a: c00b0b13 addi s6,s6,-1024 # c00 <_entry-0x7ffff400>
80004b9e: 6b85 lui s7,0x1
80004ba0: c00b8b9b addiw s7,s7,-1024
80004ba4: a861 j 80004c3c <filewrite+0xe4>
ret = pipewrite(f->pipe, addr, n);
80004ba6: 6908 ld a0,16(a0)
80004ba8: 00000097 auipc ra,0x0
80004bac: 22e080e7 jalr 558(ra) # 80004dd6 <pipewrite>
80004bb0: 8a2a mv s4,a0
80004bb2: a045 j 80004c52 <filewrite+0xfa>
if(f->major < 0 || f->major >= NDEV || !devsw[f->major].write)
80004bb4: 02451783 lh a5,36(a0)
80004bb8: 03079693 slli a3,a5,0x30
80004bbc: 92c1 srli a3,a3,0x30
80004bbe: 4725 li a4,9
80004bc0: 0cd76263 bltu a4,a3,80004c84 <filewrite+0x12c>
80004bc4: 0792 slli a5,a5,0x4
80004bc6: 0001d717 auipc a4,0x1d
80004bca: 55270713 addi a4,a4,1362 # 80022118 <devsw>
80004bce: 97ba add a5,a5,a4
80004bd0: 679c ld a5,8(a5)
80004bd2: cbdd beqz a5,80004c88 <filewrite+0x130>
ret = devsw[f->major].write(1, addr, n);
80004bd4: 4505 li a0,1
80004bd6: 9782 jalr a5
80004bd8: 8a2a mv s4,a0
80004bda: a8a5 j 80004c52 <filewrite+0xfa>
80004bdc: 00048c1b sext.w s8,s1
int n1 = n - i;
if(n1 > max)
n1 = max;
begin_op();
80004be0: 00000097 auipc ra,0x0
80004be4: 8b0080e7 jalr -1872(ra) # 80004490 <begin_op>
ilock(f->ip);
80004be8: 01893503 ld a0,24(s2)
80004bec: fffff097 auipc ra,0xfffff
80004bf0: ece080e7 jalr -306(ra) # 80003aba <ilock>
if ((r = writei(f->ip, 1, addr + i, f->off, n1)) > 0)
80004bf4: 8762 mv a4,s8
80004bf6: 02092683 lw a3,32(s2)
80004bfa: 01598633 add a2,s3,s5
80004bfe: 4585 li a1,1
80004c00: 01893503 ld a0,24(s2)
80004c04: fffff097 auipc ra,0xfffff
80004c08: 262080e7 jalr 610(ra) # 80003e66 <writei>
80004c0c: 84aa mv s1,a0
80004c0e: 00a05763 blez a0,80004c1c <filewrite+0xc4>
f->off += r;
80004c12: 02092783 lw a5,32(s2)
80004c16: 9fa9 addw a5,a5,a0
80004c18: 02f92023 sw a5,32(s2)
iunlock(f->ip);
80004c1c: 01893503 ld a0,24(s2)
80004c20: fffff097 auipc ra,0xfffff
80004c24: f5c080e7 jalr -164(ra) # 80003b7c <iunlock>
end_op();
80004c28: 00000097 auipc ra,0x0
80004c2c: 8e8080e7 jalr -1816(ra) # 80004510 <end_op>
if(r != n1){
80004c30: 009c1f63 bne s8,s1,80004c4e <filewrite+0xf6>
// error from writei
break;
}
i += r;
80004c34: 013489bb addw s3,s1,s3
while(i < n){
80004c38: 0149db63 bge s3,s4,80004c4e <filewrite+0xf6>
int n1 = n - i;
80004c3c: 413a07bb subw a5,s4,s3
if(n1 > max)
80004c40: 84be mv s1,a5
80004c42: 2781 sext.w a5,a5
80004c44: f8fb5ce3 bge s6,a5,80004bdc <filewrite+0x84>
80004c48: 84de mv s1,s7
80004c4a: bf49 j 80004bdc <filewrite+0x84>
int i = 0;
80004c4c: 4981 li s3,0
}
ret = (i == n ? n : -1);
80004c4e: 013a1f63 bne s4,s3,80004c6c <filewrite+0x114>
} else {
panic("filewrite");
}
return ret;
}
80004c52: 8552 mv a0,s4
80004c54: 60a6 ld ra,72(sp)
80004c56: 6406 ld s0,64(sp)
80004c58: 74e2 ld s1,56(sp)
80004c5a: 7942 ld s2,48(sp)
80004c5c: 79a2 ld s3,40(sp)
80004c5e: 7a02 ld s4,32(sp)
80004c60: 6ae2 ld s5,24(sp)
80004c62: 6b42 ld s6,16(sp)
80004c64: 6ba2 ld s7,8(sp)
80004c66: 6c02 ld s8,0(sp)
80004c68: 6161 addi sp,sp,80
80004c6a: 8082 ret
ret = (i == n ? n : -1);
80004c6c: 5a7d li s4,-1
80004c6e: b7d5 j 80004c52 <filewrite+0xfa>
panic("filewrite");
80004c70: 00004517 auipc a0,0x4
80004c74: b6050513 addi a0,a0,-1184 # 800087d0 <syscalls+0x280>
80004c78: ffffc097 auipc ra,0xffffc
80004c7c: 8b2080e7 jalr -1870(ra) # 8000052a <panic>
return -1;
80004c80: 5a7d li s4,-1
80004c82: bfc1 j 80004c52 <filewrite+0xfa>
return -1;
80004c84: 5a7d li s4,-1
80004c86: b7f1 j 80004c52 <filewrite+0xfa>
80004c88: 5a7d li s4,-1
80004c8a: b7e1 j 80004c52 <filewrite+0xfa>
0000000080004c8c <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
80004c8c: 7179 addi sp,sp,-48
80004c8e: f406 sd ra,40(sp)
80004c90: f022 sd s0,32(sp)
80004c92: ec26 sd s1,24(sp)
80004c94: e84a sd s2,16(sp)
80004c96: e44e sd s3,8(sp)
80004c98: e052 sd s4,0(sp)
80004c9a: 1800 addi s0,sp,48
80004c9c: 84aa mv s1,a0
80004c9e: 8a2e mv s4,a1
struct pipe *pi;
pi = 0;
*f0 = *f1 = 0;
80004ca0: 0005b023 sd zero,0(a1)
80004ca4: 00053023 sd zero,0(a0)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80004ca8: 00000097 auipc ra,0x0
80004cac: bf8080e7 jalr -1032(ra) # 800048a0 <filealloc>
80004cb0: e088 sd a0,0(s1)
80004cb2: c551 beqz a0,80004d3e <pipealloc+0xb2>
80004cb4: 00000097 auipc ra,0x0
80004cb8: bec080e7 jalr -1044(ra) # 800048a0 <filealloc>
80004cbc: 00aa3023 sd a0,0(s4)
80004cc0: c92d beqz a0,80004d32 <pipealloc+0xa6>
goto bad;
if((pi = (struct pipe*)kalloc()) == 0)
80004cc2: ffffc097 auipc ra,0xffffc
80004cc6: e10080e7 jalr -496(ra) # 80000ad2 <kalloc>
80004cca: 892a mv s2,a0
80004ccc: c125 beqz a0,80004d2c <pipealloc+0xa0>
goto bad;
pi->readopen = 1;
80004cce: 4985 li s3,1
80004cd0: 23352023 sw s3,544(a0)
pi->writeopen = 1;
80004cd4: 23352223 sw s3,548(a0)
pi->nwrite = 0;
80004cd8: 20052e23 sw zero,540(a0)
pi->nread = 0;
80004cdc: 20052c23 sw zero,536(a0)
initlock(&pi->lock, "pipe");
80004ce0: 00003597 auipc a1,0x3
80004ce4: 7a858593 addi a1,a1,1960 # 80008488 <states.0+0x1e0>
80004ce8: ffffc097 auipc ra,0xffffc
80004cec: e4a080e7 jalr -438(ra) # 80000b32 <initlock>
(*f0)->type = FD_PIPE;
80004cf0: 609c ld a5,0(s1)
80004cf2: 0137a023 sw s3,0(a5)
(*f0)->readable = 1;
80004cf6: 609c ld a5,0(s1)
80004cf8: 01378423 sb s3,8(a5)
(*f0)->writable = 0;
80004cfc: 609c ld a5,0(s1)
80004cfe: 000784a3 sb zero,9(a5)
(*f0)->pipe = pi;
80004d02: 609c ld a5,0(s1)
80004d04: 0127b823 sd s2,16(a5)
(*f1)->type = FD_PIPE;
80004d08: 000a3783 ld a5,0(s4)
80004d0c: 0137a023 sw s3,0(a5)
(*f1)->readable = 0;
80004d10: 000a3783 ld a5,0(s4)
80004d14: 00078423 sb zero,8(a5)
(*f1)->writable = 1;
80004d18: 000a3783 ld a5,0(s4)
80004d1c: 013784a3 sb s3,9(a5)
(*f1)->pipe = pi;
80004d20: 000a3783 ld a5,0(s4)
80004d24: 0127b823 sd s2,16(a5)
return 0;
80004d28: 4501 li a0,0
80004d2a: a025 j 80004d52 <pipealloc+0xc6>
bad:
if(pi)
kfree((char*)pi);
if(*f0)
80004d2c: 6088 ld a0,0(s1)
80004d2e: e501 bnez a0,80004d36 <pipealloc+0xaa>
80004d30: a039 j 80004d3e <pipealloc+0xb2>
80004d32: 6088 ld a0,0(s1)
80004d34: c51d beqz a0,80004d62 <pipealloc+0xd6>
fileclose(*f0);
80004d36: 00000097 auipc ra,0x0
80004d3a: c26080e7 jalr -986(ra) # 8000495c <fileclose>
if(*f1)
80004d3e: 000a3783 ld a5,0(s4)
fileclose(*f1);
return -1;
80004d42: 557d li a0,-1
if(*f1)
80004d44: c799 beqz a5,80004d52 <pipealloc+0xc6>
fileclose(*f1);
80004d46: 853e mv a0,a5
80004d48: 00000097 auipc ra,0x0
80004d4c: c14080e7 jalr -1004(ra) # 8000495c <fileclose>
return -1;
80004d50: 557d li a0,-1
}
80004d52: 70a2 ld ra,40(sp)
80004d54: 7402 ld s0,32(sp)
80004d56: 64e2 ld s1,24(sp)
80004d58: 6942 ld s2,16(sp)
80004d5a: 69a2 ld s3,8(sp)
80004d5c: 6a02 ld s4,0(sp)
80004d5e: 6145 addi sp,sp,48
80004d60: 8082 ret
return -1;
80004d62: 557d li a0,-1
80004d64: b7fd j 80004d52 <pipealloc+0xc6>
0000000080004d66 <pipeclose>:
void
pipeclose(struct pipe *pi, int writable)
{
80004d66: 1101 addi sp,sp,-32
80004d68: ec06 sd ra,24(sp)
80004d6a: e822 sd s0,16(sp)
80004d6c: e426 sd s1,8(sp)
80004d6e: e04a sd s2,0(sp)
80004d70: 1000 addi s0,sp,32
80004d72: 84aa mv s1,a0
80004d74: 892e mv s2,a1
acquire(&pi->lock);
80004d76: ffffc097 auipc ra,0xffffc
80004d7a: e4c080e7 jalr -436(ra) # 80000bc2 <acquire>
if(writable){
80004d7e: 02090d63 beqz s2,80004db8 <pipeclose+0x52>
pi->writeopen = 0;
80004d82: 2204a223 sw zero,548(s1)
wakeup(&pi->nread);
80004d86: 21848513 addi a0,s1,536
80004d8a: ffffd097 auipc ra,0xffffd
80004d8e: 5de080e7 jalr 1502(ra) # 80002368 <wakeup>
} else {
pi->readopen = 0;
wakeup(&pi->nwrite);
}
if(pi->readopen == 0 && pi->writeopen == 0){
80004d92: 2204b783 ld a5,544(s1)
80004d96: eb95 bnez a5,80004dca <pipeclose+0x64>
release(&pi->lock);
80004d98: 8526 mv a0,s1
80004d9a: ffffc097 auipc ra,0xffffc
80004d9e: edc080e7 jalr -292(ra) # 80000c76 <release>
kfree((char*)pi);
80004da2: 8526 mv a0,s1
80004da4: ffffc097 auipc ra,0xffffc
80004da8: c32080e7 jalr -974(ra) # 800009d6 <kfree>
} else
release(&pi->lock);
}
80004dac: 60e2 ld ra,24(sp)
80004dae: 6442 ld s0,16(sp)
80004db0: 64a2 ld s1,8(sp)
80004db2: 6902 ld s2,0(sp)
80004db4: 6105 addi sp,sp,32
80004db6: 8082 ret
pi->readopen = 0;
80004db8: 2204a023 sw zero,544(s1)
wakeup(&pi->nwrite);
80004dbc: 21c48513 addi a0,s1,540
80004dc0: ffffd097 auipc ra,0xffffd
80004dc4: 5a8080e7 jalr 1448(ra) # 80002368 <wakeup>
80004dc8: b7e9 j 80004d92 <pipeclose+0x2c>
release(&pi->lock);
80004dca: 8526 mv a0,s1
80004dcc: ffffc097 auipc ra,0xffffc
80004dd0: eaa080e7 jalr -342(ra) # 80000c76 <release>
}
80004dd4: bfe1 j 80004dac <pipeclose+0x46>
0000000080004dd6 <pipewrite>:
int
pipewrite(struct pipe *pi, uint64 addr, int n)
{
80004dd6: 711d addi sp,sp,-96
80004dd8: ec86 sd ra,88(sp)
80004dda: e8a2 sd s0,80(sp)
80004ddc: e4a6 sd s1,72(sp)
80004dde: e0ca sd s2,64(sp)
80004de0: fc4e sd s3,56(sp)
80004de2: f852 sd s4,48(sp)
80004de4: f456 sd s5,40(sp)
80004de6: f05a sd s6,32(sp)
80004de8: ec5e sd s7,24(sp)
80004dea: e862 sd s8,16(sp)
80004dec: 1080 addi s0,sp,96
80004dee: 84aa mv s1,a0
80004df0: 8aae mv s5,a1
80004df2: 8a32 mv s4,a2
int i = 0;
struct proc *pr = myproc();
80004df4: ffffd097 auipc ra,0xffffd
80004df8: b8a080e7 jalr -1142(ra) # 8000197e <myproc>
80004dfc: 89aa mv s3,a0
acquire(&pi->lock);
80004dfe: 8526 mv a0,s1
80004e00: ffffc097 auipc ra,0xffffc
80004e04: dc2080e7 jalr -574(ra) # 80000bc2 <acquire>
while(i < n){
80004e08: 0b405363 blez s4,80004eae <pipewrite+0xd8>
int i = 0;
80004e0c: 4901 li s2,0
if(pi->nwrite == pi->nread + PIPESIZE){ //DOC: pipewrite-full
wakeup(&pi->nread);
sleep(&pi->nwrite, &pi->lock);
} else {
char ch;
if(copyin(pr->pagetable, &ch, addr + i, 1) == -1)
80004e0e: 5b7d li s6,-1
wakeup(&pi->nread);
80004e10: 21848c13 addi s8,s1,536
sleep(&pi->nwrite, &pi->lock);
80004e14: 21c48b93 addi s7,s1,540
80004e18: a089 j 80004e5a <pipewrite+0x84>
release(&pi->lock);
80004e1a: 8526 mv a0,s1
80004e1c: ffffc097 auipc ra,0xffffc
80004e20: e5a080e7 jalr -422(ra) # 80000c76 <release>
return -1;
80004e24: 597d li s2,-1
}
wakeup(&pi->nread);
release(&pi->lock);
return i;
}
80004e26: 854a mv a0,s2
80004e28: 60e6 ld ra,88(sp)
80004e2a: 6446 ld s0,80(sp)
80004e2c: 64a6 ld s1,72(sp)
80004e2e: 6906 ld s2,64(sp)
80004e30: 79e2 ld s3,56(sp)
80004e32: 7a42 ld s4,48(sp)
80004e34: 7aa2 ld s5,40(sp)
80004e36: 7b02 ld s6,32(sp)
80004e38: 6be2 ld s7,24(sp)
80004e3a: 6c42 ld s8,16(sp)
80004e3c: 6125 addi sp,sp,96
80004e3e: 8082 ret
wakeup(&pi->nread);
80004e40: 8562 mv a0,s8
80004e42: ffffd097 auipc ra,0xffffd
80004e46: 526080e7 jalr 1318(ra) # 80002368 <wakeup>
sleep(&pi->nwrite, &pi->lock);
80004e4a: 85a6 mv a1,s1
80004e4c: 855e mv a0,s7
80004e4e: ffffd097 auipc ra,0xffffd
80004e52: 2a6080e7 jalr 678(ra) # 800020f4 <sleep>
while(i < n){
80004e56: 05495d63 bge s2,s4,80004eb0 <pipewrite+0xda>
if(pi->readopen == 0 || pr->killed){
80004e5a: 2204a783 lw a5,544(s1)
80004e5e: dfd5 beqz a5,80004e1a <pipewrite+0x44>
80004e60: 0289a783 lw a5,40(s3)
80004e64: fbdd bnez a5,80004e1a <pipewrite+0x44>
if(pi->nwrite == pi->nread + PIPESIZE){ //DOC: pipewrite-full
80004e66: 2184a783 lw a5,536(s1)
80004e6a: 21c4a703 lw a4,540(s1)
80004e6e: 2007879b addiw a5,a5,512
80004e72: fcf707e3 beq a4,a5,80004e40 <pipewrite+0x6a>
if(copyin(pr->pagetable, &ch, addr + i, 1) == -1)
80004e76: 4685 li a3,1
80004e78: 01590633 add a2,s2,s5
80004e7c: faf40593 addi a1,s0,-81
80004e80: 0889b503 ld a0,136(s3)
80004e84: ffffd097 auipc ra,0xffffd
80004e88: 846080e7 jalr -1978(ra) # 800016ca <copyin>
80004e8c: 03650263 beq a0,s6,80004eb0 <pipewrite+0xda>
pi->data[pi->nwrite++ % PIPESIZE] = ch;
80004e90: 21c4a783 lw a5,540(s1)
80004e94: 0017871b addiw a4,a5,1
80004e98: 20e4ae23 sw a4,540(s1)
80004e9c: 1ff7f793 andi a5,a5,511
80004ea0: 97a6 add a5,a5,s1
80004ea2: faf44703 lbu a4,-81(s0)
80004ea6: 00e78c23 sb a4,24(a5)
i++;
80004eaa: 2905 addiw s2,s2,1
80004eac: b76d j 80004e56 <pipewrite+0x80>
int i = 0;
80004eae: 4901 li s2,0
wakeup(&pi->nread);
80004eb0: 21848513 addi a0,s1,536
80004eb4: ffffd097 auipc ra,0xffffd
80004eb8: 4b4080e7 jalr 1204(ra) # 80002368 <wakeup>
release(&pi->lock);
80004ebc: 8526 mv a0,s1
80004ebe: ffffc097 auipc ra,0xffffc
80004ec2: db8080e7 jalr -584(ra) # 80000c76 <release>
return i;
80004ec6: b785 j 80004e26 <pipewrite+0x50>
0000000080004ec8 <piperead>:
int
piperead(struct pipe *pi, uint64 addr, int n)
{
80004ec8: 715d addi sp,sp,-80
80004eca: e486 sd ra,72(sp)
80004ecc: e0a2 sd s0,64(sp)
80004ece: fc26 sd s1,56(sp)
80004ed0: f84a sd s2,48(sp)
80004ed2: f44e sd s3,40(sp)
80004ed4: f052 sd s4,32(sp)
80004ed6: ec56 sd s5,24(sp)
80004ed8: e85a sd s6,16(sp)
80004eda: 0880 addi s0,sp,80
80004edc: 84aa mv s1,a0
80004ede: 892e mv s2,a1
80004ee0: 8ab2 mv s5,a2
int i;
struct proc *pr = myproc();
80004ee2: ffffd097 auipc ra,0xffffd
80004ee6: a9c080e7 jalr -1380(ra) # 8000197e <myproc>
80004eea: 8a2a mv s4,a0
char ch;
acquire(&pi->lock);
80004eec: 8526 mv a0,s1
80004eee: ffffc097 auipc ra,0xffffc
80004ef2: cd4080e7 jalr -812(ra) # 80000bc2 <acquire>
while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty
80004ef6: 2184a703 lw a4,536(s1)
80004efa: 21c4a783 lw a5,540(s1)
if(pr->killed){
release(&pi->lock);
return -1;
}
sleep(&pi->nread, &pi->lock); //DOC: piperead-sleep
80004efe: 21848993 addi s3,s1,536
while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty
80004f02: 02f71463 bne a4,a5,80004f2a <piperead+0x62>
80004f06: 2244a783 lw a5,548(s1)
80004f0a: c385 beqz a5,80004f2a <piperead+0x62>
if(pr->killed){
80004f0c: 028a2783 lw a5,40(s4)
80004f10: ebc1 bnez a5,80004fa0 <piperead+0xd8>
sleep(&pi->nread, &pi->lock); //DOC: piperead-sleep
80004f12: 85a6 mv a1,s1
80004f14: 854e mv a0,s3
80004f16: ffffd097 auipc ra,0xffffd
80004f1a: 1de080e7 jalr 478(ra) # 800020f4 <sleep>
while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty
80004f1e: 2184a703 lw a4,536(s1)
80004f22: 21c4a783 lw a5,540(s1)
80004f26: fef700e3 beq a4,a5,80004f06 <piperead+0x3e>
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80004f2a: 4981 li s3,0
if(pi->nread == pi->nwrite)
break;
ch = pi->data[pi->nread++ % PIPESIZE];
if(copyout(pr->pagetable, addr + i, &ch, 1) == -1)
80004f2c: 5b7d li s6,-1
for(i = 0; i < n; i++){ //DOC: piperead-copy
80004f2e: 05505363 blez s5,80004f74 <piperead+0xac>
if(pi->nread == pi->nwrite)
80004f32: 2184a783 lw a5,536(s1)
80004f36: 21c4a703 lw a4,540(s1)
80004f3a: 02f70d63 beq a4,a5,80004f74 <piperead+0xac>
ch = pi->data[pi->nread++ % PIPESIZE];
80004f3e: 0017871b addiw a4,a5,1
80004f42: 20e4ac23 sw a4,536(s1)
80004f46: 1ff7f793 andi a5,a5,511
80004f4a: 97a6 add a5,a5,s1
80004f4c: 0187c783 lbu a5,24(a5)
80004f50: faf40fa3 sb a5,-65(s0)
if(copyout(pr->pagetable, addr + i, &ch, 1) == -1)
80004f54: 4685 li a3,1
80004f56: fbf40613 addi a2,s0,-65
80004f5a: 85ca mv a1,s2
80004f5c: 088a3503 ld a0,136(s4)
80004f60: ffffc097 auipc ra,0xffffc
80004f64: 6de080e7 jalr 1758(ra) # 8000163e <copyout>
80004f68: 01650663 beq a0,s6,80004f74 <piperead+0xac>
for(i = 0; i < n; i++){ //DOC: piperead-copy
80004f6c: 2985 addiw s3,s3,1
80004f6e: 0905 addi s2,s2,1
80004f70: fd3a91e3 bne s5,s3,80004f32 <piperead+0x6a>
break;
}
wakeup(&pi->nwrite); //DOC: piperead-wakeup
80004f74: 21c48513 addi a0,s1,540
80004f78: ffffd097 auipc ra,0xffffd
80004f7c: 3f0080e7 jalr 1008(ra) # 80002368 <wakeup>
release(&pi->lock);
80004f80: 8526 mv a0,s1
80004f82: ffffc097 auipc ra,0xffffc
80004f86: cf4080e7 jalr -780(ra) # 80000c76 <release>
return i;
}
80004f8a: 854e mv a0,s3
80004f8c: 60a6 ld ra,72(sp)
80004f8e: 6406 ld s0,64(sp)
80004f90: 74e2 ld s1,56(sp)
80004f92: 7942 ld s2,48(sp)
80004f94: 79a2 ld s3,40(sp)
80004f96: 7a02 ld s4,32(sp)
80004f98: 6ae2 ld s5,24(sp)
80004f9a: 6b42 ld s6,16(sp)
80004f9c: 6161 addi sp,sp,80
80004f9e: 8082 ret
release(&pi->lock);
80004fa0: 8526 mv a0,s1
80004fa2: ffffc097 auipc ra,0xffffc
80004fa6: cd4080e7 jalr -812(ra) # 80000c76 <release>
return -1;
80004faa: 59fd li s3,-1
80004fac: bff9 j 80004f8a <piperead+0xc2>
0000000080004fae <exec>:
static int loadseg(pde_t *pgdir, uint64 addr, struct inode *ip, uint offset, uint sz);
int
exec(char *path, char **argv)
{
80004fae: de010113 addi sp,sp,-544
80004fb2: 20113c23 sd ra,536(sp)
80004fb6: 20813823 sd s0,528(sp)
80004fba: 20913423 sd s1,520(sp)
80004fbe: 21213023 sd s2,512(sp)
80004fc2: ffce sd s3,504(sp)
80004fc4: fbd2 sd s4,496(sp)
80004fc6: f7d6 sd s5,488(sp)
80004fc8: f3da sd s6,480(sp)
80004fca: efde sd s7,472(sp)
80004fcc: ebe2 sd s8,464(sp)
80004fce: e7e6 sd s9,456(sp)
80004fd0: e3ea sd s10,448(sp)
80004fd2: ff6e sd s11,440(sp)
80004fd4: 1400 addi s0,sp,544
80004fd6: 892a mv s2,a0
80004fd8: dea43423 sd a0,-536(s0)
80004fdc: deb43823 sd a1,-528(s0)
uint64 argc, sz = 0, sp, ustack[MAXARG+1], stackbase;
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pagetable_t pagetable = 0, oldpagetable;
struct proc *p = myproc();
80004fe0: ffffd097 auipc ra,0xffffd
80004fe4: 99e080e7 jalr -1634(ra) # 8000197e <myproc>
80004fe8: 84aa mv s1,a0
begin_op();
80004fea: fffff097 auipc ra,0xfffff
80004fee: 4a6080e7 jalr 1190(ra) # 80004490 <begin_op>
if((ip = namei(path)) == 0){
80004ff2: 854a mv a0,s2
80004ff4: fffff097 auipc ra,0xfffff
80004ff8: 27c080e7 jalr 636(ra) # 80004270 <namei>
80004ffc: c93d beqz a0,80005072 <exec+0xc4>
80004ffe: 8aaa mv s5,a0
end_op();
return -1;
}
ilock(ip);
80005000: fffff097 auipc ra,0xfffff
80005004: aba080e7 jalr -1350(ra) # 80003aba <ilock>
// Check ELF header
if(readi(ip, 0, (uint64)&elf, 0, sizeof(elf)) != sizeof(elf))
80005008: 04000713 li a4,64
8000500c: 4681 li a3,0
8000500e: e4840613 addi a2,s0,-440
80005012: 4581 li a1,0
80005014: 8556 mv a0,s5
80005016: fffff097 auipc ra,0xfffff
8000501a: d58080e7 jalr -680(ra) # 80003d6e <readi>
8000501e: 04000793 li a5,64
80005022: 00f51a63 bne a0,a5,80005036 <exec+0x88>
goto bad;
if(elf.magic != ELF_MAGIC)
80005026: e4842703 lw a4,-440(s0)
8000502a: 464c47b7 lui a5,0x464c4
8000502e: 57f78793 addi a5,a5,1407 # 464c457f <_entry-0x39b3ba81>
80005032: 04f70663 beq a4,a5,8000507e <exec+0xd0>
bad:
if(pagetable)
proc_freepagetable(pagetable, sz);
if(ip){
iunlockput(ip);
80005036: 8556 mv a0,s5
80005038: fffff097 auipc ra,0xfffff
8000503c: ce4080e7 jalr -796(ra) # 80003d1c <iunlockput>
end_op();
80005040: fffff097 auipc ra,0xfffff
80005044: 4d0080e7 jalr 1232(ra) # 80004510 <end_op>
}
return -1;
80005048: 557d li a0,-1
}
8000504a: 21813083 ld ra,536(sp)
8000504e: 21013403 ld s0,528(sp)
80005052: 20813483 ld s1,520(sp)
80005056: 20013903 ld s2,512(sp)
8000505a: 79fe ld s3,504(sp)
8000505c: 7a5e ld s4,496(sp)
8000505e: 7abe ld s5,488(sp)
80005060: 7b1e ld s6,480(sp)
80005062: 6bfe ld s7,472(sp)
80005064: 6c5e ld s8,464(sp)
80005066: 6cbe ld s9,456(sp)
80005068: 6d1e ld s10,448(sp)
8000506a: 7dfa ld s11,440(sp)
8000506c: 22010113 addi sp,sp,544
80005070: 8082 ret
end_op();
80005072: fffff097 auipc ra,0xfffff
80005076: 49e080e7 jalr 1182(ra) # 80004510 <end_op>
return -1;
8000507a: 557d li a0,-1
8000507c: b7f9 j 8000504a <exec+0x9c>
if((pagetable = proc_pagetable(p)) == 0)
8000507e: 8526 mv a0,s1
80005080: ffffd097 auipc ra,0xffffd
80005084: 9c2080e7 jalr -1598(ra) # 80001a42 <proc_pagetable>
80005088: 8b2a mv s6,a0
8000508a: d555 beqz a0,80005036 <exec+0x88>
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
8000508c: e6842783 lw a5,-408(s0)
80005090: e8045703 lhu a4,-384(s0)
80005094: c735 beqz a4,80005100 <exec+0x152>
uint64 argc, sz = 0, sp, ustack[MAXARG+1], stackbase;
80005096: 4481 li s1,0
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80005098: e0043423 sd zero,-504(s0)
if(ph.vaddr % PGSIZE != 0)
8000509c: 6a05 lui s4,0x1
8000509e: fffa0713 addi a4,s4,-1 # fff <_entry-0x7ffff001>
800050a2: dee43023 sd a4,-544(s0)
uint64 pa;
if((va % PGSIZE) != 0)
panic("loadseg: va must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
800050a6: 6d85 lui s11,0x1
800050a8: 7d7d lui s10,0xfffff
800050aa: ac1d j 800052e0 <exec+0x332>
pa = walkaddr(pagetable, va + i);
if(pa == 0)
panic("loadseg: address should exist");
800050ac: 00003517 auipc a0,0x3
800050b0: 73450513 addi a0,a0,1844 # 800087e0 <syscalls+0x290>
800050b4: ffffb097 auipc ra,0xffffb
800050b8: 476080e7 jalr 1142(ra) # 8000052a <panic>
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
if(readi(ip, 0, (uint64)pa, offset+i, n) != n)
800050bc: 874a mv a4,s2
800050be: 009c86bb addw a3,s9,s1
800050c2: 4581 li a1,0
800050c4: 8556 mv a0,s5
800050c6: fffff097 auipc ra,0xfffff
800050ca: ca8080e7 jalr -856(ra) # 80003d6e <readi>
800050ce: 2501 sext.w a0,a0
800050d0: 1aa91863 bne s2,a0,80005280 <exec+0x2d2>
for(i = 0; i < sz; i += PGSIZE){
800050d4: 009d84bb addw s1,s11,s1
800050d8: 013d09bb addw s3,s10,s3
800050dc: 1f74f263 bgeu s1,s7,800052c0 <exec+0x312>
pa = walkaddr(pagetable, va + i);
800050e0: 02049593 slli a1,s1,0x20
800050e4: 9181 srli a1,a1,0x20
800050e6: 95e2 add a1,a1,s8
800050e8: 855a mv a0,s6
800050ea: ffffc097 auipc ra,0xffffc
800050ee: f62080e7 jalr -158(ra) # 8000104c <walkaddr>
800050f2: 862a mv a2,a0
if(pa == 0)
800050f4: dd45 beqz a0,800050ac <exec+0xfe>
n = PGSIZE;
800050f6: 8952 mv s2,s4
if(sz - i < PGSIZE)
800050f8: fd49f2e3 bgeu s3,s4,800050bc <exec+0x10e>
n = sz - i;
800050fc: 894e mv s2,s3
800050fe: bf7d j 800050bc <exec+0x10e>
uint64 argc, sz = 0, sp, ustack[MAXARG+1], stackbase;
80005100: 4481 li s1,0
iunlockput(ip);
80005102: 8556 mv a0,s5
80005104: fffff097 auipc ra,0xfffff
80005108: c18080e7 jalr -1000(ra) # 80003d1c <iunlockput>
end_op();
8000510c: fffff097 auipc ra,0xfffff
80005110: 404080e7 jalr 1028(ra) # 80004510 <end_op>
p = myproc();
80005114: ffffd097 auipc ra,0xffffd
80005118: 86a080e7 jalr -1942(ra) # 8000197e <myproc>
8000511c: 8baa mv s7,a0
uint64 oldsz = p->sz;
8000511e: 08053d03 ld s10,128(a0)
sz = PGROUNDUP(sz);
80005122: 6785 lui a5,0x1
80005124: 17fd addi a5,a5,-1
80005126: 94be add s1,s1,a5
80005128: 77fd lui a5,0xfffff
8000512a: 8fe5 and a5,a5,s1
8000512c: def43c23 sd a5,-520(s0)
if((sz1 = uvmalloc(pagetable, sz, sz + 2*PGSIZE)) == 0)
80005130: 6609 lui a2,0x2
80005132: 963e add a2,a2,a5
80005134: 85be mv a1,a5
80005136: 855a mv a0,s6
80005138: ffffc097 auipc ra,0xffffc
8000513c: 2b6080e7 jalr 694(ra) # 800013ee <uvmalloc>
80005140: 8c2a mv s8,a0
ip = 0;
80005142: 4a81 li s5,0
if((sz1 = uvmalloc(pagetable, sz, sz + 2*PGSIZE)) == 0)
80005144: 12050e63 beqz a0,80005280 <exec+0x2d2>
uvmclear(pagetable, sz-2*PGSIZE);
80005148: 75f9 lui a1,0xffffe
8000514a: 95aa add a1,a1,a0
8000514c: 855a mv a0,s6
8000514e: ffffc097 auipc ra,0xffffc
80005152: 4be080e7 jalr 1214(ra) # 8000160c <uvmclear>
stackbase = sp - PGSIZE;
80005156: 7afd lui s5,0xfffff
80005158: 9ae2 add s5,s5,s8
for(argc = 0; argv[argc]; argc++) {
8000515a: df043783 ld a5,-528(s0)
8000515e: 6388 ld a0,0(a5)
80005160: c925 beqz a0,800051d0 <exec+0x222>
80005162: e8840993 addi s3,s0,-376
80005166: f8840c93 addi s9,s0,-120
sp = sz;
8000516a: 8962 mv s2,s8
for(argc = 0; argv[argc]; argc++) {
8000516c: 4481 li s1,0
sp -= strlen(argv[argc]) + 1;
8000516e: ffffc097 auipc ra,0xffffc
80005172: cd4080e7 jalr -812(ra) # 80000e42 <strlen>
80005176: 0015079b addiw a5,a0,1
8000517a: 40f90933 sub s2,s2,a5
sp -= sp % 16; // riscv sp must be 16-byte aligned
8000517e: ff097913 andi s2,s2,-16
if(sp < stackbase)
80005182: 13596363 bltu s2,s5,800052a8 <exec+0x2fa>
if(copyout(pagetable, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80005186: df043d83 ld s11,-528(s0)
8000518a: 000dba03 ld s4,0(s11) # 1000 <_entry-0x7ffff000>
8000518e: 8552 mv a0,s4
80005190: ffffc097 auipc ra,0xffffc
80005194: cb2080e7 jalr -846(ra) # 80000e42 <strlen>
80005198: 0015069b addiw a3,a0,1
8000519c: 8652 mv a2,s4
8000519e: 85ca mv a1,s2
800051a0: 855a mv a0,s6
800051a2: ffffc097 auipc ra,0xffffc
800051a6: 49c080e7 jalr 1180(ra) # 8000163e <copyout>
800051aa: 10054363 bltz a0,800052b0 <exec+0x302>
ustack[argc] = sp;
800051ae: 0129b023 sd s2,0(s3)
for(argc = 0; argv[argc]; argc++) {
800051b2: 0485 addi s1,s1,1
800051b4: 008d8793 addi a5,s11,8
800051b8: def43823 sd a5,-528(s0)
800051bc: 008db503 ld a0,8(s11)
800051c0: c911 beqz a0,800051d4 <exec+0x226>
if(argc >= MAXARG)
800051c2: 09a1 addi s3,s3,8
800051c4: fb3c95e3 bne s9,s3,8000516e <exec+0x1c0>
sz = sz1;
800051c8: df843c23 sd s8,-520(s0)
ip = 0;
800051cc: 4a81 li s5,0
800051ce: a84d j 80005280 <exec+0x2d2>
sp = sz;
800051d0: 8962 mv s2,s8
for(argc = 0; argv[argc]; argc++) {
800051d2: 4481 li s1,0
ustack[argc] = 0;
800051d4: 00349793 slli a5,s1,0x3
800051d8: f9040713 addi a4,s0,-112
800051dc: 97ba add a5,a5,a4
800051de: ee07bc23 sd zero,-264(a5) # ffffffffffffeef8 <end+0xffffffff7ffd7ef8>
sp -= (argc+1) * sizeof(uint64);
800051e2: 00148693 addi a3,s1,1
800051e6: 068e slli a3,a3,0x3
800051e8: 40d90933 sub s2,s2,a3
sp -= sp % 16;
800051ec: ff097913 andi s2,s2,-16
if(sp < stackbase)
800051f0: 01597663 bgeu s2,s5,800051fc <exec+0x24e>
sz = sz1;
800051f4: df843c23 sd s8,-520(s0)
ip = 0;
800051f8: 4a81 li s5,0
800051fa: a059 j 80005280 <exec+0x2d2>
if(copyout(pagetable, sp, (char *)ustack, (argc+1)*sizeof(uint64)) < 0)
800051fc: e8840613 addi a2,s0,-376
80005200: 85ca mv a1,s2
80005202: 855a mv a0,s6
80005204: ffffc097 auipc ra,0xffffc
80005208: 43a080e7 jalr 1082(ra) # 8000163e <copyout>
8000520c: 0a054663 bltz a0,800052b8 <exec+0x30a>
p->trapframe->a1 = sp;
80005210: 090bb783 ld a5,144(s7) # 1090 <_entry-0x7fffef70>
80005214: 0727bc23 sd s2,120(a5)
for(last=s=path; *s; s++)
80005218: de843783 ld a5,-536(s0)
8000521c: 0007c703 lbu a4,0(a5)
80005220: cf11 beqz a4,8000523c <exec+0x28e>
80005222: 0785 addi a5,a5,1
if(*s == '/')
80005224: 02f00693 li a3,47
80005228: a039 j 80005236 <exec+0x288>
last = s+1;
8000522a: def43423 sd a5,-536(s0)
for(last=s=path; *s; s++)
8000522e: 0785 addi a5,a5,1
80005230: fff7c703 lbu a4,-1(a5)
80005234: c701 beqz a4,8000523c <exec+0x28e>
if(*s == '/')
80005236: fed71ce3 bne a4,a3,8000522e <exec+0x280>
8000523a: bfc5 j 8000522a <exec+0x27c>
safestrcpy(p->name, last, sizeof(p->name));
8000523c: 4641 li a2,16
8000523e: de843583 ld a1,-536(s0)
80005242: 190b8513 addi a0,s7,400
80005246: ffffc097 auipc ra,0xffffc
8000524a: bca080e7 jalr -1078(ra) # 80000e10 <safestrcpy>
oldpagetable = p->pagetable;
8000524e: 088bb503 ld a0,136(s7)
p->pagetable = pagetable;
80005252: 096bb423 sd s6,136(s7)
p->sz = sz;
80005256: 098bb023 sd s8,128(s7)
p->trapframe->epc = elf.entry; // initial program counter = main
8000525a: 090bb783 ld a5,144(s7)
8000525e: e6043703 ld a4,-416(s0)
80005262: ef98 sd a4,24(a5)
p->trapframe->sp = sp; // initial stack pointer
80005264: 090bb783 ld a5,144(s7)
80005268: 0327b823 sd s2,48(a5)
proc_freepagetable(oldpagetable, oldsz);
8000526c: 85ea mv a1,s10
8000526e: ffffd097 auipc ra,0xffffd
80005272: 870080e7 jalr -1936(ra) # 80001ade <proc_freepagetable>
return argc; // this ends up in a0, the first argument to main(argc, argv)
80005276: 0004851b sext.w a0,s1
8000527a: bbc1 j 8000504a <exec+0x9c>
8000527c: de943c23 sd s1,-520(s0)
proc_freepagetable(pagetable, sz);
80005280: df843583 ld a1,-520(s0)
80005284: 855a mv a0,s6
80005286: ffffd097 auipc ra,0xffffd
8000528a: 858080e7 jalr -1960(ra) # 80001ade <proc_freepagetable>
if(ip){
8000528e: da0a94e3 bnez s5,80005036 <exec+0x88>
return -1;
80005292: 557d li a0,-1
80005294: bb5d j 8000504a <exec+0x9c>
80005296: de943c23 sd s1,-520(s0)
8000529a: b7dd j 80005280 <exec+0x2d2>
8000529c: de943c23 sd s1,-520(s0)
800052a0: b7c5 j 80005280 <exec+0x2d2>
800052a2: de943c23 sd s1,-520(s0)
800052a6: bfe9 j 80005280 <exec+0x2d2>
sz = sz1;
800052a8: df843c23 sd s8,-520(s0)
ip = 0;
800052ac: 4a81 li s5,0
800052ae: bfc9 j 80005280 <exec+0x2d2>
sz = sz1;
800052b0: df843c23 sd s8,-520(s0)
ip = 0;
800052b4: 4a81 li s5,0
800052b6: b7e9 j 80005280 <exec+0x2d2>
sz = sz1;
800052b8: df843c23 sd s8,-520(s0)
ip = 0;
800052bc: 4a81 li s5,0
800052be: b7c9 j 80005280 <exec+0x2d2>
if((sz1 = uvmalloc(pagetable, sz, ph.vaddr + ph.memsz)) == 0)
800052c0: df843483 ld s1,-520(s0)
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
800052c4: e0843783 ld a5,-504(s0)
800052c8: 0017869b addiw a3,a5,1
800052cc: e0d43423 sd a3,-504(s0)
800052d0: e0043783 ld a5,-512(s0)
800052d4: 0387879b addiw a5,a5,56
800052d8: e8045703 lhu a4,-384(s0)
800052dc: e2e6d3e3 bge a3,a4,80005102 <exec+0x154>
if(readi(ip, 0, (uint64)&ph, off, sizeof(ph)) != sizeof(ph))
800052e0: 2781 sext.w a5,a5
800052e2: e0f43023 sd a5,-512(s0)
800052e6: 03800713 li a4,56
800052ea: 86be mv a3,a5
800052ec: e1040613 addi a2,s0,-496
800052f0: 4581 li a1,0
800052f2: 8556 mv a0,s5
800052f4: fffff097 auipc ra,0xfffff
800052f8: a7a080e7 jalr -1414(ra) # 80003d6e <readi>
800052fc: 03800793 li a5,56
80005300: f6f51ee3 bne a0,a5,8000527c <exec+0x2ce>
if(ph.type != ELF_PROG_LOAD)
80005304: e1042783 lw a5,-496(s0)
80005308: 4705 li a4,1
8000530a: fae79de3 bne a5,a4,800052c4 <exec+0x316>
if(ph.memsz < ph.filesz)
8000530e: e3843603 ld a2,-456(s0)
80005312: e3043783 ld a5,-464(s0)
80005316: f8f660e3 bltu a2,a5,80005296 <exec+0x2e8>
if(ph.vaddr + ph.memsz < ph.vaddr)
8000531a: e2043783 ld a5,-480(s0)
8000531e: 963e add a2,a2,a5
80005320: f6f66ee3 bltu a2,a5,8000529c <exec+0x2ee>
if((sz1 = uvmalloc(pagetable, sz, ph.vaddr + ph.memsz)) == 0)
80005324: 85a6 mv a1,s1
80005326: 855a mv a0,s6
80005328: ffffc097 auipc ra,0xffffc
8000532c: 0c6080e7 jalr 198(ra) # 800013ee <uvmalloc>
80005330: dea43c23 sd a0,-520(s0)
80005334: d53d beqz a0,800052a2 <exec+0x2f4>
if(ph.vaddr % PGSIZE != 0)
80005336: e2043c03 ld s8,-480(s0)
8000533a: de043783 ld a5,-544(s0)
8000533e: 00fc77b3 and a5,s8,a5
80005342: ff9d bnez a5,80005280 <exec+0x2d2>
if(loadseg(pagetable, ph.vaddr, ip, ph.off, ph.filesz) < 0)
80005344: e1842c83 lw s9,-488(s0)
80005348: e3042b83 lw s7,-464(s0)
for(i = 0; i < sz; i += PGSIZE){
8000534c: f60b8ae3 beqz s7,800052c0 <exec+0x312>
80005350: 89de mv s3,s7
80005352: 4481 li s1,0
80005354: b371 j 800050e0 <exec+0x132>
0000000080005356 <argfd>:
// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
80005356: 7179 addi sp,sp,-48
80005358: f406 sd ra,40(sp)
8000535a: f022 sd s0,32(sp)
8000535c: ec26 sd s1,24(sp)
8000535e: e84a sd s2,16(sp)
80005360: 1800 addi s0,sp,48
80005362: 892e mv s2,a1
80005364: 84b2 mv s1,a2
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80005366: fdc40593 addi a1,s0,-36
8000536a: ffffe097 auipc ra,0xffffe
8000536e: a5c080e7 jalr -1444(ra) # 80002dc6 <argint>
80005372: 04054063 bltz a0,800053b2 <argfd+0x5c>
return -1;
if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0)
80005376: fdc42703 lw a4,-36(s0)
8000537a: 47bd li a5,15
8000537c: 02e7ed63 bltu a5,a4,800053b6 <argfd+0x60>
80005380: ffffc097 auipc ra,0xffffc
80005384: 5fe080e7 jalr 1534(ra) # 8000197e <myproc>
80005388: fdc42703 lw a4,-36(s0)
8000538c: 02070793 addi a5,a4,32
80005390: 078e slli a5,a5,0x3
80005392: 953e add a0,a0,a5
80005394: 651c ld a5,8(a0)
80005396: c395 beqz a5,800053ba <argfd+0x64>
return -1;
if(pfd)
80005398: 00090463 beqz s2,800053a0 <argfd+0x4a>
*pfd = fd;
8000539c: 00e92023 sw a4,0(s2)
if(pf)
*pf = f;
return 0;
800053a0: 4501 li a0,0
if(pf)
800053a2: c091 beqz s1,800053a6 <argfd+0x50>
*pf = f;
800053a4: e09c sd a5,0(s1)
}
800053a6: 70a2 ld ra,40(sp)
800053a8: 7402 ld s0,32(sp)
800053aa: 64e2 ld s1,24(sp)
800053ac: 6942 ld s2,16(sp)
800053ae: 6145 addi sp,sp,48
800053b0: 8082 ret
return -1;
800053b2: 557d li a0,-1
800053b4: bfcd j 800053a6 <argfd+0x50>
return -1;
800053b6: 557d li a0,-1
800053b8: b7fd j 800053a6 <argfd+0x50>
800053ba: 557d li a0,-1
800053bc: b7ed j 800053a6 <argfd+0x50>
00000000800053be <fdalloc>:
// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
800053be: 1101 addi sp,sp,-32
800053c0: ec06 sd ra,24(sp)
800053c2: e822 sd s0,16(sp)
800053c4: e426 sd s1,8(sp)
800053c6: 1000 addi s0,sp,32
800053c8: 84aa mv s1,a0
int fd;
struct proc *p = myproc();
800053ca: ffffc097 auipc ra,0xffffc
800053ce: 5b4080e7 jalr 1460(ra) # 8000197e <myproc>
800053d2: 862a mv a2,a0
for(fd = 0; fd < NOFILE; fd++){
800053d4: 10850793 addi a5,a0,264
800053d8: 4501 li a0,0
800053da: 46c1 li a3,16
if(p->ofile[fd] == 0){
800053dc: 6398 ld a4,0(a5)
800053de: cb19 beqz a4,800053f4 <fdalloc+0x36>
for(fd = 0; fd < NOFILE; fd++){
800053e0: 2505 addiw a0,a0,1
800053e2: 07a1 addi a5,a5,8
800053e4: fed51ce3 bne a0,a3,800053dc <fdalloc+0x1e>
p->ofile[fd] = f;
return fd;
}
}
return -1;
800053e8: 557d li a0,-1
}
800053ea: 60e2 ld ra,24(sp)
800053ec: 6442 ld s0,16(sp)
800053ee: 64a2 ld s1,8(sp)
800053f0: 6105 addi sp,sp,32
800053f2: 8082 ret
p->ofile[fd] = f;
800053f4: 02050793 addi a5,a0,32
800053f8: 078e slli a5,a5,0x3
800053fa: 963e add a2,a2,a5
800053fc: e604 sd s1,8(a2)
return fd;
800053fe: b7f5 j 800053ea <fdalloc+0x2c>
0000000080005400 <create>:
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
80005400: 715d addi sp,sp,-80
80005402: e486 sd ra,72(sp)
80005404: e0a2 sd s0,64(sp)
80005406: fc26 sd s1,56(sp)
80005408: f84a sd s2,48(sp)
8000540a: f44e sd s3,40(sp)
8000540c: f052 sd s4,32(sp)
8000540e: ec56 sd s5,24(sp)
80005410: 0880 addi s0,sp,80
80005412: 89ae mv s3,a1
80005414: 8ab2 mv s5,a2
80005416: 8a36 mv s4,a3
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
80005418: fb040593 addi a1,s0,-80
8000541c: fffff097 auipc ra,0xfffff
80005420: e72080e7 jalr -398(ra) # 8000428e <nameiparent>
80005424: 892a mv s2,a0
80005426: 12050e63 beqz a0,80005562 <create+0x162>
return 0;
ilock(dp);
8000542a: ffffe097 auipc ra,0xffffe
8000542e: 690080e7 jalr 1680(ra) # 80003aba <ilock>
if((ip = dirlookup(dp, name, 0)) != 0){
80005432: 4601 li a2,0
80005434: fb040593 addi a1,s0,-80
80005438: 854a mv a0,s2
8000543a: fffff097 auipc ra,0xfffff
8000543e: b64080e7 jalr -1180(ra) # 80003f9e <dirlookup>
80005442: 84aa mv s1,a0
80005444: c921 beqz a0,80005494 <create+0x94>
iunlockput(dp);
80005446: 854a mv a0,s2
80005448: fffff097 auipc ra,0xfffff
8000544c: 8d4080e7 jalr -1836(ra) # 80003d1c <iunlockput>
ilock(ip);
80005450: 8526 mv a0,s1
80005452: ffffe097 auipc ra,0xffffe
80005456: 668080e7 jalr 1640(ra) # 80003aba <ilock>
if(type == T_FILE && (ip->type == T_FILE || ip->type == T_DEVICE))
8000545a: 2981 sext.w s3,s3
8000545c: 4789 li a5,2
8000545e: 02f99463 bne s3,a5,80005486 <create+0x86>
80005462: 0444d783 lhu a5,68(s1)
80005466: 37f9 addiw a5,a5,-2
80005468: 17c2 slli a5,a5,0x30
8000546a: 93c1 srli a5,a5,0x30
8000546c: 4705 li a4,1
8000546e: 00f76c63 bltu a4,a5,80005486 <create+0x86>
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80005472: 8526 mv a0,s1
80005474: 60a6 ld ra,72(sp)
80005476: 6406 ld s0,64(sp)
80005478: 74e2 ld s1,56(sp)
8000547a: 7942 ld s2,48(sp)
8000547c: 79a2 ld s3,40(sp)
8000547e: 7a02 ld s4,32(sp)
80005480: 6ae2 ld s5,24(sp)
80005482: 6161 addi sp,sp,80
80005484: 8082 ret
iunlockput(ip);
80005486: 8526 mv a0,s1
80005488: fffff097 auipc ra,0xfffff
8000548c: 894080e7 jalr -1900(ra) # 80003d1c <iunlockput>
return 0;
80005490: 4481 li s1,0
80005492: b7c5 j 80005472 <create+0x72>
if((ip = ialloc(dp->dev, type)) == 0)
80005494: 85ce mv a1,s3
80005496: 00092503 lw a0,0(s2)
8000549a: ffffe097 auipc ra,0xffffe
8000549e: 488080e7 jalr 1160(ra) # 80003922 <ialloc>
800054a2: 84aa mv s1,a0
800054a4: c521 beqz a0,800054ec <create+0xec>
ilock(ip);
800054a6: ffffe097 auipc ra,0xffffe
800054aa: 614080e7 jalr 1556(ra) # 80003aba <ilock>
ip->major = major;
800054ae: 05549323 sh s5,70(s1)
ip->minor = minor;
800054b2: 05449423 sh s4,72(s1)
ip->nlink = 1;
800054b6: 4a05 li s4,1
800054b8: 05449523 sh s4,74(s1)
iupdate(ip);
800054bc: 8526 mv a0,s1
800054be: ffffe097 auipc ra,0xffffe
800054c2: 532080e7 jalr 1330(ra) # 800039f0 <iupdate>
if(type == T_DIR){ // Create . and .. entries.
800054c6: 2981 sext.w s3,s3
800054c8: 03498a63 beq s3,s4,800054fc <create+0xfc>
if(dirlink(dp, name, ip->inum) < 0)
800054cc: 40d0 lw a2,4(s1)
800054ce: fb040593 addi a1,s0,-80
800054d2: 854a mv a0,s2
800054d4: fffff097 auipc ra,0xfffff
800054d8: cda080e7 jalr -806(ra) # 800041ae <dirlink>
800054dc: 06054b63 bltz a0,80005552 <create+0x152>
iunlockput(dp);
800054e0: 854a mv a0,s2
800054e2: fffff097 auipc ra,0xfffff
800054e6: 83a080e7 jalr -1990(ra) # 80003d1c <iunlockput>
return ip;
800054ea: b761 j 80005472 <create+0x72>
panic("create: ialloc");
800054ec: 00003517 auipc a0,0x3
800054f0: 31450513 addi a0,a0,788 # 80008800 <syscalls+0x2b0>
800054f4: ffffb097 auipc ra,0xffffb
800054f8: 036080e7 jalr 54(ra) # 8000052a <panic>
dp->nlink++; // for ".."
800054fc: 04a95783 lhu a5,74(s2)
80005500: 2785 addiw a5,a5,1
80005502: 04f91523 sh a5,74(s2)
iupdate(dp);
80005506: 854a mv a0,s2
80005508: ffffe097 auipc ra,0xffffe
8000550c: 4e8080e7 jalr 1256(ra) # 800039f0 <iupdate>
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80005510: 40d0 lw a2,4(s1)
80005512: 00003597 auipc a1,0x3
80005516: 2fe58593 addi a1,a1,766 # 80008810 <syscalls+0x2c0>
8000551a: 8526 mv a0,s1
8000551c: fffff097 auipc ra,0xfffff
80005520: c92080e7 jalr -878(ra) # 800041ae <dirlink>
80005524: 00054f63 bltz a0,80005542 <create+0x142>
80005528: 00492603 lw a2,4(s2)
8000552c: 00003597 auipc a1,0x3
80005530: 2ec58593 addi a1,a1,748 # 80008818 <syscalls+0x2c8>
80005534: 8526 mv a0,s1
80005536: fffff097 auipc ra,0xfffff
8000553a: c78080e7 jalr -904(ra) # 800041ae <dirlink>
8000553e: f80557e3 bgez a0,800054cc <create+0xcc>
panic("create dots");
80005542: 00003517 auipc a0,0x3
80005546: 2de50513 addi a0,a0,734 # 80008820 <syscalls+0x2d0>
8000554a: ffffb097 auipc ra,0xffffb
8000554e: fe0080e7 jalr -32(ra) # 8000052a <panic>
panic("create: dirlink");
80005552: 00003517 auipc a0,0x3
80005556: 2de50513 addi a0,a0,734 # 80008830 <syscalls+0x2e0>
8000555a: ffffb097 auipc ra,0xffffb
8000555e: fd0080e7 jalr -48(ra) # 8000052a <panic>
return 0;
80005562: 84aa mv s1,a0
80005564: b739 j 80005472 <create+0x72>
0000000080005566 <sys_dup>:
{
80005566: 7179 addi sp,sp,-48
80005568: f406 sd ra,40(sp)
8000556a: f022 sd s0,32(sp)
8000556c: ec26 sd s1,24(sp)
8000556e: 1800 addi s0,sp,48
if(argfd(0, 0, &f) < 0)
80005570: fd840613 addi a2,s0,-40
80005574: 4581 li a1,0
80005576: 4501 li a0,0
80005578: 00000097 auipc ra,0x0
8000557c: dde080e7 jalr -546(ra) # 80005356 <argfd>
return -1;
80005580: 57fd li a5,-1
if(argfd(0, 0, &f) < 0)
80005582: 02054363 bltz a0,800055a8 <sys_dup+0x42>
if((fd=fdalloc(f)) < 0)
80005586: fd843503 ld a0,-40(s0)
8000558a: 00000097 auipc ra,0x0
8000558e: e34080e7 jalr -460(ra) # 800053be <fdalloc>
80005592: 84aa mv s1,a0
return -1;
80005594: 57fd li a5,-1
if((fd=fdalloc(f)) < 0)
80005596: 00054963 bltz a0,800055a8 <sys_dup+0x42>
filedup(f);
8000559a: fd843503 ld a0,-40(s0)
8000559e: fffff097 auipc ra,0xfffff
800055a2: 36c080e7 jalr 876(ra) # 8000490a <filedup>
return fd;
800055a6: 87a6 mv a5,s1
}
800055a8: 853e mv a0,a5
800055aa: 70a2 ld ra,40(sp)
800055ac: 7402 ld s0,32(sp)
800055ae: 64e2 ld s1,24(sp)
800055b0: 6145 addi sp,sp,48
800055b2: 8082 ret
00000000800055b4 <sys_read>:
{
800055b4: 7179 addi sp,sp,-48
800055b6: f406 sd ra,40(sp)
800055b8: f022 sd s0,32(sp)
800055ba: 1800 addi s0,sp,48
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
800055bc: fe840613 addi a2,s0,-24
800055c0: 4581 li a1,0
800055c2: 4501 li a0,0
800055c4: 00000097 auipc ra,0x0
800055c8: d92080e7 jalr -622(ra) # 80005356 <argfd>
return -1;
800055cc: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
800055ce: 04054163 bltz a0,80005610 <sys_read+0x5c>
800055d2: fe440593 addi a1,s0,-28
800055d6: 4509 li a0,2
800055d8: ffffd097 auipc ra,0xffffd
800055dc: 7ee080e7 jalr 2030(ra) # 80002dc6 <argint>
return -1;
800055e0: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
800055e2: 02054763 bltz a0,80005610 <sys_read+0x5c>
800055e6: fd840593 addi a1,s0,-40
800055ea: 4505 li a0,1
800055ec: ffffd097 auipc ra,0xffffd
800055f0: 7fc080e7 jalr 2044(ra) # 80002de8 <argaddr>
return -1;
800055f4: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
800055f6: 00054d63 bltz a0,80005610 <sys_read+0x5c>
return fileread(f, p, n);
800055fa: fe442603 lw a2,-28(s0)
800055fe: fd843583 ld a1,-40(s0)
80005602: fe843503 ld a0,-24(s0)
80005606: fffff097 auipc ra,0xfffff
8000560a: 490080e7 jalr 1168(ra) # 80004a96 <fileread>
8000560e: 87aa mv a5,a0
}
80005610: 853e mv a0,a5
80005612: 70a2 ld ra,40(sp)
80005614: 7402 ld s0,32(sp)
80005616: 6145 addi sp,sp,48
80005618: 8082 ret
000000008000561a <sys_write>:
{
8000561a: 7179 addi sp,sp,-48
8000561c: f406 sd ra,40(sp)
8000561e: f022 sd s0,32(sp)
80005620: 1800 addi s0,sp,48
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
80005622: fe840613 addi a2,s0,-24
80005626: 4581 li a1,0
80005628: 4501 li a0,0
8000562a: 00000097 auipc ra,0x0
8000562e: d2c080e7 jalr -724(ra) # 80005356 <argfd>
return -1;
80005632: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
80005634: 04054163 bltz a0,80005676 <sys_write+0x5c>
80005638: fe440593 addi a1,s0,-28
8000563c: 4509 li a0,2
8000563e: ffffd097 auipc ra,0xffffd
80005642: 788080e7 jalr 1928(ra) # 80002dc6 <argint>
return -1;
80005646: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
80005648: 02054763 bltz a0,80005676 <sys_write+0x5c>
8000564c: fd840593 addi a1,s0,-40
80005650: 4505 li a0,1
80005652: ffffd097 auipc ra,0xffffd
80005656: 796080e7 jalr 1942(ra) # 80002de8 <argaddr>
return -1;
8000565a: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0)
8000565c: 00054d63 bltz a0,80005676 <sys_write+0x5c>
return filewrite(f, p, n);
80005660: fe442603 lw a2,-28(s0)
80005664: fd843583 ld a1,-40(s0)
80005668: fe843503 ld a0,-24(s0)
8000566c: fffff097 auipc ra,0xfffff
80005670: 4ec080e7 jalr 1260(ra) # 80004b58 <filewrite>
80005674: 87aa mv a5,a0
}
80005676: 853e mv a0,a5
80005678: 70a2 ld ra,40(sp)
8000567a: 7402 ld s0,32(sp)
8000567c: 6145 addi sp,sp,48
8000567e: 8082 ret
0000000080005680 <sys_close>:
{
80005680: 1101 addi sp,sp,-32
80005682: ec06 sd ra,24(sp)
80005684: e822 sd s0,16(sp)
80005686: 1000 addi s0,sp,32
if(argfd(0, &fd, &f) < 0)
80005688: fe040613 addi a2,s0,-32
8000568c: fec40593 addi a1,s0,-20
80005690: 4501 li a0,0
80005692: 00000097 auipc ra,0x0
80005696: cc4080e7 jalr -828(ra) # 80005356 <argfd>
return -1;
8000569a: 57fd li a5,-1
if(argfd(0, &fd, &f) < 0)
8000569c: 02054563 bltz a0,800056c6 <sys_close+0x46>
myproc()->ofile[fd] = 0;
800056a0: ffffc097 auipc ra,0xffffc
800056a4: 2de080e7 jalr 734(ra) # 8000197e <myproc>
800056a8: fec42783 lw a5,-20(s0)
800056ac: 02078793 addi a5,a5,32
800056b0: 078e slli a5,a5,0x3
800056b2: 97aa add a5,a5,a0
800056b4: 0007b423 sd zero,8(a5)
fileclose(f);
800056b8: fe043503 ld a0,-32(s0)
800056bc: fffff097 auipc ra,0xfffff
800056c0: 2a0080e7 jalr 672(ra) # 8000495c <fileclose>
return 0;
800056c4: 4781 li a5,0
}
800056c6: 853e mv a0,a5
800056c8: 60e2 ld ra,24(sp)
800056ca: 6442 ld s0,16(sp)
800056cc: 6105 addi sp,sp,32
800056ce: 8082 ret
00000000800056d0 <sys_fstat>:
{
800056d0: 1101 addi sp,sp,-32
800056d2: ec06 sd ra,24(sp)
800056d4: e822 sd s0,16(sp)
800056d6: 1000 addi s0,sp,32
if(argfd(0, 0, &f) < 0 || argaddr(1, &st) < 0)
800056d8: fe840613 addi a2,s0,-24
800056dc: 4581 li a1,0
800056de: 4501 li a0,0
800056e0: 00000097 auipc ra,0x0
800056e4: c76080e7 jalr -906(ra) # 80005356 <argfd>
return -1;
800056e8: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argaddr(1, &st) < 0)
800056ea: 02054563 bltz a0,80005714 <sys_fstat+0x44>
800056ee: fe040593 addi a1,s0,-32
800056f2: 4505 li a0,1
800056f4: ffffd097 auipc ra,0xffffd
800056f8: 6f4080e7 jalr 1780(ra) # 80002de8 <argaddr>
return -1;
800056fc: 57fd li a5,-1
if(argfd(0, 0, &f) < 0 || argaddr(1, &st) < 0)
800056fe: 00054b63 bltz a0,80005714 <sys_fstat+0x44>
return filestat(f, st);
80005702: fe043583 ld a1,-32(s0)
80005706: fe843503 ld a0,-24(s0)
8000570a: fffff097 auipc ra,0xfffff
8000570e: 31a080e7 jalr 794(ra) # 80004a24 <filestat>
80005712: 87aa mv a5,a0
}
80005714: 853e mv a0,a5
80005716: 60e2 ld ra,24(sp)
80005718: 6442 ld s0,16(sp)
8000571a: 6105 addi sp,sp,32
8000571c: 8082 ret
000000008000571e <sys_link>:
{
8000571e: 7169 addi sp,sp,-304
80005720: f606 sd ra,296(sp)
80005722: f222 sd s0,288(sp)
80005724: ee26 sd s1,280(sp)
80005726: ea4a sd s2,272(sp)
80005728: 1a00 addi s0,sp,304
if(argstr(0, old, MAXPATH) < 0 || argstr(1, new, MAXPATH) < 0)
8000572a: 08000613 li a2,128
8000572e: ed040593 addi a1,s0,-304
80005732: 4501 li a0,0
80005734: ffffd097 auipc ra,0xffffd
80005738: 6d6080e7 jalr 1750(ra) # 80002e0a <argstr>
return -1;
8000573c: 57fd li a5,-1
if(argstr(0, old, MAXPATH) < 0 || argstr(1, new, MAXPATH) < 0)
8000573e: 10054e63 bltz a0,8000585a <sys_link+0x13c>
80005742: 08000613 li a2,128
80005746: f5040593 addi a1,s0,-176
8000574a: 4505 li a0,1
8000574c: ffffd097 auipc ra,0xffffd
80005750: 6be080e7 jalr 1726(ra) # 80002e0a <argstr>
return -1;
80005754: 57fd li a5,-1
if(argstr(0, old, MAXPATH) < 0 || argstr(1, new, MAXPATH) < 0)
80005756: 10054263 bltz a0,8000585a <sys_link+0x13c>
begin_op();
8000575a: fffff097 auipc ra,0xfffff
8000575e: d36080e7 jalr -714(ra) # 80004490 <begin_op>
if((ip = namei(old)) == 0){
80005762: ed040513 addi a0,s0,-304
80005766: fffff097 auipc ra,0xfffff
8000576a: b0a080e7 jalr -1270(ra) # 80004270 <namei>
8000576e: 84aa mv s1,a0
80005770: c551 beqz a0,800057fc <sys_link+0xde>
ilock(ip);
80005772: ffffe097 auipc ra,0xffffe
80005776: 348080e7 jalr 840(ra) # 80003aba <ilock>
if(ip->type == T_DIR){
8000577a: 04449703 lh a4,68(s1)
8000577e: 4785 li a5,1
80005780: 08f70463 beq a4,a5,80005808 <sys_link+0xea>
ip->nlink++;
80005784: 04a4d783 lhu a5,74(s1)
80005788: 2785 addiw a5,a5,1
8000578a: 04f49523 sh a5,74(s1)
iupdate(ip);
8000578e: 8526 mv a0,s1
80005790: ffffe097 auipc ra,0xffffe
80005794: 260080e7 jalr 608(ra) # 800039f0 <iupdate>
iunlock(ip);
80005798: 8526 mv a0,s1
8000579a: ffffe097 auipc ra,0xffffe
8000579e: 3e2080e7 jalr 994(ra) # 80003b7c <iunlock>
if((dp = nameiparent(new, name)) == 0)
800057a2: fd040593 addi a1,s0,-48
800057a6: f5040513 addi a0,s0,-176
800057aa: fffff097 auipc ra,0xfffff
800057ae: ae4080e7 jalr -1308(ra) # 8000428e <nameiparent>
800057b2: 892a mv s2,a0
800057b4: c935 beqz a0,80005828 <sys_link+0x10a>
ilock(dp);
800057b6: ffffe097 auipc ra,0xffffe
800057ba: 304080e7 jalr 772(ra) # 80003aba <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
800057be: 00092703 lw a4,0(s2)
800057c2: 409c lw a5,0(s1)
800057c4: 04f71d63 bne a4,a5,8000581e <sys_link+0x100>
800057c8: 40d0 lw a2,4(s1)
800057ca: fd040593 addi a1,s0,-48
800057ce: 854a mv a0,s2
800057d0: fffff097 auipc ra,0xfffff
800057d4: 9de080e7 jalr -1570(ra) # 800041ae <dirlink>
800057d8: 04054363 bltz a0,8000581e <sys_link+0x100>
iunlockput(dp);
800057dc: 854a mv a0,s2
800057de: ffffe097 auipc ra,0xffffe
800057e2: 53e080e7 jalr 1342(ra) # 80003d1c <iunlockput>
iput(ip);
800057e6: 8526 mv a0,s1
800057e8: ffffe097 auipc ra,0xffffe
800057ec: 48c080e7 jalr 1164(ra) # 80003c74 <iput>
end_op();
800057f0: fffff097 auipc ra,0xfffff
800057f4: d20080e7 jalr -736(ra) # 80004510 <end_op>
return 0;
800057f8: 4781 li a5,0
800057fa: a085 j 8000585a <sys_link+0x13c>
end_op();
800057fc: fffff097 auipc ra,0xfffff
80005800: d14080e7 jalr -748(ra) # 80004510 <end_op>
return -1;
80005804: 57fd li a5,-1
80005806: a891 j 8000585a <sys_link+0x13c>
iunlockput(ip);
80005808: 8526 mv a0,s1
8000580a: ffffe097 auipc ra,0xffffe
8000580e: 512080e7 jalr 1298(ra) # 80003d1c <iunlockput>
end_op();
80005812: fffff097 auipc ra,0xfffff
80005816: cfe080e7 jalr -770(ra) # 80004510 <end_op>
return -1;
8000581a: 57fd li a5,-1
8000581c: a83d j 8000585a <sys_link+0x13c>
iunlockput(dp);
8000581e: 854a mv a0,s2
80005820: ffffe097 auipc ra,0xffffe
80005824: 4fc080e7 jalr 1276(ra) # 80003d1c <iunlockput>
ilock(ip);
80005828: 8526 mv a0,s1
8000582a: ffffe097 auipc ra,0xffffe
8000582e: 290080e7 jalr 656(ra) # 80003aba <ilock>
ip->nlink--;
80005832: 04a4d783 lhu a5,74(s1)
80005836: 37fd addiw a5,a5,-1
80005838: 04f49523 sh a5,74(s1)
iupdate(ip);
8000583c: 8526 mv a0,s1
8000583e: ffffe097 auipc ra,0xffffe
80005842: 1b2080e7 jalr 434(ra) # 800039f0 <iupdate>
iunlockput(ip);
80005846: 8526 mv a0,s1
80005848: ffffe097 auipc ra,0xffffe
8000584c: 4d4080e7 jalr 1236(ra) # 80003d1c <iunlockput>
end_op();
80005850: fffff097 auipc ra,0xfffff
80005854: cc0080e7 jalr -832(ra) # 80004510 <end_op>
return -1;
80005858: 57fd li a5,-1
}
8000585a: 853e mv a0,a5
8000585c: 70b2 ld ra,296(sp)
8000585e: 7412 ld s0,288(sp)
80005860: 64f2 ld s1,280(sp)
80005862: 6952 ld s2,272(sp)
80005864: 6155 addi sp,sp,304
80005866: 8082 ret
0000000080005868 <sys_unlink>:
{
80005868: 7151 addi sp,sp,-240
8000586a: f586 sd ra,232(sp)
8000586c: f1a2 sd s0,224(sp)
8000586e: eda6 sd s1,216(sp)
80005870: e9ca sd s2,208(sp)
80005872: e5ce sd s3,200(sp)
80005874: 1980 addi s0,sp,240
if(argstr(0, path, MAXPATH) < 0)
80005876: 08000613 li a2,128
8000587a: f3040593 addi a1,s0,-208
8000587e: 4501 li a0,0
80005880: ffffd097 auipc ra,0xffffd
80005884: 58a080e7 jalr 1418(ra) # 80002e0a <argstr>
80005888: 18054163 bltz a0,80005a0a <sys_unlink+0x1a2>
begin_op();
8000588c: fffff097 auipc ra,0xfffff
80005890: c04080e7 jalr -1020(ra) # 80004490 <begin_op>
if((dp = nameiparent(path, name)) == 0){
80005894: fb040593 addi a1,s0,-80
80005898: f3040513 addi a0,s0,-208
8000589c: fffff097 auipc ra,0xfffff
800058a0: 9f2080e7 jalr -1550(ra) # 8000428e <nameiparent>
800058a4: 84aa mv s1,a0
800058a6: c979 beqz a0,8000597c <sys_unlink+0x114>
ilock(dp);
800058a8: ffffe097 auipc ra,0xffffe
800058ac: 212080e7 jalr 530(ra) # 80003aba <ilock>
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
800058b0: 00003597 auipc a1,0x3
800058b4: f6058593 addi a1,a1,-160 # 80008810 <syscalls+0x2c0>
800058b8: fb040513 addi a0,s0,-80
800058bc: ffffe097 auipc ra,0xffffe
800058c0: 6c8080e7 jalr 1736(ra) # 80003f84 <namecmp>
800058c4: 14050a63 beqz a0,80005a18 <sys_unlink+0x1b0>
800058c8: 00003597 auipc a1,0x3
800058cc: f5058593 addi a1,a1,-176 # 80008818 <syscalls+0x2c8>
800058d0: fb040513 addi a0,s0,-80
800058d4: ffffe097 auipc ra,0xffffe
800058d8: 6b0080e7 jalr 1712(ra) # 80003f84 <namecmp>
800058dc: 12050e63 beqz a0,80005a18 <sys_unlink+0x1b0>
if((ip = dirlookup(dp, name, &off)) == 0)
800058e0: f2c40613 addi a2,s0,-212
800058e4: fb040593 addi a1,s0,-80
800058e8: 8526 mv a0,s1
800058ea: ffffe097 auipc ra,0xffffe
800058ee: 6b4080e7 jalr 1716(ra) # 80003f9e <dirlookup>
800058f2: 892a mv s2,a0
800058f4: 12050263 beqz a0,80005a18 <sys_unlink+0x1b0>
ilock(ip);
800058f8: ffffe097 auipc ra,0xffffe
800058fc: 1c2080e7 jalr 450(ra) # 80003aba <ilock>
if(ip->nlink < 1)
80005900: 04a91783 lh a5,74(s2)
80005904: 08f05263 blez a5,80005988 <sys_unlink+0x120>
if(ip->type == T_DIR && !isdirempty(ip)){
80005908: 04491703 lh a4,68(s2)
8000590c: 4785 li a5,1
8000590e: 08f70563 beq a4,a5,80005998 <sys_unlink+0x130>
memset(&de, 0, sizeof(de));
80005912: 4641 li a2,16
80005914: 4581 li a1,0
80005916: fc040513 addi a0,s0,-64
8000591a: ffffb097 auipc ra,0xffffb
8000591e: 3a4080e7 jalr 932(ra) # 80000cbe <memset>
if(writei(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de))
80005922: 4741 li a4,16
80005924: f2c42683 lw a3,-212(s0)
80005928: fc040613 addi a2,s0,-64
8000592c: 4581 li a1,0
8000592e: 8526 mv a0,s1
80005930: ffffe097 auipc ra,0xffffe
80005934: 536080e7 jalr 1334(ra) # 80003e66 <writei>
80005938: 47c1 li a5,16
8000593a: 0af51563 bne a0,a5,800059e4 <sys_unlink+0x17c>
if(ip->type == T_DIR){
8000593e: 04491703 lh a4,68(s2)
80005942: 4785 li a5,1
80005944: 0af70863 beq a4,a5,800059f4 <sys_unlink+0x18c>
iunlockput(dp);
80005948: 8526 mv a0,s1
8000594a: ffffe097 auipc ra,0xffffe
8000594e: 3d2080e7 jalr 978(ra) # 80003d1c <iunlockput>
ip->nlink--;
80005952: 04a95783 lhu a5,74(s2)
80005956: 37fd addiw a5,a5,-1
80005958: 04f91523 sh a5,74(s2)
iupdate(ip);
8000595c: 854a mv a0,s2
8000595e: ffffe097 auipc ra,0xffffe
80005962: 092080e7 jalr 146(ra) # 800039f0 <iupdate>
iunlockput(ip);
80005966: 854a mv a0,s2
80005968: ffffe097 auipc ra,0xffffe
8000596c: 3b4080e7 jalr 948(ra) # 80003d1c <iunlockput>
end_op();
80005970: fffff097 auipc ra,0xfffff
80005974: ba0080e7 jalr -1120(ra) # 80004510 <end_op>
return 0;
80005978: 4501 li a0,0
8000597a: a84d j 80005a2c <sys_unlink+0x1c4>
end_op();
8000597c: fffff097 auipc ra,0xfffff
80005980: b94080e7 jalr -1132(ra) # 80004510 <end_op>
return -1;
80005984: 557d li a0,-1
80005986: a05d j 80005a2c <sys_unlink+0x1c4>
panic("unlink: nlink < 1");
80005988: 00003517 auipc a0,0x3
8000598c: eb850513 addi a0,a0,-328 # 80008840 <syscalls+0x2f0>
80005990: ffffb097 auipc ra,0xffffb
80005994: b9a080e7 jalr -1126(ra) # 8000052a <panic>
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80005998: 04c92703 lw a4,76(s2)
8000599c: 02000793 li a5,32
800059a0: f6e7f9e3 bgeu a5,a4,80005912 <sys_unlink+0xaa>
800059a4: 02000993 li s3,32
if(readi(dp, 0, (uint64)&de, off, sizeof(de)) != sizeof(de))
800059a8: 4741 li a4,16
800059aa: 86ce mv a3,s3
800059ac: f1840613 addi a2,s0,-232
800059b0: 4581 li a1,0
800059b2: 854a mv a0,s2
800059b4: ffffe097 auipc ra,0xffffe
800059b8: 3ba080e7 jalr 954(ra) # 80003d6e <readi>
800059bc: 47c1 li a5,16
800059be: 00f51b63 bne a0,a5,800059d4 <sys_unlink+0x16c>
if(de.inum != 0)
800059c2: f1845783 lhu a5,-232(s0)
800059c6: e7a1 bnez a5,80005a0e <sys_unlink+0x1a6>
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
800059c8: 29c1 addiw s3,s3,16
800059ca: 04c92783 lw a5,76(s2)
800059ce: fcf9ede3 bltu s3,a5,800059a8 <sys_unlink+0x140>
800059d2: b781 j 80005912 <sys_unlink+0xaa>
panic("isdirempty: readi");
800059d4: 00003517 auipc a0,0x3
800059d8: e8450513 addi a0,a0,-380 # 80008858 <syscalls+0x308>
800059dc: ffffb097 auipc ra,0xffffb
800059e0: b4e080e7 jalr -1202(ra) # 8000052a <panic>
panic("unlink: writei");
800059e4: 00003517 auipc a0,0x3
800059e8: e8c50513 addi a0,a0,-372 # 80008870 <syscalls+0x320>
800059ec: ffffb097 auipc ra,0xffffb
800059f0: b3e080e7 jalr -1218(ra) # 8000052a <panic>
dp->nlink--;
800059f4: 04a4d783 lhu a5,74(s1)
800059f8: 37fd addiw a5,a5,-1
800059fa: 04f49523 sh a5,74(s1)
iupdate(dp);
800059fe: 8526 mv a0,s1
80005a00: ffffe097 auipc ra,0xffffe
80005a04: ff0080e7 jalr -16(ra) # 800039f0 <iupdate>
80005a08: b781 j 80005948 <sys_unlink+0xe0>
return -1;
80005a0a: 557d li a0,-1
80005a0c: a005 j 80005a2c <sys_unlink+0x1c4>
iunlockput(ip);
80005a0e: 854a mv a0,s2
80005a10: ffffe097 auipc ra,0xffffe
80005a14: 30c080e7 jalr 780(ra) # 80003d1c <iunlockput>
iunlockput(dp);
80005a18: 8526 mv a0,s1
80005a1a: ffffe097 auipc ra,0xffffe
80005a1e: 302080e7 jalr 770(ra) # 80003d1c <iunlockput>
end_op();
80005a22: fffff097 auipc ra,0xfffff
80005a26: aee080e7 jalr -1298(ra) # 80004510 <end_op>
return -1;
80005a2a: 557d li a0,-1
}
80005a2c: 70ae ld ra,232(sp)
80005a2e: 740e ld s0,224(sp)
80005a30: 64ee ld s1,216(sp)
80005a32: 694e ld s2,208(sp)
80005a34: 69ae ld s3,200(sp)
80005a36: 616d addi sp,sp,240
80005a38: 8082 ret
0000000080005a3a <sys_open>:
uint64
sys_open(void)
{
80005a3a: 7131 addi sp,sp,-192
80005a3c: fd06 sd ra,184(sp)
80005a3e: f922 sd s0,176(sp)
80005a40: f526 sd s1,168(sp)
80005a42: f14a sd s2,160(sp)
80005a44: ed4e sd s3,152(sp)
80005a46: 0180 addi s0,sp,192
int fd, omode;
struct file *f;
struct inode *ip;
int n;
if((n = argstr(0, path, MAXPATH)) < 0 || argint(1, &omode) < 0)
80005a48: 08000613 li a2,128
80005a4c: f5040593 addi a1,s0,-176
80005a50: 4501 li a0,0
80005a52: ffffd097 auipc ra,0xffffd
80005a56: 3b8080e7 jalr 952(ra) # 80002e0a <argstr>
return -1;
80005a5a: 54fd li s1,-1
if((n = argstr(0, path, MAXPATH)) < 0 || argint(1, &omode) < 0)
80005a5c: 0c054163 bltz a0,80005b1e <sys_open+0xe4>
80005a60: f4c40593 addi a1,s0,-180
80005a64: 4505 li a0,1
80005a66: ffffd097 auipc ra,0xffffd
80005a6a: 360080e7 jalr 864(ra) # 80002dc6 <argint>
80005a6e: 0a054863 bltz a0,80005b1e <sys_open+0xe4>
begin_op();
80005a72: fffff097 auipc ra,0xfffff
80005a76: a1e080e7 jalr -1506(ra) # 80004490 <begin_op>
if(omode & O_CREATE){
80005a7a: f4c42783 lw a5,-180(s0)
80005a7e: 2007f793 andi a5,a5,512
80005a82: cbdd beqz a5,80005b38 <sys_open+0xfe>
ip = create(path, T_FILE, 0, 0);
80005a84: 4681 li a3,0
80005a86: 4601 li a2,0
80005a88: 4589 li a1,2
80005a8a: f5040513 addi a0,s0,-176
80005a8e: 00000097 auipc ra,0x0
80005a92: 972080e7 jalr -1678(ra) # 80005400 <create>
80005a96: 892a mv s2,a0
if(ip == 0){
80005a98: c959 beqz a0,80005b2e <sys_open+0xf4>
end_op();
return -1;
}
}
if(ip->type == T_DEVICE && (ip->major < 0 || ip->major >= NDEV)){
80005a9a: 04491703 lh a4,68(s2)
80005a9e: 478d li a5,3
80005aa0: 00f71763 bne a4,a5,80005aae <sys_open+0x74>
80005aa4: 04695703 lhu a4,70(s2)
80005aa8: 47a5 li a5,9
80005aaa: 0ce7ec63 bltu a5,a4,80005b82 <sys_open+0x148>
iunlockput(ip);
end_op();
return -1;
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80005aae: fffff097 auipc ra,0xfffff
80005ab2: df2080e7 jalr -526(ra) # 800048a0 <filealloc>
80005ab6: 89aa mv s3,a0
80005ab8: 10050263 beqz a0,80005bbc <sys_open+0x182>
80005abc: 00000097 auipc ra,0x0
80005ac0: 902080e7 jalr -1790(ra) # 800053be <fdalloc>
80005ac4: 84aa mv s1,a0
80005ac6: 0e054663 bltz a0,80005bb2 <sys_open+0x178>
iunlockput(ip);
end_op();
return -1;
}
if(ip->type == T_DEVICE){
80005aca: 04491703 lh a4,68(s2)
80005ace: 478d li a5,3
80005ad0: 0cf70463 beq a4,a5,80005b98 <sys_open+0x15e>
f->type = FD_DEVICE;
f->major = ip->major;
} else {
f->type = FD_INODE;
80005ad4: 4789 li a5,2
80005ad6: 00f9a023 sw a5,0(s3)
f->off = 0;
80005ada: 0209a023 sw zero,32(s3)
}
f->ip = ip;
80005ade: 0129bc23 sd s2,24(s3)
f->readable = !(omode & O_WRONLY);
80005ae2: f4c42783 lw a5,-180(s0)
80005ae6: 0017c713 xori a4,a5,1
80005aea: 8b05 andi a4,a4,1
80005aec: 00e98423 sb a4,8(s3)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80005af0: 0037f713 andi a4,a5,3
80005af4: 00e03733 snez a4,a4
80005af8: 00e984a3 sb a4,9(s3)
if((omode & O_TRUNC) && ip->type == T_FILE){
80005afc: 4007f793 andi a5,a5,1024
80005b00: c791 beqz a5,80005b0c <sys_open+0xd2>
80005b02: 04491703 lh a4,68(s2)
80005b06: 4789 li a5,2
80005b08: 08f70f63 beq a4,a5,80005ba6 <sys_open+0x16c>
itrunc(ip);
}
iunlock(ip);
80005b0c: 854a mv a0,s2
80005b0e: ffffe097 auipc ra,0xffffe
80005b12: 06e080e7 jalr 110(ra) # 80003b7c <iunlock>
end_op();
80005b16: fffff097 auipc ra,0xfffff
80005b1a: 9fa080e7 jalr -1542(ra) # 80004510 <end_op>
return fd;
}
80005b1e: 8526 mv a0,s1
80005b20: 70ea ld ra,184(sp)
80005b22: 744a ld s0,176(sp)
80005b24: 74aa ld s1,168(sp)
80005b26: 790a ld s2,160(sp)
80005b28: 69ea ld s3,152(sp)
80005b2a: 6129 addi sp,sp,192
80005b2c: 8082 ret
end_op();
80005b2e: fffff097 auipc ra,0xfffff
80005b32: 9e2080e7 jalr -1566(ra) # 80004510 <end_op>
return -1;
80005b36: b7e5 j 80005b1e <sys_open+0xe4>
if((ip = namei(path)) == 0){
80005b38: f5040513 addi a0,s0,-176
80005b3c: ffffe097 auipc ra,0xffffe
80005b40: 734080e7 jalr 1844(ra) # 80004270 <namei>
80005b44: 892a mv s2,a0
80005b46: c905 beqz a0,80005b76 <sys_open+0x13c>
ilock(ip);
80005b48: ffffe097 auipc ra,0xffffe
80005b4c: f72080e7 jalr -142(ra) # 80003aba <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
80005b50: 04491703 lh a4,68(s2)
80005b54: 4785 li a5,1
80005b56: f4f712e3 bne a4,a5,80005a9a <sys_open+0x60>
80005b5a: f4c42783 lw a5,-180(s0)
80005b5e: dba1 beqz a5,80005aae <sys_open+0x74>
iunlockput(ip);
80005b60: 854a mv a0,s2
80005b62: ffffe097 auipc ra,0xffffe
80005b66: 1ba080e7 jalr 442(ra) # 80003d1c <iunlockput>
end_op();
80005b6a: fffff097 auipc ra,0xfffff
80005b6e: 9a6080e7 jalr -1626(ra) # 80004510 <end_op>
return -1;
80005b72: 54fd li s1,-1
80005b74: b76d j 80005b1e <sys_open+0xe4>
end_op();
80005b76: fffff097 auipc ra,0xfffff
80005b7a: 99a080e7 jalr -1638(ra) # 80004510 <end_op>
return -1;
80005b7e: 54fd li s1,-1
80005b80: bf79 j 80005b1e <sys_open+0xe4>
iunlockput(ip);
80005b82: 854a mv a0,s2
80005b84: ffffe097 auipc ra,0xffffe
80005b88: 198080e7 jalr 408(ra) # 80003d1c <iunlockput>
end_op();
80005b8c: fffff097 auipc ra,0xfffff
80005b90: 984080e7 jalr -1660(ra) # 80004510 <end_op>
return -1;
80005b94: 54fd li s1,-1
80005b96: b761 j 80005b1e <sys_open+0xe4>
f->type = FD_DEVICE;
80005b98: 00f9a023 sw a5,0(s3)
f->major = ip->major;
80005b9c: 04691783 lh a5,70(s2)
80005ba0: 02f99223 sh a5,36(s3)
80005ba4: bf2d j 80005ade <sys_open+0xa4>
itrunc(ip);
80005ba6: 854a mv a0,s2
80005ba8: ffffe097 auipc ra,0xffffe
80005bac: 020080e7 jalr 32(ra) # 80003bc8 <itrunc>
80005bb0: bfb1 j 80005b0c <sys_open+0xd2>
fileclose(f);
80005bb2: 854e mv a0,s3
80005bb4: fffff097 auipc ra,0xfffff
80005bb8: da8080e7 jalr -600(ra) # 8000495c <fileclose>
iunlockput(ip);
80005bbc: 854a mv a0,s2
80005bbe: ffffe097 auipc ra,0xffffe
80005bc2: 15e080e7 jalr 350(ra) # 80003d1c <iunlockput>
end_op();
80005bc6: fffff097 auipc ra,0xfffff
80005bca: 94a080e7 jalr -1718(ra) # 80004510 <end_op>
return -1;
80005bce: 54fd li s1,-1
80005bd0: b7b9 j 80005b1e <sys_open+0xe4>
0000000080005bd2 <sys_mkdir>:
uint64
sys_mkdir(void)
{
80005bd2: 7175 addi sp,sp,-144
80005bd4: e506 sd ra,136(sp)
80005bd6: e122 sd s0,128(sp)
80005bd8: 0900 addi s0,sp,144
char path[MAXPATH];
struct inode *ip;
begin_op();
80005bda: fffff097 auipc ra,0xfffff
80005bde: 8b6080e7 jalr -1866(ra) # 80004490 <begin_op>
if(argstr(0, path, MAXPATH) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
80005be2: 08000613 li a2,128
80005be6: f7040593 addi a1,s0,-144
80005bea: 4501 li a0,0
80005bec: ffffd097 auipc ra,0xffffd
80005bf0: 21e080e7 jalr 542(ra) # 80002e0a <argstr>
80005bf4: 02054963 bltz a0,80005c26 <sys_mkdir+0x54>
80005bf8: 4681 li a3,0
80005bfa: 4601 li a2,0
80005bfc: 4585 li a1,1
80005bfe: f7040513 addi a0,s0,-144
80005c02: fffff097 auipc ra,0xfffff
80005c06: 7fe080e7 jalr 2046(ra) # 80005400 <create>
80005c0a: cd11 beqz a0,80005c26 <sys_mkdir+0x54>
end_op();
return -1;
}
iunlockput(ip);
80005c0c: ffffe097 auipc ra,0xffffe
80005c10: 110080e7 jalr 272(ra) # 80003d1c <iunlockput>
end_op();
80005c14: fffff097 auipc ra,0xfffff
80005c18: 8fc080e7 jalr -1796(ra) # 80004510 <end_op>
return 0;
80005c1c: 4501 li a0,0
}
80005c1e: 60aa ld ra,136(sp)
80005c20: 640a ld s0,128(sp)
80005c22: 6149 addi sp,sp,144
80005c24: 8082 ret
end_op();
80005c26: fffff097 auipc ra,0xfffff
80005c2a: 8ea080e7 jalr -1814(ra) # 80004510 <end_op>
return -1;
80005c2e: 557d li a0,-1
80005c30: b7fd j 80005c1e <sys_mkdir+0x4c>
0000000080005c32 <sys_mknod>:
uint64
sys_mknod(void)
{
80005c32: 7135 addi sp,sp,-160
80005c34: ed06 sd ra,152(sp)
80005c36: e922 sd s0,144(sp)
80005c38: 1100 addi s0,sp,160
struct inode *ip;
char path[MAXPATH];
int major, minor;
begin_op();
80005c3a: fffff097 auipc ra,0xfffff
80005c3e: 856080e7 jalr -1962(ra) # 80004490 <begin_op>
if((argstr(0, path, MAXPATH)) < 0 ||
80005c42: 08000613 li a2,128
80005c46: f7040593 addi a1,s0,-144
80005c4a: 4501 li a0,0
80005c4c: ffffd097 auipc ra,0xffffd
80005c50: 1be080e7 jalr 446(ra) # 80002e0a <argstr>
80005c54: 04054a63 bltz a0,80005ca8 <sys_mknod+0x76>
argint(1, &major) < 0 ||
80005c58: f6c40593 addi a1,s0,-148
80005c5c: 4505 li a0,1
80005c5e: ffffd097 auipc ra,0xffffd
80005c62: 168080e7 jalr 360(ra) # 80002dc6 <argint>
if((argstr(0, path, MAXPATH)) < 0 ||
80005c66: 04054163 bltz a0,80005ca8 <sys_mknod+0x76>
argint(2, &minor) < 0 ||
80005c6a: f6840593 addi a1,s0,-152
80005c6e: 4509 li a0,2
80005c70: ffffd097 auipc ra,0xffffd
80005c74: 156080e7 jalr 342(ra) # 80002dc6 <argint>
argint(1, &major) < 0 ||
80005c78: 02054863 bltz a0,80005ca8 <sys_mknod+0x76>
(ip = create(path, T_DEVICE, major, minor)) == 0){
80005c7c: f6841683 lh a3,-152(s0)
80005c80: f6c41603 lh a2,-148(s0)
80005c84: 458d li a1,3
80005c86: f7040513 addi a0,s0,-144
80005c8a: fffff097 auipc ra,0xfffff
80005c8e: 776080e7 jalr 1910(ra) # 80005400 <create>
argint(2, &minor) < 0 ||
80005c92: c919 beqz a0,80005ca8 <sys_mknod+0x76>
end_op();
return -1;
}
iunlockput(ip);
80005c94: ffffe097 auipc ra,0xffffe
80005c98: 088080e7 jalr 136(ra) # 80003d1c <iunlockput>
end_op();
80005c9c: fffff097 auipc ra,0xfffff
80005ca0: 874080e7 jalr -1932(ra) # 80004510 <end_op>
return 0;
80005ca4: 4501 li a0,0
80005ca6: a031 j 80005cb2 <sys_mknod+0x80>
end_op();
80005ca8: fffff097 auipc ra,0xfffff
80005cac: 868080e7 jalr -1944(ra) # 80004510 <end_op>
return -1;
80005cb0: 557d li a0,-1
}
80005cb2: 60ea ld ra,152(sp)
80005cb4: 644a ld s0,144(sp)
80005cb6: 610d addi sp,sp,160
80005cb8: 8082 ret
0000000080005cba <sys_chdir>:
uint64
sys_chdir(void)
{
80005cba: 7135 addi sp,sp,-160
80005cbc: ed06 sd ra,152(sp)
80005cbe: e922 sd s0,144(sp)
80005cc0: e526 sd s1,136(sp)
80005cc2: e14a sd s2,128(sp)
80005cc4: 1100 addi s0,sp,160
char path[MAXPATH];
struct inode *ip;
struct proc *p = myproc();
80005cc6: ffffc097 auipc ra,0xffffc
80005cca: cb8080e7 jalr -840(ra) # 8000197e <myproc>
80005cce: 892a mv s2,a0
begin_op();
80005cd0: ffffe097 auipc ra,0xffffe
80005cd4: 7c0080e7 jalr 1984(ra) # 80004490 <begin_op>
if(argstr(0, path, MAXPATH) < 0 || (ip = namei(path)) == 0){
80005cd8: 08000613 li a2,128
80005cdc: f6040593 addi a1,s0,-160
80005ce0: 4501 li a0,0
80005ce2: ffffd097 auipc ra,0xffffd
80005ce6: 128080e7 jalr 296(ra) # 80002e0a <argstr>
80005cea: 04054b63 bltz a0,80005d40 <sys_chdir+0x86>
80005cee: f6040513 addi a0,s0,-160
80005cf2: ffffe097 auipc ra,0xffffe
80005cf6: 57e080e7 jalr 1406(ra) # 80004270 <namei>
80005cfa: 84aa mv s1,a0
80005cfc: c131 beqz a0,80005d40 <sys_chdir+0x86>
end_op();
return -1;
}
ilock(ip);
80005cfe: ffffe097 auipc ra,0xffffe
80005d02: dbc080e7 jalr -580(ra) # 80003aba <ilock>
if(ip->type != T_DIR){
80005d06: 04449703 lh a4,68(s1)
80005d0a: 4785 li a5,1
80005d0c: 04f71063 bne a4,a5,80005d4c <sys_chdir+0x92>
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
80005d10: 8526 mv a0,s1
80005d12: ffffe097 auipc ra,0xffffe
80005d16: e6a080e7 jalr -406(ra) # 80003b7c <iunlock>
iput(p->cwd);
80005d1a: 18893503 ld a0,392(s2)
80005d1e: ffffe097 auipc ra,0xffffe
80005d22: f56080e7 jalr -170(ra) # 80003c74 <iput>
end_op();
80005d26: ffffe097 auipc ra,0xffffe
80005d2a: 7ea080e7 jalr 2026(ra) # 80004510 <end_op>
p->cwd = ip;
80005d2e: 18993423 sd s1,392(s2)
return 0;
80005d32: 4501 li a0,0
}
80005d34: 60ea ld ra,152(sp)
80005d36: 644a ld s0,144(sp)
80005d38: 64aa ld s1,136(sp)
80005d3a: 690a ld s2,128(sp)
80005d3c: 610d addi sp,sp,160
80005d3e: 8082 ret
end_op();
80005d40: ffffe097 auipc ra,0xffffe
80005d44: 7d0080e7 jalr 2000(ra) # 80004510 <end_op>
return -1;
80005d48: 557d li a0,-1
80005d4a: b7ed j 80005d34 <sys_chdir+0x7a>
iunlockput(ip);
80005d4c: 8526 mv a0,s1
80005d4e: ffffe097 auipc ra,0xffffe
80005d52: fce080e7 jalr -50(ra) # 80003d1c <iunlockput>
end_op();
80005d56: ffffe097 auipc ra,0xffffe
80005d5a: 7ba080e7 jalr 1978(ra) # 80004510 <end_op>
return -1;
80005d5e: 557d li a0,-1
80005d60: bfd1 j 80005d34 <sys_chdir+0x7a>
0000000080005d62 <sys_exec>:
uint64
sys_exec(void)
{
80005d62: 7145 addi sp,sp,-464
80005d64: e786 sd ra,456(sp)
80005d66: e3a2 sd s0,448(sp)
80005d68: ff26 sd s1,440(sp)
80005d6a: fb4a sd s2,432(sp)
80005d6c: f74e sd s3,424(sp)
80005d6e: f352 sd s4,416(sp)
80005d70: ef56 sd s5,408(sp)
80005d72: 0b80 addi s0,sp,464
char path[MAXPATH], *argv[MAXARG];
int i;
uint64 uargv, uarg;
if(argstr(0, path, MAXPATH) < 0 || argaddr(1, &uargv) < 0){
80005d74: 08000613 li a2,128
80005d78: f4040593 addi a1,s0,-192
80005d7c: 4501 li a0,0
80005d7e: ffffd097 auipc ra,0xffffd
80005d82: 08c080e7 jalr 140(ra) # 80002e0a <argstr>
return -1;
80005d86: 597d li s2,-1
if(argstr(0, path, MAXPATH) < 0 || argaddr(1, &uargv) < 0){
80005d88: 0c054a63 bltz a0,80005e5c <sys_exec+0xfa>
80005d8c: e3840593 addi a1,s0,-456
80005d90: 4505 li a0,1
80005d92: ffffd097 auipc ra,0xffffd
80005d96: 056080e7 jalr 86(ra) # 80002de8 <argaddr>
80005d9a: 0c054163 bltz a0,80005e5c <sys_exec+0xfa>
}
memset(argv, 0, sizeof(argv));
80005d9e: 10000613 li a2,256
80005da2: 4581 li a1,0
80005da4: e4040513 addi a0,s0,-448
80005da8: ffffb097 auipc ra,0xffffb
80005dac: f16080e7 jalr -234(ra) # 80000cbe <memset>
for(i=0;; i++){
if(i >= NELEM(argv)){
80005db0: e4040493 addi s1,s0,-448
memset(argv, 0, sizeof(argv));
80005db4: 89a6 mv s3,s1
80005db6: 4901 li s2,0
if(i >= NELEM(argv)){
80005db8: 02000a13 li s4,32
80005dbc: 00090a9b sext.w s5,s2
goto bad;
}
if(fetchaddr(uargv+sizeof(uint64)*i, (uint64*)&uarg) < 0){
80005dc0: 00391793 slli a5,s2,0x3
80005dc4: e3040593 addi a1,s0,-464
80005dc8: e3843503 ld a0,-456(s0)
80005dcc: 953e add a0,a0,a5
80005dce: ffffd097 auipc ra,0xffffd
80005dd2: f5e080e7 jalr -162(ra) # 80002d2c <fetchaddr>
80005dd6: 02054a63 bltz a0,80005e0a <sys_exec+0xa8>
goto bad;
}
if(uarg == 0){
80005dda: e3043783 ld a5,-464(s0)
80005dde: c3b9 beqz a5,80005e24 <sys_exec+0xc2>
argv[i] = 0;
break;
}
argv[i] = kalloc();
80005de0: ffffb097 auipc ra,0xffffb
80005de4: cf2080e7 jalr -782(ra) # 80000ad2 <kalloc>
80005de8: 85aa mv a1,a0
80005dea: 00a9b023 sd a0,0(s3)
if(argv[i] == 0)
80005dee: cd11 beqz a0,80005e0a <sys_exec+0xa8>
goto bad;
if(fetchstr(uarg, argv[i], PGSIZE) < 0)
80005df0: 6605 lui a2,0x1
80005df2: e3043503 ld a0,-464(s0)
80005df6: ffffd097 auipc ra,0xffffd
80005dfa: f88080e7 jalr -120(ra) # 80002d7e <fetchstr>
80005dfe: 00054663 bltz a0,80005e0a <sys_exec+0xa8>
if(i >= NELEM(argv)){
80005e02: 0905 addi s2,s2,1
80005e04: 09a1 addi s3,s3,8
80005e06: fb491be3 bne s2,s4,80005dbc <sys_exec+0x5a>
kfree(argv[i]);
return ret;
bad:
for(i = 0; i < NELEM(argv) && argv[i] != 0; i++)
80005e0a: 10048913 addi s2,s1,256
80005e0e: 6088 ld a0,0(s1)
80005e10: c529 beqz a0,80005e5a <sys_exec+0xf8>
kfree(argv[i]);
80005e12: ffffb097 auipc ra,0xffffb
80005e16: bc4080e7 jalr -1084(ra) # 800009d6 <kfree>
for(i = 0; i < NELEM(argv) && argv[i] != 0; i++)
80005e1a: 04a1 addi s1,s1,8
80005e1c: ff2499e3 bne s1,s2,80005e0e <sys_exec+0xac>
return -1;
80005e20: 597d li s2,-1
80005e22: a82d j 80005e5c <sys_exec+0xfa>
argv[i] = 0;
80005e24: 0a8e slli s5,s5,0x3
80005e26: fc040793 addi a5,s0,-64
80005e2a: 9abe add s5,s5,a5
80005e2c: e80ab023 sd zero,-384(s5) # ffffffffffffee80 <end+0xffffffff7ffd7e80>
int ret = exec(path, argv);
80005e30: e4040593 addi a1,s0,-448
80005e34: f4040513 addi a0,s0,-192
80005e38: fffff097 auipc ra,0xfffff
80005e3c: 176080e7 jalr 374(ra) # 80004fae <exec>
80005e40: 892a mv s2,a0
for(i = 0; i < NELEM(argv) && argv[i] != 0; i++)
80005e42: 10048993 addi s3,s1,256
80005e46: 6088 ld a0,0(s1)
80005e48: c911 beqz a0,80005e5c <sys_exec+0xfa>
kfree(argv[i]);
80005e4a: ffffb097 auipc ra,0xffffb
80005e4e: b8c080e7 jalr -1140(ra) # 800009d6 <kfree>
for(i = 0; i < NELEM(argv) && argv[i] != 0; i++)
80005e52: 04a1 addi s1,s1,8
80005e54: ff3499e3 bne s1,s3,80005e46 <sys_exec+0xe4>
80005e58: a011 j 80005e5c <sys_exec+0xfa>
return -1;
80005e5a: 597d li s2,-1
}
80005e5c: 854a mv a0,s2
80005e5e: 60be ld ra,456(sp)
80005e60: 641e ld s0,448(sp)
80005e62: 74fa ld s1,440(sp)
80005e64: 795a ld s2,432(sp)
80005e66: 79ba ld s3,424(sp)
80005e68: 7a1a ld s4,416(sp)
80005e6a: 6afa ld s5,408(sp)
80005e6c: 6179 addi sp,sp,464
80005e6e: 8082 ret
0000000080005e70 <sys_pipe>:
uint64
sys_pipe(void)
{
80005e70: 7139 addi sp,sp,-64
80005e72: fc06 sd ra,56(sp)
80005e74: f822 sd s0,48(sp)
80005e76: f426 sd s1,40(sp)
80005e78: 0080 addi s0,sp,64
uint64 fdarray; // user pointer to array of two integers
struct file *rf, *wf;
int fd0, fd1;
struct proc *p = myproc();
80005e7a: ffffc097 auipc ra,0xffffc
80005e7e: b04080e7 jalr -1276(ra) # 8000197e <myproc>
80005e82: 84aa mv s1,a0
if(argaddr(0, &fdarray) < 0)
80005e84: fd840593 addi a1,s0,-40
80005e88: 4501 li a0,0
80005e8a: ffffd097 auipc ra,0xffffd
80005e8e: f5e080e7 jalr -162(ra) # 80002de8 <argaddr>
return -1;
80005e92: 57fd li a5,-1
if(argaddr(0, &fdarray) < 0)
80005e94: 0e054263 bltz a0,80005f78 <sys_pipe+0x108>
if(pipealloc(&rf, &wf) < 0)
80005e98: fc840593 addi a1,s0,-56
80005e9c: fd040513 addi a0,s0,-48
80005ea0: fffff097 auipc ra,0xfffff
80005ea4: dec080e7 jalr -532(ra) # 80004c8c <pipealloc>
return -1;
80005ea8: 57fd li a5,-1
if(pipealloc(&rf, &wf) < 0)
80005eaa: 0c054763 bltz a0,80005f78 <sys_pipe+0x108>
fd0 = -1;
80005eae: fcf42223 sw a5,-60(s0)
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80005eb2: fd043503 ld a0,-48(s0)
80005eb6: fffff097 auipc ra,0xfffff
80005eba: 508080e7 jalr 1288(ra) # 800053be <fdalloc>
80005ebe: fca42223 sw a0,-60(s0)
80005ec2: 08054e63 bltz a0,80005f5e <sys_pipe+0xee>
80005ec6: fc843503 ld a0,-56(s0)
80005eca: fffff097 auipc ra,0xfffff
80005ece: 4f4080e7 jalr 1268(ra) # 800053be <fdalloc>
80005ed2: fca42023 sw a0,-64(s0)
80005ed6: 06054a63 bltz a0,80005f4a <sys_pipe+0xda>
p->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
}
if(copyout(p->pagetable, fdarray, (char*)&fd0, sizeof(fd0)) < 0 ||
80005eda: 4691 li a3,4
80005edc: fc440613 addi a2,s0,-60
80005ee0: fd843583 ld a1,-40(s0)
80005ee4: 64c8 ld a0,136(s1)
80005ee6: ffffb097 auipc ra,0xffffb
80005eea: 758080e7 jalr 1880(ra) # 8000163e <copyout>
80005eee: 02054063 bltz a0,80005f0e <sys_pipe+0x9e>
copyout(p->pagetable, fdarray+sizeof(fd0), (char *)&fd1, sizeof(fd1)) < 0){
80005ef2: 4691 li a3,4
80005ef4: fc040613 addi a2,s0,-64
80005ef8: fd843583 ld a1,-40(s0)
80005efc: 0591 addi a1,a1,4
80005efe: 64c8 ld a0,136(s1)
80005f00: ffffb097 auipc ra,0xffffb
80005f04: 73e080e7 jalr 1854(ra) # 8000163e <copyout>
p->ofile[fd1] = 0;
fileclose(rf);
fileclose(wf);
return -1;
}
return 0;
80005f08: 4781 li a5,0
if(copyout(p->pagetable, fdarray, (char*)&fd0, sizeof(fd0)) < 0 ||
80005f0a: 06055763 bgez a0,80005f78 <sys_pipe+0x108>
p->ofile[fd0] = 0;
80005f0e: fc442783 lw a5,-60(s0)
80005f12: 02078793 addi a5,a5,32
80005f16: 078e slli a5,a5,0x3
80005f18: 97a6 add a5,a5,s1
80005f1a: 0007b423 sd zero,8(a5)
p->ofile[fd1] = 0;
80005f1e: fc042503 lw a0,-64(s0)
80005f22: 02050513 addi a0,a0,32
80005f26: 050e slli a0,a0,0x3
80005f28: 9526 add a0,a0,s1
80005f2a: 00053423 sd zero,8(a0)
fileclose(rf);
80005f2e: fd043503 ld a0,-48(s0)
80005f32: fffff097 auipc ra,0xfffff
80005f36: a2a080e7 jalr -1494(ra) # 8000495c <fileclose>
fileclose(wf);
80005f3a: fc843503 ld a0,-56(s0)
80005f3e: fffff097 auipc ra,0xfffff
80005f42: a1e080e7 jalr -1506(ra) # 8000495c <fileclose>
return -1;
80005f46: 57fd li a5,-1
80005f48: a805 j 80005f78 <sys_pipe+0x108>
if(fd0 >= 0)
80005f4a: fc442783 lw a5,-60(s0)
80005f4e: 0007c863 bltz a5,80005f5e <sys_pipe+0xee>
p->ofile[fd0] = 0;
80005f52: 02078513 addi a0,a5,32
80005f56: 050e slli a0,a0,0x3
80005f58: 9526 add a0,a0,s1
80005f5a: 00053423 sd zero,8(a0)
fileclose(rf);
80005f5e: fd043503 ld a0,-48(s0)
80005f62: fffff097 auipc ra,0xfffff
80005f66: 9fa080e7 jalr -1542(ra) # 8000495c <fileclose>
fileclose(wf);
80005f6a: fc843503 ld a0,-56(s0)
80005f6e: fffff097 auipc ra,0xfffff
80005f72: 9ee080e7 jalr -1554(ra) # 8000495c <fileclose>
return -1;
80005f76: 57fd li a5,-1
}
80005f78: 853e mv a0,a5
80005f7a: 70e2 ld ra,56(sp)
80005f7c: 7442 ld s0,48(sp)
80005f7e: 74a2 ld s1,40(sp)
80005f80: 6121 addi sp,sp,64
80005f82: 8082 ret
...
0000000080005f90 <kernelvec>:
80005f90: 7111 addi sp,sp,-256
80005f92: e006 sd ra,0(sp)
80005f94: e40a sd sp,8(sp)
80005f96: e80e sd gp,16(sp)
80005f98: ec12 sd tp,24(sp)
80005f9a: f016 sd t0,32(sp)
80005f9c: f41a sd t1,40(sp)
80005f9e: f81e sd t2,48(sp)
80005fa0: fc22 sd s0,56(sp)
80005fa2: e0a6 sd s1,64(sp)
80005fa4: e4aa sd a0,72(sp)
80005fa6: e8ae sd a1,80(sp)
80005fa8: ecb2 sd a2,88(sp)
80005faa: f0b6 sd a3,96(sp)
80005fac: f4ba sd a4,104(sp)
80005fae: f8be sd a5,112(sp)
80005fb0: fcc2 sd a6,120(sp)
80005fb2: e146 sd a7,128(sp)
80005fb4: e54a sd s2,136(sp)
80005fb6: e94e sd s3,144(sp)
80005fb8: ed52 sd s4,152(sp)
80005fba: f156 sd s5,160(sp)
80005fbc: f55a sd s6,168(sp)
80005fbe: f95e sd s7,176(sp)
80005fc0: fd62 sd s8,184(sp)
80005fc2: e1e6 sd s9,192(sp)
80005fc4: e5ea sd s10,200(sp)
80005fc6: e9ee sd s11,208(sp)
80005fc8: edf2 sd t3,216(sp)
80005fca: f1f6 sd t4,224(sp)
80005fcc: f5fa sd t5,232(sp)
80005fce: f9fe sd t6,240(sp)
80005fd0: c1bfc0ef jal ra,80002bea <kerneltrap>
80005fd4: 6082 ld ra,0(sp)
80005fd6: 6122 ld sp,8(sp)
80005fd8: 61c2 ld gp,16(sp)
80005fda: 7282 ld t0,32(sp)
80005fdc: 7322 ld t1,40(sp)
80005fde: 73c2 ld t2,48(sp)
80005fe0: 7462 ld s0,56(sp)
80005fe2: 6486 ld s1,64(sp)
80005fe4: 6526 ld a0,72(sp)
80005fe6: 65c6 ld a1,80(sp)
80005fe8: 6666 ld a2,88(sp)
80005fea: 7686 ld a3,96(sp)
80005fec: 7726 ld a4,104(sp)
80005fee: 77c6 ld a5,112(sp)
80005ff0: 7866 ld a6,120(sp)
80005ff2: 688a ld a7,128(sp)
80005ff4: 692a ld s2,136(sp)
80005ff6: 69ca ld s3,144(sp)
80005ff8: 6a6a ld s4,152(sp)
80005ffa: 7a8a ld s5,160(sp)
80005ffc: 7b2a ld s6,168(sp)
80005ffe: 7bca ld s7,176(sp)
80006000: 7c6a ld s8,184(sp)
80006002: 6c8e ld s9,192(sp)
80006004: 6d2e ld s10,200(sp)
80006006: 6dce ld s11,208(sp)
80006008: 6e6e ld t3,216(sp)
8000600a: 7e8e ld t4,224(sp)
8000600c: 7f2e ld t5,232(sp)
8000600e: 7fce ld t6,240(sp)
80006010: 6111 addi sp,sp,256
80006012: 10200073 sret
80006016: 00000013 nop
8000601a: 00000013 nop
8000601e: 0001 nop
0000000080006020 <timervec>:
80006020: 34051573 csrrw a0,mscratch,a0
80006024: e10c sd a1,0(a0)
80006026: e510 sd a2,8(a0)
80006028: e914 sd a3,16(a0)
8000602a: 6d0c ld a1,24(a0)
8000602c: 7110 ld a2,32(a0)
8000602e: 6194 ld a3,0(a1)
80006030: 96b2 add a3,a3,a2
80006032: e194 sd a3,0(a1)
80006034: 4589 li a1,2
80006036: 14459073 csrw sip,a1
8000603a: 6914 ld a3,16(a0)
8000603c: 6510 ld a2,8(a0)
8000603e: 610c ld a1,0(a0)
80006040: 34051573 csrrw a0,mscratch,a0
80006044: 30200073 mret
...
000000008000604a <plicinit>:
// the riscv Platform Level Interrupt Controller (PLIC).
//
void
plicinit(void)
{
8000604a: 1141 addi sp,sp,-16
8000604c: e422 sd s0,8(sp)
8000604e: 0800 addi s0,sp,16
// set desired IRQ priorities non-zero (otherwise disabled).
*(uint32*)(PLIC + UART0_IRQ*4) = 1;
80006050: 0c0007b7 lui a5,0xc000
80006054: 4705 li a4,1
80006056: d798 sw a4,40(a5)
*(uint32*)(PLIC + VIRTIO0_IRQ*4) = 1;
80006058: c3d8 sw a4,4(a5)
}
8000605a: 6422 ld s0,8(sp)
8000605c: 0141 addi sp,sp,16
8000605e: 8082 ret
0000000080006060 <plicinithart>:
void
plicinithart(void)
{
80006060: 1141 addi sp,sp,-16
80006062: e406 sd ra,8(sp)
80006064: e022 sd s0,0(sp)
80006066: 0800 addi s0,sp,16
int hart = cpuid();
80006068: ffffc097 auipc ra,0xffffc
8000606c: 8ea080e7 jalr -1814(ra) # 80001952 <cpuid>
// set uart's enable bit for this hart's S-mode.
*(uint32*)PLIC_SENABLE(hart)= (1 << UART0_IRQ) | (1 << VIRTIO0_IRQ);
80006070: 0085171b slliw a4,a0,0x8
80006074: 0c0027b7 lui a5,0xc002
80006078: 97ba add a5,a5,a4
8000607a: 40200713 li a4,1026
8000607e: 08e7a023 sw a4,128(a5) # c002080 <_entry-0x73ffdf80>
// set this hart's S-mode priority threshold to 0.
*(uint32*)PLIC_SPRIORITY(hart) = 0;
80006082: 00d5151b slliw a0,a0,0xd
80006086: 0c2017b7 lui a5,0xc201
8000608a: 953e add a0,a0,a5
8000608c: 00052023 sw zero,0(a0)
}
80006090: 60a2 ld ra,8(sp)
80006092: 6402 ld s0,0(sp)
80006094: 0141 addi sp,sp,16
80006096: 8082 ret
0000000080006098 <plic_claim>:
// ask the PLIC what interrupt we should serve.
int
plic_claim(void)
{
80006098: 1141 addi sp,sp,-16
8000609a: e406 sd ra,8(sp)
8000609c: e022 sd s0,0(sp)
8000609e: 0800 addi s0,sp,16
int hart = cpuid();
800060a0: ffffc097 auipc ra,0xffffc
800060a4: 8b2080e7 jalr -1870(ra) # 80001952 <cpuid>
int irq = *(uint32*)PLIC_SCLAIM(hart);
800060a8: 00d5179b slliw a5,a0,0xd
800060ac: 0c201537 lui a0,0xc201
800060b0: 953e add a0,a0,a5
return irq;
}
800060b2: 4148 lw a0,4(a0)
800060b4: 60a2 ld ra,8(sp)
800060b6: 6402 ld s0,0(sp)
800060b8: 0141 addi sp,sp,16
800060ba: 8082 ret
00000000800060bc <plic_complete>:
// tell the PLIC we've served this IRQ.
void
plic_complete(int irq)
{
800060bc: 1101 addi sp,sp,-32
800060be: ec06 sd ra,24(sp)
800060c0: e822 sd s0,16(sp)
800060c2: e426 sd s1,8(sp)
800060c4: 1000 addi s0,sp,32
800060c6: 84aa mv s1,a0
int hart = cpuid();
800060c8: ffffc097 auipc ra,0xffffc
800060cc: 88a080e7 jalr -1910(ra) # 80001952 <cpuid>
*(uint32*)PLIC_SCLAIM(hart) = irq;
800060d0: 00d5151b slliw a0,a0,0xd
800060d4: 0c2017b7 lui a5,0xc201
800060d8: 97aa add a5,a5,a0
800060da: c3c4 sw s1,4(a5)
}
800060dc: 60e2 ld ra,24(sp)
800060de: 6442 ld s0,16(sp)
800060e0: 64a2 ld s1,8(sp)
800060e2: 6105 addi sp,sp,32
800060e4: 8082 ret
00000000800060e6 <free_desc>:
}
// mark a descriptor as free.
static void
free_desc(int i)
{
800060e6: 1141 addi sp,sp,-16
800060e8: e406 sd ra,8(sp)
800060ea: e022 sd s0,0(sp)
800060ec: 0800 addi s0,sp,16
if(i >= NUM)
800060ee: 479d li a5,7
800060f0: 06a7c963 blt a5,a0,80006162 <free_desc+0x7c>
panic("free_desc 1");
if(disk.free[i])
800060f4: 0001e797 auipc a5,0x1e
800060f8: f0c78793 addi a5,a5,-244 # 80024000 <disk>
800060fc: 00a78733 add a4,a5,a0
80006100: 6789 lui a5,0x2
80006102: 97ba add a5,a5,a4
80006104: 0187c783 lbu a5,24(a5) # 2018 <_entry-0x7fffdfe8>
80006108: e7ad bnez a5,80006172 <free_desc+0x8c>
panic("free_desc 2");
disk.desc[i].addr = 0;
8000610a: 00451793 slli a5,a0,0x4
8000610e: 00020717 auipc a4,0x20
80006112: ef270713 addi a4,a4,-270 # 80026000 <disk+0x2000>
80006116: 6314 ld a3,0(a4)
80006118: 96be add a3,a3,a5
8000611a: 0006b023 sd zero,0(a3)
disk.desc[i].len = 0;
8000611e: 6314 ld a3,0(a4)
80006120: 96be add a3,a3,a5
80006122: 0006a423 sw zero,8(a3)
disk.desc[i].flags = 0;
80006126: 6314 ld a3,0(a4)
80006128: 96be add a3,a3,a5
8000612a: 00069623 sh zero,12(a3)
disk.desc[i].next = 0;
8000612e: 6318 ld a4,0(a4)
80006130: 97ba add a5,a5,a4
80006132: 00079723 sh zero,14(a5)
disk.free[i] = 1;
80006136: 0001e797 auipc a5,0x1e
8000613a: eca78793 addi a5,a5,-310 # 80024000 <disk>
8000613e: 97aa add a5,a5,a0
80006140: 6509 lui a0,0x2
80006142: 953e add a0,a0,a5
80006144: 4785 li a5,1
80006146: 00f50c23 sb a5,24(a0) # 2018 <_entry-0x7fffdfe8>
wakeup(&disk.free[0]);
8000614a: 00020517 auipc a0,0x20
8000614e: ece50513 addi a0,a0,-306 # 80026018 <disk+0x2018>
80006152: ffffc097 auipc ra,0xffffc
80006156: 216080e7 jalr 534(ra) # 80002368 <wakeup>
}
8000615a: 60a2 ld ra,8(sp)
8000615c: 6402 ld s0,0(sp)
8000615e: 0141 addi sp,sp,16
80006160: 8082 ret
panic("free_desc 1");
80006162: 00002517 auipc a0,0x2
80006166: 71e50513 addi a0,a0,1822 # 80008880 <syscalls+0x330>
8000616a: ffffa097 auipc ra,0xffffa
8000616e: 3c0080e7 jalr 960(ra) # 8000052a <panic>
panic("free_desc 2");
80006172: 00002517 auipc a0,0x2
80006176: 71e50513 addi a0,a0,1822 # 80008890 <syscalls+0x340>
8000617a: ffffa097 auipc ra,0xffffa
8000617e: 3b0080e7 jalr 944(ra) # 8000052a <panic>
0000000080006182 <virtio_disk_init>:
{
80006182: 1101 addi sp,sp,-32
80006184: ec06 sd ra,24(sp)
80006186: e822 sd s0,16(sp)
80006188: e426 sd s1,8(sp)
8000618a: 1000 addi s0,sp,32
initlock(&disk.vdisk_lock, "virtio_disk");
8000618c: 00002597 auipc a1,0x2
80006190: 71458593 addi a1,a1,1812 # 800088a0 <syscalls+0x350>
80006194: 00020517 auipc a0,0x20
80006198: f9450513 addi a0,a0,-108 # 80026128 <disk+0x2128>
8000619c: ffffb097 auipc ra,0xffffb
800061a0: 996080e7 jalr -1642(ra) # 80000b32 <initlock>
if(*R(VIRTIO_MMIO_MAGIC_VALUE) != 0x74726976 ||
800061a4: 100017b7 lui a5,0x10001
800061a8: 4398 lw a4,0(a5)
800061aa: 2701 sext.w a4,a4
800061ac: 747277b7 lui a5,0x74727
800061b0: 97678793 addi a5,a5,-1674 # 74726976 <_entry-0xb8d968a>
800061b4: 0ef71163 bne a4,a5,80006296 <virtio_disk_init+0x114>
*R(VIRTIO_MMIO_VERSION) != 1 ||
800061b8: 100017b7 lui a5,0x10001
800061bc: 43dc lw a5,4(a5)
800061be: 2781 sext.w a5,a5
if(*R(VIRTIO_MMIO_MAGIC_VALUE) != 0x74726976 ||
800061c0: 4705 li a4,1
800061c2: 0ce79a63 bne a5,a4,80006296 <virtio_disk_init+0x114>
*R(VIRTIO_MMIO_DEVICE_ID) != 2 ||
800061c6: 100017b7 lui a5,0x10001
800061ca: 479c lw a5,8(a5)
800061cc: 2781 sext.w a5,a5
*R(VIRTIO_MMIO_VERSION) != 1 ||
800061ce: 4709 li a4,2
800061d0: 0ce79363 bne a5,a4,80006296 <virtio_disk_init+0x114>
*R(VIRTIO_MMIO_VENDOR_ID) != 0x554d4551){
800061d4: 100017b7 lui a5,0x10001
800061d8: 47d8 lw a4,12(a5)
800061da: 2701 sext.w a4,a4
*R(VIRTIO_MMIO_DEVICE_ID) != 2 ||
800061dc: 554d47b7 lui a5,0x554d4
800061e0: 55178793 addi a5,a5,1361 # 554d4551 <_entry-0x2ab2baaf>
800061e4: 0af71963 bne a4,a5,80006296 <virtio_disk_init+0x114>
*R(VIRTIO_MMIO_STATUS) = status;
800061e8: 100017b7 lui a5,0x10001
800061ec: 4705 li a4,1
800061ee: dbb8 sw a4,112(a5)
*R(VIRTIO_MMIO_STATUS) = status;
800061f0: 470d li a4,3
800061f2: dbb8 sw a4,112(a5)
uint64 features = *R(VIRTIO_MMIO_DEVICE_FEATURES);
800061f4: 4b94 lw a3,16(a5)
features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
800061f6: c7ffe737 lui a4,0xc7ffe
800061fa: 75f70713 addi a4,a4,1887 # ffffffffc7ffe75f <end+0xffffffff47fd775f>
800061fe: 8f75 and a4,a4,a3
*R(VIRTIO_MMIO_DRIVER_FEATURES) = features;
80006200: 2701 sext.w a4,a4
80006202: d398 sw a4,32(a5)
*R(VIRTIO_MMIO_STATUS) = status;
80006204: 472d li a4,11
80006206: dbb8 sw a4,112(a5)
*R(VIRTIO_MMIO_STATUS) = status;
80006208: 473d li a4,15
8000620a: dbb8 sw a4,112(a5)
*R(VIRTIO_MMIO_GUEST_PAGE_SIZE) = PGSIZE;
8000620c: 6705 lui a4,0x1
8000620e: d798 sw a4,40(a5)
*R(VIRTIO_MMIO_QUEUE_SEL) = 0;
80006210: 0207a823 sw zero,48(a5) # 10001030 <_entry-0x6fffefd0>
uint32 max = *R(VIRTIO_MMIO_QUEUE_NUM_MAX);
80006214: 5bdc lw a5,52(a5)
80006216: 2781 sext.w a5,a5
if(max == 0)
80006218: c7d9 beqz a5,800062a6 <virtio_disk_init+0x124>
if(max < NUM)
8000621a: 471d li a4,7
8000621c: 08f77d63 bgeu a4,a5,800062b6 <virtio_disk_init+0x134>
*R(VIRTIO_MMIO_QUEUE_NUM) = NUM;
80006220: 100014b7 lui s1,0x10001
80006224: 47a1 li a5,8
80006226: dc9c sw a5,56(s1)
memset(disk.pages, 0, sizeof(disk.pages));
80006228: 6609 lui a2,0x2
8000622a: 4581 li a1,0
8000622c: 0001e517 auipc a0,0x1e
80006230: dd450513 addi a0,a0,-556 # 80024000 <disk>
80006234: ffffb097 auipc ra,0xffffb
80006238: a8a080e7 jalr -1398(ra) # 80000cbe <memset>
*R(VIRTIO_MMIO_QUEUE_PFN) = ((uint64)disk.pages) >> PGSHIFT;
8000623c: 0001e717 auipc a4,0x1e
80006240: dc470713 addi a4,a4,-572 # 80024000 <disk>
80006244: 00c75793 srli a5,a4,0xc
80006248: 2781 sext.w a5,a5
8000624a: c0bc sw a5,64(s1)
disk.desc = (struct virtq_desc *) disk.pages;
8000624c: 00020797 auipc a5,0x20
80006250: db478793 addi a5,a5,-588 # 80026000 <disk+0x2000>
80006254: e398 sd a4,0(a5)
disk.avail = (struct virtq_avail *)(disk.pages + NUM*sizeof(struct virtq_desc));
80006256: 0001e717 auipc a4,0x1e
8000625a: e2a70713 addi a4,a4,-470 # 80024080 <disk+0x80>
8000625e: e798 sd a4,8(a5)
disk.used = (struct virtq_used *) (disk.pages + PGSIZE);
80006260: 0001f717 auipc a4,0x1f
80006264: da070713 addi a4,a4,-608 # 80025000 <disk+0x1000>
80006268: eb98 sd a4,16(a5)
disk.free[i] = 1;
8000626a: 4705 li a4,1
8000626c: 00e78c23 sb a4,24(a5)
80006270: 00e78ca3 sb a4,25(a5)
80006274: 00e78d23 sb a4,26(a5)
80006278: 00e78da3 sb a4,27(a5)
8000627c: 00e78e23 sb a4,28(a5)
80006280: 00e78ea3 sb a4,29(a5)
80006284: 00e78f23 sb a4,30(a5)
80006288: 00e78fa3 sb a4,31(a5)
}
8000628c: 60e2 ld ra,24(sp)
8000628e: 6442 ld s0,16(sp)
80006290: 64a2 ld s1,8(sp)
80006292: 6105 addi sp,sp,32
80006294: 8082 ret
panic("could not find virtio disk");
80006296: 00002517 auipc a0,0x2
8000629a: 61a50513 addi a0,a0,1562 # 800088b0 <syscalls+0x360>
8000629e: ffffa097 auipc ra,0xffffa
800062a2: 28c080e7 jalr 652(ra) # 8000052a <panic>
panic("virtio disk has no queue 0");
800062a6: 00002517 auipc a0,0x2
800062aa: 62a50513 addi a0,a0,1578 # 800088d0 <syscalls+0x380>
800062ae: ffffa097 auipc ra,0xffffa
800062b2: 27c080e7 jalr 636(ra) # 8000052a <panic>
panic("virtio disk max queue too short");
800062b6: 00002517 auipc a0,0x2
800062ba: 63a50513 addi a0,a0,1594 # 800088f0 <syscalls+0x3a0>
800062be: ffffa097 auipc ra,0xffffa
800062c2: 26c080e7 jalr 620(ra) # 8000052a <panic>
00000000800062c6 <virtio_disk_rw>:
return 0;
}
void
virtio_disk_rw(struct buf *b, int write)
{
800062c6: 7119 addi sp,sp,-128
800062c8: fc86 sd ra,120(sp)
800062ca: f8a2 sd s0,112(sp)
800062cc: f4a6 sd s1,104(sp)
800062ce: f0ca sd s2,96(sp)
800062d0: ecce sd s3,88(sp)
800062d2: e8d2 sd s4,80(sp)
800062d4: e4d6 sd s5,72(sp)
800062d6: e0da sd s6,64(sp)
800062d8: fc5e sd s7,56(sp)
800062da: f862 sd s8,48(sp)
800062dc: f466 sd s9,40(sp)
800062de: f06a sd s10,32(sp)
800062e0: ec6e sd s11,24(sp)
800062e2: 0100 addi s0,sp,128
800062e4: 8aaa mv s5,a0
800062e6: 8d2e mv s10,a1
uint64 sector = b->blockno * (BSIZE / 512);
800062e8: 00c52c83 lw s9,12(a0)
800062ec: 001c9c9b slliw s9,s9,0x1
800062f0: 1c82 slli s9,s9,0x20
800062f2: 020cdc93 srli s9,s9,0x20
acquire(&disk.vdisk_lock);
800062f6: 00020517 auipc a0,0x20
800062fa: e3250513 addi a0,a0,-462 # 80026128 <disk+0x2128>
800062fe: ffffb097 auipc ra,0xffffb
80006302: 8c4080e7 jalr -1852(ra) # 80000bc2 <acquire>
for(int i = 0; i < 3; i++){
80006306: 4981 li s3,0
for(int i = 0; i < NUM; i++){
80006308: 44a1 li s1,8
disk.free[i] = 0;
8000630a: 0001ec17 auipc s8,0x1e
8000630e: cf6c0c13 addi s8,s8,-778 # 80024000 <disk>
80006312: 6b89 lui s7,0x2
for(int i = 0; i < 3; i++){
80006314: 4b0d li s6,3
80006316: a0ad j 80006380 <virtio_disk_rw+0xba>
disk.free[i] = 0;
80006318: 00fc0733 add a4,s8,a5
8000631c: 975e add a4,a4,s7
8000631e: 00070c23 sb zero,24(a4)
idx[i] = alloc_desc();
80006322: c19c sw a5,0(a1)
if(idx[i] < 0){
80006324: 0207c563 bltz a5,8000634e <virtio_disk_rw+0x88>
for(int i = 0; i < 3; i++){
80006328: 2905 addiw s2,s2,1
8000632a: 0611 addi a2,a2,4
8000632c: 19690d63 beq s2,s6,800064c6 <virtio_disk_rw+0x200>
idx[i] = alloc_desc();
80006330: 85b2 mv a1,a2
for(int i = 0; i < NUM; i++){
80006332: 00020717 auipc a4,0x20
80006336: ce670713 addi a4,a4,-794 # 80026018 <disk+0x2018>
8000633a: 87ce mv a5,s3
if(disk.free[i]){
8000633c: 00074683 lbu a3,0(a4)
80006340: fee1 bnez a3,80006318 <virtio_disk_rw+0x52>
for(int i = 0; i < NUM; i++){
80006342: 2785 addiw a5,a5,1
80006344: 0705 addi a4,a4,1
80006346: fe979be3 bne a5,s1,8000633c <virtio_disk_rw+0x76>
idx[i] = alloc_desc();
8000634a: 57fd li a5,-1
8000634c: c19c sw a5,0(a1)
for(int j = 0; j < i; j++)
8000634e: 01205d63 blez s2,80006368 <virtio_disk_rw+0xa2>
80006352: 8dce mv s11,s3
free_desc(idx[j]);
80006354: 000a2503 lw a0,0(s4)
80006358: 00000097 auipc ra,0x0
8000635c: d8e080e7 jalr -626(ra) # 800060e6 <free_desc>
for(int j = 0; j < i; j++)
80006360: 2d85 addiw s11,s11,1
80006362: 0a11 addi s4,s4,4
80006364: ffb918e3 bne s2,s11,80006354 <virtio_disk_rw+0x8e>
int idx[3];
while(1){
if(alloc3_desc(idx) == 0) {
break;
}
sleep(&disk.free[0], &disk.vdisk_lock);
80006368: 00020597 auipc a1,0x20
8000636c: dc058593 addi a1,a1,-576 # 80026128 <disk+0x2128>
80006370: 00020517 auipc a0,0x20
80006374: ca850513 addi a0,a0,-856 # 80026018 <disk+0x2018>
80006378: ffffc097 auipc ra,0xffffc
8000637c: d7c080e7 jalr -644(ra) # 800020f4 <sleep>
for(int i = 0; i < 3; i++){
80006380: f8040a13 addi s4,s0,-128
{
80006384: 8652 mv a2,s4
for(int i = 0; i < 3; i++){
80006386: 894e mv s2,s3
80006388: b765 j 80006330 <virtio_disk_rw+0x6a>
disk.desc[idx[0]].next = idx[1];
disk.desc[idx[1]].addr = (uint64) b->data;
disk.desc[idx[1]].len = BSIZE;
if(write)
disk.desc[idx[1]].flags = 0; // device reads b->data
8000638a: 00020697 auipc a3,0x20
8000638e: c766b683 ld a3,-906(a3) # 80026000 <disk+0x2000>
80006392: 96ba add a3,a3,a4
80006394: 00069623 sh zero,12(a3)
else
disk.desc[idx[1]].flags = VRING_DESC_F_WRITE; // device writes b->data
disk.desc[idx[1]].flags |= VRING_DESC_F_NEXT;
80006398: 0001e817 auipc a6,0x1e
8000639c: c6880813 addi a6,a6,-920 # 80024000 <disk>
800063a0: 00020697 auipc a3,0x20
800063a4: c6068693 addi a3,a3,-928 # 80026000 <disk+0x2000>
800063a8: 6290 ld a2,0(a3)
800063aa: 963a add a2,a2,a4
800063ac: 00c65583 lhu a1,12(a2) # 200c <_entry-0x7fffdff4>
800063b0: 0015e593 ori a1,a1,1
800063b4: 00b61623 sh a1,12(a2)
disk.desc[idx[1]].next = idx[2];
800063b8: f8842603 lw a2,-120(s0)
800063bc: 628c ld a1,0(a3)
800063be: 972e add a4,a4,a1
800063c0: 00c71723 sh a2,14(a4)
disk.info[idx[0]].status = 0xff; // device writes 0 on success
800063c4: 20050593 addi a1,a0,512
800063c8: 0592 slli a1,a1,0x4
800063ca: 95c2 add a1,a1,a6
800063cc: 577d li a4,-1
800063ce: 02e58823 sb a4,48(a1)
disk.desc[idx[2]].addr = (uint64) &disk.info[idx[0]].status;
800063d2: 00461713 slli a4,a2,0x4
800063d6: 6290 ld a2,0(a3)
800063d8: 963a add a2,a2,a4
800063da: 03078793 addi a5,a5,48
800063de: 97c2 add a5,a5,a6
800063e0: e21c sd a5,0(a2)
disk.desc[idx[2]].len = 1;
800063e2: 629c ld a5,0(a3)
800063e4: 97ba add a5,a5,a4
800063e6: 4605 li a2,1
800063e8: c790 sw a2,8(a5)
disk.desc[idx[2]].flags = VRING_DESC_F_WRITE; // device writes the status
800063ea: 629c ld a5,0(a3)
800063ec: 97ba add a5,a5,a4
800063ee: 4809 li a6,2
800063f0: 01079623 sh a6,12(a5)
disk.desc[idx[2]].next = 0;
800063f4: 629c ld a5,0(a3)
800063f6: 973e add a4,a4,a5
800063f8: 00071723 sh zero,14(a4)
// record struct buf for virtio_disk_intr().
b->disk = 1;
800063fc: 00caa223 sw a2,4(s5)
disk.info[idx[0]].b = b;
80006400: 0355b423 sd s5,40(a1)
// tell the device the first index in our chain of descriptors.
disk.avail->ring[disk.avail->idx % NUM] = idx[0];
80006404: 6698 ld a4,8(a3)
80006406: 00275783 lhu a5,2(a4)
8000640a: 8b9d andi a5,a5,7
8000640c: 0786 slli a5,a5,0x1
8000640e: 97ba add a5,a5,a4
80006410: 00a79223 sh a0,4(a5)
__sync_synchronize();
80006414: 0ff0000f fence
// tell the device another avail ring entry is available.
disk.avail->idx += 1; // not % NUM ...
80006418: 6698 ld a4,8(a3)
8000641a: 00275783 lhu a5,2(a4)
8000641e: 2785 addiw a5,a5,1
80006420: 00f71123 sh a5,2(a4)
__sync_synchronize();
80006424: 0ff0000f fence
*R(VIRTIO_MMIO_QUEUE_NOTIFY) = 0; // value is queue number
80006428: 100017b7 lui a5,0x10001
8000642c: 0407a823 sw zero,80(a5) # 10001050 <_entry-0x6fffefb0>
// Wait for virtio_disk_intr() to say request has finished.
while(b->disk == 1) {
80006430: 004aa783 lw a5,4(s5)
80006434: 02c79163 bne a5,a2,80006456 <virtio_disk_rw+0x190>
sleep(b, &disk.vdisk_lock);
80006438: 00020917 auipc s2,0x20
8000643c: cf090913 addi s2,s2,-784 # 80026128 <disk+0x2128>
while(b->disk == 1) {
80006440: 4485 li s1,1
sleep(b, &disk.vdisk_lock);
80006442: 85ca mv a1,s2
80006444: 8556 mv a0,s5
80006446: ffffc097 auipc ra,0xffffc
8000644a: cae080e7 jalr -850(ra) # 800020f4 <sleep>
while(b->disk == 1) {
8000644e: 004aa783 lw a5,4(s5)
80006452: fe9788e3 beq a5,s1,80006442 <virtio_disk_rw+0x17c>
}
disk.info[idx[0]].b = 0;
80006456: f8042903 lw s2,-128(s0)
8000645a: 20090793 addi a5,s2,512
8000645e: 00479713 slli a4,a5,0x4
80006462: 0001e797 auipc a5,0x1e
80006466: b9e78793 addi a5,a5,-1122 # 80024000 <disk>
8000646a: 97ba add a5,a5,a4
8000646c: 0207b423 sd zero,40(a5)
int flag = disk.desc[i].flags;
80006470: 00020997 auipc s3,0x20
80006474: b9098993 addi s3,s3,-1136 # 80026000 <disk+0x2000>
80006478: 00491713 slli a4,s2,0x4
8000647c: 0009b783 ld a5,0(s3)
80006480: 97ba add a5,a5,a4
80006482: 00c7d483 lhu s1,12(a5)
int nxt = disk.desc[i].next;
80006486: 854a mv a0,s2
80006488: 00e7d903 lhu s2,14(a5)
free_desc(i);
8000648c: 00000097 auipc ra,0x0
80006490: c5a080e7 jalr -934(ra) # 800060e6 <free_desc>
if(flag & VRING_DESC_F_NEXT)
80006494: 8885 andi s1,s1,1
80006496: f0ed bnez s1,80006478 <virtio_disk_rw+0x1b2>
free_chain(idx[0]);
release(&disk.vdisk_lock);
80006498: 00020517 auipc a0,0x20
8000649c: c9050513 addi a0,a0,-880 # 80026128 <disk+0x2128>
800064a0: ffffa097 auipc ra,0xffffa
800064a4: 7d6080e7 jalr 2006(ra) # 80000c76 <release>
}
800064a8: 70e6 ld ra,120(sp)
800064aa: 7446 ld s0,112(sp)
800064ac: 74a6 ld s1,104(sp)
800064ae: 7906 ld s2,96(sp)
800064b0: 69e6 ld s3,88(sp)
800064b2: 6a46 ld s4,80(sp)
800064b4: 6aa6 ld s5,72(sp)
800064b6: 6b06 ld s6,64(sp)
800064b8: 7be2 ld s7,56(sp)
800064ba: 7c42 ld s8,48(sp)
800064bc: 7ca2 ld s9,40(sp)
800064be: 7d02 ld s10,32(sp)
800064c0: 6de2 ld s11,24(sp)
800064c2: 6109 addi sp,sp,128
800064c4: 8082 ret
struct virtio_blk_req *buf0 = &disk.ops[idx[0]];
800064c6: f8042503 lw a0,-128(s0)
800064ca: 20050793 addi a5,a0,512
800064ce: 0792 slli a5,a5,0x4
if(write)
800064d0: 0001e817 auipc a6,0x1e
800064d4: b3080813 addi a6,a6,-1232 # 80024000 <disk>
800064d8: 00f80733 add a4,a6,a5
800064dc: 01a036b3 snez a3,s10
800064e0: 0ad72423 sw a3,168(a4)
buf0->reserved = 0;
800064e4: 0a072623 sw zero,172(a4)
buf0->sector = sector;
800064e8: 0b973823 sd s9,176(a4)
disk.desc[idx[0]].addr = (uint64) buf0;
800064ec: 7679 lui a2,0xffffe
800064ee: 963e add a2,a2,a5
800064f0: 00020697 auipc a3,0x20
800064f4: b1068693 addi a3,a3,-1264 # 80026000 <disk+0x2000>
800064f8: 6298 ld a4,0(a3)
800064fa: 9732 add a4,a4,a2
struct virtio_blk_req *buf0 = &disk.ops[idx[0]];
800064fc: 0a878593 addi a1,a5,168
80006500: 95c2 add a1,a1,a6
disk.desc[idx[0]].addr = (uint64) buf0;
80006502: e30c sd a1,0(a4)
disk.desc[idx[0]].len = sizeof(struct virtio_blk_req);
80006504: 6298 ld a4,0(a3)
80006506: 9732 add a4,a4,a2
80006508: 45c1 li a1,16
8000650a: c70c sw a1,8(a4)
disk.desc[idx[0]].flags = VRING_DESC_F_NEXT;
8000650c: 6298 ld a4,0(a3)
8000650e: 9732 add a4,a4,a2
80006510: 4585 li a1,1
80006512: 00b71623 sh a1,12(a4)
disk.desc[idx[0]].next = idx[1];
80006516: f8442703 lw a4,-124(s0)
8000651a: 628c ld a1,0(a3)
8000651c: 962e add a2,a2,a1
8000651e: 00e61723 sh a4,14(a2) # ffffffffffffe00e <end+0xffffffff7ffd700e>
disk.desc[idx[1]].addr = (uint64) b->data;
80006522: 0712 slli a4,a4,0x4
80006524: 6290 ld a2,0(a3)
80006526: 963a add a2,a2,a4
80006528: 058a8593 addi a1,s5,88
8000652c: e20c sd a1,0(a2)
disk.desc[idx[1]].len = BSIZE;
8000652e: 6294 ld a3,0(a3)
80006530: 96ba add a3,a3,a4
80006532: 40000613 li a2,1024
80006536: c690 sw a2,8(a3)
if(write)
80006538: e40d19e3 bnez s10,8000638a <virtio_disk_rw+0xc4>
disk.desc[idx[1]].flags = VRING_DESC_F_WRITE; // device writes b->data
8000653c: 00020697 auipc a3,0x20
80006540: ac46b683 ld a3,-1340(a3) # 80026000 <disk+0x2000>
80006544: 96ba add a3,a3,a4
80006546: 4609 li a2,2
80006548: 00c69623 sh a2,12(a3)
8000654c: b5b1 j 80006398 <virtio_disk_rw+0xd2>
000000008000654e <virtio_disk_intr>:
void
virtio_disk_intr()
{
8000654e: 1101 addi sp,sp,-32
80006550: ec06 sd ra,24(sp)
80006552: e822 sd s0,16(sp)
80006554: e426 sd s1,8(sp)
80006556: e04a sd s2,0(sp)
80006558: 1000 addi s0,sp,32
acquire(&disk.vdisk_lock);
8000655a: 00020517 auipc a0,0x20
8000655e: bce50513 addi a0,a0,-1074 # 80026128 <disk+0x2128>
80006562: ffffa097 auipc ra,0xffffa
80006566: 660080e7 jalr 1632(ra) # 80000bc2 <acquire>
// we've seen this interrupt, which the following line does.
// this may race with the device writing new entries to
// the "used" ring, in which case we may process the new
// completion entries in this interrupt, and have nothing to do
// in the next interrupt, which is harmless.
*R(VIRTIO_MMIO_INTERRUPT_ACK) = *R(VIRTIO_MMIO_INTERRUPT_STATUS) & 0x3;
8000656a: 10001737 lui a4,0x10001
8000656e: 533c lw a5,96(a4)
80006570: 8b8d andi a5,a5,3
80006572: d37c sw a5,100(a4)
__sync_synchronize();
80006574: 0ff0000f fence
// the device increments disk.used->idx when it
// adds an entry to the used ring.
while(disk.used_idx != disk.used->idx){
80006578: 00020797 auipc a5,0x20
8000657c: a8878793 addi a5,a5,-1400 # 80026000 <disk+0x2000>
80006580: 6b94 ld a3,16(a5)
80006582: 0207d703 lhu a4,32(a5)
80006586: 0026d783 lhu a5,2(a3)
8000658a: 06f70163 beq a4,a5,800065ec <virtio_disk_intr+0x9e>
__sync_synchronize();
int id = disk.used->ring[disk.used_idx % NUM].id;
8000658e: 0001e917 auipc s2,0x1e
80006592: a7290913 addi s2,s2,-1422 # 80024000 <disk>
80006596: 00020497 auipc s1,0x20
8000659a: a6a48493 addi s1,s1,-1430 # 80026000 <disk+0x2000>
__sync_synchronize();
8000659e: 0ff0000f fence
int id = disk.used->ring[disk.used_idx % NUM].id;
800065a2: 6898 ld a4,16(s1)
800065a4: 0204d783 lhu a5,32(s1)
800065a8: 8b9d andi a5,a5,7
800065aa: 078e slli a5,a5,0x3
800065ac: 97ba add a5,a5,a4
800065ae: 43dc lw a5,4(a5)
if(disk.info[id].status != 0)
800065b0: 20078713 addi a4,a5,512
800065b4: 0712 slli a4,a4,0x4
800065b6: 974a add a4,a4,s2
800065b8: 03074703 lbu a4,48(a4) # 10001030 <_entry-0x6fffefd0>
800065bc: e731 bnez a4,80006608 <virtio_disk_intr+0xba>
panic("virtio_disk_intr status");
struct buf *b = disk.info[id].b;
800065be: 20078793 addi a5,a5,512
800065c2: 0792 slli a5,a5,0x4
800065c4: 97ca add a5,a5,s2
800065c6: 7788 ld a0,40(a5)
b->disk = 0; // disk is done with buf
800065c8: 00052223 sw zero,4(a0)
wakeup(b);
800065cc: ffffc097 auipc ra,0xffffc
800065d0: d9c080e7 jalr -612(ra) # 80002368 <wakeup>
disk.used_idx += 1;
800065d4: 0204d783 lhu a5,32(s1)
800065d8: 2785 addiw a5,a5,1
800065da: 17c2 slli a5,a5,0x30
800065dc: 93c1 srli a5,a5,0x30
800065de: 02f49023 sh a5,32(s1)
while(disk.used_idx != disk.used->idx){
800065e2: 6898 ld a4,16(s1)
800065e4: 00275703 lhu a4,2(a4)
800065e8: faf71be3 bne a4,a5,8000659e <virtio_disk_intr+0x50>
}
release(&disk.vdisk_lock);
800065ec: 00020517 auipc a0,0x20
800065f0: b3c50513 addi a0,a0,-1220 # 80026128 <disk+0x2128>
800065f4: ffffa097 auipc ra,0xffffa
800065f8: 682080e7 jalr 1666(ra) # 80000c76 <release>
}
800065fc: 60e2 ld ra,24(sp)
800065fe: 6442 ld s0,16(sp)
80006600: 64a2 ld s1,8(sp)
80006602: 6902 ld s2,0(sp)
80006604: 6105 addi sp,sp,32
80006606: 8082 ret
panic("virtio_disk_intr status");
80006608: 00002517 auipc a0,0x2
8000660c: 30850513 addi a0,a0,776 # 80008910 <syscalls+0x3c0>
80006610: ffffa097 auipc ra,0xffffa
80006614: f1a080e7 jalr -230(ra) # 8000052a <panic>
...
0000000080007000 <_trampoline>:
80007000: 14051573 csrrw a0,sscratch,a0
80007004: 02153423 sd ra,40(a0)
80007008: 02253823 sd sp,48(a0)
8000700c: 02353c23 sd gp,56(a0)
80007010: 04453023 sd tp,64(a0)
80007014: 04553423 sd t0,72(a0)
80007018: 04653823 sd t1,80(a0)
8000701c: 04753c23 sd t2,88(a0)
80007020: f120 sd s0,96(a0)
80007022: f524 sd s1,104(a0)
80007024: fd2c sd a1,120(a0)
80007026: e150 sd a2,128(a0)
80007028: e554 sd a3,136(a0)
8000702a: e958 sd a4,144(a0)
8000702c: ed5c sd a5,152(a0)
8000702e: 0b053023 sd a6,160(a0)
80007032: 0b153423 sd a7,168(a0)
80007036: 0b253823 sd s2,176(a0)
8000703a: 0b353c23 sd s3,184(a0)
8000703e: 0d453023 sd s4,192(a0)
80007042: 0d553423 sd s5,200(a0)
80007046: 0d653823 sd s6,208(a0)
8000704a: 0d753c23 sd s7,216(a0)
8000704e: 0f853023 sd s8,224(a0)
80007052: 0f953423 sd s9,232(a0)
80007056: 0fa53823 sd s10,240(a0)
8000705a: 0fb53c23 sd s11,248(a0)
8000705e: 11c53023 sd t3,256(a0)
80007062: 11d53423 sd t4,264(a0)
80007066: 11e53823 sd t5,272(a0)
8000706a: 11f53c23 sd t6,280(a0)
8000706e: 140022f3 csrr t0,sscratch
80007072: 06553823 sd t0,112(a0)
80007076: 00853103 ld sp,8(a0)
8000707a: 02053203 ld tp,32(a0)
8000707e: 01053283 ld t0,16(a0)
80007082: 00053303 ld t1,0(a0)
80007086: 18031073 csrw satp,t1
8000708a: 12000073 sfence.vma
8000708e: 8282 jr t0
0000000080007090 <userret>:
80007090: 18059073 csrw satp,a1
80007094: 12000073 sfence.vma
80007098: 07053283 ld t0,112(a0)
8000709c: 14029073 csrw sscratch,t0
800070a0: 02853083 ld ra,40(a0)
800070a4: 03053103 ld sp,48(a0)
800070a8: 03853183 ld gp,56(a0)
800070ac: 04053203 ld tp,64(a0)
800070b0: 04853283 ld t0,72(a0)
800070b4: 05053303 ld t1,80(a0)
800070b8: 05853383 ld t2,88(a0)
800070bc: 7120 ld s0,96(a0)
800070be: 7524 ld s1,104(a0)
800070c0: 7d2c ld a1,120(a0)
800070c2: 6150 ld a2,128(a0)
800070c4: 6554 ld a3,136(a0)
800070c6: 6958 ld a4,144(a0)
800070c8: 6d5c ld a5,152(a0)
800070ca: 0a053803 ld a6,160(a0)
800070ce: 0a853883 ld a7,168(a0)
800070d2: 0b053903 ld s2,176(a0)
800070d6: 0b853983 ld s3,184(a0)
800070da: 0c053a03 ld s4,192(a0)
800070de: 0c853a83 ld s5,200(a0)
800070e2: 0d053b03 ld s6,208(a0)
800070e6: 0d853b83 ld s7,216(a0)
800070ea: 0e053c03 ld s8,224(a0)
800070ee: 0e853c83 ld s9,232(a0)
800070f2: 0f053d03 ld s10,240(a0)
800070f6: 0f853d83 ld s11,248(a0)
800070fa: 10053e03 ld t3,256(a0)
800070fe: 10853e83 ld t4,264(a0)
80007102: 11053f03 ld t5,272(a0)
80007106: 11853f83 ld t6,280(a0)
8000710a: 14051573 csrrw a0,sscratch,a0
8000710e: 10200073 sret
...
|
div_two_8bit_numbers.asm | PrajeenRG/intel-8085-programs | 0 | 82240 | ; Dividing two 8-bit numbers in memory
;
; Inputs are taken from 0A0H (Dividend) and 0A1H (Divisor)
; Output is stored at 0A2H (Quotient) and 0A3H (Remainder)
MVI C, 00H ; initialise quotient
LDA 0A1H ; load divisor to accumulator
MOV E, A ; saves it to register E
LDA 0A0H ; load dividend to accumulator
Loop: CMP E ; compares A with E
JC Store ; checks if A < B
SUB E ; subtracts divisor from accumulator
INR C ; increments quotient by one
JMP Loop ; loops again
Store: STA 0A3H ; store accumulator to memory
MOV A, C ; load quotient to accumulator
STA 0A2H ; store quotient to memory
HLT ; halt program
|
testsuite/xml/xmlconf_test.adb | svn2github/matreshka | 24 | 15217 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2014, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * 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. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT --
-- HOLDER 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. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Command_Line;
with Ada.Characters.Conversions;
with Ada.Directories;
with Ada.Integer_Text_IO;
with Ada.Text_IO;
with League.Application;
with League.Strings;
with XML.SAX.File_Input_Sources;
with XML.SAX.Simple_Readers;
with XMLConf.Testsuite_Handlers;
procedure XMLConf_Test is
use XMLConf;
use Ada.Integer_Text_IO;
use Ada.Text_IO;
type Percent is delta 0.01 range 0.00 .. 100.00;
Data : constant League.Strings.Universal_String
:= League.Application.Arguments.Element (1);
Source : aliased XML.SAX.File_Input_Sources.File_Input_Source;
Reader : aliased XML.SAX.Simple_Readers.Simple_Reader;
Handler : aliased XMLConf.Testsuite_Handlers.Testsuite_Handler;
Enabled : Test_Flags := (others => True);
Validating : Boolean := False;
Passed : Natural;
Failed : Natural;
Suppressed : Natural;
begin
if Ada.Command_Line.Argument_Count > 1 then
Enabled := (others => False);
for J in 2 .. Ada.Command_Line.Argument_Count loop
if Ada.Command_Line.Argument (J) = "--valid" then
Enabled (Valid) := True;
elsif Ada.Command_Line.Argument (J) = "--invalid" then
Enabled (Invalid) := True;
elsif Ada.Command_Line.Argument (J) = "--not-wellformed" then
Enabled (Not_Wellformed) := True;
elsif Ada.Command_Line.Argument (J) = "--error" then
Enabled (Error) := True;
elsif Ada.Command_Line.Argument (J) = "--validating" then
Validating := True;
else
raise Program_Error;
end if;
end loop;
end if;
-- Load set of suppressed tests.
Handler.Read_Suppressed
(Ada.Directories.Containing_Directory
(Ada.Directories.Containing_Directory
(Ada.Characters.Conversions.To_String (Data.To_Wide_Wide_String)))
& "/suppressed.lst");
-- Because of limitations of current implementation in tracking relative
-- paths for entities the current working directory is changed to the
-- containing directory of the testsuite description file.
Reader.Set_Content_Handler (Handler'Unchecked_Access);
Reader.Set_Error_Handler (Handler'Unchecked_Access);
Source.Open_By_File_Name (Data);
Handler.Enabled := Enabled;
Handler.Validating := Validating;
Reader.Parse (Source'Access);
Passed :=
Handler.Results (Valid).Passed
+ Handler.Results (Invalid).Passed
+ Handler.Results (Not_Wellformed).Passed
+ Handler.Results (Error).Passed;
Failed :=
Handler.Results (Valid).Failed
+ Handler.Results (Invalid).Failed
+ Handler.Results (Not_Wellformed).Failed
+ Handler.Results (Error).Failed;
Suppressed :=
Handler.Results (Valid).Suppressed
+ Handler.Results (Invalid).Suppressed
+ Handler.Results (Not_Wellformed).Suppressed
+ Handler.Results (Error).Suppressed;
if Failed = 0 then
return;
end if;
Put_Line (" Group Passed Failed Skiped | Crash Output SAX");
Put_Line ("------- ------ ------ ------ | ------ ------ ------");
if Enabled (Valid) then
Put ("valid ");
Put (Handler.Results (Valid).Passed, 7);
Put (Handler.Results (Valid).Failed, 7);
Put (Handler.Results (Valid).Suppressed, 7);
Put (" |");
Put (Handler.Results (Valid).Crash, 7);
Put (Handler.Results (Valid).Output, 7);
Put (Handler.Results (Valid).SAX, 7);
New_Line;
end if;
if Enabled (Invalid) then
Put ("invalid");
Put (Handler.Results (Invalid).Passed, 7);
Put (Handler.Results (Invalid).Failed, 7);
Put (Handler.Results (Invalid).Suppressed, 7);
Put (" |");
Put (Handler.Results (Invalid).Crash, 7);
Put (Handler.Results (Invalid).Output, 7);
Put (Handler.Results (Invalid).SAX, 7);
New_Line;
end if;
if Enabled (Not_Wellformed) then
Put ("not-wf ");
Put (Handler.Results (Not_Wellformed).Passed, 7);
Put (Handler.Results (Not_Wellformed).Failed, 7);
Put (Handler.Results (Not_Wellformed).Suppressed, 7);
Put (" |");
Put (Handler.Results (Not_Wellformed).Crash, 7);
Put (Handler.Results (Not_Wellformed).Output, 7);
Put (Handler.Results (Not_Wellformed).SAX, 7);
New_Line;
end if;
if Enabled (Error) then
Put ("error ");
Put (Handler.Results (Error).Passed, 7);
Put (Handler.Results (Error).Failed, 7);
Put (Handler.Results (Error).Suppressed, 7);
Put (" |");
Put (Handler.Results (Error).Crash, 7);
Put (Handler.Results (Error).Output, 7);
Put (Handler.Results (Error).SAX, 7);
New_Line;
end if;
Put_Line (" ------ ------ ------ | ------ ------ ------");
Put (" ");
Put
(Handler.Results (Valid).Passed
+ Handler.Results (Invalid).Passed
+ Handler.Results (Not_Wellformed).Passed
+ Handler.Results (Error).Passed,
7);
Put
(Handler.Results (Valid).Failed
+ Handler.Results (Invalid).Failed
+ Handler.Results (Not_Wellformed).Failed
+ Handler.Results (Error).Failed,
7);
Put
(Handler.Results (Valid).Suppressed
+ Handler.Results (Invalid).Suppressed
+ Handler.Results (Not_Wellformed).Suppressed
+ Handler.Results (Error).Suppressed,
7);
Put (" |");
Put
(Handler.Results (Valid).Crash
+ Handler.Results (Invalid).Crash
+ Handler.Results (Not_Wellformed).Crash
+ Handler.Results (Error).Crash,
7);
Put
(Handler.Results (Valid).Output
+ Handler.Results (Invalid).Output
+ Handler.Results (Not_Wellformed).Output
+ Handler.Results (Error).Output,
7);
Put
(Handler.Results (Valid).SAX
+ Handler.Results (Invalid).SAX
+ Handler.Results (Not_Wellformed).SAX
+ Handler.Results (Error).SAX,
7);
New_Line;
New_Line;
Put_Line
("Status:"
& Percent'Image
(Percent
(Float (Passed) / Float (Passed + Failed + Suppressed) * 100.0))
& "% passed");
if Handler.Results (Valid).Crash /= 0
or Handler.Results (Invalid).Crash /= 0
or Handler.Results (Not_Wellformed).Crash /= 0
or Handler.Results (Error).Crash /= 0
then
raise Program_Error;
end if;
end XMLConf_Test;
|
programs/oeis/070/A070440.asm | neoneye/loda | 22 | 85605 | ; A070440: a(n) = n^2 mod 18.
; 0,1,4,9,16,7,0,13,10,9,10,13,0,7,16,9,4,1,0,1,4,9,16,7,0,13,10,9,10,13,0,7,16,9,4,1,0,1,4,9,16,7,0,13,10,9,10,13,0,7,16,9,4,1,0,1,4,9,16,7,0,13,10,9,10,13,0,7,16,9,4,1,0,1,4,9,16,7,0,13,10,9,10,13,0,7,16,9,4,1,0,1,4,9,16,7,0,13,10,9
pow $0,2
mod $0,18
|
Micro_review_3.asm | tanmayb104/Library_Management_System_8086 | 0 | 83868 | <filename>Micro_review_3.asm
org 100h
.model small
.stack 100h
.data
header DB "- Library Management System -",0Dh,0Ah,'$'
NEWLINE DB 10,13,"$"
menu1 DB 0Dh,0Ah,0Dh,0Ah,"1- Display Books in library.",0Dh,0Ah,'$'
menu2 DB "2- Add book.",0Dh,0Ah,'$'
menu3 DB "3- Remove book..",0Dh,0Ah,'$'
menu4 DB "4- Exit.",0Dh,0Ah,'$'
menu5 DB "Please enter your choice: ",0Dh,0Ah,'$'
book_name DB 0Dh,0Ah,0Dh,0Ah,"Please write the book name (max 17 character) and press Enter: ",'$'
book_type DB 0Dh,0Ah,"Please write the book type (max 10 character) and press Enter: ",'$'
book_num DB 0Dh,0Ah,0Dh,0Ah,"Please write the book number you want to remove and press Enter: ",'$'
book_list DB 0Dh,0Ah,0Dh,0Ah,"The Book List",0Dh,0Ah,'$'
book_head DB 0Dh,0Ah,"No. Book Name Book Type",'$'
space DB " ",'$'
error_msg DB 0Dh,0Ah,"The book number does not exist",0Dh,0Ah,'$'
full_msg DB 0Dh,0Ah,"There is no place to add a new book, delete book first",0Dh,0Ah,'$'
book1_name DB " The lost boy ",'$'
book2_name DB " Night ",'$'
book3_name DB " Shape of light ",'$'
book4_name DB " Rebecca ",'$'
book5_name DB " The Brain ",'$'
book6_name DB " The lost boy ",'$'
book7_name DB 17 dup('$')
book8_name DB 17 dup('$')
book9_name DB 17 dup('$')
bookA_name DB 17 dup('$')
bookB_name DB 17 dup('$')
bookC_name DB 17 dup('$')
bookD_name DB 17 dup('$')
bookE_name DB 17 dup('$')
bookF_name DB 17 dup('$')
book10_name DB 17 dup('$')
book11_name DB 17 dup('$')
book12_name DB 17 dup('$')
book13_name DB 17 dup('$')
book14_name DB 17 dup('$')
book15_name DB 17 dup('$')
book16_name DB 17 dup('$')
book17_name DB 17 dup('$')
book18_name DB 17 dup('$')
book19_name DB 17 dup('$')
book1A_name DB 17 dup('$')
book1B_name DB 17 dup('$')
book1C_name DB 17 dup('$')
book1D_name DB 17 dup('$')
book1E_name DB 17 dup('$')
book1F_name DB 17 dup('$')
book20_name DB 17 dup('$')
book21_name DB 17 dup('$')
book22_name DB 17 dup('$')
book23_name DB 17 dup('$')
book24_name DB 17 dup('$')
book25_name DB 17 dup('$')
book26_name DB 17 dup('$')
book27_name DB 17 dup('$')
book28_name DB 17 dup('$')
book29_name DB 17 dup('$')
book2A_name DB 17 dup('$')
book2B_name DB 17 dup('$')
book2C_name DB 17 dup('$')
book2D_name DB 17 dup('$')
book2E_name DB 17 dup('$')
book2F_name DB 17 dup('$')
book30_name DB 17 dup('$')
book1_type DB " Story",'$'
book2_type DB " Story",'$'
book3_type DB " Art",'$'
book4_type DB " Art",'$'
book5_type DB " Science",'$'
book6_type DB " Science",'$'
book7_type DB 12 dup('$')
book8_type DB 12 dup('$')
book9_type DB 12 dup('$')
bookA_type DB 12 dup('$')
bookB_type DB 12 dup('$')
bookC_type DB 12 dup('$')
bookD_type DB 12 dup('$')
bookE_type DB 12 dup('$')
bookF_type DB 12 dup('$')
book10_type DB 12 dup('$')
book11_type DB 12 dup('$')
book12_type DB 12 dup('$')
book13_type DB 12 dup('$')
book14_type DB 12 dup('$')
book15_type DB 12 dup('$')
book16_type DB 12 dup('$')
book17_type DB 12 dup('$')
book18_type DB 12 dup('$')
book19_type DB 12 dup('$')
book1A_type DB 12 dup('$')
book1B_type DB 12 dup('$')
book1C_type DB 12 dup('$')
book1D_type DB 12 dup('$')
book1E_type DB 12 dup('$')
book1F_type DB 12 dup('$')
book20_type DB 12 dup('$')
book21_type DB 12 dup('$')
book22_type DB 12 dup('$')
book23_type DB 12 dup('$')
book24_type DB 12 dup('$')
book25_type DB 12 dup('$')
book26_type DB 12 dup('$')
book27_type DB 12 dup('$')
book28_type DB 12 dup('$')
book29_type DB 12 dup('$')
book2A_type DB 12 dup('$')
book2B_type DB 12 dup('$')
book2C_type DB 12 dup('$')
book2D_type DB 12 dup('$')
book2E_type DB 12 dup('$')
book2F_type DB 12 dup('$')
book30_type DB 12 dup('$')
available_book DB 1, 2, 3, 4, 5 ,6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
area DD 0
operation DB 0
.code
begin:
mov ax,@data
mov ds,ax
; print message for the header
MOV AH,09H
LEA DX,header
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
;================================================
start:
;code to choose one choice from the menu
MOV AH,09H
LEA DX, menu1
INT 21H
LEA DX, menu2
INT 21H
LEA DX, menu3
INT 21H
LEA DX, menu4
INT 21H
LEA DX, menu5
INT 21H
get_choice:
; read the user choice
mov ah, 1
int 21h
; first choice
cmp al, '1'
je FIRST_CHOICE
; second choice
cmp al, '2'
je SECOND_CHOICE
; third choice
cmp al, '3'
je THIRD_CHOICE
; forth choice
cmp al, '4'
je FORTH_CHOICE
; loop back to get_choice until the user choose
jmp get_choice
;================================================
FIRST_CHOICE:
; print raduis msg
MOV AH,09H
LEA DX, book_list
INT 21H
LEA DX, book_head
INT 21H
lea si, available_book
mov bl, 0
print_book:
inc bl ; book counter
mov al, [si]
inc si
cmp al, 0 ; go to next book
je next_book
cmp al, 1 ; go to book 1
je book1
cmp al, 2 ; go to book 2
je book2
cmp al, 3 ; go to book 3
je book3
cmp al, 4 ; go to book 4
je book4
cmp al, 5 ; go to book 5
je book5
cmp al, 6 ; go to book 6
je book6
cmp al, 7 ; go to book 7
je book7
cmp al, 8 ; go to book 8
je book8
cmp al, 9 ; go to book 9
je book9
cmp al, 0AH ; go to book A
je bookA
cmp al, 0BH ; go to book B
je bookB
cmp al, 0CH ; go to book C
je bookC
cmp al, 0DH ; go to book D
je bookD
cmp al, 0EH ; go to book E
je bookE
cmp al, 0FH ; go to book F
je bookF
cmp al, 10H ; go to book 10
je book10
cmp al, 11 ; go to book 11
je book11
cmp al, 12 ; go to book 12
je book12
cmp al, 13 ; go to book 13
je book13
cmp al, 14 ; go to book 14
je book14
cmp al, 15 ; go to book 15
je book15
cmp al, 16 ; go to book 16
je book16
cmp al, 17 ; go to book 17
je book17
cmp al, 18 ; go to book 18
je book18
cmp al, 19 ; go to book 19
je book19
cmp al, 1AH ; go to book 1A
je book1A
cmp al, 1BH ; go to book 1B
je book1B
cmp al, 1CH ; go to book 1C
je book1C
cmp al, 1DH ; go to book 1D
je book1D
cmp al, 1EH ; go to book 1E
je book1E
cmp al, 1FH ; go to book 1F
je book1F
cmp al, 20H ; go to book 20
je book20
cmp al, 21 ; go to book 21
je book21
cmp al, 22 ; go to book 22
je book22
cmp al, 23 ; go to book 23
je book23
cmp al, 24 ; go to book 24
je book24
cmp al, 25 ; go to book 25
je book25
cmp al, 26 ; go to book 26
je book26
cmp al, 27 ; go to book 27
je book27
cmp al, 28 ; go to book 28
je book28
cmp al, 29 ; go to book 29
je book29
cmp al, 2AH ; go to book 2A
je book2A
cmp al, 2BH ; go to book 2B
je book2B
cmp al, 2CH ; go to book 2C
je book2C
cmp al, 2DH ; go to book 2D
je book2D
cmp al, 2EH ; go to book 2E
je book2E
cmp al, 2FH ; go to book 2F
je book2F
cmp al, 30H ; go to book 30
je book30
print_book_1:
; print new line
MOV AH,09H
LEA DX, NEWLINE
INT 21H
; print book number
MOV AH,02H
MOV Dl, bl
add Dl, 48
INT 21H
; print space
MOV AH,09H
LEA DX, space
INT 21H
; print book_name
MOV AH,09H
ret
print_book_2:
add dx,02h ; to get rid of the space on the beginning or the buffer size
INT 21H
; print space
MOV AH,09H
LEA DX, space
INT 21H
; print book1_type
MOV AH,09H
ret
print_book_3:
add dx,02h ; to get rid of the space on the beginning or the buffer size
INT 21H
ret
; Display respective book
book1:
CALL print_book_1
LEA DX, book1_name
CALL print_book_2
LEA DX, book1_type
CALL print_book_3
jmp next_book
book2:
CALL print_book_1
LEA DX, book2_name
CALL print_book_2
LEA DX, book2_type
CALL print_book_3
jmp next_book
book3:
CALL print_book_1
LEA DX, book3_name
CALL print_book_2
LEA DX, book3_type
CALL print_book_3
jmp next_book
book4:
CALL print_book_1
LEA DX, book4_name
CALL print_book_2
LEA DX, book4_type
CALL print_book_3
jmp next_book
book5:
CALL print_book_1
LEA DX, book5_name
CALL print_book_2
LEA DX, book5_type
CALL print_book_3
jmp next_book
book6:
CALL print_book_1
LEA DX, book6_name
CALL print_book_2
LEA DX, book6_type
CALL print_book_3
jmp next_book
book7:
CALL print_book_1
LEA DX, book7_name
CALL print_book_2
LEA DX, book7_type
CALL print_book_3
jmp next_book
book8:
CALL print_book_1
LEA DX, book8_name
CALL print_book_2
LEA DX, book8_type
CALL print_book_3
jmp next_book
book9:
CALL print_book_1
LEA DX, book9_name
CALL print_book_2
LEA DX, book9_type
CALL print_book_3
jmp next_book
bookA:
CALL print_book_1
LEA DX, bookA_name
CALL print_book_2
LEA DX, bookA_type
CALL print_book_3
jmp next_book
bookB:
CALL print_book_1
LEA DX, bookB_name
CALL print_book_2
LEA DX, bookB_type
CALL print_book_3
jmp next_book
bookC:
CALL print_book_1
LEA DX, bookC_name
CALL print_book_2
LEA DX, bookC_type
CALL print_book_3
jmp next_book
bookD:
CALL print_book_1
LEA DX, bookD_name
CALL print_book_2
LEA DX, bookD_type
CALL print_book_3
jmp next_book
bookE:
CALL print_book_1
LEA DX, bookE_name
CALL print_book_2
LEA DX, bookE_type
CALL print_book_3
jmp next_book
bookF:
CALL print_book_1
LEA DX, bookF_name
CALL print_book_2
LEA DX, bookF_type
CALL print_book_3
jmp next_book
book10:
CALL print_book_1
LEA DX, book10_name
CALL print_book_2
LEA DX, book10_type
CALL print_book_3
jmp next_book
book11:
CALL print_book_1
LEA DX, book11_name
CALL print_book_2
LEA DX, book11_type
CALL print_book_3
jmp next_book
book12:
CALL print_book_1
LEA DX, book12_name
CALL print_book_2
LEA DX, book12_type
CALL print_book_3
jmp next_book
book13:
CALL print_book_1
LEA DX, book13_name
CALL print_book_2
LEA DX, book13_type
CALL print_book_3
jmp next_book
book14:
CALL print_book_1
LEA DX, book14_name
CALL print_book_2
LEA DX, book14_type
CALL print_book_3
jmp next_book
book15:
CALL print_book_1
LEA DX, book15_name
CALL print_book_2
LEA DX, book15_type
CALL print_book_3
jmp next_book
book16:
CALL print_book_1
LEA DX, book16_name
CALL print_book_2
LEA DX, book16_type
CALL print_book_3
jmp next_book
book17:
CALL print_book_1
LEA DX, book17_name
CALL print_book_2
LEA DX, book17_type
CALL print_book_3
jmp next_book
book18:
CALL print_book_1
LEA DX, book18_name
CALL print_book_2
LEA DX, book18_type
CALL print_book_3
jmp next_book
book19:
CALL print_book_1
LEA DX, book19_name
CALL print_book_2
LEA DX, book19_type
CALL print_book_3
jmp next_book
book1A:
CALL print_book_1
LEA DX, book1A_name
CALL print_book_2
LEA DX, book1A_type
CALL print_book_3
jmp next_book
book1B:
CALL print_book_1
LEA DX, book1B_name
CALL print_book_2
LEA DX, book1B_type
CALL print_book_3
jmp next_book
book1C:
CALL print_book_1
LEA DX, book1C_name
CALL print_book_2
LEA DX, book1C_type
CALL print_book_3
jmp next_book
book1D:
CALL print_book_1
LEA DX, book1D_name
CALL print_book_2
LEA DX, book1D_type
CALL print_book_3
jmp next_book
book1E:
CALL print_book_1
LEA DX, book1E_name
CALL print_book_2
LEA DX, book1E_type
CALL print_book_3
jmp next_book
book1F:
CALL print_book_1
LEA DX, book1F_name
CALL print_book_2
LEA DX, book1F_type
CALL print_book_3
jmp next_book
book20:
CALL print_book_1
LEA DX, book20_name
CALL print_book_2
LEA DX, book20_type
CALL print_book_3
jmp next_book
book21:
CALL print_book_1
LEA DX, book21_name
CALL print_book_2
LEA DX, book21_type
CALL print_book_3
jmp next_book
book22:
CALL print_book_1
LEA DX, book22_name
CALL print_book_2
LEA DX, book22_type
CALL print_book_3
jmp next_book
book23:
CALL print_book_1
LEA DX, book23_name
CALL print_book_2
LEA DX, book23_type
CALL print_book_3
jmp next_book
book24:
CALL print_book_1
LEA DX, book24_name
CALL print_book_2
LEA DX, book24_type
CALL print_book_3
jmp next_book
book25:
CALL print_book_1
LEA DX, book25_name
CALL print_book_2
LEA DX, book25_type
CALL print_book_3
jmp next_book
book26:
CALL print_book_1
LEA DX, book26_name
CALL print_book_2
LEA DX, book26_type
CALL print_book_3
jmp next_book
book27:
CALL print_book_1
LEA DX, book27_name
CALL print_book_2
LEA DX, book27_type
CALL print_book_3
jmp next_book
book28:
CALL print_book_1
LEA DX, book28_name
CALL print_book_2
LEA DX, book28_type
CALL print_book_3
jmp next_book
book29:
CALL print_book_1
LEA DX, book29_name
CALL print_book_2
LEA DX, book29_type
CALL print_book_3
jmp next_book
book2A:
CALL print_book_1
LEA DX, book2A_name
CALL print_book_2
LEA DX, book2A_type
CALL print_book_3
jmp next_book
book2B:
CALL print_book_1
LEA DX, book2B_name
CALL print_book_2
LEA DX, book2B_type
CALL print_book_3
jmp next_book
book2C:
CALL print_book_1
LEA DX, book2C_name
CALL print_book_2
LEA DX, book2C_type
CALL print_book_3
jmp next_book
book2D:
CALL print_book_1
LEA DX, book2D_name
CALL print_book_2
LEA DX, book2D_type
CALL print_book_3
jmp next_book
book2E:
CALL print_book_1
LEA DX, book2E_name
CALL print_book_2
LEA DX, book2E_type
CALL print_book_3
jmp next_book
book2F:
CALL print_book_1
LEA DX, book2F_name
CALL print_book_2
LEA DX, book2F_type
CALL print_book_3
jmp next_book
book30:
CALL print_book_1
LEA DX, book30_name
CALL print_book_2
LEA DX, book30_type
CALL print_book_3
jmp next_book
next_book:
cmp bl, 30H
jg start
jmp print_book
;================================================
SECOND_CHOICE:
lea si, available_book
mov bl, 0
add_book:
; check for empty place
mov al, [si]
inc si
inc bl ; book counter
cmp bl, 30H
jg full_place ; there is no place to add a new book
cmp al, 0 ; there is empty place
je found_place
jmp add_book
found_place:
dec si
mov [si], bl ; save the book num in the list
mov al, bl ; al now have the number of the empty place to add the book
cmp al, 1 ; add book at place 1
je add_book1
cmp al, 2 ; add book at place 2
je add_book2
cmp al, 3 ; add book at place 3
je add_book3
cmp al, 4 ; add book at place 4
je add_book4
cmp al, 5 ; add book at place 5
je add_book5
cmp al, 6 ; add book at place 6
je add_book6
cmp al, 7 ; add book at place 7
je add_book7
cmp al, 8 ; add book at place 8
je add_book8
cmp al, 9 ; add book at place 9
je add_book9
cmp al, 0AH ; add book at place 10
je add_bookA
cmp al, 0BH ; add book at place 11
je add_bookB
cmp al, 0CH ; add book at place 12
je add_bookC
cmp al, 0DH ; add book at place 13
je add_bookD
cmp al, 0EH ; add book at place 14
je add_bookE
cmp al, 0FH ; add book at place 15
je add_bookF
cmp al, 10H ; add book at place 16
je add_book10
cmp al, 11 ; add book at place 17
je add_book11
cmp al, 12 ; add book at place 18
je add_book12
cmp al, 13 ; add book at place 19
je add_book13
cmp al, 14 ; add book at place 20
je add_book14
cmp al, 15 ; add book at place 21
je add_book15
cmp al, 16 ; add book at place 22
je add_book16
cmp al, 17 ; add book at place 23
je add_book17
cmp al, 18 ; add book at place 24
je add_book18
cmp al, 19 ; add book at place 25
je add_book19
cmp al, 1AH ; add book at place 26
je add_book1A
cmp al, 1BH ; add book at place 27
je add_book1B
cmp al, 1CH ; add book at place 28
je add_book1C
cmp al, 1DH ; add book at place 29
je add_book1D
cmp al, 1EH ; add book at place 30
je add_book1E
cmp al, 1FH ; add book at place 31
je add_book1F
cmp al, 20H ; add book at place 32
je add_book20
cmp al, 21 ; add book at place 33
je add_book21
cmp al, 22 ; add book at place 34
je add_book22
cmp al, 23 ; add book at place 35
je add_book23
cmp al, 24 ; add book at place 36
je add_book24
cmp al, 25 ; add book at place 37
je add_book25
cmp al, 26 ; add book at place 38
je add_book26
cmp al, 27 ; add book at place 39
je add_book27
cmp al, 28 ; add book at place 40
je add_book28
cmp al, 29 ; add book at place 41
je add_book29
cmp al, 2AH ; add book at place 42
je add_book2A
cmp al, 2BH ; add book at place 43
je add_book2B
cmp al, 2CH ; add book at place 44
je add_book2C
cmp al, 2DH ; add book at place 45
je add_book2D
cmp al, 2EH ; add book at place 46
je add_book2E
cmp al, 2FH ; add book at place 47
je add_book2F
cmp al, 30H ; add book at place 48
je add_book30
add_book_1:
; print book_name msg
MOV AH,09H
LEA DX, book_name
INT 21H
; Get the book name
mov ah,0ah
ret
add_book_2:
int 21h
mov si, dx ; save the address for space padding
; print NEWLINE
MOV AH,09H
LEA DX, NEWLINE
INT 21H
; print book_type msg
MOV AH,09H
LEA DX, book_type
INT 21H
; Get the book type
mov ah,0ah
ret
add_book_3:
int 21h
mov di, dx ; save the address for end string
jmp space_pad
ret
; add book in place 1
add_book1:
CALL add_book_1
lea dx, book1_name
CALL add_book_2
lea dx, book1_type
CALL add_book_3
; add book in place 2
add_book2:
CALL add_book_1
lea dx, book2_name
CALL add_book_2
lea dx, book2_type
CALL add_book_3
; add book in place 3
add_book3:
CALL add_book_1
lea dx, book3_name
CALL add_book_2
lea dx, book3_type
CALL add_book_3
; add book in place 4
add_book4:
CALL add_book_1
lea dx, book4_name
CALL add_book_2
lea dx, book4_type
CALL add_book_3
; add book in place 5
add_book5:
CALL add_book_1
lea dx, book5_name
CALL add_book_2
lea dx, book5_type
CALL add_book_3
; add book in place 6
add_book6:
CALL add_book_1
lea dx, book6_name
CALL add_book_2
lea dx, book6_type
CALL add_book_3
; add book in place 7
add_book7:
CALL add_book_1
lea dx, book7_name
CALL add_book_2
lea dx, book7_type
CALL add_book_3
; add book in place 8
add_book8:
CALL add_book_1
lea dx, book8_name
CALL add_book_2
lea dx, book8_type
CALL add_book_3
; add book in place 9
add_book9:
CALL add_book_1
lea dx, book9_name
CALL add_book_2
lea dx, book9_type
CALL add_book_3
; add book in place 10
add_bookA:
CALL add_book_1
lea dx, bookA_name
CALL add_book_2
lea dx, bookA_type
CALL add_book_3
; add book in place 11
add_bookB:
CALL add_book_1
lea dx, bookB_name
CALL add_book_2
lea dx, bookB_type
CALL add_book_3
; add book in place 12
add_bookC:
CALL add_book_1
lea dx, bookC_name
CALL add_book_2
lea dx, bookC_type
CALL add_book_3
; add book in place 13
add_bookD:
CALL add_book_1
lea dx, bookD_name
CALL add_book_2
lea dx, bookD_type
CALL add_book_3
; add book in place 14
add_bookE:
CALL add_book_1
lea dx, bookE_name
CALL add_book_2
lea dx, bookE_type
CALL add_book_3
; add book in place 15
add_bookF:
CALL add_book_1
lea dx, bookF_name
CALL add_book_2
lea dx, bookF_type
CALL add_book_3
; add book in place 16
add_book10:
CALL add_book_1
lea dx, book10_name
CALL add_book_2
lea dx, book10_type
CALL add_book_3
; add book in place 17
add_book11:
CALL add_book_1
lea dx, book11_name
CALL add_book_2
lea dx, book11_type
CALL add_book_3
; add book in place 18
add_book12:
CALL add_book_1
lea dx, book12_name
CALL add_book_2
lea dx, book12_type
CALL add_book_3
; add book in place 19
add_book13:
CALL add_book_1
lea dx, book13_name
CALL add_book_2
lea dx, book13_type
CALL add_book_3
; add book in place 20
add_book14:
CALL add_book_1
lea dx, book14_name
CALL add_book_2
lea dx, book14_type
CALL add_book_3
; add book in place 21
add_book15:
CALL add_book_1
lea dx, book15_name
CALL add_book_2
lea dx, book15_type
CALL add_book_3
; add book in place 22
add_book16:
CALL add_book_1
lea dx, book16_name
CALL add_book_2
lea dx, book16_type
CALL add_book_3
; add book in place 23
add_book17:
CALL add_book_1
lea dx, book17_name
CALL add_book_2
lea dx, book17_type
CALL add_book_3
; add book in place 24
add_book18:
CALL add_book_1
lea dx, book18_name
CALL add_book_2
lea dx, book18_type
CALL add_book_3
; add book in place 25
add_book19:
CALL add_book_1
lea dx, book19_name
CALL add_book_2
lea dx, book19_type
CALL add_book_3
; add book in place 26
add_book1A:
CALL add_book_1
lea dx, book1A_name
CALL add_book_2
lea dx, book1A_type
CALL add_book_3
; add book in place 27
add_book1B:
CALL add_book_1
lea dx, book1B_name
CALL add_book_2
lea dx, book1B_type
CALL add_book_3
; add book in place 28
add_book1C:
CALL add_book_1
lea dx, book1C_name
CALL add_book_2
lea dx, book1C_type
CALL add_book_3
; add book in place 29
add_book1D:
CALL add_book_1
lea dx, book1D_name
CALL add_book_2
lea dx, book1D_type
CALL add_book_3
; add book in place 30
add_book1E:
CALL add_book_1
lea dx, book1E_name
CALL add_book_2
lea dx, book1E_type
CALL add_book_3
; add book in place 31
add_book1F:
CALL add_book_1
lea dx, book1F_name
CALL add_book_2
lea dx, book1F_type
CALL add_book_3
; add book in place 32
add_book20:
CALL add_book_1
lea dx, book20_name
CALL add_book_2
lea dx, book20_type
CALL add_book_3
; add book in place 33
add_book21:
CALL add_book_1
lea dx, book21_name
CALL add_book_2
lea dx, book21_type
CALL add_book_3
; add book in place 34
add_book22:
CALL add_book_1
lea dx, book22_name
CALL add_book_2
lea dx, book22_type
CALL add_book_3
; add book in place 35
add_book23:
CALL add_book_1
lea dx, book23_name
CALL add_book_2
lea dx, book23_type
CALL add_book_3
; add book in place 36
add_book24:
CALL add_book_1
lea dx, book24_name
CALL add_book_2
lea dx, book24_type
CALL add_book_3
; add book in place 37
add_book25:
CALL add_book_1
lea dx, book25_name
CALL add_book_2
lea dx, book25_type
CALL add_book_3
; add book in place 38
add_book26:
CALL add_book_1
lea dx, book26_name
CALL add_book_2
lea dx, book26_type
CALL add_book_3
; add book in place 39
add_book27:
CALL add_book_1
lea dx, book27_name
CALL add_book_2
lea dx, book27_type
CALL add_book_3
; add book in place 40
add_book28:
CALL add_book_1
lea dx, book28_name
CALL add_book_2
lea dx, book28_type
CALL add_book_3
; add book in place 41
add_book29:
CALL add_book_1
lea dx, book29_name
CALL add_book_2
lea dx, book29_type
CALL add_book_3
; add book in place 42
add_book2A:
CALL add_book_1
lea dx, book2A_name
CALL add_book_2
lea dx, book2A_type
CALL add_book_3
; add book in place 43
add_book2B:
CALL add_book_1
lea dx, book2B_name
CALL add_book_2
lea dx, book2B_type
CALL add_book_3
; add book in place 44
add_book2C:
CALL add_book_1
lea dx, book2C_name
CALL add_book_2
lea dx, book2C_type
CALL add_book_3
; add book in place 45
add_book2D:
CALL add_book_1
lea dx, book2D_name
CALL add_book_2
lea dx, book2D_type
CALL add_book_3
; add book in place 46
add_book2E:
CALL add_book_1
lea dx, book2E_name
CALL add_book_2
lea dx, book2E_type
CALL add_book_3
; add book in place 47
add_book2F:
CALL add_book_1
lea dx, book2F_name
CALL add_book_2
lea dx, book2F_type
CALL add_book_3
; add book in place 48
add_book30:
CALL add_book_1
lea dx, book30_name
CALL add_book_2
lea dx, book30_type
CALL add_book_3
; when there is no space for new book
full_place:
; print full_msg
mov ah,09h
lea dx, full_msg
int 21h
jmp start
; fill the rest of the name with space for printing
space_pad:
mov ax, 0
mov cx, 0
mov al, [si+1] ; get the length of the string
add al, 2 ; for the buffer size
mov cl, 17
sub cl, al ; initilaize the counter
add ax, si
mov si, ax ; go to character after the last character
space_loop:
mov [si], 32 ; add space to the name
inc si
loop space_loop
mov [si], '$'
; add $ to the end of the book type string
mov ax, 0
mov cx, 0
mov al, [di+1] ; get the length of the string
add al, 2 ; for the buffer size
add ax, di
mov di, ax ; go to character after the last character
mov [di], '$' ; add $ to the end
jmp start
;================================================
THIRD_CHOICE:
; print book_num msg
mov ah,09h
lea dx, book_num
int 21h
; read the user choice
mov ah, 1
int 21h
sub al, 48
lea si, available_book
mov bl, 0
; check for book
check_book:
cmp al, [si]
je found_book
inc si
inc bl ; book counter
cmp bl, 30H
jg wrong ; there is no place to add a new book
jmp check_book
found_book:
mov [si], 0
jmp start
wrong:
; print error_msg
mov ah,0ah
lea dx, error_msg
int 21h
jmp start
;================================================
FORTH_CHOICE:
mov ah,4Ch
int 21h |
g-socket.adb | ytomino/gnat4drake | 0 | 14052 | with Ada.Unchecked_Deallocation;
package body GNAT.Sockets is
procedure Free is
new Ada.Unchecked_Deallocation (
Ada.Streams.Stream_IO.File_Type,
Socket_Type);
function Addresses (E : Host_Entry_Type; N : Positive := 1)
return Inet_Addr_Type
is
pragma Unreferenced (N);
begin
return (
Family => Family_Inet,
Host_Name =>
Ada.Strings.Unbounded_Strings.To_Unbounded_String (String (E)));
end Addresses;
function Get_Host_By_Name (Name : String) return Host_Entry_Type is
begin
return Host_Entry_Type (Name);
end Get_Host_By_Name;
procedure Create_Socket (
Socket : out Socket_Type;
Family : Family_Type := Family_Inet;
Mode : Mode_Type := Socket_Stream)
is
pragma Unreferenced (Family);
pragma Unreferenced (Mode);
begin
Socket := new Ada.Streams.Stream_IO.File_Type;
end Create_Socket;
procedure Close_Socket (Socket : in out Socket_Type) is
begin
Ada.Streams.Stream_IO.Close (Socket.all);
Free (Socket);
end Close_Socket;
procedure Connect_Socket (
Socket : Socket_Type;
Server : in out Sock_Addr_Type)
is
End_Point : constant Ada.Streams.Stream_IO.Sockets.End_Point :=
Ada.Streams.Stream_IO.Sockets.Resolve (
Ada.Strings.Unbounded_Strings.Constant_Reference (
Server.Addr.Host_Name).Element.all,
Server.Port);
begin
Ada.Streams.Stream_IO.Sockets.Connect (Socket.all, End_Point);
end Connect_Socket;
procedure Receive_Socket (
Socket : Socket_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Flags : Request_Flag_Type := No_Request_Flag)
is
pragma Unreferenced (Flags);
begin
Ada.Streams.Stream_IO.Read (Socket.all, Item, Last);
end Receive_Socket;
function Stream (Socket : Socket_Type) return Stream_Access is
begin
return Ada.Streams.Stream_IO.Stream (Socket.all);
end Stream;
end GNAT.Sockets;
|
oeis/315/A315259.asm | neoneye/loda-programs | 11 | 244431 | <filename>oeis/315/A315259.asm<gh_stars>10-100
; A315259: Coordination sequence Gal.4.54.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>
; 1,6,10,15,20,25,30,34,40,46,50,55,60,65,70,74,80,86,90,95,100,105,110,114,120,126,130,135,140,145,150,154,160,166,170,175,180,185,190,194,200,206,210,215,220,225,230,234,240,246
mov $1,$0
seq $1,310458 ; Coordination sequence Gal.4.78.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
mov $2,$0
mul $0,7
sub $0,1
mod $0,$1
mul $2,3
add $0,$2
add $0,1
|
sources/ippcp/asm_intel64/pcpp384r1funcs_montas.asm | ymarkovitch/ipp-crypto | 0 | 18958 | ;===============================================================================
; Copyright 2014-2019 Intel Corporation
; All Rights Reserved.
;
; If this software was obtained under the Intel Simplified Software License,
; the following terms apply:
;
; The source code, information and material ("Material") contained herein is
; owned by Intel Corporation or its suppliers or licensors, and title to such
; Material remains with Intel Corporation or its suppliers or licensors. The
; Material contains proprietary information of Intel or its suppliers and
; licensors. The Material is protected by worldwide copyright laws and treaty
; provisions. No part of the Material may be used, copied, reproduced,
; modified, published, uploaded, posted, transmitted, distributed or disclosed
; in any way without Intel's prior express written permission. No license under
; any patent, copyright or other intellectual property rights in the Material
; is granted to or conferred upon you, either expressly, by implication,
; inducement, estoppel or otherwise. Any license under such intellectual
; property rights must be express and approved by Intel in writing.
;
; Unless otherwise agreed by Intel in writing, you may not remove or alter this
; notice or any other notice embedded in Materials by Intel or Intel's
; suppliers or licensors in any way.
;
;
; If this software was obtained under the Apache License, Version 2.0 (the
; "License"), the following terms apply:
;
; You may not use this file except in compliance with the License. You may
; obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
;
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;
; See the License for the specific language governing permissions and
; limitations under the License.
;===============================================================================
;
;
; Purpose: Cryptography Primitive.
; secp p384r1 specific implementation
;
include asmdefs.inc
include ia_32e.inc
IF _IPP32E GE _IPP32E_M7
_xEMULATION_ = 1
_ADCX_ADOX_ = 1
.LIST
IPPCODE SEGMENT 'CODE' ALIGN (IPP_ALIGN_FACTOR)
ALIGN IPP_ALIGN_FACTOR
;; The p384r1 polynomial
Lpoly DQ 000000000ffffffffh,0ffffffff00000000h,0fffffffffffffffeh
DQ 0ffffffffffffffffh,0ffffffffffffffffh,0ffffffffffffffffh
;; 2^(2*384) mod P precomputed for p384r1 polynomial
;LRR DQ 0fffffffe00000001h,00000000200000000h,0fffffffe00000000h
; DQ 00000000200000000h,00000000000000001h,00000000000000000h
LOne DD 1,1,1,1,1,1,1,1
LTwo DD 2,2,2,2,2,2,2,2
LThree DD 3,3,3,3,3,3,3,3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; void p384r1_mul_by_2(uint64_t res[6], uint64_t a[6]);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_mul_by_2 PROC PUBLIC FRAME
USES_GPR rsi,rdi,r12
LOCAL_FRAME = 0
USES_XMM
COMP_ABI 2
a0 equ rax
a1 equ rcx
a2 equ rdx
a3 equ r8
a4 equ r9
a5 equ r10
ex equ r11
t equ r12
xor ex, ex
mov a0, qword ptr[rsi+sizeof(qword)*0]
mov a1, qword ptr[rsi+sizeof(qword)*1]
mov a2, qword ptr[rsi+sizeof(qword)*2]
mov a3, qword ptr[rsi+sizeof(qword)*3]
mov a4, qword ptr[rsi+sizeof(qword)*4]
mov a5, qword ptr[rsi+sizeof(qword)*5]
shld ex, a5, 1
shld a5, a4, 1
mov qword ptr[rdi+sizeof(qword)*5], a5
shld a4, a3, 1
mov qword ptr[rdi+sizeof(qword)*4], a4
shld a3, a2, 1
mov qword ptr[rdi+sizeof(qword)*3], a3
shld a2, a1, 1
mov qword ptr[rdi+sizeof(qword)*2], a2
shld a1, a0, 1
mov qword ptr[rdi+sizeof(qword)*1], a1
shl a0, 1
mov qword ptr[rdi+sizeof(qword)*0], a0
sub a0, qword ptr Lpoly+sizeof(qword)*0
sbb a1, qword ptr Lpoly+sizeof(qword)*1
sbb a2, qword ptr Lpoly+sizeof(qword)*2
sbb a3, qword ptr Lpoly+sizeof(qword)*3
sbb a4, qword ptr Lpoly+sizeof(qword)*4
sbb a5, qword ptr Lpoly+sizeof(qword)*5
sbb ex, 0
mov t, qword ptr[rdi+sizeof(qword)*0]
cmovnz a0, t
mov t, qword ptr[rdi+sizeof(qword)*1]
cmovnz a1, t
mov t, qword ptr[rdi+sizeof(qword)*2]
cmovnz a2, t
mov t, qword ptr[rdi+sizeof(qword)*3]
cmovnz a3, t
mov t, qword ptr[rdi+sizeof(qword)*4]
cmovnz a4, t
mov t, qword ptr[rdi+sizeof(qword)*5]
cmovnz a5, t
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
REST_XMM
REST_GPR
ret
IPPASM p384r1_mul_by_2 ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; void p384r1_div_by_2(uint64_t res[6], uint64_t a[6]);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_div_by_2 PROC PUBLIC FRAME
USES_GPR rsi,rdi,r12
LOCAL_FRAME = 0
USES_XMM
COMP_ABI 2
a0 equ rax
a1 equ rcx
a2 equ rdx
a3 equ r8
a4 equ r9
a5 equ r10
ex equ r11
t equ r12
mov a0, qword ptr[rsi+sizeof(qword)*0]
mov a1, qword ptr[rsi+sizeof(qword)*1]
mov a2, qword ptr[rsi+sizeof(qword)*2]
mov a3, qword ptr[rsi+sizeof(qword)*3]
mov a4, qword ptr[rsi+sizeof(qword)*4]
mov a5, qword ptr[rsi+sizeof(qword)*5]
xor t, t
xor ex, ex
add a0, qword ptr Lpoly+sizeof(qword)*0
adc a1, qword ptr Lpoly+sizeof(qword)*1
adc a2, qword ptr Lpoly+sizeof(qword)*2
adc a3, qword ptr Lpoly+sizeof(qword)*3
adc a4, qword ptr Lpoly+sizeof(qword)*4
adc a5, qword ptr Lpoly+sizeof(qword)*5
adc ex, 0
test a0, 1
cmovnz ex, t
mov t, qword ptr[rsi+sizeof(qword)*0]
cmovnz a0, t
mov t, qword ptr[rsi+sizeof(qword)*1]
cmovnz a1, t
mov t, qword ptr[rsi+sizeof(qword)*2]
cmovnz a2, t
mov t, qword ptr[rsi+sizeof(qword)*3]
cmovnz a3, t
mov t, qword ptr[rsi+sizeof(qword)*4]
cmovnz a4, t
mov t, qword ptr[rsi+sizeof(qword)*5]
cmovnz a5, t
shrd a0, a1, 1
shrd a1, a2, 1
shrd a2, a3, 1
shrd a3, a4, 1
shrd a4, a5, 1
shrd a5, ex, 1
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
REST_XMM
REST_GPR
ret
IPPASM p384r1_div_by_2 ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; void p384r1_mul_by_3(uint64_t res[6], uint64_t a[6]);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_mul_by_3 PROC PUBLIC FRAME
USES_GPR rsi,rdi,r12,r13
LOCAL_FRAME = sizeof(qword)*6
USES_XMM
COMP_ABI 2
a0 equ rax
a1 equ rcx
a2 equ rdx
a3 equ r8
a4 equ r9
a5 equ r10
ex equ r11
t equ r12
xor ex, ex
mov a0, qword ptr[rsi+sizeof(qword)*0]
mov a1, qword ptr[rsi+sizeof(qword)*1]
mov a2, qword ptr[rsi+sizeof(qword)*2]
mov a3, qword ptr[rsi+sizeof(qword)*3]
mov a4, qword ptr[rsi+sizeof(qword)*4]
mov a5, qword ptr[rsi+sizeof(qword)*5]
shld ex, a5, 1
shld a5, a4, 1
mov qword ptr[rsp+sizeof(qword)*5], a5
shld a4, a3, 1
mov qword ptr[rsp+sizeof(qword)*4], a4
shld a3, a2, 1
mov qword ptr[rsp+sizeof(qword)*3], a3
shld a2, a1, 1
mov qword ptr[rsp+sizeof(qword)*2], a2
shld a1, a0, 1
mov qword ptr[rsp+sizeof(qword)*1], a1
shl a0, 1
mov qword ptr[rsp+sizeof(qword)*0], a0
sub a0, qword ptr Lpoly+sizeof(qword)*0
sbb a1, qword ptr Lpoly+sizeof(qword)*1
sbb a2, qword ptr Lpoly+sizeof(qword)*2
sbb a3, qword ptr Lpoly+sizeof(qword)*3
sbb a4, qword ptr Lpoly+sizeof(qword)*4
sbb a5, qword ptr Lpoly+sizeof(qword)*5
sbb ex, 0
mov t, qword ptr[rsp+0*sizeof(qword)]
cmovb a0, t
mov t, qword ptr[rsp+1*sizeof(qword)]
cmovb a1, t
mov t, qword ptr[rsp+2*sizeof(qword)]
cmovb a2, t
mov t, qword ptr[rsp+3*sizeof(qword)]
cmovb a3, t
mov t, qword ptr[rsp+4*sizeof(qword)]
cmovb a4, t
mov t, qword ptr[rsp+5*sizeof(qword)]
cmovb a5, t
xor ex, ex
add a0, qword ptr[rsi+sizeof(qword)*0]
mov qword ptr[rsp+sizeof(qword)*0], a0
adc a1, qword ptr[rsi+sizeof(qword)*1]
mov qword ptr[rsp+sizeof(qword)*1], a1
adc a2, qword ptr[rsi+sizeof(qword)*2]
mov qword ptr[rsp+sizeof(qword)*2], a2
adc a3, qword ptr[rsi+sizeof(qword)*3]
mov qword ptr[rsp+sizeof(qword)*3], a3
adc a4, qword ptr[rsi+sizeof(qword)*4]
mov qword ptr[rsp+sizeof(qword)*4], a4
adc a5, qword ptr[rsi+sizeof(qword)*5]
mov qword ptr[rsp+sizeof(qword)*5], a5
adc ex, 0
sub a0, qword ptr Lpoly+sizeof(qword)*0
sbb a1, qword ptr Lpoly+sizeof(qword)*1
sbb a2, qword ptr Lpoly+sizeof(qword)*2
sbb a3, qword ptr Lpoly+sizeof(qword)*3
sbb a4, qword ptr Lpoly+sizeof(qword)*4
sbb a5, qword ptr Lpoly+sizeof(qword)*5
sbb ex, 0
mov t, qword ptr[rsp+sizeof(qword)*0]
cmovb a0, t
mov t, qword ptr[rsp+sizeof(qword)*1]
cmovb a1, t
mov t, qword ptr[rsp+sizeof(qword)*2]
cmovb a2, t
mov t, qword ptr[rsp+sizeof(qword)*3]
cmovb a3, t
mov t, qword ptr[rsp+sizeof(qword)*4]
cmovb a4, t
mov t, qword ptr[rsp+sizeof(qword)*5]
cmovb a5, t
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
REST_XMM
REST_GPR
ret
IPPASM p384r1_mul_by_3 ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; void p384r1_add(uint64_t res[6], uint64_t a[6], uint64_t b[6]);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_add PROC PUBLIC FRAME
USES_GPR rbx,rsi,rdi,r12
LOCAL_FRAME = 0
USES_XMM
COMP_ABI 3
a0 equ rax
a1 equ rcx
a2 equ rbx
a3 equ r8
a4 equ r9
a5 equ r10
ex equ r11
t equ r12
xor ex, ex
mov a0, qword ptr[rsi+sizeof(qword)*0]
mov a1, qword ptr[rsi+sizeof(qword)*1]
mov a2, qword ptr[rsi+sizeof(qword)*2]
mov a3, qword ptr[rsi+sizeof(qword)*3]
mov a4, qword ptr[rsi+sizeof(qword)*4]
mov a5, qword ptr[rsi+sizeof(qword)*5]
add a0, qword ptr[rdx+sizeof(qword)*0]
adc a1, qword ptr[rdx+sizeof(qword)*1]
adc a2, qword ptr[rdx+sizeof(qword)*2]
adc a3, qword ptr[rdx+sizeof(qword)*3]
adc a4, qword ptr[rdx+sizeof(qword)*4]
adc a5, qword ptr[rdx+sizeof(qword)*5]
adc ex, 0
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
sub a0, qword ptr Lpoly+sizeof(qword)*0
sbb a1, qword ptr Lpoly+sizeof(qword)*1
sbb a2, qword ptr Lpoly+sizeof(qword)*2
sbb a3, qword ptr Lpoly+sizeof(qword)*3
sbb a4, qword ptr Lpoly+sizeof(qword)*4
sbb a5, qword ptr Lpoly+sizeof(qword)*5
sbb ex, 0
mov t, qword ptr[rdi+sizeof(qword)*0]
cmovb a0, t
mov t, qword ptr[rdi+sizeof(qword)*1]
cmovb a1, t
mov t, qword ptr[rdi+sizeof(qword)*2]
cmovb a2, t
mov t, qword ptr[rdi+sizeof(qword)*3]
cmovb a3, t
mov t, qword ptr[rdi+sizeof(qword)*4]
cmovb a4, t
mov t, qword ptr[rdi+sizeof(qword)*5]
cmovb a5, t
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
REST_XMM
REST_GPR
ret
IPPASM p384r1_add ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; void p384r1_sub(uint64_t res[6], uint64_t a[6], uint64_t b[6]);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_sub PROC PUBLIC FRAME
USES_GPR rbx,rsi,rdi,r12
LOCAL_FRAME = 0
USES_XMM
COMP_ABI 3
a0 equ rax
a1 equ rcx
a2 equ rbx
a3 equ r8
a4 equ r9
a5 equ r10
ex equ r11
t equ r12
xor ex, ex
mov a0, qword ptr[rsi+sizeof(qword)*0] ; a
mov a1, qword ptr[rsi+sizeof(qword)*1]
mov a2, qword ptr[rsi+sizeof(qword)*2]
mov a3, qword ptr[rsi+sizeof(qword)*3]
mov a4, qword ptr[rsi+sizeof(qword)*4]
mov a5, qword ptr[rsi+sizeof(qword)*5]
sub a0, qword ptr[rdx+sizeof(qword)*0] ; a-b
sbb a1, qword ptr[rdx+sizeof(qword)*1]
sbb a2, qword ptr[rdx+sizeof(qword)*2]
sbb a3, qword ptr[rdx+sizeof(qword)*3]
sbb a4, qword ptr[rdx+sizeof(qword)*4]
sbb a5, qword ptr[rdx+sizeof(qword)*5]
sbb ex, 0 ; ex = a>=b? 0 : -1
mov qword ptr[rdi+sizeof(qword)*0], a0 ; store (a-b)
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
add a0, qword ptr Lpoly+sizeof(qword)*0 ; (a-b) +poly
adc a1, qword ptr Lpoly+sizeof(qword)*1
adc a2, qword ptr Lpoly+sizeof(qword)*2
adc a3, qword ptr Lpoly+sizeof(qword)*3
adc a4, qword ptr Lpoly+sizeof(qword)*4
adc a5, qword ptr Lpoly+sizeof(qword)*5
test ex, ex ; r = (ex)? ((a-b)+poly) : (a-b)
mov t, qword ptr[rdi+sizeof(qword)*0]
cmovz a0, t
mov t, qword ptr[rdi+sizeof(qword)*1]
cmovz a1, t
mov t, qword ptr[rdi+sizeof(qword)*2]
cmovz a2, t
mov t, qword ptr[rdi+sizeof(qword)*3]
cmovz a3, t
mov t, qword ptr[rdi+sizeof(qword)*4]
cmovz a4, t
mov t, qword ptr[rdi+sizeof(qword)*5]
cmovz a5, t
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
REST_XMM
REST_GPR
ret
IPPASM p384r1_sub ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; void p384r1_neg(uint64_t res[6], uint64_t a[6]);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_neg PROC PUBLIC FRAME
USES_GPR rsi,rdi,r12
LOCAL_FRAME = 0
USES_XMM
COMP_ABI 2
a0 equ rax
a1 equ rcx
a2 equ rdx
a3 equ r8
a4 equ r9
a5 equ r10
ex equ r11
t equ r12
xor ex, ex
xor a0, a0
xor a1, a1
xor a2, a2
xor a3, a3
xor a4, a4
xor a5, a5
sub a0, qword ptr[rsi+sizeof(qword)*0]
sbb a1, qword ptr[rsi+sizeof(qword)*1]
sbb a2, qword ptr[rsi+sizeof(qword)*2]
sbb a3, qword ptr[rsi+sizeof(qword)*3]
sbb a4, qword ptr[rsi+sizeof(qword)*4]
sbb a5, qword ptr[rsi+sizeof(qword)*5]
sbb ex, 0
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
add a0, qword ptr Lpoly+sizeof(qword)*0
adc a1, qword ptr Lpoly+sizeof(qword)*1
adc a2, qword ptr Lpoly+sizeof(qword)*2
adc a3, qword ptr Lpoly+sizeof(qword)*3
adc a4, qword ptr Lpoly+sizeof(qword)*4
adc a5, qword ptr Lpoly+sizeof(qword)*5
test ex, ex
mov t, qword ptr[rdi+sizeof(qword)*0]
cmovz a0, t
mov t, qword ptr[rdi+sizeof(qword)*1]
cmovz a1, t
mov t, qword ptr[rdi+sizeof(qword)*2]
cmovz a2, t
mov t, qword ptr[rdi+sizeof(qword)*3]
cmovz a3, t
mov t, qword ptr[rdi+sizeof(qword)*4]
cmovz a4, t
mov t, qword ptr[rdi+sizeof(qword)*5]
cmovz a5, t
mov qword ptr[rdi+sizeof(qword)*0], a0
mov qword ptr[rdi+sizeof(qword)*1], a1
mov qword ptr[rdi+sizeof(qword)*2], a2
mov qword ptr[rdi+sizeof(qword)*3], a3
mov qword ptr[rdi+sizeof(qword)*4], a4
mov qword ptr[rdi+sizeof(qword)*5], a5
REST_XMM
REST_GPR
ret
IPPASM p384r1_neg ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; projective point selector
;
; void p384r1_mred(Ipp464u* res, Ipp64u product);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mred_step MACRO a6,a5,a4,a3,a2,a1,a0, t2,t1
mov rax, a0 ;; u = (m0*a0) mod 2^64= ((2^32+1)*a0) mod 2^64
shl rax, 32
add rax, a0
mov t2, rax ;; (t2:t1) = u*2^32, store
shr t2, (64-32)
push t2
mov t1, rax
shl t1, 32
push t1
sub t1, rax ;; {t2:t1} = (2^32 -1)*u
sbb t2, 0
add a0, t1 ;; {a0:a1} += {t2:t1}
pop t1 ;; restore {t2:t1} = u*2^32
adc a1, t2 ;; and accomodate carry
pop t2
sbb t2, 0
sub a1, t1 ;; {a1:a2} -= {t1:t2}
mov t1, 0
sbb a2, t2
adc t1, 0
sub a2, rax ;; a2 -= u
adc t1, 0
sub a3, t1 ;; a3 -= borrow
sbb a4, 0 ;; a4 -= borrow
sbb a5, 0 ;; a5 -= borrow
sbb rax, 0
add rax, rdx
mov rdx, 0
adc rdx, 0
add a6, rax
adc rdx, 0
ENDM
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_mred PROC PUBLIC FRAME
USES_GPR rsi,rdi,r12,r13,r14,r15
USES_XMM
COMP_ABI 2
;; rdi = result
;; rsi = product buffer
xor rdx, rdx
mov r8, qword ptr[rsi]
mov r9, qword ptr[rsi+sizeof(qword)]
mov r10, qword ptr[rsi+sizeof(qword)*2]
mov r11, qword ptr[rsi+sizeof(qword)*3]
mov r12, qword ptr[rsi+sizeof(qword)*4]
mov r13, qword ptr[rsi+sizeof(qword)*5]
mov r14, qword ptr[rsi+sizeof(qword)*6]
mred_step r14,r13,r12,r11,r10,r9,r8, r15,rcx
;mov qword ptr[rdi+sizeof(qword)*0], r9
;mov qword ptr[rdi+sizeof(qword)*1], r10
;mov qword ptr[rdi+sizeof(qword)*2], r11
;mov qword ptr[rdi+sizeof(qword)*3], r12
;mov qword ptr[rdi+sizeof(qword)*4], r13
;mov qword ptr[rdi+sizeof(qword)*5], r14
mov r8, qword ptr[rsi+sizeof(qword)*7]
mred_step r8,r14,r13,r12,r11,r10,r9, r15,rcx
;mov qword ptr[rdi+sizeof(qword)*0], r10
;mov qword ptr[rdi+sizeof(qword)*1], r11
;mov qword ptr[rdi+sizeof(qword)*2], r12
;mov qword ptr[rdi+sizeof(qword)*3], r13
;mov qword ptr[rdi+sizeof(qword)*4], r14
;mov qword ptr[rdi+sizeof(qword)*5], r8
mov r9, qword ptr[rsi+sizeof(qword)*8]
mred_step r9,r8,r14,r13,r12,r11,r10, r15,rcx
;mov qword ptr[rdi+sizeof(qword)*0], r11
;mov qword ptr[rdi+sizeof(qword)*1], r12
;mov qword ptr[rdi+sizeof(qword)*2], r13
;mov qword ptr[rdi+sizeof(qword)*3], r14
;mov qword ptr[rdi+sizeof(qword)*4], r8
;mov qword ptr[rdi+sizeof(qword)*5], r9
mov r10, qword ptr[rsi+sizeof(qword)*9]
mred_step r10,r9,r8,r14,r13,r12,r11, r15,rcx
;mov qword ptr[rdi+sizeof(qword)*0], r12
;mov qword ptr[rdi+sizeof(qword)*1], r13
;mov qword ptr[rdi+sizeof(qword)*2], r14
;mov qword ptr[rdi+sizeof(qword)*3], r8
;mov qword ptr[rdi+sizeof(qword)*4], r9
;mov qword ptr[rdi+sizeof(qword)*5], r10
mov r11, qword ptr[rsi+sizeof(qword)*10]
mred_step r11,r10,r9,r8,r14,r13,r12, r15,rcx
;mov qword ptr[rdi+sizeof(qword)*0], r13
;mov qword ptr[rdi+sizeof(qword)*1], r14
;mov qword ptr[rdi+sizeof(qword)*2], r8
;mov qword ptr[rdi+sizeof(qword)*3], r9
;mov qword ptr[rdi+sizeof(qword)*4], r10
;mov qword ptr[rdi+sizeof(qword)*5], r11
mov r12, qword ptr[rsi+sizeof(qword)*11]
mred_step r12,r11,r10,r9,r8,r14,r13, r15,rcx ; {r12,r11,r10,r9,r8,r14} - result
mov qword ptr[rdi+sizeof(qword)*0], r14
mov qword ptr[rdi+sizeof(qword)*1], r8
mov qword ptr[rdi+sizeof(qword)*2], r9
mov qword ptr[rdi+sizeof(qword)*3], r10
mov qword ptr[rdi+sizeof(qword)*4], r11
mov qword ptr[rdi+sizeof(qword)*5], r12
sub r14, qword ptr Lpoly+sizeof(qword)*0
sbb r8, qword ptr Lpoly+sizeof(qword)*1
sbb r9, qword ptr Lpoly+sizeof(qword)*2
sbb r10, qword ptr Lpoly+sizeof(qword)*3
sbb r11, qword ptr Lpoly+sizeof(qword)*4
sbb r12, qword ptr Lpoly+sizeof(qword)*5
sbb rdx, 0
mov rax, qword ptr[rdi+sizeof(qword)*0]
cmovnz r14, rax
mov rax, qword ptr[rdi+sizeof(qword)*1]
cmovnz r8, rax
mov rax, qword ptr[rdi+sizeof(qword)*2]
cmovnz r9, rax
mov rax, qword ptr[rdi+sizeof(qword)*3]
cmovnz r10, rax
mov rax, qword ptr[rdi+sizeof(qword)*4]
cmovnz r11, rax
mov rax, qword ptr[rdi+sizeof(qword)*5]
cmovnz r12, rax
mov qword ptr[rdi+sizeof(qword)*0], r14
mov qword ptr[rdi+sizeof(qword)*1], r8
mov qword ptr[rdi+sizeof(qword)*2], r9
mov qword ptr[rdi+sizeof(qword)*3], r10
mov qword ptr[rdi+sizeof(qword)*4], r11
mov qword ptr[rdi+sizeof(qword)*5], r12
REST_XMM
REST_GPR
ret
IPPASM p384r1_mred ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; projective point selector
;
; void p384r1_select_pp_w5(P384_POINT* val, const P384_POINT* tbl, int idx);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_select_pp_w5 PROC PUBLIC FRAME
USES_GPR rsi,rdi,r12,r13
LOCAL_FRAME = 0
USES_XMM xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12
COMP_ABI 3
val equ rdi
tbl equ rsi
idx equ edx
Xa equ xmm0
Xb equ xmm1
Xc equ xmm2
Ya equ xmm3
Yb equ xmm4
Yc equ xmm5
Za equ xmm6
Zb equ xmm7
Zc equ xmm8
REQ_IDX equ xmm9
CUR_IDX equ xmm10
MASKDATA equ xmm11
TMP equ xmm12
movdqa CUR_IDX, oword ptr LOne
movd REQ_IDX, idx
pshufd REQ_IDX, REQ_IDX, 0
pxor Xa, Xa
pxor Xb, Xb
pxor Xc, Xc
pxor Ya, Ya
pxor Yb, Yb
pxor Yc, Yc
pxor Za, Za
pxor Zb, Zb
pxor Zc, Zc
; Skip index = 0, is implicictly infty -> load with offset -1
mov rcx, 16
select_loop:
movdqa MASKDATA, CUR_IDX ; MASK = CUR_IDX==REQ_IDX? 0xFF : 0x00
pcmpeqd MASKDATA, REQ_IDX ;
paddd CUR_IDX, oword ptr LOne
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*0]
por Xa, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*1]
por Xb, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*2]
por Xc, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*3]
por Ya, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*4]
por Yb, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*5]
por Yc, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*6]
por Za, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*7]
por Zb, TMP
movdqa TMP, MASKDATA
pand TMP, oword ptr[tbl+sizeof(oword)*8]
por Zc, TMP
add tbl, sizeof(oword)*9
dec rcx
jnz select_loop
movdqu oword ptr[val+sizeof(oword)*0], Xa
movdqu oword ptr[val+sizeof(oword)*1], Xb
movdqu oword ptr[val+sizeof(oword)*2], Xc
movdqu oword ptr[val+sizeof(oword)*3], Ya
movdqu oword ptr[val+sizeof(oword)*4], Yb
movdqu oword ptr[val+sizeof(oword)*5], Yc
movdqu oword ptr[val+sizeof(oword)*6], Za
movdqu oword ptr[val+sizeof(oword)*7], Zb
movdqu oword ptr[val+sizeof(oword)*8], Zc
REST_XMM
REST_GPR
ret
IPPASM p384r1_select_pp_w5 ENDP
IFNDEF _DISABLE_ECP_384R1_HARDCODED_BP_TBL_
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; affine point selector
;
; void p384r1_select_ap_w5(AF_POINT *val, const AF_POINT *tbl, int idx);
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ALIGN IPP_ALIGN_FACTOR
IPPASM p384r1_select_ap_w5 PROC PUBLIC FRAME
USES_GPR rsi,rdi,r12,r13
LOCAL_FRAME = 0
USES_XMM xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14
COMP_ABI 3
val equ rdi
in_t equ rsi
idx equ edx
Xa equ xmm0
Xb equ xmm1
Xc equ xmm2
Ya equ xmm3
Yb equ xmm4
Yc equ xmm5
TXa equ xmm6
TXb equ xmm7
TXc equ xmm8
TYa equ xmm9
TYb equ xmm10
TYc equ xmm11
REQ_IDX equ xmm12
CUR_IDX equ xmm13
MASKDATA equ xmm14
movdqa CUR_IDX, oword ptr LOne
movd REQ_IDX, idx
pshufd REQ_IDX, REQ_IDX, 0
pxor Xa, Xa
pxor Xb, Xb
pxor Xc, Xc
pxor Ya, Ya
pxor Yb, Yb
pxor Yc, Yc
; Skip index = 0, is implicictly infty -> load with offset -1
mov rcx, 16
select_loop:
movdqa MASKDATA, CUR_IDX ; MASK = CUR_IDX==REQ_IDX? 0xFF : 0x00
pcmpeqd MASKDATA, REQ_IDX ;
paddd CUR_IDX, oword ptr LOne
movdqa TXa, oword ptr[in_t+sizeof(oword)*0]
movdqa TXb, oword ptr[in_t+sizeof(oword)*1]
movdqa TXc, oword ptr[in_t+sizeof(oword)*2]
movdqa TYa, oword ptr[in_t+sizeof(oword)*3]
movdqa TYb, oword ptr[in_t+sizeof(oword)*4]
movdqa TYc, oword ptr[in_t+sizeof(oword)*5]
add tbl, sizeof(oword)*6
pand TXa, MASKDATA
pand TXb, MASKDATA
pand TXc, MASKDATA
pand TYa, MASKDATA
pand TYb, MASKDATA
pand TYc, MASKDATA
por Xa, TXa
por Xb, TXb
por Xc, TXc
por Ya, TYa
por Yb, TYb
por Yc, TYc
dec rcx
jnz select_loop
movdqu oword ptr[val+sizeof(oword)*0], Xa
movdqu oword ptr[val+sizeof(oword)*1], Xb
movdqu oword ptr[val+sizeof(oword)*2], Xc
movdqu oword ptr[val+sizeof(oword)*3], Ya
movdqu oword ptr[val+sizeof(oword)*4], Yb
movdqu oword ptr[val+sizeof(oword)*5], Yc
REST_XMM
REST_GPR
ret
IPPASM p384r1_select_ap_w5 ENDP
ENDIF
ENDIF ;; _IPP32E_M7
END
|
pkgs/tools/yasm/src/modules/objfmts/elf/tests/elfmanysym.asm | manggoguy/parsec-modified | 2,151 | 161830 | <reponame>manggoguy/parsec-modified
struc PPC_CPU_State
dummy:
gpr:
fpr:
cr:
fpscr:
xer:
xer_ca:
lr:
ctr:
msr:
pvr:
ibatu:
ibatl:
ibat_bl17:
dbatu:
dbatl:
dbat_bl17:
sdr1:
sr:
dar:
dsisr:
sprg:
srr0:
srr1:
decr:
ear:
pir:
tb:
hid:
pc:
npc:
current_opc:
exception_pending:
dec_exception:
ext_exception:
stop_exception:
singlestep_ignore:
align1:
align2:
align3:
pagetable_base:
pagetable_hashmask:
reserve:
have_reservation:
tlb_last:
tlb_pa:
tlb_va:
effective_code_page:
physical_code_page:
pdec:
ptb:
temp:
temp2:
x87cw:
pc_ofs:
current_code_base:
endstruc
struc JITC
clientPages
tlb_code_0_eff
tlb_data_0_eff
tlb_data_8_eff
tlb_code_0_phys
tlb_data_0_phys
tlb_data_8_phys
tlb_code_0_hits
tlb_data_0_hits
tlb_data_8_hits
tlb_code_0_misses
tlb_data_0_misses
tlb_data_8_misses
nativeReg
nativeRegState
nativeFlags
nativeFlagsState
nativeCarryState
clientReg
nativeRegsList
LRUreg
MRUreg
LRUpage
MRUpage
freeFragmentsList
freeClientPages
translationCache
endstruc
extern gCPU, gJITC, gMemory, gMemorySize,
extern jitc_error, ppc_isi_exception_asm, ppc_dsi_exception_asm
extern jitcDestroyAndFreeClientPage
extern io_mem_read_glue
extern io_mem_write_glue
extern io_mem_read64_glue
extern io_mem_write64_glue
extern io_mem_read128_glue
extern io_mem_write128_glue
extern io_mem_read128_native_glue
extern io_mem_write128_native_glue
global ppc_effective_to_physical_code, ppc_effective_to_physical_data
global ppc_write_effective_byte_asm
global ppc_write_effective_half_asm
global ppc_write_effective_word_asm
global ppc_write_effective_dword_asm
global ppc_write_effective_qword_asm
global ppc_write_effective_qword_sse_asm
global ppc_read_effective_byte_asm
global ppc_read_effective_half_z_asm
global ppc_read_effective_half_s_asm
global ppc_read_effective_word_asm
global ppc_read_effective_dword_asm
global ppc_read_effective_qword_asm
global ppc_read_effective_qword_sse_asm
global ppc_mmu_tlb_invalidate_all_asm
global ppc_mmu_tlb_invalidate_entry_asm
global ppc_opc_lswi_asm
global ppc_opc_stswi_asm
global ppc_opc_icbi_asm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
ppc_mmu_tlb_invalidate_all_asm:
mov edi, gJITC+tlb_code_0_eff
ppc_mmu_tlb_invalidate_entry_asm:
ppc_pte_protection:
%macro bat_lookup 4
%%npr:
%%ok:
%%bat_lookup_failed:
%endmacro
%macro pg_table_lookup 3
%%invalid:
%endmacro
protection_fault_0_code:
protection_fault_0_data:
protection_fault_8_data:
%macro tlb_lookup 2
%%tlb_lookup_failed:
%endmacro
ppc_effective_to_physical_code_ret:
ppc_effective_to_physical_code:
tlb_lookup 0, code
bat_lookup i, 0, 0, code
bat_lookup i, 1, 0, code
bat_lookup i, 2, 0, code
bat_lookup i, 3, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup 0, 0, code
pg_table_lookup (1<<6), 0, code
pg_table_lookup (1<<6), 0, code
pg_table_lookup (1<<6), 0, code
pg_table_lookup (1<<6), 0, code
pg_table_lookup (1<<6), 0, code
pg_table_lookup (1<<6), 0, code
pg_table_lookup (1<<6), 0, code
pg_table_lookup (1<<6), 0, code
.noexec:
ppc_effective_to_physical_data_read_ret:
ppc_effective_to_physical_data_read:
tlb_lookup 0, data
bat_lookup d, 0, 0, data
bat_lookup d, 1, 0, data
bat_lookup d, 2, 0, data
bat_lookup d, 3, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup 0, 0, data
pg_table_lookup (1<<6), 0, data
pg_table_lookup (1<<6), 0, data
pg_table_lookup (1<<6), 0, data
pg_table_lookup (1<<6), 0, data
pg_table_lookup (1<<6), 0, data
pg_table_lookup (1<<6), 0, data
pg_table_lookup (1<<6), 0, data
pg_table_lookup (1<<6), 0, data
ppc_effective_to_physical_data_write_ret:
ppc_effective_to_physical_data_write:
tlb_lookup 8, data
bat_lookup d, 0, 8, data
bat_lookup d, 1, 8, data
bat_lookup d, 2, 8, data
bat_lookup d, 3, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup 0, 8, data
pg_table_lookup (1<<6), 8, data
pg_table_lookup (1<<6), 8, data
pg_table_lookup (1<<6), 8, data
pg_table_lookup (1<<6), 8, data
pg_table_lookup (1<<6), 8, data
pg_table_lookup (1<<6), 8, data
pg_table_lookup (1<<6), 8, data
pg_table_lookup (1<<6), 8, data
ppc_write_effective_byte_asm:
.mmio:
ppc_write_effective_half_asm:
.mmio:
.overlap:
.overlapped_mmio_1_back:
.overlapped_mmio_1:
.overlapped_mmio_2:
ppc_write_effective_word_asm:
.mmio:
.overlap:
.loop1:
.overlapped_mmio_1_back:
.loop2:
.overlapped_mmio_1:
.overlapped_mmio_1_loop:
.overlapped_mmio_2:
.overlapped_mmio_2_loop:
ppc_write_effective_dword_asm:
.mmio:
.overlap:
.loop1:
.overlapped_mmio_1_back:
.loop2:
.overlapped_mmio_1:
.overlapped_mmio_1_loop:
.overlapped_mmio_2:
.overlapped_mmio_2_loop:
ppc_write_effective_qword_asm:
.mmio:
ppc_write_effective_qword_sse_asm:
.mmio:
ppc_read_effective_byte_asm:
.mmio:
ppc_read_effective_half_z_asm:
.mmio:
.overlap:
.loop1:
.mmio1:
.mmio2:
ppc_read_effective_half_s_asm:
.mmio:
.overlap:
.loop1:
.mmio1:
.mmio2:
ppc_read_effective_word_asm:
.mmio:
.overlap:
.loop1:
.overlapped_mmio_1_back:
.loop2:
.overlapped_mmio_1:
.overlapped_mmio_1_loop:
.overlapped_mmio_2:
.overlapped_mmio_2_loop:
ppc_read_effective_dword_asm:
.mmio:
.overlap:
.loop1:
.overlapped_mmio_1_back:
.loop2:
.overlapped_mmio_1:
.overlapped_mmio_1_loop:
.overlapped_mmio_2:
.overlapped_mmio_2_loop:
ppc_read_effective_qword_asm:
.mmio:
ppc_read_effective_qword_sse_asm:
.mmio:
ppc_opc_stswi_asm:
.loop:
.ok1:
.back:
.mmio:
ppc_opc_lswi_asm:
.loop:
.ok1:
.back:
.loop2:
.ret:
.mmio:
ppc_opc_icbi_asm:
.destroy:
.ok:
|
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1861.asm | ljhsiun2/medusa | 9 | 101262 | <filename>Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1861.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r9
push %rax
push %rbp
push %rcx
lea addresses_D_ht+0xc14e, %r15
nop
nop
cmp %r12, %r12
mov (%r15), %rax
sub %rax, %rax
lea addresses_WC_ht+0x1d14e, %r13
sub $46244, %rbp
vmovups (%r13), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %r15
nop
and $26986, %r15
lea addresses_normal_ht+0xf8ce, %r9
add %rcx, %rcx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm1
movups %xmm1, (%r9)
nop
nop
nop
nop
cmp $26477, %r12
lea addresses_WT_ht+0x166d2, %r13
add $44930, %rax
vmovups (%r13), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %r9
nop
nop
nop
sub $34973, %rbp
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0x336e, %rbx
nop
nop
nop
sub %r9, %r9
mov $0x5152535455565758, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%rbx)
nop
nop
nop
inc %rsi
// Load
lea addresses_PSE+0xf94e, %r11
nop
nop
nop
nop
sub %r10, %r10
mov (%r11), %ebx
nop
nop
nop
cmp %rdi, %rdi
// REPMOV
lea addresses_D+0x1889e, %rsi
lea addresses_normal+0x964e, %rdi
nop
nop
nop
nop
cmp $48088, %r10
mov $68, %rcx
rep movsw
nop
nop
nop
nop
nop
and $5907, %rbx
// Store
mov $0x477fbc0000000d5e, %rdi
nop
nop
nop
nop
nop
sub %rsi, %rsi
mov $0x5152535455565758, %rbx
movq %rbx, (%rdi)
nop
nop
nop
nop
xor $138, %rcx
// Faulty Load
lea addresses_PSE+0xf94e, %r11
nop
dec %rsi
mov (%r11), %rdi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
src/loader_init.asm | onslaught-demogroup/ons_paddo_music_disk | 0 | 244789 | .namespace __loader_init{
/*
ZP used by this code
*/
.const ZPL=$9e
.const ZPH=$9f
/*
Load drivecode into the drive
Entry point
*/
init:
jsr i_open_chn
lda #<drivecode
ldx #>drivecode
sta ZPL
stx ZPH
i_cc11:
jsr i_cc72
ldy #$00
i_cc16:
lda (ZPL),y
jsr i_write_byte
iny
cpy #$10
bne i_cc16
lda #$0d
jsr i_write_byte
jsr i_close_chn
jsr i_open_chn
lda ZPL
clc
adc #$10
sta ZPL
bcc i_cc36
inc ZPH
i_cc36:
cmp #<(end_drivecode - 1)
lda ZPH
sbc #>(end_drivecode - 1)
bcc i_cc11
jsr i_cc9a
jsr i_close_chn
lda #$c7
sta $dd00 //bank 0, 232 out, data in, clock in
ldx #$00
i_cc4b:
dey
bne i_cc4b
dex
bne i_cc4b
rts
i_open_chn:
ldx #$08
lda #$0f
tay
jsr $ffba //SETLFS. Set file parameters. 15,8,15
lda #$00
jsr $ffbd //SETNAM. Set file name parameters.
jsr $ffc0 //OPEN. Open file. (Must call SETLFS and SETNAM beforehands.)
ldx #$0f
jsr $ffc9 //CHKOUT. Define file as default output. (Must call OPEN beforehands.) 15
rts
i_write_byte:
sty i_tmp
jsr $ffd2 //CHROUT. Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
ldy i_tmp
rts
i_cc72:
lda #$4d //M
jsr i_write_byte
lda #$2d //-
jsr i_write_byte
lda #$57 //W
jsr i_write_byte
lda ZPL
sec
sbc # <drivecode //$b7
php
clc
jsr i_write_byte
plp
lda ZPH
sbc # (>drivecode) - 5 //$c7
clc
jsr i_write_byte
lda #$10 //number of bytes to send
jsr i_write_byte
rts
i_cc9a:
ldy #$00
i_cc9c:
lda i_cca8,y
jsr i_write_byte
iny
cpy #$06
bne i_cc9c
rts
i_cca8:
.byte $4d, $2d, $45, $00, $05, $0d //M-E 00 05 <return>
/*
cca8 4d 2d 45 eor $452d
ccab 00 brk
ccac 05 0d ora $0d
*/
i_close_chn:
jsr $ffcc //CLRCHN. Close default input/output files (for serial bus, send UNTALK and/or UNLISTEN); restore default input/output to keyboard/screen.
lda #$0f
jsr $ffc3 //CLOSE. Close file.
rts
i_tmp:
.byte $00
drivecode:
.pseudopc $0500 {
jsr dc_067f
dc_0503:
jsr dc_05c3
lda $0e
sta dc_06a5
lda $0f
sta dc_06a6
ldy #$01
dc_0512:
ldx #$12
stx $0e
sty $0f
jsr dc_05fb
ldy #$02
dc_051d:
lda $0700,y
and #$83
cmp #$82
bne dc_0539
lda $0703,y
cmp dc_06a5
bne dc_0539
lda $0704,y
cmp dc_06a6
bne dc_0539
jmp dc_0561
dc_0539:
tya
clc
adc #$20
tay
bcc dc_051d
ldy $0701
bpl dc_0512
dc_0545:
lda #$00
sta $1800
ldx #$fe
jsr dc_062f
ldx #$fe
jsr dc_062f
ldx #$ac
jsr dc_062f
ldx #$f7
jsr dc_062f
jmp dc_0503
dc_0561:
lda $0701,y
sta $0e
lda $0702,y
sta $0f
dc_056b:
jsr dc_05fb
ldy #$00
lda $0700
sta $0e
bne dc_057b
ldy $0701
iny
dc_057b:
sty dc_06a5
lda $0701
sta $0f
ldy #$02
lda #$00
sta $1800
dc_058a:
ldx $0700,y
cpx #$ac
bne dc_0596
jsr dc_062f
ldx #$ac
dc_0596:
jsr dc_062f
iny
cpy dc_06a5
bne dc_058a
lda $0700
beq dc_05b6
ldx #$ac
jsr dc_062f
ldx #$c3
jsr dc_062f
lda #$08
sta $1800
jmp dc_056b
dc_05b6:
ldx #$ac
jsr dc_062f
ldx #$ff
jsr dc_062f
jmp dc_0503
dc_05c3:
lda #$08
sta $1800
lda $1c00
and #$f7
sta $1c00
cli
lda #$01
dc_05d3:
bit $1800
beq dc_05d3
sei
lda #$00
sta $1800
jsr dc_065d
pha
jsr dc_065d
sta $0e
jsr dc_065d
sta $0f
lda #$08
sta $1800
lda $1c00
ora #$08
sta $1c00
pla
rts
dc_05fb:
ldy #$05
sty $8b
dc_05ff:
cli
lda #$80
sta $04
dc_0604:
lda $04
bmi dc_0604
cmp #$01
beq dc_062d
dec $8b
ldy $8b
bmi dc_0628
cpy #$02
bne dc_061a
lda #$c0
sta $04
dc_061a:
lda $16
sta $12
lda $17
sta $13
dc_0622:
lda $04
bmi dc_0622
bpl dc_05ff
dc_0628:
pla
pla
jmp dc_0545
dc_062d:
sei
rts
dc_062f:
stx $14
lda #$04
jsr dc_063c
jsr dc_063c
jsr dc_063c
dc_063c:
lsr $14
ldx #$02
bcc dc_0644
ldx #$00
dc_0644:
bit $1800
bne dc_0644
stx $1800
lsr $14
ldx #$02
bcc dc_0654
ldx #$00
dc_0654:
bit $1800
beq dc_0654
stx $1800
rts
dc_065d:
ldy #$04
dc_065f:
lda #$04
dc_0661:
bit $1800
beq dc_0661
lda $1800
lsr
ror $14
lda #$04
dc_066e:
bit $1800
bne dc_066e
lda $1800
lsr
ror $14
dey
bne dc_065f
lda $14
rts
dc_067f:
sei
cld
ldy #$08
dc_0683:
lda #$10
sta $1800
dc_0688:
dex
bne dc_0688
lda #$00
sta $1800
dc_0690:
dex
bne dc_0690
dey
bne dc_0683
dc_0696:
lda $1800
and #$05
bne dc_0696
lda $1800
and #$05
bne dc_0696
rts
dc_06a5: .byte $00
dc_06a6: .byte $00
dc_06a7: .byte $00
}
end_drivecode:
.byte $00
/*
ce5e 00 brk
*/
} |
README/Lambda.agda | nad/partiality-monad | 2 | 3983 | ------------------------------------------------------------------------
-- Examples involving simple λ-calculi
------------------------------------------------------------------------
{-# OPTIONS --cubical --sized-types #-}
module README.Lambda where
------------------------------------------------------------------------
-- An untyped λ-calculus with constants
-- Some developments from "Operational Semantics Using the Partiality
-- Monad" by Danielsson, implemented using both the quotient
-- inductive-inductive partiality monad, and the delay monad.
--
-- These developments to a large extent mirror developments in
-- "Coinductive big-step operational semantics" by Leroy and Grall.
-- The syntax of, and a type system for, the untyped λ-calculus with
-- constants.
import Lambda.Syntax
-- Most of a virtual machine.
import Lambda.Virtual-machine
-- A compiler.
import Lambda.Compiler
-- A definitional interpreter.
import Lambda.Partiality-monad.Inductive.Interpreter
import Lambda.Delay-monad.Interpreter
-- A type soundness result.
import Lambda.Partiality-monad.Inductive.Type-soundness
import Lambda.Delay-monad.Type-soundness
-- A virtual machine.
import Lambda.Partiality-monad.Inductive.Virtual-machine
import Lambda.Delay-monad.Virtual-machine
-- Compiler correctness.
import Lambda.Partiality-monad.Inductive.Compiler-correctness
import Lambda.Delay-monad.Compiler-correctness
------------------------------------------------------------------------
-- An untyped λ-calculus without constants
-- A variant of the development above. The development above uses a
-- well-scoped variant of the untyped λ-calculus with constants. This
-- development does not use constants. This means that the interpreter
-- cannot crash, so the type soundness result has been omitted.
import Lambda.Simplified.Syntax
import Lambda.Simplified.Virtual-machine
import Lambda.Simplified.Compiler
import Lambda.Simplified.Partiality-monad.Inductive.Interpreter
import Lambda.Simplified.Delay-monad.Interpreter
import Lambda.Simplified.Partiality-monad.Inductive.Virtual-machine
import Lambda.Simplified.Delay-monad.Virtual-machine
import Lambda.Simplified.Partiality-monad.Inductive.Compiler-correctness
import Lambda.Simplified.Delay-monad.Compiler-correctness
|
EEL7030/Keil/C51/Examples/M8051EW/L51IBANK/L51IBank.a51 | GSimas/MicroC | 0 | 23198 | $NOMOD51 NOLINES
$NOCOND
;------------------------------------------------------------------------------
; This file is part of the LX51 Banked Linker/Locater package
; Copyright (c) 1988 - 2006 Keil - An ARM Company
; Version 1.10 (Code and Variable Banking for Mentor M8051EW based devices)
;------------------------------------------------------------------------------
;
; This file implements code and variable banking for Mentor M8051EW based
; devices, which offer three memory extension registers MEX1, MEX2 and MEX3.
; *** Important Notes ***
;
; 1. Full support for Mentor M8051EW based devices requires the LX51 linker/
; locater. This file does not work with the BL51 linker/locater.
;
; 2. The C51 Compiler must be invoked with the directive VARBANKING(1)
; in order to use this file. It is unimportant if you are using
; variable banking (far memory type) in your application.
;
; 3. This file contains also the CPU startup code
;
; 4. You need to use the C51 run-time library files C51M*.LIB.
;
;************************ Configuration Section *******************************
?B_NBANKS EQU 4 ; Define maximum Number of Banks *
; ; following values are allowed: 2 .. 16 *
; *
?B_CB EQU 3 ; Define Memory Bank used for constants *
; ; following values are allowed: 0 .. 7 *
; ; The value 0xFF uses the current program code bank *
; ; as constant bank *
; *
?B_VAR_BANKING EQU 1 ; XDATA Variable Banking (far memory type support) *
; ; 0 XDATA Variable Banking no required *
; ; 1 XDATA Variable Banking uses this L51IBANK.A51 *
; ; module *
; Notes: ?B_VAR_BANKING uses the C51 'far' memory type to extent the space *
; for variables in RAM space of the M8051EW device. *
; *
;******************************************************************************
;------------------------- CPU STARTUP CONFIGURATION --------------------------
;
; User-defined Power-On Initialization of Memory
;
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; ; the absolute start-address of IDATA memory is always 0
IDATALEN EQU 80H ; the length of IDATA memory in bytes.
;
XDATASTART EQU 0H ; the absolute start-address of XDATA memory
XDATALEN EQU 0H ; the length of XDATA memory in bytes.
;
PDATASTART EQU 0H ; the absolute start-address of PDATA memory
PDATALEN EQU 0H ; the length of PDATA memory in bytes.
;
; Notes: The IDATA space overlaps physically the DATA and BIT areas of the
; 8051 CPU. At minimum the memory space occupied from the C51
; run-time routines must be set to zero.
;------------------------------------------------------------------------------
;
; Reentrant Stack Initilization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; Stack Space for reentrant functions in the SMALL model.
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
IBPSTACKTOP EQU 0FFH+1 ; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the LARGE model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
XBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
PBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
;
;------------------------------------------------------------------------------
;
; Page Definition for Using the Compact Model with 64 KByte xdata RAM
;
; The following EQU statements define the xdata page used for pdata
; variables. The EQU PPAGE must conform with the PPAGE control used
; in the linker invocation.
;
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
;
PPAGE EQU 0 ; define PPAGE number.
;
PPAGE_SFR DATA 0A0H ; SFR that supplies uppermost address byte
; (most 8051 variants use P2 as uppermost address byte)
;
;------------------------------------------------------------------------------
;
; Address of EO (Extended Operation) Register
;
; The M8051EW includes an Extended Operation register, which is used
; - to select the function executed by the A5h opcode
; - to select the active DPTR register when the device offers multiple DPTR
;
; The setting ?C?DPSEL configures the EO address and is used in the functions
; memcpy, memcmp, memmove, strcpy, and strcmp for multiple DPTR selection.
;
?C?DPSEL DATA 093H ; SFR Address of E0 register (default 0A2H)
;
;------------------------------------------------------------------------------
NAME ?BANK?SWITCHING
;******************************************************************************
; *
; THEORY OF OPERATION *
; ------------------- *
; The section below describes the code generated by LX51. LX51 generates for *
; each function that is located in a code memory bank and called from the *
; common area or a different code bank and entry into the INTRABANK CALL *
; TABLE. The INTRABANK CALL TABLE is located in the SEGMENT ?BANK?SELECT and *
; listed in the Linker MAP file. The entries in that TABLE have the following *
; format: *
; *
; ?FCT?1: MOV MEX1,#n ; Load bank number of target FCT *
; LJMP FCT ; Jump to Target Code *
; *
; Instead of directly calling the function FCT, the Linker changes the entry *
; to ?FCT?1. This entry selects the bank where the function FCT is located *
; and jumps to that function. *
;******************************************************************************
; Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
; Definitions for Mentor Memory Extension Hardware
MEX1 DATA 94H
MEX2 DATA 95H
MEX3 DATA 96H
MEXSP DATA 97H
PUBLIC ?C?DPSEL ; DPSEL Register address
?B_MODE EQU 8 ; 8 for Mentor EW8051 integrated MEX Banking
?B_RST_BANK EQU 0 ; active code bank after CPU reset
?B_IB EQU 0 ; use Bank 0 for Interrupt Functions
?B_CURRENTBANK EQU MEX1 ; MEX1.4 .. 7 hold current code bank
?B_FACTOR EQU 4 ; ?B_CURRENTBANK shift factor
?B_MASK EQU 0F0H ; valid bits in ?B_CURRENTBANK
?B_MEX1 EQU MEX1 ; address of next bank register
PUBLIC ?B_NBANKS, ?B_MODE
PUBLIC ?B_CURRENTBANK
PUBLIC ?B_FACTOR, ?B_RST_BANK
PUBLIC ?B_IB, ?B_CB, ?B_MEX1
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
RSEG ?STACK
DS 1
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
CSEG AT 0
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF
IF XDATALEN <> 0
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
MOV SP,#?STACK-1
; Configure Memory Extension Registers
MEX2VAL SET 0
IF ?B_CB <> 0xFF
MEX2VAL SET ((?B_CB AND 7) SHL 4) OR 80H
ENDIF
MEX2VAL SET MEX2VAL OR ?B_IB
MOV MEX2,#MEX2VAL
MOV MEXSP,#7FH ; set to bottom of stack
MOV MEX3,#008H ; access XDATA by default
LJMP ?C_START
IF ?B_VAR_BANKING <> 0 ;----- XDATA Variable Banking
;******************************************************************************
; *
; THEORY OF OPERATION *
; ------------------- *
; This section describes how the extended LX51 linker/locater manages the *
; extended address spaces that are addressed with the new C51 memory types *
; 'far' and 'far const'. The C51 Compiler uses 3 byte pointer generic *
; pointer to access these memory areas. 'far' variables are placed in the *
; memory class HDATA and 'far const' variables get the memory class 'HCONST'. *
; The LX51 linker/locater allows you to locate these memory classes in the *
; logical 16 MBYTE CODE or 16 MBYTE XDATA spaces. *
; *
; The memory access itself is performed via eight different subroutines that *
; can be configured in this assembler module. These routines are: *
; ?C?CLDXPTR, ?C?CSTXPTR ; load/store BYTE (char) in extended memory *
; ?C?ILDXPTR, ?C?ISTXPTR ; load/store WORD (int) in extended memory *
; ?C?PLDXPTR, ?C?PSTXPTR ; load/store 3-BYTE PTR in extended memory *
; ?C?LLDXPTR, ?C?LSTXPTR ; load/store DWORD (long) in extended memory *
; *
; Each function gets as a parameter the memory address with 3 BYTE POINTER *
; representation in the CPU registers R1/R2/R3. The register R3 holds the *
; memory type. The C51 compiler uses the following memory types: *
; *
; R3 Value | Memory Type | Memory Class | Address Range *
; -----------------------+--------------+-------------------------- *
; 00 | data/idata | DATA/IDATA | I:0x00 .. I:0xFF *
; 01 | xdata | XDATA | X:0x0000 .. X:0xFFFF *
; 02..7F | far | HDATA | X:0x010000 .. X:0x7E0000 *
; 80..FD | far const | HCONST | C:0x800000 .. C:0xFD0000 (see note) *
; FE | pdata | XDATA | one 256-byte page in XDATA memory *
; FF | code | CODE | C:0x0000 .. C:0xFFFF *
; *
; Note: the far const memory area is mapped into the banked memory areas. *
; *
; The R3 values 00, 01, FE and FF are already handled within the C51 run-time *
; library. Only the values 02..FE are passed to the XPTR access functions *
; described below. The AX51 macro assembler provides the MBYTE operator *
; that calculates the R3 value that needs to be passed to the XPTR access *
; function. AX51 Assembler example for using XPTR access functions: *
; MOV R1,#LOW (variable) ; gives LSB address byte of variable *
; MOV R1,#HIGH (variable) ; gives MSB address byte of variable *
; MOV R1,#MBYTE (variable) ; gives memory type byte of variable *
; CALL ?C?CLDXPTR ; load BYTE variable into A *
;******************************************************************************
?C?XPAGE1SFR EQU MEX3 ; use MEX3 as XDATA map register
?C?XPAGE1RST EQU 008H ; access XDATA by default
PUBLIC ?C?XPAGE1SFR, ?C?XPAGE1RST
PUBLIC ?C?CLDXPTR, ?C?CSTXPTR, ?C?ILDXPTR, ?C?ISTXPTR
PUBLIC ?C?PLDXPTR, ?C?PSTXPTR, ?C?LLDXPTR, ?C?LSTXPTR
?C?LIB_CODE SEGMENT CODE
RSEG ?C?LIB_CODE
LOAD_BANK MACRO
LOCAL lab, acc_code
MOV DPL,A ; Save acc
MOV A,R3 ; check memory type
JB ACC.7, acc_code ; code is un-banked
DEC A
ANL A,#7 ; support xdata banks 0 - 7
ORL A,#8 ; set MXM
MOV ?C?XPAGE1SFR,A
acc_code: MOV A,DPL
MOV DPL,R1
MOV DPH,R2
ENDM
; CLDXPTR: Load BYTE in A via Address given in R1/R2/R3
?C?CLDXPTR: LOAD_BANK
MOVX A,@DPTR
MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
; CSTXPTR: Store BYTE in A via Address given in R1/R2/R3
?C?CSTXPTR: LOAD_BANK
MOVX @DPTR,A
CSTCODE: MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
; ILDXPTR: Load WORD in A(LSB)/B(HSB) via Address given in R1/R2/R3
?C?ILDXPTR: LOAD_BANK
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
; ISTXPTR: Store WORD in A(HSB)/B(LSB) via Address given in R1/R2/R3
?C?ISTXPTR: LOAD_BANK
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
; PLDXPTR: Load PTR in R1/R2/R3 via Address given in R1/R2/R3
?C?PLDXPTR: LOAD_BANK
MOVX A,@DPTR
MOV R3,A
INC DPTR
MOVX A,@DPTR
MOV R2,A
INC DPTR
MOVX A,@DPTR
MOV R1,A
MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
; PSTXPTR: Store PTR in R0/A/B via Address given in R1/R2/R3
?C?PSTXPTR: LOAD_BANK
XCH A,B
MOVX @DPTR,A
INC DPTR
XCH A,B
MOVX @DPTR,A
INC DPTR
MOV A,R0
MOVX @DPTR,A
MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
; LLDXPTR: Load DWORD in R4/R5/R6/R7 via Address given in R1/R2/R3
?C?LLDXPTR: LOAD_BANK
MOVX A,@DPTR
MOV R4,A
INC DPTR
MOVX A,@DPTR
MOV R5,A
INC DPTR
MOVX A,@DPTR
MOV R6,A
INC DPTR
MOVX A,@DPTR
MOV R7,A
MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
; LSTXPTR: Store DWORD in R4/R5/R6/R7 via Address given in R1/R2/R3
?C?LSTXPTR: LOAD_BANK
MOV A,R4
MOVX @DPTR,A
INC DPTR
MOV A,R5
MOVX @DPTR,A
INC DPTR
MOV A,R6
MOVX @DPTR,A
INC DPTR
MOV A,R7
MOVX @DPTR,A
MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
RET
ENDIF ; IF ?B_VAR_BANKING <> 0 ----- XDATA Variable Banking
END
|
common/structs.asm | temisu/BR4096 | 8 | 93916 | ; Copyright (C) <NAME>
; stack layout after pushad
struc ad
.edi resd 1
.esi resd 1
.ebp resd 1
.esp resd 1
.ebx resd 1
.edx resd 1
.ecx resd 1
.eax resd 1
endstruc
|
taskTwo.scpt | hascong/ExerciseForAppleScript | 0 | 2545 | set aCoupleOfSeconds to 3
set twoMinutes to 60 * 2
set oneHour to 60 * 60
set twoHours to 60 * 60 * 2
set fourHours to 60 * 60 * 4
set eightHours to 60 * 60 * 8
set tenHours to 60 * 60 * 10
set twelveHours to 60 * 60 * 12
set twentyFourHours to 60 * 60 * 24
set delayBeforeTaskOne to fourHours
set delayBetweenTaskOneAndTwo to tenHours
set delayTimeOut to twentyFourHours
with timeout of delayTimeOut seconds
tell application "Safari"
-- Report before starting task two
tell application "Mail"
set aNewMessage to make new outgoing message with properties {subject:"Report", content:"Will begin task two.", visible:true}
tell aNewMessage
make new to recipient at end of to recipients with properties {address:"<EMAIL>"}
send
end tell
end tell
-- Begin task two
activate
delay aCoupleOfSeconds
open location "http://domain_name.com/"
-- set the URL of the front document to "http://domain_name.com/"
delay aCoupleOfSeconds
do JavaScript "javascript:login()" in document 1
delay aCoupleOfSeconds
tell application "System Events"
tell process "Safari"
-- Click Check in radio button
tell (UI element 1 of group 3 of UI element 1 of scroll area 1 of group 4 of UI element 1 of scroll area 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 2 of window 1)
if exists then
click
end if
end tell
delay aCoupleOfSeconds
-- Click Check out radio button
(*
tell (UI element 1 of group 4 of UI element 1 of scroll area 1 of group 4 of UI element 1 of scroll area 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 2 of window 1)
if exists then
click
end if
end tell
delay aCoupleOfSeconds
tell (UI element 1 of group 5 of UI element 1 of scroll area 1 of group 4 of UI element 1 of scroll area 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 2 of window 1)
if exists then
click
end if
end tell
delay aCoupleOfSeconds
*)
-- Click OK record button
tell (UI element 1 of group 6 of UI element 1 of scroll area 1 of group 4 of UI element 1 of scroll area 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 2 of window 1)
if exists then
click
end if
end tell
delay aCoupleOfSeconds
tell (UI element 1 of group 7 of UI element 1 of scroll area 1 of group 4 of UI element 1 of scroll area 3 of UI element 1 of scroll area 1 of group 1 of group 1 of group 2 of window 1)
if exists then
click
end if
end tell
delay aCoupleOfSeconds
end tell
end tell
activate
delay aCoupleOfSeconds
set frontmost to true
delay aCoupleOfSeconds
quit
delay aCoupleOfSeconds
end tell
end timeout
-- Report after done task two
tell application "Mail"
set aNewMessage to make new outgoing message with properties {subject:"Report", content:"Done task two.", visible:true}
tell aNewMessage
make new to recipient at end of to recipients with properties {address:"<EMAIL>"}
send
end tell
end tell
|
10/antlr/Jack.g4 | SummerLife/building-my-computer | 10 | 4601 | <filename>10/antlr/Jack.g4
lexer grammar Jack;
//关键字
Class: 'class';
Constructot: 'constructor';
Function: 'function';
Method: 'method';
Field: 'field';
Static: 'static';
Var: 'var';
True: 'true';
False: 'false';
Null: 'null';
This: 'this';
Let: 'let';
Do: 'do';
If: 'if';
Else: 'else';
While: 'while';
Return: 'return';
//字面量
IntLiteral: [0-9]+;
StringLiteral: '"' .*? '"'; //字符串字面量
//操作符
LeftBrace: '{';
RightBrace: '}';
LeftParen: '(';
RightParen: ')';
LeftBracket: '[';
RightBracket: ']';
Dot: '.';
Comm: ',';
SemiColon: ';';
Plus: '+';
Min: '-';
Star: '*';
DIV: '/';
BITAND: '&';
BITOR: '|';
LT: '<';
GT: '>';
ASSIGN: '=';
TILDE: '~';
// Whitespace and comments
WS: [ \t\r\n\u000C]+ -> channel(HIDDEN);
COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: '//' ~[\r\n]* -> channel(HIDDEN);
// Identifier
IDENTIFIER: Letter LetterOrDigit*;
// Fragment rules
fragment LetterOrDigit
: Letter
| [0-9]
;
fragment Letter
: [a-zA-Z$_] // these are the "java letters" below 0x7F
| ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
| [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
;
|
FASM/x32/console_function_call.asm | secana/Assembler-Examples | 8 | 101296 | format PE console
entry start
include 'win32a.inc'
section '.idata' import data readable writeable
library kernel32, 'kernel32.dll', \
msvcrt, 'MSVCRT.DLL'
import kernel32, \
ExitProcess, 'ExitProcess'
import msvcrt, \
printf, 'printf'
section '.data' data readable
szFormat db 'My function was called with %d and %d',10,0
szReturnFormat db 'My function returned %d',10,0
section '.text' code readable executable
myFunc:
; Prolog
push ebp
mov ebp, esp
sub esp, 4 ; Space for one local variables
mov eax, szFormat
mov [ebp-4], eax ; move value in local var
cinvoke printf, [ebp-4], [ebp+8], [ebp+0xC] ; Print which parameters the function got
mov eax, [ebp+8]
mov ebx, [ebp+0xC]
add eax, ebx
; Epilog
mov esp, ebp
pop ebp
ret
start:
; Call myFunc with paremeters (5,7)
push 7
push 5
call myFunc
add esp, 8
cinvoke printf, szReturnFormat, eax
exit:
push 0
call [ExitProcess] |
oeis/157/A157080.asm | neoneye/loda-programs | 11 | 85656 | ; A157080: 32805000n^2 - 16200n + 1.
; 32788801,131187601,295196401,524815201,820044001,1180882801,1607331601,2099390401,2657059201,3280338001,3969226801,4723725601,5543834401,6429553201,7380882001,8397820801,9480369601,10628528401,11842297201,13121676001,14466664801,15877263601,17353472401,18895291201,20502720001,22175758801,23914407601,25718666401,27588535201,29524014001,31525102801,33591801601,35724110401,37922029201,40185558001,42514696801,44909445601,47369804401,49895773201,52487352001,55144540801,57867339601,60655748401
seq $0,156867 ; 729000n - 180.
pow $0,2
mul $0,3
sub $0,1593535777200
div $0,48600
add $0,32788801
|
tools/scanner_transformer/scanner_transformer.adb | svn2github/matreshka | 24 | 10666 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * 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. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT --
-- HOLDER 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. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This program extracts data from the code generated by aflex, and generate
-- actual implementation of scanner for regular expression engine.
with Ada.Characters.Conversions;
with Ada.Command_Line;
with Asis.Ada_Environments;
with Asis.Compilation_Units;
with Asis.Elements;
with Asis.Implementation;
with Scanner_Analyzer;
with Scanner_Extractor;
with Scanner_Generator;
with Scanner_Utilities;
procedure Scanner_Transformer is
Transformer_Context : Asis.Context;
Scanner_Unit : Asis.Compilation_Unit;
Scanner_Body : Asis.Element;
begin
Asis.Implementation.Initialize ("-asis05");
Asis.Ada_Environments.Associate
(Transformer_Context,
"Transformer_Context",
"-C1 "
& Ada.Characters.Conversions.To_Wide_String
(Ada.Command_Line.Argument (2)));
Asis.Ada_Environments.Open (Transformer_Context);
case Scanner_Utilities.Mode is
when Scanner_Utilities.Regexp =>
Scanner_Unit :=
Asis.Compilation_Units.Compilation_Unit_Body
("Regexp_Scanner", Transformer_Context);
Scanner_Body := Asis.Elements.Unit_Declaration (Scanner_Unit);
when Scanner_Utilities.XML =>
Scanner_Unit :=
Asis.Compilation_Units.Compilation_Unit_Body
("Xml_Scanner", Transformer_Context);
Scanner_Body := Asis.Elements.Unit_Declaration (Scanner_Unit);
end case;
Scanner_Extractor.Extract (Scanner_Body);
Scanner_Analyzer.Analyze;
Scanner_Generator.Generate_Scanner_Code;
Scanner_Generator.Generate_Scanner_Tables;
Asis.Ada_Environments.Close (Transformer_Context);
Asis.Ada_Environments.Dissociate (Transformer_Context);
Asis.Implementation.Finalize;
end Scanner_Transformer;
|
test/Compiler/with-stdlib/ShowNat.agda | guilhermehas/agda | 0 | 16466 | module ShowNat where
open import IO
open import Data.Unit
open import Data.Nat.Show
open import Level using (0ℓ)
main = run {0ℓ} (putStrLn (Data.Nat.Show.show 10))
|
programs/oeis/034/A034860.asm | neoneye/loda | 22 | 83887 | <filename>programs/oeis/034/A034860.asm
; A034860: a(n) = n!*(2*n-5)/2.
; 3,36,300,2520,22680,221760,2358720,27216000,339292800,4550515200,65383718400,1002550348800,16345929600000,282457663488000,5157467707392000,99236792438784000,2007144156745728000,42575785143091200000,945182430176624640000,21918014191663349760000,529966343147142021120000,13339640637264647946240000,349002225974947184640000000,9477349336475232436224000000,266777301535249627938816000000,7774652787598703442788352000000,234306692834102101795405824000000,7294453644835254112498483200000000,234350901644070800305178542080000000
mov $1,$0
add $0,3
mov $3,2
mov $4,1158
sub $4,$1
mov $5,$1
sub $5,2
add $5,$0
mul $5,4
div $1,$5
mul $3,$0
sub $4,1
lpb $3,4
add $1,1
trn $3,2
dif $4,$1
mul $5,$1
lpe
mov $0,$5
div $0,24
mul $0,3
|
oeis/130/A130322.asm | neoneye/loda-programs | 11 | 160607 | <gh_stars>10-100
; A130322: A130321^2.
; Submitted by <NAME>(s3)
; 1,4,1,12,4,1,32,12,4,1,80,32,12,4,1,192,80,32,12,4,1,448,192,80,32,12,4,1,1024,448,192,80,32,12,4,1,2304,1024,448,192,80,32,12,4,1
seq $0,212012 ; Triangle read by rows in which row n lists the number of states of the subshells of the n-th shell of the nuclear shell model ordered by energy level in increasing order.
div $0,2
mov $1,2
pow $1,$0
mul $1,$0
mov $0,$1
div $0,2
|
oeis/185/A185087.asm | neoneye/loda-programs | 11 | 165796 | <reponame>neoneye/loda-programs
; A185087: a(n) = Sum_{k=0..floor(n/2)} binomial(n-k,k)*A000108(k+1).
; Submitted by <NAME>(w3)
; 1,1,3,5,12,24,55,119,272,612,1411,3247,7565,17667,41561,98099,232696,553784,1322813,3169065,7614583,18342921,44294991,107200829,259983346,631718606,1537737567,3749440151,9156561590,22394270034,54845701243,134497468359,330232547654,811765175526,1997647751499,4921080224179,12134785568837,29951088628675,73991572782137,182945911599011,452706680336094,1121111805777986,2778458503307849,6890773329927073,17101257571341830,42468991330992098,105532974612374085,262401280980751297,652822467195891786
mov $3,$0
mov $5,$0
lpb $5
mov $0,$3
sub $5,1
sub $0,$5
mov $1,$0
add $1,$0
add $1,2
bin $1,$0
mov $2,$5
bin $2,$0
add $0,1
div $1,$0
mul $1,$2
add $4,$1
lpe
mov $0,$4
add $0,1
|
Light/Library/Action.agda | zamfofex/lightlib | 1 | 13851 | {-# OPTIONS --omega-in-omega --no-termination-check --overlapping-instances #-}
module Light.Library.Action where
open import Light.Level using (Level ; Setω)
open import Light.Library.Data.Unit as Unit using (Unit)
open import Light.Library.Data.Natural as Natural using (ℕ)
open import Light.Variable.Sets
open import Light.Variable.Levels
open import Light.Package using (Package)
record Dependencies : Setω where
field ⦃ unit‐package ⦄ : Package record { Unit }
field ⦃ natural‐package ⦄ : Package record { Natural }
record Library (dependencies : Dependencies) : Setω where
field
main‐ℓ : Level
Action : Set aℓ → Set aℓ
pure : 𝕒 → Action 𝕒
_>>=_ : Action 𝕒 → (𝕒 → Action 𝕓) → Action 𝕓
_>>_ : Action 𝕒 → Action 𝕓 → Action 𝕓
log : 𝕒 → Action Unit
Main : Set main‐ℓ
run : Action Unit → Main
prompt : Action ℕ
alert : 𝕒 → Action Unit
open Library ⦃ ... ⦄ public
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_7_656.asm | ljhsiun2/medusa | 9 | 94955 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r8
push %rbp
push %rcx
push %rsi
lea addresses_WT_ht+0xe4d5, %rcx
nop
nop
add $27173, %r12
mov (%rcx), %r8d
cmp $50818, %r14
lea addresses_UC_ht+0x189d5, %r10
nop
nop
nop
nop
sub $42975, %rbp
movw $0x6162, (%r10)
nop
nop
nop
nop
nop
add $60137, %r14
pop %rsi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %rax
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WT+0xdc75, %rcx
nop
dec %r11
movl $0x51525354, (%rcx)
nop
nop
nop
nop
nop
xor %r11, %r11
// Store
lea addresses_UC+0x1b5d5, %r15
nop
nop
nop
add $22878, %rcx
mov $0x5152535455565758, %r12
movq %r12, (%r15)
nop
nop
nop
nop
nop
inc %r15
// REPMOV
lea addresses_normal+0x13cd5, %rsi
lea addresses_PSE+0xe7d5, %rdi
nop
nop
nop
add $30278, %r10
mov $106, %rcx
rep movsl
nop
add $60116, %r15
// Store
lea addresses_WT+0x15481, %rsi
clflush (%rsi)
nop
nop
nop
and %rcx, %rcx
movw $0x5152, (%rsi)
nop
inc %rdi
// Store
lea addresses_WT+0x185d5, %r10
nop
nop
nop
and %rcx, %rcx
mov $0x5152535455565758, %rax
movq %rax, (%r10)
nop
nop
nop
cmp %r12, %r12
// Faulty Load
lea addresses_US+0x1dd5, %r15
add $15001, %r11
mov (%r15), %edi
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_normal'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'00': 7}
00 00 00 00 00 00 00
*/
|
programs/oeis/001/A001297.asm | karttu/loda | 1 | 10643 | ; A001297: Stirling numbers of the second kind S(n+3, n).
; 0,1,15,90,350,1050,2646,5880,11880,22275,39325,66066,106470,165620,249900,367200,527136,741285,1023435,1389850,1859550,2454606,3200450,4126200,5265000,6654375,8336601,10359090,12774790,15642600,19027800,23002496,27646080,33045705,39296775,46503450,54779166,64247170,75041070,87305400,101196200,116881611,134542485,154373010,176581350,201390300,229037956,259778400,293882400,331638125,373351875,419348826,469973790,525591990,586589850,653375800,726381096,806060655,892893905,987385650,1090066950,1201496016,1322259120,1452971520,1594278400,1746855825,1911411711,2088686810,2279455710,2484527850,2704748550,2941000056,3194202600,3465315475,3755338125,4065311250,4396317926,4749484740,5125982940,5527029600,5953888800,6407872821,6890343355,7402712730,7946445150,8523057950,9134122866,9781267320,10466175720,11190590775,11956314825,12765211186,13619205510,14520287160,15470510600,16471996800,17526934656,18637582425,19806269175,21035396250,22327438750,23684947026,25110548190,26606947640,28176930600,29823363675,31549196421,33357462930,35251283430,37233865900,39308507700,41478597216,43747615520,46119138045,48596836275,51184479450,53885936286,56705176710,59646273610,62713404600,65910853800,69243013631,72714386625,76329587250,80093343750,84010500000,88086017376,92324976640,96732579840,101314152225,106075144175,111021133146,116157825630,121491059130,127026804150,132771166200,138730387816,144910850595,151319077245,157961733650,164845630950,171977727636,179365131660,187015102560,194935053600,203132553925,211615330731,220391271450,229468425950,238855008750,248559401250,258590153976,268955988840,279665801415,290728663225,302153824050,313950714246,326128947080,338698321080,351668822400,365050627200,378854104041,393089816295,407768524570,422901189150,438498972450,454573241486,471135570360,488197742760,505771754475,523869815925,542504354706,561688018150,581433675900,601754422500,622663580000,644174700576,666301569165,689058206115,712458869850,736518059550,761250517846,786671233530,812795444280,839638639400,867216562575,895545214641,924640856370,954520011270,985199468400,1016696285200,1049027790336,1082211586560,1116265553585,1151207850975,1187056921050,1223831491806,1261550579850,1300233493350,1339899835000,1380569505000,1422262704051,1464999936365,1508802012690,1553690053350,1599685491300,1646810075196,1695085872480,1744535272480,1795180989525,1847046066075,1900153875866,1954528127070,2010192865470,2067172477650,2125491694200,2185175592936,2246249602135,2308739503785,2372671436850,2438071900550,2504967757656,2573386237800,2643354940800,2714901840000,2788055285625,2862844008151,2939297121690,3017444127390,3097314916850,3178939775550,3262349386296,3347574832680,3434647602555,3523599591525,3614463106450,3707270868966,3802056019020,3898852118420,3997693154400,4098613543200,4201648133661,4306832210835,4414201499610,4523792168350,4635640832550,4749784558506,4866260867000,4985107737000,5106363609375
mov $1,$0
pow $1,2
mov $2,2
add $2,$0
mov $3,$0
add $3,$2
add $2,$1
add $1,$0
pow $1,2
add $2,$3
add $3,$2
mul $1,$3
div $1,48
|
source/nodes/program-nodes-case_expression_path_vectors.ads | reznikmm/gela | 0 | 7207 | <filename>source/nodes/program-nodes-case_expression_path_vectors.ads
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Nodes.Generic_Vectors;
with Program.Elements.Case_Expression_Paths;
package Program.Nodes.Case_Expression_Path_Vectors is new
Program.Nodes.Generic_Vectors
(Program.Elements.Case_Expression_Paths
.Case_Expression_Path_Vector);
pragma Preelaborate (Program.Nodes.Case_Expression_Path_Vectors);
|
programs/oeis/252/A252488.asm | karttu/loda | 1 | 97661 | <reponame>karttu/loda
; A252488: Binary sequence starting with 1 and with run lengths given by the ruler sequence A001511.
; 1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1
add $0,1
cal $0,46699 ; a(1) = a(2) = 1, a(n) = a(n - a(n-1)) + a(n-1 - a(n-2)) if n > 2.
mov $1,$0
mod $1,2
|
alloy4fun_models/trashltl/models/11/RDJiWwSK8Ev9vZqKx.als | Kaixi26/org.alloytools.alloy | 0 | 1912 | open main
pred idRDJiWwSK8Ev9vZqKx_prop12 {
some f : File | f in Trash since f in Trash
}
pred __repair { idRDJiWwSK8Ev9vZqKx_prop12 }
check __repair { idRDJiWwSK8Ev9vZqKx_prop12 <=> prop12o } |
libsrc/fcntl/dummy/write.asm | andydansby/z88dk-mk2 | 1 | 87429 | <reponame>andydansby/z88dk-mk2
; Dummy function to keep rest of libs happy
;
; $Id: write.asm,v 1.1 2001/05/01 13:55:21 dom Exp $
;
XLIB write
.write
ret
|
source/RunCommand.popclipext/iterm2-3.applescript | cnstntn-kndrtv/PopClip-Extensions | 1,262 | 1886 | <reponame>cnstntn-kndrtv/PopClip-Extensions
-- new version of script for iTerm2 v2.9+
tell application id "com.googlecode.iterm2"
activate
set _session to current session of current window
tell _session
set command to get the clipboard
write text "{popclip text}"
end tell
end tell |
test/Fail/Issue5781c.agda | sseefried/agda | 1 | 302 | {-# OPTIONS --profile=modules --profile=internal #-}
|
agda/SBList.agda | bgbianchi/sorting | 6 | 2849 | {-# OPTIONS --sized-types #-}
module SBList {A : Set}(_≤_ : A → A → Set) where
open import Bound.Total A
open import Bound.Total.Order _≤_
open import Data.List
open import Data.Product
open import Size
data SBList : {ι : Size} → Bound → Bound → Set where
nil : {ι : Size}{b t : Bound}
→ LeB b t
→ SBList {↑ ι} b t
cons : {ι : Size}{b t : Bound}
(x : A)
→ LeB b (val x)
→ LeB (val x) t
→ SBList {ι} b t
→ SBList {↑ ι} b t
bound : List A → SBList bot top
bound [] = nil lebx
bound (x ∷ xs) = cons x lebx lext (bound xs)
unbound : {b t : Bound} → SBList b t → List A
unbound (nil _) = []
unbound (cons x _ _ xs) = x ∷ unbound xs
unbound× : {ι : Size}{b t b' t' : Bound} → SBList {ι} b t × SBList {ι} b' t' → List A × List A
unbound× (xs , ys) = (unbound xs , unbound ys)
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt21_pkg.ads | best08618/asylo | 7 | 29907 | <gh_stars>1-10
with System;
package Opt21_Pkg is
type R is record
Ptr : System.Address := System.Null_Address;
end record;
type Obj is access all R;
function Get_Object (Object : not null access R) return System.Address;
function Convert (W : Obj) return System.Address;
end Opt21_Pkg;
|
oeis/130/A130241.asm | neoneye/loda-programs | 11 | 160090 | ; A130241: Maximal index k of a Lucas number such that Lucas(k) <= n (the 'lower' Lucas (A000032) Inverse).
; Submitted by <NAME>
; 1,1,2,3,3,3,4,4,4,4,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9
mov $5,$0
mov $7,2
lpb $7
mov $0,$5
sub $7,1
add $0,$7
sub $0,1
mov $1,$0
mov $2,1
mov $3,1
mov $4,2
lpb $0
sub $0,$2
add $1,$0
add $4,$2
mov $2,$3
mov $3,$4
lpe
mov $0,$1
add $0,1
mov $8,$7
mul $8,$0
add $6,$8
lpe
min $5,1
mul $5,$0
mov $0,$6
sub $0,$5
|
EjerciciosClase/slides12x13.asm | adeandak/OPC | 0 | 17078 | TITLE *MASM Template (slides6x7.asm)*
; Descripcion:
; BGslides12x13
;
INCLUDE \masm32\Irvine\Irvine32.inc
INCLUDELIB \masm32\Irvine\Irvine32.lib
INCLUDELIB \masm32\Irvine\User32.lib
INCLUDELIB \masm32\Irvine\Kernel32.lib
.CODE
; Procedimiento principal
main PROC
; IMUL Examples
MOV EAX,4823424
MOV EBX,-423
IMUL EBX ; EDX:EAX = FFFFFFFF86635D80h, OF=0, CF=0
call DumpRegs
call CrLf
; ++++++++
; Your turn ... 3
MOV EAX, 0
MOV EBX, 0
MOV EDX, 0
MOV AX,8760h
MOV BX,100h
IMUL BX
call DumpRegs
call CrLf
exit
main ENDP
; Termina el procedimiento principal
; Termina el area de Ensamble
END main |
gnutls/nettle/x86_64/sha_ni/sha256-compress.asm | TheShellLand/crossover-source | 0 | 167557 | <gh_stars>0
C x86_64/sha_ni/sha256-compress.asm
ifelse(<
Copyright (C) 2018 <NAME>
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
>)
.file "sha256-compress.asm"
define(<STATE>, <%rdi>)
define(<INPUT>, <%rsi>)
define(<K>, <%rdx>)
define(<MSGK>,<%xmm0>) C Implicit operand of sha256rnds2
define(<MSG0>,<%xmm1>)
define(<MSG1>,<%xmm2>)
define(<MSG2>,<%xmm3>)
define(<MSG3>,<%xmm4>)
define(<ABEF>,<%xmm5>)
define(<CDGH>,<%xmm6>)
define(<ABEF_ORIG>,<%xmm7>)
define(<CDGH_ORIG>, <%xmm8>)
define(<SWAP_MASK>,<%xmm9>)
define(<TMP>, <%xmm9>) C Overlaps SWAP_MASK
C QROUND(M0, M1, M2, M3, R)
define(<QROUND>, <
movdqa eval($5*4)(K), MSGK
paddd $1, MSGK
sha256rnds2 ABEF, CDGH
pshufd <$>0xe, MSGK, MSGK
sha256rnds2 CDGH, ABEF
movdqa $1, TMP
palignr <$>4, $4, TMP
paddd TMP, $2
sha256msg2 $1, $2
sha256msg1 $1, $4
>)
C FIXME: Do something more clever, taking the pshufd into account.
C TRANSPOSE(ABCD, EFGH, scratch) --> untouched, ABEF, CDGH
define(<TRANSPOSE>, <
movdqa $2, $3
punpckhqdq $1, $2
punpcklqdq $1, $3
>)
C void
C _nettle_sha256_compress(uint32_t *state, const uint8_t *input, const uint32_t *k)
.text
ALIGN(16)
.Lswap_mask:
.byte 3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12
PROLOGUE(_nettle_sha256_compress)
W64_ENTRY(3, 10)
movups (STATE), TMP
movups 16(STATE), ABEF
pshufd $0x1b, TMP, TMP
pshufd $0x1b, ABEF, ABEF
TRANSPOSE(TMP, ABEF, CDGH)
movdqa .Lswap_mask(%rip), SWAP_MASK
movdqa ABEF, ABEF_ORIG
movdqa CDGH, CDGH_ORIG
movups (INPUT), MSG0
pshufb SWAP_MASK, MSG0
movdqa (K), MSGK
paddd MSG0, MSGK
sha256rnds2 ABEF, CDGH C Round 0-1
pshufd $0xe, MSGK, MSGK
sha256rnds2 CDGH, ABEF C Round 2-3
movups 16(INPUT), MSG1
pshufb SWAP_MASK, MSG1
movdqa 16(K), MSGK
paddd MSG1, MSGK
sha256rnds2 ABEF, CDGH C Round 4-5
pshufd $0xe, MSGK, MSGK
sha256rnds2 CDGH, ABEF C Round 6-7
sha256msg1 MSG1, MSG0
movups 32(INPUT), MSG2
pshufb SWAP_MASK, MSG2
movdqa 32(K), MSGK
paddd MSG2, MSGK
sha256rnds2 ABEF, CDGH C Round 8-9
pshufd $0xe, MSGK, MSGK
sha256rnds2 CDGH, ABEF C Round 10-11
sha256msg1 MSG2, MSG1
movups 48(INPUT), MSG3
pshufb SWAP_MASK, MSG3
QROUND(MSG3, MSG0, MSG1, MSG2, 12) C Round 12-15
QROUND(MSG0, MSG1, MSG2, MSG3, 16)
QROUND(MSG1, MSG2, MSG3, MSG0, 20)
QROUND(MSG2, MSG3, MSG0, MSG1, 24)
QROUND(MSG3, MSG0, MSG1, MSG2, 28)
QROUND(MSG0, MSG1, MSG2, MSG3, 32)
QROUND(MSG1, MSG2, MSG3, MSG0, 36)
QROUND(MSG2, MSG3, MSG0, MSG1, 40)
QROUND(MSG3, MSG0, MSG1, MSG2, 44)
QROUND(MSG0, MSG1, MSG2, MSG3, 48)
movdqa 208(K), MSGK
paddd MSG1, MSGK
sha256rnds2 ABEF, CDGH C Round 52-53
pshufd $0xe, MSGK, MSGK
sha256rnds2 CDGH, ABEF C Round 54-55
movdqa MSG1, TMP
palignr $4, MSG0, TMP
paddd TMP, MSG2
sha256msg2 MSG1, MSG2
movdqa 224(K), MSGK
paddd MSG2, MSGK
sha256rnds2 ABEF, CDGH C Round 56-57
pshufd $0xe, MSGK, MSGK
sha256rnds2 CDGH, ABEF C Round 58-59
movdqa MSG2, TMP
palignr $4, MSG1, TMP
paddd TMP, MSG3
sha256msg2 MSG2, MSG3
movdqa 240(K), MSGK
paddd MSG3, MSGK
sha256rnds2 ABEF, CDGH C Round 60-61
pshufd $0xe, MSGK, MSGK
sha256rnds2 CDGH, ABEF C Round 62-63
paddd ABEF_ORIG, ABEF
paddd CDGH_ORIG, CDGH
TRANSPOSE(ABEF, CDGH, TMP)
pshufd $0x1b, CDGH, CDGH
pshufd $0x1b, TMP, TMP
movups CDGH, 0(STATE)
movups TMP, 16(STATE)
W64_EXIT(3, 10)
ret
EPILOGUE(_nettle_sha256_compress)
|
data/maps/objects/VictoryRoad3F.asm | opiter09/ASM-Machina | 1 | 160809 | <gh_stars>1-10
VictoryRoad3F_Object:
db $7d ; border block
def_warps
warp 23, 7, 3, VICTORY_ROAD_2F
warp 26, 8, 5, VICTORY_ROAD_2F
warp 27, 15, 4, VICTORY_ROAD_2F
warp 2, 0, 6, VICTORY_ROAD_2F
def_signs
def_objects
object SPRITE_COOLTRAINER_M, 28, 5, STAY, LEFT, 1, OPP_COOLTRAINER_M, 2
object SPRITE_COOLTRAINER_F, 7, 13, STAY, RIGHT, 2, OPP_COOLTRAINER_F, 2
object SPRITE_COOLTRAINER_M, 6, 14, STAY, LEFT, 3, OPP_COOLTRAINER_M, 3
object SPRITE_COOLTRAINER_F, 13, 3, STAY, RIGHT, 4, OPP_COOLTRAINER_F, 3
object SPRITE_POKE_BALL, 26, 5, STAY, NONE, 5, MAX_REVIVE
object SPRITE_POKE_BALL, 7, 7, STAY, NONE, 6, TM_EXPLOSION
object SPRITE_BOULDER, 22, 3, STAY, BOULDER_MOVEMENT_BYTE_2, 7 ; person
object SPRITE_BOULDER, 13, 12, STAY, BOULDER_MOVEMENT_BYTE_2, 8 ; person
object SPRITE_BOULDER, 24, 10, STAY, BOULDER_MOVEMENT_BYTE_2, 9 ; person
object SPRITE_BOULDER, 22, 15, STAY, BOULDER_MOVEMENT_BYTE_2, 10 ; person
def_warps_to VICTORY_ROAD_3F
|
programs/oeis/122/A122248.asm | jmorken/loda | 1 | 24420 | ; A122248: a(n) - a(n-1) = A113474(n).
; 0,1,3,5,9,13,18,23,31,39,48,57,68,79,91,103,119,135,152,169,188,207,227,247,270,293,317,341,367,393,420,447,479,511,544,577,612,647,683,719,758,797,837,877,919,961,1004,1047,1094,1141,1189
mov $3,$0
mov $5,$0
lpb $5
mov $0,$3
sub $5,1
sub $0,$5
mov $2,$0
mov $7,1
lpb $2
mov $4,$7
add $6,8
lpb $6
div $2,2
add $4,$2
sub $6,1
lpe
lpe
add $1,$4
lpe
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.