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 |
|---|---|---|---|---|
stm32f3/stm32gd-clocks-tree.adb | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 25697 | with STM32_SVD; use STM32_SVD;
with STM32_SVD.RCC; use STM32_SVD.RCC;
with HAL;
package body STM32GD.CLOCKS.TREE is
procedure Init is
RCC : RCC_Peripheral renames RCC_Periph;
begin
if PLL_Source = HSE_Input then
RCC.CR.HSEON := 1;
while RCC.CR.HSERDY = 0 loop
null;
end loop;
end if;
RCC.CFGR := (
PLLMUL => UInt4 (PLL_Mul),
PLLSRC => (
case PLL_Source is
when HSI_Input => 1,
when HSE_Input => 1),
others => <>);
end;
end STM32GD.CLOCKS.TREE;
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca.log_289_567.asm | ljhsiun2/medusa | 9 | 21877 | .global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1129f, %rsi
lea addresses_D_ht+0x1a61b, %rdi
nop
nop
nop
nop
nop
and $5940, %rbp
mov $48, %rcx
rep movsw
nop
nop
and %rax, %rax
lea addresses_WC_ht+0xbe9f, %rax
cmp $58293, %r15
mov (%rax), %si
and %rcx, %rcx
lea addresses_WC_ht+0x691f, %r15
add %rax, %rax
mov (%r15), %ebp
nop
xor $64368, %rdi
lea addresses_WT_ht+0x5f27, %rsi
lea addresses_A_ht+0x1929f, %rdi
and $27512, %rbp
mov $89, %rcx
rep movsb
nop
nop
nop
nop
nop
xor $17913, %rax
lea addresses_UC_ht+0x1368b, %rdi
nop
nop
nop
add %r8, %r8
movb $0x61, (%rdi)
nop
nop
nop
inc %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rbp
push %rbx
push %rdi
push %rdx
// Store
lea addresses_RW+0x3c6f, %rbx
nop
nop
nop
xor $53600, %r12
movb $0x51, (%rbx)
nop
nop
and $36442, %r12
// Store
lea addresses_RW+0x160d3, %r14
sub $35089, %rdi
mov $0x5152535455565758, %rbx
movq %rbx, (%r14)
nop
nop
sub %r10, %r10
// Store
lea addresses_D+0xd69f, %r12
nop
nop
add %rbp, %rbp
movw $0x5152, (%r12)
nop
nop
nop
nop
nop
and %rdx, %rdx
// Store
lea addresses_D+0x1baff, %rdi
nop
nop
nop
nop
nop
add $19182, %rdx
mov $0x5152535455565758, %r12
movq %r12, %xmm0
movaps %xmm0, (%rdi)
nop
nop
nop
add %rbx, %rbx
// Store
lea addresses_US+0x1689f, %r12
nop
nop
nop
nop
sub $52264, %rbx
mov $0x5152535455565758, %rbp
movq %rbp, %xmm0
movups %xmm0, (%r12)
nop
nop
nop
nop
dec %rdi
// Store
lea addresses_D+0x8a5b, %rbx
nop
nop
nop
nop
nop
and $51388, %rbp
mov $0x5152535455565758, %rdi
movq %rdi, %xmm1
vmovntdq %ymm1, (%rbx)
nop
nop
nop
nop
nop
add %rbx, %rbx
// Faulty Load
mov $0x7b93ce000000069f, %rbx
nop
nop
nop
nop
nop
cmp %r10, %r10
movups (%rbx), %xmm2
vpextrq $1, %xmm2, %rdx
lea oracles, %r12
and $0xff, %rdx
shlq $12, %rdx
mov (%r12,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rbx
pop %rbp
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_RW'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_RW'}}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': True, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_US'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_D'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}}
{'00': 289}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
tools-src/gnu/gcc/gcc/ada/exp_ch7.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 12964 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ C H 7 --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT 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 a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains virtually all expansion mechanisms related to
-- - controlled types
-- - transient scopes
with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
with Exp_Ch9; use Exp_Ch9;
with Exp_Ch11; use Exp_Ch11;
with Exp_Dbug; use Exp_Dbug;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
with Hostparm; use Hostparm;
with Lib; use Lib;
with Lib.Xref; use Lib.Xref;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Output; use Output;
with Restrict; use Restrict;
with Rtsfind; use Rtsfind;
with Targparm; use Targparm;
with Sinfo; use Sinfo;
with Sem; use Sem;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch7; use Sem_Ch7;
with Sem_Ch8; use Sem_Ch8;
with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Snames; use Snames;
with Stand; use Stand;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
package body Exp_Ch7 is
--------------------------------
-- Transient Scope Management --
--------------------------------
-- A transient scope is created when temporary objects are created by the
-- compiler. These temporary objects are allocated on the secondary stack
-- and the transient scope is responsible for finalizing the object when
-- appropriate and reclaiming the memory at the right time. The temporary
-- objects are generally the objects allocated to store the result of a
-- function returning an unconstrained or a tagged value. Expressions
-- needing to be wrapped in a transient scope (functions calls returning
-- unconstrained or tagged values) may appear in 3 different contexts which
-- lead to 3 different kinds of transient scope expansion:
-- 1. In a simple statement (procedure call, assignment, ...). In
-- this case the instruction is wrapped into a transient block.
-- (See Wrap_Transient_Statement for details)
-- 2. In an expression of a control structure (test in a IF statement,
-- expression in a CASE statement, ...).
-- (See Wrap_Transient_Expression for details)
-- 3. In a expression of an object_declaration. No wrapping is possible
-- here, so the finalization actions, if any are done right after the
-- declaration and the secondary stack deallocation is done in the
-- proper enclosing scope (see Wrap_Transient_Declaration for details)
-- Note about function returning tagged types: It has been decided to
-- always allocate their result in the secondary stack while it is not
-- absolutely mandatory when the tagged type is constrained because the
-- caller knows the size of the returned object and thus could allocate the
-- result in the primary stack. But, allocating them always in the
-- secondary stack simplifies many implementation hassles:
-- - If it is dispatching function call, the computation of the size of
-- the result is possible but complex from the outside.
-- - If the returned type is controlled, the assignment of the returned
-- value to the anonymous object involves an Adjust, and we have no
-- easy way to access the anonymous object created by the back-end
-- - If the returned type is class-wide, this is an unconstrained type
-- anyway
-- Furthermore, the little loss in efficiency which is the result of this
-- decision is not such a big deal because function returning tagged types
-- are not very much used in real life as opposed to functions returning
-- access to a tagged type
--------------------------------------------------
-- Transient Blocks and Finalization Management --
--------------------------------------------------
function Find_Node_To_Be_Wrapped (N : Node_Id) return Node_Id;
-- N is a node wich may generate a transient scope. Loop over the
-- parent pointers of N until it find the appropriate node to
-- wrap. It it returns Empty, it means that no transient scope is
-- needed in this context.
function Make_Clean
(N : Node_Id;
Clean : Entity_Id;
Mark : Entity_Id;
Flist : Entity_Id;
Is_Task : Boolean;
Is_Master : Boolean;
Is_Protected_Subprogram : Boolean;
Is_Task_Allocation_Block : Boolean;
Is_Asynchronous_Call_Block : Boolean)
return Node_Id;
-- Expand a the clean-up procedure for controlled and/or transient
-- block, and/or task master or task body, or blocks used to
-- implement task allocation or asynchronous entry calls, or
-- procedures used to implement protected procedures. Clean is the
-- entity for such a procedure. Mark is the entity for the secondary
-- stack mark, if empty only controlled block clean-up will be
-- performed. Flist is the entity for the local final list, if empty
-- only transient scope clean-up will be performed. The flags
-- Is_Task and Is_Master control the calls to the corresponding
-- finalization actions for a task body or for an entity that is a
-- task master.
procedure Set_Node_To_Be_Wrapped (N : Node_Id);
-- Set the field Node_To_Be_Wrapped of the current scope
procedure Insert_Actions_In_Scope_Around (N : Node_Id);
-- Insert the before-actions kept in the scope stack before N, and the
-- after after-actions, after N which must be a member of a list.
function Make_Transient_Block
(Loc : Source_Ptr;
Action : Node_Id)
return Node_Id;
-- Create a transient block whose name is Scope, which is also a
-- controlled block if Flist is not empty and whose only code is
-- Action (either a single statement or single declaration).
type Final_Primitives is (Initialize_Case, Adjust_Case, Finalize_Case);
-- This enumeration type is defined in order to ease sharing code for
-- building finalization procedures for composite types.
Name_Of : constant array (Final_Primitives) of Name_Id :=
(Initialize_Case => Name_Initialize,
Adjust_Case => Name_Adjust,
Finalize_Case => Name_Finalize);
Deep_Name_Of : constant array (Final_Primitives) of Name_Id :=
(Initialize_Case => Name_uDeep_Initialize,
Adjust_Case => Name_uDeep_Adjust,
Finalize_Case => Name_uDeep_Finalize);
procedure Build_Record_Deep_Procs (Typ : Entity_Id);
-- Build the deep Initialize/Adjust/Finalize for a record Typ with
-- Has_Component_Component set and store them using the TSS mechanism.
procedure Build_Array_Deep_Procs (Typ : Entity_Id);
-- Build the deep Initialize/Adjust/Finalize for a record Typ with
-- Has_Controlled_Component set and store them using the TSS mechanism.
function Make_Deep_Proc
(Prim : Final_Primitives;
Typ : Entity_Id;
Stmts : List_Id)
return Node_Id;
-- This function generates the tree for Deep_Initialize, Deep_Adjust
-- or Deep_Finalize procedures according to the first parameter,
-- these procedures operate on the type Typ. The Stmts parameter
-- gives the body of the procedure.
function Make_Deep_Array_Body
(Prim : Final_Primitives;
Typ : Entity_Id)
return List_Id;
-- This function generates the list of statements for implementing
-- Deep_Initialize, Deep_Adjust or Deep_Finalize procedures
-- according to the first parameter, these procedures operate on the
-- array type Typ.
function Make_Deep_Record_Body
(Prim : Final_Primitives;
Typ : Entity_Id)
return List_Id;
-- This function generates the list of statements for implementing
-- Deep_Initialize, Deep_Adjust or Deep_Finalize procedures
-- according to the first parameter, these procedures operate on the
-- record type Typ.
function Convert_View
(Proc : Entity_Id;
Arg : Node_Id;
Ind : Pos := 1)
return Node_Id;
-- Proc is one of the Initialize/Adjust/Finalize operations, and
-- Arg is the argument being passed to it. Ind indicates which
-- formal of procedure Proc we are trying to match. This function
-- will, if necessary, generate an conversion between the partial
-- and full view of Arg to match the type of the formal of Proc,
-- or force a conversion to the class-wide type in the case where
-- the operation is abstract.
-----------------------------
-- Finalization Management --
-----------------------------
-- This part describe how Initialization/Adjusment/Finalization procedures
-- are generated and called. Two cases must be considered, types that are
-- Controlled (Is_Controlled flag set) and composite types that contain
-- controlled components (Has_Controlled_Component flag set). In the first
-- case the procedures to call are the user-defined primitive operations
-- Initialize/Adjust/Finalize. In the second case, GNAT generates
-- Deep_Initialize, Deep_Adjust and Deep_Finalize that are in charge of
-- calling the former procedures on the controlled components.
-- For records with Has_Controlled_Component set, a hidden "controller"
-- component is inserted. This controller component contains its own
-- finalization list on which all controlled components are attached
-- creating an indirection on the upper-level Finalization list. This
-- technique facilitates the management of objects whose number of
-- controlled components changes during execution. This controller
-- component is itself controlled and is attached to the upper-level
-- finalization chain. Its adjust primitive is in charge of calling
-- adjust on the components and adusting the finalization pointer to
-- match their new location (see a-finali.adb)
-- It is not possible to use a similar technique for arrays that have
-- Has_Controlled_Component set. In this case, deep procedures are
-- generated that call initialize/adjust/finalize + attachment or
-- detachment on the finalization list for all component.
-- Initialize calls: they are generated for declarations or dynamic
-- allocations of Controlled objects with no initial value. They are
-- always followed by an attachment to the current Finalization
-- Chain. For the dynamic allocation case this the chain attached to
-- the scope of the access type definition otherwise, this is the chain
-- of the current scope.
-- Adjust Calls: They are generated on 2 occasions: (1) for
-- declarations or dynamic allocations of Controlled objects with an
-- initial value. (2) after an assignment. In the first case they are
-- followed by an attachment to the final chain, in the second case
-- they are not.
-- Finalization Calls: They are generated on (1) scope exit, (2)
-- assignments, (3) unchecked deallocations. In case (3) they have to
-- be detached from the final chain, in case (2) they must not and in
-- case (1) this is not important since we are exiting the scope
-- anyway.
-- Here is a simple example of the expansion of a controlled block :
-- declare
-- X : Controlled ;
-- Y : Controlled := Init;
--
-- type R is record
-- C : Controlled;
-- end record;
-- W : R;
-- Z : R := (C => X);
-- begin
-- X := Y;
-- W := Z;
-- end;
--
-- is expanded into
--
-- declare
-- _L : System.FI.Finalizable_Ptr;
-- procedure _Clean is
-- begin
-- Abort_Defer;
-- System.FI.Finalize_List (_L);
-- Abort_Undefer;
-- end _Clean;
-- X : Controlled;
-- Initialize (X);
-- Attach_To_Final_List (_L, Finalizable (X), 1);
-- Y : Controlled := Init;
-- Adjust (Y);
-- Attach_To_Final_List (_L, Finalizable (Y), 1);
--
-- type R is record
-- _C : Record_Controller;
-- C : Controlled;
-- end record;
-- W : R;
-- Deep_Initialize (W, _L, 1);
-- Z : R := (C => X);
-- Deep_Adjust (Z, _L, 1);
-- begin
-- Finalize (X);
-- X := Y;
-- Adjust (X);
-- Deep_Finalize (W, False);
-- W := Z;
-- Deep_Adjust (W, _L, 0);
-- at end
-- _Clean;
-- end;
function Global_Flist_Ref (Flist_Ref : Node_Id) return Boolean;
-- Return True if Flist_Ref refers to a global final list, either
-- the object GLobal_Final_List which is used to attach standalone
-- objects, or any of the list controllers associated with library
-- level access to controlled objects
----------------------------
-- Build_Array_Deep_Procs --
----------------------------
procedure Build_Array_Deep_Procs (Typ : Entity_Id) is
begin
Set_TSS (Typ,
Make_Deep_Proc (
Prim => Initialize_Case,
Typ => Typ,
Stmts => Make_Deep_Array_Body (Initialize_Case, Typ)));
if not Is_Return_By_Reference_Type (Typ) then
Set_TSS (Typ,
Make_Deep_Proc (
Prim => Adjust_Case,
Typ => Typ,
Stmts => Make_Deep_Array_Body (Adjust_Case, Typ)));
end if;
Set_TSS (Typ,
Make_Deep_Proc (
Prim => Finalize_Case,
Typ => Typ,
Stmts => Make_Deep_Array_Body (Finalize_Case, Typ)));
end Build_Array_Deep_Procs;
-----------------------------
-- Build_Controlling_Procs --
-----------------------------
procedure Build_Controlling_Procs (Typ : Entity_Id) is
begin
if Is_Array_Type (Typ) then
Build_Array_Deep_Procs (Typ);
else pragma Assert (Is_Record_Type (Typ));
Build_Record_Deep_Procs (Typ);
end if;
end Build_Controlling_Procs;
----------------------
-- Build_Final_List --
----------------------
procedure Build_Final_List (N : Node_Id; Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
begin
Set_Associated_Final_Chain (Typ,
Make_Defining_Identifier (Loc,
New_External_Name (Chars (Typ), 'L')));
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier =>
Associated_Final_Chain (Typ),
Object_Definition =>
New_Reference_To
(RTE (RE_List_Controller), Loc)));
end Build_Final_List;
-----------------------------
-- Build_Record_Deep_Procs --
-----------------------------
procedure Build_Record_Deep_Procs (Typ : Entity_Id) is
begin
Set_TSS (Typ,
Make_Deep_Proc (
Prim => Initialize_Case,
Typ => Typ,
Stmts => Make_Deep_Record_Body (Initialize_Case, Typ)));
if not Is_Return_By_Reference_Type (Typ) then
Set_TSS (Typ,
Make_Deep_Proc (
Prim => Adjust_Case,
Typ => Typ,
Stmts => Make_Deep_Record_Body (Adjust_Case, Typ)));
end if;
Set_TSS (Typ,
Make_Deep_Proc (
Prim => Finalize_Case,
Typ => Typ,
Stmts => Make_Deep_Record_Body (Finalize_Case, Typ)));
end Build_Record_Deep_Procs;
---------------------
-- Controlled_Type --
---------------------
function Controlled_Type (T : Entity_Id) return Boolean is
begin
-- Class-wide types are considered controlled because they may contain
-- an extension that has controlled components
return (Is_Class_Wide_Type (T)
and then not No_Run_Time
and then not In_Finalization_Root (T))
or else Is_Controlled (T)
or else Has_Controlled_Component (T)
or else (Is_Concurrent_Type (T)
and then Present (Corresponding_Record_Type (T))
and then Controlled_Type (Corresponding_Record_Type (T)));
end Controlled_Type;
--------------------------
-- Controller_Component --
--------------------------
function Controller_Component (Typ : Entity_Id) return Entity_Id is
T : Entity_Id := Base_Type (Typ);
Comp : Entity_Id;
Comp_Scop : Entity_Id;
Res : Entity_Id := Empty;
Res_Scop : Entity_Id := Empty;
begin
if Is_Class_Wide_Type (T) then
T := Root_Type (T);
end if;
if Is_Private_Type (T) then
T := Underlying_Type (T);
end if;
-- Fetch the outermost controller
Comp := First_Entity (T);
while Present (Comp) loop
if Chars (Comp) = Name_uController then
Comp_Scop := Scope (Original_Record_Component (Comp));
-- If this controller is at the outermost level, no need to
-- look for another one
if Comp_Scop = T then
return Comp;
-- Otherwise record the outermost one and continue looking
elsif Res = Empty or else Is_Ancestor (Res_Scop, Comp_Scop) then
Res := Comp;
Res_Scop := Comp_Scop;
end if;
end if;
Next_Entity (Comp);
end loop;
-- If we fall through the loop, there is no controller component
return Res;
end Controller_Component;
------------------
-- Convert_View --
------------------
function Convert_View
(Proc : Entity_Id;
Arg : Node_Id;
Ind : Pos := 1)
return Node_Id
is
Fent : Entity_Id := First_Entity (Proc);
Ftyp : Entity_Id;
Atyp : Entity_Id;
begin
for J in 2 .. Ind loop
Next_Entity (Fent);
end loop;
Ftyp := Etype (Fent);
if Nkind (Arg) = N_Type_Conversion
or else Nkind (Arg) = N_Unchecked_Type_Conversion
then
Atyp := Entity (Subtype_Mark (Arg));
else
Atyp := Etype (Arg);
end if;
if Is_Abstract (Proc) and then Is_Tagged_Type (Ftyp) then
return Unchecked_Convert_To (Class_Wide_Type (Ftyp), Arg);
elsif Ftyp /= Atyp
and then Present (Atyp)
and then
(Is_Private_Type (Ftyp) or else Is_Private_Type (Atyp))
and then Underlying_Type (Atyp) = Underlying_Type (Ftyp)
then
return Unchecked_Convert_To (Ftyp, Arg);
-- If the argument is already a conversion, as generated by
-- Make_Init_Call, set the target type to the type of the formal
-- directly, to avoid spurious typing problems.
elsif (Nkind (Arg) = N_Unchecked_Type_Conversion
or else Nkind (Arg) = N_Type_Conversion)
and then not Is_Class_Wide_Type (Atyp)
then
Set_Subtype_Mark (Arg, New_Occurrence_Of (Ftyp, Sloc (Arg)));
Set_Etype (Arg, Ftyp);
return Arg;
else
return Arg;
end if;
end Convert_View;
-------------------------------
-- Establish_Transient_Scope --
-------------------------------
-- This procedure is called each time a transient block has to be inserted
-- that is to say for each call to a function with unconstrained ot tagged
-- result. It creates a new scope on the stack scope in order to enclose
-- all transient variables generated
procedure Establish_Transient_Scope (N : Node_Id; Sec_Stack : Boolean) is
Loc : constant Source_Ptr := Sloc (N);
Wrap_Node : Node_Id;
Sec_Stk : constant Boolean :=
Sec_Stack and not Functions_Return_By_DSP_On_Target;
-- We never need a secondary stack if functions return by DSP
begin
-- Do not create a transient scope if we are already inside one
for S in reverse Scope_Stack.First .. Scope_Stack.Last loop
if Scope_Stack.Table (S).Is_Transient then
if Sec_Stk then
Set_Uses_Sec_Stack (Scope_Stack.Table (S).Entity);
end if;
return;
-- If we have encountered Standard there are no enclosing
-- transient scopes.
elsif Scope_Stack.Table (S).Entity = Standard_Standard then
exit;
end if;
end loop;
Wrap_Node := Find_Node_To_Be_Wrapped (N);
-- Case of no wrap node, false alert, no transient scope needed
if No (Wrap_Node) then
null;
-- Transient scope is required
else
New_Scope (New_Internal_Entity (E_Block, Current_Scope, Loc, 'B'));
Set_Scope_Is_Transient;
if Sec_Stk then
Set_Uses_Sec_Stack (Current_Scope);
Check_Restriction (No_Secondary_Stack, N);
end if;
Set_Etype (Current_Scope, Standard_Void_Type);
Set_Node_To_Be_Wrapped (Wrap_Node);
if Debug_Flag_W then
Write_Str (" <Transient>");
Write_Eol;
end if;
end if;
end Establish_Transient_Scope;
----------------------------
-- Expand_Cleanup_Actions --
----------------------------
procedure Expand_Cleanup_Actions (N : Node_Id) is
Loc : Source_Ptr;
S : constant Entity_Id :=
Current_Scope;
Flist : constant Entity_Id :=
Finalization_Chain_Entity (S);
Is_Task : constant Boolean :=
(Nkind (Original_Node (N)) = N_Task_Body);
Is_Master : constant Boolean :=
Nkind (N) /= N_Entry_Body
and then Is_Task_Master (N);
Is_Protected : constant Boolean :=
Nkind (N) = N_Subprogram_Body
and then Is_Protected_Subprogram_Body (N);
Is_Task_Allocation : constant Boolean :=
Nkind (N) = N_Block_Statement
and then Is_Task_Allocation_Block (N);
Is_Asynchronous_Call : constant Boolean :=
Nkind (N) = N_Block_Statement
and then Is_Asynchronous_Call_Block (N);
Clean : Entity_Id;
Mark : Entity_Id := Empty;
New_Decls : List_Id := New_List;
Blok : Node_Id;
Wrapped : Boolean;
Chain : Entity_Id := Empty;
Decl : Node_Id;
Old_Poll : Boolean;
begin
-- Compute a location that is not directly in the user code in
-- order to avoid to generate confusing debug info. A good
-- approximation is the name of the outer user-defined scope
declare
S1 : Entity_Id := S;
begin
while not Comes_From_Source (S1) and then S1 /= Standard_Standard loop
S1 := Scope (S1);
end loop;
Loc := Sloc (S1);
end;
-- There are cleanup actions only if the secondary stack needs
-- releasing or some finalizations are needed or in the context
-- of tasking
if Uses_Sec_Stack (Current_Scope)
and then not Sec_Stack_Needed_For_Return (Current_Scope)
then
null;
elsif No (Flist)
and then not Is_Master
and then not Is_Task
and then not Is_Protected
and then not Is_Task_Allocation
and then not Is_Asynchronous_Call
then
return;
end if;
-- Set polling off, since we don't need to poll during cleanup
-- actions, and indeed for the cleanup routine, which is executed
-- with aborts deferred, we don't want polling.
Old_Poll := Polling_Required;
Polling_Required := False;
-- Make sure we have a declaration list, since we will add to it
if No (Declarations (N)) then
Set_Declarations (N, New_List);
end if;
-- The task activation call has already been built for task
-- allocation blocks.
if not Is_Task_Allocation then
Build_Task_Activation_Call (N);
end if;
if Is_Master then
Establish_Task_Master (N);
end if;
-- If secondary stack is in use, expand:
-- _Mxx : constant Mark_Id := SS_Mark;
-- Suppress calls to SS_Mark and SS_Release if Java_VM,
-- since we never use the secondary stack on the JVM.
if Uses_Sec_Stack (Current_Scope)
and then not Sec_Stack_Needed_For_Return (Current_Scope)
and then not Java_VM
then
Mark := Make_Defining_Identifier (Loc, New_Internal_Name ('M'));
Append_To (New_Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Mark,
Object_Definition => New_Reference_To (RTE (RE_Mark_Id), Loc),
Expression =>
Make_Function_Call (Loc,
Name => New_Reference_To (RTE (RE_SS_Mark), Loc))));
Set_Uses_Sec_Stack (Current_Scope, False);
end if;
-- If finalization list is present then expand:
-- Local_Final_List : System.FI.Finalizable_Ptr;
if Present (Flist) then
Append_To (New_Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Flist,
Object_Definition =>
New_Reference_To (RTE (RE_Finalizable_Ptr), Loc)));
end if;
-- Clean-up procedure definition
Clean := Make_Defining_Identifier (Loc, Name_uClean);
Set_Suppress_Elaboration_Warnings (Clean);
Append_To (New_Decls,
Make_Clean (N, Clean, Mark, Flist,
Is_Task,
Is_Master,
Is_Protected,
Is_Task_Allocation,
Is_Asynchronous_Call));
-- If exception handlers are present, wrap the Sequence of
-- statements in a block because it is not possible to get
-- exception handlers and an AT END call in the same scope.
if Present (Exception_Handlers (Handled_Statement_Sequence (N))) then
Blok :=
Make_Block_Statement (Loc,
Handled_Statement_Sequence => Handled_Statement_Sequence (N));
Set_Handled_Statement_Sequence (N,
Make_Handled_Sequence_Of_Statements (Loc, New_List (Blok)));
Wrapped := True;
-- Otherwise we do not wrap
else
Wrapped := False;
Blok := Empty;
end if;
-- Don't move the _chain Activation_Chain declaration in task
-- allocation blocks. Task allocation blocks use this object
-- in their cleanup handlers, and gigi complains if it is declared
-- in the sequence of statements of the scope that declares the
-- handler.
if Is_Task_Allocation then
Chain := Activation_Chain_Entity (N);
Decl := First (Declarations (N));
while Nkind (Decl) /= N_Object_Declaration
or else Defining_Identifier (Decl) /= Chain
loop
Next (Decl);
pragma Assert (Present (Decl));
end loop;
Remove (Decl);
Prepend_To (New_Decls, Decl);
end if;
-- Now we move the declarations into the Sequence of statements
-- in order to get them protected by the AT END call. It may seem
-- weird to put declarations in the sequence of statement but in
-- fact nothing forbids that at the tree level. We also set the
-- First_Real_Statement field so that we remember where the real
-- statements (i.e. original statements) begin. Note that if we
-- wrapped the statements, the first real statement is inside the
-- inner block. If the First_Real_Statement is already set (as is
-- the case for subprogram bodies that are expansions of task bodies)
-- then do not reset it, because its declarative part would migrate
-- to the statement part.
if not Wrapped then
if No (First_Real_Statement (Handled_Statement_Sequence (N))) then
Set_First_Real_Statement (Handled_Statement_Sequence (N),
First (Statements (Handled_Statement_Sequence (N))));
end if;
else
Set_First_Real_Statement (Handled_Statement_Sequence (N), Blok);
end if;
Append_List_To (Declarations (N),
Statements (Handled_Statement_Sequence (N)));
Set_Statements (Handled_Statement_Sequence (N), Declarations (N));
-- We need to reset the Sloc of the handled statement sequence to
-- properly reflect the new initial "statement" in the sequence.
Set_Sloc
(Handled_Statement_Sequence (N), Sloc (First (Declarations (N))));
-- The declarations of the _Clean procedure and finalization chain
-- replace the old declarations that have been moved inward
Set_Declarations (N, New_Decls);
Analyze_Declarations (New_Decls);
-- The At_End call is attached to the sequence of statements.
declare
HSS : Node_Id;
begin
-- If the construct is a protected subprogram, then the call to
-- the corresponding unprotected program appears in a block which
-- is the last statement in the body, and it is this block that
-- must be covered by the At_End handler.
if Is_Protected then
HSS := Handled_Statement_Sequence
(Last (Statements (Handled_Statement_Sequence (N))));
else
HSS := Handled_Statement_Sequence (N);
end if;
Set_At_End_Proc (HSS, New_Occurrence_Of (Clean, Loc));
Expand_At_End_Handler (HSS, Empty);
end;
-- Restore saved polling mode
Polling_Required := Old_Poll;
end Expand_Cleanup_Actions;
-------------------------------
-- Expand_Ctrl_Function_Call --
-------------------------------
procedure Expand_Ctrl_Function_Call (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Rtype : constant Entity_Id := Etype (N);
Utype : constant Entity_Id := Underlying_Type (Rtype);
Ref : Node_Id;
Action : Node_Id;
Attach_Level : Uint := Uint_1;
Len_Ref : Node_Id := Empty;
function Last_Array_Component
(Ref : Node_Id;
Typ : Entity_Id)
return Node_Id;
-- Creates a reference to the last component of the array object
-- designated by Ref whose type is Typ.
function Last_Array_Component
(Ref : Node_Id;
Typ : Entity_Id)
return Node_Id
is
N : Int;
Index_List : List_Id := New_List;
begin
N := 1;
while N <= Number_Dimensions (Typ) loop
Append_To (Index_List,
Make_Attribute_Reference (Loc,
Prefix => Duplicate_Subexpr (Ref),
Attribute_Name => Name_Last,
Expressions => New_List (
Make_Integer_Literal (Loc, N))));
N := N + 1;
end loop;
return
Make_Indexed_Component (Loc,
Prefix => Duplicate_Subexpr (Ref),
Expressions => Index_List);
end Last_Array_Component;
-- Start of processing for Expand_Ctrl_Function_Call
begin
-- Optimization, if the returned value (which is on the sec-stack)
-- is returned again, no need to copy/readjust/finalize, we can just
-- pass the value thru (see Expand_N_Return_Statement), and thus no
-- attachment is needed
if Nkind (Parent (N)) = N_Return_Statement then
return;
end if;
-- Resolution is now finished, make sure we don't start analysis again
-- because of the duplication
Set_Analyzed (N);
Ref := Duplicate_Subexpr (N);
-- Now we can generate the Attach Call, note that this value is
-- always in the (secondary) stack and thus is attached to a singly
-- linked final list:
--
-- Resx := F (X)'reference;
-- Attach_To_Final_List (_Lx, Resx.all, 1);
-- or when there are controlled components
-- Attach_To_Final_List (_Lx, Resx._controller, 1);
-- or if it is an array with is_controlled components
-- Attach_To_Final_List (_Lx, Resx (Resx'last), 3);
-- An attach level of 3 means that a whole array is to be
-- attached to the finalization list
-- or if it is an array with has_controlled components
-- Attach_To_Final_List (_Lx, Resx (Resx'last)._controller, 3);
if Has_Controlled_Component (Rtype) then
declare
T1 : Entity_Id := Rtype;
T2 : Entity_Id := Utype;
begin
if Is_Array_Type (T2) then
Len_Ref :=
Make_Attribute_Reference (Loc,
Prefix => Duplicate_Subexpr (Unchecked_Convert_To (T2, Ref)),
Attribute_Name => Name_Length);
end if;
while Is_Array_Type (T2) loop
if T1 /= T2 then
Ref := Unchecked_Convert_To (T2, Ref);
end if;
Ref := Last_Array_Component (Ref, T2);
Attach_Level := Uint_3;
T1 := Component_Type (T2);
T2 := Underlying_Type (T1);
end loop;
if Has_Controlled_Component (T2) then
if T1 /= T2 then
Ref := Unchecked_Convert_To (T2, Ref);
end if;
Ref :=
Make_Selected_Component (Loc,
Prefix => Ref,
Selector_Name => Make_Identifier (Loc, Name_uController));
end if;
end;
-- Here we know that 'Ref' has a controller so we may as well
-- attach it directly
Action :=
Make_Attach_Call (
Obj_Ref => Ref,
Flist_Ref => Find_Final_List (Current_Scope),
With_Attach => Make_Integer_Literal (Loc, Attach_Level));
else
-- Here, we have a controlled type that does not seem to have
-- controlled components but it could be a class wide type whose
-- further derivations have controlled components. So we don't know
-- if the object itself needs to be attached or if it
-- has a record controller. We need to call a runtime function
-- (Deep_Tag_Attach) which knows what to do thanks to the
-- RC_Offset in the dispatch table.
Action :=
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_Deep_Tag_Attach), Loc),
Parameter_Associations => New_List (
Find_Final_List (Current_Scope),
Make_Attribute_Reference (Loc,
Prefix => Ref,
Attribute_Name => Name_Address),
Make_Integer_Literal (Loc, Attach_Level)));
end if;
if Present (Len_Ref) then
Action :=
Make_Implicit_If_Statement (N,
Condition => Make_Op_Gt (Loc,
Left_Opnd => Len_Ref,
Right_Opnd => Make_Integer_Literal (Loc, 0)),
Then_Statements => New_List (Action));
end if;
Insert_Action (N, Action);
end Expand_Ctrl_Function_Call;
---------------------------
-- Expand_N_Package_Body --
---------------------------
-- Add call to Activate_Tasks if body is an activator (actual
-- processing is in chapter 9).
-- Generate subprogram descriptor for elaboration routine
-- ENcode entity names in package body
procedure Expand_N_Package_Body (N : Node_Id) is
Ent : Entity_Id := Corresponding_Spec (N);
begin
-- This is done only for non-generic packages
if Ekind (Ent) = E_Package then
New_Scope (Corresponding_Spec (N));
Build_Task_Activation_Call (N);
Pop_Scope;
end if;
Set_Elaboration_Flag (N, Corresponding_Spec (N));
-- Generate a subprogram descriptor for the elaboration routine of
-- a package body if the package body has no pending instantiations
-- and it has generated at least one exception handler
if Present (Handler_Records (Body_Entity (Ent)))
and then Is_Compilation_Unit (Ent)
and then not Delay_Subprogram_Descriptors (Body_Entity (Ent))
then
Generate_Subprogram_Descriptor_For_Package
(N, Body_Entity (Ent));
end if;
Set_In_Package_Body (Ent, False);
-- Set to encode entity names in package body before gigi is called
Qualify_Entity_Names (N);
end Expand_N_Package_Body;
----------------------------------
-- Expand_N_Package_Declaration --
----------------------------------
-- Add call to Activate_Tasks if there are tasks declared and the
-- package has no body. Note that in Ada83, this may result in
-- premature activation of some tasks, given that we cannot tell
-- whether a body will eventually appear.
procedure Expand_N_Package_Declaration (N : Node_Id) is
begin
if Nkind (Parent (N)) = N_Compilation_Unit
and then not Body_Required (Parent (N))
and then not Unit_Requires_Body (Defining_Entity (N))
and then Present (Activation_Chain_Entity (N))
then
New_Scope (Defining_Entity (N));
Build_Task_Activation_Call (N);
Pop_Scope;
end if;
-- Note: it is not necessary to worry about generating a subprogram
-- descriptor, since the only way to get exception handlers into a
-- package spec is to include instantiations, and that would cause
-- generation of subprogram descriptors to be delayed in any case.
-- Set to encode entity names in package spec before gigi is called
Qualify_Entity_Names (N);
end Expand_N_Package_Declaration;
---------------------
-- Find_Final_List --
---------------------
function Find_Final_List
(E : Entity_Id;
Ref : Node_Id := Empty)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (Ref);
S : Entity_Id;
Id : Entity_Id;
R : Node_Id;
begin
-- Case of an internal component. The Final list is the record
-- controller of the enclosing record
if Present (Ref) then
R := Ref;
loop
case Nkind (R) is
when N_Unchecked_Type_Conversion | N_Type_Conversion =>
R := Expression (R);
when N_Indexed_Component | N_Explicit_Dereference =>
R := Prefix (R);
when N_Selected_Component =>
R := Prefix (R);
exit;
when N_Identifier =>
exit;
when others =>
raise Program_Error;
end case;
end loop;
return
Make_Selected_Component (Loc,
Prefix =>
Make_Selected_Component (Loc,
Prefix => R,
Selector_Name => Make_Identifier (Loc, Name_uController)),
Selector_Name => Make_Identifier (Loc, Name_F));
-- Case of a dynamically allocated object. The final list is the
-- corresponding list controller (The next entity in the scope of
-- the access type with the right type). If the type comes from a
-- With_Type clause, no controller was created, and we use the
-- global chain instead.
elsif Is_Access_Type (E) then
if not From_With_Type (E) then
return
Make_Selected_Component (Loc,
Prefix =>
New_Reference_To
(Associated_Final_Chain (Base_Type (E)), Loc),
Selector_Name => Make_Identifier (Loc, Name_F));
else
return New_Reference_To (RTE (RE_Global_Final_List), Sloc (E));
end if;
else
if Is_Dynamic_Scope (E) then
S := E;
else
S := Enclosing_Dynamic_Scope (E);
end if;
-- When the finalization chain entity is 'Error', it means that
-- there should not be any chain at that level and that the
-- enclosing one should be used
-- This is a nasty kludge, see ??? note in exp_ch11
while Finalization_Chain_Entity (S) = Error loop
S := Enclosing_Dynamic_Scope (S);
end loop;
if S = Standard_Standard then
return New_Reference_To (RTE (RE_Global_Final_List), Sloc (E));
else
if No (Finalization_Chain_Entity (S)) then
Id := Make_Defining_Identifier (Sloc (S),
New_Internal_Name ('F'));
Set_Finalization_Chain_Entity (S, Id);
-- Set momentarily some semantics attributes to allow normal
-- analysis of expansions containing references to this chain.
-- Will be fully decorated during the expansion of the scope
-- itself
Set_Ekind (Id, E_Variable);
Set_Etype (Id, RTE (RE_Finalizable_Ptr));
end if;
return New_Reference_To (Finalization_Chain_Entity (S), Sloc (E));
end if;
end if;
end Find_Final_List;
-----------------------------
-- Find_Node_To_Be_Wrapped --
-----------------------------
function Find_Node_To_Be_Wrapped (N : Node_Id) return Node_Id is
P : Node_Id;
The_Parent : Node_Id;
begin
The_Parent := N;
loop
P := The_Parent;
pragma Assert (P /= Empty);
The_Parent := Parent (P);
case Nkind (The_Parent) is
-- Simple statement can be wrapped
when N_Pragma =>
return The_Parent;
-- Usually assignments are good candidate for wrapping
-- except when they have been generated as part of a
-- controlled aggregate where the wrapping should take
-- place more globally.
when N_Assignment_Statement =>
if No_Ctrl_Actions (The_Parent) then
null;
else
return The_Parent;
end if;
-- An entry call statement is a special case if it occurs in
-- the context of a Timed_Entry_Call. In this case we wrap
-- the entire timed entry call.
when N_Entry_Call_Statement |
N_Procedure_Call_Statement =>
if Nkind (Parent (The_Parent)) = N_Entry_Call_Alternative
and then
Nkind (Parent (Parent (The_Parent))) = N_Timed_Entry_Call
then
return Parent (Parent (The_Parent));
else
return The_Parent;
end if;
-- Object declarations are also a boundary for the transient scope
-- even if they are not really wrapped
-- (see Wrap_Transient_Declaration)
when N_Object_Declaration |
N_Object_Renaming_Declaration |
N_Subtype_Declaration =>
return The_Parent;
-- The expression itself is to be wrapped if its parent is a
-- compound statement or any other statement where the expression
-- is known to be scalar
when N_Accept_Alternative |
N_Attribute_Definition_Clause |
N_Case_Statement |
N_Code_Statement |
N_Delay_Alternative |
N_Delay_Until_Statement |
N_Delay_Relative_Statement |
N_Discriminant_Association |
N_Elsif_Part |
N_Entry_Body_Formal_Part |
N_Exit_Statement |
N_If_Statement |
N_Iteration_Scheme |
N_Terminate_Alternative =>
return P;
when N_Attribute_Reference =>
if Is_Procedure_Attribute_Name
(Attribute_Name (The_Parent))
then
return The_Parent;
end if;
-- ??? No scheme yet for "for I in Expression'Range loop"
-- ??? the current scheme for Expression wrapping doesn't apply
-- ??? because a RANGE is NOT an expression. Tricky problem...
-- ??? while this problem is not solved we have a potential for
-- ??? leak and unfinalized intermediate objects here.
when N_Loop_Parameter_Specification =>
return Empty;
-- The following nodes contains "dummy calls" which don't
-- need to be wrapped.
when N_Parameter_Specification |
N_Discriminant_Specification |
N_Component_Declaration =>
return Empty;
-- The return statement is not to be wrapped when the function
-- itself needs wrapping at the outer-level
when N_Return_Statement =>
if Requires_Transient_Scope (Return_Type (The_Parent)) then
return Empty;
else
return The_Parent;
end if;
-- If we leave a scope without having been able to find a node to
-- wrap, something is going wrong but this can happen in error
-- situation that are not detected yet (such as a dynamic string
-- in a pragma export)
when N_Subprogram_Body |
N_Package_Declaration |
N_Package_Body |
N_Block_Statement =>
return Empty;
-- otherwise continue the search
when others =>
null;
end case;
end loop;
end Find_Node_To_Be_Wrapped;
----------------------
-- Global_Flist_Ref --
----------------------
function Global_Flist_Ref (Flist_Ref : Node_Id) return Boolean is
Flist : Entity_Id;
begin
-- Look for the Global_Final_List
if Is_Entity_Name (Flist_Ref) then
Flist := Entity (Flist_Ref);
-- Look for the final list associated with an access to controlled
elsif Nkind (Flist_Ref) = N_Selected_Component
and then Is_Entity_Name (Prefix (Flist_Ref))
then
Flist := Entity (Prefix (Flist_Ref));
else
return False;
end if;
return Present (Flist)
and then Present (Scope (Flist))
and then Enclosing_Dynamic_Scope (Flist) = Standard_Standard;
end Global_Flist_Ref;
----------------------------------
-- Has_New_Controlled_Component --
----------------------------------
function Has_New_Controlled_Component (E : Entity_Id) return Boolean is
Comp : Entity_Id;
begin
if not Is_Tagged_Type (E) then
return Has_Controlled_Component (E);
elsif not Is_Derived_Type (E) then
return Has_Controlled_Component (E);
end if;
Comp := First_Component (E);
while Present (Comp) loop
if Chars (Comp) = Name_uParent then
null;
elsif Scope (Original_Record_Component (Comp)) = E
and then Controlled_Type (Etype (Comp))
then
return True;
end if;
Next_Component (Comp);
end loop;
return False;
end Has_New_Controlled_Component;
--------------------------
-- In_Finalization_Root --
--------------------------
-- It would seem simpler to test Scope (RTE (RE_Root_Controlled)) but
-- the purpose of this function is to avoid a circular call to Rtsfind
-- which would been caused by such a test.
function In_Finalization_Root (E : Entity_Id) return Boolean is
S : constant Entity_Id := Scope (E);
begin
return Chars (Scope (S)) = Name_System
and then Chars (S) = Name_Finalization_Root
and then Scope (Scope (S)) = Standard_Standard;
end In_Finalization_Root;
------------------------------------
-- Insert_Actions_In_Scope_Around --
------------------------------------
procedure Insert_Actions_In_Scope_Around (N : Node_Id) is
SE : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last);
begin
if Present (SE.Actions_To_Be_Wrapped_Before) then
Insert_List_Before (N, SE.Actions_To_Be_Wrapped_Before);
SE.Actions_To_Be_Wrapped_Before := No_List;
end if;
if Present (SE.Actions_To_Be_Wrapped_After) then
Insert_List_After (N, SE.Actions_To_Be_Wrapped_After);
SE.Actions_To_Be_Wrapped_After := No_List;
end if;
end Insert_Actions_In_Scope_Around;
-----------------------
-- Make_Adjust_Call --
-----------------------
function Make_Adjust_Call
(Ref : Node_Id;
Typ : Entity_Id;
Flist_Ref : Node_Id;
With_Attach : Node_Id)
return List_Id
is
Loc : constant Source_Ptr := Sloc (Ref);
Res : constant List_Id := New_List;
Utyp : Entity_Id;
Proc : Entity_Id;
Cref : Node_Id := Ref;
Cref2 : Node_Id;
Attach : Node_Id := With_Attach;
begin
if Is_Class_Wide_Type (Typ) then
Utyp := Underlying_Type (Base_Type (Root_Type (Typ)));
else
Utyp := Underlying_Type (Base_Type (Typ));
end if;
Set_Assignment_OK (Cref);
-- Deal with non-tagged derivation of private views
if Is_Untagged_Derivation (Typ) then
Utyp := Underlying_Type (Root_Type (Base_Type (Typ)));
Cref := Unchecked_Convert_To (Utyp, Cref);
Set_Assignment_OK (Cref);
-- To prevent problems with UC see 1.156 RH ???
end if;
-- If the underlying_type is a subtype, we are dealing with
-- the completion of a private type. We need to access
-- the base type and generate a conversion to it.
if Utyp /= Base_Type (Utyp) then
pragma Assert (Is_Private_Type (Typ));
Utyp := Base_Type (Utyp);
Cref := Unchecked_Convert_To (Utyp, Cref);
end if;
-- We do not need to attach to one of the Global Final Lists
-- the objects whose type is Finalize_Storage_Only
if Finalize_Storage_Only (Typ)
and then (Global_Flist_Ref (Flist_Ref)
or else Entity (Constant_Value (RTE (RE_Garbage_Collected)))
= Standard_True)
then
Attach := Make_Integer_Literal (Loc, 0);
end if;
-- Generate:
-- Deep_Adjust (Flist_Ref, Ref, With_Attach);
if Has_Controlled_Component (Utyp)
or else Is_Class_Wide_Type (Typ)
then
if Is_Tagged_Type (Utyp) then
Proc := Find_Prim_Op (Utyp, Deep_Name_Of (Adjust_Case));
else
Proc := TSS (Utyp, Deep_Name_Of (Adjust_Case));
end if;
Cref := Convert_View (Proc, Cref, 2);
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Proc, Loc),
Parameter_Associations =>
New_List (Flist_Ref, Cref, Attach)));
-- Generate:
-- if With_Attach then
-- Attach_To_Final_List (Ref, Flist_Ref);
-- end if;
-- Adjust (Ref);
else -- Is_Controlled (Utyp)
Proc := Find_Prim_Op (Utyp, Name_Of (Adjust_Case));
Cref := Convert_View (Proc, Cref);
Cref2 := New_Copy_Tree (Cref);
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Proc, Loc),
Parameter_Associations => New_List (Cref2)));
Append_To (Res, Make_Attach_Call (Cref, Flist_Ref, Attach));
-- Treat this as a reference to Adjust if the Adjust routine
-- comes from source. The call is not explicit, but it is near
-- enough, and we won't typically get explicit adjust calls.
if Comes_From_Source (Proc) then
Generate_Reference (Proc, Ref);
end if;
end if;
return Res;
end Make_Adjust_Call;
----------------------
-- Make_Attach_Call --
----------------------
-- Generate:
-- System.FI.Attach_To_Final_List (Flist, Ref, Nb_Link)
function Make_Attach_Call
(Obj_Ref : Node_Id;
Flist_Ref : Node_Id;
With_Attach : Node_Id)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (Obj_Ref);
begin
-- Optimization: If the number of links is statically '0', don't
-- call the attach_proc.
if Nkind (With_Attach) = N_Integer_Literal
and then Intval (With_Attach) = Uint_0
then
return Make_Null_Statement (Loc);
end if;
return
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_Attach_To_Final_List), Loc),
Parameter_Associations => New_List (
Flist_Ref,
OK_Convert_To (RTE (RE_Finalizable), Obj_Ref),
With_Attach));
end Make_Attach_Call;
----------------
-- Make_Clean --
----------------
function Make_Clean
(N : Node_Id;
Clean : Entity_Id;
Mark : Entity_Id;
Flist : Entity_Id;
Is_Task : Boolean;
Is_Master : Boolean;
Is_Protected_Subprogram : Boolean;
Is_Task_Allocation_Block : Boolean;
Is_Asynchronous_Call_Block : Boolean)
return Node_Id
is
Loc : constant Source_Ptr := Sloc (Clean);
Stmt : List_Id := New_List;
Sbody : Node_Id;
Spec : Node_Id;
Name : Node_Id;
Param : Node_Id;
Unlock : Node_Id;
Param_Type : Entity_Id;
Pid : Entity_Id := Empty;
Cancel_Param : Entity_Id;
begin
if Is_Task then
if Restricted_Profile then
Append_To
(Stmt, Build_Runtime_Call (Loc, RE_Complete_Restricted_Task));
else
Append_To (Stmt, Build_Runtime_Call (Loc, RE_Complete_Task));
end if;
elsif Is_Master then
if Restrictions (No_Task_Hierarchy) = False then
Append_To (Stmt, Build_Runtime_Call (Loc, RE_Complete_Master));
end if;
elsif Is_Protected_Subprogram then
-- Add statements to the cleanup handler of the (ordinary)
-- subprogram expanded to implement a protected subprogram,
-- unlocking the protected object parameter and undeferring abortion.
-- If this is a protected procedure, and the object contains
-- entries, this also calls the entry service routine.
-- NOTE: This cleanup handler references _object, a parameter
-- to the procedure.
-- Find the _object parameter representing the protected object.
Spec := Parent (Corresponding_Spec (N));
Param := First (Parameter_Specifications (Spec));
loop
Param_Type := Etype (Parameter_Type (Param));
if Ekind (Param_Type) = E_Record_Type then
Pid := Corresponding_Concurrent_Type (Param_Type);
end if;
exit when not Present (Param) or else Present (Pid);
Next (Param);
end loop;
pragma Assert (Present (Param));
-- If the associated protected object declares entries,
-- a protected procedure has to service entry queues.
-- In this case, add
-- Service_Entries (_object._object'Access);
-- _object is the record used to implement the protected object.
-- It is a parameter to the protected subprogram.
if Nkind (Specification (N)) = N_Procedure_Specification
and then Has_Entries (Pid)
then
if Abort_Allowed
or else Restrictions (No_Entry_Queue) = False
or else Number_Entries (Pid) > 1
then
Name := New_Reference_To (RTE (RE_Service_Entries), Loc);
else
Name := New_Reference_To (RTE (RE_Service_Entry), Loc);
end if;
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name => Name,
Parameter_Associations => New_List (
Make_Attribute_Reference (Loc,
Prefix =>
Make_Selected_Component (Loc,
Prefix => New_Reference_To (
Defining_Identifier (Param), Loc),
Selector_Name =>
Make_Identifier (Loc, Name_uObject)),
Attribute_Name => Name_Unchecked_Access))));
end if;
-- Unlock (_object._object'Access);
-- _object is the record used to implement the protected object.
-- It is a parameter to the protected subprogram.
-- If the protected object is controlled (i.e it has entries or
-- needs finalization for interrupt handling), call Unlock_Entries,
-- except if the protected object follows the ravenscar profile, in
-- which case call Unlock_Entry, otherwise call the simplified
-- version, Unlock.
if Has_Entries (Pid)
or else Has_Interrupt_Handler (Pid)
or else Has_Attach_Handler (Pid)
then
if Abort_Allowed
or else Restrictions (No_Entry_Queue) = False
or else Number_Entries (Pid) > 1
then
Unlock := New_Reference_To (RTE (RE_Unlock_Entries), Loc);
else
Unlock := New_Reference_To (RTE (RE_Unlock_Entry), Loc);
end if;
else
Unlock := New_Reference_To (RTE (RE_Unlock), Loc);
end if;
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name => Unlock,
Parameter_Associations => New_List (
Make_Attribute_Reference (Loc,
Prefix =>
Make_Selected_Component (Loc,
Prefix =>
New_Reference_To (Defining_Identifier (Param), Loc),
Selector_Name =>
Make_Identifier (Loc, Name_uObject)),
Attribute_Name => Name_Unchecked_Access))));
if Abort_Allowed then
-- Abort_Undefer;
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name =>
New_Reference_To (
RTE (RE_Abort_Undefer), Loc),
Parameter_Associations => Empty_List));
end if;
elsif Is_Task_Allocation_Block then
-- Add a call to Expunge_Unactivated_Tasks to the cleanup
-- handler of a block created for the dynamic allocation of
-- tasks:
-- Expunge_Unactivated_Tasks (_chain);
-- where _chain is the list of tasks created by the allocator
-- but not yet activated. This list will be empty unless
-- the block completes abnormally.
-- This only applies to dynamically allocated tasks;
-- other unactivated tasks are completed by Complete_Task or
-- Complete_Master.
-- NOTE: This cleanup handler references _chain, a local
-- object.
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name =>
New_Reference_To (
RTE (RE_Expunge_Unactivated_Tasks), Loc),
Parameter_Associations => New_List (
New_Reference_To (Activation_Chain_Entity (N), Loc))));
elsif Is_Asynchronous_Call_Block then
-- Add a call to attempt to cancel the asynchronous entry call
-- whenever the block containing the abortable part is exited.
-- NOTE: This cleanup handler references C, a local object
-- Get the argument to the Cancel procedure
Cancel_Param := Entry_Cancel_Parameter (Entity (Identifier (N)));
-- If it is of type Communication_Block, this must be a
-- protected entry call.
if Is_RTE (Etype (Cancel_Param), RE_Communication_Block) then
Append_To (Stmt,
-- if Enqueued (Cancel_Parameter) then
Make_Implicit_If_Statement (Clean,
Condition => Make_Function_Call (Loc,
Name => New_Reference_To (
RTE (RE_Enqueued), Loc),
Parameter_Associations => New_List (
New_Reference_To (Cancel_Param, Loc))),
Then_Statements => New_List (
-- Cancel_Protected_Entry_Call (Cancel_Param);
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (
RTE (RE_Cancel_Protected_Entry_Call), Loc),
Parameter_Associations => New_List (
New_Reference_To (Cancel_Param, Loc))))));
-- Asynchronous delay
elsif Is_RTE (Etype (Cancel_Param), RE_Delay_Block) then
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_Cancel_Async_Delay), Loc),
Parameter_Associations => New_List (
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Cancel_Param, Loc),
Attribute_Name => Name_Unchecked_Access))));
-- Task entry call
else
-- Append call to Cancel_Task_Entry_Call (C);
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (
RTE (RE_Cancel_Task_Entry_Call),
Loc),
Parameter_Associations => New_List (
New_Reference_To (Cancel_Param, Loc))));
end if;
end if;
if Present (Flist) then
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_Finalize_List), Loc),
Parameter_Associations => New_List (
New_Reference_To (Flist, Loc))));
end if;
if Present (Mark) then
Append_To (Stmt,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_SS_Release), Loc),
Parameter_Associations => New_List (
New_Reference_To (Mark, Loc))));
end if;
Sbody :=
Make_Subprogram_Body (Loc,
Specification =>
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Clean),
Declarations => New_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => Stmt));
if Present (Flist) or else Is_Task or else Is_Master then
Wrap_Cleanup_Procedure (Sbody);
end if;
-- We do not want debug information for _Clean routines,
-- since it just confuses the debugging operation unless
-- we are debugging generated code.
if not Debug_Generated_Code then
Set_Debug_Info_Off (Clean, True);
end if;
return Sbody;
end Make_Clean;
--------------------------
-- Make_Deep_Array_Body --
--------------------------
-- Array components are initialized and adjusted in the normal order
-- and finalized in the reverse order. Exceptions are handled and
-- Program_Error is re-raise in the Adjust and Finalize case
-- (RM 7.6.1(12)). Generate the following code :
--
-- procedure Deep_<P> -- with <P> being Initialize or Adjust or Finalize
-- (L : in out Finalizable_Ptr;
-- V : in out Typ)
-- is
-- begin
-- for J1 in Typ'First (1) .. Typ'Last (1) loop
-- ^ reverse ^ -- in the finalization case
-- ...
-- for J2 in Typ'First (n) .. Typ'Last (n) loop
-- Make_<P>_Call (Typ, V (J1, .. , Jn), L, V);
-- end loop;
-- ...
-- end loop;
-- exception -- not in the
-- when others => raise Program_Error; -- Initialize case
-- end Deep_<P>;
function Make_Deep_Array_Body
(Prim : Final_Primitives;
Typ : Entity_Id)
return List_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
Index_List : constant List_Id := New_List;
-- Stores the list of references to the indexes (one per dimension)
function One_Component return List_Id;
-- Create one statement to initialize/adjust/finalize one array
-- component, designated by a full set of indices.
function One_Dimension (N : Int) return List_Id;
-- Create loop to deal with one dimension of the array. The single
-- statement in the body of the loop initializes the inner dimensions if
-- any, or else a single component.
-------------------
-- One_Component --
-------------------
function One_Component return List_Id is
Comp_Typ : constant Entity_Id := Component_Type (Typ);
Comp_Ref : constant Node_Id :=
Make_Indexed_Component (Loc,
Prefix => Make_Identifier (Loc, Name_V),
Expressions => Index_List);
begin
-- Set the etype of the component Reference, which is used to
-- determine whether a conversion to a parent type is needed.
Set_Etype (Comp_Ref, Comp_Typ);
case Prim is
when Initialize_Case =>
return Make_Init_Call (Comp_Ref, Comp_Typ,
Make_Identifier (Loc, Name_L),
Make_Identifier (Loc, Name_B));
when Adjust_Case =>
return Make_Adjust_Call (Comp_Ref, Comp_Typ,
Make_Identifier (Loc, Name_L),
Make_Identifier (Loc, Name_B));
when Finalize_Case =>
return Make_Final_Call (Comp_Ref, Comp_Typ,
Make_Identifier (Loc, Name_B));
end case;
end One_Component;
-------------------
-- One_Dimension --
-------------------
function One_Dimension (N : Int) return List_Id is
Index : Entity_Id;
begin
if N > Number_Dimensions (Typ) then
return One_Component;
else
Index :=
Make_Defining_Identifier (Loc, New_External_Name ('J', N));
Append_To (Index_List, New_Reference_To (Index, Loc));
return New_List (
Make_Implicit_Loop_Statement (Typ,
Identifier => Empty,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => Index,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => Make_Identifier (Loc, Name_V),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, N))),
Reverse_Present => Prim = Finalize_Case)),
Statements => One_Dimension (N + 1)));
end if;
end One_Dimension;
-- Start of processing for Make_Deep_Array_Body
begin
return One_Dimension (1);
end Make_Deep_Array_Body;
--------------------
-- Make_Deep_Proc --
--------------------
-- Generate:
-- procedure DEEP_<prim>
-- (L : IN OUT Finalizable_Ptr; -- not for Finalize
-- V : IN OUT <typ>;
-- B : IN Short_Short_Integer) is
-- begin
-- <stmts>;
-- exception -- Finalize and Adjust Cases only
-- raise Program_Error; -- idem
-- end DEEP_<prim>;
function Make_Deep_Proc
(Prim : Final_Primitives;
Typ : Entity_Id;
Stmts : List_Id)
return Entity_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
Formals : List_Id;
Proc_Name : Entity_Id;
Handler : List_Id := No_List;
Subp_Body : Node_Id;
Type_B : Entity_Id;
begin
if Prim = Finalize_Case then
Formals := New_List;
Type_B := Standard_Boolean;
else
Formals := New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_L),
In_Present => True,
Out_Present => True,
Parameter_Type =>
New_Reference_To (RTE (RE_Finalizable_Ptr), Loc)));
Type_B := Standard_Short_Short_Integer;
end if;
Append_To (Formals,
Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_V),
In_Present => True,
Out_Present => True,
Parameter_Type => New_Reference_To (Typ, Loc)));
Append_To (Formals,
Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_B),
Parameter_Type => New_Reference_To (Type_B, Loc)));
if Prim = Finalize_Case or else Prim = Adjust_Case then
Handler := New_List (
Make_Exception_Handler (Loc,
Exception_Choices => New_List (Make_Others_Choice (Loc)),
Statements => New_List (
Make_Raise_Program_Error (Loc))));
end if;
Proc_Name := Make_Defining_Identifier (Loc, Deep_Name_Of (Prim));
Subp_Body :=
Make_Subprogram_Body (Loc,
Specification =>
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Proc_Name,
Parameter_Specifications => Formals),
Declarations => Empty_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => Stmts,
Exception_Handlers => Handler));
return Proc_Name;
end Make_Deep_Proc;
---------------------------
-- Make_Deep_Record_Body --
---------------------------
-- The Deep procedures call the appropriate Controlling proc on the
-- the controller component. In the init case, it also attach the
-- controller to the current finalization list.
function Make_Deep_Record_Body
(Prim : Final_Primitives;
Typ : Entity_Id)
return List_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
Controller_Typ : Entity_Id;
Obj_Ref : constant Node_Id := Make_Identifier (Loc, Name_V);
Controller_Ref : constant Node_Id :=
Make_Selected_Component (Loc,
Prefix => Obj_Ref,
Selector_Name =>
Make_Identifier (Loc, Name_uController));
begin
if Is_Return_By_Reference_Type (Typ) then
Controller_Typ := RTE (RE_Limited_Record_Controller);
else
Controller_Typ := RTE (RE_Record_Controller);
end if;
case Prim is
when Initialize_Case =>
declare
Res : constant List_Id := New_List;
begin
Append_List_To (Res,
Make_Init_Call (
Ref => Controller_Ref,
Typ => Controller_Typ,
Flist_Ref => Make_Identifier (Loc, Name_L),
With_Attach => Make_Identifier (Loc, Name_B)));
-- When the type is also a controlled type by itself,
-- Initialize it and attach it at the end of the internal
-- finalization chain
if Is_Controlled (Typ) then
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (
Find_Prim_Op (Typ, Name_Of (Prim)), Loc),
Parameter_Associations =>
New_List (New_Copy_Tree (Obj_Ref))));
Append_To (Res, Make_Attach_Call (
Obj_Ref => New_Copy_Tree (Obj_Ref),
Flist_Ref =>
Make_Selected_Component (Loc,
Prefix => New_Copy_Tree (Controller_Ref),
Selector_Name => Make_Identifier (Loc, Name_F)),
With_Attach => Make_Integer_Literal (Loc, 1)));
end if;
return Res;
end;
when Adjust_Case =>
return
Make_Adjust_Call (Controller_Ref, Controller_Typ,
Make_Identifier (Loc, Name_L),
Make_Identifier (Loc, Name_B));
when Finalize_Case =>
return
Make_Final_Call (Controller_Ref, Controller_Typ,
Make_Identifier (Loc, Name_B));
end case;
end Make_Deep_Record_Body;
----------------------
-- Make_Final_Call --
----------------------
function Make_Final_Call
(Ref : Node_Id;
Typ : Entity_Id;
With_Detach : Node_Id)
return List_Id
is
Loc : constant Source_Ptr := Sloc (Ref);
Res : constant List_Id := New_List;
Cref : Node_Id;
Cref2 : Node_Id;
Proc : Entity_Id;
Utyp : Entity_Id;
begin
if Is_Class_Wide_Type (Typ) then
Utyp := Root_Type (Typ);
Cref := Ref;
elsif Is_Concurrent_Type (Typ) then
Utyp := Corresponding_Record_Type (Typ);
Cref := Convert_Concurrent (Ref, Typ);
elsif Is_Private_Type (Typ)
and then Present (Full_View (Typ))
and then Is_Concurrent_Type (Full_View (Typ))
then
Utyp := Corresponding_Record_Type (Full_View (Typ));
Cref := Convert_Concurrent (Ref, Full_View (Typ));
else
Utyp := Typ;
Cref := Ref;
end if;
Utyp := Underlying_Type (Base_Type (Utyp));
Set_Assignment_OK (Cref);
-- Deal with non-tagged derivation of private views
if Is_Untagged_Derivation (Typ) then
Utyp := Underlying_Type (Root_Type (Base_Type (Typ)));
Cref := Unchecked_Convert_To (Utyp, Cref);
Set_Assignment_OK (Cref);
-- To prevent problems with UC see 1.156 RH ???
end if;
-- If the underlying_type is a subtype, we are dealing with
-- the completion of a private type. We need to access
-- the base type and generate a conversion to it.
if Utyp /= Base_Type (Utyp) then
pragma Assert (Is_Private_Type (Typ));
Utyp := Base_Type (Utyp);
Cref := Unchecked_Convert_To (Utyp, Cref);
end if;
-- Generate:
-- Deep_Finalize (Ref, With_Detach);
if Has_Controlled_Component (Utyp)
or else Is_Class_Wide_Type (Typ)
then
if Is_Tagged_Type (Utyp) then
Proc := Find_Prim_Op (Utyp, Deep_Name_Of (Finalize_Case));
else
Proc := TSS (Utyp, Deep_Name_Of (Finalize_Case));
end if;
Cref := Convert_View (Proc, Cref);
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Proc, Loc),
Parameter_Associations =>
New_List (Cref, With_Detach)));
-- Generate:
-- if With_Detach then
-- Finalize_One (Ref);
-- else
-- Finalize (Ref);
-- end if;
else
Proc := Find_Prim_Op (Utyp, Name_Of (Finalize_Case));
if Chars (With_Detach) = Chars (Standard_True) then
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_Finalize_One), Loc),
Parameter_Associations => New_List (
OK_Convert_To (RTE (RE_Finalizable), Cref))));
elsif Chars (With_Detach) = Chars (Standard_False) then
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Proc, Loc),
Parameter_Associations =>
New_List (Convert_View (Proc, Cref))));
else
Cref2 := New_Copy_Tree (Cref);
Append_To (Res,
Make_Implicit_If_Statement (Ref,
Condition => With_Detach,
Then_Statements => New_List (
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (RTE (RE_Finalize_One), Loc),
Parameter_Associations => New_List (
OK_Convert_To (RTE (RE_Finalizable), Cref)))),
Else_Statements => New_List (
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Proc, Loc),
Parameter_Associations =>
New_List (Convert_View (Proc, Cref2))))));
end if;
end if;
-- Treat this as a reference to Finalize if the Finalize routine
-- comes from source. The call is not explicit, but it is near
-- enough, and we won't typically get explicit adjust calls.
if Comes_From_Source (Proc) then
Generate_Reference (Proc, Ref);
end if;
return Res;
end Make_Final_Call;
--------------------
-- Make_Init_Call --
--------------------
function Make_Init_Call
(Ref : Node_Id;
Typ : Entity_Id;
Flist_Ref : Node_Id;
With_Attach : Node_Id)
return List_Id
is
Loc : constant Source_Ptr := Sloc (Ref);
Is_Conc : Boolean;
Res : constant List_Id := New_List;
Proc : Entity_Id;
Utyp : Entity_Id;
Cref : Node_Id;
Cref2 : Node_Id;
Attach : Node_Id := With_Attach;
begin
if Is_Concurrent_Type (Typ) then
Is_Conc := True;
Utyp := Corresponding_Record_Type (Typ);
Cref := Convert_Concurrent (Ref, Typ);
elsif Is_Private_Type (Typ)
and then Present (Full_View (Typ))
and then Is_Concurrent_Type (Underlying_Type (Typ))
then
Is_Conc := True;
Utyp := Corresponding_Record_Type (Underlying_Type (Typ));
Cref := Convert_Concurrent (Ref, Underlying_Type (Typ));
else
Is_Conc := False;
Utyp := Typ;
Cref := Ref;
end if;
Utyp := Underlying_Type (Base_Type (Utyp));
Set_Assignment_OK (Cref);
-- Deal with non-tagged derivation of private views
if Is_Untagged_Derivation (Typ)
and then not Is_Conc
then
Utyp := Underlying_Type (Root_Type (Base_Type (Typ)));
Cref := Unchecked_Convert_To (Utyp, Cref);
Set_Assignment_OK (Cref);
-- To prevent problems with UC see 1.156 RH ???
end if;
-- If the underlying_type is a subtype, we are dealing with
-- the completion of a private type. We need to access
-- the base type and generate a conversion to it.
if Utyp /= Base_Type (Utyp) then
pragma Assert (Is_Private_Type (Typ));
Utyp := Base_Type (Utyp);
Cref := Unchecked_Convert_To (Utyp, Cref);
end if;
-- We do not need to attach to one of the Global Final Lists
-- the objects whose type is Finalize_Storage_Only
if Finalize_Storage_Only (Typ)
and then (Global_Flist_Ref (Flist_Ref)
or else Entity (Constant_Value (RTE (RE_Garbage_Collected)))
= Standard_True)
then
Attach := Make_Integer_Literal (Loc, 0);
end if;
-- Generate:
-- Deep_Initialize (Ref, Flist_Ref);
if Has_Controlled_Component (Utyp) then
Proc := TSS (Utyp, Deep_Name_Of (Initialize_Case));
Cref := Convert_View (Proc, Cref, 2);
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Proc, Loc),
Parameter_Associations => New_List (
Node1 => Flist_Ref,
Node2 => Cref,
Node3 => Attach)));
-- Generate:
-- Attach_To_Final_List (Ref, Flist_Ref);
-- Initialize (Ref);
else -- Is_Controlled (Utyp)
Proc := Find_Prim_Op (Utyp, Name_Of (Initialize_Case));
Cref := Convert_View (Proc, Cref);
Cref2 := New_Copy_Tree (Cref);
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Reference_To (Proc, Loc),
Parameter_Associations => New_List (Cref2)));
Append_To (Res,
Make_Attach_Call (Cref, Flist_Ref, Attach));
-- Treat this as a reference to Initialize if Initialize routine
-- comes from source. The call is not explicit, but it is near
-- enough, and we won't typically get explicit adjust calls.
if Comes_From_Source (Proc) then
Generate_Reference (Proc, Ref);
end if;
end if;
return Res;
end Make_Init_Call;
--------------------------
-- Make_Transient_Block --
--------------------------
-- If finalization is involved, this function just wraps the instruction
-- into a block whose name is the transient block entity, and then
-- Expand_Cleanup_Actions (called on the expansion of the handled
-- sequence of statements will do the necessary expansions for
-- cleanups).
function Make_Transient_Block
(Loc : Source_Ptr;
Action : Node_Id)
return Node_Id
is
Flist : constant Entity_Id := Finalization_Chain_Entity (Current_Scope);
Decls : constant List_Id := New_List;
Par : constant Node_Id := Parent (Action);
Instrs : constant List_Id := New_List (Action);
Blk : Node_Id;
begin
-- Case where only secondary stack use is involved
if Uses_Sec_Stack (Current_Scope)
and then No (Flist)
and then Nkind (Action) /= N_Return_Statement
and then Nkind (Par) /= N_Exception_Handler
then
declare
S : Entity_Id;
K : Entity_Kind;
begin
S := Scope (Current_Scope);
loop
K := Ekind (S);
-- At the outer level, no need to release the sec stack
if S = Standard_Standard then
Set_Uses_Sec_Stack (Current_Scope, False);
exit;
-- In a function, only release the sec stack if the
-- function does not return on the sec stack otherwise
-- the result may be lost. The caller is responsible for
-- releasing.
elsif K = E_Function then
Set_Uses_Sec_Stack (Current_Scope, False);
if not Requires_Transient_Scope (Etype (S)) then
if not Functions_Return_By_DSP_On_Target then
Set_Uses_Sec_Stack (S, True);
Check_Restriction (No_Secondary_Stack, Action);
end if;
end if;
exit;
-- In a loop or entry we should install a block encompassing
-- all the construct. For now just release right away.
elsif K = E_Loop or else K = E_Entry then
exit;
-- In a procedure or a block, we release on exit of the
-- procedure or block. ??? memory leak can be created by
-- recursive calls.
elsif K = E_Procedure
or else K = E_Block
then
if not Functions_Return_By_DSP_On_Target then
Set_Uses_Sec_Stack (S, True);
Check_Restriction (No_Secondary_Stack, Action);
end if;
Set_Uses_Sec_Stack (Current_Scope, False);
exit;
else
S := Scope (S);
end if;
end loop;
end;
end if;
-- Insert actions stuck in the transient scopes as well as all
-- freezing nodes needed by those actions
Insert_Actions_In_Scope_Around (Action);
declare
Last_Inserted : Node_Id := Prev (Action);
begin
if Present (Last_Inserted) then
Freeze_All (First_Entity (Current_Scope), Last_Inserted);
end if;
end;
Blk :=
Make_Block_Statement (Loc,
Identifier => New_Reference_To (Current_Scope, Loc),
Declarations => Decls,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc, Statements => Instrs),
Has_Created_Identifier => True);
-- When the transient scope was established, we pushed the entry for
-- the transient scope onto the scope stack, so that the scope was
-- active for the installation of finalizable entities etc. Now we
-- must remove this entry, since we have constructed a proper block.
Pop_Scope;
return Blk;
end Make_Transient_Block;
------------------------
-- Node_To_Be_Wrapped --
------------------------
function Node_To_Be_Wrapped return Node_Id is
begin
return Scope_Stack.Table (Scope_Stack.Last).Node_To_Be_Wrapped;
end Node_To_Be_Wrapped;
----------------------------
-- Set_Node_To_Be_Wrapped --
----------------------------
procedure Set_Node_To_Be_Wrapped (N : Node_Id) is
begin
Scope_Stack.Table (Scope_Stack.Last).Node_To_Be_Wrapped := N;
end Set_Node_To_Be_Wrapped;
----------------------------------
-- Store_After_Actions_In_Scope --
----------------------------------
procedure Store_After_Actions_In_Scope (L : List_Id) is
SE : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last);
begin
if Present (SE.Actions_To_Be_Wrapped_After) then
Insert_List_Before_And_Analyze (
First (SE.Actions_To_Be_Wrapped_After), L);
else
SE.Actions_To_Be_Wrapped_After := L;
if Is_List_Member (SE.Node_To_Be_Wrapped) then
Set_Parent (L, Parent (SE.Node_To_Be_Wrapped));
else
Set_Parent (L, SE.Node_To_Be_Wrapped);
end if;
Analyze_List (L);
end if;
end Store_After_Actions_In_Scope;
-----------------------------------
-- Store_Before_Actions_In_Scope --
-----------------------------------
procedure Store_Before_Actions_In_Scope (L : List_Id) is
SE : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last);
begin
if Present (SE.Actions_To_Be_Wrapped_Before) then
Insert_List_After_And_Analyze (
Last (SE.Actions_To_Be_Wrapped_Before), L);
else
SE.Actions_To_Be_Wrapped_Before := L;
if Is_List_Member (SE.Node_To_Be_Wrapped) then
Set_Parent (L, Parent (SE.Node_To_Be_Wrapped));
else
Set_Parent (L, SE.Node_To_Be_Wrapped);
end if;
Analyze_List (L);
end if;
end Store_Before_Actions_In_Scope;
--------------------------------
-- Wrap_Transient_Declaration --
--------------------------------
-- If a transient scope has been established during the processing of the
-- Expression of an Object_Declaration, it is not possible to wrap the
-- declaration into a transient block as usual case, otherwise the object
-- would be itself declared in the wrong scope. Therefore, all entities (if
-- any) defined in the transient block are moved to the proper enclosing
-- scope, furthermore, if they are controlled variables they are finalized
-- right after the declaration. The finalization list of the transient
-- scope is defined as a renaming of the enclosing one so during their
-- initialization they will be attached to the proper finalization
-- list. For instance, the following declaration :
-- X : Typ := F (G (A), G (B));
-- (where G(A) and G(B) return controlled values, expanded as _v1 and _v2)
-- is expanded into :
-- _local_final_list_1 : Finalizable_Ptr;
-- X : Typ := [ complex Expression-Action ];
-- Finalize_One(_v1);
-- Finalize_One (_v2);
procedure Wrap_Transient_Declaration (N : Node_Id) is
S : Entity_Id;
LC : Entity_Id := Empty;
Nodes : List_Id;
Loc : constant Source_Ptr := Sloc (N);
Enclosing_S : Entity_Id;
Uses_SS : Boolean;
Next_N : constant Node_Id := Next (N);
begin
S := Current_Scope;
Enclosing_S := Scope (S);
-- Insert Actions kept in the Scope stack
Insert_Actions_In_Scope_Around (N);
-- If the declaration is consuming some secondary stack, mark the
-- Enclosing scope appropriately.
Uses_SS := Uses_Sec_Stack (S);
Pop_Scope;
-- Create a List controller and rename the final list to be its
-- internal final pointer:
-- Lxxx : Simple_List_Controller;
-- Fxxx : Finalizable_Ptr renames Lxxx.F;
if Present (Finalization_Chain_Entity (S)) then
LC := Make_Defining_Identifier (Loc, New_Internal_Name ('L'));
Nodes := New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => LC,
Object_Definition =>
New_Reference_To (RTE (RE_Simple_List_Controller), Loc)),
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Finalization_Chain_Entity (S),
Subtype_Mark => New_Reference_To (RTE (RE_Finalizable_Ptr), Loc),
Name =>
Make_Selected_Component (Loc,
Prefix => New_Reference_To (LC, Loc),
Selector_Name => Make_Identifier (Loc, Name_F))));
-- Put the declaration at the beginning of the declaration part
-- to make sure it will be before all other actions that have been
-- inserted before N.
Insert_List_Before_And_Analyze (First (List_Containing (N)), Nodes);
-- Generate the Finalization calls by finalizing the list
-- controller right away. It will be re-finalized on scope
-- exit but it doesn't matter. It cannot be done when the
-- call initializes a renaming object though because in this
-- case, the object becomes a pointer to the temporary and thus
-- increases its life span.
if Nkind (N) = N_Object_Renaming_Declaration
and then Controlled_Type (Etype (Defining_Identifier (N)))
then
null;
else
Nodes :=
Make_Final_Call (
Ref => New_Reference_To (LC, Loc),
Typ => Etype (LC),
With_Detach => New_Reference_To (Standard_False, Loc));
if Present (Next_N) then
Insert_List_Before_And_Analyze (Next_N, Nodes);
else
Append_List_To (List_Containing (N), Nodes);
end if;
end if;
end if;
-- Put the local entities back in the enclosing scope, and set the
-- Is_Public flag appropriately.
Transfer_Entities (S, Enclosing_S);
-- Mark the enclosing dynamic scope so that the sec stack will be
-- released upon its exit unless this is a function that returns on
-- the sec stack in which case this will be done by the caller.
if Uses_SS then
S := Enclosing_Dynamic_Scope (S);
if Ekind (S) = E_Function
and then Requires_Transient_Scope (Etype (S))
then
null;
else
Set_Uses_Sec_Stack (S);
Check_Restriction (No_Secondary_Stack, N);
end if;
end if;
end Wrap_Transient_Declaration;
-------------------------------
-- Wrap_Transient_Expression --
-------------------------------
-- Insert actions before <Expression>:
-- (lines marked with <CTRL> are expanded only in presence of Controlled
-- objects needing finalization)
-- _E : Etyp;
-- declare
-- _M : constant Mark_Id := SS_Mark;
-- Local_Final_List : System.FI.Finalizable_Ptr; <CTRL>
-- procedure _Clean is
-- begin
-- Abort_Defer;
-- System.FI.Finalize_List (Local_Final_List); <CTRL>
-- SS_Release (M);
-- Abort_Undefer;
-- end _Clean;
-- begin
-- _E := <Expression>;
-- at end
-- _Clean;
-- end;
-- then expression is replaced by _E
procedure Wrap_Transient_Expression (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
E : constant Entity_Id :=
Make_Defining_Identifier (Loc, New_Internal_Name ('E'));
Etyp : Entity_Id := Etype (N);
begin
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => E,
Object_Definition => New_Reference_To (Etyp, Loc)),
Make_Transient_Block (Loc,
Action =>
Make_Assignment_Statement (Loc,
Name => New_Reference_To (E, Loc),
Expression => Relocate_Node (N)))));
Rewrite (N, New_Reference_To (E, Loc));
Analyze_And_Resolve (N, Etyp);
end Wrap_Transient_Expression;
------------------------------
-- Wrap_Transient_Statement --
------------------------------
-- Transform <Instruction> into
-- (lines marked with <CTRL> are expanded only in presence of Controlled
-- objects needing finalization)
-- declare
-- _M : Mark_Id := SS_Mark;
-- Local_Final_List : System.FI.Finalizable_Ptr ; <CTRL>
-- procedure _Clean is
-- begin
-- Abort_Defer;
-- System.FI.Finalize_List (Local_Final_List); <CTRL>
-- SS_Release (_M);
-- Abort_Undefer;
-- end _Clean;
-- begin
-- <Instr uction>;
-- at end
-- _Clean;
-- end;
procedure Wrap_Transient_Statement (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
New_Statement : constant Node_Id := Relocate_Node (N);
begin
Rewrite (N, Make_Transient_Block (Loc, New_Statement));
-- With the scope stack back to normal, we can call analyze on the
-- resulting block. At this point, the transient scope is being
-- treated like a perfectly normal scope, so there is nothing
-- special about it.
-- Note: Wrap_Transient_Statement is called with the node already
-- analyzed (i.e. Analyzed (N) is True). This is important, since
-- otherwise we would get a recursive processing of the node when
-- we do this Analyze call.
Analyze (N);
end Wrap_Transient_Statement;
end Exp_Ch7;
|
programs/oeis/141/A141015.asm | neoneye/loda | 22 | 170729 | ; A141015: a(0) = 0, a(1) = 1, a(2) = 2; for n > 2, a(n) = a(n-1) + 2*a(n-2) + a(n-3).
; 0,1,2,4,9,19,41,88,189,406,872,1873,4023,8641,18560,39865,85626,183916,395033,848491,1822473,3914488,8407925,18059374,38789712,83316385,178955183,384377665,825604416,1773314929,3808901426,8181135700,17572253481,37743426307,81069068969,174128175064,374009739309,803335158406,1725482812088,3706162868209,7960463650791,17098272199297,36725362369088,78882370418473,169431367355946,363921470561980,781666575692345,1678940884172251,3606195506118921,7745743850155768,16637075746565861,35734758952996318,76754654296283808,164861247948842305,354105315494406239,760582465688374657,1633654344626029440,3508924591497184993,7536815746437618530,16188319274058017956,34770875358430440009,74684329652984094451,160414399643902992425,344553934308301621336,740067063249091700637,1589589331509597935734,3414277392316082958344,7333523118584370530449,15751667234726134382871,33832990864210958402113,72669848452247597698304,156087497415395648885401,335260185184101802684122,720105028467140698153228,1546712896250739952406873,3322183138369123151397451,7135713959337743754364425,15326793132326730009566200,32920404189371340669692501,70709704413362544443189326,151877305924431955792140528,326217118940528385348211681,700681435202754841375682063,1504992979008243567864245953,3232572968354281635963821760,6943240361573523613067995729,14913379277290330452859885202,32032432968791659314959698420,68802431884945843833747464553,147780677099819492916526746595,317417973838502839898981374121,681781759923087669565782331864,1464398384699912842280271826701,3145379878384591021310817864550,6755958407707504375437143849816,14511116549176599260339051405617,31168413242976199032524156969799,66946604749036901928639403630849,143794547784165899254026768976064,308856170525215902143829733207561
mul $0,2
mov $1,1
mov $2,2
mov $4,2
lpb $0
sub $0,1
mov $3,$2
mov $2,$1
sub $4,1
mov $1,$4
add $4,$3
lpe
trn $1,$4
add $1,5
add $1,$4
sub $1,7
mov $0,$1
|
commands/apps/deepl/deepl-app-translate.applescript | grzegorzkrukowski/script-commands | 1 | 980 | #!/usr/bin/osascript
# Dependency: This script requires DeepL to be installed: https://deepl.com/app
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title DeepL App Translate
# @raycast.mode silent
# Optional parameters:
# @raycast.icon images/deepl.png
# @raycast.argument1 { "type": "text", "placeholder": "text", "optional": true }
# @raycast.packageName Apps
# Documentation:
# @raycast.description Translate text in DeepL for Mac. Copies from the clipboard if no text argument is given.
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/jonohewitt
on run translate
### Configuration: ###
-- choose whether the translation result should be automatically copied to the clipboard:
set copyResultToClipboard to false
-- set time in seconds to wait for DeepL to load below. It may need to be increased on slower computers
set delayTime to 1.2
###
if application "DeepL" is running then
tell application "System Events"
click UI element "DeepL" of list 1 of application process "Dock"
end tell
else
activate application "DeepL"
delay delayTime
end if
set inputText to ""
if item 1 of translate is equal to "" then
set inputText to the clipboard
else
set inputText to item 1 of translate
end if
tell application "System Events"
set value of text area 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "DeepL" of application process "DeepL" to inputText
end tell
if copyResultToClipboard is equal to true then
set translation to ""
tell application "System Events"
repeat until translation is not equal to ""
set translation to value of text area 1 of group 12 of UI element 1 of scroll area 1 of group 1 of group 1 of window "DeepL" of application process "DeepL"
end repeat
end tell
set the clipboard to translation
end if
end run |
grammar/tiny/recursion/modle/main.asm | bishop986/CompileConstruction | 2 | 1902 | <reponame>bishop986/CompileConstruction<gh_stars>1-10
; Author: bishop986 @copyright
; Introduction:
; code modle
section .data
errorMsg1: db "[ERROR] Data Format Error, Exit process", 0ah, 0
msgLen1: equ $-errorMsg1
section .text
global _start
_start:
nop
nop
call _exit
.errorread:
xor rax, rax
xor rbx, rbx
xor rcx, rcx
xor rdx, rdx
mov eax, 4
mov ebx, 1
mov ecx, eax
mov edx, msgLen1
int 80h
call _exit
_exit:
mov eax, 1
mov ebx, 0
int 80h
_putc:
xor rax, rax
xor rbx, rbx
xor rcx, rcx
xor rdx, rdx
mov eax, 4
mov ebx, 1
mov ecx, char
mov edx, 1
int 80h
ret
_read:
push rax
; read from stdin
mov eax, 3
mov ebx, 0
mov ecx, buffer
mov edx, bufferlen
int 80h
mov byte [buffer + 12], 0
;compute the length of str, save it to edx
xor edx, edx
mov edx, 0
.begin1:
mov al, [buffer+edx]
cmp al, 0ah
je .end1
cmp al, 0
je .end1
mov bl, '-'
cmp al, bl
je .right
cmp al, '0'
jb _start.errorread
cmp al, '9'
ja _start.errorread
.right:
inc dl
jmp .begin1
.end1: ; finish get the size of str
xor rax, rax
xor ebx, ebx
xor ecx, ecx
mov qword [num], rax
mov ecx, 1
.atoi: ; convert str to number, save to memory num
mov rax, 1
xor ebx, ebx
cmp edx, 0
je .end2
mov bl, [buffer+edx-1]
cmp bl, "-"
je .end2neg
xor rax, rax
sub bl, 48 ; transform ascii to number
mov eax, ebx ; send data of ebx to eax wait for multi
push rdx
mul ecx ; a*100+b*10+c = abc
add qword [num], rax
pop rdx
xor rax, rax ; iteration multi 10
mov eax, ecx
mov ebx, 10
push rdx
mul ebx
pop rdx
mov ecx, eax
sub edx, 1
jmp .atoi
.end2neg:
cmp edx, 1 ; judge if it's the first symbol
jne _start.errorread
mov rax, -1
.end2:
mul qword [num]
pop rcx
mov qword [rcx], rax
ret
_write:
xor rcx, rcx
mov rcx, 1
cmp rax, 0
jg .otia
mov rbx, -1
mul rbx
push rax
push rcx
mov byte [char], '-'
call _putc
pop rcx
pop rax
.otia:
xor rbx, rbx
xor rdx, rdx
mov rbx, 10
div rbx
add rdx, 48
mov byte [char], dl
push rdx
cmp rax, 0
je .end3
inc rcx
jmp .otia
.end3:
.output:
pop rax
mov byte [char], al
push rcx
call _putc
pop rcx
dec rcx
cmp rcx, 0
jne .output
mov byte [char], 0ah
call _putc
ret
_eqfunc:
sub rax, rbx
cmp rax, 0
je .isequ
mov rax, 0
ret
.isequ:
mov rax, 1
ret
_lefunc:
sub rbx, rax
cmp rbx, 0
jg .isle
mov rax, 0
ret
.isle:
mov rax, 1
ret
section .bss
char: resb 1
delim: resb 1
num: resb 8
bufferlen: equ 1024
buffer: resb bufferlen
|
TRAIN/TRAIN_CHAR/vett.asm | mich2k/CE_LAB | 0 | 247054 | <gh_stars>0
.586
.model flat
.code
_spazi proc
push ebp
mov ebp,esp
push esi
push edi
push ebx
mov ebx, dword ptr[ebp+8] ; arr
mov edi, 0
mov esi, 0
ciclo:
mov al, byte ptr [ebx+esi]
cmp al, 0
je fine
cmp al, 32
je found
inc esi
jmp ciclo
; bh 4 bit mov bh, 1
; bl 8 bit mov bl, 44
; bx 16 bit
; ebx 32 bit cambiato
found:
mov byte ptr [ebx+esi], ','
;pop eax
inc edi
inc esi
jmp ciclo
fine:
mov eax, edi
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret
_spazi endp
end |
src/demo3.asm | vbguyny/c64kernel | 2 | 164156 | <reponame>vbguyny/c64kernel
incasm "kernel.hdr"
;incasm "kernel.asm"
main
@loop
jsr console.clear$
lda #color.white$
sta console.setcharactercolor.color$
jsr console.setcharactercolor$
lda #<title
sta console.writestr.straddress$
lda #>title
sta console.writestr.straddress$+1
jsr console.writestr$
jsr console.writeln$
lda #<options
sta console.writestr.straddress$
lda #>options
sta console.writestr.straddress$+1
jsr console.writestr$
jsr console.writeln$
jsr console.readchr$
lda console.readchr.char$
cmp #'1'
bne @not1
jsr Do1
@not1
cmp #'x'
bne @notexit
jsr GoBack
@notexit
jmp @loop
rts
GoBack
lda #<fnback
sta filename
lda #>fnback
sta filename+1
jsr DoLoad
rts
NextPrg
sta fnnext+6 ; Modify the string value directly
lda #<fnnext
sta filename
lda #>fnnext
sta filename+1
jsr DoLoad
rts
DoLoad
lda filename
sta disk.loadfile.filename$
lda filename+1
sta disk.loadfile.filename$+1
jsr disk.loadfile$
jsr audio.beep$
jsr console.writeln$
jsr console.writeln$
lda #color.red$
sta console.setcharactercolor.color$
jsr console.setcharactercolor$
lda #<failed
sta console.writestr.straddress$
lda #>failed
sta console.writestr.straddress$+1
jsr console.writestr$
lda filename
sta console.writestr.straddress$
lda filename+1
sta console.writestr.straddress$+1
jsr console.writestr$
jsr console.readchr$
lda #$00
rts
PressAnyKey
jsr console.writeln$
jsr console.writeln$
lda #<anykey
sta console.writestr.straddress$
lda #>anykey
sta console.writestr.straddress$+1
jsr console.writestr$
jsr console.readchr$
lda #$00
rts
Do1
; Ticks are the number of milliseconds that the computer has been on.
; They reset when the computer is turned off/on and after 24 hours.
; Ticks are updated every "jiffy" which is 1/50 of a second for PAL
; and 1/60 of a second for NTSC.
jsr console.clear$
lda #<ticks
sta console.writestr.straddress$
lda #>ticks
sta console.writestr.straddress$+1
jsr console.writestr$
jsr time.getticks$
lda time.getticks.result$
sta console.writeint32.integer$
lda time.getticks.result$+1
sta console.writeint32.integer$+1
lda time.getticks.result$+2
sta console.writeint32.integer$+2
lda time.getticks.result$+3
sta console.writeint32.integer$+3
jsr console.writeint32$
jsr PressAnyKey
rts
title text 'Time', console.newline$, console.newline$
text 'Please select one of the options below:', console.newline$, console.null$
options text '1. Get Ticks', console.newline$
text 'x. Exit', console.newline$
text console.null$
anykey text 'Press any key to go back', console.null$
filename word $0000
fnnext text 'DEMO3-X', console.null$
fnback text 'MAIN', console.null$
failed text 'Failed to load ', console.null$
ticks text 'Ticks: ', console.null$
|
source/options.ads | jquorning/CELLE | 0 | 26285 | <reponame>jquorning/CELLE<gh_stars>0
--
-- The author disclaims copyright to this source code. In place of
-- a legal notice, here is a blessing:
--
-- May you do good and not evil.
-- May you find forgiveness for yourself and forgive others.
-- May you share freely, not taking more than you give.
--
with GNAT.Strings;
package Options is
Show_Conflict : aliased Boolean := False;
Show_Version : aliased Boolean := False;
RP_Flag : aliased Boolean := False;
Basis_Flag : aliased Boolean := False;
Compress : aliased Boolean := False;
Be_Quiet : aliased Boolean := False;
Statistics : aliased Boolean := False;
Make_Headers : aliased Boolean := False; -- Output makeheaders compompatible
No_Line_Nos : aliased Boolean := False;
No_Resort : aliased Boolean := False;
Show_Help : aliased Boolean := False;
Generate_SQL : aliased Boolean := False;
Debug_Level : aliased Integer := 0;
use GNAT.Strings;
Program_Name : aliased String_Access := new String'("");
Input_File : aliased String_Access := new String'("parse.y");
User_Template : aliased String_Access := new String'("");
Output_Dir : aliased String_Access := new String'(".");
Placeholder_Dummy : aliased GNAT.Strings.String_Access := null;
Language_String : aliased GNAT.Strings.String_Access :=
new String'("C");
-- C is the default language like in Lemon.
-- High level options
type Language_Type is (Language_Ada, Language_C);
Language : Language_Type := Language_C;
-- Not used by C parts.
procedure Set_Language;
end Options;
|
libsrc/ctype/ispunct.asm | grancier/z180 | 0 | 166656 | ;
; Small C z88 Character functions
; Written by <NAME> <<EMAIL>>
;
; 1/3/99 djm
;
; Hurrah, this is our first table for our isxxx routines!
;
; $Id: ispunct.asm,v 1.7 2016/03/06 21:41:15 dom Exp $
;
SECTION code_clib
PUBLIC _ispunct
PUBLIC ispunct
EXTERN asm_ispunct
; FASTCALL
._ispunct
.ispunct
ld a,l
call asm_ispunct
ld l,c
ld h,b
ret
|
stack_storage.ads | jrcarter/Ada_GUI | 19 | 18694 | <reponame>jrcarter/Ada_GUI
-- --
-- package Stack_Storage Copyright (c) <NAME> --
-- Interface Luebeck --
-- Winter, 2003 --
-- --
-- Last revision : 13:09 10 Mar 2013 --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of 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. This library --
-- 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 a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
--
-- This package implements a dynaically allocated stack which acts as a
-- storage pool. The type Stack is a descendant of Root_Storage_Pool.
-- Note that pool objects have to be allocated and deallocated in LIFO.
-- Note also that the pool should be protected from a concurrent
-- access.
--
with Generic_Unbounded_Ptr_Array;
with System; use System;
with System.Storage_Elements; use System.Storage_Elements;
with System.Storage_Pools; use System.Storage_Pools;
package Stack_Storage is
--
-- Pool -- The stack pool
--
-- Initial_Size - Of the stack segments
-- Items_Number - The number of items in a segment
--
-- A stack pool consists of contiguous segments allocated dynamically as
-- necessary. The discriminants control the stack segments allocation.
-- Initial_Size determines the initial default size of a newly allocated
-- segment. If this size is less than the size of the object being
-- allocated the default size is set to the object size multiplied to
-- Items_Number. This value will then be used as the default size for
-- all further segments. The segments allocated earlier having lesser
-- size will be freed when possible. Otherwise, they remain allocated
-- until pool destruction. Upon stack destruction, all stack segments
-- are deallocated. No checks made whether some objects remain allocated
-- on the stack.
--
type Pool
( Initial_Size : Storage_Count;
Items_Number : Positive
) is new Root_Storage_Pool with private;
--
-- Allocate -- Overrides System.Storage_Pools...
--
procedure Allocate
( Stack : in out Pool;
Place : out Address;
Size : Storage_Count;
Alignment : Storage_Count
);
--
-- Deallocate -- Overrides System.Storage_Pools...
--
-- The object has to be deallocated in the order they were allocated. No
-- checks made with this respect. It is also not checked whether the
-- address of the object being deallocated is correct.
--
procedure Deallocate
( Stack : in out Pool;
Place : Address;
Size : Storage_Count;
Alignment : Storage_Count
);
--
-- Deallocate_All -- Erase pool contents
--
-- Stack - The storage pool
--
-- This procedure deallocates everything allocated in the pool, should
-- be used with great care.
--
procedure Deallocate_All (Stack : in out Pool);
--
-- Get_Last_Segment -- The number of the last segment in use
--
-- Stack - The storage pool
--
-- Returns :
--
-- The last segment holding some allocated data
--
function Get_Last_Segment (Stack : Pool) return Natural;
--
-- Get_Segments_Number -- Get total number segments in the pool
--
-- Stack - The storage pool
--
-- Returns :
--
-- Number of allocated segments, including unused ones
--
function Get_Segments_Number (Stack : Pool) return Natural;
--
-- Get_Segment_Data -- Get description of a segment
--
-- Stack - The storage pool
-- Index - The segment number 1..Get_Segments_Number
-- Size - The total size of the segment
-- Used - The used space in the segment
-- Start - The first address in the segment
--
-- The first free address is Start + Used. Free space in the segment is
-- Size - Used.
--
-- Exceptions :
--
-- Constraint_Error - Illegal index
--
procedure Get_Segment_Data
( Stack : Pool;
Index : Positive;
Size : out Storage_Count;
Used : out Storage_Count;
Start : out Address
);
--
-- Storage_Size -- Overrides System.Storage_Pools...
--
function Storage_Size (Stack : Pool) return Storage_Count;
private
type Block_Index is new Integer;
--
-- Block -- A contiguous segment of a stack pool
--
-- Size - The segment size
--
-- The field Free specifies the first free address in the segment. When
-- a segment is allocated it is set to point to the first element of the
-- field Memory. As the memory is consumed Free moves to further
-- elements.
--
type Block (Size : Storage_Count) is record
Free : Storage_Offset := 1;
Memory : aliased Storage_Array (1..Size);
end record;
type Block_Ptr is access Block;
type Block_Ptr_Array is array (Block_Index range <>) of Block_Ptr;
--
-- Block_Arrays -- A package providing unbounded arrays of segments
--
package Block_Arrays is
new Generic_Unbounded_Ptr_Array
( Index_Type => Block_Index,
Object_Type => Block,
Object_Ptr_Type => Block_Ptr,
Object_Ptr_Array_Type => Block_Ptr_Array
);
type Pool
( Initial_Size : Storage_Count;
Items_Number : Positive
) is new Root_Storage_Pool with
record
Total_Size : Storage_Count := 0;
Block_Size : Storage_Count := Initial_Size;
Current : Block_Index := 0;
Last : Block_Index := 0;
Blocks : Block_Arrays.Unbounded_Ptr_Array;
end record;
end Stack_Storage;
|
src/boot/printf.asm | wsngamerz/wsn_os | 1 | 14308 | ; output string to screen
printf:
pusha
; loop through the si register one char at a time and output the char
str_loop:
mov al, [si]
cmp al, 0
jne print_char
popa
ret
; 'method' to output the char
print_char:
mov ah, 0x0e
int 0x10
inc si
jmp str_loop
|
asmFiles/subroutine_div.asm | hythzz/MIPS-Processor | 0 | 26202 | <filename>asmFiles/subroutine_div.asm
# registers a0-1,v0-1,t0
# a0 = Numerator
# a1 = Denominator
# v0 = Quotient
# v1 = Remainder
#-divide(N=$a0,D=$a1) returns (Q=$v0,R=$v1)--------
divide: # setup frame
push $ra # saved return address
push $a0 # saved register
push $a1 # saved register
or $v0, $0, $0 # Quotient v0=0
or $v1, $0, $a0 # Remainder t2=N=a0
beq $0, $a1, divrtn # test zero D
slt $t0, $a1, $0 # test neg D
bne $t0, $0, divdneg
slt $t0, $a0, $0 # test neg N
bne $t0, $0, divnneg
divloop:
slt $t0, $v1, $a1 # while R >= D
bne $t0, $0, divrtn
addiu $v0, $v0, 1 # Q = Q + 1
subu $v1, $v1, $a1 # R = R - D
j divloop
divnneg:
subu $a0, $0, $a0 # negate N
jal divide # call divide
subu $v0, $0, $v0 # negate Q
beq $v1, $0, divrtn
addiu $v0, $v0, -1 # return -Q-1
j divrtn
divdneg:
subu $a0, $0, $a1 # negate D
jal divide # call divide
subu $v0, $0, $v0 # negate Q
divrtn:
pop $a1
pop $a0
pop $ra
jr $ra
#-divide--------------------------------------------
|
engine/display_text_id_init.asm | AmateurPanda92/pokemon-rby-dx | 9 | 100881 | ; function that performs initialization for DisplayTextID
DisplayTextIDInit:
xor a
ld [wListMenuID], a
ld a, [wAutoTextBoxDrawingControl]
bit 0, a
jr nz, .skipDrawingTextBoxBorder
ld a, [hSpriteIndexOrTextID] ; text ID (or sprite ID)
and a
jr nz, .notStartMenu
; if text ID is 0 (i.e. the start menu)
; Note that the start menu text border is also drawn in the function directly
; below this, so this seems unnecessary.
CheckEvent EVENT_GOT_POKEDEX
; start menu with pokedex
coord hl, 10, 0
ld b, $0e
ld c, $08
jr nz, .drawTextBoxBorder
; start menu without pokedex
coord hl, 10, 0
ld b, $0c
ld c, $08
jr .drawTextBoxBorder
; if text ID is not 0 (i.e. not the start menu) then do a standard dialogue text box
.notStartMenu
coord hl, 0, 12
ld b, $04
ld c, $12
.drawTextBoxBorder
call TextBoxBorder
.skipDrawingTextBoxBorder
ld hl, wFontLoaded
set 0, [hl]
ld hl, wFlags_0xcd60
bit 4, [hl]
res 4, [hl]
jr nz, .skipMovingSprites
call UpdateSprites
.skipMovingSprites
; loop to copy C1X9 (direction the sprite is facing) to C2X9 for each sprite
; this is done because when you talk to an NPC, they turn to look your way
; the original direction they were facing must be restored after the dialogue is over
ld hl, wSpriteStateData1 + $19
ld c, $0f
ld de, $0010
.spriteFacingDirectionCopyLoop
ld a, [hl]
inc h
ld [hl], a
dec h
add hl, de
dec c
jr nz, .spriteFacingDirectionCopyLoop
; loop to force all the sprites in the middle of animation to stand still
; (so that they don't like they're frozen mid-step during the dialogue)
ld hl, wSpriteStateData1 + 2
ld de, $0010
ld c, e
.spriteStandStillLoop
ld a, [hl]
cp $ff ; is the sprite visible?
jr z, .nextSprite
; if it is visible
and $fc
ld [hl], a
.nextSprite
add hl, de
dec c
jr nz, .spriteStandStillLoop
ld b, $9c ; window background address
call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM
xor a
ld [hWY], a ; put the window on the screen
call LoadFontTilePatterns
ld a, $01
ld [H_AUTOBGTRANSFERENABLED], a ; enable continuous WRAM to VRAM transfer each V-blank
ret
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0x48_notsx.log_21829_1186.asm | ljhsiun2/medusa | 9 | 85995 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x11c65, %r12
nop
nop
add %rax, %rax
movups (%r12), %xmm4
vpextrq $0, %xmm4, %rdi
nop
nop
nop
nop
add %r10, %r10
lea addresses_A_ht+0xf665, %r8
nop
nop
nop
add $46462, %rsi
movl $0x61626364, (%r8)
nop
nop
nop
dec %rsi
lea addresses_WC_ht+0xa65, %r8
nop
nop
nop
xor %rbx, %rbx
movb $0x61, (%r8)
nop
nop
cmp $18125, %rbx
lea addresses_WT_ht+0x1b7c5, %rdi
inc %rsi
vmovups (%rdi), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %r10
nop
nop
inc %r8
lea addresses_D_ht+0x7265, %rsi
lea addresses_WC_ht+0x15149, %rdi
nop
nop
add $9184, %rbx
mov $65, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $6757, %rcx
lea addresses_WC_ht+0xad8d, %rsi
lea addresses_UC_ht+0x1ce65, %rdi
nop
nop
nop
cmp %rbx, %rbx
mov $58, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $35422, %rbx
lea addresses_WC_ht+0x1b85, %rsi
lea addresses_D_ht+0x1065, %rdi
nop
nop
nop
sub %rax, %rax
mov $49, %rcx
rep movsl
nop
and %rax, %rax
lea addresses_D_ht+0x1d805, %rcx
nop
nop
and $55110, %r8
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
and $0xffffffffffffffc0, %rcx
movntdq %xmm7, (%rcx)
nop
nop
nop
inc %rbx
lea addresses_normal_ht+0x16785, %rsi
lea addresses_UC_ht+0xcb55, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
sub $32082, %r10
mov $115, %rcx
rep movsq
and %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %rax
push %rbp
push %rcx
// Store
lea addresses_UC+0x13a65, %rcx
nop
nop
nop
nop
nop
add $38675, %r8
movb $0x51, (%rcx)
nop
nop
nop
nop
dec %r14
// Faulty Load
lea addresses_UC+0x13a65, %r8
nop
cmp $29682, %r12
vmovups (%r8), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %rcx
lea oracles, %rax
and $0xff, %rcx
shlq $12, %rcx
mov (%rax,%rcx,1), %rcx
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_UC', 'congruent': 0}}
{'dst': {'same': True, 'NT': True, 'AVXalign': True, 'size': 1, 'type': 'addresses_UC', 'congruent': 0}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 8}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 3}}
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 2, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 5, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 5, 'type': 'addresses_normal_ht'}}
{'51': 21829}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
sample/obj/release/Sample.asm | Marakusa/neptyne | 0 | 29795 | section .data
section .text
global _start
_start:
call _main
mov eax, 1
mov ebx, 0
int 80h
_main:
push rbp
mov rbp, rsp
mov eax, 112
mov DWORD [rbp-4], eax
mov eax, DWORD [rbp-4]
mov DWORD [rbp-8], eax
mov eax, DWORD [rbp-8]
mov ecx, eax
mov eax, 4
mov ebx, 1
mov edx, 4
int 80h
mov eax, DWORD [rbp-8]
pop rbp
ret
|
awa/plugins/awa-images/src/awa-images-services.adb | fuzzysloth/ada-awa | 0 | 18464 | -----------------------------------------------------------------------
-- awa-images-services -- Image service
-- Copyright (C) 2012, 2013, 2015, 2016 <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 Util.Processes;
with Util.Beans.Objects;
with Util.Log.Loggers;
with Util.Streams.Pipes;
with Util.Streams.Texts;
with Util.Strings;
with ADO.Sessions;
with AWA.Images.Models;
with AWA.Services.Contexts;
with AWA.Storages.Services;
with AWA.Storages.Modules;
with Ada.Strings.Unbounded;
with EL.Variables.Default;
with EL.Contexts.Default;
-- == Storage Service ==
-- The <tt>Storage_Service</tt> provides the operations to access and use the persisent storage.
-- It controls the permissions that grant access to the service for users.
--
-- Other modules can be notified of storage changes by registering a listener
-- on the storage module.
package body AWA.Images.Services is
package ASC renames AWA.Services.Contexts;
-- ------------------------------
-- Image Service
-- ------------------------------
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Images.Services");
-- ------------------------------
-- Initializes the storage service.
-- ------------------------------
overriding
procedure Initialize (Service : in out Image_Service;
Module : in AWA.Modules.Module'Class) is
begin
AWA.Modules.Module_Manager (Service).Initialize (Module);
Service.Thumbnail_Command := Module.Get_Config (PARAM_THUMBNAIL_COMMAND);
end Initialize;
procedure Create_Thumbnail (Service : in Image_Service;
Source : in String;
Into : in String;
Width : in out Natural;
Height : in out Natural) is
Ctx : EL.Contexts.Default.Default_Context;
Variables : aliased EL.Variables.Default.Default_Variable_Mapper;
Proc : Util.Processes.Process;
Pipe : aliased Util.Streams.Pipes.Pipe_Stream;
begin
Variables.Bind ("src", Util.Beans.Objects.To_Object (Source));
Variables.Bind ("dst", Util.Beans.Objects.To_Object (Into));
Variables.Bind ("width", Util.Beans.Objects.To_Object (Width));
Variables.Bind ("height", Util.Beans.Objects.To_Object (Height));
Ctx.Set_Variable_Mapper (Variables'Unchecked_Access);
declare
Cmd : constant Util.Beans.Objects.Object := Service.Thumbnail_Command.Get_Value (Ctx);
Command : constant String := Util.Beans.Objects.To_String (Cmd);
Input : Util.Streams.Texts.Reader_Stream;
begin
Width := 0;
Height := 0;
Pipe.Open (Command, Util.Processes.READ_ALL);
Input.Initialize (null, Pipe'Unchecked_Access, 1024);
while not Input.Is_Eof loop
declare
use Ada.Strings;
Line : Ada.Strings.Unbounded.Unbounded_String;
Pos : Natural;
Sep : Natural;
Last : Natural;
begin
Input.Read_Line (Into => Line, Strip => False);
exit when Ada.Strings.Unbounded.Length (Line) = 0;
Log.Info ("Received: {0}", Line);
-- The '-verbose' option of ImageMagick reports information about the original
-- image. Extract the picture width and height.
-- image.png PNG 120x282 120x282+0+0 8-bit DirectClass 34.4KB 0.000u 0:00.018
Pos := Ada.Strings.Unbounded.Index (Line, " ");
if Pos > 0 and Width = 0 then
Pos := Ada.Strings.Unbounded.Index (Line, " ", Pos + 1);
if Pos > 0 then
Sep := Ada.Strings.Unbounded.Index (Line, "x", Pos + 1);
Last := Ada.Strings.Unbounded.Index (Line, "=", Pos + 1);
if Sep > 0 and Sep < Last then
Log.Info ("Dimension {0} - {1}..{2}",
Ada.Strings.Unbounded.Slice (Line, Pos, Last),
Natural'Image (Pos), Natural'Image (Last));
Width := Natural'Value (Unbounded.Slice (Line, Pos + 1, Sep - 1));
Height := Natural'Value (Unbounded.Slice (Line, Sep + 1, Last - 1));
end if;
end if;
end if;
end;
end loop;
Pipe.Close;
Util.Processes.Wait (Proc);
if Pipe.Get_Exit_Status /= 0 then
Log.Error ("Command {0} exited with status {1}", Command,
Integer'Image (Pipe.Get_Exit_Status));
end if;
end;
end Create_Thumbnail;
-- Build a thumbnail for the image identified by the Id.
procedure Build_Thumbnail (Service : in Image_Service;
Id : in ADO.Identifier) is
Storage_Service : constant AWA.Storages.Services.Storage_Service_Access
:= AWA.Storages.Modules.Get_Storage_Manager;
Ctx : constant ASC.Service_Context_Access := ASC.Current;
DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx);
Img : AWA.Images.Models.Image_Ref;
Thumb : AWA.Images.Models.Image_Ref;
Target_File : AWA.Storages.Storage_File (AWA.Storages.TMP);
Local_File : AWA.Storages.Storage_File (AWA.Storages.CACHE);
Thumbnail : AWA.Storages.Models.Storage_Ref;
Width : Natural := 64;
Height : Natural := 64;
begin
Img.Load (DB, Id);
declare
Image_File : constant AWA.Storages.Models.Storage_Ref'Class := Img.Get_Storage;
begin
Storage_Service.Get_Local_File (From => Image_File.Get_Id, Into => Local_File);
Storage_Service.Create_Local_File (Target_File);
Service.Create_Thumbnail (AWA.Storages.Get_Path (Local_File),
AWA.Storages.Get_Path (Target_File), Width, Height);
Thumbnail.Set_Mime_Type ("image/jpeg");
Thumbnail.Set_Original (Image_File);
Thumbnail.Set_Workspace (Image_File.Get_Workspace);
Thumbnail.Set_Folder (Image_File.Get_Folder);
Thumbnail.Set_Owner (Image_File.Get_Owner);
Thumbnail.Set_Name (String '(Image_File.Get_Name));
Storage_Service.Save (Thumbnail, AWA.Storages.Get_Path (Target_File),
AWA.Storages.Models.DATABASE);
Thumb.Set_Width (64);
Thumb.Set_Height (64);
Thumb.Set_Owner (Image_File.Get_Owner);
Thumb.Set_Folder (Image_File.Get_Folder);
Thumb.Set_Storage (Thumbnail);
Img.Set_Width (Width);
Img.Set_Height (Height);
Img.Set_Thumb_Width (64);
Img.Set_Thumb_Height (64);
Img.Set_Thumbnail (Thumbnail);
Ctx.Start;
Img.Save (DB);
Thumb.Save (DB);
Ctx.Commit;
end;
end Build_Thumbnail;
-- Save the data object contained in the <b>Data</b> part element into the
-- target storage represented by <b>Into</b>.
procedure Create_Image (Service : in Image_Service;
File : in AWA.Storages.Models.Storage_Ref'Class) is
pragma Unreferenced (Service);
Ctx : constant AWA.Services.Contexts.Service_Context_Access := AWA.Services.Contexts.Current;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
Img : AWA.Images.Models.Image_Ref;
begin
Ctx.Start;
Img.Set_Width (0);
Img.Set_Height (0);
Img.Set_Thumb_Height (0);
Img.Set_Thumb_Width (0);
Img.Set_Storage (File);
Img.Set_Folder (File.Get_Folder);
Img.Set_Owner (File.Get_Owner);
Img.Save (DB);
Ctx.Commit;
end Create_Image;
-- Deletes the storage instance.
procedure Delete_Image (Service : in Image_Service;
File : in AWA.Storages.Models.Storage_Ref'Class) is
begin
null;
end Delete_Image;
-- ------------------------------
-- Scale the image dimension.
-- ------------------------------
procedure Scale (Width : in Natural;
Height : in Natural;
To_Width : in out Natural;
To_Height : in out Natural) is
begin
if To_Width = Natural'Last or To_Height = Natural'Last
or (To_Width = 0 and To_Height = 0)
then
To_Width := Width;
To_Height := Height;
elsif To_Width = 0 then
To_Width := (Width * To_Height) / Height;
elsif To_Height = 0 then
To_Height := (Height * To_Width) / Width;
end if;
end Scale;
-- ------------------------------
-- Get the dimension represented by the string. The string has one of the following
-- formats:
-- original -> Width, Height := Natural'Last
-- default -> Width, Height := 0
-- <width>x -> Width := <width>, Height := 0
-- x<height> -> Width := 0, Height := <height>
-- <width>x<height> -> Width := <width>, Height := <height>
-- ------------------------------
procedure Get_Sizes (Dimension : in String;
Width : out Natural;
Height : out Natural) is
Pos : Natural;
begin
if Dimension = "original" then
Width := Natural'Last;
Height := Natural'Last;
elsif Dimension = "default" then
Width := 800;
Height := 0;
else
Pos := Util.Strings.Index (Dimension, 'x');
if Pos > Dimension'First then
Width := Natural'Value (Dimension (Dimension'First .. Pos - 1));
else
Width := 0;
end if;
if Pos < Dimension'Last then
Height := Natural'Value (Dimension (Pos + 1 .. Dimension'Last));
else
Height := 0;
end if;
end if;
end Get_Sizes;
end AWA.Images.Services;
|
Kernel/asm/interrupts.asm | luciatorrusio/Arqui--TPE | 0 | 29479 |
GLOBAL _cli
GLOBAL _sti
GLOBAL picMasterMask
GLOBAL picSlaveMask
GLOBAL haltcpu
GLOBAL _hlt
GLOBAL _irq00Handler
GLOBAL _irq01Handler
GLOBAL _irq02Handler
GLOBAL _irq03Handler
GLOBAL _irq04Handler
GLOBAL _irq05Handler
GLOBAL _irq80Handler
GLOBAL _irq81Handler
GLOBAL _irq82Handler
GLOBAL _irq83Handler
GLOBAL _irq85Handler
GLOBAL _exception0Handler
GLOBAL _exception6Handler
EXTERN irqDispatcher
EXTERN exceptionDispatcher
SECTION .text
%macro pushState 0
push rax
push rbx
push rcx
push rdx
push rbp
push rdi
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
%endmacro
%macro popState 0
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
%endmacro
%macro irqHandlerMaster 1
pushState
mov r9, r9 ; Quinto Param
mov r8, rdx ; Cuarto Param
mov rcx,rcx ; Tercer Param
mov rdx,rbx ; Segundo Param
mov rsi,rax ; Primer Param
mov rdi, %1 ; Tipo de Interrupcion
call irqDispatcher
; signal pic EOI (End of Interrupt)
mov al, 20h
out 20h, al
popState
iretq
%endmacro
%macro exceptionHandler 1
pushState
mov rdi, %1 ; first parameter
mov rsi, rsp ; second parameter
call exceptionDispatcher
mov qword [rsp+8*15],SampleCodeAdress
popState
iretq
%endmacro
_hlt:
sti
hlt
ret
_cli:
cli
ret
_sti:
sti
ret
picMasterMask:
push rbp
mov rbp, rsp
mov ax, di
out 21h,al
pop rbp
retn
picSlaveMask:
push rbp
mov rbp, rsp
mov ax, di ; ax = mascara de 16 bits
out 0A1h,al
pop rbp
retn
;8254 Timer (Timer Tick)
_irq00Handler:
irqHandlerMaster 0
;Keyboard
_irq01Handler:
irqHandlerMaster 1
;Cascade pic never called
_irq02Handler:
irqHandlerMaster 2
;Serial Port 2 and 4
_irq03Handler:
irqHandlerMaster 3
;Serial Port 1 and 3
_irq04Handler:
irqHandlerMaster 4
; READ / WRITE
_irq80Handler:
irqHandlerMaster 80h
; DEVICEINFO
_irq81Handler:
irqHandlerMaster 81h
; TIME
_irq82Handler:
irqHandlerMaster 82h
; printAt
_irq83Handler:
irqHandlerMaster 83h
; CustomExceptions
_irq85Handler:
irqHandlerMaster 85h
;USB
_irq05Handler:
irqHandlerMaster 5
;Zero Division Exception
_exception0Handler:
exceptionHandler 0
;Invalid Opcode Exception
_exception6Handler:
exceptionHandler 6
; Excepciones custom
haltcpu:
cli
hlt
ret
SECTION .bss
aux resq 1
SPBackup resq 1
IPBackup resq 1
SampleCodeAdress equ 0x400000 |
kernel/asm/isr.asm | avdgrinten/echidnaOS | 0 | 160139 | global handler_simple
global handler_code
global handler_irq_pic0
global handler_irq_pic1
global handler_div0
global irq0_handler
global keyboard_isr
global syscall
global ts_enable
global read_stat
global write_stat
extern keyboard_handler
extern task_switch
extern except_div0
extern set_PIC0_mask
extern get_PIC0_mask
; API calls
extern open
extern close
extern read
extern write
extern lseek
extern getpid
extern signal
extern task_fork
extern task_quit_self
extern alloc
extern free
extern realloc
extern enter_iowait_status
extern enter_iowait_status1
extern enter_ipcwait_status
extern enter_vdevwait_status
extern pwd
extern what_stdin
extern what_stdout
extern what_stderr
extern ipc_send_packet
extern ipc_read_packet
extern ipc_resolve_name
extern ipc_payload_sender
extern ipc_payload_length
extern vfs_cd
extern vfs_read
extern vfs_write
extern vfs_remove
extern vfs_mkdir
extern vfs_create
extern vfs_list
extern vfs_get_metadata
extern general_execute
extern general_execute_block
extern register_vdev
extern vdev_in_ready
extern vdev_out_ready
extern get_heap_base
extern get_heap_size
extern resize_heap
extern syscall_log
section .data
ts_enable dd 1
read_stat dd 0
write_stat dd 0
routine_list:
dd task_quit_self ; 0x00
dd general_execute ; 0x01
dd 0 ;general_execute_block; 0x02 - dummy entry
dd 0 ; 0x03
dd syscall_log ; 0x04
dd 0 ;task_fork ; 0x05 - dummy entry
dd 0 ; 0x06
dd 0 ; 0x07
dd ipc_send_packet ; 0x08
dd ipc_read_packet ; 0x09
dd ipc_resolve_name ; 0x0a
dd ipc_payload_sender ; 0x0b
dd ipc_payload_length ; 0x0c
dd 0 ;ipc_await 0x0d - dummy entry
dd 0 ; 0x0e
dd 0 ; 0x0f
dd get_heap_base ; 0x10
dd get_heap_size ; 0x11
dd resize_heap ; 0x12
dd 0 ; 0x13
dd 0 ; 0x14
dd getpid ; 0x15
dd signal ; 0x16
dd 0 ; 0x17
dd 0 ; 0x18
dd 0 ; 0x19
dd pwd ; 0x1a
dd what_stdin ; 0x1b
dd what_stdout ; 0x1c
dd what_stderr ; 0x1d
dd 0 ; 0x1e
dd 0 ; 0x1f
dd register_vdev ; 0x20
dd vdev_in_ready ; 0x21
dd vdev_out_ready ; 0x22
dd 0 ;vdev_await ; 0x23 - dummy entry
dd 0 ; 0x24
dd 0 ; 0x25
dd 0 ; 0x26
dd 0 ; 0x27
dd 0 ; 0x28
dd 0 ; 0x29
dd open ; 0x2a
dd close ; 0x2b
dd 0 ;read ; 0x2c - dummy entry
dd 0 ;write ; 0x2d - dummy entry
dd lseek ; 0x2e
dd vfs_cd ; 0x2f
dd 0 ;vfs_read ; 0x30 - dummy entry
dd 0 ;vfs_write ; 0x31 - dummy entry
dd vfs_list ; 0x32
dd vfs_get_metadata ; 0x33
dd vfs_remove ; 0x34
dd vfs_mkdir ; 0x35
dd vfs_create ; 0x36
section .text
bits 32
handler_simple:
jmp $
iretd
handler_code:
jmp $
add esp, 4
iretd
handler_irq_pic0:
push eax
mov al, 0x20 ; acknowledge interrupt to PIC0
out 0x20, al
pop eax
iretd
handler_irq_pic1:
push eax
mov al, 0x20 ; acknowledge interrupt to both PICs
out 0xA0, al
out 0x20, al
pop eax
iretd
handler_div0:
mov ax, 0x10
mov ds, ax
mov es, ax
call except_div0
irq0_handler:
push ds
push 0x10
pop ds
cmp dword [ts_enable], 0
pop ds
je .ts_abort
; save task status
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov al, 0x20 ; acknowledge interrupt to PIC0
out 0x20, al
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call task_switch
.ts_abort:
push eax
mov al, 0x20 ; acknowledge interrupt to PIC0
out 0x20, al
pop eax
iretd
keyboard_isr:
push eax
push ebx
push ecx
push edx
push esi
push edi
push ebp
push ds
push es
mov ax, 0x10
mov ds, ax
mov es, ax
xor eax, eax
in al, 0x60 ; read from keyboard
push eax
call keyboard_handler
add esp, 4
mov al, 0x20 ; acknowledge interrupt to PIC0
out 0x20, al
pop es
pop ds
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop eax
iretd
syscall:
; ARGS in EAX (call code), ECX, EDX, EDI, ESI
; return value in EAX/EDX
; special routines check
cmp eax, 0x0d
je ipc_await
cmp eax, 0x23
je vdev_await
cmp eax, 0x05
je fork_isr
; disable task switch, reenable all interrupts
push ds
push 0x10
pop ds
mov dword [ts_enable], 0
pop ds
sti
; special routines check
cmp eax, 0x30
je vfs_read_isr
cmp eax, 0x31
je vfs_write_isr
cmp eax, 0x2c
je read_isr
cmp eax, 0x2d
je write_isr
cmp eax, 0x02
je gen_exec_block_isr
; end special routines check
push ebx
push ecx
push esi
push edi
push ebp
push ds
push es
push fs
push gs
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
mov ebx, 4
push edx
mul ebx
pop edx
; push syscall args, and call
push esi
push edi
push edx
push ecx
call [routine_list+eax]
add esp, 16
; disable all interrupts, reenable task switch
cli
mov dword [ts_enable], 1
; return
pop gs
pop fs
pop es
pop ds
pop ebp
pop edi
pop esi
pop ecx
pop ebx
iretd
vfs_read_isr:
; check if I/O is ready
push ebx
push ecx
push esi
push edi
push ebp
push ds
push es
push fs
push gs
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
push esi
push edi
push edx
push ecx
call vfs_read
add esp, 16
; disable all interrupts, reenable task switch
cli
mov dword [ts_enable], 1
; done
pop gs
pop fs
pop es
pop ds
pop ebp
pop edi
pop esi
pop ecx
pop ebx
cmp eax, -5 ; if I/O is not ready
je .enter_iowait
iretd ; else, just return
.enter_iowait:
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
push 0 ; VFS read type
push esi
push edi
push edx
push ecx
call enter_iowait_status
add esp, 20
call task_switch
vfs_write_isr:
; check if I/O is ready
push ebx
push ecx
push esi
push edi
push ebp
push ds
push es
push fs
push gs
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
push esi
push edi
push edx
push ecx
call vfs_write
add esp, 16
; disable all interrupts, reenable task switch
cli
mov dword [ts_enable], 1
; done
pop gs
pop fs
pop es
pop ds
pop ebp
pop edi
pop esi
pop ecx
pop ebx
cmp eax, -5 ; if I/O is not ready
je .enter_iowait
iretd ; else, just return
.enter_iowait:
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
push 1 ; VFS write type
push esi
push edi
push edx
push ecx
call enter_iowait_status
add esp, 20
call task_switch
read_isr:
; check if I/O is ready
push ebx
push ecx
push edx
push esi
push edi
push ebp
push ds
push es
push fs
push gs
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
push esi
push edi
push edx
push ecx
call read
add esp, 16
; disable all interrupts, reenable task switch
cli
mov dword [ts_enable], 1
cmp dword [read_stat], 1 ; if I/O is not ready
; done
pop gs
pop fs
pop es
pop ds
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
je .enter_iowait
iretd ; else, just return
.enter_iowait:
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
push eax
push 2 ; read type
push edi
push edx
push ecx
call enter_iowait_status1
add esp, 20
call task_switch
write_isr:
; check if I/O is ready
push ebx
push ecx
push edx
push esi
push edi
push ebp
push ds
push es
push fs
push gs
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
push esi
push edi
push edx
push ecx
call write
add esp, 16
; disable all interrupts, reenable task switch
cli
mov dword [ts_enable], 1
cmp dword [write_stat], 1 ; if I/O is not ready
; done
pop gs
pop fs
pop es
pop ds
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
je .enter_iowait
iretd ; else, just return
.enter_iowait:
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov bx, 0x10
mov ds, bx
mov es, bx
mov fs, bx
mov gs, bx
push eax
push 3 ; write type
push edi
push edx
push ecx
call enter_iowait_status1
add esp, 20
call task_switch
gen_exec_block_isr:
; save task status
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
push esi
push edi
push edx
push ecx
call general_execute_block
add esp, 16
; disable all interrupts, reenable task switch
cli
mov dword [ts_enable], 1
; done
cmp eax, -1
je .abort
call task_switch
.abort:
pop eax
pop ebx
pop ecx
pop edx
pop esi
pop edi
pop ebp
pop ds
pop es
pop fs
pop gs
mov eax, -1
mov edx, -1
iretd
ipc_await:
; save task status
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call enter_ipcwait_status
call task_switch
vdev_await:
; save task status
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call enter_vdevwait_status
call task_switch
fork_isr:
; save task status
push gs
push fs
push es
push ds
push ebp
push edi
push esi
push edx
push ecx
push ebx
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call task_fork
|
Applications/Safari/windows/test.applescript | looking-for-a-job/applescript-examples | 1 | 1286 | #!/usr/bin/osascript
tell application "Safari"
URL of every tab of window 1
end tell
|
Data/ShipModelEquates.asm | ped7g/EliteNext | 0 | 102259 | <filename>Data/ShipModelEquates.asm
ScoopDebrisOffset equ 0 ; hull byte#0 high nibble is scoop info, lower nibble is debris spin info
MissileLockLoOffset equ 1
MissileLockHiOffset equ 2
EdgeAddyOffset equ 3
LineX4Offset equ 5
GunVertexOffset equ 6
ExplosionCtOffset equ 7
VertexCtX6Offset equ 8
EdgeCountOffset equ 9
BountyLoOffset equ 10
BountyHiOffset equ 11
FaceCtX4Offset equ 12
DotOffset equ 13
EnergyOffset equ 14
SpeedOffset equ 15
FaceAddyOffset equ 16
QOffset equ 18
LaserOffset equ 19
VerticiesAddyOffset equ 20
ShipTypeOffset equ 22
ShipNewBitsOffset equ 23
ShipDataLength equ ShipNewBitsOffset+1
CobraTablePointer equ 43
;29 faulty
BankThreshold equ 16
ShipTableALast equ 23
ShipTableBLast equ 39
ShipTableCLast equ 55
|
assembler/tests/t_403/t_403.asm | paulscottrobson/RCA-Cosmac-VIP-III | 1 | 160524 | <reponame>paulscottrobson/RCA-Cosmac-VIP-III<filename>assembler/tests/t_403/t_403.asm
cpu ppc403
page 0
include stddef60
org 0x1000
mtdcr 10,r5
mtbear r5
mfdcr r5,10
mfbesr r5
wrtee r10
wrteei 1
bdnzl 0x10
bdztla 7,0x10
beq 0x10
beq 2,0x10
beq cr2,0x10
cmpw r1,r2
clrlwi r1,r2,5
mtspr pit,r5
mcrf cr4,cr5
mcrf 4,5
|
programs/oeis/315/A315211.asm | karttu/loda | 0 | 88287 | <reponame>karttu/loda<gh_stars>0
; A315211: Coordination sequence Gal.3.20.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.
; 1,6,10,14,20,26,30,34,40,46,50,54,60,66,70,74,80,86,90,94,100,106,110,114,120,126,130,134,140,146,150,154,160,166,170,174,180,186,190,194,200,206,210,214,220,226,230,234,240,246
mov $1,$0
mul $1,2
lpb $0,1
trn $0,3
add $1,2
mov $2,$1
sub $1,2
add $2,$0
trn $0,1
add $1,2
mul $2,2
mov $3,$2
lpe
mov $1,3
trn $3,3
add $1,$3
sub $1,2
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2696.asm | ljhsiun2/medusa | 9 | 90003 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1dc1b, %rdi
nop
nop
nop
and %r12, %r12
mov (%rdi), %edx
nop
nop
xor $12078, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_A+0x1efad, %rsi
lea addresses_UC+0x103b5, %rdi
nop
nop
nop
cmp $46177, %r9
mov $17, %rcx
rep movsq
nop
nop
cmp $2514, %r9
// Faulty Load
lea addresses_RW+0x4cad, %r9
nop
nop
nop
dec %r15
mov (%r9), %rdx
lea oracles, %rsi
and $0xff, %rdx
shlq $12, %rdx
mov (%rsi,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_UC', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
src/gnat/mlib-utl.adb | My-Colaborations/dynamo | 15 | 19099 | <reponame>My-Colaborations/dynamo
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M L I B . U T L --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2014, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT 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 a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with MLib.Fil; use MLib.Fil;
with MLib.Tgt; use MLib.Tgt;
with Opt;
with Osint;
with Output; use Output;
with Interfaces.C.Strings; use Interfaces.C.Strings;
package body MLib.Utl is
Adalib_Path : String_Access := null;
-- Path of the GNAT adalib directory, specified in procedure
-- Specify_Adalib_Dir. Used in function Lib_Directory.
Gcc_Name : String_Access;
-- Default value of the "gcc" executable used in procedure Gcc
Gcc_Exec : String_Access;
-- The full path name of the "gcc" executable
Ar_Name : String_Access;
-- The name of the archive builder for the platform, set when procedure Ar
-- is called for the first time.
Ar_Exec : String_Access;
-- The full path name of the archive builder
Ar_Options : String_List_Access;
-- The minimum options used when invoking the archive builder
Ar_Append_Options : String_List_Access;
-- The options to be used when invoking the archive builder to add chunks
-- of object files, when building the archive in chunks.
Opt_Length : Natural := 0;
-- The max number of options for the Archive_Builder
Initial_Size : Natural := 0;
-- The minimum number of bytes for the invocation of the Archive Builder
-- (without name of the archive or object files).
Ranlib_Name : String_Access;
-- The name of the archive indexer for the platform, if there is one
Ranlib_Exec : String_Access := null;
-- The full path name of the archive indexer
Ranlib_Options : String_List_Access := null;
-- The options to be used when invoking the archive indexer, if any
--------
-- Ar --
--------
procedure Ar (Output_File : String; Objects : Argument_List) is
Full_Output_File : constant String :=
Ext_To (Output_File, Archive_Ext);
Arguments : Argument_List_Access;
Last_Arg : Natural := 0;
Success : Boolean;
Line_Length : Natural := 0;
Maximum_Size : Integer;
pragma Import (C, Maximum_Size, "__gnat_link_max");
-- Maximum number of bytes to put in an invocation of the
-- Archive_Builder.
Size : Integer;
-- The number of bytes for the invocation of the archive builder
Current_Object : Natural;
procedure Display;
-- Display an invocation of the Archive Builder
-------------
-- Display --
-------------
procedure Display is
begin
if not Opt.Quiet_Output then
Write_Str (Ar_Name.all);
Line_Length := Ar_Name'Length;
for J in 1 .. Last_Arg loop
-- Make sure the Output buffer does not overflow
if Line_Length + 1 + Arguments (J)'Length > Buffer_Max then
Write_Eol;
Line_Length := 0;
end if;
Write_Char (' ');
-- Only output the first object files when not in verbose mode
if (not Opt.Verbose_Mode) and then J = Opt_Length + 3 then
Write_Str ("...");
exit;
end if;
Write_Str (Arguments (J).all);
Line_Length := Line_Length + 1 + Arguments (J)'Length;
end loop;
Write_Eol;
end if;
end Display;
begin
if Ar_Exec = null then
Ar_Name := Osint.Program_Name (Archive_Builder, "gnatmake");
Ar_Exec := Locate_Exec_On_Path (Ar_Name.all);
if Ar_Exec = null then
Free (Ar_Name);
Ar_Name := new String'(Archive_Builder);
Ar_Exec := Locate_Exec_On_Path (Ar_Name.all);
end if;
if Ar_Exec = null then
Fail (Ar_Name.all & " not found in path");
elsif Opt.Verbose_Mode then
Write_Str ("found ");
Write_Line (Ar_Exec.all);
end if;
Ar_Options := Archive_Builder_Options;
Initial_Size := 0;
for J in Ar_Options'Range loop
Initial_Size := Initial_Size + Ar_Options (J)'Length + 1;
end loop;
Ar_Append_Options := Archive_Builder_Append_Options;
Opt_Length := Ar_Options'Length;
if Ar_Append_Options /= null then
Opt_Length := Natural'Max (Ar_Append_Options'Length, Opt_Length);
Size := 0;
for J in Ar_Append_Options'Range loop
Size := Size + Ar_Append_Options (J)'Length + 1;
end loop;
Initial_Size := Integer'Max (Initial_Size, Size);
end if;
-- ranlib
Ranlib_Name := Osint.Program_Name (Archive_Indexer, "gnatmake");
if Ranlib_Name'Length > 0 then
Ranlib_Exec := Locate_Exec_On_Path (Ranlib_Name.all);
if Ranlib_Exec = null then
Free (Ranlib_Name);
Ranlib_Name := new String'(Archive_Indexer);
Ranlib_Exec := Locate_Exec_On_Path (Ranlib_Name.all);
end if;
if Ranlib_Exec /= null and then Opt.Verbose_Mode then
Write_Str ("found ");
Write_Line (Ranlib_Exec.all);
end if;
end if;
Ranlib_Options := Archive_Indexer_Options;
end if;
Arguments :=
new String_List (1 .. 1 + Opt_Length + Objects'Length);
Arguments (1 .. Ar_Options'Length) := Ar_Options.all; -- "ar cr ..."
Arguments (Ar_Options'Length + 1) := new String'(Full_Output_File);
Delete_File (Full_Output_File);
Size := Initial_Size + Full_Output_File'Length + 1;
-- Check the full size of a call of the archive builder with all the
-- object files.
for J in Objects'Range loop
Size := Size + Objects (J)'Length + 1;
end loop;
-- If the size is not too large or if it is not possible to build the
-- archive in chunks, build the archive in a single invocation.
if Size <= Maximum_Size or else Ar_Append_Options = null then
Last_Arg := Ar_Options'Length + 1 + Objects'Length;
Arguments (Ar_Options'Length + 2 .. Last_Arg) := Objects;
Display;
Spawn (Ar_Exec.all, Arguments (1 .. Last_Arg), Success);
else
-- Build the archive in several invocation, making sure to not
-- go over the maximum size for each invocation.
Last_Arg := Ar_Options'Length + 1;
Current_Object := Objects'First;
Size := Initial_Size + Full_Output_File'Length + 1;
-- First invocation
while Current_Object <= Objects'Last loop
Size := Size + Objects (Current_Object)'Length + 1;
exit when Size > Maximum_Size;
Last_Arg := Last_Arg + 1;
Arguments (Last_Arg) := Objects (Current_Object);
Current_Object := Current_Object + 1;
end loop;
Display;
Spawn (Ar_Exec.all, Arguments (1 .. Last_Arg), Success);
Arguments (1 .. Ar_Append_Options'Length) := Ar_Append_Options.all;
Arguments
(Ar_Append_Options'Length + 1) := new String'(Full_Output_File);
-- Appending invocation(s)
Big_Loop : while Success and then Current_Object <= Objects'Last loop
Last_Arg := Ar_Append_Options'Length + 1;
Size := Initial_Size + Full_Output_File'Length + 1;
Inner_Loop : while Current_Object <= Objects'Last loop
Size := Size + Objects (Current_Object)'Length + 1;
exit Inner_Loop when Size > Maximum_Size;
Last_Arg := Last_Arg + 1;
Arguments (Last_Arg) := Objects (Current_Object);
Current_Object := Current_Object + 1;
end loop Inner_Loop;
Display;
Spawn (Ar_Exec.all, Arguments (1 .. Last_Arg), Success);
end loop Big_Loop;
end if;
if not Success then
Fail (Ar_Name.all & " execution error.");
end if;
-- If we have found ranlib, run it over the library
if Ranlib_Exec /= null then
if not Opt.Quiet_Output then
Write_Str (Ranlib_Name.all);
Write_Char (' ');
for J in Ranlib_Options'Range loop
Write_Str (Ranlib_Options (J).all);
Write_Char (' ');
end loop;
Write_Line (Arguments (Ar_Options'Length + 1).all);
end if;
Spawn
(Ranlib_Exec.all,
Ranlib_Options.all & (Arguments (Ar_Options'Length + 1)),
Success);
if not Success then
Fail (Ranlib_Name.all & " execution error.");
end if;
end if;
end Ar;
-----------------
-- Delete_File --
-----------------
procedure Delete_File (Filename : String) is
File : constant String := Filename & ASCII.NUL;
Success : Boolean;
begin
Delete_File (File'Address, Success);
if Opt.Verbose_Mode then
if Success then
Write_Str ("deleted ");
else
Write_Str ("could not delete ");
end if;
Write_Line (Filename);
end if;
end Delete_File;
---------
-- Gcc --
---------
procedure Gcc
(Output_File : String;
Objects : Argument_List;
Options : Argument_List;
Options_2 : Argument_List;
Driver_Name : Name_Id := No_Name)
is
Link_Bytes : Integer := 0;
-- Projected number of bytes for the linker command line
Link_Max : Integer;
pragma Import (C, Link_Max, "__gnat_link_max");
-- Maximum number of bytes on the command line supported by the OS
-- linker. Passed this limit the response file mechanism must be used
-- if supported.
Object_List_File_Supported : Boolean;
for Object_List_File_Supported'Size use Character'Size;
pragma Import
(C, Object_List_File_Supported, "__gnat_objlist_file_supported");
-- Predicate indicating whether the linker has an option whereby the
-- names of object files can be passed to the linker in a file.
Object_File_Option_Ptr : Interfaces.C.Strings.chars_ptr;
pragma Import (C, Object_File_Option_Ptr, "__gnat_object_file_option");
-- Pointer to a string representing the linker option which specifies
-- the response file.
Object_File_Option : constant String := Value (Object_File_Option_Ptr);
-- The linker option which specifies the response file as a string
Using_GNU_response_file : constant Boolean :=
Object_File_Option'Length > 0
and then
Object_File_Option
(Object_File_Option'Last) = '@';
-- Whether a GNU response file is used
Tname : String_Access;
Tname_FD : File_Descriptor := Invalid_FD;
-- Temporary file used by linker to pass list of object files on
-- certain systems with limitations on size of arguments.
Closing_Status : Boolean;
-- For call to Close
Arguments :
Argument_List
(1 .. 7 + Objects'Length + Options'Length + Options_2'Length);
A : Natural := 0;
Success : Boolean;
Out_Opt : constant String_Access := new String'("-o");
Out_V : constant String_Access := new String'(Output_File);
Lib_Dir : constant String_Access := new String'("-L" & Lib_Directory);
Lib_Opt : constant String_Access := new String'(Dynamic_Option);
Driver : String_Access;
type Object_Position is (First, Second, Last);
Position : Object_Position;
procedure Write_RF (S : String);
-- Write a string to the response file and check if it was successful.
-- Fail the program if it was not successful (disk full).
--------------
-- Write_RF --
--------------
procedure Write_RF (S : String) is
Success : Boolean := True;
Back_Slash : constant Character := '\';
begin
-- If a GNU response file is used, space and backslash need to be
-- escaped because they are interpreted as a string separator and
-- an escape character respectively by the underlying mechanism.
-- On the other hand, quote and double-quote are not escaped since
-- they are interpreted as string delimiters on both sides.
if Using_GNU_response_file then
for J in S'Range loop
if S (J) = ' ' or else S (J) = '\' then
if Write (Tname_FD, Back_Slash'Address, 1) /= 1 then
Success := False;
end if;
end if;
if Write (Tname_FD, S (J)'Address, 1) /= 1 then
Success := False;
end if;
end loop;
else
if Write (Tname_FD, S'Address, S'Length) /= S'Length then
Success := False;
end if;
end if;
if Write (Tname_FD, ASCII.LF'Address, 1) /= 1 then
Success := False;
end if;
if not Success then
Fail ("cannot generate response file to link library: disk full");
end if;
end Write_RF;
-- Start of processing for Gcc
begin
if Driver_Name = No_Name then
if Gcc_Exec = null then
if Gcc_Name = null then
Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
end if;
Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all);
if Gcc_Exec = null then
Fail (Gcc_Name.all & " not found in path");
end if;
end if;
Driver := Gcc_Exec;
else
Driver := Locate_Exec_On_Path (Get_Name_String (Driver_Name));
if Driver = null then
Fail (Get_Name_String (Driver_Name) & " not found in path");
end if;
end if;
Link_Bytes := 0;
if Lib_Opt'Length /= 0 then
A := A + 1;
Arguments (A) := Lib_Opt;
Link_Bytes := Link_Bytes + Lib_Opt'Length + 1;
end if;
A := A + 1;
Arguments (A) := Out_Opt;
Link_Bytes := Link_Bytes + Out_Opt'Length + 1;
A := A + 1;
Arguments (A) := Out_V;
Link_Bytes := Link_Bytes + Out_V'Length + 1;
A := A + 1;
Arguments (A) := Lib_Dir;
Link_Bytes := Link_Bytes + Lib_Dir'Length + 1;
A := A + Options'Length;
Arguments (A - Options'Length + 1 .. A) := Options;
for J in Options'Range loop
Link_Bytes := Link_Bytes + Options (J)'Length + 1;
end loop;
if not Opt.Quiet_Output then
if Opt.Verbose_Mode then
Write_Str (Driver.all);
elsif Driver_Name /= No_Name then
Write_Str (Get_Name_String (Driver_Name));
else
Write_Str (Gcc_Name.all);
end if;
for J in 1 .. A loop
if Opt.Verbose_Mode or else J < 4 then
Write_Char (' ');
Write_Str (Arguments (J).all);
else
Write_Str (" ...");
exit;
end if;
end loop;
-- Do not display all the object files if not in verbose mode, only
-- the first one.
Position := First;
for J in Objects'Range loop
if Opt.Verbose_Mode or else Position = First then
Write_Char (' ');
Write_Str (Objects (J).all);
Position := Second;
elsif Position = Second then
Write_Str (" ...");
Position := Last;
exit;
end if;
end loop;
for J in Options_2'Range loop
if not Opt.Verbose_Mode then
if Position = Second then
Write_Str (" ...");
end if;
exit;
end if;
Write_Char (' ');
Write_Str (Options_2 (J).all);
end loop;
Write_Eol;
end if;
for J in Objects'Range loop
Link_Bytes := Link_Bytes + Objects (J)'Length + 1;
end loop;
for J in Options_2'Range loop
Link_Bytes := Link_Bytes + Options_2 (J)'Length + 1;
end loop;
if Object_List_File_Supported and then Link_Bytes > Link_Max then
-- Create a temporary file containing the object files, one object
-- file per line for maximal compatibility with linkers supporting
-- this option.
Create_Temp_File (Tname_FD, Tname);
for J in Objects'Range loop
Write_RF (Objects (J).all);
end loop;
Close (Tname_FD, Closing_Status);
if not Closing_Status then
Fail ("cannot generate response file to link library: disk full");
end if;
A := A + 1;
Arguments (A) := new String'(Object_File_Option & Tname.all);
else
A := A + Objects'Length;
Arguments (A - Objects'Length + 1 .. A) := Objects;
end if;
A := A + Options_2'Length;
Arguments (A - Options_2'Length + 1 .. A) := Options_2;
Spawn (Driver.all, Arguments (1 .. A), Success);
if Success then
-- Delete the temporary file used in conjunction with linking
-- if one was created.
if Tname_FD /= Invalid_FD then
Delete_File (Tname.all);
end if;
else
if Driver_Name = No_Name then
Fail (Gcc_Name.all & " execution error");
else
Fail (Get_Name_String (Driver_Name) & " execution error");
end if;
end if;
end Gcc;
-------------------
-- Lib_Directory --
-------------------
function Lib_Directory return String is
Libgnat : constant String := Tgt.Libgnat;
begin
-- If procedure Specify_Adalib_Dir has been called, used the specified
-- value.
if Adalib_Path /= null then
return Adalib_Path.all;
end if;
Name_Len := Libgnat'Length;
Name_Buffer (1 .. Name_Len) := Libgnat;
Get_Name_String (Osint.Find_File (Name_Enter, Osint.Library));
-- Remove libgnat.a
return Name_Buffer (1 .. Name_Len - Libgnat'Length);
end Lib_Directory;
------------------------
-- Specify_Adalib_Dir --
------------------------
procedure Specify_Adalib_Dir (Path : String) is
begin
if Path'Length = 0 then
Adalib_Path := null;
else
Adalib_Path := new String'(Path);
end if;
end Specify_Adalib_Dir;
end MLib.Utl;
|
src/util/spat-unique_ids.ads | HeisenbugLtd/spat | 20 | 18371 | <filename>src/util/spat-unique_ids.ads
------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>)
--
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the LICENSE file for more details.
------------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------------
--
-- SPARK Proof Analysis Tool
--
-- S.P.A.T. - Provide atomic ids (counters) to facilitate stable sorting.
-- Each instantiation provides its own local counter.
--
------------------------------------------------------------------------------
with GNATCOLL.Atomic;
generic
package SPAT.Unique_Ids is
-- Sometimes entries are identical which makes sorting unstable. To
-- counter the issue we add a unique id to each entry which serves as a
-- last ditch sorting criterion, making two entries always distinct.
-- CAREFUL: This approach only works if the order of elements being
-- inserted does not change between runs (I'm thinking further
-- parallelization here). But to make sure this works in a
-- tasking context anyway we use atomic increments to generate
-- our ids.
-- Luckily GNATCOLL already serves us, so we don't need to wrap
-- it into our own protected type (inefficient) or revert to
-- compiler/target specific intrinsics.
subtype Id is GNATCOLL.Atomic.Atomic_Counter;
-- Our id type.
--------------------------------------------------------------------------
-- Next
--
-- Returns the next available id.
-- Id is a modular type, so it wraps around instead of overflow, but we
-- should never be able to exhaust an Id's range, anyway.
--------------------------------------------------------------------------
function Next return Id with
Volatile_Function => True;
end SPAT.Unique_Ids;
|
programs/oeis/016/A016262.asm | neoneye/loda | 22 | 89038 | ; A016262: Expansion of 1/((1-x)(1-9x)(1-11x)).
; 1,21,322,4362,55363,675423,8027524,93683604,1078947205,12304267305,139269572806,1567268992926,17557692150727,195994212714867,2181672731375368,24230027568735528,268614950968549129,2973526290066165309,32877645655436942410,363173810392188482610
lpb $0
mov $2,$0
sub $0,1
seq $2,16190 ; Expansion of 1/((1-9x)(1-11x)).
add $1,$2
lpe
add $1,1
mov $0,$1
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_1237.asm | ljhsiun2/medusa | 9 | 80255 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x18baf, %rbx
add %r10, %r10
movl $0x61626364, (%rbx)
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0xd5b3, %r8
nop
nop
inc %rsi
movw $0x6162, (%r8)
nop
nop
xor $14946, %rsi
lea addresses_WC_ht+0x179b3, %rsi
lea addresses_A_ht+0x10933, %rdi
clflush (%rdi)
nop
nop
nop
nop
and %r8, %r8
mov $76, %rcx
rep movsw
nop
nop
nop
nop
cmp %r12, %r12
lea addresses_normal_ht+0x150b3, %rdi
dec %r12
movl $0x61626364, (%rdi)
nop
cmp $65076, %r10
lea addresses_A_ht+0xdff3, %rdi
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %r8
movq %r8, %xmm2
vmovups %ymm2, (%rdi)
nop
nop
nop
nop
nop
and %rbx, %rbx
lea addresses_normal_ht+0xdb33, %r15
xor %r10, %r10
mov (%r15), %rsi
nop
nop
nop
nop
nop
cmp %r15, %r15
lea addresses_A_ht+0x3bb3, %r15
nop
cmp %rsi, %rsi
vmovups (%r15), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdi
nop
nop
nop
nop
add $45128, %rbx
lea addresses_WT_ht+0x13a3, %r12
nop
nop
nop
nop
dec %r15
mov (%r12), %ebx
nop
xor $38875, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r15
push %rbx
push %rcx
push %rsi
// Store
lea addresses_D+0xe733, %rcx
nop
nop
nop
nop
nop
and $52522, %r13
movl $0x51525354, (%rcx)
add $36883, %rcx
// Store
lea addresses_UC+0x8db3, %rcx
nop
nop
nop
inc %r15
mov $0x5152535455565758, %rsi
movq %rsi, %xmm4
movups %xmm4, (%rcx)
nop
nop
sub $58689, %r12
// Store
lea addresses_PSE+0x73b3, %r13
nop
cmp %r14, %r14
movl $0x51525354, (%r13)
nop
nop
sub %r13, %r13
// Store
mov $0x7db5770000000d43, %rsi
nop
nop
nop
nop
nop
cmp $29243, %r14
movl $0x51525354, (%rsi)
nop
nop
nop
nop
nop
sub $15271, %rbx
// Store
lea addresses_UC+0x10f33, %rcx
nop
nop
nop
xor $44773, %r14
movl $0x51525354, (%rcx)
nop
nop
nop
nop
xor %rcx, %rcx
// Faulty Load
lea addresses_WC+0xf9b3, %rsi
add $46492, %r13
mov (%rsi), %rbx
lea oracles, %rcx
and $0xff, %rbx
shlq $12, %rbx
mov (%rcx,%rbx,1), %rbx
pop %rsi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': True, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'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
*/
|
src/boot/stage2/start.asm | cjsmeele/RikaiOS | 8 | 10658 | ;; Copyright 2019 <NAME>
;;
;; 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
;;
;; https://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.
[bits 16]
extern stage2_main
;; Stage2 entrypoint (at 0x7e00).
;; This calls a C++ main function.
stage2_start:
call dword stage2_main
cli
hlt
|
programs/oeis/099/A099467.asm | neoneye/loda | 22 | 22851 | <reponame>neoneye/loda
; A099467: a(1) = a(2) = 1; for n > 2, a(n) is the smallest number > a(n-1) which is not the sum of 2 consecutive elements of the sequence.
; 1,1,3,5,6,7,9,10,12,14,15,17,18,20,21,23,24,25,27,28,30,31,33,34,36,37,39,40,42,43,45,46,48,50,51,53,54,56,57,59,60,62,63,65,66,68,69,71,72,74,75,77,78,80,81,83,84,86,87,89,90,92,93,95,96,97,99,100,102,103,105,106,108,109,111,112,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,136,138,139,141,142,144,145,147,148
mov $2,$0
mov $4,$0
add $4,1
lpb $4
mov $0,$2
sub $4,1
sub $0,$4
sub $0,1
mov $3,$0
add $0,4
lpb $0
add $0,4
div $0,2
add $3,5
lpe
sub $3,1
mod $3,2
add $3,1
add $1,$3
lpe
mov $0,$1
|
source/oasis/program-elements-subtype_declarations.ads | reznikmm/gela | 0 | 4535 | -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Declarations;
with Program.Lexical_Elements;
with Program.Elements.Defining_Identifiers;
with Program.Elements.Subtype_Indications;
with Program.Elements.Aspect_Specifications;
package Program.Elements.Subtype_Declarations is
pragma Pure (Program.Elements.Subtype_Declarations);
type Subtype_Declaration is
limited interface and Program.Elements.Declarations.Declaration;
type Subtype_Declaration_Access is access all Subtype_Declaration'Class
with Storage_Size => 0;
not overriding function Name
(Self : Subtype_Declaration)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is abstract;
not overriding function Subtype_Indication
(Self : Subtype_Declaration)
return not null Program.Elements.Subtype_Indications
.Subtype_Indication_Access is abstract;
not overriding function Aspects
(Self : Subtype_Declaration)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is abstract;
type Subtype_Declaration_Text is limited interface;
type Subtype_Declaration_Text_Access is
access all Subtype_Declaration_Text'Class with Storage_Size => 0;
not overriding function To_Subtype_Declaration_Text
(Self : in out Subtype_Declaration)
return Subtype_Declaration_Text_Access is abstract;
not overriding function Subtype_Token
(Self : Subtype_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function Is_Token
(Self : Subtype_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
not overriding function With_Token
(Self : Subtype_Declaration_Text)
return Program.Lexical_Elements.Lexical_Element_Access is abstract;
not overriding function Semicolon_Token
(Self : Subtype_Declaration_Text)
return not null Program.Lexical_Elements.Lexical_Element_Access
is abstract;
end Program.Elements.Subtype_Declarations;
|
test/fail/ATPBadHint2.agda | asr/eagda | 1 | 13473 | -- An ATP hint must be used with functions.
-- This error is detected by TypeChecking.Rules.Decl.
module ATPBadHint2 where
data Bool : Set where
false true : Bool
{-# ATP hint Bool #-}
|
src/tests/imagetests.adb | sebsgit/textproc | 0 | 28903 | with AUnit.Assertions; use AUnit.Assertions;
with PixelArray; use PixelArray;
with ImageThresholds;
with ImageIO;
package body ImageTests is
procedure Register_Tests (T: in out ImageTest) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine(T, testPixelArray'Access, "pixel array");
Register_Routine(T, testImageThresholding'Access, "image thresholds");
Register_Routine(T, testImageIO'Access, "image IO");
end Register_Tests;
function Name(T: ImageTest) return Test_String is
begin
return Format("Image tests");
end Name;
procedure testPixelArray(T : in out Test_Cases.Test_Case'Class) is
testImage: PixelArray.ImagePlane := PixelArray.allocate(120, 120);
begin
Assert(testImage.isInside(0, 0), "");
Assert(not testImage.isInside(120, 120), "");
Assert(not testImage.isInside(-1, -2), "");
testImage.set(10, 10, Pixel(99));
Assert(testImage.get(10, 10) = Pixel(99), "");
end testPixelArray;
procedure testImageThresholding(T: in out Test_Cases.Test_Case'Class) is
testImage: PixelArray.ImagePlane := PixelArray.allocate(20, 20);
begin
testImage.set(Pixel(0));
testImage.set(10, 10, Pixel(45));
testImage.set(11, 11, Pixel(46));
testImage.set(12, 16, Pixel(99));
ImageThresholds.simple(testImage, threshold => Pixel(45));
Assert(ImageThresholds.isBinary(testImage), "binary output");
Assert(testImage.get(10, 10) = Pixel(0), "");
Assert(testImage.get(11, 11) = Pixel(255), "");
Assert(testImage.get(12, 16) = Pixel(255), "");
Assert(testImage.get(15, 15) = Pixel(0), "");
end testImageThresholding;
procedure testImageIO(T: in out Test_Cases.Test_Case'Class) is
testImage: PixelArray.ImagePlane := PixelArray.allocate(width => 128,
height => 128);
saveResult: Boolean;
begin
testImage.set(Pixel(56));
for i in 0 .. testImage.width - 1 loop
testImage.set(i, i, Pixel(i));
end loop;
saveResult := ImageIO.save(filename => "test_image_IO.png",
image => testImage);
testImage.set(Pixel(0));
declare
loadedImage: constant PixelArray.ImagePlane := ImageIO.load("test_image_IO.png");
begin
for i in 0 .. testImage.height - 1 loop
for j in 0 .. testImage.width - 1 loop
if i = j then
Assert(loadedImage.get(j, i) = Pixel(i), "diagonal pixel");
else
Assert(loadedImage.get(j, i) = Pixel(56), "background pixel");
end if;
end loop;
end loop;
end;
end testImageIO;
end ImageTests;
|
oeis/038/A038555.asm | neoneye/loda-programs | 11 | 20650 | <gh_stars>10-100
; A038555: Derivative of n in base 3.
; Submitted by <NAME>
; 0,0,0,1,2,0,2,0,1,3,4,5,7,8,6,2,0,1,6,7,8,1,2,0,5,3,4,9,10,11,13,14,12,17,15,16,21,22,23,25,26,24,20,18,19,6,7,8,1,2,0,5,3,4,18,19,20,22,23,21,26,24,25,3,4,5,7,8,6,2,0,1,15,16,17,10,11,9,14,12,13,27,28,29,31,32,30,35,33,34,39,40,41,43,44,42,38,36,37,51
mov $4,1
lpb $0
mov $3,$0
div $0,3
mov $2,$1
add $3,$0
mod $3,3
mul $3,$4
add $1,$3
mul $4,3
lpe
mov $0,$2
|
source/xml.ads | ytomino/xml-ada | 0 | 24422 | <reponame>ytomino/xml-ada<filename>source/xml.ads
with Ada.IO_Exceptions;
private with Ada.Finalization;
private with C.libxml.encoding;
private with C.libxml.xmlerror;
private with C.libxml.xmlreader;
private with C.libxml.xmlwriter;
package XML is
pragma Preelaborate;
pragma Linker_Options ("-lxml2");
function Version return String;
procedure Check_Version;
procedure Cleanup; -- do finalization
type Encoding_Type is private;
function No_Encoding return Encoding_Type;
function Find (Name : String) return Encoding_Type;
function Name (Encoding : Encoding_Type) return String;
type Standalone_Type is (No_Specific, No, Yes);
for Standalone_Type use (No_Specific => -1, No => 0, Yes => 1);
package Event_Types is
type Event_Type is (
No_Event,
Element_Start,
Attribute,
Text,
CDATA,
Entity_Reference,
Entity_Start,
Processing_Instruction, -- <?xml-stylesheet ...?>
Comment,
Document, -- not used
Document_Type, -- <!DOCTYPE ...>
Document_Fragment,
Notation,
Whitespace,
Significant_Whitespace,
Element_End,
Entity_End,
XML_Declaration); -- <?xml ...?>, not used
private
use C.libxml.xmlreader;
for Event_Type use (
No_Event =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_NONE),
Element_Start =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_ELEMENT),
Attribute =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_ATTRIBUTE),
Text =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_TEXT),
CDATA =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_CDATA),
Entity_Reference =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_ENTITY_REFERENCE),
Entity_Start =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_ENTITY),
Processing_Instruction =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_PROCESSING_INSTRUCTION),
Comment =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_COMMENT),
Document =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_DOCUMENT),
Document_Type =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_DOCUMENT_TYPE),
Document_Fragment =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_DOCUMENT_FRAGMENT),
Notation =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_NOTATION),
Whitespace =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_WHITESPACE),
Significant_Whitespace =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_SIGNIFICANT_WHITESPACE),
Element_End =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_END_ELEMENT),
Entity_End =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_END_ENTITY),
XML_Declaration =>
xmlReaderTypes'Enum_Rep (XML_READER_TYPE_XML_DECLARATION));
end Event_Types;
type Event_Type is new Event_Types.Event_Type;
type Event (Event_Type : XML.Event_Type := No_Event) is record
case Event_Type is
when Element_Start | Attribute | Processing_Instruction | Document_Type =>
Name : not null access constant String;
case Event_Type is
when Attribute =>
Value : not null access constant String;
when Document_Type =>
Public_Id : access constant String;
System_Id : access constant String;
Subset : access constant String;
when others =>
null;
end case;
when Text | CDATA | Comment | Whitespace | Significant_Whitespace =>
Content : not null access constant String;
when others =>
null;
end case;
end record;
-- reader
type Parsing_Entry_Type is limited private;
pragma Preelaborable_Initialization (Parsing_Entry_Type);
function Is_Assigned (Parsing_Entry : Parsing_Entry_Type) return Boolean;
pragma Inline (Is_Assigned);
type Event_Reference_Type (
Element : not null access constant Event) is null record
with Implicit_Dereference => Element;
function Value (Parsing_Entry : aliased Parsing_Entry_Type)
return Event_Reference_Type;
pragma Inline (Value);
type Reader (<>) is limited private;
function Create (
Input : not null access procedure (Item : out String; Last : out Natural);
Encoding : Encoding_Type := No_Encoding;
URI : String := "")
return Reader;
procedure Set_DTD_Loading (Object : in out Reader; Value : in Boolean);
procedure Set_Default_Attributes (
Object : in out Reader;
Value : in Boolean);
procedure Set_Validation (Object : in out Reader; Value : in Boolean);
procedure Set_Substitute_Entities (
Object : in out Reader;
Value : in Boolean);
function Version (Object : in out Reader) return access constant String;
function Encoding (Object : in out Reader) return Encoding_Type;
function Standalone (Object : in out Reader) return Standalone_Type;
function Base_URI (Object : in out Reader) return String;
procedure Get (
Object : in out Reader;
Process : not null access procedure (Event : in XML.Event));
procedure Get (
Object : in out Reader;
Parsing_Entry : out Parsing_Entry_Type);
procedure Get_Until_Element_End (Object : in out Reader);
procedure Get_Document_Start (Object : in out Reader) is null;
procedure Get_Document_End (Object : in out Reader) is null;
procedure Finish (Object : in out Reader);
function Last_Error_Line (Object : Reader) return Natural;
function Last_Error_Message (Object : Reader) return String;
-- writer
type Writer (<>) is limited private;
function Create (
Output : not null access procedure (Item : in String);
Encoding : Encoding_Type := No_Encoding)
return Writer;
function Finished (Object : Writer) return Boolean;
pragma Inline (Finished);
procedure Flush (Object : in out Writer);
procedure Set_Indent (Object : in out Writer; Indent : in Natural);
procedure Set_Indent (Object : in out Writer; Indent : in String);
procedure Put (Object : in out Writer; Event : in XML.Event);
procedure Put_Document_Start (
Object : in out Writer;
Version : access constant String := null;
Encoding : Encoding_Type := No_Encoding;
Standalone : Standalone_Type := No_Specific);
procedure Put_Document_End (Object : in out Writer);
procedure Finish (Object : in out Writer);
-- exceptions
Status_Error : exception
renames Ada.IO_Exceptions.Status_Error;
Name_Error : exception
renames Ada.IO_Exceptions.Name_Error;
Use_Error : exception
renames Ada.IO_Exceptions.Use_Error;
Data_Error : exception
renames Ada.IO_Exceptions.Data_Error;
private
type Encoding_Type is new C.libxml.encoding.xmlCharEncodingHandlerPtr;
type String_Access is access String;
type String_Constraint is record
First : Positive;
Last : Natural;
end record;
pragma Suppress_Initialization (String_Constraint);
-- reader
type Parsed_Data_Type is limited record
Event : aliased XML.Event;
Name_Constraint : aliased String_Constraint;
Value_Constraint : aliased String_Constraint;
Public_Id_Constraint : aliased String_Constraint;
System_Id_Constraint : aliased String_Constraint;
Subset_Constraint : aliased String_Constraint;
Content_Constraint : aliased String_Constraint;
end record;
pragma Suppress_Initialization (Parsed_Data_Type);
type Parsing_Entry_Type is limited record -- may be controlled type
-- uninitialized
Data : aliased Parsed_Data_Type;
-- initialized
Assigned : Boolean := False;
end record;
type Reader_State is (
Next,
Start,
Remaining,
Empty_Element); -- have to supplement Element_End
pragma Discard_Names (Reader_State);
type Uninitialized_Non_Controlled_Reader is limited record
Last_Error : aliased C.libxml.xmlerror.xmlError;
end record;
pragma Suppress_Initialization (Uninitialized_Non_Controlled_Reader);
type Non_Controlled_Reader is limited record
-- uninitialized
U : Uninitialized_Non_Controlled_Reader;
-- initialized by Controlled_Readers.Reader
Raw : C.libxml.xmlreader.xmlTextReaderPtr;
State : Reader_State;
Error : Boolean;
Version : String_Access;
end record;
pragma Suppress_Initialization (Non_Controlled_Reader);
procedure Install_Error_Handler (
NC_Object : aliased in out Non_Controlled_Reader);
procedure Reset_Last_Error (NC_Object : in out Non_Controlled_Reader);
procedure Raise_Last_Error (NC_Object : in Non_Controlled_Reader);
package Controlled_Readers is
type Reader is limited private;
function Reference (Object : aliased in out XML.Reader)
return not null access Non_Controlled_Reader;
pragma Inline (Reference);
generic
type Result_Type (<>) is limited private;
with function Process (Raw : Non_Controlled_Reader) return Result_Type;
function Query (Object : XML.Reader) return Result_Type;
pragma Inline (Query);
generic
with procedure Process (Raw : in out Non_Controlled_Reader);
procedure Update (Object : in out XML.Reader);
pragma Inline (Update);
private
type Reader is new Ada.Finalization.Limited_Controlled
with record
Data : aliased Non_Controlled_Reader :=
(U => <>, Raw => null, State => Start, Error => False, Version => null);
end record;
overriding procedure Finalize (Object : in out Reader);
end Controlled_Readers;
type Reader is new Controlled_Readers.Reader;
-- writer
type Non_Controlled_Writer is limited record
Raw : C.libxml.xmlwriter.xmlTextWriterPtr := null;
Finished : Boolean := False;
end record;
pragma Suppress_Initialization (Non_Controlled_Writer);
package Controlled_Writers is
type Writer is limited private;
generic
type Result_Type (<>) is limited private;
with function Process (Raw : Non_Controlled_Writer) return Result_Type;
function Query (Object : XML.Writer) return Result_Type;
pragma Inline (Query);
generic
with procedure Process (Raw : in out Non_Controlled_Writer);
procedure Update (Object : in out XML.Writer);
pragma Inline (Update);
private
type Writer is new Ada.Finalization.Limited_Controlled
with record
Data : aliased Non_Controlled_Writer := (Raw => null, Finished => False);
end record;
overriding procedure Finalize (Object : in out Writer);
end Controlled_Writers;
type Writer is new Controlled_Writers.Writer;
-- exceptions
procedure Raise_Error (Error : access constant C.libxml.xmlerror.xmlError);
pragma No_Return (Raise_Error);
end XML;
|
agda/EquationalTheory.agda | ryanakca/strong-normalization | 32 | 12142 | <filename>agda/EquationalTheory.agda
module EquationalTheory where
open import Library
open import Syntax
open import RenamingAndSubstitution
-- Single collapsing substitution.
sub1 : ∀{Γ σ τ} → Tm Γ σ → Tm (Γ , σ) τ → Tm Γ τ
sub1 {Γ}{σ}{τ} u t = sub (subId , u) t
-- Typed β-η-equality.
data _≡βη_ {Γ : Cxt} : ∀{σ} → Tm Γ σ → Tm Γ σ → Set where
-- Axioms.
beta≡ : ∀{σ τ} {t : Tm (Γ , σ) τ} {u : Tm Γ σ} →
--------------------------
app (abs t) u ≡βη sub1 u t
eta≡ : ∀{σ τ} (t : Tm Γ (σ ⇒ τ)) →
-------------------------------------
abs (app (weak _ t) (var zero)) ≡βη t
-- Congruence rules.
var≡ : ∀{σ} (x : Var Γ σ) →
---------------
var x ≡βη var x
abs≡ : ∀{σ τ}{t t' : Tm (Γ , σ) τ} →
t ≡βη t' →
----------------
abs t ≡βη abs t'
app≡ : ∀{σ τ}{t t' : Tm Γ (σ ⇒ τ)}{u u' : Tm Γ σ} →
t ≡βη t' → u ≡βη u' →
---------------------
app t u ≡βη app t' u'
-- Equivalence rules.
refl≡ : ∀{a} (t {t'} : Tm Γ a) →
t ≡ t' →
-------
t ≡βη t'
sym≡ : ∀{a}{t t' : Tm Γ a}
(t'≡t : t' ≡βη t) →
-----------------
t ≡βη t'
trans≡ : ∀{a}{t₁ t₂ t₃ : Tm Γ a}
(t₁≡t₂ : t₁ ≡βη t₂) (t₂≡t₃ : t₂ ≡βη t₃) →
----------------------------------
t₁ ≡βη t₃
-- A calculation on renamings needed for renaming of eta≡.
ren-eta≡ : ∀ {Γ Δ a b} (t : Tm Γ (a ⇒ b)) (ρ : Ren Δ Γ) →
ren (wkr ρ , zero) (ren (wkr renId) t) ≡ ren (wkr {σ = a} renId) (ren ρ t)
ren-eta≡ t ρ = begin
ren (wkr ρ , zero) (ren (wkr renId) t) ≡⟨ sym (rencomp _ _ _) ⟩
ren (renComp (wkr ρ , zero) (wkr renId)) t ≡⟨ cong (λ ρ₁ → ren ρ₁ t) (lemrr _ _ _) ⟩
ren (renComp (wkr ρ) renId) t ≡⟨ cong (λ ρ₁ → ren ρ₁ t) (ridr _) ⟩
ren (wkr ρ) t ≡⟨ cong (λ ρ₁ → ren ρ₁ t) (cong wkr (sym (lidr _))) ⟩
ren (wkr (renComp renId ρ)) t ≡⟨ cong (λ ρ₁ → ren ρ₁ t) (sym (wkrcomp _ _)) ⟩
ren (renComp (wkr renId) ρ) t ≡⟨ rencomp _ _ _ ⟩
ren (wkr renId) (ren ρ t) ∎ where open ≡-Reasoning
-- Definitional equality is closed under renaming.
ren≡βη : ∀{Γ a} {t : Tm Γ a}{t' : Tm Γ a} → t ≡βη t' → ∀{Δ}(ρ : Ren Δ Γ) →
ren ρ t ≡βη ren ρ t'
ren≡βη (beta≡ {t = t}{u = u}) ρ = trans≡ beta≡ $ refl≡ _ $
trans (subren (subId , ren ρ u) (liftr ρ) t)
(trans (cong (λ xs → sub xs t)
(cong₂ Sub._,_
(trans (lemsr subId (ren ρ u) ρ)
(trans (sidl (ren2sub ρ)) (sym $ sidr (ren2sub ρ))))
(ren2subren ρ u)))
(sym $ rensub ρ (subId , u) t))
-- TODO: factor out reasoning about renamings and substitutions
ren≡βη (eta≡ {a} t) ρ rewrite ren-eta≡ t ρ = eta≡ (ren ρ t)
-- OLD:
-- ren≡βη (eta≡ t) ρ = trans≡
-- (abs≡ (app≡ (refl≡ _
-- (trans (sym $ rencomp (liftr ρ) (wkr renId) t)
-- (trans (cong (λ xs → ren xs t)
-- (trans (lemrr (wkr ρ) zero renId)
-- (trans (ridr (wkr ρ))
-- (trans (cong wkr (sym (lidr ρ)))
-- (sym (wkrcomp renId ρ))))))
-- (rencomp (wkr renId) ρ t))))
-- (refl≡ _)))
-- (eta≡ _)
ren≡βη (var≡ x) ρ = var≡ (lookr ρ x)
ren≡βη (abs≡ p) ρ = abs≡ (ren≡βη p (liftr ρ))
ren≡βη (app≡ p q) ρ = app≡ (ren≡βη p ρ) (ren≡βη q ρ)
ren≡βη (refl≡ _ refl) ρ = refl≡ _ refl
ren≡βη (sym≡ p) ρ = sym≡ (ren≡βη p ρ)
ren≡βη (trans≡ p q) ρ = trans≡ (ren≡βη p ρ) (ren≡βη q ρ)
|
include/pthread_h.ads | docandrew/troodon | 5 | 20482 | <reponame>docandrew/troodon
pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with System;
with bits_pthreadtypes_h;
limited with bits_types_struct_timespec_h;
with bits_types_clockid_t_h;
with stddef_h;
limited with bits_types_struct_sched_param_h;
limited with bits_cpu_set_h;
limited with bits_types_u_sigset_t_h;
with Interfaces.C.Strings;
with bits_setjmp_h;
with bits_types_h;
package pthread_h is
-- unsupported macro: PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
-- unsupported macro: PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
-- unsupported macro: PTHREAD_MUTEX_INITIALIZER { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_TIMED_NP) } }
-- unsupported macro: PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
-- unsupported macro: PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
-- unsupported macro: PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
-- unsupported macro: PTHREAD_RWLOCK_INITIALIZER { { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_DEFAULT_NP) } }
-- unsupported macro: PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP { { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) } }
-- unsupported macro: PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED
-- unsupported macro: PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED
-- unsupported macro: PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
-- unsupported macro: PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
-- unsupported macro: PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
-- unsupported macro: PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
-- unsupported macro: PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
-- unsupported macro: PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
-- unsupported macro: PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
-- unsupported macro: PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
-- unsupported macro: PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
-- unsupported macro: PTHREAD_CANCELED ((void *) -1)
PTHREAD_ONCE_INIT : constant := 0; -- /usr/include/pthread.h:184
PTHREAD_BARRIER_SERIAL_THREAD : constant := -1; -- /usr/include/pthread.h:191
PTHREAD_ATTR_NO_SIGMASK_NP : constant := (-1); -- /usr/include/pthread.h:402
-- arg-macro: procedure pthread_cleanup_push (routine, arg)
-- do { __pthread_cleanup_class __clframe (routine, arg)
-- arg-macro: procedure pthread_cleanup_pop (execute)
-- __clframe.__setdoit (execute); } while (0)
-- arg-macro: procedure pthread_cleanup_push_defer_np (routine, arg)
-- do { __pthread_cleanup_class __clframe (routine, arg); __clframe.__defer ()
-- arg-macro: procedure pthread_cleanup_pop_restore_np (execute)
-- __clframe.__restore (); __clframe.__setdoit (execute); } while (0)
-- Copyright (C) 2002-2021 Free Software Foundation, Inc.
-- This file is part of the GNU C Library.
-- The GNU C Library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
-- The GNU C Library 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
-- Lesser General Public License for more details.
-- You should have received a copy of the GNU Lesser General Public
-- License along with the GNU C Library; if not, see
-- <https://www.gnu.org/licenses/>.
-- Detach state.
-- Mutex types.
-- For compatibility.
-- Robust mutex or not flags.
-- Mutex protocols.
-- Read-write lock types.
-- Read-write lock initializers.
-- Scheduler inheritance.
-- Scope handling.
-- Process shared or private flag.
-- Conditional variable handling.
-- Cleanup buffers
-- Function to call.
type u_pthread_cleanup_buffer;
type u_pthread_cleanup_buffer is record
uu_routine : access procedure (arg1 : System.Address); -- /usr/include/pthread.h:159
uu_arg : System.Address; -- /usr/include/pthread.h:160
uu_canceltype : aliased int; -- /usr/include/pthread.h:161
uu_prev : access u_pthread_cleanup_buffer; -- /usr/include/pthread.h:162
end record
with Convention => C_Pass_By_Copy; -- /usr/include/pthread.h:157
-- Its argument.
-- Saved cancellation type.
-- Chaining of cleanup functions.
-- Cancellation
-- Single execution handling.
-- Value returned by 'pthread_barrier_wait' for one of the threads after
-- the required number of threads have called this function.
-- -1 is distinct from 0 and all errno constants
-- Create a new thread, starting with execution of START-ROUTINE
-- getting passed ARG. Creation attributed come from ATTR. The new
-- handle is stored in *NEWTHREAD.
function pthread_create
(uu_newthread : access bits_pthreadtypes_h.pthread_t;
uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t;
uu_start_routine : access function (arg1 : System.Address) return System.Address;
uu_arg : System.Address) return int -- /usr/include/pthread.h:200
with Import => True,
Convention => C,
External_Name => "pthread_create";
-- Terminate calling thread.
-- The registered cleanup handlers are called via exception handling
-- so we cannot mark this function with __THROW.
procedure pthread_exit (uu_retval : System.Address) -- /usr/include/pthread.h:209
with Import => True,
Convention => C,
External_Name => "pthread_exit";
-- Make calling thread wait for termination of the thread TH. The
-- exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN
-- is not NULL.
-- This function is a cancellation point and therefore not marked with
-- __THROW.
function pthread_join (uu_th : bits_pthreadtypes_h.pthread_t; uu_thread_return : System.Address) return int -- /usr/include/pthread.h:217
with Import => True,
Convention => C,
External_Name => "pthread_join";
-- Check whether thread TH has terminated. If yes return the status of
-- the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL.
function pthread_tryjoin_np (uu_th : bits_pthreadtypes_h.pthread_t; uu_thread_return : System.Address) return int -- /usr/include/pthread.h:222
with Import => True,
Convention => C,
External_Name => "pthread_tryjoin_np";
-- Make calling thread wait for termination of the thread TH, but only
-- until TIMEOUT. The exit status of the thread is stored in
-- *THREAD_RETURN, if THREAD_RETURN is not NULL.
-- This function is a cancellation point and therefore not marked with
-- __THROW.
function pthread_timedjoin_np
(uu_th : bits_pthreadtypes_h.pthread_t;
uu_thread_return : System.Address;
uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:230
with Import => True,
Convention => C,
External_Name => "pthread_timedjoin_np";
-- Make calling thread wait for termination of the thread TH, but only
-- until TIMEOUT measured against the clock specified by CLOCKID. The
-- exit status of the thread is stored in *THREAD_RETURN, if
-- THREAD_RETURN is not NULL.
-- This function is a cancellation point and therefore not marked with
-- __THROW.
function pthread_clockjoin_np
(uu_th : bits_pthreadtypes_h.pthread_t;
uu_thread_return : System.Address;
uu_clockid : bits_types_clockid_t_h.clockid_t;
uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:240
with Import => True,
Convention => C,
External_Name => "pthread_clockjoin_np";
-- Indicate that the thread TH is never to be joined with PTHREAD_JOIN.
-- The resources of TH will therefore be freed immediately when it
-- terminates, instead of waiting for another thread to perform PTHREAD_JOIN
-- on it.
function pthread_detach (uu_th : bits_pthreadtypes_h.pthread_t) return int -- /usr/include/pthread.h:249
with Import => True,
Convention => C,
External_Name => "pthread_detach";
-- Obtain the identifier of the current thread.
function pthread_self return bits_pthreadtypes_h.pthread_t -- /usr/include/pthread.h:253
with Import => True,
Convention => C,
External_Name => "pthread_self";
-- Compare two thread identifiers.
function pthread_equal (uu_thread1 : bits_pthreadtypes_h.pthread_t; uu_thread2 : bits_pthreadtypes_h.pthread_t) return int -- /usr/include/pthread.h:256
with Import => True,
Convention => C,
External_Name => "pthread_equal";
-- Thread attribute handling.
-- Initialize thread attribute *ATTR with default attributes
-- (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER,
-- no user-provided stack).
function pthread_attr_init (uu_attr : access bits_pthreadtypes_h.pthread_attr_t) return int -- /usr/include/pthread.h:265
with Import => True,
Convention => C,
External_Name => "pthread_attr_init";
-- Destroy thread attribute *ATTR.
function pthread_attr_destroy (uu_attr : access bits_pthreadtypes_h.pthread_attr_t) return int -- /usr/include/pthread.h:268
with Import => True,
Convention => C,
External_Name => "pthread_attr_destroy";
-- Get detach state attribute.
function pthread_attr_getdetachstate (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_detachstate : access int) return int -- /usr/include/pthread.h:272
with Import => True,
Convention => C,
External_Name => "pthread_attr_getdetachstate";
-- Set detach state attribute.
function pthread_attr_setdetachstate (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_detachstate : int) return int -- /usr/include/pthread.h:277
with Import => True,
Convention => C,
External_Name => "pthread_attr_setdetachstate";
-- Get the size of the guard area created for stack overflow protection.
function pthread_attr_getguardsize (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_guardsize : access stddef_h.size_t) return int -- /usr/include/pthread.h:283
with Import => True,
Convention => C,
External_Name => "pthread_attr_getguardsize";
-- Set the size of the guard area created for stack overflow protection.
function pthread_attr_setguardsize (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_guardsize : stddef_h.size_t) return int -- /usr/include/pthread.h:288
with Import => True,
Convention => C,
External_Name => "pthread_attr_setguardsize";
-- Return in *PARAM the scheduling parameters of *ATTR.
function pthread_attr_getschedparam (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_param : access bits_types_struct_sched_param_h.sched_param) return int -- /usr/include/pthread.h:294
with Import => True,
Convention => C,
External_Name => "pthread_attr_getschedparam";
-- Set scheduling parameters (priority, etc) in *ATTR according to PARAM.
function pthread_attr_setschedparam (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_param : access constant bits_types_struct_sched_param_h.sched_param) return int -- /usr/include/pthread.h:299
with Import => True,
Convention => C,
External_Name => "pthread_attr_setschedparam";
-- Return in *POLICY the scheduling policy of *ATTR.
function pthread_attr_getschedpolicy (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_policy : access int) return int -- /usr/include/pthread.h:304
with Import => True,
Convention => C,
External_Name => "pthread_attr_getschedpolicy";
-- Set scheduling policy in *ATTR according to POLICY.
function pthread_attr_setschedpolicy (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_policy : int) return int -- /usr/include/pthread.h:309
with Import => True,
Convention => C,
External_Name => "pthread_attr_setschedpolicy";
-- Return in *INHERIT the scheduling inheritance mode of *ATTR.
function pthread_attr_getinheritsched (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_inherit : access int) return int -- /usr/include/pthread.h:313
with Import => True,
Convention => C,
External_Name => "pthread_attr_getinheritsched";
-- Set scheduling inheritance mode in *ATTR according to INHERIT.
function pthread_attr_setinheritsched (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_inherit : int) return int -- /usr/include/pthread.h:318
with Import => True,
Convention => C,
External_Name => "pthread_attr_setinheritsched";
-- Return in *SCOPE the scheduling contention scope of *ATTR.
function pthread_attr_getscope (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_scope : access int) return int -- /usr/include/pthread.h:324
with Import => True,
Convention => C,
External_Name => "pthread_attr_getscope";
-- Set scheduling contention scope in *ATTR according to SCOPE.
function pthread_attr_setscope (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_scope : int) return int -- /usr/include/pthread.h:329
with Import => True,
Convention => C,
External_Name => "pthread_attr_setscope";
-- Return the previously set address for the stack.
function pthread_attr_getstackaddr (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_stackaddr : System.Address) return int -- /usr/include/pthread.h:333
with Import => True,
Convention => C,
External_Name => "pthread_attr_getstackaddr";
-- Set the starting address of the stack of the thread to be created.
-- Depending on whether the stack grows up or down the value must either
-- be higher or lower than all the address in the memory block. The
-- minimal size of the block must be PTHREAD_STACK_MIN.
function pthread_attr_setstackaddr (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_stackaddr : System.Address) return int -- /usr/include/pthread.h:341
with Import => True,
Convention => C,
External_Name => "pthread_attr_setstackaddr";
-- Return the currently used minimal stack size.
function pthread_attr_getstacksize (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; uu_stacksize : access stddef_h.size_t) return int -- /usr/include/pthread.h:346
with Import => True,
Convention => C,
External_Name => "pthread_attr_getstacksize";
-- Add information about the minimum stack size needed for the thread
-- to be started. This size must never be less than PTHREAD_STACK_MIN
-- and must also not exceed the system limits.
function pthread_attr_setstacksize (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; uu_stacksize : stddef_h.size_t) return int -- /usr/include/pthread.h:353
with Import => True,
Convention => C,
External_Name => "pthread_attr_setstacksize";
-- Return the previously set address for the stack.
function pthread_attr_getstack
(uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t;
uu_stackaddr : System.Address;
uu_stacksize : access stddef_h.size_t) return int -- /usr/include/pthread.h:359
with Import => True,
Convention => C,
External_Name => "pthread_attr_getstack";
-- The following two interfaces are intended to replace the last two. They
-- require setting the address as well as the size since only setting the
-- address will make the implementation on some architectures impossible.
function pthread_attr_setstack
(uu_attr : access bits_pthreadtypes_h.pthread_attr_t;
uu_stackaddr : System.Address;
uu_stacksize : stddef_h.size_t) return int -- /usr/include/pthread.h:367
with Import => True,
Convention => C,
External_Name => "pthread_attr_setstack";
-- Thread created with attribute ATTR will be limited to run only on
-- the processors represented in CPUSET.
function pthread_attr_setaffinity_np
(uu_attr : access bits_pthreadtypes_h.pthread_attr_t;
uu_cpusetsize : stddef_h.size_t;
uu_cpuset : access constant bits_cpu_set_h.cpu_set_t) return int -- /usr/include/pthread.h:374
with Import => True,
Convention => C,
External_Name => "pthread_attr_setaffinity_np";
-- Get bit set in CPUSET representing the processors threads created with
-- ATTR can run on.
function pthread_attr_getaffinity_np
(uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t;
uu_cpusetsize : stddef_h.size_t;
uu_cpuset : access bits_cpu_set_h.cpu_set_t) return int -- /usr/include/pthread.h:381
with Import => True,
Convention => C,
External_Name => "pthread_attr_getaffinity_np";
-- Get the default attributes used by pthread_create in this process.
function pthread_getattr_default_np (uu_attr : access bits_pthreadtypes_h.pthread_attr_t) return int -- /usr/include/pthread.h:387
with Import => True,
Convention => C,
External_Name => "pthread_getattr_default_np";
-- Store *SIGMASK as the signal mask for the new thread in *ATTR.
function pthread_attr_setsigmask_np (uu_attr : access bits_pthreadtypes_h.pthread_attr_t; sigmask : access constant bits_types_u_sigset_t_h.uu_sigset_t) return int -- /usr/include/pthread.h:391
with Import => True,
Convention => C,
External_Name => "pthread_attr_setsigmask_np";
-- Store the signal mask of *ATTR in *SIGMASK. If there is no signal
-- mask stored, return PTHREAD_ATTR_NOSIGMASK_NP. Return zero on
-- success.
function pthread_attr_getsigmask_np (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t; sigmask : access bits_types_u_sigset_t_h.uu_sigset_t) return int -- /usr/include/pthread.h:397
with Import => True,
Convention => C,
External_Name => "pthread_attr_getsigmask_np";
-- Special return value from pthread_attr_getsigmask_np if the signal
-- mask has not been set.
-- Set the default attributes to be used by pthread_create in this
-- process.
function pthread_setattr_default_np (uu_attr : access constant bits_pthreadtypes_h.pthread_attr_t) return int -- /usr/include/pthread.h:406
with Import => True,
Convention => C,
External_Name => "pthread_setattr_default_np";
-- Initialize thread attribute *ATTR with attributes corresponding to the
-- already running thread TH. It shall be called on uninitialized ATTR
-- and destroyed with pthread_attr_destroy when no longer needed.
function pthread_getattr_np (uu_th : bits_pthreadtypes_h.pthread_t; uu_attr : access bits_pthreadtypes_h.pthread_attr_t) return int -- /usr/include/pthread.h:412
with Import => True,
Convention => C,
External_Name => "pthread_getattr_np";
-- Functions for scheduling control.
-- Set the scheduling parameters for TARGET_THREAD according to POLICY
-- and *PARAM.
function pthread_setschedparam
(uu_target_thread : bits_pthreadtypes_h.pthread_t;
uu_policy : int;
uu_param : access constant bits_types_struct_sched_param_h.sched_param) return int -- /usr/include/pthread.h:421
with Import => True,
Convention => C,
External_Name => "pthread_setschedparam";
-- Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD.
function pthread_getschedparam
(uu_target_thread : bits_pthreadtypes_h.pthread_t;
uu_policy : access int;
uu_param : access bits_types_struct_sched_param_h.sched_param) return int -- /usr/include/pthread.h:426
with Import => True,
Convention => C,
External_Name => "pthread_getschedparam";
-- Set the scheduling priority for TARGET_THREAD.
function pthread_setschedprio (uu_target_thread : bits_pthreadtypes_h.pthread_t; uu_prio : int) return int -- /usr/include/pthread.h:432
with Import => True,
Convention => C,
External_Name => "pthread_setschedprio";
-- Get thread name visible in the kernel and its interfaces.
function pthread_getname_np
(uu_target_thread : bits_pthreadtypes_h.pthread_t;
uu_buf : Interfaces.C.Strings.chars_ptr;
uu_buflen : stddef_h.size_t) return int -- /usr/include/pthread.h:438
with Import => True,
Convention => C,
External_Name => "pthread_getname_np";
-- Set thread name visible in the kernel and its interfaces.
function pthread_setname_np (uu_target_thread : bits_pthreadtypes_h.pthread_t; uu_name : Interfaces.C.Strings.chars_ptr) return int -- /usr/include/pthread.h:443
with Import => True,
Convention => C,
External_Name => "pthread_setname_np";
-- Determine level of concurrency.
function pthread_getconcurrency return int -- /usr/include/pthread.h:450
with Import => True,
Convention => C,
External_Name => "pthread_getconcurrency";
-- Set new concurrency level to LEVEL.
function pthread_setconcurrency (uu_level : int) return int -- /usr/include/pthread.h:453
with Import => True,
Convention => C,
External_Name => "pthread_setconcurrency";
-- Yield the processor to another thread or process.
-- This function is similar to the POSIX `sched_yield' function but
-- might be differently implemented in the case of a m-on-n thread
-- implementation.
function pthread_yield return int -- /usr/include/pthread.h:461
with Import => True,
Convention => C,
External_Name => "pthread_yield";
-- Limit specified thread TH to run only on the processors represented
-- in CPUSET.
function pthread_setaffinity_np
(uu_th : bits_pthreadtypes_h.pthread_t;
uu_cpusetsize : stddef_h.size_t;
uu_cpuset : access constant bits_cpu_set_h.cpu_set_t) return int -- /usr/include/pthread.h:466
with Import => True,
Convention => C,
External_Name => "pthread_setaffinity_np";
-- Get bit set in CPUSET representing the processors TH can run on.
function pthread_getaffinity_np
(uu_th : bits_pthreadtypes_h.pthread_t;
uu_cpusetsize : stddef_h.size_t;
uu_cpuset : access bits_cpu_set_h.cpu_set_t) return int -- /usr/include/pthread.h:471
with Import => True,
Convention => C,
External_Name => "pthread_getaffinity_np";
-- Functions for handling initialization.
-- Guarantee that the initialization function INIT_ROUTINE will be called
-- only once, even if pthread_once is executed several times with the
-- same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or
-- extern variable initialized to PTHREAD_ONCE_INIT.
-- The initialization functions might throw exception which is why
-- this function is not marked with __THROW.
function pthread_once (uu_once_control : access bits_pthreadtypes_h.pthread_once_t; uu_init_routine : access procedure) return int -- /usr/include/pthread.h:486
with Import => True,
Convention => C,
External_Name => "pthread_once";
-- Functions for handling cancellation.
-- Note that these functions are explicitly not marked to not throw an
-- exception in C++ code. If cancellation is implemented by unwinding
-- this is necessary to have the compiler generate the unwind information.
-- Set cancelability state of current thread to STATE, returning old
-- state in *OLDSTATE if OLDSTATE is not NULL.
function pthread_setcancelstate (uu_state : int; uu_oldstate : access int) return int -- /usr/include/pthread.h:498
with Import => True,
Convention => C,
External_Name => "pthread_setcancelstate";
-- Set cancellation state of current thread to TYPE, returning the old
-- type in *OLDTYPE if OLDTYPE is not NULL.
function pthread_setcanceltype (uu_type : int; uu_oldtype : access int) return int -- /usr/include/pthread.h:502
with Import => True,
Convention => C,
External_Name => "pthread_setcanceltype";
-- Cancel THREAD immediately or at the next possibility.
function pthread_cancel (uu_th : bits_pthreadtypes_h.pthread_t) return int -- /usr/include/pthread.h:505
with Import => True,
Convention => C,
External_Name => "pthread_cancel";
-- Test for pending cancellation for the current thread and terminate
-- the thread as per pthread_exit(PTHREAD_CANCELED) if it has been
-- cancelled.
procedure pthread_testcancel -- /usr/include/pthread.h:510
with Import => True,
Convention => C,
External_Name => "pthread_testcancel";
-- Cancellation handling with integration into exception handling.
type uu_cancel_jmp_buf_tag is record
uu_cancel_jmp_buf : aliased bits_setjmp_h.uu_jmp_buf; -- /usr/include/pthread.h:517
uu_mask_was_saved : aliased int; -- /usr/include/pthread.h:518
end record
with Convention => C_Pass_By_Copy; -- /usr/include/pthread.h:515
-- skipped anonymous struct anon_27
type uu_pthread_unwind_buf_t_array1432 is array (0 .. 0) of aliased uu_cancel_jmp_buf_tag;
type uu_pthread_unwind_buf_t_array1433 is array (0 .. 3) of System.Address;
type uu_pthread_unwind_buf_t is record
uu_cancel_jmp_buf : aliased uu_pthread_unwind_buf_t_array1432; -- /usr/include/pthread.h:523
uu_pad : uu_pthread_unwind_buf_t_array1433; -- /usr/include/pthread.h:524
end record
with Convention => C_Pass_By_Copy; -- /usr/include/pthread.h:525
-- No special attributes by default.
-- Structure to hold the cleanup handler information.
type uu_pthread_cleanup_frame is record
uu_cancel_routine : access procedure (arg1 : System.Address); -- /usr/include/pthread.h:536
uu_cancel_arg : System.Address; -- /usr/include/pthread.h:537
uu_do_it : aliased int; -- /usr/include/pthread.h:538
uu_cancel_type : aliased int; -- /usr/include/pthread.h:539
end record
with Convention => C_Pass_By_Copy; -- /usr/include/pthread.h:534
-- Class to handle cancellation handler invocation.
package Class_uu_pthread_cleanup_class is
type uu_pthread_cleanup_class is limited record
uu_cancel_routine : access procedure (arg1 : System.Address); -- /usr/include/pthread.h:547
uu_cancel_arg : System.Address; -- /usr/include/pthread.h:548
uu_do_it : aliased int; -- /usr/include/pthread.h:549
uu_cancel_type : aliased int; -- /usr/include/pthread.h:550
end record
with Import => True,
Convention => CPP;
function New_uu_pthread_cleanup_class (uu_fct : access procedure (arg1 : System.Address); uu_arg : System.Address) return uu_pthread_cleanup_class; -- /usr/include/pthread.h:553
pragma CPP_Constructor (New_uu_pthread_cleanup_class, "_ZN23__pthread_cleanup_classC1EPFvPvES0_");
procedure Delete_uu_pthread_cleanup_class (this : access uu_pthread_cleanup_class) -- /usr/include/pthread.h:555
with Import => True,
Convention => CPP,
External_Name => "_ZN23__pthread_cleanup_classD1Ev";
-- skipped func __setdoit
-- skipped func __defer
-- skipped func __restore
end;
use Class_uu_pthread_cleanup_class;
-- Install a cleanup handler: ROUTINE will be called with arguments ARG
-- when the thread is canceled or calls pthread_exit. ROUTINE will also
-- be called with arguments ARG when the matching pthread_cleanup_pop
-- is executed with non-zero EXECUTE argument.
-- pthread_cleanup_push and pthread_cleanup_pop are macros and must always
-- be used in matching pairs at the same nesting level of braces.
-- Remove a cleanup handler installed by the matching pthread_cleanup_push.
-- If EXECUTE is non-zero, the handler function is called.
-- Install a cleanup handler as pthread_cleanup_push does, but also
-- saves the current cancellation type and sets it to deferred
-- cancellation.
-- Remove a cleanup handler as pthread_cleanup_pop does, but also
-- restores the cancellation type that was in effect when the matching
-- pthread_cleanup_push_defer was called.
-- Function called to call the cleanup handler. As an extern inline
-- function the compiler is free to decide inlining the change when
-- needed or fall back on the copy which must exist somewhere
-- else.
-- Install a cleanup handler: ROUTINE will be called with arguments ARG
-- when the thread is canceled or calls pthread_exit. ROUTINE will also
-- be called with arguments ARG when the matching pthread_cleanup_pop
-- is executed with non-zero EXECUTE argument.
-- pthread_cleanup_push and pthread_cleanup_pop are macros and must always
-- be used in matching pairs at the same nesting level of braces.
-- Remove a cleanup handler installed by the matching pthread_cleanup_push.
-- If EXECUTE is non-zero, the handler function is called.
-- Install a cleanup handler as pthread_cleanup_push does, but also
-- saves the current cancellation type and sets it to deferred
-- cancellation.
-- Remove a cleanup handler as pthread_cleanup_pop does, but also
-- restores the cancellation type that was in effect when the matching
-- pthread_cleanup_push_defer was called.
-- Install a cleanup handler: ROUTINE will be called with arguments ARG
-- when the thread is canceled or calls pthread_exit. ROUTINE will also
-- be called with arguments ARG when the matching pthread_cleanup_pop
-- is executed with non-zero EXECUTE argument.
-- pthread_cleanup_push and pthread_cleanup_pop are macros and must always
-- be used in matching pairs at the same nesting level of braces.
-- Remove a cleanup handler installed by the matching pthread_cleanup_push.
-- If EXECUTE is non-zero, the handler function is called.
-- Install a cleanup handler as pthread_cleanup_push does, but also
-- saves the current cancellation type and sets it to deferred
-- cancellation.
-- Remove a cleanup handler as pthread_cleanup_pop does, but also
-- restores the cancellation type that was in effect when the matching
-- pthread_cleanup_push_defer was called.
-- Internal interface to initiate cleanup.
-- Function used in the macros. Calling __sigsetjmp, with its first
-- argument declared as an array, results in a -Wstringop-overflow
-- warning from GCC 11 because struct pthread_unwind_buf is smaller
-- than jmp_buf. The calls from the macros have __SAVEMASK set to 0,
-- so nothing beyond the common prefix is used and this warning is a
-- false positive. Use an alias with its first argument declared to
-- use the type in the macros if possible to avoid this warning.
-- skipped func __sigsetjmp
-- Mutex handling.
-- Initialize a mutex.
function pthread_mutex_init (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t; uu_mutexattr : access constant bits_pthreadtypes_h.pthread_mutexattr_t) return int -- /usr/include/pthread.h:758
with Import => True,
Convention => C,
External_Name => "pthread_mutex_init";
-- Destroy a mutex.
function pthread_mutex_destroy (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t) return int -- /usr/include/pthread.h:763
with Import => True,
Convention => C,
External_Name => "pthread_mutex_destroy";
-- Try locking a mutex.
function pthread_mutex_trylock (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t) return int -- /usr/include/pthread.h:767
with Import => True,
Convention => C,
External_Name => "pthread_mutex_trylock";
-- Lock a mutex.
function pthread_mutex_lock (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t) return int -- /usr/include/pthread.h:771
with Import => True,
Convention => C,
External_Name => "pthread_mutex_lock";
-- Wait until lock becomes available, or specified time passes.
function pthread_mutex_timedlock (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t; uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:776
with Import => True,
Convention => C,
External_Name => "pthread_mutex_timedlock";
function pthread_mutex_clocklock
(uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t;
uu_clockid : bits_types_clockid_t_h.clockid_t;
uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:782
with Import => True,
Convention => C,
External_Name => "pthread_mutex_clocklock";
-- Unlock a mutex.
function pthread_mutex_unlock (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t) return int -- /usr/include/pthread.h:789
with Import => True,
Convention => C,
External_Name => "pthread_mutex_unlock";
-- Get the priority ceiling of MUTEX.
function pthread_mutex_getprioceiling (uu_mutex : access constant bits_pthreadtypes_h.pthread_mutex_t; uu_prioceiling : access int) return int -- /usr/include/pthread.h:794
with Import => True,
Convention => C,
External_Name => "pthread_mutex_getprioceiling";
-- Set the priority ceiling of MUTEX to PRIOCEILING, return old
-- priority ceiling value in *OLD_CEILING.
function pthread_mutex_setprioceiling
(uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t;
uu_prioceiling : int;
uu_old_ceiling : access int) return int -- /usr/include/pthread.h:801
with Import => True,
Convention => C,
External_Name => "pthread_mutex_setprioceiling";
-- Declare the state protected by MUTEX as consistent.
function pthread_mutex_consistent (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t) return int -- /usr/include/pthread.h:809
with Import => True,
Convention => C,
External_Name => "pthread_mutex_consistent";
function pthread_mutex_consistent_np (uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t) return int -- /usr/include/pthread.h:812
with Import => True,
Convention => C,
External_Name => "pthread_mutex_consistent_np";
-- Functions for handling mutex attributes.
-- Initialize mutex attribute object ATTR with default attributes
-- (kind is PTHREAD_MUTEX_TIMED_NP).
function pthread_mutexattr_init (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t) return int -- /usr/include/pthread.h:822
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_init";
-- Destroy mutex attribute object ATTR.
function pthread_mutexattr_destroy (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t) return int -- /usr/include/pthread.h:826
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_destroy";
-- Get the process-shared flag of the mutex attribute ATTR.
function pthread_mutexattr_getpshared (uu_attr : access constant bits_pthreadtypes_h.pthread_mutexattr_t; uu_pshared : access int) return int -- /usr/include/pthread.h:830
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_getpshared";
-- Set the process-shared flag of the mutex attribute ATTR.
function pthread_mutexattr_setpshared (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t; uu_pshared : int) return int -- /usr/include/pthread.h:836
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_setpshared";
-- Return in *KIND the mutex kind attribute in *ATTR.
function pthread_mutexattr_gettype (uu_attr : access constant bits_pthreadtypes_h.pthread_mutexattr_t; uu_kind : access int) return int -- /usr/include/pthread.h:842
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_gettype";
-- Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL,
-- PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or
-- PTHREAD_MUTEX_DEFAULT).
function pthread_mutexattr_settype (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t; uu_kind : int) return int -- /usr/include/pthread.h:849
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_settype";
-- Return in *PROTOCOL the mutex protocol attribute in *ATTR.
function pthread_mutexattr_getprotocol (uu_attr : access constant bits_pthreadtypes_h.pthread_mutexattr_t; uu_protocol : access int) return int -- /usr/include/pthread.h:854
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_getprotocol";
-- Set the mutex protocol attribute in *ATTR to PROTOCOL (either
-- PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT).
function pthread_mutexattr_setprotocol (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t; uu_protocol : int) return int -- /usr/include/pthread.h:861
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_setprotocol";
-- Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR.
function pthread_mutexattr_getprioceiling (uu_attr : access constant bits_pthreadtypes_h.pthread_mutexattr_t; uu_prioceiling : access int) return int -- /usr/include/pthread.h:866
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_getprioceiling";
-- Set the mutex prioceiling attribute in *ATTR to PRIOCEILING.
function pthread_mutexattr_setprioceiling (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t; uu_prioceiling : int) return int -- /usr/include/pthread.h:872
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_setprioceiling";
-- Get the robustness flag of the mutex attribute ATTR.
function pthread_mutexattr_getrobust (uu_attr : access constant bits_pthreadtypes_h.pthread_mutexattr_t; uu_robustness : access int) return int -- /usr/include/pthread.h:878
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_getrobust";
function pthread_mutexattr_getrobust_np (uu_attr : access constant bits_pthreadtypes_h.pthread_mutexattr_t; uu_robustness : access int) return int -- /usr/include/pthread.h:882
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_getrobust_np";
-- Set the robustness flag of the mutex attribute ATTR.
function pthread_mutexattr_setrobust (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t; uu_robustness : int) return int -- /usr/include/pthread.h:888
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_setrobust";
function pthread_mutexattr_setrobust_np (uu_attr : access bits_pthreadtypes_h.pthread_mutexattr_t; uu_robustness : int) return int -- /usr/include/pthread.h:892
with Import => True,
Convention => C,
External_Name => "pthread_mutexattr_setrobust_np";
-- Functions for handling read-write locks.
-- Initialize read-write lock RWLOCK using attributes ATTR, or use
-- the default values if later is NULL.
function pthread_rwlock_init (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t; uu_attr : access constant bits_pthreadtypes_h.pthread_rwlockattr_t) return int -- /usr/include/pthread.h:904
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_init";
-- Destroy read-write lock RWLOCK.
function pthread_rwlock_destroy (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t) return int -- /usr/include/pthread.h:909
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_destroy";
-- Acquire read lock for RWLOCK.
function pthread_rwlock_rdlock (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t) return int -- /usr/include/pthread.h:913
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_rdlock";
-- Try to acquire read lock for RWLOCK.
function pthread_rwlock_tryrdlock (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t) return int -- /usr/include/pthread.h:917
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_tryrdlock";
-- Try to acquire read lock for RWLOCK or return after specfied time.
function pthread_rwlock_timedrdlock (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t; uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:922
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_timedrdlock";
function pthread_rwlock_clockrdlock
(uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t;
uu_clockid : bits_types_clockid_t_h.clockid_t;
uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:928
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_clockrdlock";
-- Acquire write lock for RWLOCK.
function pthread_rwlock_wrlock (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t) return int -- /usr/include/pthread.h:935
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_wrlock";
-- Try to acquire write lock for RWLOCK.
function pthread_rwlock_trywrlock (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t) return int -- /usr/include/pthread.h:939
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_trywrlock";
-- Try to acquire write lock for RWLOCK or return after specfied time.
function pthread_rwlock_timedwrlock (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t; uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:944
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_timedwrlock";
function pthread_rwlock_clockwrlock
(uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t;
uu_clockid : bits_types_clockid_t_h.clockid_t;
uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:950
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_clockwrlock";
-- Unlock RWLOCK.
function pthread_rwlock_unlock (uu_rwlock : access bits_pthreadtypes_h.pthread_rwlock_t) return int -- /usr/include/pthread.h:957
with Import => True,
Convention => C,
External_Name => "pthread_rwlock_unlock";
-- Functions for handling read-write lock attributes.
-- Initialize attribute object ATTR with default values.
function pthread_rwlockattr_init (uu_attr : access bits_pthreadtypes_h.pthread_rwlockattr_t) return int -- /usr/include/pthread.h:964
with Import => True,
Convention => C,
External_Name => "pthread_rwlockattr_init";
-- Destroy attribute object ATTR.
function pthread_rwlockattr_destroy (uu_attr : access bits_pthreadtypes_h.pthread_rwlockattr_t) return int -- /usr/include/pthread.h:968
with Import => True,
Convention => C,
External_Name => "pthread_rwlockattr_destroy";
-- Return current setting of process-shared attribute of ATTR in PSHARED.
function pthread_rwlockattr_getpshared (uu_attr : access constant bits_pthreadtypes_h.pthread_rwlockattr_t; uu_pshared : access int) return int -- /usr/include/pthread.h:972
with Import => True,
Convention => C,
External_Name => "pthread_rwlockattr_getpshared";
-- Set process-shared attribute of ATTR to PSHARED.
function pthread_rwlockattr_setpshared (uu_attr : access bits_pthreadtypes_h.pthread_rwlockattr_t; uu_pshared : int) return int -- /usr/include/pthread.h:978
with Import => True,
Convention => C,
External_Name => "pthread_rwlockattr_setpshared";
-- Return current setting of reader/writer preference.
function pthread_rwlockattr_getkind_np (uu_attr : access constant bits_pthreadtypes_h.pthread_rwlockattr_t; uu_pref : access int) return int -- /usr/include/pthread.h:983
with Import => True,
Convention => C,
External_Name => "pthread_rwlockattr_getkind_np";
-- Set reader/write preference.
function pthread_rwlockattr_setkind_np (uu_attr : access bits_pthreadtypes_h.pthread_rwlockattr_t; uu_pref : int) return int -- /usr/include/pthread.h:989
with Import => True,
Convention => C,
External_Name => "pthread_rwlockattr_setkind_np";
-- Functions for handling conditional variables.
-- Initialize condition variable COND using attributes ATTR, or use
-- the default values if later is NULL.
function pthread_cond_init (uu_cond : access bits_pthreadtypes_h.pthread_cond_t; uu_cond_attr : access constant bits_pthreadtypes_h.pthread_condattr_t) return int -- /usr/include/pthread.h:998
with Import => True,
Convention => C,
External_Name => "pthread_cond_init";
-- Destroy condition variable COND.
function pthread_cond_destroy (uu_cond : access bits_pthreadtypes_h.pthread_cond_t) return int -- /usr/include/pthread.h:1003
with Import => True,
Convention => C,
External_Name => "pthread_cond_destroy";
-- Wake up one thread waiting for condition variable COND.
function pthread_cond_signal (uu_cond : access bits_pthreadtypes_h.pthread_cond_t) return int -- /usr/include/pthread.h:1007
with Import => True,
Convention => C,
External_Name => "pthread_cond_signal";
-- Wake up all threads waiting for condition variables COND.
function pthread_cond_broadcast (uu_cond : access bits_pthreadtypes_h.pthread_cond_t) return int -- /usr/include/pthread.h:1011
with Import => True,
Convention => C,
External_Name => "pthread_cond_broadcast";
-- Wait for condition variable COND to be signaled or broadcast.
-- MUTEX is assumed to be locked before.
-- This function is a cancellation point and therefore not marked with
-- __THROW.
function pthread_cond_wait (uu_cond : access bits_pthreadtypes_h.pthread_cond_t; uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t) return int -- /usr/include/pthread.h:1019
with Import => True,
Convention => C,
External_Name => "pthread_cond_wait";
-- Wait for condition variable COND to be signaled or broadcast until
-- ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an
-- absolute time specification; zero is the beginning of the epoch
-- (00:00:00 GMT, January 1, 1970).
-- This function is a cancellation point and therefore not marked with
-- __THROW.
function pthread_cond_timedwait
(uu_cond : access bits_pthreadtypes_h.pthread_cond_t;
uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t;
uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:1030
with Import => True,
Convention => C,
External_Name => "pthread_cond_timedwait";
-- Wait for condition variable COND to be signaled or broadcast until
-- ABSTIME measured by the specified clock. MUTEX is assumed to be
-- locked before. CLOCK is the clock to use. ABSTIME is an absolute
-- time specification against CLOCK's epoch.
-- This function is a cancellation point and therefore not marked with
-- __THROW.
function pthread_cond_clockwait
(uu_cond : access bits_pthreadtypes_h.pthread_cond_t;
uu_mutex : access bits_pthreadtypes_h.pthread_mutex_t;
uu_clock_id : bits_types_h.uu_clockid_t;
uu_abstime : access constant bits_types_struct_timespec_h.timespec) return int -- /usr/include/pthread.h:1043
with Import => True,
Convention => C,
External_Name => "pthread_cond_clockwait";
-- Functions for handling condition variable attributes.
-- Initialize condition variable attribute ATTR.
function pthread_condattr_init (uu_attr : access bits_pthreadtypes_h.pthread_condattr_t) return int -- /usr/include/pthread.h:1053
with Import => True,
Convention => C,
External_Name => "pthread_condattr_init";
-- Destroy condition variable attribute ATTR.
function pthread_condattr_destroy (uu_attr : access bits_pthreadtypes_h.pthread_condattr_t) return int -- /usr/include/pthread.h:1057
with Import => True,
Convention => C,
External_Name => "pthread_condattr_destroy";
-- Get the process-shared flag of the condition variable attribute ATTR.
function pthread_condattr_getpshared (uu_attr : access constant bits_pthreadtypes_h.pthread_condattr_t; uu_pshared : access int) return int -- /usr/include/pthread.h:1061
with Import => True,
Convention => C,
External_Name => "pthread_condattr_getpshared";
-- Set the process-shared flag of the condition variable attribute ATTR.
function pthread_condattr_setpshared (uu_attr : access bits_pthreadtypes_h.pthread_condattr_t; uu_pshared : int) return int -- /usr/include/pthread.h:1067
with Import => True,
Convention => C,
External_Name => "pthread_condattr_setpshared";
-- Get the clock selected for the condition variable attribute ATTR.
function pthread_condattr_getclock (uu_attr : access constant bits_pthreadtypes_h.pthread_condattr_t; uu_clock_id : access bits_types_h.uu_clockid_t) return int -- /usr/include/pthread.h:1072
with Import => True,
Convention => C,
External_Name => "pthread_condattr_getclock";
-- Set the clock selected for the condition variable attribute ATTR.
function pthread_condattr_setclock (uu_attr : access bits_pthreadtypes_h.pthread_condattr_t; uu_clock_id : bits_types_h.uu_clockid_t) return int -- /usr/include/pthread.h:1078
with Import => True,
Convention => C,
External_Name => "pthread_condattr_setclock";
-- Functions to handle spinlocks.
-- Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can
-- be shared between different processes.
function pthread_spin_init (uu_lock : access bits_pthreadtypes_h.pthread_spinlock_t; uu_pshared : int) return int -- /usr/include/pthread.h:1089
with Import => True,
Convention => C,
External_Name => "pthread_spin_init";
-- Destroy the spinlock LOCK.
function pthread_spin_destroy (uu_lock : access bits_pthreadtypes_h.pthread_spinlock_t) return int -- /usr/include/pthread.h:1093
with Import => True,
Convention => C,
External_Name => "pthread_spin_destroy";
-- Wait until spinlock LOCK is retrieved.
function pthread_spin_lock (uu_lock : access bits_pthreadtypes_h.pthread_spinlock_t) return int -- /usr/include/pthread.h:1097
with Import => True,
Convention => C,
External_Name => "pthread_spin_lock";
-- Try to lock spinlock LOCK.
function pthread_spin_trylock (uu_lock : access bits_pthreadtypes_h.pthread_spinlock_t) return int -- /usr/include/pthread.h:1101
with Import => True,
Convention => C,
External_Name => "pthread_spin_trylock";
-- Release spinlock LOCK.
function pthread_spin_unlock (uu_lock : access bits_pthreadtypes_h.pthread_spinlock_t) return int -- /usr/include/pthread.h:1105
with Import => True,
Convention => C,
External_Name => "pthread_spin_unlock";
-- Functions to handle barriers.
-- Initialize BARRIER with the attributes in ATTR. The barrier is
-- opened when COUNT waiters arrived.
function pthread_barrier_init
(uu_barrier : access bits_pthreadtypes_h.pthread_barrier_t;
uu_attr : access constant bits_pthreadtypes_h.pthread_barrierattr_t;
uu_count : unsigned) return int -- /usr/include/pthread.h:1113
with Import => True,
Convention => C,
External_Name => "pthread_barrier_init";
-- Destroy a previously dynamically initialized barrier BARRIER.
function pthread_barrier_destroy (uu_barrier : access bits_pthreadtypes_h.pthread_barrier_t) return int -- /usr/include/pthread.h:1119
with Import => True,
Convention => C,
External_Name => "pthread_barrier_destroy";
-- Wait on barrier BARRIER.
function pthread_barrier_wait (uu_barrier : access bits_pthreadtypes_h.pthread_barrier_t) return int -- /usr/include/pthread.h:1123
with Import => True,
Convention => C,
External_Name => "pthread_barrier_wait";
-- Initialize barrier attribute ATTR.
function pthread_barrierattr_init (uu_attr : access bits_pthreadtypes_h.pthread_barrierattr_t) return int -- /usr/include/pthread.h:1128
with Import => True,
Convention => C,
External_Name => "pthread_barrierattr_init";
-- Destroy previously dynamically initialized barrier attribute ATTR.
function pthread_barrierattr_destroy (uu_attr : access bits_pthreadtypes_h.pthread_barrierattr_t) return int -- /usr/include/pthread.h:1132
with Import => True,
Convention => C,
External_Name => "pthread_barrierattr_destroy";
-- Get the process-shared flag of the barrier attribute ATTR.
function pthread_barrierattr_getpshared (uu_attr : access constant bits_pthreadtypes_h.pthread_barrierattr_t; uu_pshared : access int) return int -- /usr/include/pthread.h:1136
with Import => True,
Convention => C,
External_Name => "pthread_barrierattr_getpshared";
-- Set the process-shared flag of the barrier attribute ATTR.
function pthread_barrierattr_setpshared (uu_attr : access bits_pthreadtypes_h.pthread_barrierattr_t; uu_pshared : int) return int -- /usr/include/pthread.h:1142
with Import => True,
Convention => C,
External_Name => "pthread_barrierattr_setpshared";
-- Functions for handling thread-specific data.
-- Create a key value identifying a location in the thread-specific
-- data area. Each thread maintains a distinct thread-specific data
-- area. DESTR_FUNCTION, if non-NULL, is called with the value
-- associated to that key when the key is destroyed.
-- DESTR_FUNCTION is not called if the value associated is NULL when
-- the key is destroyed.
function pthread_key_create (uu_key : access bits_pthreadtypes_h.pthread_key_t; uu_destr_function : access procedure (arg1 : System.Address)) return int -- /usr/include/pthread.h:1156
with Import => True,
Convention => C,
External_Name => "pthread_key_create";
-- Destroy KEY.
function pthread_key_delete (uu_key : bits_pthreadtypes_h.pthread_key_t) return int -- /usr/include/pthread.h:1161
with Import => True,
Convention => C,
External_Name => "pthread_key_delete";
-- Return current value of the thread-specific data slot identified by KEY.
function pthread_getspecific (uu_key : bits_pthreadtypes_h.pthread_key_t) return System.Address -- /usr/include/pthread.h:1164
with Import => True,
Convention => C,
External_Name => "pthread_getspecific";
-- Store POINTER in the thread-specific data slot identified by KEY.
function pthread_setspecific (uu_key : bits_pthreadtypes_h.pthread_key_t; uu_pointer : System.Address) return int -- /usr/include/pthread.h:1167
with Import => True,
Convention => C,
External_Name => "pthread_setspecific";
-- Get ID of CPU-time clock for thread THREAD_ID.
function pthread_getcpuclockid (uu_thread_id : bits_pthreadtypes_h.pthread_t; uu_clock_id : access bits_types_h.uu_clockid_t) return int -- /usr/include/pthread.h:1173
with Import => True,
Convention => C,
External_Name => "pthread_getcpuclockid";
-- Install handlers to be called when a new process is created with FORK.
-- The PREPARE handler is called in the parent process just before performing
-- FORK. The PARENT handler is called in the parent process just after FORK.
-- The CHILD handler is called in the child process. Each of the three
-- handlers can be NULL, meaning that no handler needs to be called at that
-- point.
-- PTHREAD_ATFORK can be called several times, in which case the PREPARE
-- handlers are called in LIFO order (last added with PTHREAD_ATFORK,
-- first called before FORK), and the PARENT and CHILD handlers are called
-- in FIFO (first added, first called).
function pthread_atfork
(uu_prepare : access procedure;
uu_parent : access procedure;
uu_child : access procedure) return int -- /usr/include/pthread.h:1190
with Import => True,
Convention => C,
External_Name => "pthread_atfork";
-- Optimizations.
end pthread_h;
|
programs/oeis/005/A005095.asm | jmorken/loda | 1 | 247071 | <reponame>jmorken/loda
; A005095: a(n) = n! + n.
; 1,2,4,9,28,125,726,5047,40328,362889,3628810,39916811,479001612,6227020813,87178291214,1307674368015,20922789888016,355687428096017,6402373705728018
mov $1,$0
cal $1,142
add $1,$0
|
Task/Call-a-function/Ada/call-a-function-4.ada | LaudateCorpus1/RosettaCodeData | 1 | 27089 | <reponame>LaudateCorpus1/RosettaCodeData
function H (Int: Integer;
Fun: not null access function (X: Integer; Y: Integer)
return Integer);
return Integer;
...
X := H(A, F'Access) -- assuming X and A are Integers, and F is a function
-- taking two Integers and returning an Integer.
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/unc.adb | best08618/asylo | 7 | 22692 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/unc.adb<gh_stars>1-10
-- { dg-do compile }
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
procedure Unc is
type Arr is array (1..4) of integer;
type Bytes is array (positive range <>) of Character;
type Buffer (D : Boolean := False) is record
case D is
when False =>
Chars: Bytes (1..16);
when True =>
Values : Arr;
end case;
end record;
--
pragma Unchecked_Union (Buffer);
pragma Warnings (Off);
Val : Buffer;
--
F : File_Type;
S : Stream_Access;
begin
Create (F, Out_File);
S := Stream (F);
Buffer'Output (S, Val);
end;
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-graphs.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 26381 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . G R A P H S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2018-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Compiler_Unit_Warning;
with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.Lists; use GNAT.Lists;
with GNAT.Sets; use GNAT.Sets;
package GNAT.Graphs is
---------------
-- Component --
---------------
-- The following type denotes a strongly connected component handle
-- (referred to as simply "component") in a graph.
type Component_Id is new Natural;
No_Component : constant Component_Id := Component_Id'First;
function Hash_Component (Comp : Component_Id) return Bucket_Range_Type;
-- Map component Comp into the range of buckets
function Present (Comp : Component_Id) return Boolean;
-- Determine whether component Comp exists
---------------------
-- Directed_Graphs --
---------------------
-- The following package offers a directed graph abstraction with the
-- following characteristics:
--
-- * Dynamic resizing based on number of vertices and edges
-- * Creation of multiple instances, of different sizes
-- * Discovery of strongly connected components
-- * Iterable attributes
--
-- The following use pattern must be employed when operating this graph:
--
-- Graph : Directed_Graph := Create (<some size>, <some size>);
--
-- <various operations>
--
-- Destroy (Graph);
--
-- The destruction of the graph reclaims all storage occupied by it.
generic
--------------
-- Vertices --
--------------
type Vertex_Id is private;
-- The handle of a vertex
No_Vertex : Vertex_Id;
-- An indicator for a nonexistent vertex
with function Hash_Vertex (V : Vertex_Id) return Bucket_Range_Type;
-- Map vertex V into the range of buckets
with function Same_Vertex
(Left : Vertex_Id;
Right : Vertex_Id) return Boolean;
-- Compare vertex Left to vertex Right for identity
-----------
-- Edges --
-----------
type Edge_Id is private;
-- The handle of an edge
No_Edge : Edge_Id;
-- An indicator for a nonexistent edge
with function Hash_Edge (E : Edge_Id) return Bucket_Range_Type;
-- Map edge E into the range of buckets
with function Same_Edge
(Left : Edge_Id;
Right : Edge_Id) return Boolean;
-- Compare edge Left to edge Right for identity
package Directed_Graphs is
-- The following exceptions are raised when an attempt is made to add
-- the same edge or vertex in a graph.
Duplicate_Edge : exception;
Duplicate_Vertex : exception;
-- The following exceptions are raised when an attempt is made to delete
-- or reference a nonexistent component, edge, or vertex in a graph.
Missing_Component : exception;
Missing_Edge : exception;
Missing_Vertex : exception;
----------------------
-- Graph operations --
----------------------
-- The following type denotes a graph handle. Each instance must be
-- created using routine Create.
type Directed_Graph is private;
Nil : constant Directed_Graph;
procedure Add_Edge
(G : Directed_Graph;
E : Edge_Id;
Source : Vertex_Id;
Destination : Vertex_Id);
-- Add edge E to graph G which links vertex source Source and desination
-- vertex Destination. The edge is "owned" by vertex Source. This action
-- raises the following exceptions:
--
-- * Duplicate_Edge, when the edge is already present in the graph
--
-- * Iterated, when the graph has an outstanding edge iterator
--
-- * Missing_Vertex, when either the source or desination are not
-- present in the graph.
procedure Add_Vertex
(G : Directed_Graph;
V : Vertex_Id);
-- Add vertex V to graph G. This action raises the following exceptions:
--
-- * Duplicate_Vertex, when the vertex is already present in the graph
--
-- * Iterated, when the graph has an outstanding vertex iterator
function Component
(G : Directed_Graph;
V : Vertex_Id) return Component_Id;
-- Obtain the component where vertex V of graph G resides. This action
-- raises the following exceptions:
--
-- * Missing_Vertex, when the vertex is not present in the graph
function Contains_Component
(G : Directed_Graph;
Comp : Component_Id) return Boolean;
-- Determine whether graph G contains component Comp
function Contains_Edge
(G : Directed_Graph;
E : Edge_Id) return Boolean;
-- Determine whether graph G contains edge E
function Contains_Vertex
(G : Directed_Graph;
V : Vertex_Id) return Boolean;
-- Determine whether graph G contains vertex V
function Create
(Initial_Vertices : Positive;
Initial_Edges : Positive) return Directed_Graph;
-- Create a new graph with vertex capacity Initial_Vertices and edge
-- capacity Initial_Edges. This routine must be called at the start of
-- a graph's lifetime.
procedure Delete_Edge
(G : Directed_Graph;
E : Edge_Id);
-- Delete edge E from graph G. This action raises these exceptions:
--
-- * Iterated, when the graph has an outstanding edge iterator
--
-- * Missing_Edge, when the edge is not present in the graph
--
-- * Missing_Vertex, when the source vertex that "owns" the edge is
-- not present in the graph.
function Destination_Vertex
(G : Directed_Graph;
E : Edge_Id) return Vertex_Id;
-- Obtain the destination vertex of edge E of graph G. This action
-- raises the following exceptions:
--
-- * Missing_Edge, when the edge is not present in the graph
procedure Destroy (G : in out Directed_Graph);
-- Destroy the contents of graph G, rendering it unusable. This routine
-- must be called at the end of a graph's lifetime. This action raises
-- the following exceptions:
--
-- * Iterated, if the graph has any outstanding iterator
procedure Find_Components (G : Directed_Graph);
-- Find all components of graph G. This action raises the following
-- exceptions:
--
-- * Iterated, when the components or vertices of the graph have an
-- outstanding iterator.
function Is_Empty (G : Directed_Graph) return Boolean;
-- Determine whether graph G is empty
function Number_Of_Component_Vertices
(G : Directed_Graph;
Comp : Component_Id) return Natural;
-- Obtain the total number of vertices of component Comp of graph G
function Number_Of_Components (G : Directed_Graph) return Natural;
-- Obtain the total number of components of graph G
function Number_Of_Edges (G : Directed_Graph) return Natural;
-- Obtain the total number of edges of graph G
function Number_Of_Outgoing_Edges
(G : Directed_Graph;
V : Vertex_Id) return Natural;
-- Obtain the total number of outgoing edges of vertex V of graph G
function Number_Of_Vertices (G : Directed_Graph) return Natural;
-- Obtain the total number of vertices of graph G
function Present (G : Directed_Graph) return Boolean;
-- Determine whether graph G exists
function Source_Vertex
(G : Directed_Graph;
E : Edge_Id) return Vertex_Id;
-- Obtain the source vertex that "owns" edge E of graph G. This action
-- raises the following exceptions:
--
-- * Missing_Edge, when the edge is not present in the graph
-------------------------
-- Iterator operations --
-------------------------
-- The following types represent iterators over various attributes of a
-- graph. Each iterator locks all mutation operations of its associated
-- attribute, and unlocks them once it is exhausted. The iterators must
-- be used with the following pattern:
--
-- Iter : Iterate_XXX (Graph);
-- while Has_Next (Iter) loop
-- Next (Iter, Element);
-- end loop;
--
-- It is possible to advance the iterators by using Next only, however
-- this risks raising Iterator_Exhausted.
-- The following type represents an iterator over all edges of a graph
type All_Edge_Iterator is private;
function Has_Next (Iter : All_Edge_Iterator) return Boolean;
-- Determine whether iterator Iter has more edges to examine
function Iterate_All_Edges (G : Directed_Graph) return All_Edge_Iterator;
-- Obtain an iterator over all edges of graph G
procedure Next
(Iter : in out All_Edge_Iterator;
E : out Edge_Id);
-- Return the current edge referenced by iterator Iter and advance to
-- the next available edge. This action raises the following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type represents an iterator over all vertices of a
-- graph.
type All_Vertex_Iterator is private;
function Has_Next (Iter : All_Vertex_Iterator) return Boolean;
-- Determine whether iterator Iter has more vertices to examine
function Iterate_All_Vertices
(G : Directed_Graph) return All_Vertex_Iterator;
-- Obtain an iterator over all vertices of graph G
procedure Next
(Iter : in out All_Vertex_Iterator;
V : out Vertex_Id);
-- Return the current vertex referenced by iterator Iter and advance
-- to the next available vertex. This action raises the following
-- exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type represents an iterator over all components of a
-- graph.
type Component_Iterator is private;
function Has_Next (Iter : Component_Iterator) return Boolean;
-- Determine whether iterator Iter has more components to examine
function Iterate_Components
(G : Directed_Graph) return Component_Iterator;
-- Obtain an iterator over all components of graph G
procedure Next
(Iter : in out Component_Iterator;
Comp : out Component_Id);
-- Return the current component referenced by iterator Iter and advance
-- to the next component. This action raises the following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type prepresents an iterator over all vertices of a
-- component.
type Component_Vertex_Iterator is private;
function Has_Next (Iter : Component_Vertex_Iterator) return Boolean;
-- Determine whether iterator Iter has more vertices to examine
function Iterate_Component_Vertices
(G : Directed_Graph;
Comp : Component_Id) return Component_Vertex_Iterator;
-- Obtain an iterator over all vertices that comprise component Comp of
-- graph G.
procedure Next
(Iter : in out Component_Vertex_Iterator;
V : out Vertex_Id);
-- Return the current vertex referenced by iterator Iter and advance to
-- the next vertex. This action raises the following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
-- The following type represents an iterator over all outgoing edges of
-- a vertex.
type Outgoing_Edge_Iterator is private;
function Has_Next (Iter : Outgoing_Edge_Iterator) return Boolean;
-- Determine whether iterator Iter has more outgoing edges to examine
function Iterate_Outgoing_Edges
(G : Directed_Graph;
V : Vertex_Id) return Outgoing_Edge_Iterator;
-- Obtain an iterator over all the outgoing edges "owned" by vertex V of
-- graph G.
procedure Next
(Iter : in out Outgoing_Edge_Iterator;
E : out Edge_Id);
-- Return the current outgoing edge referenced by iterator Iter and
-- advance to the next available outgoing edge. This action raises the
-- following exceptions:
--
-- * Iterator_Exhausted, when the iterator has been exhausted and
-- further attempts are made to advance it.
private
pragma Unreferenced (No_Edge);
--------------
-- Edge_Map --
--------------
type Edge_Attributes is record
Destination : Vertex_Id := No_Vertex;
-- The target of a directed edge
Source : Vertex_Id := No_Vertex;
-- The origin of a directed edge. The source vertex "owns" the edge.
end record;
No_Edge_Attributes : constant Edge_Attributes :=
(Destination => No_Vertex,
Source => No_Vertex);
procedure Destroy_Edge_Attributes (Attrs : in out Edge_Attributes);
-- Destroy the contents of attributes Attrs
package Edge_Map is new Dynamic_Hash_Tables
(Key_Type => Edge_Id,
Value_Type => Edge_Attributes,
No_Value => No_Edge_Attributes,
Expansion_Threshold => 1.5,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => Same_Edge,
Destroy_Value => Destroy_Edge_Attributes,
Hash => Hash_Edge);
--------------
-- Edge_Set --
--------------
package Edge_Set is new Membership_Sets
(Element_Type => Edge_Id,
"=" => "=",
Hash => Hash_Edge);
-----------------
-- Vertex_List --
-----------------
procedure Destroy_Vertex (V : in out Vertex_Id);
-- Destroy the contents of a vertex
package Vertex_List is new Doubly_Linked_Lists
(Element_Type => Vertex_Id,
"=" => Same_Vertex,
Destroy_Element => Destroy_Vertex);
----------------
-- Vertex_Map --
----------------
type Vertex_Attributes is record
Component : Component_Id := No_Component;
-- The component where a vertex lives
Outgoing_Edges : Edge_Set.Membership_Set := Edge_Set.Nil;
-- The set of edges that extend out from a vertex
end record;
No_Vertex_Attributes : constant Vertex_Attributes :=
(Component => No_Component,
Outgoing_Edges => Edge_Set.Nil);
procedure Destroy_Vertex_Attributes (Attrs : in out Vertex_Attributes);
-- Destroy the contents of attributes Attrs
package Vertex_Map is new Dynamic_Hash_Tables
(Key_Type => Vertex_Id,
Value_Type => Vertex_Attributes,
No_Value => No_Vertex_Attributes,
Expansion_Threshold => 1.5,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => Same_Vertex,
Destroy_Value => Destroy_Vertex_Attributes,
Hash => Hash_Vertex);
-------------------
-- Component_Map --
-------------------
type Component_Attributes is record
Vertices : Vertex_List.Doubly_Linked_List := Vertex_List.Nil;
end record;
No_Component_Attributes : constant Component_Attributes :=
(Vertices => Vertex_List.Nil);
procedure Destroy_Component_Attributes
(Attrs : in out Component_Attributes);
-- Destroy the contents of attributes Attrs
package Component_Map is new Dynamic_Hash_Tables
(Key_Type => Component_Id,
Value_Type => Component_Attributes,
No_Value => No_Component_Attributes,
Expansion_Threshold => 1.5,
Expansion_Factor => 2,
Compression_Threshold => 0.3,
Compression_Factor => 2,
"=" => "=",
Destroy_Value => Destroy_Component_Attributes,
Hash => Hash_Component);
-----------
-- Graph --
-----------
type Directed_Graph_Attributes is record
All_Edges : Edge_Map.Dynamic_Hash_Table := Edge_Map.Nil;
-- The map of edge -> edge attributes for all edges in the graph
All_Vertices : Vertex_Map.Dynamic_Hash_Table := Vertex_Map.Nil;
-- The map of vertex -> vertex attributes for all vertices in the
-- graph.
Components : Component_Map.Dynamic_Hash_Table := Component_Map.Nil;
-- The map of component -> component attributes for all components
-- in the graph.
end record;
type Directed_Graph is access Directed_Graph_Attributes;
Nil : constant Directed_Graph := null;
---------------
-- Iterators --
---------------
type All_Edge_Iterator is new Edge_Map.Iterator;
type All_Vertex_Iterator is new Vertex_Map.Iterator;
type Component_Iterator is new Component_Map.Iterator;
type Component_Vertex_Iterator is new Vertex_List.Iterator;
type Outgoing_Edge_Iterator is new Edge_Set.Iterator;
end Directed_Graphs;
private
First_Component : constant Component_Id := No_Component + 1;
end GNAT.Graphs;
|
tests/applescript/alfred.bundler.applescript | shawnrice/alfred-bundler | 9 | 2070 | --# Current Alfred-Bundler version
property BUNDLER_VERSION : "devel"
--# Path to Alfred-Bundler's root directory
on get_bundler_dir()
return (POSIX path of (path to home folder as text)) & "Library/Application Support/Alfred 2/Workflow Data/alfred.bundler-" & BUNDLER_VERSION
end get_bundler_dir
--# Path to Alfred-Bundler's cache directory
on get_cache_dir()
return (POSIX path of (path to home folder as text)) & "Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/alfred.bundler-" & BUNDLER_VERSION
end get_cache_dir
(* MAIN API FUNCTION *)
on load_bundler()
(* Load `AlfredBundler.scpt` from the Alfred-Bundler directory as a script object.
If the Alfred-Bundler directory does not exist, install it (using `_bootstrap()`).
:returns: the script object of `AlfredBundler.scpt`
:rtype: ``script object``
*)
set BUNDLER_DIR to my get_bundler_dir()
--# Check if Alfred-Bundler is installed
if (my _folder_exists(BUNDLER_DIR)) is not equal to true then
--# install it if not
my _bootstrap()
end if
delay 0.1
--# Path to `AlfredBundler.scpt` in Alfed-Bundler directory
set as_bundler to (BUNDLER_DIR & "/bundler/AlfredBundler.scpt")
--# Return script object
return load script as_bundler
end load_bundler
(* AUTO-DOWNLOAD BUNDLER *)
on _bootstrap()
(* Check if bundler bash bundlet is installed and install it if not.
:returns: ``None``
*)
--# Ask to install the Bundler
set BUNDLER_DIR to my get_bundler_dir()
set CACHE_DIR to my get_cache_dir()
try
my _install_confirmation()
on error
--# Cannot continue to install the bundler, so stop
return false
end try
--# Download the bundler
set URLs to {"https://github.com/shawnrice/alfred-bundler/archive/" & BUNDLER_VERSION & ".zip", "https://bitbucket.org/shawnrice/alfred-bundler/get/" & BUNDLER_VERSION & ".zip"}
--# Save Alfred-Bundler zipfile to this location temporarily
set _zipfile to (quoted form of CACHE_DIR) & "/installer/bundler.zip"
repeat with _url in URLs
set _status to (do shell script "curl -fsSL --create-dirs --connect-timeout 5 " & _url & " -o " & _zipfile & " && echo $?")
if _status is equal to "0" then exit repeat
end repeat
--# Could not download the file
if _status is not equal to "0" then error "Could not download bundler install file" number 21
--# Ensure directory tree already exists for bundler to be moved into it
my _check_dir(BUNDLER_DIR)
--# Unzip the bundler and move it to its data directory
set _cmd to "cd " & (quoted form of CACHE_DIR) & "; cd installer; unzip -qo bundler.zip; mv ./*/bundler " & (quoted form of BUNDLER_DIR)
do shell script _cmd
--# Wait until bundler is fully unzipped and written to disk before finishing
set as_bundler to (BUNDLER_DIR & "/bundler/AlfredBundler.scpt")
repeat while not (my _path_exists(as_bundler))
delay 0.2
end repeat
tell application "Finder" to delete (POSIX file CACHE_DIR as alias)
return
end _bootstrap
--# Function to get confirmation to install the bundler
on _install_confirmation()
(* Ask user for permission to install Alfred-Bundler.
Allow user to go to website for more information, or even to cancel download.
:returns: ``True`` or raises Error
*)
--# Get path to workflow's `info.plist` file
set _plist to my _pwd() & "info.plist"
--# Get name of workflow's from `info.plist` file
set _cmd to "/usr/libexec/PlistBuddy -c 'Print :name' '" & _plist & "'"
set _name to do shell script _cmd
--# Get workflow's icon, or default to system icon
set _icon to my _pwd() & "icon.png"
set _icon to my _check_icon(_icon)
--# Prepare explanation text for dialog box
set _text to _name & " needs to install additional components, which will be placed in the Alfred storage directory and will not interfere with your system.
You may be asked to allow some components to run, depending on your security settings.
You can decline this installation, but " & _name & " may not work without them. There will be a slight delay after accepting."
set _response to button returned of (display dialog _text buttons {"More Info", "Cancel", "Proceed"} default button 3 with title "Setup " & _name with icon POSIX file _icon)
--# If permission granted, continue download
if _response is equal to "Proceed" then return true
--# If more info requested, open webpage and error
if _response is equal to "More Info" then
tell application "System Events"
open location "https://github.com/shawnrice/alfred-bundler/wiki/What-is-the-Alfred-Bundler"
end tell
error "User looked sought more information" number 23
end if
--# If permission denied, stop and error
if _response is equal to "Cancel" then error "User canceled bundler installation" number 23
end _install_confirmation
(* HELPER HANDLERS *)
on _pwd()
(* Get path to "present working directory", i.e. the workflow's root directory.
:returns: Path to this script's parent directory
:rtype: ``string`` (POSIX path)
*)
--# Save default AS delimiters, and set delimiters to "/"
set {ASTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
--# Get POSIX path of script's directory
set _path to (text items 1 thru -2 of (POSIX path of (path to me)) as string) & "/"
--# Reset AS delimiters to original values
set AppleScript's text item delimiters to ASTID
return _path
end _pwd
on _prepare_cmd(_cmd)
(* Ensure shell `_cmd` is working from the property directory.
For testing purposes, it also sets the `AB_BRANCH` environmental variable.
:param _cmd: Shell command to be run in `do shell script`
:type _cmd: ``string``
:returns: Shell command with `pwd` set properly
:rtype: ``string``
*)
--# Ensure `pwd` is properly quoted for shell command
set pwd to quoted form of (my _pwd())
--# Declare environmental variable
--#TODO: remove for final release
set testing_var to "export AB_BRANCH=devel; "
--# return shell script where `pwd` is properly set
return testing_var & "cd " & pwd & "; bash " & _cmd
end _prepare_cmd
on _check_icon(_icon)
(* Check if `_icon` exists, and if not revert to system download icon.
:returns: POSIX path to `_icon`
:rtype: ``string`` (POSIX path)
*)
try
POSIX file _icon as alias
return _icon
on error
return "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/SidebarDownloadsFolder.icns"
end try
end _check_icon
on _check_dir(_folder)
(* Check if `_folder` exists, and if not create it, including any sub-directories.
:returns: POSIX path to `_folder`
:rtype: ``string`` (POSIX path)
*)
if not my _folder_exists(_folder) then
do shell script "mkdir -p " & (quoted form of _folder)
end if
return _folder
end _check_dir
on _folder_exists(_folder)
(* Return ``true`` if `_folder` exists, else ``false``
:param _folder: Full path to directory
:type _folder: ``string`` (POSIX path)
:returns: ``Boolean``
*)
if my _path_exists(_folder) then
tell application "System Events"
return (class of (disk item _folder) is folder)
end tell
end if
return false
end _folder_exists
on _path_exists(_path)
(* Return ``true`` if `_path` exists, else ``false``
:param _path: Any POSIX path (file or folder)
:type _path: ``string`` (POSIX path)
:returns: ``Boolean``
*)
if _path is missing value or my _is_empty(_path) then return false
try
if class of _path is alias then return true
if _path contains ":" then
alias _path
return true
else if _path contains "/" then
POSIX file _path as alias
return true
else
return false
end if
on error msg
return false
end try
end _path_exists
on _is_empty(_obj)
(* Return ``true`` if `_obj ` is empty, else ``false``
:param _obj: Any Applescript type
:type _obj: (optional)
:returns: ``Boolean``
*)
--# Is `_obj ` a ``Boolean``?
if {true, false} contains _obj then return false
--# Is `_obj ` a ``missing value``?
if _obj is missing value then return true
--# Is `_obj ` a empty string?
return length of (my _trim(_obj)) is 0
end _is_empty
on _trim(_str)
(* Remove white space from beginning and end of `_str`
:param _str: A text string
:type _str: ``string``
:returns: trimmed string
*)
if class of _str is not text or class of _str is not string or _str is missing value then return _str
if _str is "" then return _str
repeat while _str begins with " "
try
set _str to items 2 thru -1 of _str as text
on error msg
return ""
end try
end repeat
repeat while _str ends with " "
try
set _str to items 1 thru -2 of _str as text
on error
return ""
end try
end repeat
return _str
end _trim |
src/util/icon/asm_compress.asm | olifink/qspread | 0 | 20026 | <reponame>olifink/qspread
* Sprite compress
*
* Mode 4
* +---|----------------+
* - wwwwwwwwww -
* | wwwwwwwwwwwwwwww |
* |rrrrrrrrr wwwwwwww |
* |r r r rrrww |
* |r ww r r rwwr |
* |r rr wwrrr |
* |r w ww r rrrww |
* |r r rwwr |
* |r www w r wwrrr |
* |r r rrrww |
* |r ww ww r rww |
* |rrrrrrrrr wwwwwwww |
* | wwwwwwwwwwwwwwww |
* | wwwwwwwwwwrwwr |
* | wwrrr |
* | rrrww |
* +---|----------------+
*
section sprite
xdef mes_compress
xref mes_zero
mes_compress
dc.w $0100,$0000
dc.w 20,16,0,0
dc.l mcs_compress-*
dc.l mes_zero-*
dc.l sp_compress-*
mcs_compress
dc.w $1F1F,$F8F8
dc.w $0000,$0000
dc.w $1F1F,$FFFF
dc.w $E0E0,$0000
dc.w $00FF,$1F9F
dc.w $E0E0,$0000
dc.w $0084,$0087
dc.w $C0C0,$0000
dc.w $30B2,$0387
dc.w $0080,$0000
dc.w $0081,$0C8F
dc.w $0080,$0000
dc.w $2CAC,$0087
dc.w $C0C0,$0000
dc.w $0080,$0387
dc.w $0080,$0000
dc.w $3ABA,$0C8F
dc.w $0080,$0000
dc.w $0080,$0087
dc.w $C0C0,$0000
dc.w $36B6,$0387
dc.w $0000,$0000
dc.w $00FF,$1F9F
dc.w $E0E0,$0000
dc.w $1F1F,$FFFF
dc.w $E0E0,$0000
dc.w $1F1F,$FBFF
dc.w $0080,$0000
dc.w $0000,$0C0F
dc.w $0080,$0000
dc.w $0000,$0007
dc.w $C0C0,$0000
*
sp_compress
incbin 'win1_util_icon_compress_spr'
end
|
memsim-master/src/memory-transform-shift.adb | strenkml/EE368 | 0 | 17474 | <filename>memsim-master/src/memory-transform-shift.adb
with Device; use Device;
with Memory.Container; use Memory.Container;
package body Memory.Transform.Shift is
function Create_Shift return Shift_Pointer is
result : constant Shift_Pointer := new Shift_Type;
begin
return result;
end Create_Shift;
function Random_Shift(next : access Memory_Type'Class;
generator : Distribution_Type;
max_cost : Cost_Type) return Memory_Pointer is
result : constant Shift_Pointer := Create_Shift;
abits : constant Positive := Get_Address_Bits;
begin
Set_Memory(result.all, next);
result.value := Long_Integer((Random(generator) mod abits)) + 1;
return Memory_Pointer(result);
end Random_Shift;
function Clone(mem : Shift_Type) return Memory_Pointer is
result : constant Shift_Pointer := new Shift_Type'(mem);
begin
return Memory_Pointer(result);
end Clone;
procedure Permute(mem : in out Shift_Type;
generator : in Distribution_Type;
max_cost : in Cost_Type) is
abits : constant Positive := Get_Address_Bits;
begin
mem.value := Long_Integer((Random(generator) mod abits)) + 1;
end Permute;
function Get_Name(mem : Shift_Type) return String is
begin
return "shift";
end Get_Name;
function Apply(mem : Shift_Type;
address : Address_Type;
dir : Boolean) return Address_Type is
abits : constant Integer := Get_Address_Bits;
wsize : constant Address_Type := Address_Type(Get_Word_Size(mem));
wbits : constant Natural := Log2(Natural(wsize)) - 1;
caddr : constant Address_Type := address mod wsize;
saddr : constant Address_Type := address / wsize;
shift : Long_Integer := mem.value;
rmult : Address_Type;
lmult : Address_Type;
result : Address_Type;
begin
if shift < 0 then
shift := Long_Integer(abits - wbits) + shift;
end if;
shift := shift mod Long_Integer(abits - wbits);
rmult := Address_Type(2) ** Natural(shift);
lmult := Address_Type(2) ** (abits - Natural(shift) - wbits);
if dir then
result := ((saddr * rmult) or (saddr / lmult)) * wsize or caddr;
else
result := ((saddr * lmult) or (saddr / rmult)) * wsize or caddr;
end if;
return result and ((Address_Type(2) ** abits) - 1);
end Apply;
function Is_Empty(mem : Shift_Type) return Boolean is
begin
return mem.value = 0;
end Is_Empty;
function Get_Alignment(mem : Shift_Type) return Positive is
begin
return Get_Word_Size(mem);
end Get_Alignment;
function Get_Transform_Length(mem : Shift_Type) return Natural is
begin
return 0;
end Get_Transform_Length;
end Memory.Transform.Shift;
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_947.asm | ljhsiun2/medusa | 9 | 25890 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1087d, %r8
inc %r14
movb $0x61, (%r8)
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_D_ht+0x1e0fd, %rdx
nop
sub $64420, %rbx
movb $0x61, (%rdx)
nop
nop
nop
nop
cmp $34620, %rcx
lea addresses_WT_ht+0xe399, %r13
nop
nop
add %r9, %r9
movb (%r13), %cl
nop
nop
nop
add $18170, %rcx
lea addresses_D_ht+0x1cb4d, %rsi
lea addresses_normal_ht+0x14f6d, %rdi
nop
nop
nop
nop
nop
lfence
mov $81, %rcx
rep movsb
nop
nop
add %r13, %r13
lea addresses_UC_ht+0x18f6d, %rsi
lea addresses_WC_ht+0xd36d, %rdi
nop
nop
nop
nop
nop
dec %rbx
mov $126, %rcx
rep movsb
nop
nop
nop
xor %r14, %r14
lea addresses_normal_ht+0x1a12d, %rsi
lea addresses_normal_ht+0x7748, %rdi
nop
nop
nop
nop
xor $15566, %r14
mov $63, %rcx
rep movsw
sub $23638, %rdi
lea addresses_WT_ht+0x5f6d, %rsi
lea addresses_A_ht+0x16aad, %rdi
add $45566, %rdx
mov $113, %rcx
rep movsb
sub %r9, %r9
lea addresses_WC_ht+0x1db4d, %rcx
nop
nop
nop
nop
nop
add $31702, %rbx
and $0xffffffffffffffc0, %rcx
movntdqa (%rcx), %xmm6
vpextrq $1, %xmm6, %r14
nop
inc %r9
lea addresses_WT_ht+0x31ed, %rcx
nop
nop
nop
add $38197, %r14
mov $0x6162636465666768, %rdx
movq %rdx, (%rcx)
nop
and $1972, %r9
lea addresses_D_ht+0x19497, %r9
nop
nop
nop
sub $31908, %rdx
mov $0x6162636465666768, %r13
movq %r13, (%r9)
nop
add %r14, %r14
lea addresses_A_ht+0x12315, %r9
clflush (%r9)
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $0x6162636465666768, %r14
movq %r14, (%r9)
nop
nop
nop
and $59567, %rsi
lea addresses_D_ht+0x1af6d, %r8
nop
nop
sub %r9, %r9
mov (%r8), %edi
nop
nop
nop
nop
nop
add $1919, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %rbp
push %rdi
// Faulty Load
lea addresses_WC+0xf76d, %r11
nop
nop
nop
nop
nop
sub %r12, %r12
mov (%r11), %edi
lea oracles, %rbp
and $0xff, %rdi
shlq $12, %rdi
mov (%rbp,%rdi,1), %rdi
pop %rdi
pop %rbp
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}, 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_normal_ht'}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
src/hdl/mk3/simulation/sim_asm/test_asmz80/z80_chipram.asm | dominicbeesley/blitter-vhdl-6502 | 5 | 104084 | .area CODE (CON, ABS)
.globl font_data
handle_res: di
ld sp, 0x3000
; enable local jim
ld a,#0xD1
ld (0xFCFF),a
ld a,#0xFC
ld (0xFCFE),a
ld a,#0xFE
ld (0xFCFD),a
ld a,(0xFCFF)
out (0x8F), a
in a, (0x8F)
; cls
ld hl, 0xB000
ld de, 0xB001
ld a, 0
ld (hl),a
ld bc, 0x4000-1
ldir
ld hl, 0xC000
ld (scr_ptr), hl
ld hl, message
str_loop: ld a, (hl)
or a
jr Z, str_done
call scr_char
inc hl
jr str_loop
str_done: jr str_done
scr_char: push af
push bc
push hl
push de
and #127
sub #32
ld h,0
ld l,a
add hl,hl
add hl,hl
add hl,hl
ld de,#font_data
add hl,de
ld de,(scr_ptr)
ld bc,#8
ldir
ld (scr_ptr),de
pop de
pop hl
pop bc
pop af
ret
message: .asciz "Hello Stardot Z80!"
scr_ptr: .rmb 2
|
contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/mi_var_union/bar.adb | TheSledgeHammer/2.11BSD | 3 | 18481 | -- Copyright 2018-2020 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program 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 a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Bar is
type Union_Type (A : Boolean := False) is record
case A is
when True => B : Integer;
when False => C : Float;
end case;
end record;
pragma Unchecked_Union (Union_Type);
Ut : Union_Type := (A => True, B => 3);
begin
Do_Nothing (Ut'Address); -- STOP
end Bar;
|
kernel/a20.asm | jpbottaro/minios | 2 | 9440 | <filename>kernel/a20.asm
BITS 16
%include "macrosmodoreal.mac"
section .text
habilitando: db 'Habilitando A20........'
habilitando_len equ $ - habilitando
deshabilitando: db 'Desabilitando A20......'
deshabilitando_len equ $ - deshabilitando
checkeando: db 'Checkeando A20.........'
checkeando_len equ $ - checkeando
mensajeOK: db 'OK!'
mensajeOK_len equ $ - mensajeOK
mensajeFAIL: db 'FALLO!'
mensajeFAIL_len equ $ - mensajeFAIL
disable_A20:
pushf
pusha
;IMPRIMIR_MODO_REAL deshabilitando, deshabilitando_len, 0x07, 0, 0
call a20wait
mov al,0xAD
out 0x64,al
call a20wait
mov al,0xD0
out 0x64,al
call a20wait2
in al,0x60
push ax
call a20wait
mov al,0xD1
out 0x64,al
call a20wait
pop ax
and al,0xFD ; disabling
out 0x60,al
call a20wait
mov al,0xAE
out 0x64,al
call a20wait
;IMPRIMIR_MODO_REAL mensajeOK, mensajeOK_len, 0x0A, 0xFFFF, 23
popa
popf
ret
enable_A20:
pushf
pusha
;IMPRIMIR_MODO_REAL habilitando, habilitando_len, 0x07, 0, 0
call a20wait
mov al,0xAD
out 0x64,al
call a20wait
mov al,0xD0
out 0x64,al
call a20wait2
in al,0x60
push ax
call a20wait
mov al,0xD1
out 0x64,al
call a20wait
pop ax
or al,2
out 0x60,al
call a20wait
mov al,0xAE
out 0x64,al
call a20wait
;IMPRIMIR_MODO_REAL mensajeOK, mensajeOK_len, 0x0A, 0xFFFF, 23
popa
popf
ret
a20wait:
in al,0x64
test al,2
jnz a20wait
ret
a20wait2:
in al,0x64
test al,1
jz a20wait2
ret
check_A20:
pushf
push fs
push gs
push di
push si
;IMPRIMIR_MODO_REAL checkeando, checkeando_len, 0x07, 0, 0
xor ax, ax ; ax = 0
mov fs, ax
not ax ; ax = 0xFFFF
mov gs, ax
mov di, 0x0500
mov si, 0x0510
mov al, byte [fs:di]
push ax
mov al, byte [gs:si]
push ax
mov byte [fs:di], 0x00
mov byte [gs:si], 0xFF
cmp byte [fs:di], 0xFF
je .fail
;IMPRIMIR_MODO_REAL mensajeOK, mensajeOK_len, 0x0A, 0xFFFF, 23
jmp .ok
.fail:
;IMPRIMIR_MODO_REAL mensajeFAIL, mensajeFAIL_len, 0x0C, 0xFFFF, 23
.ok:
pop ax
mov byte [gs:si], al
pop ax
mov byte [fs:di], al
mov ax, 0
je check_a20__exit
mov ax, 1
check_a20__exit:
pop si
pop di
pop gs
pop fs
popf
ret
|
oeis/189/A189739.asm | neoneye/loda-programs | 11 | 104881 | <filename>oeis/189/A189739.asm
; A189739: a(1)=3, a(2)=5, a(n)=3a(n-1) + 5a(n-2)
; Submitted by <NAME>
; 3,5,30,115,495,2060,8655,36265,152070,637535,2672955,11206540,46984395,196985885,825879630,3462568315,14517103095,60864150860,255177968055,1069854658465,4485453815670,18805634739335,78844173296355,330560693585740,1385902947238995,5810512309645685,24361051665132030,102135716543624515,428212407956533695,1795315806587723660,7527009459545839455,31557607411576136665,132307869532457607270,554711645655253505135,2325674284628048551755,9750581082160413180940,40880114669621482301595
mov $1,3
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $2,5
mul $3,3
add $3,$1
mov $1,$2
lpe
mov $0,$1
|
tests/inchexstr/9.asm | NullMember/customasm | 414 | 14214 | #d inchexstr("data1.txt", "data2.txt") ; error: wrong |
Transynther/x86/_processed/NONE/_st_/i9-9900K_12_0xa0_notsx.log_21829_1294.asm | ljhsiun2/medusa | 9 | 172972 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xe781, %r9
dec %rbx
mov (%r9), %esi
nop
sub $22776, %r8
lea addresses_WT_ht+0xa41, %r12
clflush (%r12)
inc %r8
movb (%r12), %r13b
nop
nop
nop
nop
nop
and $64913, %rbx
lea addresses_WT_ht+0x2cf1, %r12
nop
nop
nop
add $48682, %rdi
mov $0x6162636465666768, %rbx
movq %rbx, (%r12)
nop
and %r8, %r8
lea addresses_A_ht+0x5f87, %rdi
cmp $54092, %rsi
mov (%rdi), %r8w
sub %r13, %r13
lea addresses_normal_ht+0x12161, %rsi
lea addresses_D_ht+0x3e31, %rdi
nop
nop
nop
nop
nop
inc %r12
mov $37, %rcx
rep movsq
nop
nop
nop
add $54588, %r8
lea addresses_normal_ht+0xb5f9, %r8
nop
cmp %r13, %r13
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
vmovups %ymm0, (%r8)
xor %r12, %r12
lea addresses_WC_ht+0xc241, %r8
nop
nop
cmp %rsi, %rsi
movb $0x61, (%r8)
nop
nop
dec %r8
lea addresses_WC_ht+0xf421, %rsi
lea addresses_WT_ht+0x18e81, %rdi
nop
nop
inc %r13
mov $22, %rcx
rep movsb
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_WT_ht+0xd2c1, %rsi
lea addresses_WT_ht+0x18441, %rdi
nop
cmp $11231, %r8
mov $113, %rcx
rep movsq
nop
nop
sub %r12, %r12
lea addresses_WT_ht+0x81, %rsi
lea addresses_WC_ht+0x16be1, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
inc %r8
mov $64, %rcx
rep movsl
nop
nop
nop
xor $51144, %r13
lea addresses_A_ht+0x129e1, %rsi
lea addresses_WC_ht+0x1ab2d, %rdi
add $30261, %r13
mov $59, %rcx
rep movsb
nop
nop
nop
cmp $40304, %r9
lea addresses_WC_ht+0xb041, %rsi
lea addresses_WT_ht+0xba61, %rdi
nop
add %rbx, %rbx
mov $47, %rcx
rep movsl
sub %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_normal+0x49c, %rsi
lea addresses_UC+0xe441, %rdi
clflush (%rsi)
nop
xor %r8, %r8
mov $88, %rcx
rep movsb
nop
nop
cmp %r8, %r8
// Store
lea addresses_D+0x17841, %r9
nop
nop
cmp $9372, %r8
movw $0x5152, (%r9)
xor $38401, %rsi
// Faulty Load
lea addresses_UC+0xe441, %r8
nop
nop
nop
sub $63550, %rsi
mov (%r8), %cx
lea oracles, %r13
and $0xff, %rcx
shlq $12, %rcx
mov (%r13,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC', 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 8}}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
test/sub.asm | cryptoptusenix/assemblyline | 0 | 7215 | SECTION .text
GLOBAL test
test:
sub r11, r10
sub rsp, 0x138
sub rsp, 0x48
sub rsp, 0x50
sub rsp, 0x80 |
programs/oeis/155/A155640.asm | neoneye/loda | 22 | 172211 | <filename>programs/oeis/155/A155640.asm
; A155640: a(n) = 7^n - 5^n + 1^n.
; 1,3,25,219,1777,13683,102025,745419,5374177,38400483,272709625,1928498619,13597146577,95668307283,672119557225,4717043931819,33080342678977,231867574534083,1624598900644825,11379821699045019,79696898865971377,558069026925080883
mov $1,7
pow $1,$0
mov $2,5
pow $2,$0
sub $1,$2
mov $0,$1
add $0,1
|
oeis/019/A019693.asm | neoneye/loda-programs | 11 | 164332 | <gh_stars>10-100
; A019693: Decimal expansion of 2*Pi/3.
; Submitted by <NAME>
; 2,0,9,4,3,9,5,1,0,2,3,9,3,1,9,5,4,9,2,3,0,8,4,2,8,9,2,2,1,8,6,3,3,5,2,5,6,1,3,1,4,4,6,2,6,6,2,5,0,0,7,0,5,4,7,3,1,6,6,2,9,7,2,8,2,0,5,2,1,0,9,3,7,5,2,4,1,3,9,3,3,2,4,1,8,6,8,9,8,8,3,5,6,1,4,1,1,3,7,8
mov $1,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $1,$3
mov $5,$3
mul $5,2
add $5,1
mul $2,$5
add $1,$2
div $5,$2
add $5,$0
div $1,$5
div $2,$5
sub $3,1
lpe
mul $1,8
mov $4,10
pow $4,$0
div $2,$4
mul $2,6
div $1,$2
add $1,$4
mov $0,$1
mod $0,10
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48.log_21829_2572.asm | ljhsiun2/medusa | 9 | 165389 | <filename>Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48.log_21829_2572.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1b106, %r13
nop
nop
nop
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%r13)
cmp $25891, %r13
lea addresses_normal_ht+0x1592e, %rdx
clflush (%rdx)
nop
nop
nop
nop
nop
dec %rbp
movw $0x6162, (%rdx)
nop
nop
nop
and $33348, %r13
lea addresses_normal_ht+0xfe5e, %rsi
lea addresses_WT_ht+0x195e, %rdi
xor %r11, %r11
mov $14, %rcx
rep movsw
nop
nop
nop
nop
nop
and %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0xe05e, %r14
nop
nop
nop
nop
add %rcx, %rcx
mov $0x5152535455565758, %rbx
movq %rbx, (%r14)
nop
nop
nop
nop
sub %rcx, %rcx
// Store
lea addresses_PSE+0x1de66, %rbp
nop
nop
nop
inc %rsi
movb $0x51, (%rbp)
nop
nop
nop
nop
and $42642, %rbp
// Store
lea addresses_normal+0x717e, %rcx
nop
nop
nop
dec %r9
movw $0x5152, (%rcx)
nop
nop
sub %rbp, %rbp
// Store
lea addresses_RW+0xdc5e, %r14
clflush (%r14)
nop
sub %rdi, %rdi
mov $0x5152535455565758, %rbp
movq %rbp, (%r14)
nop
and %rcx, %rcx
// Store
lea addresses_WC+0x1fa1e, %rbx
nop
nop
nop
nop
add $45808, %r9
mov $0x5152535455565758, %rbp
movq %rbp, %xmm7
movups %xmm7, (%rbx)
nop
xor %rsi, %rsi
// Faulty Load
lea addresses_RW+0x13e5e, %rbp
clflush (%rbp)
nop
inc %r14
mov (%rbp), %r9d
lea oracles, %rbp
and $0xff, %r9
shlq $12, %r9
mov (%rbp,%r9,1), %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 2, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
oeis/173/A173279.asm | neoneye/loda-programs | 11 | 177619 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A173279: Irregular triangle read by rows: M(n,k) = (n-2*k)!, k=0..floor(n/2).
; Submitted by <NAME>
; 1,1,2,1,6,1,24,2,1,120,6,1,720,24,2,1,5040,120,6,1,40320,720,24,2,1,362880,5040,120,6,1,3628800,40320,720,24,2,1,39916800,362880,5040,120,6,1,479001600,3628800,40320,720,24,2,1,6227020800,39916800,362880,5040,120,6,1,87178291200
seq $0,82375 ; Irregular triangle read by rows: row n begins with n and decreases by 2 until 0 or 1 is reached, for n >= 0.
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
|
proofs/Classes.agda | samuelhklumpers/strong-vector | 0 | 16137 | module Classes where
open import Agda.Primitive
open import Agda.Builtin.Equality
open import Relation.Binary.PropositionalEquality.Core
open ≡-Reasoning
id : ∀ {ℓ} {A : Set ℓ} → A → A
id x = x
_$_ : ∀ {ℓ} {A B : Set ℓ} → (A → B) → A → B
_$_ = id
_∘_ : ∀ {ℓ} {A B C : Set ℓ} → (B → C) → (A → B) → A → C
f ∘ g = λ x → f (g x)
record Functor {ℓ} (F : Set ℓ → Set ℓ) : Set (lsuc ℓ) where
field
fmap : ∀ {A B} → (A → B) → F A → F B
F-id : ∀ {A} → (a : F A) → fmap id a ≡ a
F-∘ : ∀ {A B C} → (g : B → C) (f : A → B) (a : F A) → fmap (g ∘ f) a ≡ (fmap g ∘ fmap f) a
_<$>_ : ∀ {A B} → (A → B) → F A → F B
_<$>_ = fmap
infixl 20 _<$>_
open Functor {{...}} public
record Applicative (F : Set → Set) : Set₁ where
field
{{funF}} : Functor F
pure : {A : Set} → A → F A
_<*>_ : {A B : Set} → F (A → B) → F A → F B
A-id : ∀ {A} → (v : F A) → pure id <*> v ≡ v
A-∘ : ∀ {A B C} → (u : F (B → C)) (v : F (A → B)) (w : F A) → pure _∘_ <*> u <*> v <*> w ≡ u <*> (v <*> w)
A-hom : ∀ {A B} → (f : A → B) (x : A) → pure f <*> pure x ≡ pure (f x)
A-ic : ∀ {A B} → (u : F (A → B)) (y : A) → u <*> pure y ≡ pure (_$ y) <*> u
infixl 20 _<*>_
open Applicative {{...}} public
postulate
-- this is from parametricity: fmap is universal w.r.t. the functor laws
appFun : ∀ {A B F} {{aF : Applicative F}} → (f : A → B) (x : F A) → pure f <*> x ≡ fmap f x
record Monad (F : Set → Set) : Set₁ where
field
{{appF}} : Applicative F
_>>=_ : ∀ {A B} → F A → (A → F B) → F B
return : ∀ {A} → A → F A
return = pure
_>=>_ : {A B C : Set} → (A → F B) → (B → F C) → A → F C
f >=> g = λ a → f a >>= g
infixl 10 _>>=_
infixr 10 _>=>_
field
left-1 : ∀ {A B} → (a : A) (k : A → F B) → return a >>= k ≡ k a
right-1 : ∀ {A} → (m : F A) → m >>= return ≡ m
assoc : ∀ {A B C D} → (f : A → F B) (g : B → F C) (h : C → F D) (a : A) → (f >=> (g >=> h)) a ≡ ((f >=> g) >=> h) a
open Monad {{...}} public
|
ProcessingLexer.g4 | gagik/ppprocessing | 0 | 6274 | <filename>ProcessingLexer.g4<gh_stars>0
/*
Derived from Processing preprocessor code by <NAME> and <NAME>.
Copyright (c) 2021 <NAME>
*/
lexer grammar ProcessingLexer;
import JavaLexer;
// // add color literal notations for
// // #ff5522
// HEX_COLOR_LITERAL
// : '#' HEX_COLOR_VALUE
// ;
HEX_COLOR_VALUE: HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT;
HEX_START: '#';
CIRCLE: 'circle';
ELLIPSE: 'ellipse';
RECT: 'rect';
LINE: 'line';
// catch floating point numbers in a parser rule
DECIMAL_LITERAL: ('0' | [1-9] (Digits? | '_'+ Digits)) [lL]?;
SIZE: 'size';
ABS_FUNC: 'abs';
SUBTRACT: '-';
ADD: '+';
SIN: 'sin';
COS: 'cos';
// special variables
FRAMECOUNT: 'frameCount';
// color-related
COLOR: 'color';
FILL: 'fill';
BACKGROUND: 'background';
STROKE: 'stroke';
HEX_DIGIT: [0-9a-fA-F];
// copy from Java.g4 where is is just a fragment
HEX_FLOAT_LITERAL: '0' [xX] (HexDigits '.'? | HexDigits? '.' HexDigits) [pP] [+-]? Digits [fFdD]?; |
usertests.asm | Nehoray-Marziano/XV6-Scheduling-Policies | 0 | 244596 |
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
return randstate;
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 0c sub $0xc,%esp
printf(1, "usertests starting\n");
11: 68 26 53 00 00 push $0x5326
16: 6a 01 push $0x1
18: e8 c3 3f 00 00 call 3fe0 <printf>
if(open("usertests.ran", 0) >= 0){
1d: 59 pop %ecx
1e: 58 pop %eax
1f: 6a 00 push $0x0
21: 68 3a 53 00 00 push $0x533a
26: e8 87 3e 00 00 call 3eb2 <open>
2b: 83 c4 10 add $0x10,%esp
2e: 85 c0 test %eax,%eax
30: 78 1a js 4c <main+0x4c>
printf(1, "already ran user tests -- rebuild fs.img\n");
32: 52 push %edx
33: 52 push %edx
34: 68 a4 5a 00 00 push $0x5aa4
39: 6a 01 push $0x1
3b: e8 a0 3f 00 00 call 3fe0 <printf>
exit(0);
40: c7 04 24 00 00 00 00 movl $0x0,(%esp)
47: e8 26 3e 00 00 call 3e72 <exit>
}
close(open("usertests.ran", O_CREATE));
4c: 50 push %eax
4d: 50 push %eax
4e: 68 00 02 00 00 push $0x200
53: 68 3a 53 00 00 push $0x533a
58: e8 55 3e 00 00 call 3eb2 <open>
5d: 89 04 24 mov %eax,(%esp)
60: e8 35 3e 00 00 call 3e9a <close>
argptest();
65: e8 26 3b 00 00 call 3b90 <argptest>
createdelete();
6a: e8 81 13 00 00 call 13f0 <createdelete>
linkunlink();
6f: e8 2c 1d 00 00 call 1da0 <linkunlink>
concreate();
74: e8 e7 19 00 00 call 1a60 <concreate>
fourfiles();
79: e8 32 11 00 00 call 11b0 <fourfiles>
sharedfd();
7e: e8 4d 0f 00 00 call fd0 <sharedfd>
bigargtest();
83: e8 88 37 00 00 call 3810 <bigargtest>
bigwrite();
88: e8 53 27 00 00 call 27e0 <bigwrite>
bigargtest();
8d: e8 7e 37 00 00 call 3810 <bigargtest>
bsstest();
92: e8 f9 36 00 00 call 3790 <bsstest>
sbrktest();
97: e8 94 31 00 00 call 3230 <sbrktest>
validatetest();
9c: e8 2f 36 00 00 call 36d0 <validatetest>
opentest();
a1: e8 ea 03 00 00 call 490 <opentest>
writetest();
a6: e8 85 04 00 00 call 530 <writetest>
writetest1();
ab: e8 90 06 00 00 call 740 <writetest1>
createtest();
b0: e8 8b 08 00 00 call 940 <createtest>
openiputtest();
b5: e8 a6 02 00 00 call 360 <openiputtest>
exitiputtest();
ba: e8 71 01 00 00 call 230 <exitiputtest>
iputtest();
bf: e8 6c 00 00 00 call 130 <iputtest>
mem();
c4: e8 27 0e 00 00 call ef0 <mem>
pipe1();
c9: e8 72 0a 00 00 call b40 <pipe1>
preempt();
ce: e8 2d 0c 00 00 call d00 <preempt>
exitwait(null);
d3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
da: e8 71 0d 00 00 call e50 <exitwait>
rmdot();
df: e8 4c 2b 00 00 call 2c30 <rmdot>
fourteen();
e4: e8 e7 29 00 00 call 2ad0 <fourteen>
bigfile();
e9: e8 e2 27 00 00 call 28d0 <bigfile>
subdir();
ee: e8 0d 1f 00 00 call 2000 <subdir>
linktest();
f3: e8 18 17 00 00 call 1810 <linktest>
unlinkread();
f8: e8 53 15 00 00 call 1650 <unlinkread>
dirfile();
fd: e8 de 2c 00 00 call 2de0 <dirfile>
iref();
102: e8 19 2f 00 00 call 3020 <iref>
forktest();
107: e8 44 30 00 00 call 3150 <forktest>
bigdir(); // slow
10c: e8 9f 1d 00 00 call 1eb0 <bigdir>
uio();
111: e8 ea 39 00 00 call 3b00 <uio>
exectest();
116: e8 d5 09 00 00 call af0 <exectest>
exit(0);
11b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
122: e8 4b 3d 00 00 call 3e72 <exit>
127: 66 90 xchg %ax,%ax
129: 66 90 xchg %ax,%ax
12b: 66 90 xchg %ax,%ax
12d: 66 90 xchg %ax,%ax
12f: 90 nop
00000130 <iputtest>:
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 83 ec 10 sub $0x10,%esp
printf(stdout, "iput test\n");
136: 68 cc 43 00 00 push $0x43cc
13b: ff 35 e8 63 00 00 pushl 0x63e8
141: e8 9a 3e 00 00 call 3fe0 <printf>
if(mkdir("iputdir") < 0){
146: c7 04 24 5f 43 00 00 movl $0x435f,(%esp)
14d: e8 88 3d 00 00 call 3eda <mkdir>
152: 83 c4 10 add $0x10,%esp
155: 85 c0 test %eax,%eax
157: 78 58 js 1b1 <iputtest+0x81>
if(chdir("iputdir") < 0){
159: 83 ec 0c sub $0xc,%esp
15c: 68 5f 43 00 00 push $0x435f
161: e8 7c 3d 00 00 call 3ee2 <chdir>
166: 83 c4 10 add $0x10,%esp
169: 85 c0 test %eax,%eax
16b: 0f 88 9a 00 00 00 js 20b <iputtest+0xdb>
if(unlink("../iputdir") < 0){
171: 83 ec 0c sub $0xc,%esp
174: 68 5c 43 00 00 push $0x435c
179: e8 44 3d 00 00 call 3ec2 <unlink>
17e: 83 c4 10 add $0x10,%esp
181: 85 c0 test %eax,%eax
183: 78 68 js 1ed <iputtest+0xbd>
if(chdir("/") < 0){
185: 83 ec 0c sub $0xc,%esp
188: 68 81 43 00 00 push $0x4381
18d: e8 50 3d 00 00 call 3ee2 <chdir>
192: 83 c4 10 add $0x10,%esp
195: 85 c0 test %eax,%eax
197: 78 36 js 1cf <iputtest+0x9f>
printf(stdout, "iput test ok\n");
199: 83 ec 08 sub $0x8,%esp
19c: 68 04 44 00 00 push $0x4404
1a1: ff 35 e8 63 00 00 pushl 0x63e8
1a7: e8 34 3e 00 00 call 3fe0 <printf>
}
1ac: 83 c4 10 add $0x10,%esp
1af: c9 leave
1b0: c3 ret
printf(stdout, "mkdir failed\n");
1b1: 50 push %eax
1b2: 50 push %eax
1b3: 68 38 43 00 00 push $0x4338
1b8: ff 35 e8 63 00 00 pushl 0x63e8
1be: e8 1d 3e 00 00 call 3fe0 <printf>
exit(0);
1c3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1ca: e8 a3 3c 00 00 call 3e72 <exit>
printf(stdout, "chdir / failed\n");
1cf: 50 push %eax
1d0: 50 push %eax
1d1: 68 83 43 00 00 push $0x4383
1d6: ff 35 e8 63 00 00 pushl 0x63e8
1dc: e8 ff 3d 00 00 call 3fe0 <printf>
exit(0);
1e1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1e8: e8 85 3c 00 00 call 3e72 <exit>
printf(stdout, "unlink ../iputdir failed\n");
1ed: 52 push %edx
1ee: 52 push %edx
1ef: 68 67 43 00 00 push $0x4367
1f4: ff 35 e8 63 00 00 pushl 0x63e8
1fa: e8 e1 3d 00 00 call 3fe0 <printf>
exit(0);
1ff: c7 04 24 00 00 00 00 movl $0x0,(%esp)
206: e8 67 3c 00 00 call 3e72 <exit>
printf(stdout, "chdir iputdir failed\n");
20b: 51 push %ecx
20c: 51 push %ecx
20d: 68 46 43 00 00 push $0x4346
212: ff 35 e8 63 00 00 pushl 0x63e8
218: e8 c3 3d 00 00 call 3fe0 <printf>
exit(0);
21d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
224: e8 49 3c 00 00 call 3e72 <exit>
229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000230 <exitiputtest>:
{
230: 55 push %ebp
231: 89 e5 mov %esp,%ebp
233: 83 ec 10 sub $0x10,%esp
printf(stdout, "exitiput test\n");
236: 68 93 43 00 00 push $0x4393
23b: ff 35 e8 63 00 00 pushl 0x63e8
241: e8 9a 3d 00 00 call 3fe0 <printf>
pid = fork();
246: e8 1f 3c 00 00 call 3e6a <fork>
if(pid < 0){
24b: 83 c4 10 add $0x10,%esp
24e: 85 c0 test %eax,%eax
250: 0f 88 a1 00 00 00 js 2f7 <exitiputtest+0xc7>
if(pid == 0){
256: 75 58 jne 2b0 <exitiputtest+0x80>
if(mkdir("iputdir") < 0){
258: 83 ec 0c sub $0xc,%esp
25b: 68 5f 43 00 00 push $0x435f
260: e8 75 3c 00 00 call 3eda <mkdir>
265: 83 c4 10 add $0x10,%esp
268: 85 c0 test %eax,%eax
26a: 0f 88 c3 00 00 00 js 333 <exitiputtest+0x103>
if(chdir("iputdir") < 0){
270: 83 ec 0c sub $0xc,%esp
273: 68 5f 43 00 00 push $0x435f
278: e8 65 3c 00 00 call 3ee2 <chdir>
27d: 83 c4 10 add $0x10,%esp
280: 85 c0 test %eax,%eax
282: 0f 88 8d 00 00 00 js 315 <exitiputtest+0xe5>
if(unlink("../iputdir") < 0){
288: 83 ec 0c sub $0xc,%esp
28b: 68 5c 43 00 00 push $0x435c
290: e8 2d 3c 00 00 call 3ec2 <unlink>
295: 83 c4 10 add $0x10,%esp
298: 85 c0 test %eax,%eax
29a: 78 3c js 2d8 <exitiputtest+0xa8>
exit(0);
29c: 83 ec 0c sub $0xc,%esp
29f: 6a 00 push $0x0
2a1: e8 cc 3b 00 00 call 3e72 <exit>
2a6: 8d 76 00 lea 0x0(%esi),%esi
2a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
wait(null);
2b0: 83 ec 0c sub $0xc,%esp
2b3: 6a 00 push $0x0
2b5: e8 c0 3b 00 00 call 3e7a <wait>
printf(stdout, "exitiput test ok\n");
2ba: 58 pop %eax
2bb: 5a pop %edx
2bc: 68 b6 43 00 00 push $0x43b6
2c1: ff 35 e8 63 00 00 pushl 0x63e8
2c7: e8 14 3d 00 00 call 3fe0 <printf>
}
2cc: 83 c4 10 add $0x10,%esp
2cf: c9 leave
2d0: c3 ret
2d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printf(stdout, "unlink ../iputdir failed\n");
2d8: 83 ec 08 sub $0x8,%esp
2db: 68 67 43 00 00 push $0x4367
2e0: ff 35 e8 63 00 00 pushl 0x63e8
2e6: e8 f5 3c 00 00 call 3fe0 <printf>
exit(0);
2eb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f2: e8 7b 3b 00 00 call 3e72 <exit>
printf(stdout, "fork failed\n");
2f7: 50 push %eax
2f8: 50 push %eax
2f9: 68 79 52 00 00 push $0x5279
2fe: ff 35 e8 63 00 00 pushl 0x63e8
304: e8 d7 3c 00 00 call 3fe0 <printf>
exit(0);
309: c7 04 24 00 00 00 00 movl $0x0,(%esp)
310: e8 5d 3b 00 00 call 3e72 <exit>
printf(stdout, "child chdir failed\n");
315: 51 push %ecx
316: 51 push %ecx
317: 68 a2 43 00 00 push $0x43a2
31c: ff 35 e8 63 00 00 pushl 0x63e8
322: e8 b9 3c 00 00 call 3fe0 <printf>
exit(0);
327: c7 04 24 00 00 00 00 movl $0x0,(%esp)
32e: e8 3f 3b 00 00 call 3e72 <exit>
printf(stdout, "mkdir failed\n");
333: 50 push %eax
334: 50 push %eax
335: 68 38 43 00 00 push $0x4338
33a: ff 35 e8 63 00 00 pushl 0x63e8
340: e8 9b 3c 00 00 call 3fe0 <printf>
exit(0);
345: c7 04 24 00 00 00 00 movl $0x0,(%esp)
34c: e8 21 3b 00 00 call 3e72 <exit>
351: eb 0d jmp 360 <openiputtest>
353: 90 nop
354: 90 nop
355: 90 nop
356: 90 nop
357: 90 nop
358: 90 nop
359: 90 nop
35a: 90 nop
35b: 90 nop
35c: 90 nop
35d: 90 nop
35e: 90 nop
35f: 90 nop
00000360 <openiputtest>:
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 83 ec 10 sub $0x10,%esp
printf(stdout, "openiput test\n");
366: 68 c8 43 00 00 push $0x43c8
36b: ff 35 e8 63 00 00 pushl 0x63e8
371: e8 6a 3c 00 00 call 3fe0 <printf>
if(mkdir("oidir") < 0){
376: c7 04 24 d7 43 00 00 movl $0x43d7,(%esp)
37d: e8 58 3b 00 00 call 3eda <mkdir>
382: 83 c4 10 add $0x10,%esp
385: 85 c0 test %eax,%eax
387: 0f 88 9d 00 00 00 js 42a <openiputtest+0xca>
pid = fork();
38d: e8 d8 3a 00 00 call 3e6a <fork>
if(pid < 0){
392: 85 c0 test %eax,%eax
394: 0f 88 ae 00 00 00 js 448 <openiputtest+0xe8>
if(pid == 0){
39a: 75 3c jne 3d8 <openiputtest+0x78>
int fd = open("oidir", O_RDWR);
39c: 83 ec 08 sub $0x8,%esp
39f: 6a 02 push $0x2
3a1: 68 d7 43 00 00 push $0x43d7
3a6: e8 07 3b 00 00 call 3eb2 <open>
if(fd >= 0){
3ab: 83 c4 10 add $0x10,%esp
3ae: 85 c0 test %eax,%eax
3b0: 78 6e js 420 <openiputtest+0xc0>
printf(stdout, "open directory for write succeeded\n");
3b2: 83 ec 08 sub $0x8,%esp
3b5: 68 5c 53 00 00 push $0x535c
3ba: ff 35 e8 63 00 00 pushl 0x63e8
3c0: e8 1b 3c 00 00 call 3fe0 <printf>
exit(0);
3c5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3cc: e8 a1 3a 00 00 call 3e72 <exit>
3d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sleep(1);
3d8: 83 ec 0c sub $0xc,%esp
3db: 6a 01 push $0x1
3dd: e8 20 3b 00 00 call 3f02 <sleep>
if(unlink("oidir") != 0){
3e2: c7 04 24 d7 43 00 00 movl $0x43d7,(%esp)
3e9: e8 d4 3a 00 00 call 3ec2 <unlink>
3ee: 83 c4 10 add $0x10,%esp
3f1: 85 c0 test %eax,%eax
3f3: 75 71 jne 466 <openiputtest+0x106>
wait(null);
3f5: 83 ec 0c sub $0xc,%esp
3f8: 6a 00 push $0x0
3fa: e8 7b 3a 00 00 call 3e7a <wait>
printf(stdout, "openiput test ok\n");
3ff: 58 pop %eax
400: 5a pop %edx
401: 68 00 44 00 00 push $0x4400
406: ff 35 e8 63 00 00 pushl 0x63e8
40c: e8 cf 3b 00 00 call 3fe0 <printf>
}
411: 83 c4 10 add $0x10,%esp
414: c9 leave
415: c3 ret
416: 8d 76 00 lea 0x0(%esi),%esi
419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
exit(0);
420: 83 ec 0c sub $0xc,%esp
423: 6a 00 push $0x0
425: e8 48 3a 00 00 call 3e72 <exit>
printf(stdout, "mkdir oidir failed\n");
42a: 50 push %eax
42b: 50 push %eax
42c: 68 dd 43 00 00 push $0x43dd
431: ff 35 e8 63 00 00 pushl 0x63e8
437: e8 a4 3b 00 00 call 3fe0 <printf>
exit(0);
43c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
443: e8 2a 3a 00 00 call 3e72 <exit>
printf(stdout, "fork failed\n");
448: 50 push %eax
449: 50 push %eax
44a: 68 79 52 00 00 push $0x5279
44f: ff 35 e8 63 00 00 pushl 0x63e8
455: e8 86 3b 00 00 call 3fe0 <printf>
exit(0);
45a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
461: e8 0c 3a 00 00 call 3e72 <exit>
printf(stdout, "unlink failed\n");
466: 51 push %ecx
467: 51 push %ecx
468: 68 f1 43 00 00 push $0x43f1
46d: ff 35 e8 63 00 00 pushl 0x63e8
473: e8 68 3b 00 00 call 3fe0 <printf>
exit(0);
478: c7 04 24 00 00 00 00 movl $0x0,(%esp)
47f: e8 ee 39 00 00 call 3e72 <exit>
484: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
48a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000490 <opentest>:
{
490: 55 push %ebp
491: 89 e5 mov %esp,%ebp
493: 83 ec 10 sub $0x10,%esp
printf(stdout, "open test\n");
496: 68 12 44 00 00 push $0x4412
49b: ff 35 e8 63 00 00 pushl 0x63e8
4a1: e8 3a 3b 00 00 call 3fe0 <printf>
fd = open("echo", 0);
4a6: 58 pop %eax
4a7: 5a pop %edx
4a8: 6a 00 push $0x0
4aa: 68 1d 44 00 00 push $0x441d
4af: e8 fe 39 00 00 call 3eb2 <open>
if(fd < 0){
4b4: 83 c4 10 add $0x10,%esp
4b7: 85 c0 test %eax,%eax
4b9: 78 36 js 4f1 <opentest+0x61>
close(fd);
4bb: 83 ec 0c sub $0xc,%esp
4be: 50 push %eax
4bf: e8 d6 39 00 00 call 3e9a <close>
fd = open("doesnotexist", 0);
4c4: 5a pop %edx
4c5: 59 pop %ecx
4c6: 6a 00 push $0x0
4c8: 68 35 44 00 00 push $0x4435
4cd: e8 e0 39 00 00 call 3eb2 <open>
if(fd >= 0){
4d2: 83 c4 10 add $0x10,%esp
4d5: 85 c0 test %eax,%eax
4d7: 79 36 jns 50f <opentest+0x7f>
printf(stdout, "open test ok\n");
4d9: 83 ec 08 sub $0x8,%esp
4dc: 68 60 44 00 00 push $0x4460
4e1: ff 35 e8 63 00 00 pushl 0x63e8
4e7: e8 f4 3a 00 00 call 3fe0 <printf>
}
4ec: 83 c4 10 add $0x10,%esp
4ef: c9 leave
4f0: c3 ret
printf(stdout, "open echo failed!\n");
4f1: 50 push %eax
4f2: 50 push %eax
4f3: 68 22 44 00 00 push $0x4422
4f8: ff 35 e8 63 00 00 pushl 0x63e8
4fe: e8 dd 3a 00 00 call 3fe0 <printf>
exit(0);
503: c7 04 24 00 00 00 00 movl $0x0,(%esp)
50a: e8 63 39 00 00 call 3e72 <exit>
printf(stdout, "open doesnotexist succeeded!\n");
50f: 50 push %eax
510: 50 push %eax
511: 68 42 44 00 00 push $0x4442
516: ff 35 e8 63 00 00 pushl 0x63e8
51c: e8 bf 3a 00 00 call 3fe0 <printf>
exit(0);
521: c7 04 24 00 00 00 00 movl $0x0,(%esp)
528: e8 45 39 00 00 call 3e72 <exit>
52d: 8d 76 00 lea 0x0(%esi),%esi
00000530 <writetest>:
{
530: 55 push %ebp
531: 89 e5 mov %esp,%ebp
533: 56 push %esi
534: 53 push %ebx
printf(stdout, "small file test\n");
535: 83 ec 08 sub $0x8,%esp
538: 68 6e 44 00 00 push $0x446e
53d: ff 35 e8 63 00 00 pushl 0x63e8
543: e8 98 3a 00 00 call 3fe0 <printf>
fd = open("small", O_CREATE|O_RDWR);
548: 58 pop %eax
549: 5a pop %edx
54a: 68 02 02 00 00 push $0x202
54f: 68 7f 44 00 00 push $0x447f
554: e8 59 39 00 00 call 3eb2 <open>
if(fd >= 0){
559: 83 c4 10 add $0x10,%esp
55c: 85 c0 test %eax,%eax
55e: 0f 88 af 01 00 00 js 713 <writetest+0x1e3>
printf(stdout, "creat small succeeded; ok\n");
564: 83 ec 08 sub $0x8,%esp
567: 89 c6 mov %eax,%esi
for(i = 0; i < 100; i++){
569: 31 db xor %ebx,%ebx
printf(stdout, "creat small succeeded; ok\n");
56b: 68 85 44 00 00 push $0x4485
570: ff 35 e8 63 00 00 pushl 0x63e8
576: e8 65 3a 00 00 call 3fe0 <printf>
57b: 83 c4 10 add $0x10,%esp
57e: 66 90 xchg %ax,%ax
if(write(fd, "aaaaaaaaaa", 10) != 10){
580: 83 ec 04 sub $0x4,%esp
583: 6a 0a push $0xa
585: 68 bc 44 00 00 push $0x44bc
58a: 56 push %esi
58b: e8 02 39 00 00 call 3e92 <write>
590: 83 c4 10 add $0x10,%esp
593: 83 f8 0a cmp $0xa,%eax
596: 0f 85 dd 00 00 00 jne 679 <writetest+0x149>
if(write(fd, "bbbbbbbbbb", 10) != 10){
59c: 83 ec 04 sub $0x4,%esp
59f: 6a 0a push $0xa
5a1: 68 c7 44 00 00 push $0x44c7
5a6: 56 push %esi
5a7: e8 e6 38 00 00 call 3e92 <write>
5ac: 83 c4 10 add $0x10,%esp
5af: 83 f8 0a cmp $0xa,%eax
5b2: 0f 85 e1 00 00 00 jne 699 <writetest+0x169>
for(i = 0; i < 100; i++){
5b8: 83 c3 01 add $0x1,%ebx
5bb: 83 fb 64 cmp $0x64,%ebx
5be: 75 c0 jne 580 <writetest+0x50>
printf(stdout, "writes ok\n");
5c0: 83 ec 08 sub $0x8,%esp
5c3: 68 d2 44 00 00 push $0x44d2
5c8: ff 35 e8 63 00 00 pushl 0x63e8
5ce: e8 0d 3a 00 00 call 3fe0 <printf>
close(fd);
5d3: 89 34 24 mov %esi,(%esp)
5d6: e8 bf 38 00 00 call 3e9a <close>
fd = open("small", O_RDONLY);
5db: 5b pop %ebx
5dc: 5e pop %esi
5dd: 6a 00 push $0x0
5df: 68 7f 44 00 00 push $0x447f
5e4: e8 c9 38 00 00 call 3eb2 <open>
if(fd >= 0){
5e9: 83 c4 10 add $0x10,%esp
5ec: 85 c0 test %eax,%eax
fd = open("small", O_RDONLY);
5ee: 89 c3 mov %eax,%ebx
if(fd >= 0){
5f0: 0f 88 c3 00 00 00 js 6b9 <writetest+0x189>
printf(stdout, "open small succeeded ok\n");
5f6: 83 ec 08 sub $0x8,%esp
5f9: 68 dd 44 00 00 push $0x44dd
5fe: ff 35 e8 63 00 00 pushl 0x63e8
604: e8 d7 39 00 00 call 3fe0 <printf>
i = read(fd, buf, 2000);
609: 83 c4 0c add $0xc,%esp
60c: 68 d0 07 00 00 push $0x7d0
611: 68 c0 8b 00 00 push $0x8bc0
616: 53 push %ebx
617: e8 6e 38 00 00 call 3e8a <read>
if(i == 2000){
61c: 83 c4 10 add $0x10,%esp
61f: 3d d0 07 00 00 cmp $0x7d0,%eax
624: 0f 85 ad 00 00 00 jne 6d7 <writetest+0x1a7>
printf(stdout, "read succeeded ok\n");
62a: 83 ec 08 sub $0x8,%esp
62d: 68 11 45 00 00 push $0x4511
632: ff 35 e8 63 00 00 pushl 0x63e8
638: e8 a3 39 00 00 call 3fe0 <printf>
close(fd);
63d: 89 1c 24 mov %ebx,(%esp)
640: e8 55 38 00 00 call 3e9a <close>
if(unlink("small") < 0){
645: c7 04 24 7f 44 00 00 movl $0x447f,(%esp)
64c: e8 71 38 00 00 call 3ec2 <unlink>
651: 83 c4 10 add $0x10,%esp
654: 85 c0 test %eax,%eax
656: 0f 88 99 00 00 00 js 6f5 <writetest+0x1c5>
printf(stdout, "small file test ok\n");
65c: 83 ec 08 sub $0x8,%esp
65f: 68 39 45 00 00 push $0x4539
664: ff 35 e8 63 00 00 pushl 0x63e8
66a: e8 71 39 00 00 call 3fe0 <printf>
}
66f: 83 c4 10 add $0x10,%esp
672: 8d 65 f8 lea -0x8(%ebp),%esp
675: 5b pop %ebx
676: 5e pop %esi
677: 5d pop %ebp
678: c3 ret
printf(stdout, "error: write aa %d new file failed\n", i);
679: 83 ec 04 sub $0x4,%esp
67c: 53 push %ebx
67d: 68 80 53 00 00 push $0x5380
682: ff 35 e8 63 00 00 pushl 0x63e8
688: e8 53 39 00 00 call 3fe0 <printf>
exit(0);
68d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
694: e8 d9 37 00 00 call 3e72 <exit>
printf(stdout, "error: write bb %d new file failed\n", i);
699: 83 ec 04 sub $0x4,%esp
69c: 53 push %ebx
69d: 68 a4 53 00 00 push $0x53a4
6a2: ff 35 e8 63 00 00 pushl 0x63e8
6a8: e8 33 39 00 00 call 3fe0 <printf>
exit(0);
6ad: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6b4: e8 b9 37 00 00 call 3e72 <exit>
printf(stdout, "error: open small failed!\n");
6b9: 51 push %ecx
6ba: 51 push %ecx
6bb: 68 f6 44 00 00 push $0x44f6
6c0: ff 35 e8 63 00 00 pushl 0x63e8
6c6: e8 15 39 00 00 call 3fe0 <printf>
exit(0);
6cb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6d2: e8 9b 37 00 00 call 3e72 <exit>
printf(stdout, "read failed\n");
6d7: 52 push %edx
6d8: 52 push %edx
6d9: 68 3d 48 00 00 push $0x483d
6de: ff 35 e8 63 00 00 pushl 0x63e8
6e4: e8 f7 38 00 00 call 3fe0 <printf>
exit(0);
6e9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6f0: e8 7d 37 00 00 call 3e72 <exit>
printf(stdout, "unlink small failed\n");
6f5: 50 push %eax
6f6: 50 push %eax
6f7: 68 24 45 00 00 push $0x4524
6fc: ff 35 e8 63 00 00 pushl 0x63e8
702: e8 d9 38 00 00 call 3fe0 <printf>
exit(0);
707: c7 04 24 00 00 00 00 movl $0x0,(%esp)
70e: e8 5f 37 00 00 call 3e72 <exit>
printf(stdout, "error: creat small failed!\n");
713: 50 push %eax
714: 50 push %eax
715: 68 a0 44 00 00 push $0x44a0
71a: ff 35 e8 63 00 00 pushl 0x63e8
720: e8 bb 38 00 00 call 3fe0 <printf>
exit(0);
725: c7 04 24 00 00 00 00 movl $0x0,(%esp)
72c: e8 41 37 00 00 call 3e72 <exit>
731: eb 0d jmp 740 <writetest1>
733: 90 nop
734: 90 nop
735: 90 nop
736: 90 nop
737: 90 nop
738: 90 nop
739: 90 nop
73a: 90 nop
73b: 90 nop
73c: 90 nop
73d: 90 nop
73e: 90 nop
73f: 90 nop
00000740 <writetest1>:
{
740: 55 push %ebp
741: 89 e5 mov %esp,%ebp
743: 56 push %esi
744: 53 push %ebx
printf(stdout, "big files test\n");
745: 83 ec 08 sub $0x8,%esp
748: 68 4d 45 00 00 push $0x454d
74d: ff 35 e8 63 00 00 pushl 0x63e8
753: e8 88 38 00 00 call 3fe0 <printf>
fd = open("big", O_CREATE|O_RDWR);
758: 58 pop %eax
759: 5a pop %edx
75a: 68 02 02 00 00 push $0x202
75f: 68 c7 45 00 00 push $0x45c7
764: e8 49 37 00 00 call 3eb2 <open>
if(fd < 0){
769: 83 c4 10 add $0x10,%esp
76c: 85 c0 test %eax,%eax
76e: 0f 88 88 01 00 00 js 8fc <writetest1+0x1bc>
774: 89 c6 mov %eax,%esi
for(i = 0; i < MAXFILE; i++){
776: 31 db xor %ebx,%ebx
778: 90 nop
779: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(write(fd, buf, 512) != 512){
780: 83 ec 04 sub $0x4,%esp
((int*)buf)[0] = i;
783: 89 1d c0 8b 00 00 mov %ebx,0x8bc0
if(write(fd, buf, 512) != 512){
789: 68 00 02 00 00 push $0x200
78e: 68 c0 8b 00 00 push $0x8bc0
793: 56 push %esi
794: e8 f9 36 00 00 call 3e92 <write>
799: 83 c4 10 add $0x10,%esp
79c: 3d 00 02 00 00 cmp $0x200,%eax
7a1: 0f 85 b7 00 00 00 jne 85e <writetest1+0x11e>
for(i = 0; i < MAXFILE; i++){
7a7: 83 c3 01 add $0x1,%ebx
7aa: 81 fb 8c 00 00 00 cmp $0x8c,%ebx
7b0: 75 ce jne 780 <writetest1+0x40>
close(fd);
7b2: 83 ec 0c sub $0xc,%esp
7b5: 56 push %esi
7b6: e8 df 36 00 00 call 3e9a <close>
fd = open("big", O_RDONLY);
7bb: 5b pop %ebx
7bc: 5e pop %esi
7bd: 6a 00 push $0x0
7bf: 68 c7 45 00 00 push $0x45c7
7c4: e8 e9 36 00 00 call 3eb2 <open>
if(fd < 0){
7c9: 83 c4 10 add $0x10,%esp
7cc: 85 c0 test %eax,%eax
fd = open("big", O_RDONLY);
7ce: 89 c6 mov %eax,%esi
if(fd < 0){
7d0: 0f 88 08 01 00 00 js 8de <writetest1+0x19e>
n = 0;
7d6: 31 db xor %ebx,%ebx
7d8: eb 21 jmp 7fb <writetest1+0xbb>
7da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(i != 512){
7e0: 3d 00 02 00 00 cmp $0x200,%eax
7e5: 0f 85 b1 00 00 00 jne 89c <writetest1+0x15c>
if(((int*)buf)[0] != n){
7eb: a1 c0 8b 00 00 mov 0x8bc0,%eax
7f0: 39 d8 cmp %ebx,%eax
7f2: 0f 85 86 00 00 00 jne 87e <writetest1+0x13e>
n++;
7f8: 83 c3 01 add $0x1,%ebx
i = read(fd, buf, 512);
7fb: 83 ec 04 sub $0x4,%esp
7fe: 68 00 02 00 00 push $0x200
803: 68 c0 8b 00 00 push $0x8bc0
808: 56 push %esi
809: e8 7c 36 00 00 call 3e8a <read>
if(i == 0){
80e: 83 c4 10 add $0x10,%esp
811: 85 c0 test %eax,%eax
813: 75 cb jne 7e0 <writetest1+0xa0>
if(n == MAXFILE - 1){
815: 81 fb 8b 00 00 00 cmp $0x8b,%ebx
81b: 0f 84 9b 00 00 00 je 8bc <writetest1+0x17c>
close(fd);
821: 83 ec 0c sub $0xc,%esp
824: 56 push %esi
825: e8 70 36 00 00 call 3e9a <close>
if(unlink("big") < 0){
82a: c7 04 24 c7 45 00 00 movl $0x45c7,(%esp)
831: e8 8c 36 00 00 call 3ec2 <unlink>
836: 83 c4 10 add $0x10,%esp
839: 85 c0 test %eax,%eax
83b: 0f 88 d9 00 00 00 js 91a <writetest1+0x1da>
printf(stdout, "big files ok\n");
841: 83 ec 08 sub $0x8,%esp
844: 68 ee 45 00 00 push $0x45ee
849: ff 35 e8 63 00 00 pushl 0x63e8
84f: e8 8c 37 00 00 call 3fe0 <printf>
}
854: 83 c4 10 add $0x10,%esp
857: 8d 65 f8 lea -0x8(%ebp),%esp
85a: 5b pop %ebx
85b: 5e pop %esi
85c: 5d pop %ebp
85d: c3 ret
printf(stdout, "error: write big file failed\n", i);
85e: 83 ec 04 sub $0x4,%esp
861: 53 push %ebx
862: 68 77 45 00 00 push $0x4577
867: ff 35 e8 63 00 00 pushl 0x63e8
86d: e8 6e 37 00 00 call 3fe0 <printf>
exit(0);
872: c7 04 24 00 00 00 00 movl $0x0,(%esp)
879: e8 f4 35 00 00 call 3e72 <exit>
printf(stdout, "read content of block %d is %d\n",
87e: 50 push %eax
87f: 53 push %ebx
880: 68 c8 53 00 00 push $0x53c8
885: ff 35 e8 63 00 00 pushl 0x63e8
88b: e8 50 37 00 00 call 3fe0 <printf>
exit(0);
890: c7 04 24 00 00 00 00 movl $0x0,(%esp)
897: e8 d6 35 00 00 call 3e72 <exit>
printf(stdout, "read failed %d\n", i);
89c: 83 ec 04 sub $0x4,%esp
89f: 50 push %eax
8a0: 68 cb 45 00 00 push $0x45cb
8a5: ff 35 e8 63 00 00 pushl 0x63e8
8ab: e8 30 37 00 00 call 3fe0 <printf>
exit(0);
8b0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8b7: e8 b6 35 00 00 call 3e72 <exit>
printf(stdout, "read only %d blocks from big", n);
8bc: 52 push %edx
8bd: 68 8b 00 00 00 push $0x8b
8c2: 68 ae 45 00 00 push $0x45ae
8c7: ff 35 e8 63 00 00 pushl 0x63e8
8cd: e8 0e 37 00 00 call 3fe0 <printf>
exit(0);
8d2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8d9: e8 94 35 00 00 call 3e72 <exit>
printf(stdout, "error: open big failed!\n");
8de: 51 push %ecx
8df: 51 push %ecx
8e0: 68 95 45 00 00 push $0x4595
8e5: ff 35 e8 63 00 00 pushl 0x63e8
8eb: e8 f0 36 00 00 call 3fe0 <printf>
exit(0);
8f0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8f7: e8 76 35 00 00 call 3e72 <exit>
printf(stdout, "error: creat big failed!\n");
8fc: 50 push %eax
8fd: 50 push %eax
8fe: 68 5d 45 00 00 push $0x455d
903: ff 35 e8 63 00 00 pushl 0x63e8
909: e8 d2 36 00 00 call 3fe0 <printf>
exit(0);
90e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
915: e8 58 35 00 00 call 3e72 <exit>
printf(stdout, "unlink big failed\n");
91a: 50 push %eax
91b: 50 push %eax
91c: 68 db 45 00 00 push $0x45db
921: ff 35 e8 63 00 00 pushl 0x63e8
927: e8 b4 36 00 00 call 3fe0 <printf>
exit(0);
92c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
933: e8 3a 35 00 00 call 3e72 <exit>
938: 90 nop
939: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000940 <createtest>:
{
940: 55 push %ebp
941: 89 e5 mov %esp,%ebp
943: 53 push %ebx
name[2] = '\0';
944: bb 30 00 00 00 mov $0x30,%ebx
{
949: 83 ec 0c sub $0xc,%esp
printf(stdout, "many creates, followed by unlink test\n");
94c: 68 e8 53 00 00 push $0x53e8
951: ff 35 e8 63 00 00 pushl 0x63e8
957: e8 84 36 00 00 call 3fe0 <printf>
name[0] = 'a';
95c: c6 05 c0 ab 00 00 61 movb $0x61,0xabc0
name[2] = '\0';
963: c6 05 c2 ab 00 00 00 movb $0x0,0xabc2
96a: 83 c4 10 add $0x10,%esp
96d: 8d 76 00 lea 0x0(%esi),%esi
fd = open(name, O_CREATE|O_RDWR);
970: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
973: 88 1d c1 ab 00 00 mov %bl,0xabc1
979: 83 c3 01 add $0x1,%ebx
fd = open(name, O_CREATE|O_RDWR);
97c: 68 02 02 00 00 push $0x202
981: 68 c0 ab 00 00 push $0xabc0
986: e8 27 35 00 00 call 3eb2 <open>
close(fd);
98b: 89 04 24 mov %eax,(%esp)
98e: e8 07 35 00 00 call 3e9a <close>
for(i = 0; i < 52; i++){
993: 83 c4 10 add $0x10,%esp
996: 80 fb 64 cmp $0x64,%bl
999: 75 d5 jne 970 <createtest+0x30>
name[0] = 'a';
99b: c6 05 c0 ab 00 00 61 movb $0x61,0xabc0
name[2] = '\0';
9a2: c6 05 c2 ab 00 00 00 movb $0x0,0xabc2
9a9: bb 30 00 00 00 mov $0x30,%ebx
9ae: 66 90 xchg %ax,%ax
unlink(name);
9b0: 83 ec 0c sub $0xc,%esp
name[1] = '0' + i;
9b3: 88 1d c1 ab 00 00 mov %bl,0xabc1
9b9: 83 c3 01 add $0x1,%ebx
unlink(name);
9bc: 68 c0 ab 00 00 push $0xabc0
9c1: e8 fc 34 00 00 call 3ec2 <unlink>
for(i = 0; i < 52; i++){
9c6: 83 c4 10 add $0x10,%esp
9c9: 80 fb 64 cmp $0x64,%bl
9cc: 75 e2 jne 9b0 <createtest+0x70>
printf(stdout, "many creates, followed by unlink; ok\n");
9ce: 83 ec 08 sub $0x8,%esp
9d1: 68 10 54 00 00 push $0x5410
9d6: ff 35 e8 63 00 00 pushl 0x63e8
9dc: e8 ff 35 00 00 call 3fe0 <printf>
}
9e1: 83 c4 10 add $0x10,%esp
9e4: 8b 5d fc mov -0x4(%ebp),%ebx
9e7: c9 leave
9e8: c3 ret
9e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000009f0 <dirtest>:
{
9f0: 55 push %ebp
9f1: 89 e5 mov %esp,%ebp
9f3: 83 ec 10 sub $0x10,%esp
printf(stdout, "mkdir test\n");
9f6: 68 fc 45 00 00 push $0x45fc
9fb: ff 35 e8 63 00 00 pushl 0x63e8
a01: e8 da 35 00 00 call 3fe0 <printf>
if(mkdir("dir0") < 0){
a06: c7 04 24 08 46 00 00 movl $0x4608,(%esp)
a0d: e8 c8 34 00 00 call 3eda <mkdir>
a12: 83 c4 10 add $0x10,%esp
a15: 85 c0 test %eax,%eax
a17: 78 58 js a71 <dirtest+0x81>
if(chdir("dir0") < 0){
a19: 83 ec 0c sub $0xc,%esp
a1c: 68 08 46 00 00 push $0x4608
a21: e8 bc 34 00 00 call 3ee2 <chdir>
a26: 83 c4 10 add $0x10,%esp
a29: 85 c0 test %eax,%eax
a2b: 0f 88 9a 00 00 00 js acb <dirtest+0xdb>
if(chdir("..") < 0){
a31: 83 ec 0c sub $0xc,%esp
a34: 68 ad 4b 00 00 push $0x4bad
a39: e8 a4 34 00 00 call 3ee2 <chdir>
a3e: 83 c4 10 add $0x10,%esp
a41: 85 c0 test %eax,%eax
a43: 78 68 js aad <dirtest+0xbd>
if(unlink("dir0") < 0){
a45: 83 ec 0c sub $0xc,%esp
a48: 68 08 46 00 00 push $0x4608
a4d: e8 70 34 00 00 call 3ec2 <unlink>
a52: 83 c4 10 add $0x10,%esp
a55: 85 c0 test %eax,%eax
a57: 78 36 js a8f <dirtest+0x9f>
printf(stdout, "mkdir test ok\n");
a59: 83 ec 08 sub $0x8,%esp
a5c: 68 45 46 00 00 push $0x4645
a61: ff 35 e8 63 00 00 pushl 0x63e8
a67: e8 74 35 00 00 call 3fe0 <printf>
}
a6c: 83 c4 10 add $0x10,%esp
a6f: c9 leave
a70: c3 ret
printf(stdout, "mkdir failed\n");
a71: 50 push %eax
a72: 50 push %eax
a73: 68 38 43 00 00 push $0x4338
a78: ff 35 e8 63 00 00 pushl 0x63e8
a7e: e8 5d 35 00 00 call 3fe0 <printf>
exit(0);
a83: c7 04 24 00 00 00 00 movl $0x0,(%esp)
a8a: e8 e3 33 00 00 call 3e72 <exit>
printf(stdout, "unlink dir0 failed\n");
a8f: 50 push %eax
a90: 50 push %eax
a91: 68 31 46 00 00 push $0x4631
a96: ff 35 e8 63 00 00 pushl 0x63e8
a9c: e8 3f 35 00 00 call 3fe0 <printf>
exit(0);
aa1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
aa8: e8 c5 33 00 00 call 3e72 <exit>
printf(stdout, "chdir .. failed\n");
aad: 52 push %edx
aae: 52 push %edx
aaf: 68 20 46 00 00 push $0x4620
ab4: ff 35 e8 63 00 00 pushl 0x63e8
aba: e8 21 35 00 00 call 3fe0 <printf>
exit(0);
abf: c7 04 24 00 00 00 00 movl $0x0,(%esp)
ac6: e8 a7 33 00 00 call 3e72 <exit>
printf(stdout, "chdir dir0 failed\n");
acb: 51 push %ecx
acc: 51 push %ecx
acd: 68 0d 46 00 00 push $0x460d
ad2: ff 35 e8 63 00 00 pushl 0x63e8
ad8: e8 03 35 00 00 call 3fe0 <printf>
exit(0);
add: c7 04 24 00 00 00 00 movl $0x0,(%esp)
ae4: e8 89 33 00 00 call 3e72 <exit>
ae9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000af0 <exectest>:
{
af0: 55 push %ebp
af1: 89 e5 mov %esp,%ebp
af3: 83 ec 10 sub $0x10,%esp
printf(stdout, "exec test\n");
af6: 68 54 46 00 00 push $0x4654
afb: ff 35 e8 63 00 00 pushl 0x63e8
b01: e8 da 34 00 00 call 3fe0 <printf>
if(exec("echo", echoargv) < 0){
b06: 5a pop %edx
b07: 59 pop %ecx
b08: 68 ec 63 00 00 push $0x63ec
b0d: 68 1d 44 00 00 push $0x441d
b12: e8 93 33 00 00 call 3eaa <exec>
b17: 83 c4 10 add $0x10,%esp
b1a: 85 c0 test %eax,%eax
b1c: 78 02 js b20 <exectest+0x30>
}
b1e: c9 leave
b1f: c3 ret
printf(stdout, "exec echo failed\n");
b20: 50 push %eax
b21: 50 push %eax
b22: 68 5f 46 00 00 push $0x465f
b27: ff 35 e8 63 00 00 pushl 0x63e8
b2d: e8 ae 34 00 00 call 3fe0 <printf>
exit(0);
b32: c7 04 24 00 00 00 00 movl $0x0,(%esp)
b39: e8 34 33 00 00 call 3e72 <exit>
b3e: 66 90 xchg %ax,%ax
00000b40 <pipe1>:
{
b40: 55 push %ebp
b41: 89 e5 mov %esp,%ebp
b43: 57 push %edi
b44: 56 push %esi
b45: 53 push %ebx
if(pipe(fds) != 0){
b46: 8d 45 e0 lea -0x20(%ebp),%eax
{
b49: 83 ec 38 sub $0x38,%esp
if(pipe(fds) != 0){
b4c: 50 push %eax
b4d: e8 30 33 00 00 call 3e82 <pipe>
b52: 83 c4 10 add $0x10,%esp
b55: 85 c0 test %eax,%eax
b57: 0f 85 51 01 00 00 jne cae <pipe1+0x16e>
b5d: 89 c3 mov %eax,%ebx
pid = fork();
b5f: e8 06 33 00 00 call 3e6a <fork>
if(pid == 0){
b64: 83 f8 00 cmp $0x0,%eax
b67: 0f 84 84 00 00 00 je bf1 <pipe1+0xb1>
} else if(pid > 0){
b6d: 0f 8e 55 01 00 00 jle cc8 <pipe1+0x188>
close(fds[1]);
b73: 83 ec 0c sub $0xc,%esp
b76: ff 75 e4 pushl -0x1c(%ebp)
cc = 1;
b79: bf 01 00 00 00 mov $0x1,%edi
close(fds[1]);
b7e: e8 17 33 00 00 call 3e9a <close>
while((n = read(fds[0], buf, cc)) > 0){
b83: 83 c4 10 add $0x10,%esp
total = 0;
b86: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
while((n = read(fds[0], buf, cc)) > 0){
b8d: 83 ec 04 sub $0x4,%esp
b90: 57 push %edi
b91: 68 c0 8b 00 00 push $0x8bc0
b96: ff 75 e0 pushl -0x20(%ebp)
b99: e8 ec 32 00 00 call 3e8a <read>
b9e: 83 c4 10 add $0x10,%esp
ba1: 85 c0 test %eax,%eax
ba3: 0f 8e b0 00 00 00 jle c59 <pipe1+0x119>
if((buf[i] & 0xff) != (seq++ & 0xff)){
ba9: 89 d9 mov %ebx,%ecx
bab: 8d 34 18 lea (%eax,%ebx,1),%esi
bae: f7 d9 neg %ecx
bb0: 38 9c 0b c0 8b 00 00 cmp %bl,0x8bc0(%ebx,%ecx,1)
bb7: 8d 53 01 lea 0x1(%ebx),%edx
bba: 75 1b jne bd7 <pipe1+0x97>
for(i = 0; i < n; i++){
bbc: 39 f2 cmp %esi,%edx
bbe: 89 d3 mov %edx,%ebx
bc0: 75 ee jne bb0 <pipe1+0x70>
cc = cc * 2;
bc2: 01 ff add %edi,%edi
total += n;
bc4: 01 45 d4 add %eax,-0x2c(%ebp)
bc7: b8 00 20 00 00 mov $0x2000,%eax
bcc: 81 ff 00 20 00 00 cmp $0x2000,%edi
bd2: 0f 4f f8 cmovg %eax,%edi
bd5: eb b6 jmp b8d <pipe1+0x4d>
printf(1, "pipe1 oops 2\n");
bd7: 83 ec 08 sub $0x8,%esp
bda: 68 8e 46 00 00 push $0x468e
bdf: 6a 01 push $0x1
be1: e8 fa 33 00 00 call 3fe0 <printf>
return;
be6: 83 c4 10 add $0x10,%esp
}
be9: 8d 65 f4 lea -0xc(%ebp),%esp
bec: 5b pop %ebx
bed: 5e pop %esi
bee: 5f pop %edi
bef: 5d pop %ebp
bf0: c3 ret
close(fds[0]);
bf1: 83 ec 0c sub $0xc,%esp
bf4: ff 75 e0 pushl -0x20(%ebp)
bf7: 31 db xor %ebx,%ebx
bf9: be 09 04 00 00 mov $0x409,%esi
bfe: e8 97 32 00 00 call 3e9a <close>
c03: 83 c4 10 add $0x10,%esp
c06: 89 d8 mov %ebx,%eax
c08: 89 f2 mov %esi,%edx
c0a: f7 d8 neg %eax
c0c: 29 da sub %ebx,%edx
c0e: 66 90 xchg %ax,%ax
buf[i] = seq++;
c10: 88 84 03 c0 8b 00 00 mov %al,0x8bc0(%ebx,%eax,1)
c17: 83 c0 01 add $0x1,%eax
for(i = 0; i < 1033; i++)
c1a: 39 d0 cmp %edx,%eax
c1c: 75 f2 jne c10 <pipe1+0xd0>
if(write(fds[1], buf, 1033) != 1033){
c1e: 83 ec 04 sub $0x4,%esp
c21: 68 09 04 00 00 push $0x409
c26: 68 c0 8b 00 00 push $0x8bc0
c2b: ff 75 e4 pushl -0x1c(%ebp)
c2e: e8 5f 32 00 00 call 3e92 <write>
c33: 83 c4 10 add $0x10,%esp
c36: 3d 09 04 00 00 cmp $0x409,%eax
c3b: 0f 85 a1 00 00 00 jne ce2 <pipe1+0x1a2>
c41: 81 eb 09 04 00 00 sub $0x409,%ebx
for(n = 0; n < 5; n++){
c47: 81 fb d3 eb ff ff cmp $0xffffebd3,%ebx
c4d: 75 b7 jne c06 <pipe1+0xc6>
exit(0);
c4f: 83 ec 0c sub $0xc,%esp
c52: 6a 00 push $0x0
c54: e8 19 32 00 00 call 3e72 <exit>
if(total != 5 * 1033){
c59: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp)
c60: 75 30 jne c92 <pipe1+0x152>
close(fds[0]);
c62: 83 ec 0c sub $0xc,%esp
c65: ff 75 e0 pushl -0x20(%ebp)
c68: e8 2d 32 00 00 call 3e9a <close>
wait(null);
c6d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
c74: e8 01 32 00 00 call 3e7a <wait>
printf(1, "pipe1 ok\n");
c79: 5a pop %edx
c7a: 59 pop %ecx
c7b: 68 b3 46 00 00 push $0x46b3
c80: 6a 01 push $0x1
c82: e8 59 33 00 00 call 3fe0 <printf>
c87: 83 c4 10 add $0x10,%esp
}
c8a: 8d 65 f4 lea -0xc(%ebp),%esp
c8d: 5b pop %ebx
c8e: 5e pop %esi
c8f: 5f pop %edi
c90: 5d pop %ebp
c91: c3 ret
printf(1, "pipe1 oops 3 total %d\n", total);
c92: 53 push %ebx
c93: ff 75 d4 pushl -0x2c(%ebp)
c96: 68 9c 46 00 00 push $0x469c
c9b: 6a 01 push $0x1
c9d: e8 3e 33 00 00 call 3fe0 <printf>
exit(0);
ca2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
ca9: e8 c4 31 00 00 call 3e72 <exit>
printf(1, "pipe() failed\n");
cae: 57 push %edi
caf: 57 push %edi
cb0: 68 71 46 00 00 push $0x4671
cb5: 6a 01 push $0x1
cb7: e8 24 33 00 00 call 3fe0 <printf>
exit(0);
cbc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
cc3: e8 aa 31 00 00 call 3e72 <exit>
printf(1, "fork() failed\n");
cc8: 50 push %eax
cc9: 50 push %eax
cca: 68 bd 46 00 00 push $0x46bd
ccf: 6a 01 push $0x1
cd1: e8 0a 33 00 00 call 3fe0 <printf>
exit(0);
cd6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
cdd: e8 90 31 00 00 call 3e72 <exit>
printf(1, "pipe1 oops 1\n");
ce2: 56 push %esi
ce3: 56 push %esi
ce4: 68 80 46 00 00 push $0x4680
ce9: 6a 01 push $0x1
ceb: e8 f0 32 00 00 call 3fe0 <printf>
exit(0);
cf0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
cf7: e8 76 31 00 00 call 3e72 <exit>
cfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000d00 <preempt>:
{
d00: 55 push %ebp
d01: 89 e5 mov %esp,%ebp
d03: 57 push %edi
d04: 56 push %esi
d05: 53 push %ebx
d06: 83 ec 24 sub $0x24,%esp
printf(1, "preempt: ");
d09: 68 cc 46 00 00 push $0x46cc
d0e: 6a 01 push $0x1
d10: e8 cb 32 00 00 call 3fe0 <printf>
pid1 = fork();
d15: e8 50 31 00 00 call 3e6a <fork>
if(pid1 == 0)
d1a: 83 c4 10 add $0x10,%esp
d1d: 85 c0 test %eax,%eax
d1f: 75 02 jne d23 <preempt+0x23>
d21: eb fe jmp d21 <preempt+0x21>
d23: 89 c7 mov %eax,%edi
pid2 = fork();
d25: e8 40 31 00 00 call 3e6a <fork>
if(pid2 == 0)
d2a: 85 c0 test %eax,%eax
pid2 = fork();
d2c: 89 c6 mov %eax,%esi
if(pid2 == 0)
d2e: 75 02 jne d32 <preempt+0x32>
d30: eb fe jmp d30 <preempt+0x30>
pipe(pfds);
d32: 8d 45 e0 lea -0x20(%ebp),%eax
d35: 83 ec 0c sub $0xc,%esp
d38: 50 push %eax
d39: e8 44 31 00 00 call 3e82 <pipe>
pid3 = fork();
d3e: e8 27 31 00 00 call 3e6a <fork>
if(pid3 == 0){
d43: 83 c4 10 add $0x10,%esp
d46: 85 c0 test %eax,%eax
pid3 = fork();
d48: 89 c3 mov %eax,%ebx
if(pid3 == 0){
d4a: 75 46 jne d92 <preempt+0x92>
close(pfds[0]);
d4c: 83 ec 0c sub $0xc,%esp
d4f: ff 75 e0 pushl -0x20(%ebp)
d52: e8 43 31 00 00 call 3e9a <close>
if(write(pfds[1], "x", 1) != 1)
d57: 83 c4 0c add $0xc,%esp
d5a: 6a 01 push $0x1
d5c: 68 91 4c 00 00 push $0x4c91
d61: ff 75 e4 pushl -0x1c(%ebp)
d64: e8 29 31 00 00 call 3e92 <write>
d69: 83 c4 10 add $0x10,%esp
d6c: 83 e8 01 sub $0x1,%eax
d6f: 74 11 je d82 <preempt+0x82>
printf(1, "preempt write error");
d71: 50 push %eax
d72: 50 push %eax
d73: 68 d6 46 00 00 push $0x46d6
d78: 6a 01 push $0x1
d7a: e8 61 32 00 00 call 3fe0 <printf>
d7f: 83 c4 10 add $0x10,%esp
close(pfds[1]);
d82: 83 ec 0c sub $0xc,%esp
d85: ff 75 e4 pushl -0x1c(%ebp)
d88: e8 0d 31 00 00 call 3e9a <close>
d8d: 83 c4 10 add $0x10,%esp
d90: eb fe jmp d90 <preempt+0x90>
close(pfds[1]);
d92: 83 ec 0c sub $0xc,%esp
d95: ff 75 e4 pushl -0x1c(%ebp)
d98: e8 fd 30 00 00 call 3e9a <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
d9d: 83 c4 0c add $0xc,%esp
da0: 68 00 20 00 00 push $0x2000
da5: 68 c0 8b 00 00 push $0x8bc0
daa: ff 75 e0 pushl -0x20(%ebp)
dad: e8 d8 30 00 00 call 3e8a <read>
db2: 83 c4 10 add $0x10,%esp
db5: 83 e8 01 sub $0x1,%eax
db8: 74 19 je dd3 <preempt+0xd3>
printf(1, "preempt read error");
dba: 50 push %eax
dbb: 50 push %eax
dbc: 68 ea 46 00 00 push $0x46ea
dc1: 6a 01 push $0x1
dc3: e8 18 32 00 00 call 3fe0 <printf>
return;
dc8: 83 c4 10 add $0x10,%esp
}
dcb: 8d 65 f4 lea -0xc(%ebp),%esp
dce: 5b pop %ebx
dcf: 5e pop %esi
dd0: 5f pop %edi
dd1: 5d pop %ebp
dd2: c3 ret
close(pfds[0]);
dd3: 83 ec 0c sub $0xc,%esp
dd6: ff 75 e0 pushl -0x20(%ebp)
dd9: e8 bc 30 00 00 call 3e9a <close>
printf(1, "kill... ");
dde: 58 pop %eax
ddf: 5a pop %edx
de0: 68 fd 46 00 00 push $0x46fd
de5: 6a 01 push $0x1
de7: e8 f4 31 00 00 call 3fe0 <printf>
kill(pid1);
dec: 89 3c 24 mov %edi,(%esp)
def: e8 ae 30 00 00 call 3ea2 <kill>
kill(pid2);
df4: 89 34 24 mov %esi,(%esp)
df7: e8 a6 30 00 00 call 3ea2 <kill>
kill(pid3);
dfc: 89 1c 24 mov %ebx,(%esp)
dff: e8 9e 30 00 00 call 3ea2 <kill>
printf(1, "wait... ");
e04: 59 pop %ecx
e05: 5b pop %ebx
e06: 68 06 47 00 00 push $0x4706
e0b: 6a 01 push $0x1
e0d: e8 ce 31 00 00 call 3fe0 <printf>
wait(null);
e12: c7 04 24 00 00 00 00 movl $0x0,(%esp)
e19: e8 5c 30 00 00 call 3e7a <wait>
wait(null);
e1e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
e25: e8 50 30 00 00 call 3e7a <wait>
wait(null);
e2a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
e31: e8 44 30 00 00 call 3e7a <wait>
printf(1, "preempt ok\n");
e36: 5e pop %esi
e37: 5f pop %edi
e38: 68 0f 47 00 00 push $0x470f
e3d: 6a 01 push $0x1
e3f: e8 9c 31 00 00 call 3fe0 <printf>
e44: 83 c4 10 add $0x10,%esp
e47: eb 82 jmp dcb <preempt+0xcb>
e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000e50 <exitwait>:
{
e50: 55 push %ebp
e51: 89 e5 mov %esp,%ebp
e53: 56 push %esi
e54: be 64 00 00 00 mov $0x64,%esi
e59: 53 push %ebx
e5a: eb 1c jmp e78 <exitwait+0x28>
e5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid){
e60: 74 77 je ed9 <exitwait+0x89>
if(wait(null) != pid){
e62: 83 ec 0c sub $0xc,%esp
e65: 6a 00 push $0x0
e67: e8 0e 30 00 00 call 3e7a <wait>
e6c: 83 c4 10 add $0x10,%esp
e6f: 39 d8 cmp %ebx,%eax
e71: 75 2d jne ea0 <exitwait+0x50>
for(i = 0; i < 100; i++){
e73: 83 ee 01 sub $0x1,%esi
e76: 74 48 je ec0 <exitwait+0x70>
pid = fork();
e78: e8 ed 2f 00 00 call 3e6a <fork>
if(pid < 0){
e7d: 85 c0 test %eax,%eax
pid = fork();
e7f: 89 c3 mov %eax,%ebx
if(pid < 0){
e81: 79 dd jns e60 <exitwait+0x10>
printf(1, "fork failed\n");
e83: 83 ec 08 sub $0x8,%esp
e86: 68 79 52 00 00 push $0x5279
e8b: 6a 01 push $0x1
e8d: e8 4e 31 00 00 call 3fe0 <printf>
return;
e92: 83 c4 10 add $0x10,%esp
}
e95: 8d 65 f8 lea -0x8(%ebp),%esp
e98: 5b pop %ebx
e99: 5e pop %esi
e9a: 5d pop %ebp
e9b: c3 ret
e9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "wait wrong pid\n");
ea0: 83 ec 08 sub $0x8,%esp
ea3: 68 1b 47 00 00 push $0x471b
ea8: 6a 01 push $0x1
eaa: e8 31 31 00 00 call 3fe0 <printf>
return;
eaf: 83 c4 10 add $0x10,%esp
}
eb2: 8d 65 f8 lea -0x8(%ebp),%esp
eb5: 5b pop %ebx
eb6: 5e pop %esi
eb7: 5d pop %ebp
eb8: c3 ret
eb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "exitwait ok\n");
ec0: 83 ec 08 sub $0x8,%esp
ec3: 68 2b 47 00 00 push $0x472b
ec8: 6a 01 push $0x1
eca: e8 11 31 00 00 call 3fe0 <printf>
ecf: 83 c4 10 add $0x10,%esp
}
ed2: 8d 65 f8 lea -0x8(%ebp),%esp
ed5: 5b pop %ebx
ed6: 5e pop %esi
ed7: 5d pop %ebp
ed8: c3 ret
exit(0);
ed9: 83 ec 0c sub $0xc,%esp
edc: 6a 00 push $0x0
ede: e8 8f 2f 00 00 call 3e72 <exit>
ee3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ee9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000ef0 <mem>:
{
ef0: 55 push %ebp
ef1: 89 e5 mov %esp,%ebp
ef3: 57 push %edi
ef4: 56 push %esi
ef5: 53 push %ebx
ef6: 31 db xor %ebx,%ebx
ef8: 83 ec 14 sub $0x14,%esp
printf(1, "mem test\n");
efb: 68 38 47 00 00 push $0x4738
f00: 6a 01 push $0x1
f02: e8 d9 30 00 00 call 3fe0 <printf>
ppid = getpid();
f07: e8 e6 2f 00 00 call 3ef2 <getpid>
f0c: 89 c6 mov %eax,%esi
if((pid = fork()) == 0){
f0e: e8 57 2f 00 00 call 3e6a <fork>
f13: 83 c4 10 add $0x10,%esp
f16: 85 c0 test %eax,%eax
f18: 74 0a je f24 <mem+0x34>
f1a: e9 99 00 00 00 jmp fb8 <mem+0xc8>
f1f: 90 nop
*(char**)m2 = m1;
f20: 89 18 mov %ebx,(%eax)
f22: 89 c3 mov %eax,%ebx
while((m2 = malloc(10001)) != 0){
f24: 83 ec 0c sub $0xc,%esp
f27: 68 11 27 00 00 push $0x2711
f2c: e8 0f 33 00 00 call 4240 <malloc>
f31: 83 c4 10 add $0x10,%esp
f34: 85 c0 test %eax,%eax
f36: 75 e8 jne f20 <mem+0x30>
while(m1){
f38: 85 db test %ebx,%ebx
f3a: 74 18 je f54 <mem+0x64>
f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
m2 = *(char**)m1;
f40: 8b 3b mov (%ebx),%edi
free(m1);
f42: 83 ec 0c sub $0xc,%esp
f45: 53 push %ebx
f46: 89 fb mov %edi,%ebx
f48: e8 63 32 00 00 call 41b0 <free>
while(m1){
f4d: 83 c4 10 add $0x10,%esp
f50: 85 db test %ebx,%ebx
f52: 75 ec jne f40 <mem+0x50>
m1 = malloc(1024*20);
f54: 83 ec 0c sub $0xc,%esp
f57: 68 00 50 00 00 push $0x5000
f5c: e8 df 32 00 00 call 4240 <malloc>
if(m1 == 0){
f61: 83 c4 10 add $0x10,%esp
f64: 85 c0 test %eax,%eax
f66: 74 28 je f90 <mem+0xa0>
free(m1);
f68: 83 ec 0c sub $0xc,%esp
f6b: 50 push %eax
f6c: e8 3f 32 00 00 call 41b0 <free>
printf(1, "mem ok\n");
f71: 58 pop %eax
f72: 5a pop %edx
f73: 68 5c 47 00 00 push $0x475c
f78: 6a 01 push $0x1
f7a: e8 61 30 00 00 call 3fe0 <printf>
exit(0);
f7f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
f86: e8 e7 2e 00 00 call 3e72 <exit>
f8b: 90 nop
f8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "couldn't allocate mem?!!\n");
f90: 83 ec 08 sub $0x8,%esp
f93: 68 42 47 00 00 push $0x4742
f98: 6a 01 push $0x1
f9a: e8 41 30 00 00 call 3fe0 <printf>
kill(ppid);
f9f: 89 34 24 mov %esi,(%esp)
fa2: e8 fb 2e 00 00 call 3ea2 <kill>
exit(0);
fa7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
fae: e8 bf 2e 00 00 call 3e72 <exit>
fb3: 90 nop
fb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
wait(null);
fb8: 83 ec 0c sub $0xc,%esp
fbb: 6a 00 push $0x0
fbd: e8 b8 2e 00 00 call 3e7a <wait>
}
fc2: 83 c4 10 add $0x10,%esp
fc5: 8d 65 f4 lea -0xc(%ebp),%esp
fc8: 5b pop %ebx
fc9: 5e pop %esi
fca: 5f pop %edi
fcb: 5d pop %ebp
fcc: c3 ret
fcd: 8d 76 00 lea 0x0(%esi),%esi
00000fd0 <sharedfd>:
{
fd0: 55 push %ebp
fd1: 89 e5 mov %esp,%ebp
fd3: 57 push %edi
fd4: 56 push %esi
fd5: 53 push %ebx
fd6: 83 ec 34 sub $0x34,%esp
printf(1, "sharedfd test\n");
fd9: 68 64 47 00 00 push $0x4764
fde: 6a 01 push $0x1
fe0: e8 fb 2f 00 00 call 3fe0 <printf>
unlink("sharedfd");
fe5: c7 04 24 73 47 00 00 movl $0x4773,(%esp)
fec: e8 d1 2e 00 00 call 3ec2 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
ff1: 59 pop %ecx
ff2: 5b pop %ebx
ff3: 68 02 02 00 00 push $0x202
ff8: 68 73 47 00 00 push $0x4773
ffd: e8 b0 2e 00 00 call 3eb2 <open>
if(fd < 0){
1002: 83 c4 10 add $0x10,%esp
1005: 85 c0 test %eax,%eax
1007: 0f 88 43 01 00 00 js 1150 <sharedfd+0x180>
100d: 89 c6 mov %eax,%esi
memset(buf, pid==0?'c':'p', sizeof(buf));
100f: bb e8 03 00 00 mov $0x3e8,%ebx
pid = fork();
1014: e8 51 2e 00 00 call 3e6a <fork>
memset(buf, pid==0?'c':'p', sizeof(buf));
1019: 83 f8 01 cmp $0x1,%eax
pid = fork();
101c: 89 c7 mov %eax,%edi
memset(buf, pid==0?'c':'p', sizeof(buf));
101e: 19 c0 sbb %eax,%eax
1020: 83 ec 04 sub $0x4,%esp
1023: 83 e0 f3 and $0xfffffff3,%eax
1026: 6a 0a push $0xa
1028: 83 c0 70 add $0x70,%eax
102b: 50 push %eax
102c: 8d 45 de lea -0x22(%ebp),%eax
102f: 50 push %eax
1030: e8 9b 2c 00 00 call 3cd0 <memset>
1035: 83 c4 10 add $0x10,%esp
1038: eb 0b jmp 1045 <sharedfd+0x75>
103a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(i = 0; i < 1000; i++){
1040: 83 eb 01 sub $0x1,%ebx
1043: 74 29 je 106e <sharedfd+0x9e>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
1045: 8d 45 de lea -0x22(%ebp),%eax
1048: 83 ec 04 sub $0x4,%esp
104b: 6a 0a push $0xa
104d: 50 push %eax
104e: 56 push %esi
104f: e8 3e 2e 00 00 call 3e92 <write>
1054: 83 c4 10 add $0x10,%esp
1057: 83 f8 0a cmp $0xa,%eax
105a: 74 e4 je 1040 <sharedfd+0x70>
printf(1, "fstests: write sharedfd failed\n");
105c: 83 ec 08 sub $0x8,%esp
105f: 68 64 54 00 00 push $0x5464
1064: 6a 01 push $0x1
1066: e8 75 2f 00 00 call 3fe0 <printf>
break;
106b: 83 c4 10 add $0x10,%esp
if(pid == 0)
106e: 85 ff test %edi,%edi
1070: 0f 84 0e 01 00 00 je 1184 <sharedfd+0x1b4>
wait(null);
1076: 83 ec 0c sub $0xc,%esp
nc = np = 0;
1079: 31 db xor %ebx,%ebx
107b: 31 ff xor %edi,%edi
wait(null);
107d: 6a 00 push $0x0
107f: e8 f6 2d 00 00 call 3e7a <wait>
close(fd);
1084: 89 34 24 mov %esi,(%esp)
1087: 8d 75 e8 lea -0x18(%ebp),%esi
108a: e8 0b 2e 00 00 call 3e9a <close>
fd = open("sharedfd", 0);
108f: 58 pop %eax
1090: 5a pop %edx
1091: 6a 00 push $0x0
1093: 68 73 47 00 00 push $0x4773
1098: e8 15 2e 00 00 call 3eb2 <open>
if(fd < 0){
109d: 83 c4 10 add $0x10,%esp
10a0: 85 c0 test %eax,%eax
fd = open("sharedfd", 0);
10a2: 89 45 d4 mov %eax,-0x2c(%ebp)
if(fd < 0){
10a5: 0f 88 bf 00 00 00 js 116a <sharedfd+0x19a>
10ab: 89 f8 mov %edi,%eax
10ad: 89 df mov %ebx,%edi
10af: 89 c3 mov %eax,%ebx
10b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
while((n = read(fd, buf, sizeof(buf))) > 0){
10b8: 8d 45 de lea -0x22(%ebp),%eax
10bb: 83 ec 04 sub $0x4,%esp
10be: 6a 0a push $0xa
10c0: 50 push %eax
10c1: ff 75 d4 pushl -0x2c(%ebp)
10c4: e8 c1 2d 00 00 call 3e8a <read>
10c9: 83 c4 10 add $0x10,%esp
10cc: 85 c0 test %eax,%eax
10ce: 7e 30 jle 1100 <sharedfd+0x130>
10d0: 8d 45 de lea -0x22(%ebp),%eax
10d3: eb 15 jmp 10ea <sharedfd+0x11a>
10d5: 8d 76 00 lea 0x0(%esi),%esi
np++;
10d8: 80 fa 70 cmp $0x70,%dl
10db: 0f 94 c2 sete %dl
10de: 0f b6 d2 movzbl %dl,%edx
10e1: 01 d7 add %edx,%edi
10e3: 83 c0 01 add $0x1,%eax
for(i = 0; i < sizeof(buf); i++){
10e6: 39 f0 cmp %esi,%eax
10e8: 74 ce je 10b8 <sharedfd+0xe8>
if(buf[i] == 'c')
10ea: 0f b6 10 movzbl (%eax),%edx
10ed: 80 fa 63 cmp $0x63,%dl
10f0: 75 e6 jne 10d8 <sharedfd+0x108>
nc++;
10f2: 83 c3 01 add $0x1,%ebx
10f5: eb ec jmp 10e3 <sharedfd+0x113>
10f7: 89 f6 mov %esi,%esi
10f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
close(fd);
1100: 83 ec 0c sub $0xc,%esp
1103: 89 d8 mov %ebx,%eax
1105: ff 75 d4 pushl -0x2c(%ebp)
1108: 89 fb mov %edi,%ebx
110a: 89 c7 mov %eax,%edi
110c: e8 89 2d 00 00 call 3e9a <close>
unlink("sharedfd");
1111: c7 04 24 73 47 00 00 movl $0x4773,(%esp)
1118: e8 a5 2d 00 00 call 3ec2 <unlink>
if(nc == 10000 && np == 10000){
111d: 83 c4 10 add $0x10,%esp
1120: 81 ff 10 27 00 00 cmp $0x2710,%edi
1126: 75 66 jne 118e <sharedfd+0x1be>
1128: 81 fb 10 27 00 00 cmp $0x2710,%ebx
112e: 75 5e jne 118e <sharedfd+0x1be>
printf(1, "sharedfd ok\n");
1130: 83 ec 08 sub $0x8,%esp
1133: 68 7c 47 00 00 push $0x477c
1138: 6a 01 push $0x1
113a: e8 a1 2e 00 00 call 3fe0 <printf>
113f: 83 c4 10 add $0x10,%esp
}
1142: 8d 65 f4 lea -0xc(%ebp),%esp
1145: 5b pop %ebx
1146: 5e pop %esi
1147: 5f pop %edi
1148: 5d pop %ebp
1149: c3 ret
114a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "fstests: cannot open sharedfd for writing");
1150: 83 ec 08 sub $0x8,%esp
1153: 68 38 54 00 00 push $0x5438
1158: 6a 01 push $0x1
115a: e8 81 2e 00 00 call 3fe0 <printf>
return;
115f: 83 c4 10 add $0x10,%esp
}
1162: 8d 65 f4 lea -0xc(%ebp),%esp
1165: 5b pop %ebx
1166: 5e pop %esi
1167: 5f pop %edi
1168: 5d pop %ebp
1169: c3 ret
printf(1, "fstests: cannot open sharedfd for reading\n");
116a: 83 ec 08 sub $0x8,%esp
116d: 68 84 54 00 00 push $0x5484
1172: 6a 01 push $0x1
1174: e8 67 2e 00 00 call 3fe0 <printf>
return;
1179: 83 c4 10 add $0x10,%esp
}
117c: 8d 65 f4 lea -0xc(%ebp),%esp
117f: 5b pop %ebx
1180: 5e pop %esi
1181: 5f pop %edi
1182: 5d pop %ebp
1183: c3 ret
exit(0);
1184: 83 ec 0c sub $0xc,%esp
1187: 6a 00 push $0x0
1189: e8 e4 2c 00 00 call 3e72 <exit>
printf(1, "sharedfd oops %d %d\n", nc, np);
118e: 53 push %ebx
118f: 57 push %edi
1190: 68 89 47 00 00 push $0x4789
1195: 6a 01 push $0x1
1197: e8 44 2e 00 00 call 3fe0 <printf>
exit(0);
119c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
11a3: e8 ca 2c 00 00 call 3e72 <exit>
11a8: 90 nop
11a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000011b0 <fourfiles>:
{
11b0: 55 push %ebp
11b1: 89 e5 mov %esp,%ebp
11b3: 57 push %edi
11b4: 56 push %esi
11b5: 53 push %ebx
printf(1, "fourfiles test\n");
11b6: be 9e 47 00 00 mov $0x479e,%esi
for(pi = 0; pi < 4; pi++){
11bb: 31 db xor %ebx,%ebx
{
11bd: 83 ec 34 sub $0x34,%esp
char *names[] = { "f0", "f1", "f2", "f3" };
11c0: c7 45 d8 9e 47 00 00 movl $0x479e,-0x28(%ebp)
11c7: c7 45 dc e7 48 00 00 movl $0x48e7,-0x24(%ebp)
printf(1, "fourfiles test\n");
11ce: 68 a4 47 00 00 push $0x47a4
11d3: 6a 01 push $0x1
char *names[] = { "f0", "f1", "f2", "f3" };
11d5: c7 45 e0 eb 48 00 00 movl $0x48eb,-0x20(%ebp)
11dc: c7 45 e4 a1 47 00 00 movl $0x47a1,-0x1c(%ebp)
printf(1, "fourfiles test\n");
11e3: e8 f8 2d 00 00 call 3fe0 <printf>
11e8: 83 c4 10 add $0x10,%esp
unlink(fname);
11eb: 83 ec 0c sub $0xc,%esp
11ee: 56 push %esi
11ef: e8 ce 2c 00 00 call 3ec2 <unlink>
pid = fork();
11f4: e8 71 2c 00 00 call 3e6a <fork>
if(pid < 0){
11f9: 83 c4 10 add $0x10,%esp
11fc: 85 c0 test %eax,%eax
11fe: 0f 88 9b 01 00 00 js 139f <fourfiles+0x1ef>
if(pid == 0){
1204: 0f 84 ff 00 00 00 je 1309 <fourfiles+0x159>
for(pi = 0; pi < 4; pi++){
120a: 83 c3 01 add $0x1,%ebx
120d: 83 fb 04 cmp $0x4,%ebx
1210: 74 06 je 1218 <fourfiles+0x68>
1212: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi
1216: eb d3 jmp 11eb <fourfiles+0x3b>
wait(null);
1218: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 2; i++){
121b: 31 ff xor %edi,%edi
wait(null);
121d: 6a 00 push $0x0
121f: e8 56 2c 00 00 call 3e7a <wait>
1224: c7 04 24 00 00 00 00 movl $0x0,(%esp)
122b: e8 4a 2c 00 00 call 3e7a <wait>
1230: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1237: e8 3e 2c 00 00 call 3e7a <wait>
123c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1243: e8 32 2c 00 00 call 3e7a <wait>
1248: 83 c4 10 add $0x10,%esp
124b: c7 45 d0 9e 47 00 00 movl $0x479e,-0x30(%ebp)
fd = open(fname, 0);
1252: 83 ec 08 sub $0x8,%esp
total = 0;
1255: 31 db xor %ebx,%ebx
fd = open(fname, 0);
1257: 6a 00 push $0x0
1259: ff 75 d0 pushl -0x30(%ebp)
125c: e8 51 2c 00 00 call 3eb2 <open>
while((n = read(fd, buf, sizeof(buf))) > 0){
1261: 83 c4 10 add $0x10,%esp
fd = open(fname, 0);
1264: 89 45 d4 mov %eax,-0x2c(%ebp)
1267: 89 f6 mov %esi,%esi
1269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
while((n = read(fd, buf, sizeof(buf))) > 0){
1270: 83 ec 04 sub $0x4,%esp
1273: 68 00 20 00 00 push $0x2000
1278: 68 c0 8b 00 00 push $0x8bc0
127d: ff 75 d4 pushl -0x2c(%ebp)
1280: e8 05 2c 00 00 call 3e8a <read>
1285: 83 c4 10 add $0x10,%esp
1288: 85 c0 test %eax,%eax
128a: 7e 26 jle 12b2 <fourfiles+0x102>
for(j = 0; j < n; j++){
128c: 31 d2 xor %edx,%edx
128e: 66 90 xchg %ax,%ax
if(buf[j] != '0'+i){
1290: 0f be b2 c0 8b 00 00 movsbl 0x8bc0(%edx),%esi
1297: 83 ff 01 cmp $0x1,%edi
129a: 19 c9 sbb %ecx,%ecx
129c: 83 c1 31 add $0x31,%ecx
129f: 39 ce cmp %ecx,%esi
12a1: 0f 85 c3 00 00 00 jne 136a <fourfiles+0x1ba>
for(j = 0; j < n; j++){
12a7: 83 c2 01 add $0x1,%edx
12aa: 39 d0 cmp %edx,%eax
12ac: 75 e2 jne 1290 <fourfiles+0xe0>
total += n;
12ae: 01 c3 add %eax,%ebx
12b0: eb be jmp 1270 <fourfiles+0xc0>
close(fd);
12b2: 83 ec 0c sub $0xc,%esp
12b5: ff 75 d4 pushl -0x2c(%ebp)
12b8: e8 dd 2b 00 00 call 3e9a <close>
if(total != 12*500){
12bd: 83 c4 10 add $0x10,%esp
12c0: 81 fb 70 17 00 00 cmp $0x1770,%ebx
12c6: 0f 85 ed 00 00 00 jne 13b9 <fourfiles+0x209>
unlink(fname);
12cc: 83 ec 0c sub $0xc,%esp
12cf: ff 75 d0 pushl -0x30(%ebp)
12d2: e8 eb 2b 00 00 call 3ec2 <unlink>
for(i = 0; i < 2; i++){
12d7: 83 c4 10 add $0x10,%esp
12da: 83 ff 01 cmp $0x1,%edi
12dd: 75 1a jne 12f9 <fourfiles+0x149>
printf(1, "fourfiles ok\n");
12df: 83 ec 08 sub $0x8,%esp
12e2: 68 e2 47 00 00 push $0x47e2
12e7: 6a 01 push $0x1
12e9: e8 f2 2c 00 00 call 3fe0 <printf>
}
12ee: 83 c4 10 add $0x10,%esp
12f1: 8d 65 f4 lea -0xc(%ebp),%esp
12f4: 5b pop %ebx
12f5: 5e pop %esi
12f6: 5f pop %edi
12f7: 5d pop %ebp
12f8: c3 ret
12f9: 8b 45 dc mov -0x24(%ebp),%eax
12fc: bf 01 00 00 00 mov $0x1,%edi
1301: 89 45 d0 mov %eax,-0x30(%ebp)
1304: e9 49 ff ff ff jmp 1252 <fourfiles+0xa2>
fd = open(fname, O_CREATE | O_RDWR);
1309: 83 ec 08 sub $0x8,%esp
130c: 68 02 02 00 00 push $0x202
1311: 56 push %esi
1312: e8 9b 2b 00 00 call 3eb2 <open>
if(fd < 0){
1317: 83 c4 10 add $0x10,%esp
131a: 85 c0 test %eax,%eax
fd = open(fname, O_CREATE | O_RDWR);
131c: 89 c6 mov %eax,%esi
if(fd < 0){
131e: 78 65 js 1385 <fourfiles+0x1d5>
memset(buf, '0'+pi, 512);
1320: 83 ec 04 sub $0x4,%esp
1323: 83 c3 30 add $0x30,%ebx
1326: 68 00 02 00 00 push $0x200
132b: 53 push %ebx
132c: bb 0c 00 00 00 mov $0xc,%ebx
1331: 68 c0 8b 00 00 push $0x8bc0
1336: e8 95 29 00 00 call 3cd0 <memset>
133b: 83 c4 10 add $0x10,%esp
if((n = write(fd, buf, 500)) != 500){
133e: 83 ec 04 sub $0x4,%esp
1341: 68 f4 01 00 00 push $0x1f4
1346: 68 c0 8b 00 00 push $0x8bc0
134b: 56 push %esi
134c: e8 41 2b 00 00 call 3e92 <write>
1351: 83 c4 10 add $0x10,%esp
1354: 3d f4 01 00 00 cmp $0x1f4,%eax
1359: 75 78 jne 13d3 <fourfiles+0x223>
for(i = 0; i < 12; i++){
135b: 83 eb 01 sub $0x1,%ebx
135e: 75 de jne 133e <fourfiles+0x18e>
exit(0);
1360: 83 ec 0c sub $0xc,%esp
1363: 6a 00 push $0x0
1365: e8 08 2b 00 00 call 3e72 <exit>
printf(1, "wrong char\n");
136a: 83 ec 08 sub $0x8,%esp
136d: 68 c5 47 00 00 push $0x47c5
1372: 6a 01 push $0x1
1374: e8 67 2c 00 00 call 3fe0 <printf>
exit(0);
1379: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1380: e8 ed 2a 00 00 call 3e72 <exit>
printf(1, "create failed\n");
1385: 51 push %ecx
1386: 51 push %ecx
1387: 68 3f 4a 00 00 push $0x4a3f
138c: 6a 01 push $0x1
138e: e8 4d 2c 00 00 call 3fe0 <printf>
exit(0);
1393: c7 04 24 00 00 00 00 movl $0x0,(%esp)
139a: e8 d3 2a 00 00 call 3e72 <exit>
printf(1, "fork failed\n");
139f: 53 push %ebx
13a0: 53 push %ebx
13a1: 68 79 52 00 00 push $0x5279
13a6: 6a 01 push $0x1
13a8: e8 33 2c 00 00 call 3fe0 <printf>
exit(0);
13ad: c7 04 24 00 00 00 00 movl $0x0,(%esp)
13b4: e8 b9 2a 00 00 call 3e72 <exit>
printf(1, "wrong length %d\n", total);
13b9: 50 push %eax
13ba: 53 push %ebx
13bb: 68 d1 47 00 00 push $0x47d1
13c0: 6a 01 push $0x1
13c2: e8 19 2c 00 00 call 3fe0 <printf>
exit(0);
13c7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
13ce: e8 9f 2a 00 00 call 3e72 <exit>
printf(1, "write failed %d\n", n);
13d3: 52 push %edx
13d4: 50 push %eax
13d5: 68 b4 47 00 00 push $0x47b4
13da: 6a 01 push $0x1
13dc: e8 ff 2b 00 00 call 3fe0 <printf>
exit(0);
13e1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
13e8: e8 85 2a 00 00 call 3e72 <exit>
13ed: 8d 76 00 lea 0x0(%esi),%esi
000013f0 <createdelete>:
{
13f0: 55 push %ebp
13f1: 89 e5 mov %esp,%ebp
13f3: 57 push %edi
13f4: 56 push %esi
13f5: 53 push %ebx
for(pi = 0; pi < 4; pi++){
13f6: 31 db xor %ebx,%ebx
{
13f8: 83 ec 44 sub $0x44,%esp
printf(1, "createdelete test\n");
13fb: 68 f0 47 00 00 push $0x47f0
1400: 6a 01 push $0x1
1402: e8 d9 2b 00 00 call 3fe0 <printf>
1407: 83 c4 10 add $0x10,%esp
pid = fork();
140a: e8 5b 2a 00 00 call 3e6a <fork>
if(pid < 0){
140f: 85 c0 test %eax,%eax
1411: 0f 88 f9 01 00 00 js 1610 <createdelete+0x220>
if(pid == 0){
1417: 0f 84 2b 01 00 00 je 1548 <createdelete+0x158>
for(pi = 0; pi < 4; pi++){
141d: 83 c3 01 add $0x1,%ebx
1420: 83 fb 04 cmp $0x4,%ebx
1423: 75 e5 jne 140a <createdelete+0x1a>
wait(null);
1425: 83 ec 0c sub $0xc,%esp
1428: 8d 7d c8 lea -0x38(%ebp),%edi
name[0] = name[1] = name[2] = 0;
142b: be ff ff ff ff mov $0xffffffff,%esi
wait(null);
1430: 6a 00 push $0x0
1432: e8 43 2a 00 00 call 3e7a <wait>
1437: c7 04 24 00 00 00 00 movl $0x0,(%esp)
143e: e8 37 2a 00 00 call 3e7a <wait>
1443: c7 04 24 00 00 00 00 movl $0x0,(%esp)
144a: e8 2b 2a 00 00 call 3e7a <wait>
144f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1456: e8 1f 2a 00 00 call 3e7a <wait>
name[0] = name[1] = name[2] = 0;
145b: c6 45 ca 00 movb $0x0,-0x36(%ebp)
145f: 83 c4 10 add $0x10,%esp
1462: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1468: 8d 46 31 lea 0x31(%esi),%eax
146b: 88 45 c7 mov %al,-0x39(%ebp)
146e: 8d 46 01 lea 0x1(%esi),%eax
1471: 83 f8 09 cmp $0x9,%eax
1474: 89 45 c0 mov %eax,-0x40(%ebp)
1477: 0f 9f c3 setg %bl
147a: 85 c0 test %eax,%eax
147c: 0f 94 c0 sete %al
147f: 09 c3 or %eax,%ebx
1481: 88 5d c6 mov %bl,-0x3a(%ebp)
name[2] = '\0';
1484: bb 70 00 00 00 mov $0x70,%ebx
name[1] = '0' + i;
1489: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
fd = open(name, 0);
148d: 83 ec 08 sub $0x8,%esp
name[0] = 'p' + pi;
1490: 88 5d c8 mov %bl,-0x38(%ebp)
fd = open(name, 0);
1493: 6a 00 push $0x0
1495: 57 push %edi
name[1] = '0' + i;
1496: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
1499: e8 14 2a 00 00 call 3eb2 <open>
if((i == 0 || i >= N/2) && fd < 0){
149e: 83 c4 10 add $0x10,%esp
14a1: 80 7d c6 00 cmpb $0x0,-0x3a(%ebp)
14a5: 0f 84 85 00 00 00 je 1530 <createdelete+0x140>
14ab: 85 c0 test %eax,%eax
14ad: 0f 88 27 01 00 00 js 15da <createdelete+0x1ea>
} else if((i >= 1 && i < N/2) && fd >= 0){
14b3: 83 fe 08 cmp $0x8,%esi
14b6: 0f 86 76 01 00 00 jbe 1632 <createdelete+0x242>
close(fd);
14bc: 83 ec 0c sub $0xc,%esp
14bf: 50 push %eax
14c0: e8 d5 29 00 00 call 3e9a <close>
14c5: 83 c4 10 add $0x10,%esp
14c8: 83 c3 01 add $0x1,%ebx
for(pi = 0; pi < 4; pi++){
14cb: 80 fb 74 cmp $0x74,%bl
14ce: 75 b9 jne 1489 <createdelete+0x99>
14d0: 8b 75 c0 mov -0x40(%ebp),%esi
for(i = 0; i < N; i++){
14d3: 83 fe 13 cmp $0x13,%esi
14d6: 75 90 jne 1468 <createdelete+0x78>
14d8: be 70 00 00 00 mov $0x70,%esi
14dd: 8d 76 00 lea 0x0(%esi),%esi
14e0: 8d 46 c0 lea -0x40(%esi),%eax
name[0] = name[1] = name[2] = 0;
14e3: bb 04 00 00 00 mov $0x4,%ebx
14e8: 88 45 c7 mov %al,-0x39(%ebp)
name[0] = 'p' + i;
14eb: 89 f0 mov %esi,%eax
unlink(name);
14ed: 83 ec 0c sub $0xc,%esp
name[0] = 'p' + i;
14f0: 88 45 c8 mov %al,-0x38(%ebp)
name[1] = '0' + i;
14f3: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
unlink(name);
14f7: 57 push %edi
name[1] = '0' + i;
14f8: 88 45 c9 mov %al,-0x37(%ebp)
unlink(name);
14fb: e8 c2 29 00 00 call 3ec2 <unlink>
for(pi = 0; pi < 4; pi++){
1500: 83 c4 10 add $0x10,%esp
1503: 83 eb 01 sub $0x1,%ebx
1506: 75 e3 jne 14eb <createdelete+0xfb>
1508: 83 c6 01 add $0x1,%esi
for(i = 0; i < N; i++){
150b: 89 f0 mov %esi,%eax
150d: 3c 84 cmp $0x84,%al
150f: 75 cf jne 14e0 <createdelete+0xf0>
printf(1, "createdelete ok\n");
1511: 83 ec 08 sub $0x8,%esp
1514: 68 03 48 00 00 push $0x4803
1519: 6a 01 push $0x1
151b: e8 c0 2a 00 00 call 3fe0 <printf>
}
1520: 8d 65 f4 lea -0xc(%ebp),%esp
1523: 5b pop %ebx
1524: 5e pop %esi
1525: 5f pop %edi
1526: 5d pop %ebp
1527: c3 ret
1528: 90 nop
1529: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if((i >= 1 && i < N/2) && fd >= 0){
1530: 83 fe 08 cmp $0x8,%esi
1533: 0f 86 f1 00 00 00 jbe 162a <createdelete+0x23a>
if(fd >= 0)
1539: 85 c0 test %eax,%eax
153b: 78 8b js 14c8 <createdelete+0xd8>
153d: e9 7a ff ff ff jmp 14bc <createdelete+0xcc>
1542: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
name[0] = 'p' + pi;
1548: 83 c3 70 add $0x70,%ebx
name[2] = '\0';
154b: c6 45 ca 00 movb $0x0,-0x36(%ebp)
154f: 8d 7d c8 lea -0x38(%ebp),%edi
name[0] = 'p' + pi;
1552: 88 5d c8 mov %bl,-0x38(%ebp)
name[2] = '\0';
1555: 31 db xor %ebx,%ebx
1557: eb 0f jmp 1568 <createdelete+0x178>
1559: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < N; i++){
1560: 83 fb 13 cmp $0x13,%ebx
1563: 74 6b je 15d0 <createdelete+0x1e0>
1565: 83 c3 01 add $0x1,%ebx
fd = open(name, O_CREATE | O_RDWR);
1568: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
156b: 8d 43 30 lea 0x30(%ebx),%eax
fd = open(name, O_CREATE | O_RDWR);
156e: 68 02 02 00 00 push $0x202
1573: 57 push %edi
name[1] = '0' + i;
1574: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, O_CREATE | O_RDWR);
1577: e8 36 29 00 00 call 3eb2 <open>
if(fd < 0){
157c: 83 c4 10 add $0x10,%esp
157f: 85 c0 test %eax,%eax
1581: 78 73 js 15f6 <createdelete+0x206>
close(fd);
1583: 83 ec 0c sub $0xc,%esp
1586: 50 push %eax
1587: e8 0e 29 00 00 call 3e9a <close>
if(i > 0 && (i % 2 ) == 0){
158c: 83 c4 10 add $0x10,%esp
158f: 85 db test %ebx,%ebx
1591: 74 d2 je 1565 <createdelete+0x175>
1593: f6 c3 01 test $0x1,%bl
1596: 75 c8 jne 1560 <createdelete+0x170>
if(unlink(name) < 0){
1598: 83 ec 0c sub $0xc,%esp
name[1] = '0' + (i / 2);
159b: 89 d8 mov %ebx,%eax
159d: d1 f8 sar %eax
if(unlink(name) < 0){
159f: 57 push %edi
name[1] = '0' + (i / 2);
15a0: 83 c0 30 add $0x30,%eax
15a3: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
15a6: e8 17 29 00 00 call 3ec2 <unlink>
15ab: 83 c4 10 add $0x10,%esp
15ae: 85 c0 test %eax,%eax
15b0: 79 ae jns 1560 <createdelete+0x170>
printf(1, "unlink failed\n");
15b2: 52 push %edx
15b3: 52 push %edx
15b4: 68 f1 43 00 00 push $0x43f1
15b9: 6a 01 push $0x1
15bb: e8 20 2a 00 00 call 3fe0 <printf>
exit(0);
15c0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
15c7: e8 a6 28 00 00 call 3e72 <exit>
15cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
exit(0);
15d0: 83 ec 0c sub $0xc,%esp
15d3: 6a 00 push $0x0
15d5: e8 98 28 00 00 call 3e72 <exit>
printf(1, "oops createdelete %s didn't exist\n", name);
15da: 83 ec 04 sub $0x4,%esp
15dd: 57 push %edi
15de: 68 b0 54 00 00 push $0x54b0
15e3: 6a 01 push $0x1
15e5: e8 f6 29 00 00 call 3fe0 <printf>
exit(0);
15ea: c7 04 24 00 00 00 00 movl $0x0,(%esp)
15f1: e8 7c 28 00 00 call 3e72 <exit>
printf(1, "create failed\n");
15f6: 51 push %ecx
15f7: 51 push %ecx
15f8: 68 3f 4a 00 00 push $0x4a3f
15fd: 6a 01 push $0x1
15ff: e8 dc 29 00 00 call 3fe0 <printf>
exit(0);
1604: c7 04 24 00 00 00 00 movl $0x0,(%esp)
160b: e8 62 28 00 00 call 3e72 <exit>
printf(1, "fork failed\n");
1610: 53 push %ebx
1611: 53 push %ebx
1612: 68 79 52 00 00 push $0x5279
1617: 6a 01 push $0x1
1619: e8 c2 29 00 00 call 3fe0 <printf>
exit(0);
161e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1625: e8 48 28 00 00 call 3e72 <exit>
} else if((i >= 1 && i < N/2) && fd >= 0){
162a: 85 c0 test %eax,%eax
162c: 0f 88 96 fe ff ff js 14c8 <createdelete+0xd8>
printf(1, "oops createdelete %s did exist\n", name);
1632: 50 push %eax
1633: 57 push %edi
1634: 68 d4 54 00 00 push $0x54d4
1639: 6a 01 push $0x1
163b: e8 a0 29 00 00 call 3fe0 <printf>
exit(0);
1640: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1647: e8 26 28 00 00 call 3e72 <exit>
164c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001650 <unlinkread>:
{
1650: 55 push %ebp
1651: 89 e5 mov %esp,%ebp
1653: 56 push %esi
1654: 53 push %ebx
printf(1, "unlinkread test\n");
1655: 83 ec 08 sub $0x8,%esp
1658: 68 14 48 00 00 push $0x4814
165d: 6a 01 push $0x1
165f: e8 7c 29 00 00 call 3fe0 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
1664: 5b pop %ebx
1665: 5e pop %esi
1666: 68 02 02 00 00 push $0x202
166b: 68 25 48 00 00 push $0x4825
1670: e8 3d 28 00 00 call 3eb2 <open>
if(fd < 0){
1675: 83 c4 10 add $0x10,%esp
1678: 85 c0 test %eax,%eax
167a: 0f 88 e6 00 00 00 js 1766 <unlinkread+0x116>
write(fd, "hello", 5);
1680: 83 ec 04 sub $0x4,%esp
1683: 89 c3 mov %eax,%ebx
1685: 6a 05 push $0x5
1687: 68 4a 48 00 00 push $0x484a
168c: 50 push %eax
168d: e8 00 28 00 00 call 3e92 <write>
close(fd);
1692: 89 1c 24 mov %ebx,(%esp)
1695: e8 00 28 00 00 call 3e9a <close>
fd = open("unlinkread", O_RDWR);
169a: 58 pop %eax
169b: 5a pop %edx
169c: 6a 02 push $0x2
169e: 68 25 48 00 00 push $0x4825
16a3: e8 0a 28 00 00 call 3eb2 <open>
if(fd < 0){
16a8: 83 c4 10 add $0x10,%esp
16ab: 85 c0 test %eax,%eax
fd = open("unlinkread", O_RDWR);
16ad: 89 c3 mov %eax,%ebx
if(fd < 0){
16af: 0f 88 33 01 00 00 js 17e8 <unlinkread+0x198>
if(unlink("unlinkread") != 0){
16b5: 83 ec 0c sub $0xc,%esp
16b8: 68 25 48 00 00 push $0x4825
16bd: e8 00 28 00 00 call 3ec2 <unlink>
16c2: 83 c4 10 add $0x10,%esp
16c5: 85 c0 test %eax,%eax
16c7: 0f 85 01 01 00 00 jne 17ce <unlinkread+0x17e>
fd1 = open("unlinkread", O_CREATE | O_RDWR);
16cd: 83 ec 08 sub $0x8,%esp
16d0: 68 02 02 00 00 push $0x202
16d5: 68 25 48 00 00 push $0x4825
16da: e8 d3 27 00 00 call 3eb2 <open>
write(fd1, "yyy", 3);
16df: 83 c4 0c add $0xc,%esp
fd1 = open("unlinkread", O_CREATE | O_RDWR);
16e2: 89 c6 mov %eax,%esi
write(fd1, "yyy", 3);
16e4: 6a 03 push $0x3
16e6: 68 82 48 00 00 push $0x4882
16eb: 50 push %eax
16ec: e8 a1 27 00 00 call 3e92 <write>
close(fd1);
16f1: 89 34 24 mov %esi,(%esp)
16f4: e8 a1 27 00 00 call 3e9a <close>
if(read(fd, buf, sizeof(buf)) != 5){
16f9: 83 c4 0c add $0xc,%esp
16fc: 68 00 20 00 00 push $0x2000
1701: 68 c0 8b 00 00 push $0x8bc0
1706: 53 push %ebx
1707: e8 7e 27 00 00 call 3e8a <read>
170c: 83 c4 10 add $0x10,%esp
170f: 83 f8 05 cmp $0x5,%eax
1712: 0f 85 9c 00 00 00 jne 17b4 <unlinkread+0x164>
if(buf[0] != 'h'){
1718: 80 3d c0 8b 00 00 68 cmpb $0x68,0x8bc0
171f: 75 79 jne 179a <unlinkread+0x14a>
if(write(fd, buf, 10) != 10){
1721: 83 ec 04 sub $0x4,%esp
1724: 6a 0a push $0xa
1726: 68 c0 8b 00 00 push $0x8bc0
172b: 53 push %ebx
172c: e8 61 27 00 00 call 3e92 <write>
1731: 83 c4 10 add $0x10,%esp
1734: 83 f8 0a cmp $0xa,%eax
1737: 75 47 jne 1780 <unlinkread+0x130>
close(fd);
1739: 83 ec 0c sub $0xc,%esp
173c: 53 push %ebx
173d: e8 58 27 00 00 call 3e9a <close>
unlink("unlinkread");
1742: c7 04 24 25 48 00 00 movl $0x4825,(%esp)
1749: e8 74 27 00 00 call 3ec2 <unlink>
printf(1, "unlinkread ok\n");
174e: 58 pop %eax
174f: 5a pop %edx
1750: 68 cd 48 00 00 push $0x48cd
1755: 6a 01 push $0x1
1757: e8 84 28 00 00 call 3fe0 <printf>
}
175c: 83 c4 10 add $0x10,%esp
175f: 8d 65 f8 lea -0x8(%ebp),%esp
1762: 5b pop %ebx
1763: 5e pop %esi
1764: 5d pop %ebp
1765: c3 ret
printf(1, "create unlinkread failed\n");
1766: 51 push %ecx
1767: 51 push %ecx
1768: 68 30 48 00 00 push $0x4830
176d: 6a 01 push $0x1
176f: e8 6c 28 00 00 call 3fe0 <printf>
exit(0);
1774: c7 04 24 00 00 00 00 movl $0x0,(%esp)
177b: e8 f2 26 00 00 call 3e72 <exit>
printf(1, "unlinkread write failed\n");
1780: 51 push %ecx
1781: 51 push %ecx
1782: 68 b4 48 00 00 push $0x48b4
1787: 6a 01 push $0x1
1789: e8 52 28 00 00 call 3fe0 <printf>
exit(0);
178e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1795: e8 d8 26 00 00 call 3e72 <exit>
printf(1, "unlinkread wrong data\n");
179a: 53 push %ebx
179b: 53 push %ebx
179c: 68 9d 48 00 00 push $0x489d
17a1: 6a 01 push $0x1
17a3: e8 38 28 00 00 call 3fe0 <printf>
exit(0);
17a8: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17af: e8 be 26 00 00 call 3e72 <exit>
printf(1, "unlinkread read failed");
17b4: 56 push %esi
17b5: 56 push %esi
17b6: 68 86 48 00 00 push $0x4886
17bb: 6a 01 push $0x1
17bd: e8 1e 28 00 00 call 3fe0 <printf>
exit(0);
17c2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17c9: e8 a4 26 00 00 call 3e72 <exit>
printf(1, "unlink unlinkread failed\n");
17ce: 50 push %eax
17cf: 50 push %eax
17d0: 68 68 48 00 00 push $0x4868
17d5: 6a 01 push $0x1
17d7: e8 04 28 00 00 call 3fe0 <printf>
exit(0);
17dc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17e3: e8 8a 26 00 00 call 3e72 <exit>
printf(1, "open unlinkread failed\n");
17e8: 50 push %eax
17e9: 50 push %eax
17ea: 68 50 48 00 00 push $0x4850
17ef: 6a 01 push $0x1
17f1: e8 ea 27 00 00 call 3fe0 <printf>
exit(0);
17f6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17fd: e8 70 26 00 00 call 3e72 <exit>
1802: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1809: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001810 <linktest>:
{
1810: 55 push %ebp
1811: 89 e5 mov %esp,%ebp
1813: 53 push %ebx
1814: 83 ec 0c sub $0xc,%esp
printf(1, "linktest\n");
1817: 68 dc 48 00 00 push $0x48dc
181c: 6a 01 push $0x1
181e: e8 bd 27 00 00 call 3fe0 <printf>
unlink("lf1");
1823: c7 04 24 e6 48 00 00 movl $0x48e6,(%esp)
182a: e8 93 26 00 00 call 3ec2 <unlink>
unlink("lf2");
182f: c7 04 24 ea 48 00 00 movl $0x48ea,(%esp)
1836: e8 87 26 00 00 call 3ec2 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
183b: 58 pop %eax
183c: 5a pop %edx
183d: 68 02 02 00 00 push $0x202
1842: 68 e6 48 00 00 push $0x48e6
1847: e8 66 26 00 00 call 3eb2 <open>
if(fd < 0){
184c: 83 c4 10 add $0x10,%esp
184f: 85 c0 test %eax,%eax
1851: 0f 88 1e 01 00 00 js 1975 <linktest+0x165>
if(write(fd, "hello", 5) != 5){
1857: 83 ec 04 sub $0x4,%esp
185a: 89 c3 mov %eax,%ebx
185c: 6a 05 push $0x5
185e: 68 4a 48 00 00 push $0x484a
1863: 50 push %eax
1864: e8 29 26 00 00 call 3e92 <write>
1869: 83 c4 10 add $0x10,%esp
186c: 83 f8 05 cmp $0x5,%eax
186f: 0f 85 d0 01 00 00 jne 1a45 <linktest+0x235>
close(fd);
1875: 83 ec 0c sub $0xc,%esp
1878: 53 push %ebx
1879: e8 1c 26 00 00 call 3e9a <close>
if(link("lf1", "lf2") < 0){
187e: 5b pop %ebx
187f: 58 pop %eax
1880: 68 ea 48 00 00 push $0x48ea
1885: 68 e6 48 00 00 push $0x48e6
188a: e8 43 26 00 00 call 3ed2 <link>
188f: 83 c4 10 add $0x10,%esp
1892: 85 c0 test %eax,%eax
1894: 0f 88 91 01 00 00 js 1a2b <linktest+0x21b>
unlink("lf1");
189a: 83 ec 0c sub $0xc,%esp
189d: 68 e6 48 00 00 push $0x48e6
18a2: e8 1b 26 00 00 call 3ec2 <unlink>
if(open("lf1", 0) >= 0){
18a7: 58 pop %eax
18a8: 5a pop %edx
18a9: 6a 00 push $0x0
18ab: 68 e6 48 00 00 push $0x48e6
18b0: e8 fd 25 00 00 call 3eb2 <open>
18b5: 83 c4 10 add $0x10,%esp
18b8: 85 c0 test %eax,%eax
18ba: 0f 89 51 01 00 00 jns 1a11 <linktest+0x201>
fd = open("lf2", 0);
18c0: 83 ec 08 sub $0x8,%esp
18c3: 6a 00 push $0x0
18c5: 68 ea 48 00 00 push $0x48ea
18ca: e8 e3 25 00 00 call 3eb2 <open>
if(fd < 0){
18cf: 83 c4 10 add $0x10,%esp
18d2: 85 c0 test %eax,%eax
fd = open("lf2", 0);
18d4: 89 c3 mov %eax,%ebx
if(fd < 0){
18d6: 0f 88 1b 01 00 00 js 19f7 <linktest+0x1e7>
if(read(fd, buf, sizeof(buf)) != 5){
18dc: 83 ec 04 sub $0x4,%esp
18df: 68 00 20 00 00 push $0x2000
18e4: 68 c0 8b 00 00 push $0x8bc0
18e9: 50 push %eax
18ea: e8 9b 25 00 00 call 3e8a <read>
18ef: 83 c4 10 add $0x10,%esp
18f2: 83 f8 05 cmp $0x5,%eax
18f5: 0f 85 e2 00 00 00 jne 19dd <linktest+0x1cd>
close(fd);
18fb: 83 ec 0c sub $0xc,%esp
18fe: 53 push %ebx
18ff: e8 96 25 00 00 call 3e9a <close>
if(link("lf2", "lf2") >= 0){
1904: 58 pop %eax
1905: 5a pop %edx
1906: 68 ea 48 00 00 push $0x48ea
190b: 68 ea 48 00 00 push $0x48ea
1910: e8 bd 25 00 00 call 3ed2 <link>
1915: 83 c4 10 add $0x10,%esp
1918: 85 c0 test %eax,%eax
191a: 0f 89 a3 00 00 00 jns 19c3 <linktest+0x1b3>
unlink("lf2");
1920: 83 ec 0c sub $0xc,%esp
1923: 68 ea 48 00 00 push $0x48ea
1928: e8 95 25 00 00 call 3ec2 <unlink>
if(link("lf2", "lf1") >= 0){
192d: 59 pop %ecx
192e: 5b pop %ebx
192f: 68 e6 48 00 00 push $0x48e6
1934: 68 ea 48 00 00 push $0x48ea
1939: e8 94 25 00 00 call 3ed2 <link>
193e: 83 c4 10 add $0x10,%esp
1941: 85 c0 test %eax,%eax
1943: 79 64 jns 19a9 <linktest+0x199>
if(link(".", "lf1") >= 0){
1945: 83 ec 08 sub $0x8,%esp
1948: 68 e6 48 00 00 push $0x48e6
194d: 68 ae 4b 00 00 push $0x4bae
1952: e8 7b 25 00 00 call 3ed2 <link>
1957: 83 c4 10 add $0x10,%esp
195a: 85 c0 test %eax,%eax
195c: 79 31 jns 198f <linktest+0x17f>
printf(1, "linktest ok\n");
195e: 83 ec 08 sub $0x8,%esp
1961: 68 84 49 00 00 push $0x4984
1966: 6a 01 push $0x1
1968: e8 73 26 00 00 call 3fe0 <printf>
}
196d: 83 c4 10 add $0x10,%esp
1970: 8b 5d fc mov -0x4(%ebp),%ebx
1973: c9 leave
1974: c3 ret
printf(1, "create lf1 failed\n");
1975: 50 push %eax
1976: 50 push %eax
1977: 68 ee 48 00 00 push $0x48ee
197c: 6a 01 push $0x1
197e: e8 5d 26 00 00 call 3fe0 <printf>
exit(0);
1983: c7 04 24 00 00 00 00 movl $0x0,(%esp)
198a: e8 e3 24 00 00 call 3e72 <exit>
printf(1, "link . lf1 succeeded! oops\n");
198f: 50 push %eax
1990: 50 push %eax
1991: 68 68 49 00 00 push $0x4968
1996: 6a 01 push $0x1
1998: e8 43 26 00 00 call 3fe0 <printf>
exit(0);
199d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19a4: e8 c9 24 00 00 call 3e72 <exit>
printf(1, "link non-existant succeeded! oops\n");
19a9: 52 push %edx
19aa: 52 push %edx
19ab: 68 1c 55 00 00 push $0x551c
19b0: 6a 01 push $0x1
19b2: e8 29 26 00 00 call 3fe0 <printf>
exit(0);
19b7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19be: e8 af 24 00 00 call 3e72 <exit>
printf(1, "link lf2 lf2 succeeded! oops\n");
19c3: 50 push %eax
19c4: 50 push %eax
19c5: 68 4a 49 00 00 push $0x494a
19ca: 6a 01 push $0x1
19cc: e8 0f 26 00 00 call 3fe0 <printf>
exit(0);
19d1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19d8: e8 95 24 00 00 call 3e72 <exit>
printf(1, "read lf2 failed\n");
19dd: 51 push %ecx
19de: 51 push %ecx
19df: 68 39 49 00 00 push $0x4939
19e4: 6a 01 push $0x1
19e6: e8 f5 25 00 00 call 3fe0 <printf>
exit(0);
19eb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19f2: e8 7b 24 00 00 call 3e72 <exit>
printf(1, "open lf2 failed\n");
19f7: 53 push %ebx
19f8: 53 push %ebx
19f9: 68 28 49 00 00 push $0x4928
19fe: 6a 01 push $0x1
1a00: e8 db 25 00 00 call 3fe0 <printf>
exit(0);
1a05: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a0c: e8 61 24 00 00 call 3e72 <exit>
printf(1, "unlinked lf1 but it is still there!\n");
1a11: 50 push %eax
1a12: 50 push %eax
1a13: 68 f4 54 00 00 push $0x54f4
1a18: 6a 01 push $0x1
1a1a: e8 c1 25 00 00 call 3fe0 <printf>
exit(0);
1a1f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a26: e8 47 24 00 00 call 3e72 <exit>
printf(1, "link lf1 lf2 failed\n");
1a2b: 51 push %ecx
1a2c: 51 push %ecx
1a2d: 68 13 49 00 00 push $0x4913
1a32: 6a 01 push $0x1
1a34: e8 a7 25 00 00 call 3fe0 <printf>
exit(0);
1a39: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a40: e8 2d 24 00 00 call 3e72 <exit>
printf(1, "write lf1 failed\n");
1a45: 50 push %eax
1a46: 50 push %eax
1a47: 68 01 49 00 00 push $0x4901
1a4c: 6a 01 push $0x1
1a4e: e8 8d 25 00 00 call 3fe0 <printf>
exit(0);
1a53: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a5a: e8 13 24 00 00 call 3e72 <exit>
1a5f: 90 nop
00001a60 <concreate>:
{
1a60: 55 push %ebp
1a61: 89 e5 mov %esp,%ebp
1a63: 57 push %edi
1a64: 56 push %esi
1a65: 53 push %ebx
for(i = 0; i < 40; i++){
1a66: 31 f6 xor %esi,%esi
1a68: 8d 5d ad lea -0x53(%ebp),%ebx
if(pid && (i % 3) == 1){
1a6b: bf ab aa aa aa mov $0xaaaaaaab,%edi
{
1a70: 83 ec 64 sub $0x64,%esp
printf(1, "concreate test\n");
1a73: 68 91 49 00 00 push $0x4991
1a78: 6a 01 push $0x1
1a7a: e8 61 25 00 00 call 3fe0 <printf>
file[0] = 'C';
1a7f: c6 45 ad 43 movb $0x43,-0x53(%ebp)
file[2] = '\0';
1a83: c6 45 af 00 movb $0x0,-0x51(%ebp)
1a87: 83 c4 10 add $0x10,%esp
1a8a: eb 54 jmp 1ae0 <concreate+0x80>
1a8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid && (i % 3) == 1){
1a90: 89 f0 mov %esi,%eax
1a92: 89 f1 mov %esi,%ecx
1a94: f7 e7 mul %edi
1a96: d1 ea shr %edx
1a98: 8d 04 52 lea (%edx,%edx,2),%eax
1a9b: 29 c1 sub %eax,%ecx
1a9d: 83 f9 01 cmp $0x1,%ecx
1aa0: 0f 84 ca 00 00 00 je 1b70 <concreate+0x110>
fd = open(file, O_CREATE | O_RDWR);
1aa6: 83 ec 08 sub $0x8,%esp
1aa9: 68 02 02 00 00 push $0x202
1aae: 53 push %ebx
1aaf: e8 fe 23 00 00 call 3eb2 <open>
if(fd < 0){
1ab4: 83 c4 10 add $0x10,%esp
1ab7: 85 c0 test %eax,%eax
1ab9: 78 6f js 1b2a <concreate+0xca>
close(fd);
1abb: 83 ec 0c sub $0xc,%esp
1abe: 50 push %eax
1abf: e8 d6 23 00 00 call 3e9a <close>
1ac4: 83 c4 10 add $0x10,%esp
wait(null);
1ac7: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 40; i++){
1aca: 83 c6 01 add $0x1,%esi
wait(null);
1acd: 6a 00 push $0x0
1acf: e8 a6 23 00 00 call 3e7a <wait>
for(i = 0; i < 40; i++){
1ad4: 83 c4 10 add $0x10,%esp
1ad7: 83 fe 28 cmp $0x28,%esi
1ada: 0f 84 b0 00 00 00 je 1b90 <concreate+0x130>
unlink(file);
1ae0: 83 ec 0c sub $0xc,%esp
file[1] = '0' + i;
1ae3: 8d 46 30 lea 0x30(%esi),%eax
unlink(file);
1ae6: 53 push %ebx
file[1] = '0' + i;
1ae7: 88 45 ae mov %al,-0x52(%ebp)
unlink(file);
1aea: e8 d3 23 00 00 call 3ec2 <unlink>
pid = fork();
1aef: e8 76 23 00 00 call 3e6a <fork>
if(pid && (i % 3) == 1){
1af4: 83 c4 10 add $0x10,%esp
1af7: 85 c0 test %eax,%eax
1af9: 75 95 jne 1a90 <concreate+0x30>
} else if(pid == 0 && (i % 5) == 1){
1afb: 89 f0 mov %esi,%eax
1afd: ba cd cc cc cc mov $0xcccccccd,%edx
1b02: f7 e2 mul %edx
1b04: c1 ea 02 shr $0x2,%edx
1b07: 8d 04 92 lea (%edx,%edx,4),%eax
1b0a: 29 c6 sub %eax,%esi
1b0c: 83 fe 01 cmp $0x1,%esi
1b0f: 74 3f je 1b50 <concreate+0xf0>
fd = open(file, O_CREATE | O_RDWR);
1b11: 83 ec 08 sub $0x8,%esp
1b14: 68 02 02 00 00 push $0x202
1b19: 53 push %ebx
1b1a: e8 93 23 00 00 call 3eb2 <open>
if(fd < 0){
1b1f: 83 c4 10 add $0x10,%esp
1b22: 85 c0 test %eax,%eax
1b24: 0f 89 5c 02 00 00 jns 1d86 <concreate+0x326>
printf(1, "concreate create %s failed\n", file);
1b2a: 83 ec 04 sub $0x4,%esp
1b2d: 53 push %ebx
1b2e: 68 a4 49 00 00 push $0x49a4
1b33: 6a 01 push $0x1
1b35: e8 a6 24 00 00 call 3fe0 <printf>
exit(0);
1b3a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1b41: e8 2c 23 00 00 call 3e72 <exit>
1b46: 8d 76 00 lea 0x0(%esi),%esi
1b49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
link("C0", file);
1b50: 83 ec 08 sub $0x8,%esp
1b53: 53 push %ebx
1b54: 68 a1 49 00 00 push $0x49a1
1b59: e8 74 23 00 00 call 3ed2 <link>
1b5e: 83 c4 10 add $0x10,%esp
exit(0);
1b61: 83 ec 0c sub $0xc,%esp
1b64: 6a 00 push $0x0
1b66: e8 07 23 00 00 call 3e72 <exit>
1b6b: 90 nop
1b6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
link("C0", file);
1b70: 83 ec 08 sub $0x8,%esp
1b73: 53 push %ebx
1b74: 68 a1 49 00 00 push $0x49a1
1b79: e8 54 23 00 00 call 3ed2 <link>
1b7e: 83 c4 10 add $0x10,%esp
1b81: e9 41 ff ff ff jmp 1ac7 <concreate+0x67>
1b86: 8d 76 00 lea 0x0(%esi),%esi
1b89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
memset(fa, 0, sizeof(fa));
1b90: 8d 45 c0 lea -0x40(%ebp),%eax
1b93: 83 ec 04 sub $0x4,%esp
1b96: 6a 28 push $0x28
1b98: 6a 00 push $0x0
1b9a: 50 push %eax
1b9b: e8 30 21 00 00 call 3cd0 <memset>
fd = open(".", 0);
1ba0: 5f pop %edi
1ba1: 58 pop %eax
1ba2: 6a 00 push $0x0
1ba4: 68 ae 4b 00 00 push $0x4bae
1ba9: 8d 7d b0 lea -0x50(%ebp),%edi
1bac: e8 01 23 00 00 call 3eb2 <open>
while(read(fd, &de, sizeof(de)) > 0){
1bb1: 83 c4 10 add $0x10,%esp
fd = open(".", 0);
1bb4: 89 c6 mov %eax,%esi
n = 0;
1bb6: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp)
1bbd: 8d 76 00 lea 0x0(%esi),%esi
while(read(fd, &de, sizeof(de)) > 0){
1bc0: 83 ec 04 sub $0x4,%esp
1bc3: 6a 10 push $0x10
1bc5: 57 push %edi
1bc6: 56 push %esi
1bc7: e8 be 22 00 00 call 3e8a <read>
1bcc: 83 c4 10 add $0x10,%esp
1bcf: 85 c0 test %eax,%eax
1bd1: 7e 3d jle 1c10 <concreate+0x1b0>
if(de.inum == 0)
1bd3: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp)
1bd8: 74 e6 je 1bc0 <concreate+0x160>
if(de.name[0] == 'C' && de.name[2] == '\0'){
1bda: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp)
1bde: 75 e0 jne 1bc0 <concreate+0x160>
1be0: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp)
1be4: 75 da jne 1bc0 <concreate+0x160>
i = de.name[1] - '0';
1be6: 0f be 45 b3 movsbl -0x4d(%ebp),%eax
1bea: 83 e8 30 sub $0x30,%eax
if(i < 0 || i >= sizeof(fa)){
1bed: 83 f8 27 cmp $0x27,%eax
1bf0: 0f 87 73 01 00 00 ja 1d69 <concreate+0x309>
if(fa[i]){
1bf6: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1)
1bfb: 0f 85 4b 01 00 00 jne 1d4c <concreate+0x2ec>
fa[i] = 1;
1c01: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1)
n++;
1c06: 83 45 a4 01 addl $0x1,-0x5c(%ebp)
1c0a: eb b4 jmp 1bc0 <concreate+0x160>
1c0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
close(fd);
1c10: 83 ec 0c sub $0xc,%esp
1c13: 56 push %esi
1c14: e8 81 22 00 00 call 3e9a <close>
if(n != 40){
1c19: 83 c4 10 add $0x10,%esp
1c1c: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp)
1c20: 0f 85 0c 01 00 00 jne 1d32 <concreate+0x2d2>
for(i = 0; i < 40; i++){
1c26: 31 f6 xor %esi,%esi
1c28: eb 54 jmp 1c7e <concreate+0x21e>
1c2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
((i % 3) == 1 && pid != 0)){
1c30: 85 ff test %edi,%edi
1c32: 74 05 je 1c39 <concreate+0x1d9>
1c34: 83 fa 01 cmp $0x1,%edx
1c37: 74 70 je 1ca9 <concreate+0x249>
unlink(file);
1c39: 83 ec 0c sub $0xc,%esp
1c3c: 53 push %ebx
1c3d: e8 80 22 00 00 call 3ec2 <unlink>
unlink(file);
1c42: 89 1c 24 mov %ebx,(%esp)
1c45: e8 78 22 00 00 call 3ec2 <unlink>
unlink(file);
1c4a: 89 1c 24 mov %ebx,(%esp)
1c4d: e8 70 22 00 00 call 3ec2 <unlink>
unlink(file);
1c52: 89 1c 24 mov %ebx,(%esp)
1c55: e8 68 22 00 00 call 3ec2 <unlink>
1c5a: 83 c4 10 add $0x10,%esp
if(pid == 0)
1c5d: 85 ff test %edi,%edi
1c5f: 0f 84 fc fe ff ff je 1b61 <concreate+0x101>
wait(null);
1c65: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 40; i++){
1c68: 83 c6 01 add $0x1,%esi
wait(null);
1c6b: 6a 00 push $0x0
1c6d: e8 08 22 00 00 call 3e7a <wait>
for(i = 0; i < 40; i++){
1c72: 83 c4 10 add $0x10,%esp
1c75: 83 fe 28 cmp $0x28,%esi
1c78: 0f 84 82 00 00 00 je 1d00 <concreate+0x2a0>
file[1] = '0' + i;
1c7e: 8d 46 30 lea 0x30(%esi),%eax
1c81: 88 45 ae mov %al,-0x52(%ebp)
pid = fork();
1c84: e8 e1 21 00 00 call 3e6a <fork>
if(pid < 0){
1c89: 85 c0 test %eax,%eax
pid = fork();
1c8b: 89 c7 mov %eax,%edi
if(pid < 0){
1c8d: 0f 88 84 00 00 00 js 1d17 <concreate+0x2b7>
if(((i % 3) == 0 && pid == 0) ||
1c93: b8 ab aa aa aa mov $0xaaaaaaab,%eax
1c98: f7 e6 mul %esi
1c9a: d1 ea shr %edx
1c9c: 8d 04 52 lea (%edx,%edx,2),%eax
1c9f: 89 f2 mov %esi,%edx
1ca1: 29 c2 sub %eax,%edx
1ca3: 89 d0 mov %edx,%eax
1ca5: 09 f8 or %edi,%eax
1ca7: 75 87 jne 1c30 <concreate+0x1d0>
close(open(file, 0));
1ca9: 83 ec 08 sub $0x8,%esp
1cac: 6a 00 push $0x0
1cae: 53 push %ebx
1caf: e8 fe 21 00 00 call 3eb2 <open>
1cb4: 89 04 24 mov %eax,(%esp)
1cb7: e8 de 21 00 00 call 3e9a <close>
close(open(file, 0));
1cbc: 58 pop %eax
1cbd: 5a pop %edx
1cbe: 6a 00 push $0x0
1cc0: 53 push %ebx
1cc1: e8 ec 21 00 00 call 3eb2 <open>
1cc6: 89 04 24 mov %eax,(%esp)
1cc9: e8 cc 21 00 00 call 3e9a <close>
close(open(file, 0));
1cce: 59 pop %ecx
1ccf: 58 pop %eax
1cd0: 6a 00 push $0x0
1cd2: 53 push %ebx
1cd3: e8 da 21 00 00 call 3eb2 <open>
1cd8: 89 04 24 mov %eax,(%esp)
1cdb: e8 ba 21 00 00 call 3e9a <close>
close(open(file, 0));
1ce0: 58 pop %eax
1ce1: 5a pop %edx
1ce2: 6a 00 push $0x0
1ce4: 53 push %ebx
1ce5: e8 c8 21 00 00 call 3eb2 <open>
1cea: 89 04 24 mov %eax,(%esp)
1ced: e8 a8 21 00 00 call 3e9a <close>
1cf2: 83 c4 10 add $0x10,%esp
1cf5: e9 63 ff ff ff jmp 1c5d <concreate+0x1fd>
1cfa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "concreate ok\n");
1d00: 83 ec 08 sub $0x8,%esp
1d03: 68 f6 49 00 00 push $0x49f6
1d08: 6a 01 push $0x1
1d0a: e8 d1 22 00 00 call 3fe0 <printf>
}
1d0f: 8d 65 f4 lea -0xc(%ebp),%esp
1d12: 5b pop %ebx
1d13: 5e pop %esi
1d14: 5f pop %edi
1d15: 5d pop %ebp
1d16: c3 ret
printf(1, "fork failed\n");
1d17: 83 ec 08 sub $0x8,%esp
1d1a: 68 79 52 00 00 push $0x5279
1d1f: 6a 01 push $0x1
1d21: e8 ba 22 00 00 call 3fe0 <printf>
exit(0);
1d26: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d2d: e8 40 21 00 00 call 3e72 <exit>
printf(1, "concreate not enough files in directory listing\n");
1d32: 51 push %ecx
1d33: 51 push %ecx
1d34: 68 40 55 00 00 push $0x5540
1d39: 6a 01 push $0x1
1d3b: e8 a0 22 00 00 call 3fe0 <printf>
exit(0);
1d40: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d47: e8 26 21 00 00 call 3e72 <exit>
printf(1, "concreate duplicate file %s\n", de.name);
1d4c: 8d 45 b2 lea -0x4e(%ebp),%eax
1d4f: 53 push %ebx
1d50: 50 push %eax
1d51: 68 d9 49 00 00 push $0x49d9
1d56: 6a 01 push $0x1
1d58: e8 83 22 00 00 call 3fe0 <printf>
exit(0);
1d5d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d64: e8 09 21 00 00 call 3e72 <exit>
printf(1, "concreate weird file %s\n", de.name);
1d69: 8d 45 b2 lea -0x4e(%ebp),%eax
1d6c: 56 push %esi
1d6d: 50 push %eax
1d6e: 68 c0 49 00 00 push $0x49c0
1d73: 6a 01 push $0x1
1d75: e8 66 22 00 00 call 3fe0 <printf>
exit(0);
1d7a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d81: e8 ec 20 00 00 call 3e72 <exit>
close(fd);
1d86: 83 ec 0c sub $0xc,%esp
1d89: 50 push %eax
1d8a: e8 0b 21 00 00 call 3e9a <close>
1d8f: 83 c4 10 add $0x10,%esp
1d92: e9 ca fd ff ff jmp 1b61 <concreate+0x101>
1d97: 89 f6 mov %esi,%esi
1d99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001da0 <linkunlink>:
{
1da0: 55 push %ebp
1da1: 89 e5 mov %esp,%ebp
1da3: 57 push %edi
1da4: 56 push %esi
1da5: 53 push %ebx
1da6: 83 ec 24 sub $0x24,%esp
printf(1, "linkunlink test\n");
1da9: 68 04 4a 00 00 push $0x4a04
1dae: 6a 01 push $0x1
1db0: e8 2b 22 00 00 call 3fe0 <printf>
unlink("x");
1db5: c7 04 24 91 4c 00 00 movl $0x4c91,(%esp)
1dbc: e8 01 21 00 00 call 3ec2 <unlink>
pid = fork();
1dc1: e8 a4 20 00 00 call 3e6a <fork>
if(pid < 0){
1dc6: 83 c4 10 add $0x10,%esp
1dc9: 85 c0 test %eax,%eax
pid = fork();
1dcb: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
1dce: 0f 88 b6 00 00 00 js 1e8a <linkunlink+0xea>
unsigned int x = (pid ? 1 : 97);
1dd4: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp)
1dd8: bb 64 00 00 00 mov $0x64,%ebx
if((x % 3) == 0){
1ddd: be ab aa aa aa mov $0xaaaaaaab,%esi
unsigned int x = (pid ? 1 : 97);
1de2: 19 ff sbb %edi,%edi
1de4: 83 e7 60 and $0x60,%edi
1de7: 83 c7 01 add $0x1,%edi
1dea: eb 1e jmp 1e0a <linkunlink+0x6a>
1dec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if((x % 3) == 1){
1df0: 83 fa 01 cmp $0x1,%edx
1df3: 74 7b je 1e70 <linkunlink+0xd0>
unlink("x");
1df5: 83 ec 0c sub $0xc,%esp
1df8: 68 91 4c 00 00 push $0x4c91
1dfd: e8 c0 20 00 00 call 3ec2 <unlink>
1e02: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1e05: 83 eb 01 sub $0x1,%ebx
1e08: 74 3d je 1e47 <linkunlink+0xa7>
x = x * 1103515245 + 12345;
1e0a: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx
1e10: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi
if((x % 3) == 0){
1e16: 89 f8 mov %edi,%eax
1e18: f7 e6 mul %esi
1e1a: d1 ea shr %edx
1e1c: 8d 04 52 lea (%edx,%edx,2),%eax
1e1f: 89 fa mov %edi,%edx
1e21: 29 c2 sub %eax,%edx
1e23: 75 cb jne 1df0 <linkunlink+0x50>
close(open("x", O_RDWR | O_CREATE));
1e25: 83 ec 08 sub $0x8,%esp
1e28: 68 02 02 00 00 push $0x202
1e2d: 68 91 4c 00 00 push $0x4c91
1e32: e8 7b 20 00 00 call 3eb2 <open>
1e37: 89 04 24 mov %eax,(%esp)
1e3a: e8 5b 20 00 00 call 3e9a <close>
1e3f: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1e42: 83 eb 01 sub $0x1,%ebx
1e45: 75 c3 jne 1e0a <linkunlink+0x6a>
if(pid)
1e47: 8b 4d e4 mov -0x1c(%ebp),%ecx
1e4a: 85 c9 test %ecx,%ecx
1e4c: 74 56 je 1ea4 <linkunlink+0x104>
wait(null);
1e4e: 83 ec 0c sub $0xc,%esp
1e51: 6a 00 push $0x0
1e53: e8 22 20 00 00 call 3e7a <wait>
printf(1, "linkunlink ok\n");
1e58: 58 pop %eax
1e59: 5a pop %edx
1e5a: 68 19 4a 00 00 push $0x4a19
1e5f: 6a 01 push $0x1
1e61: e8 7a 21 00 00 call 3fe0 <printf>
}
1e66: 8d 65 f4 lea -0xc(%ebp),%esp
1e69: 5b pop %ebx
1e6a: 5e pop %esi
1e6b: 5f pop %edi
1e6c: 5d pop %ebp
1e6d: c3 ret
1e6e: 66 90 xchg %ax,%ax
link("cat", "x");
1e70: 83 ec 08 sub $0x8,%esp
1e73: 68 91 4c 00 00 push $0x4c91
1e78: 68 15 4a 00 00 push $0x4a15
1e7d: e8 50 20 00 00 call 3ed2 <link>
1e82: 83 c4 10 add $0x10,%esp
1e85: e9 7b ff ff ff jmp 1e05 <linkunlink+0x65>
printf(1, "fork failed\n");
1e8a: 53 push %ebx
1e8b: 53 push %ebx
1e8c: 68 79 52 00 00 push $0x5279
1e91: 6a 01 push $0x1
1e93: e8 48 21 00 00 call 3fe0 <printf>
exit(0);
1e98: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1e9f: e8 ce 1f 00 00 call 3e72 <exit>
exit(0);
1ea4: 83 ec 0c sub $0xc,%esp
1ea7: 6a 00 push $0x0
1ea9: e8 c4 1f 00 00 call 3e72 <exit>
1eae: 66 90 xchg %ax,%ax
00001eb0 <bigdir>:
{
1eb0: 55 push %ebp
1eb1: 89 e5 mov %esp,%ebp
1eb3: 57 push %edi
1eb4: 56 push %esi
1eb5: 53 push %ebx
1eb6: 83 ec 24 sub $0x24,%esp
printf(1, "bigdir test\n");
1eb9: 68 28 4a 00 00 push $0x4a28
1ebe: 6a 01 push $0x1
1ec0: e8 1b 21 00 00 call 3fe0 <printf>
unlink("bd");
1ec5: c7 04 24 35 4a 00 00 movl $0x4a35,(%esp)
1ecc: e8 f1 1f 00 00 call 3ec2 <unlink>
fd = open("bd", O_CREATE);
1ed1: 5a pop %edx
1ed2: 59 pop %ecx
1ed3: 68 00 02 00 00 push $0x200
1ed8: 68 35 4a 00 00 push $0x4a35
1edd: e8 d0 1f 00 00 call 3eb2 <open>
if(fd < 0){
1ee2: 83 c4 10 add $0x10,%esp
1ee5: 85 c0 test %eax,%eax
1ee7: 0f 88 ec 00 00 00 js 1fd9 <bigdir+0x129>
close(fd);
1eed: 83 ec 0c sub $0xc,%esp
1ef0: 8d 7d de lea -0x22(%ebp),%edi
for(i = 0; i < 500; i++){
1ef3: 31 f6 xor %esi,%esi
close(fd);
1ef5: 50 push %eax
1ef6: e8 9f 1f 00 00 call 3e9a <close>
1efb: 83 c4 10 add $0x10,%esp
1efe: 66 90 xchg %ax,%ax
name[1] = '0' + (i / 64);
1f00: 89 f0 mov %esi,%eax
if(link("bd", name) != 0){
1f02: 83 ec 08 sub $0x8,%esp
name[0] = 'x';
1f05: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1f09: c1 f8 06 sar $0x6,%eax
if(link("bd", name) != 0){
1f0c: 57 push %edi
1f0d: 68 35 4a 00 00 push $0x4a35
name[1] = '0' + (i / 64);
1f12: 83 c0 30 add $0x30,%eax
name[3] = '\0';
1f15: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[1] = '0' + (i / 64);
1f19: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1f1c: 89 f0 mov %esi,%eax
1f1e: 83 e0 3f and $0x3f,%eax
1f21: 83 c0 30 add $0x30,%eax
1f24: 88 45 e0 mov %al,-0x20(%ebp)
if(link("bd", name) != 0){
1f27: e8 a6 1f 00 00 call 3ed2 <link>
1f2c: 83 c4 10 add $0x10,%esp
1f2f: 85 c0 test %eax,%eax
1f31: 89 c3 mov %eax,%ebx
1f33: 75 6e jne 1fa3 <bigdir+0xf3>
for(i = 0; i < 500; i++){
1f35: 83 c6 01 add $0x1,%esi
1f38: 81 fe f4 01 00 00 cmp $0x1f4,%esi
1f3e: 75 c0 jne 1f00 <bigdir+0x50>
unlink("bd");
1f40: 83 ec 0c sub $0xc,%esp
1f43: 68 35 4a 00 00 push $0x4a35
1f48: e8 75 1f 00 00 call 3ec2 <unlink>
1f4d: 83 c4 10 add $0x10,%esp
name[1] = '0' + (i / 64);
1f50: 89 d8 mov %ebx,%eax
if(unlink(name) != 0){
1f52: 83 ec 0c sub $0xc,%esp
name[0] = 'x';
1f55: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1f59: c1 f8 06 sar $0x6,%eax
if(unlink(name) != 0){
1f5c: 57 push %edi
name[3] = '\0';
1f5d: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[1] = '0' + (i / 64);
1f61: 83 c0 30 add $0x30,%eax
1f64: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1f67: 89 d8 mov %ebx,%eax
1f69: 83 e0 3f and $0x3f,%eax
1f6c: 83 c0 30 add $0x30,%eax
1f6f: 88 45 e0 mov %al,-0x20(%ebp)
if(unlink(name) != 0){
1f72: e8 4b 1f 00 00 call 3ec2 <unlink>
1f77: 83 c4 10 add $0x10,%esp
1f7a: 85 c0 test %eax,%eax
1f7c: 75 40 jne 1fbe <bigdir+0x10e>
for(i = 0; i < 500; i++){
1f7e: 83 c3 01 add $0x1,%ebx
1f81: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
1f87: 75 c7 jne 1f50 <bigdir+0xa0>
printf(1, "bigdir ok\n");
1f89: 83 ec 08 sub $0x8,%esp
1f8c: 68 77 4a 00 00 push $0x4a77
1f91: 6a 01 push $0x1
1f93: e8 48 20 00 00 call 3fe0 <printf>
}
1f98: 83 c4 10 add $0x10,%esp
1f9b: 8d 65 f4 lea -0xc(%ebp),%esp
1f9e: 5b pop %ebx
1f9f: 5e pop %esi
1fa0: 5f pop %edi
1fa1: 5d pop %ebp
1fa2: c3 ret
printf(1, "bigdir link failed\n");
1fa3: 83 ec 08 sub $0x8,%esp
1fa6: 68 4e 4a 00 00 push $0x4a4e
1fab: 6a 01 push $0x1
1fad: e8 2e 20 00 00 call 3fe0 <printf>
exit(0);
1fb2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1fb9: e8 b4 1e 00 00 call 3e72 <exit>
printf(1, "bigdir unlink failed");
1fbe: 83 ec 08 sub $0x8,%esp
1fc1: 68 62 4a 00 00 push $0x4a62
1fc6: 6a 01 push $0x1
1fc8: e8 13 20 00 00 call 3fe0 <printf>
exit(0);
1fcd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1fd4: e8 99 1e 00 00 call 3e72 <exit>
printf(1, "bigdir create failed\n");
1fd9: 50 push %eax
1fda: 50 push %eax
1fdb: 68 38 4a 00 00 push $0x4a38
1fe0: 6a 01 push $0x1
1fe2: e8 f9 1f 00 00 call 3fe0 <printf>
exit(0);
1fe7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1fee: e8 7f 1e 00 00 call 3e72 <exit>
1ff3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1ff9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00002000 <subdir>:
{
2000: 55 push %ebp
2001: 89 e5 mov %esp,%ebp
2003: 53 push %ebx
2004: 83 ec 0c sub $0xc,%esp
printf(1, "subdir test\n");
2007: 68 82 4a 00 00 push $0x4a82
200c: 6a 01 push $0x1
200e: e8 cd 1f 00 00 call 3fe0 <printf>
unlink("ff");
2013: c7 04 24 0b 4b 00 00 movl $0x4b0b,(%esp)
201a: e8 a3 1e 00 00 call 3ec2 <unlink>
if(mkdir("dd") != 0){
201f: c7 04 24 a8 4b 00 00 movl $0x4ba8,(%esp)
2026: e8 af 1e 00 00 call 3eda <mkdir>
202b: 83 c4 10 add $0x10,%esp
202e: 85 c0 test %eax,%eax
2030: 0f 85 4d 06 00 00 jne 2683 <subdir+0x683>
fd = open("dd/ff", O_CREATE | O_RDWR);
2036: 83 ec 08 sub $0x8,%esp
2039: 68 02 02 00 00 push $0x202
203e: 68 e1 4a 00 00 push $0x4ae1
2043: e8 6a 1e 00 00 call 3eb2 <open>
if(fd < 0){
2048: 83 c4 10 add $0x10,%esp
204b: 85 c0 test %eax,%eax
fd = open("dd/ff", O_CREATE | O_RDWR);
204d: 89 c3 mov %eax,%ebx
if(fd < 0){
204f: 0f 88 14 06 00 00 js 2669 <subdir+0x669>
write(fd, "ff", 2);
2055: 83 ec 04 sub $0x4,%esp
2058: 6a 02 push $0x2
205a: 68 0b 4b 00 00 push $0x4b0b
205f: 50 push %eax
2060: e8 2d 1e 00 00 call 3e92 <write>
close(fd);
2065: 89 1c 24 mov %ebx,(%esp)
2068: e8 2d 1e 00 00 call 3e9a <close>
if(unlink("dd") >= 0){
206d: c7 04 24 a8 4b 00 00 movl $0x4ba8,(%esp)
2074: e8 49 1e 00 00 call 3ec2 <unlink>
2079: 83 c4 10 add $0x10,%esp
207c: 85 c0 test %eax,%eax
207e: 0f 89 cb 05 00 00 jns 264f <subdir+0x64f>
if(mkdir("/dd/dd") != 0){
2084: 83 ec 0c sub $0xc,%esp
2087: 68 bc 4a 00 00 push $0x4abc
208c: e8 49 1e 00 00 call 3eda <mkdir>
2091: 83 c4 10 add $0x10,%esp
2094: 85 c0 test %eax,%eax
2096: 0f 85 99 05 00 00 jne 2635 <subdir+0x635>
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
209c: 83 ec 08 sub $0x8,%esp
209f: 68 02 02 00 00 push $0x202
20a4: 68 de 4a 00 00 push $0x4ade
20a9: e8 04 1e 00 00 call 3eb2 <open>
if(fd < 0){
20ae: 83 c4 10 add $0x10,%esp
20b1: 85 c0 test %eax,%eax
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
20b3: 89 c3 mov %eax,%ebx
if(fd < 0){
20b5: 0f 88 5c 04 00 00 js 2517 <subdir+0x517>
write(fd, "FF", 2);
20bb: 83 ec 04 sub $0x4,%esp
20be: 6a 02 push $0x2
20c0: 68 ff 4a 00 00 push $0x4aff
20c5: 50 push %eax
20c6: e8 c7 1d 00 00 call 3e92 <write>
close(fd);
20cb: 89 1c 24 mov %ebx,(%esp)
20ce: e8 c7 1d 00 00 call 3e9a <close>
fd = open("dd/dd/../ff", 0);
20d3: 58 pop %eax
20d4: 5a pop %edx
20d5: 6a 00 push $0x0
20d7: 68 02 4b 00 00 push $0x4b02
20dc: e8 d1 1d 00 00 call 3eb2 <open>
if(fd < 0){
20e1: 83 c4 10 add $0x10,%esp
20e4: 85 c0 test %eax,%eax
fd = open("dd/dd/../ff", 0);
20e6: 89 c3 mov %eax,%ebx
if(fd < 0){
20e8: 0f 88 0f 04 00 00 js 24fd <subdir+0x4fd>
cc = read(fd, buf, sizeof(buf));
20ee: 83 ec 04 sub $0x4,%esp
20f1: 68 00 20 00 00 push $0x2000
20f6: 68 c0 8b 00 00 push $0x8bc0
20fb: 50 push %eax
20fc: e8 89 1d 00 00 call 3e8a <read>
if(cc != 2 || buf[0] != 'f'){
2101: 83 c4 10 add $0x10,%esp
2104: 83 f8 02 cmp $0x2,%eax
2107: 0f 85 3a 03 00 00 jne 2447 <subdir+0x447>
210d: 80 3d c0 8b 00 00 66 cmpb $0x66,0x8bc0
2114: 0f 85 2d 03 00 00 jne 2447 <subdir+0x447>
close(fd);
211a: 83 ec 0c sub $0xc,%esp
211d: 53 push %ebx
211e: e8 77 1d 00 00 call 3e9a <close>
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
2123: 5b pop %ebx
2124: 58 pop %eax
2125: 68 42 4b 00 00 push $0x4b42
212a: 68 de 4a 00 00 push $0x4ade
212f: e8 9e 1d 00 00 call 3ed2 <link>
2134: 83 c4 10 add $0x10,%esp
2137: 85 c0 test %eax,%eax
2139: 0f 85 0c 04 00 00 jne 254b <subdir+0x54b>
if(unlink("dd/dd/ff") != 0){
213f: 83 ec 0c sub $0xc,%esp
2142: 68 de 4a 00 00 push $0x4ade
2147: e8 76 1d 00 00 call 3ec2 <unlink>
214c: 83 c4 10 add $0x10,%esp
214f: 85 c0 test %eax,%eax
2151: 0f 85 24 03 00 00 jne 247b <subdir+0x47b>
if(open("dd/dd/ff", O_RDONLY) >= 0){
2157: 83 ec 08 sub $0x8,%esp
215a: 6a 00 push $0x0
215c: 68 de 4a 00 00 push $0x4ade
2161: e8 4c 1d 00 00 call 3eb2 <open>
2166: 83 c4 10 add $0x10,%esp
2169: 85 c0 test %eax,%eax
216b: 0f 89 aa 04 00 00 jns 261b <subdir+0x61b>
if(chdir("dd") != 0){
2171: 83 ec 0c sub $0xc,%esp
2174: 68 a8 4b 00 00 push $0x4ba8
2179: e8 64 1d 00 00 call 3ee2 <chdir>
217e: 83 c4 10 add $0x10,%esp
2181: 85 c0 test %eax,%eax
2183: 0f 85 78 04 00 00 jne 2601 <subdir+0x601>
if(chdir("dd/../../dd") != 0){
2189: 83 ec 0c sub $0xc,%esp
218c: 68 76 4b 00 00 push $0x4b76
2191: e8 4c 1d 00 00 call 3ee2 <chdir>
2196: 83 c4 10 add $0x10,%esp
2199: 85 c0 test %eax,%eax
219b: 0f 85 c0 02 00 00 jne 2461 <subdir+0x461>
if(chdir("dd/../../../dd") != 0){
21a1: 83 ec 0c sub $0xc,%esp
21a4: 68 9c 4b 00 00 push $0x4b9c
21a9: e8 34 1d 00 00 call 3ee2 <chdir>
21ae: 83 c4 10 add $0x10,%esp
21b1: 85 c0 test %eax,%eax
21b3: 0f 85 a8 02 00 00 jne 2461 <subdir+0x461>
if(chdir("./..") != 0){
21b9: 83 ec 0c sub $0xc,%esp
21bc: 68 ab 4b 00 00 push $0x4bab
21c1: e8 1c 1d 00 00 call 3ee2 <chdir>
21c6: 83 c4 10 add $0x10,%esp
21c9: 85 c0 test %eax,%eax
21cb: 0f 85 60 03 00 00 jne 2531 <subdir+0x531>
fd = open("dd/dd/ffff", 0);
21d1: 83 ec 08 sub $0x8,%esp
21d4: 6a 00 push $0x0
21d6: 68 42 4b 00 00 push $0x4b42
21db: e8 d2 1c 00 00 call 3eb2 <open>
if(fd < 0){
21e0: 83 c4 10 add $0x10,%esp
21e3: 85 c0 test %eax,%eax
fd = open("dd/dd/ffff", 0);
21e5: 89 c3 mov %eax,%ebx
if(fd < 0){
21e7: 0f 88 ce 05 00 00 js 27bb <subdir+0x7bb>
if(read(fd, buf, sizeof(buf)) != 2){
21ed: 83 ec 04 sub $0x4,%esp
21f0: 68 00 20 00 00 push $0x2000
21f5: 68 c0 8b 00 00 push $0x8bc0
21fa: 50 push %eax
21fb: e8 8a 1c 00 00 call 3e8a <read>
2200: 83 c4 10 add $0x10,%esp
2203: 83 f8 02 cmp $0x2,%eax
2206: 0f 85 95 05 00 00 jne 27a1 <subdir+0x7a1>
close(fd);
220c: 83 ec 0c sub $0xc,%esp
220f: 53 push %ebx
2210: e8 85 1c 00 00 call 3e9a <close>
if(open("dd/dd/ff", O_RDONLY) >= 0){
2215: 59 pop %ecx
2216: 5b pop %ebx
2217: 6a 00 push $0x0
2219: 68 de 4a 00 00 push $0x4ade
221e: e8 8f 1c 00 00 call 3eb2 <open>
2223: 83 c4 10 add $0x10,%esp
2226: 85 c0 test %eax,%eax
2228: 0f 89 81 02 00 00 jns 24af <subdir+0x4af>
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
222e: 83 ec 08 sub $0x8,%esp
2231: 68 02 02 00 00 push $0x202
2236: 68 f6 4b 00 00 push $0x4bf6
223b: e8 72 1c 00 00 call 3eb2 <open>
2240: 83 c4 10 add $0x10,%esp
2243: 85 c0 test %eax,%eax
2245: 0f 89 4a 02 00 00 jns 2495 <subdir+0x495>
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
224b: 83 ec 08 sub $0x8,%esp
224e: 68 02 02 00 00 push $0x202
2253: 68 1b 4c 00 00 push $0x4c1b
2258: e8 55 1c 00 00 call 3eb2 <open>
225d: 83 c4 10 add $0x10,%esp
2260: 85 c0 test %eax,%eax
2262: 0f 89 7f 03 00 00 jns 25e7 <subdir+0x5e7>
if(open("dd", O_CREATE) >= 0){
2268: 83 ec 08 sub $0x8,%esp
226b: 68 00 02 00 00 push $0x200
2270: 68 a8 4b 00 00 push $0x4ba8
2275: e8 38 1c 00 00 call 3eb2 <open>
227a: 83 c4 10 add $0x10,%esp
227d: 85 c0 test %eax,%eax
227f: 0f 89 48 03 00 00 jns 25cd <subdir+0x5cd>
if(open("dd", O_RDWR) >= 0){
2285: 83 ec 08 sub $0x8,%esp
2288: 6a 02 push $0x2
228a: 68 a8 4b 00 00 push $0x4ba8
228f: e8 1e 1c 00 00 call 3eb2 <open>
2294: 83 c4 10 add $0x10,%esp
2297: 85 c0 test %eax,%eax
2299: 0f 89 14 03 00 00 jns 25b3 <subdir+0x5b3>
if(open("dd", O_WRONLY) >= 0){
229f: 83 ec 08 sub $0x8,%esp
22a2: 6a 01 push $0x1
22a4: 68 a8 4b 00 00 push $0x4ba8
22a9: e8 04 1c 00 00 call 3eb2 <open>
22ae: 83 c4 10 add $0x10,%esp
22b1: 85 c0 test %eax,%eax
22b3: 0f 89 e0 02 00 00 jns 2599 <subdir+0x599>
if(link("dd/ff/ff", "dd/dd/xx") == 0){
22b9: 83 ec 08 sub $0x8,%esp
22bc: 68 8a 4c 00 00 push $0x4c8a
22c1: 68 f6 4b 00 00 push $0x4bf6
22c6: e8 07 1c 00 00 call 3ed2 <link>
22cb: 83 c4 10 add $0x10,%esp
22ce: 85 c0 test %eax,%eax
22d0: 0f 84 a9 02 00 00 je 257f <subdir+0x57f>
if(link("dd/xx/ff", "dd/dd/xx") == 0){
22d6: 83 ec 08 sub $0x8,%esp
22d9: 68 8a 4c 00 00 push $0x4c8a
22de: 68 1b 4c 00 00 push $0x4c1b
22e3: e8 ea 1b 00 00 call 3ed2 <link>
22e8: 83 c4 10 add $0x10,%esp
22eb: 85 c0 test %eax,%eax
22ed: 0f 84 72 02 00 00 je 2565 <subdir+0x565>
if(link("dd/ff", "dd/dd/ffff") == 0){
22f3: 83 ec 08 sub $0x8,%esp
22f6: 68 42 4b 00 00 push $0x4b42
22fb: 68 e1 4a 00 00 push $0x4ae1
2300: e8 cd 1b 00 00 call 3ed2 <link>
2305: 83 c4 10 add $0x10,%esp
2308: 85 c0 test %eax,%eax
230a: 0f 84 d3 01 00 00 je 24e3 <subdir+0x4e3>
if(mkdir("dd/ff/ff") == 0){
2310: 83 ec 0c sub $0xc,%esp
2313: 68 f6 4b 00 00 push $0x4bf6
2318: e8 bd 1b 00 00 call 3eda <mkdir>
231d: 83 c4 10 add $0x10,%esp
2320: 85 c0 test %eax,%eax
2322: 0f 84 a1 01 00 00 je 24c9 <subdir+0x4c9>
if(mkdir("dd/xx/ff") == 0){
2328: 83 ec 0c sub $0xc,%esp
232b: 68 1b 4c 00 00 push $0x4c1b
2330: e8 a5 1b 00 00 call 3eda <mkdir>
2335: 83 c4 10 add $0x10,%esp
2338: 85 c0 test %eax,%eax
233a: 0f 84 47 04 00 00 je 2787 <subdir+0x787>
if(mkdir("dd/dd/ffff") == 0){
2340: 83 ec 0c sub $0xc,%esp
2343: 68 42 4b 00 00 push $0x4b42
2348: e8 8d 1b 00 00 call 3eda <mkdir>
234d: 83 c4 10 add $0x10,%esp
2350: 85 c0 test %eax,%eax
2352: 0f 84 15 04 00 00 je 276d <subdir+0x76d>
if(unlink("dd/xx/ff") == 0){
2358: 83 ec 0c sub $0xc,%esp
235b: 68 1b 4c 00 00 push $0x4c1b
2360: e8 5d 1b 00 00 call 3ec2 <unlink>
2365: 83 c4 10 add $0x10,%esp
2368: 85 c0 test %eax,%eax
236a: 0f 84 e3 03 00 00 je 2753 <subdir+0x753>
if(unlink("dd/ff/ff") == 0){
2370: 83 ec 0c sub $0xc,%esp
2373: 68 f6 4b 00 00 push $0x4bf6
2378: e8 45 1b 00 00 call 3ec2 <unlink>
237d: 83 c4 10 add $0x10,%esp
2380: 85 c0 test %eax,%eax
2382: 0f 84 b1 03 00 00 je 2739 <subdir+0x739>
if(chdir("dd/ff") == 0){
2388: 83 ec 0c sub $0xc,%esp
238b: 68 e1 4a 00 00 push $0x4ae1
2390: e8 4d 1b 00 00 call 3ee2 <chdir>
2395: 83 c4 10 add $0x10,%esp
2398: 85 c0 test %eax,%eax
239a: 0f 84 7f 03 00 00 je 271f <subdir+0x71f>
if(chdir("dd/xx") == 0){
23a0: 83 ec 0c sub $0xc,%esp
23a3: 68 8d 4c 00 00 push $0x4c8d
23a8: e8 35 1b 00 00 call 3ee2 <chdir>
23ad: 83 c4 10 add $0x10,%esp
23b0: 85 c0 test %eax,%eax
23b2: 0f 84 4d 03 00 00 je 2705 <subdir+0x705>
if(unlink("dd/dd/ffff") != 0){
23b8: 83 ec 0c sub $0xc,%esp
23bb: 68 42 4b 00 00 push $0x4b42
23c0: e8 fd 1a 00 00 call 3ec2 <unlink>
23c5: 83 c4 10 add $0x10,%esp
23c8: 85 c0 test %eax,%eax
23ca: 0f 85 ab 00 00 00 jne 247b <subdir+0x47b>
if(unlink("dd/ff") != 0){
23d0: 83 ec 0c sub $0xc,%esp
23d3: 68 e1 4a 00 00 push $0x4ae1
23d8: e8 e5 1a 00 00 call 3ec2 <unlink>
23dd: 83 c4 10 add $0x10,%esp
23e0: 85 c0 test %eax,%eax
23e2: 0f 85 03 03 00 00 jne 26eb <subdir+0x6eb>
if(unlink("dd") == 0){
23e8: 83 ec 0c sub $0xc,%esp
23eb: 68 a8 4b 00 00 push $0x4ba8
23f0: e8 cd 1a 00 00 call 3ec2 <unlink>
23f5: 83 c4 10 add $0x10,%esp
23f8: 85 c0 test %eax,%eax
23fa: 0f 84 d1 02 00 00 je 26d1 <subdir+0x6d1>
if(unlink("dd/dd") < 0){
2400: 83 ec 0c sub $0xc,%esp
2403: 68 bd 4a 00 00 push $0x4abd
2408: e8 b5 1a 00 00 call 3ec2 <unlink>
240d: 83 c4 10 add $0x10,%esp
2410: 85 c0 test %eax,%eax
2412: 0f 88 9f 02 00 00 js 26b7 <subdir+0x6b7>
if(unlink("dd") < 0){
2418: 83 ec 0c sub $0xc,%esp
241b: 68 a8 4b 00 00 push $0x4ba8
2420: e8 9d 1a 00 00 call 3ec2 <unlink>
2425: 83 c4 10 add $0x10,%esp
2428: 85 c0 test %eax,%eax
242a: 0f 88 6d 02 00 00 js 269d <subdir+0x69d>
printf(1, "subdir ok\n");
2430: 83 ec 08 sub $0x8,%esp
2433: 68 8a 4d 00 00 push $0x4d8a
2438: 6a 01 push $0x1
243a: e8 a1 1b 00 00 call 3fe0 <printf>
}
243f: 83 c4 10 add $0x10,%esp
2442: 8b 5d fc mov -0x4(%ebp),%ebx
2445: c9 leave
2446: c3 ret
printf(1, "dd/dd/../ff wrong content\n");
2447: 50 push %eax
2448: 50 push %eax
2449: 68 27 4b 00 00 push $0x4b27
244e: 6a 01 push $0x1
2450: e8 8b 1b 00 00 call 3fe0 <printf>
exit(0);
2455: c7 04 24 00 00 00 00 movl $0x0,(%esp)
245c: e8 11 1a 00 00 call 3e72 <exit>
printf(1, "chdir dd/../../dd failed\n");
2461: 50 push %eax
2462: 50 push %eax
2463: 68 82 4b 00 00 push $0x4b82
2468: 6a 01 push $0x1
246a: e8 71 1b 00 00 call 3fe0 <printf>
exit(0);
246f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2476: e8 f7 19 00 00 call 3e72 <exit>
printf(1, "unlink dd/dd/ff failed\n");
247b: 52 push %edx
247c: 52 push %edx
247d: 68 4d 4b 00 00 push $0x4b4d
2482: 6a 01 push $0x1
2484: e8 57 1b 00 00 call 3fe0 <printf>
exit(0);
2489: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2490: e8 dd 19 00 00 call 3e72 <exit>
printf(1, "create dd/ff/ff succeeded!\n");
2495: 50 push %eax
2496: 50 push %eax
2497: 68 ff 4b 00 00 push $0x4bff
249c: 6a 01 push $0x1
249e: e8 3d 1b 00 00 call 3fe0 <printf>
exit(0);
24a3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24aa: e8 c3 19 00 00 call 3e72 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
24af: 52 push %edx
24b0: 52 push %edx
24b1: 68 e4 55 00 00 push $0x55e4
24b6: 6a 01 push $0x1
24b8: e8 23 1b 00 00 call 3fe0 <printf>
exit(0);
24bd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24c4: e8 a9 19 00 00 call 3e72 <exit>
printf(1, "mkdir dd/ff/ff succeeded!\n");
24c9: 52 push %edx
24ca: 52 push %edx
24cb: 68 93 4c 00 00 push $0x4c93
24d0: 6a 01 push $0x1
24d2: e8 09 1b 00 00 call 3fe0 <printf>
exit(0);
24d7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24de: e8 8f 19 00 00 call 3e72 <exit>
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
24e3: 51 push %ecx
24e4: 51 push %ecx
24e5: 68 54 56 00 00 push $0x5654
24ea: 6a 01 push $0x1
24ec: e8 ef 1a 00 00 call 3fe0 <printf>
exit(0);
24f1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24f8: e8 75 19 00 00 call 3e72 <exit>
printf(1, "open dd/dd/../ff failed\n");
24fd: 50 push %eax
24fe: 50 push %eax
24ff: 68 0e 4b 00 00 push $0x4b0e
2504: 6a 01 push $0x1
2506: e8 d5 1a 00 00 call 3fe0 <printf>
exit(0);
250b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2512: e8 5b 19 00 00 call 3e72 <exit>
printf(1, "create dd/dd/ff failed\n");
2517: 51 push %ecx
2518: 51 push %ecx
2519: 68 e7 4a 00 00 push $0x4ae7
251e: 6a 01 push $0x1
2520: e8 bb 1a 00 00 call 3fe0 <printf>
exit(0);
2525: c7 04 24 00 00 00 00 movl $0x0,(%esp)
252c: e8 41 19 00 00 call 3e72 <exit>
printf(1, "chdir ./.. failed\n");
2531: 50 push %eax
2532: 50 push %eax
2533: 68 b0 4b 00 00 push $0x4bb0
2538: 6a 01 push $0x1
253a: e8 a1 1a 00 00 call 3fe0 <printf>
exit(0);
253f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2546: e8 27 19 00 00 call 3e72 <exit>
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
254b: 51 push %ecx
254c: 51 push %ecx
254d: 68 9c 55 00 00 push $0x559c
2552: 6a 01 push $0x1
2554: e8 87 1a 00 00 call 3fe0 <printf>
exit(0);
2559: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2560: e8 0d 19 00 00 call 3e72 <exit>
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
2565: 53 push %ebx
2566: 53 push %ebx
2567: 68 30 56 00 00 push $0x5630
256c: 6a 01 push $0x1
256e: e8 6d 1a 00 00 call 3fe0 <printf>
exit(0);
2573: c7 04 24 00 00 00 00 movl $0x0,(%esp)
257a: e8 f3 18 00 00 call 3e72 <exit>
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
257f: 50 push %eax
2580: 50 push %eax
2581: 68 0c 56 00 00 push $0x560c
2586: 6a 01 push $0x1
2588: e8 53 1a 00 00 call 3fe0 <printf>
exit(0);
258d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2594: e8 d9 18 00 00 call 3e72 <exit>
printf(1, "open dd wronly succeeded!\n");
2599: 50 push %eax
259a: 50 push %eax
259b: 68 6f 4c 00 00 push $0x4c6f
25a0: 6a 01 push $0x1
25a2: e8 39 1a 00 00 call 3fe0 <printf>
exit(0);
25a7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25ae: e8 bf 18 00 00 call 3e72 <exit>
printf(1, "open dd rdwr succeeded!\n");
25b3: 50 push %eax
25b4: 50 push %eax
25b5: 68 56 4c 00 00 push $0x4c56
25ba: 6a 01 push $0x1
25bc: e8 1f 1a 00 00 call 3fe0 <printf>
exit(0);
25c1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25c8: e8 a5 18 00 00 call 3e72 <exit>
printf(1, "create dd succeeded!\n");
25cd: 50 push %eax
25ce: 50 push %eax
25cf: 68 40 4c 00 00 push $0x4c40
25d4: 6a 01 push $0x1
25d6: e8 05 1a 00 00 call 3fe0 <printf>
exit(0);
25db: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25e2: e8 8b 18 00 00 call 3e72 <exit>
printf(1, "create dd/xx/ff succeeded!\n");
25e7: 50 push %eax
25e8: 50 push %eax
25e9: 68 24 4c 00 00 push $0x4c24
25ee: 6a 01 push $0x1
25f0: e8 eb 19 00 00 call 3fe0 <printf>
exit(0);
25f5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25fc: e8 71 18 00 00 call 3e72 <exit>
printf(1, "chdir dd failed\n");
2601: 50 push %eax
2602: 50 push %eax
2603: 68 65 4b 00 00 push $0x4b65
2608: 6a 01 push $0x1
260a: e8 d1 19 00 00 call 3fe0 <printf>
exit(0);
260f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2616: e8 57 18 00 00 call 3e72 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
261b: 50 push %eax
261c: 50 push %eax
261d: 68 c0 55 00 00 push $0x55c0
2622: 6a 01 push $0x1
2624: e8 b7 19 00 00 call 3fe0 <printf>
exit(0);
2629: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2630: e8 3d 18 00 00 call 3e72 <exit>
printf(1, "subdir mkdir dd/dd failed\n");
2635: 53 push %ebx
2636: 53 push %ebx
2637: 68 c3 4a 00 00 push $0x4ac3
263c: 6a 01 push $0x1
263e: e8 9d 19 00 00 call 3fe0 <printf>
exit(0);
2643: c7 04 24 00 00 00 00 movl $0x0,(%esp)
264a: e8 23 18 00 00 call 3e72 <exit>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
264f: 50 push %eax
2650: 50 push %eax
2651: 68 74 55 00 00 push $0x5574
2656: 6a 01 push $0x1
2658: e8 83 19 00 00 call 3fe0 <printf>
exit(0);
265d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2664: e8 09 18 00 00 call 3e72 <exit>
printf(1, "create dd/ff failed\n");
2669: 50 push %eax
266a: 50 push %eax
266b: 68 a7 4a 00 00 push $0x4aa7
2670: 6a 01 push $0x1
2672: e8 69 19 00 00 call 3fe0 <printf>
exit(0);
2677: c7 04 24 00 00 00 00 movl $0x0,(%esp)
267e: e8 ef 17 00 00 call 3e72 <exit>
printf(1, "subdir mkdir dd failed\n");
2683: 50 push %eax
2684: 50 push %eax
2685: 68 8f 4a 00 00 push $0x4a8f
268a: 6a 01 push $0x1
268c: e8 4f 19 00 00 call 3fe0 <printf>
exit(0);
2691: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2698: e8 d5 17 00 00 call 3e72 <exit>
printf(1, "unlink dd failed\n");
269d: 50 push %eax
269e: 50 push %eax
269f: 68 78 4d 00 00 push $0x4d78
26a4: 6a 01 push $0x1
26a6: e8 35 19 00 00 call 3fe0 <printf>
exit(0);
26ab: c7 04 24 00 00 00 00 movl $0x0,(%esp)
26b2: e8 bb 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/dd failed\n");
26b7: 52 push %edx
26b8: 52 push %edx
26b9: 68 63 4d 00 00 push $0x4d63
26be: 6a 01 push $0x1
26c0: e8 1b 19 00 00 call 3fe0 <printf>
exit(0);
26c5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
26cc: e8 a1 17 00 00 call 3e72 <exit>
printf(1, "unlink non-empty dd succeeded!\n");
26d1: 51 push %ecx
26d2: 51 push %ecx
26d3: 68 78 56 00 00 push $0x5678
26d8: 6a 01 push $0x1
26da: e8 01 19 00 00 call 3fe0 <printf>
exit(0);
26df: c7 04 24 00 00 00 00 movl $0x0,(%esp)
26e6: e8 87 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/ff failed\n");
26eb: 53 push %ebx
26ec: 53 push %ebx
26ed: 68 4e 4d 00 00 push $0x4d4e
26f2: 6a 01 push $0x1
26f4: e8 e7 18 00 00 call 3fe0 <printf>
exit(0);
26f9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2700: e8 6d 17 00 00 call 3e72 <exit>
printf(1, "chdir dd/xx succeeded!\n");
2705: 50 push %eax
2706: 50 push %eax
2707: 68 36 4d 00 00 push $0x4d36
270c: 6a 01 push $0x1
270e: e8 cd 18 00 00 call 3fe0 <printf>
exit(0);
2713: c7 04 24 00 00 00 00 movl $0x0,(%esp)
271a: e8 53 17 00 00 call 3e72 <exit>
printf(1, "chdir dd/ff succeeded!\n");
271f: 50 push %eax
2720: 50 push %eax
2721: 68 1e 4d 00 00 push $0x4d1e
2726: 6a 01 push $0x1
2728: e8 b3 18 00 00 call 3fe0 <printf>
exit(0);
272d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2734: e8 39 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/ff/ff succeeded!\n");
2739: 50 push %eax
273a: 50 push %eax
273b: 68 02 4d 00 00 push $0x4d02
2740: 6a 01 push $0x1
2742: e8 99 18 00 00 call 3fe0 <printf>
exit(0);
2747: c7 04 24 00 00 00 00 movl $0x0,(%esp)
274e: e8 1f 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/xx/ff succeeded!\n");
2753: 50 push %eax
2754: 50 push %eax
2755: 68 e6 4c 00 00 push $0x4ce6
275a: 6a 01 push $0x1
275c: e8 7f 18 00 00 call 3fe0 <printf>
exit(0);
2761: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2768: e8 05 17 00 00 call 3e72 <exit>
printf(1, "mkdir dd/dd/ffff succeeded!\n");
276d: 50 push %eax
276e: 50 push %eax
276f: 68 c9 4c 00 00 push $0x4cc9
2774: 6a 01 push $0x1
2776: e8 65 18 00 00 call 3fe0 <printf>
exit(0);
277b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2782: e8 eb 16 00 00 call 3e72 <exit>
printf(1, "mkdir dd/xx/ff succeeded!\n");
2787: 50 push %eax
2788: 50 push %eax
2789: 68 ae 4c 00 00 push $0x4cae
278e: 6a 01 push $0x1
2790: e8 4b 18 00 00 call 3fe0 <printf>
exit(0);
2795: c7 04 24 00 00 00 00 movl $0x0,(%esp)
279c: e8 d1 16 00 00 call 3e72 <exit>
printf(1, "read dd/dd/ffff wrong len\n");
27a1: 50 push %eax
27a2: 50 push %eax
27a3: 68 db 4b 00 00 push $0x4bdb
27a8: 6a 01 push $0x1
27aa: e8 31 18 00 00 call 3fe0 <printf>
exit(0);
27af: c7 04 24 00 00 00 00 movl $0x0,(%esp)
27b6: e8 b7 16 00 00 call 3e72 <exit>
printf(1, "open dd/dd/ffff failed\n");
27bb: 50 push %eax
27bc: 50 push %eax
27bd: 68 c3 4b 00 00 push $0x4bc3
27c2: 6a 01 push $0x1
27c4: e8 17 18 00 00 call 3fe0 <printf>
exit(0);
27c9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
27d0: e8 9d 16 00 00 call 3e72 <exit>
27d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
27d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000027e0 <bigwrite>:
{
27e0: 55 push %ebp
27e1: 89 e5 mov %esp,%ebp
27e3: 56 push %esi
27e4: 53 push %ebx
for(sz = 499; sz < 12*512; sz += 471){
27e5: bb f3 01 00 00 mov $0x1f3,%ebx
printf(1, "bigwrite test\n");
27ea: 83 ec 08 sub $0x8,%esp
27ed: 68 95 4d 00 00 push $0x4d95
27f2: 6a 01 push $0x1
27f4: e8 e7 17 00 00 call 3fe0 <printf>
unlink("bigwrite");
27f9: c7 04 24 a4 4d 00 00 movl $0x4da4,(%esp)
2800: e8 bd 16 00 00 call 3ec2 <unlink>
2805: 83 c4 10 add $0x10,%esp
2808: 90 nop
2809: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
fd = open("bigwrite", O_CREATE | O_RDWR);
2810: 83 ec 08 sub $0x8,%esp
2813: 68 02 02 00 00 push $0x202
2818: 68 a4 4d 00 00 push $0x4da4
281d: e8 90 16 00 00 call 3eb2 <open>
if(fd < 0){
2822: 83 c4 10 add $0x10,%esp
2825: 85 c0 test %eax,%eax
fd = open("bigwrite", O_CREATE | O_RDWR);
2827: 89 c6 mov %eax,%esi
if(fd < 0){
2829: 0f 88 85 00 00 00 js 28b4 <bigwrite+0xd4>
int cc = write(fd, buf, sz);
282f: 83 ec 04 sub $0x4,%esp
2832: 53 push %ebx
2833: 68 c0 8b 00 00 push $0x8bc0
2838: 50 push %eax
2839: e8 54 16 00 00 call 3e92 <write>
if(cc != sz){
283e: 83 c4 10 add $0x10,%esp
2841: 39 d8 cmp %ebx,%eax
2843: 75 55 jne 289a <bigwrite+0xba>
int cc = write(fd, buf, sz);
2845: 83 ec 04 sub $0x4,%esp
2848: 53 push %ebx
2849: 68 c0 8b 00 00 push $0x8bc0
284e: 56 push %esi
284f: e8 3e 16 00 00 call 3e92 <write>
if(cc != sz){
2854: 83 c4 10 add $0x10,%esp
2857: 39 d8 cmp %ebx,%eax
2859: 75 3f jne 289a <bigwrite+0xba>
close(fd);
285b: 83 ec 0c sub $0xc,%esp
for(sz = 499; sz < 12*512; sz += 471){
285e: 81 c3 d7 01 00 00 add $0x1d7,%ebx
close(fd);
2864: 56 push %esi
2865: e8 30 16 00 00 call 3e9a <close>
unlink("bigwrite");
286a: c7 04 24 a4 4d 00 00 movl $0x4da4,(%esp)
2871: e8 4c 16 00 00 call 3ec2 <unlink>
for(sz = 499; sz < 12*512; sz += 471){
2876: 83 c4 10 add $0x10,%esp
2879: 81 fb 07 18 00 00 cmp $0x1807,%ebx
287f: 75 8f jne 2810 <bigwrite+0x30>
printf(1, "bigwrite ok\n");
2881: 83 ec 08 sub $0x8,%esp
2884: 68 d7 4d 00 00 push $0x4dd7
2889: 6a 01 push $0x1
288b: e8 50 17 00 00 call 3fe0 <printf>
}
2890: 83 c4 10 add $0x10,%esp
2893: 8d 65 f8 lea -0x8(%ebp),%esp
2896: 5b pop %ebx
2897: 5e pop %esi
2898: 5d pop %ebp
2899: c3 ret
printf(1, "write(%d) ret %d\n", sz, cc);
289a: 50 push %eax
289b: 53 push %ebx
289c: 68 c5 4d 00 00 push $0x4dc5
28a1: 6a 01 push $0x1
28a3: e8 38 17 00 00 call 3fe0 <printf>
exit(0);
28a8: c7 04 24 00 00 00 00 movl $0x0,(%esp)
28af: e8 be 15 00 00 call 3e72 <exit>
printf(1, "cannot create bigwrite\n");
28b4: 83 ec 08 sub $0x8,%esp
28b7: 68 ad 4d 00 00 push $0x4dad
28bc: 6a 01 push $0x1
28be: e8 1d 17 00 00 call 3fe0 <printf>
exit(0);
28c3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
28ca: e8 a3 15 00 00 call 3e72 <exit>
28cf: 90 nop
000028d0 <bigfile>:
{
28d0: 55 push %ebp
28d1: 89 e5 mov %esp,%ebp
28d3: 57 push %edi
28d4: 56 push %esi
28d5: 53 push %ebx
28d6: 83 ec 14 sub $0x14,%esp
printf(1, "bigfile test\n");
28d9: 68 e4 4d 00 00 push $0x4de4
28de: 6a 01 push $0x1
28e0: e8 fb 16 00 00 call 3fe0 <printf>
unlink("bigfile");
28e5: c7 04 24 00 4e 00 00 movl $0x4e00,(%esp)
28ec: e8 d1 15 00 00 call 3ec2 <unlink>
fd = open("bigfile", O_CREATE | O_RDWR);
28f1: 58 pop %eax
28f2: 5a pop %edx
28f3: 68 02 02 00 00 push $0x202
28f8: 68 00 4e 00 00 push $0x4e00
28fd: e8 b0 15 00 00 call 3eb2 <open>
if(fd < 0){
2902: 83 c4 10 add $0x10,%esp
2905: 85 c0 test %eax,%eax
2907: 0f 88 81 01 00 00 js 2a8e <bigfile+0x1be>
290d: 89 c6 mov %eax,%esi
for(i = 0; i < 20; i++){
290f: 31 db xor %ebx,%ebx
2911: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
memset(buf, i, 600);
2918: 83 ec 04 sub $0x4,%esp
291b: 68 58 02 00 00 push $0x258
2920: 53 push %ebx
2921: 68 c0 8b 00 00 push $0x8bc0
2926: e8 a5 13 00 00 call 3cd0 <memset>
if(write(fd, buf, 600) != 600){
292b: 83 c4 0c add $0xc,%esp
292e: 68 58 02 00 00 push $0x258
2933: 68 c0 8b 00 00 push $0x8bc0
2938: 56 push %esi
2939: e8 54 15 00 00 call 3e92 <write>
293e: 83 c4 10 add $0x10,%esp
2941: 3d 58 02 00 00 cmp $0x258,%eax
2946: 0f 85 0d 01 00 00 jne 2a59 <bigfile+0x189>
for(i = 0; i < 20; i++){
294c: 83 c3 01 add $0x1,%ebx
294f: 83 fb 14 cmp $0x14,%ebx
2952: 75 c4 jne 2918 <bigfile+0x48>
close(fd);
2954: 83 ec 0c sub $0xc,%esp
2957: 56 push %esi
2958: e8 3d 15 00 00 call 3e9a <close>
fd = open("bigfile", 0);
295d: 5e pop %esi
295e: 5f pop %edi
295f: 6a 00 push $0x0
2961: 68 00 4e 00 00 push $0x4e00
2966: e8 47 15 00 00 call 3eb2 <open>
if(fd < 0){
296b: 83 c4 10 add $0x10,%esp
296e: 85 c0 test %eax,%eax
fd = open("bigfile", 0);
2970: 89 c6 mov %eax,%esi
if(fd < 0){
2972: 0f 88 fc 00 00 00 js 2a74 <bigfile+0x1a4>
total = 0;
2978: 31 db xor %ebx,%ebx
for(i = 0; ; i++){
297a: 31 ff xor %edi,%edi
297c: eb 30 jmp 29ae <bigfile+0xde>
297e: 66 90 xchg %ax,%ax
if(cc != 300){
2980: 3d 2c 01 00 00 cmp $0x12c,%eax
2985: 0f 85 98 00 00 00 jne 2a23 <bigfile+0x153>
if(buf[0] != i/2 || buf[299] != i/2){
298b: 0f be 05 c0 8b 00 00 movsbl 0x8bc0,%eax
2992: 89 fa mov %edi,%edx
2994: d1 fa sar %edx
2996: 39 d0 cmp %edx,%eax
2998: 75 6e jne 2a08 <bigfile+0x138>
299a: 0f be 15 eb 8c 00 00 movsbl 0x8ceb,%edx
29a1: 39 d0 cmp %edx,%eax
29a3: 75 63 jne 2a08 <bigfile+0x138>
total += cc;
29a5: 81 c3 2c 01 00 00 add $0x12c,%ebx
for(i = 0; ; i++){
29ab: 83 c7 01 add $0x1,%edi
cc = read(fd, buf, 300);
29ae: 83 ec 04 sub $0x4,%esp
29b1: 68 2c 01 00 00 push $0x12c
29b6: 68 c0 8b 00 00 push $0x8bc0
29bb: 56 push %esi
29bc: e8 c9 14 00 00 call 3e8a <read>
if(cc < 0){
29c1: 83 c4 10 add $0x10,%esp
29c4: 85 c0 test %eax,%eax
29c6: 78 76 js 2a3e <bigfile+0x16e>
if(cc == 0)
29c8: 75 b6 jne 2980 <bigfile+0xb0>
close(fd);
29ca: 83 ec 0c sub $0xc,%esp
29cd: 56 push %esi
29ce: e8 c7 14 00 00 call 3e9a <close>
if(total != 20*600){
29d3: 83 c4 10 add $0x10,%esp
29d6: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx
29dc: 0f 85 c6 00 00 00 jne 2aa8 <bigfile+0x1d8>
unlink("bigfile");
29e2: 83 ec 0c sub $0xc,%esp
29e5: 68 00 4e 00 00 push $0x4e00
29ea: e8 d3 14 00 00 call 3ec2 <unlink>
printf(1, "bigfile test ok\n");
29ef: 58 pop %eax
29f0: 5a pop %edx
29f1: 68 8f 4e 00 00 push $0x4e8f
29f6: 6a 01 push $0x1
29f8: e8 e3 15 00 00 call 3fe0 <printf>
}
29fd: 83 c4 10 add $0x10,%esp
2a00: 8d 65 f4 lea -0xc(%ebp),%esp
2a03: 5b pop %ebx
2a04: 5e pop %esi
2a05: 5f pop %edi
2a06: 5d pop %ebp
2a07: c3 ret
printf(1, "read bigfile wrong data\n");
2a08: 83 ec 08 sub $0x8,%esp
2a0b: 68 5c 4e 00 00 push $0x4e5c
2a10: 6a 01 push $0x1
2a12: e8 c9 15 00 00 call 3fe0 <printf>
exit(0);
2a17: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a1e: e8 4f 14 00 00 call 3e72 <exit>
printf(1, "short read bigfile\n");
2a23: 83 ec 08 sub $0x8,%esp
2a26: 68 48 4e 00 00 push $0x4e48
2a2b: 6a 01 push $0x1
2a2d: e8 ae 15 00 00 call 3fe0 <printf>
exit(0);
2a32: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a39: e8 34 14 00 00 call 3e72 <exit>
printf(1, "read bigfile failed\n");
2a3e: 83 ec 08 sub $0x8,%esp
2a41: 68 33 4e 00 00 push $0x4e33
2a46: 6a 01 push $0x1
2a48: e8 93 15 00 00 call 3fe0 <printf>
exit(0);
2a4d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a54: e8 19 14 00 00 call 3e72 <exit>
printf(1, "write bigfile failed\n");
2a59: 83 ec 08 sub $0x8,%esp
2a5c: 68 08 4e 00 00 push $0x4e08
2a61: 6a 01 push $0x1
2a63: e8 78 15 00 00 call 3fe0 <printf>
exit(0);
2a68: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a6f: e8 fe 13 00 00 call 3e72 <exit>
printf(1, "cannot open bigfile\n");
2a74: 53 push %ebx
2a75: 53 push %ebx
2a76: 68 1e 4e 00 00 push $0x4e1e
2a7b: 6a 01 push $0x1
2a7d: e8 5e 15 00 00 call 3fe0 <printf>
exit(0);
2a82: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a89: e8 e4 13 00 00 call 3e72 <exit>
printf(1, "cannot create bigfile");
2a8e: 50 push %eax
2a8f: 50 push %eax
2a90: 68 f2 4d 00 00 push $0x4df2
2a95: 6a 01 push $0x1
2a97: e8 44 15 00 00 call 3fe0 <printf>
exit(0);
2a9c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2aa3: e8 ca 13 00 00 call 3e72 <exit>
printf(1, "read bigfile wrong total\n");
2aa8: 51 push %ecx
2aa9: 51 push %ecx
2aaa: 68 75 4e 00 00 push $0x4e75
2aaf: 6a 01 push $0x1
2ab1: e8 2a 15 00 00 call 3fe0 <printf>
exit(0);
2ab6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2abd: e8 b0 13 00 00 call 3e72 <exit>
2ac2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00002ad0 <fourteen>:
{
2ad0: 55 push %ebp
2ad1: 89 e5 mov %esp,%ebp
2ad3: 83 ec 10 sub $0x10,%esp
printf(1, "fourteen test\n");
2ad6: 68 a0 4e 00 00 push $0x4ea0
2adb: 6a 01 push $0x1
2add: e8 fe 14 00 00 call 3fe0 <printf>
if(mkdir("12345678901234") != 0){
2ae2: c7 04 24 db 4e 00 00 movl $0x4edb,(%esp)
2ae9: e8 ec 13 00 00 call 3eda <mkdir>
2aee: 83 c4 10 add $0x10,%esp
2af1: 85 c0 test %eax,%eax
2af3: 0f 85 9b 00 00 00 jne 2b94 <fourteen+0xc4>
if(mkdir("12345678901234/123456789012345") != 0){
2af9: 83 ec 0c sub $0xc,%esp
2afc: 68 98 56 00 00 push $0x5698
2b01: e8 d4 13 00 00 call 3eda <mkdir>
2b06: 83 c4 10 add $0x10,%esp
2b09: 85 c0 test %eax,%eax
2b0b: 0f 85 05 01 00 00 jne 2c16 <fourteen+0x146>
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
2b11: 83 ec 08 sub $0x8,%esp
2b14: 68 00 02 00 00 push $0x200
2b19: 68 e8 56 00 00 push $0x56e8
2b1e: e8 8f 13 00 00 call 3eb2 <open>
if(fd < 0){
2b23: 83 c4 10 add $0x10,%esp
2b26: 85 c0 test %eax,%eax
2b28: 0f 88 ce 00 00 00 js 2bfc <fourteen+0x12c>
close(fd);
2b2e: 83 ec 0c sub $0xc,%esp
2b31: 50 push %eax
2b32: e8 63 13 00 00 call 3e9a <close>
fd = open("12345678901234/12345678901234/12345678901234", 0);
2b37: 58 pop %eax
2b38: 5a pop %edx
2b39: 6a 00 push $0x0
2b3b: 68 58 57 00 00 push $0x5758
2b40: e8 6d 13 00 00 call 3eb2 <open>
if(fd < 0){
2b45: 83 c4 10 add $0x10,%esp
2b48: 85 c0 test %eax,%eax
2b4a: 0f 88 92 00 00 00 js 2be2 <fourteen+0x112>
close(fd);
2b50: 83 ec 0c sub $0xc,%esp
2b53: 50 push %eax
2b54: e8 41 13 00 00 call 3e9a <close>
if(mkdir("12345678901234/12345678901234") == 0){
2b59: c7 04 24 cc 4e 00 00 movl $0x4ecc,(%esp)
2b60: e8 75 13 00 00 call 3eda <mkdir>
2b65: 83 c4 10 add $0x10,%esp
2b68: 85 c0 test %eax,%eax
2b6a: 74 5c je 2bc8 <fourteen+0xf8>
if(mkdir("123456789012345/12345678901234") == 0){
2b6c: 83 ec 0c sub $0xc,%esp
2b6f: 68 f4 57 00 00 push $0x57f4
2b74: e8 61 13 00 00 call 3eda <mkdir>
2b79: 83 c4 10 add $0x10,%esp
2b7c: 85 c0 test %eax,%eax
2b7e: 74 2e je 2bae <fourteen+0xde>
printf(1, "fourteen ok\n");
2b80: 83 ec 08 sub $0x8,%esp
2b83: 68 ea 4e 00 00 push $0x4eea
2b88: 6a 01 push $0x1
2b8a: e8 51 14 00 00 call 3fe0 <printf>
}
2b8f: 83 c4 10 add $0x10,%esp
2b92: c9 leave
2b93: c3 ret
printf(1, "mkdir 12345678901234 failed\n");
2b94: 50 push %eax
2b95: 50 push %eax
2b96: 68 af 4e 00 00 push $0x4eaf
2b9b: 6a 01 push $0x1
2b9d: e8 3e 14 00 00 call 3fe0 <printf>
exit(0);
2ba2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2ba9: e8 c4 12 00 00 call 3e72 <exit>
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
2bae: 50 push %eax
2baf: 50 push %eax
2bb0: 68 14 58 00 00 push $0x5814
2bb5: 6a 01 push $0x1
2bb7: e8 24 14 00 00 call 3fe0 <printf>
exit(0);
2bbc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2bc3: e8 aa 12 00 00 call 3e72 <exit>
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
2bc8: 52 push %edx
2bc9: 52 push %edx
2bca: 68 c4 57 00 00 push $0x57c4
2bcf: 6a 01 push $0x1
2bd1: e8 0a 14 00 00 call 3fe0 <printf>
exit(0);
2bd6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2bdd: e8 90 12 00 00 call 3e72 <exit>
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
2be2: 51 push %ecx
2be3: 51 push %ecx
2be4: 68 88 57 00 00 push $0x5788
2be9: 6a 01 push $0x1
2beb: e8 f0 13 00 00 call 3fe0 <printf>
exit(0);
2bf0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2bf7: e8 76 12 00 00 call 3e72 <exit>
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
2bfc: 51 push %ecx
2bfd: 51 push %ecx
2bfe: 68 18 57 00 00 push $0x5718
2c03: 6a 01 push $0x1
2c05: e8 d6 13 00 00 call 3fe0 <printf>
exit(0);
2c0a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2c11: e8 5c 12 00 00 call 3e72 <exit>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
2c16: 50 push %eax
2c17: 50 push %eax
2c18: 68 b8 56 00 00 push $0x56b8
2c1d: 6a 01 push $0x1
2c1f: e8 bc 13 00 00 call 3fe0 <printf>
exit(0);
2c24: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2c2b: e8 42 12 00 00 call 3e72 <exit>
00002c30 <rmdot>:
{
2c30: 55 push %ebp
2c31: 89 e5 mov %esp,%ebp
2c33: 83 ec 10 sub $0x10,%esp
printf(1, "rmdot test\n");
2c36: 68 f7 4e 00 00 push $0x4ef7
2c3b: 6a 01 push $0x1
2c3d: e8 9e 13 00 00 call 3fe0 <printf>
if(mkdir("dots") != 0){
2c42: c7 04 24 03 4f 00 00 movl $0x4f03,(%esp)
2c49: e8 8c 12 00 00 call 3eda <mkdir>
2c4e: 83 c4 10 add $0x10,%esp
2c51: 85 c0 test %eax,%eax
2c53: 0f 85 b4 00 00 00 jne 2d0d <rmdot+0xdd>
if(chdir("dots") != 0){
2c59: 83 ec 0c sub $0xc,%esp
2c5c: 68 03 4f 00 00 push $0x4f03
2c61: e8 7c 12 00 00 call 3ee2 <chdir>
2c66: 83 c4 10 add $0x10,%esp
2c69: 85 c0 test %eax,%eax
2c6b: 0f 85 52 01 00 00 jne 2dc3 <rmdot+0x193>
if(unlink(".") == 0){
2c71: 83 ec 0c sub $0xc,%esp
2c74: 68 ae 4b 00 00 push $0x4bae
2c79: e8 44 12 00 00 call 3ec2 <unlink>
2c7e: 83 c4 10 add $0x10,%esp
2c81: 85 c0 test %eax,%eax
2c83: 0f 84 20 01 00 00 je 2da9 <rmdot+0x179>
if(unlink("..") == 0){
2c89: 83 ec 0c sub $0xc,%esp
2c8c: 68 ad 4b 00 00 push $0x4bad
2c91: e8 2c 12 00 00 call 3ec2 <unlink>
2c96: 83 c4 10 add $0x10,%esp
2c99: 85 c0 test %eax,%eax
2c9b: 0f 84 ee 00 00 00 je 2d8f <rmdot+0x15f>
if(chdir("/") != 0){
2ca1: 83 ec 0c sub $0xc,%esp
2ca4: 68 81 43 00 00 push $0x4381
2ca9: e8 34 12 00 00 call 3ee2 <chdir>
2cae: 83 c4 10 add $0x10,%esp
2cb1: 85 c0 test %eax,%eax
2cb3: 0f 85 bc 00 00 00 jne 2d75 <rmdot+0x145>
if(unlink("dots/.") == 0){
2cb9: 83 ec 0c sub $0xc,%esp
2cbc: 68 4b 4f 00 00 push $0x4f4b
2cc1: e8 fc 11 00 00 call 3ec2 <unlink>
2cc6: 83 c4 10 add $0x10,%esp
2cc9: 85 c0 test %eax,%eax
2ccb: 0f 84 8a 00 00 00 je 2d5b <rmdot+0x12b>
if(unlink("dots/..") == 0){
2cd1: 83 ec 0c sub $0xc,%esp
2cd4: 68 69 4f 00 00 push $0x4f69
2cd9: e8 e4 11 00 00 call 3ec2 <unlink>
2cde: 83 c4 10 add $0x10,%esp
2ce1: 85 c0 test %eax,%eax
2ce3: 74 5c je 2d41 <rmdot+0x111>
if(unlink("dots") != 0){
2ce5: 83 ec 0c sub $0xc,%esp
2ce8: 68 03 4f 00 00 push $0x4f03
2ced: e8 d0 11 00 00 call 3ec2 <unlink>
2cf2: 83 c4 10 add $0x10,%esp
2cf5: 85 c0 test %eax,%eax
2cf7: 75 2e jne 2d27 <rmdot+0xf7>
printf(1, "rmdot ok\n");
2cf9: 83 ec 08 sub $0x8,%esp
2cfc: 68 9e 4f 00 00 push $0x4f9e
2d01: 6a 01 push $0x1
2d03: e8 d8 12 00 00 call 3fe0 <printf>
}
2d08: 83 c4 10 add $0x10,%esp
2d0b: c9 leave
2d0c: c3 ret
printf(1, "mkdir dots failed\n");
2d0d: 50 push %eax
2d0e: 50 push %eax
2d0f: 68 08 4f 00 00 push $0x4f08
2d14: 6a 01 push $0x1
2d16: e8 c5 12 00 00 call 3fe0 <printf>
exit(0);
2d1b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d22: e8 4b 11 00 00 call 3e72 <exit>
printf(1, "unlink dots failed!\n");
2d27: 50 push %eax
2d28: 50 push %eax
2d29: 68 89 4f 00 00 push $0x4f89
2d2e: 6a 01 push $0x1
2d30: e8 ab 12 00 00 call 3fe0 <printf>
exit(0);
2d35: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d3c: e8 31 11 00 00 call 3e72 <exit>
printf(1, "unlink dots/.. worked!\n");
2d41: 52 push %edx
2d42: 52 push %edx
2d43: 68 71 4f 00 00 push $0x4f71
2d48: 6a 01 push $0x1
2d4a: e8 91 12 00 00 call 3fe0 <printf>
exit(0);
2d4f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d56: e8 17 11 00 00 call 3e72 <exit>
printf(1, "unlink dots/. worked!\n");
2d5b: 51 push %ecx
2d5c: 51 push %ecx
2d5d: 68 52 4f 00 00 push $0x4f52
2d62: 6a 01 push $0x1
2d64: e8 77 12 00 00 call 3fe0 <printf>
exit(0);
2d69: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d70: e8 fd 10 00 00 call 3e72 <exit>
printf(1, "chdir / failed\n");
2d75: 50 push %eax
2d76: 50 push %eax
2d77: 68 83 43 00 00 push $0x4383
2d7c: 6a 01 push $0x1
2d7e: e8 5d 12 00 00 call 3fe0 <printf>
exit(0);
2d83: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d8a: e8 e3 10 00 00 call 3e72 <exit>
printf(1, "rm .. worked!\n");
2d8f: 50 push %eax
2d90: 50 push %eax
2d91: 68 3c 4f 00 00 push $0x4f3c
2d96: 6a 01 push $0x1
2d98: e8 43 12 00 00 call 3fe0 <printf>
exit(0);
2d9d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2da4: e8 c9 10 00 00 call 3e72 <exit>
printf(1, "rm . worked!\n");
2da9: 50 push %eax
2daa: 50 push %eax
2dab: 68 2e 4f 00 00 push $0x4f2e
2db0: 6a 01 push $0x1
2db2: e8 29 12 00 00 call 3fe0 <printf>
exit(0);
2db7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2dbe: e8 af 10 00 00 call 3e72 <exit>
printf(1, "chdir dots failed\n");
2dc3: 50 push %eax
2dc4: 50 push %eax
2dc5: 68 1b 4f 00 00 push $0x4f1b
2dca: 6a 01 push $0x1
2dcc: e8 0f 12 00 00 call 3fe0 <printf>
exit(0);
2dd1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2dd8: e8 95 10 00 00 call 3e72 <exit>
2ddd: 8d 76 00 lea 0x0(%esi),%esi
00002de0 <dirfile>:
{
2de0: 55 push %ebp
2de1: 89 e5 mov %esp,%ebp
2de3: 53 push %ebx
2de4: 83 ec 0c sub $0xc,%esp
printf(1, "dir vs file\n");
2de7: 68 a8 4f 00 00 push $0x4fa8
2dec: 6a 01 push $0x1
2dee: e8 ed 11 00 00 call 3fe0 <printf>
fd = open("dirfile", O_CREATE);
2df3: 59 pop %ecx
2df4: 5b pop %ebx
2df5: 68 00 02 00 00 push $0x200
2dfa: 68 b5 4f 00 00 push $0x4fb5
2dff: e8 ae 10 00 00 call 3eb2 <open>
if(fd < 0){
2e04: 83 c4 10 add $0x10,%esp
2e07: 85 c0 test %eax,%eax
2e09: 0f 88 51 01 00 00 js 2f60 <dirfile+0x180>
close(fd);
2e0f: 83 ec 0c sub $0xc,%esp
2e12: 50 push %eax
2e13: e8 82 10 00 00 call 3e9a <close>
if(chdir("dirfile") == 0){
2e18: c7 04 24 b5 4f 00 00 movl $0x4fb5,(%esp)
2e1f: e8 be 10 00 00 call 3ee2 <chdir>
2e24: 83 c4 10 add $0x10,%esp
2e27: 85 c0 test %eax,%eax
2e29: 0f 84 17 01 00 00 je 2f46 <dirfile+0x166>
fd = open("dirfile/xx", 0);
2e2f: 83 ec 08 sub $0x8,%esp
2e32: 6a 00 push $0x0
2e34: 68 ee 4f 00 00 push $0x4fee
2e39: e8 74 10 00 00 call 3eb2 <open>
if(fd >= 0){
2e3e: 83 c4 10 add $0x10,%esp
2e41: 85 c0 test %eax,%eax
2e43: 0f 89 e3 00 00 00 jns 2f2c <dirfile+0x14c>
fd = open("dirfile/xx", O_CREATE);
2e49: 83 ec 08 sub $0x8,%esp
2e4c: 68 00 02 00 00 push $0x200
2e51: 68 ee 4f 00 00 push $0x4fee
2e56: e8 57 10 00 00 call 3eb2 <open>
if(fd >= 0){
2e5b: 83 c4 10 add $0x10,%esp
2e5e: 85 c0 test %eax,%eax
2e60: 0f 89 c6 00 00 00 jns 2f2c <dirfile+0x14c>
if(mkdir("dirfile/xx") == 0){
2e66: 83 ec 0c sub $0xc,%esp
2e69: 68 ee 4f 00 00 push $0x4fee
2e6e: e8 67 10 00 00 call 3eda <mkdir>
2e73: 83 c4 10 add $0x10,%esp
2e76: 85 c0 test %eax,%eax
2e78: 0f 84 7e 01 00 00 je 2ffc <dirfile+0x21c>
if(unlink("dirfile/xx") == 0){
2e7e: 83 ec 0c sub $0xc,%esp
2e81: 68 ee 4f 00 00 push $0x4fee
2e86: e8 37 10 00 00 call 3ec2 <unlink>
2e8b: 83 c4 10 add $0x10,%esp
2e8e: 85 c0 test %eax,%eax
2e90: 0f 84 4c 01 00 00 je 2fe2 <dirfile+0x202>
if(link("README", "dirfile/xx") == 0){
2e96: 83 ec 08 sub $0x8,%esp
2e99: 68 ee 4f 00 00 push $0x4fee
2e9e: 68 52 50 00 00 push $0x5052
2ea3: e8 2a 10 00 00 call 3ed2 <link>
2ea8: 83 c4 10 add $0x10,%esp
2eab: 85 c0 test %eax,%eax
2ead: 0f 84 15 01 00 00 je 2fc8 <dirfile+0x1e8>
if(unlink("dirfile") != 0){
2eb3: 83 ec 0c sub $0xc,%esp
2eb6: 68 b5 4f 00 00 push $0x4fb5
2ebb: e8 02 10 00 00 call 3ec2 <unlink>
2ec0: 83 c4 10 add $0x10,%esp
2ec3: 85 c0 test %eax,%eax
2ec5: 0f 85 e3 00 00 00 jne 2fae <dirfile+0x1ce>
fd = open(".", O_RDWR);
2ecb: 83 ec 08 sub $0x8,%esp
2ece: 6a 02 push $0x2
2ed0: 68 ae 4b 00 00 push $0x4bae
2ed5: e8 d8 0f 00 00 call 3eb2 <open>
if(fd >= 0){
2eda: 83 c4 10 add $0x10,%esp
2edd: 85 c0 test %eax,%eax
2edf: 0f 89 af 00 00 00 jns 2f94 <dirfile+0x1b4>
fd = open(".", 0);
2ee5: 83 ec 08 sub $0x8,%esp
2ee8: 6a 00 push $0x0
2eea: 68 ae 4b 00 00 push $0x4bae
2eef: e8 be 0f 00 00 call 3eb2 <open>
if(write(fd, "x", 1) > 0){
2ef4: 83 c4 0c add $0xc,%esp
fd = open(".", 0);
2ef7: 89 c3 mov %eax,%ebx
if(write(fd, "x", 1) > 0){
2ef9: 6a 01 push $0x1
2efb: 68 91 4c 00 00 push $0x4c91
2f00: 50 push %eax
2f01: e8 8c 0f 00 00 call 3e92 <write>
2f06: 83 c4 10 add $0x10,%esp
2f09: 85 c0 test %eax,%eax
2f0b: 7f 6d jg 2f7a <dirfile+0x19a>
close(fd);
2f0d: 83 ec 0c sub $0xc,%esp
2f10: 53 push %ebx
2f11: e8 84 0f 00 00 call 3e9a <close>
printf(1, "dir vs file OK\n");
2f16: 58 pop %eax
2f17: 5a pop %edx
2f18: 68 85 50 00 00 push $0x5085
2f1d: 6a 01 push $0x1
2f1f: e8 bc 10 00 00 call 3fe0 <printf>
}
2f24: 83 c4 10 add $0x10,%esp
2f27: 8b 5d fc mov -0x4(%ebp),%ebx
2f2a: c9 leave
2f2b: c3 ret
printf(1, "create dirfile/xx succeeded!\n");
2f2c: 50 push %eax
2f2d: 50 push %eax
2f2e: 68 f9 4f 00 00 push $0x4ff9
2f33: 6a 01 push $0x1
2f35: e8 a6 10 00 00 call 3fe0 <printf>
exit(0);
2f3a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f41: e8 2c 0f 00 00 call 3e72 <exit>
printf(1, "chdir dirfile succeeded!\n");
2f46: 50 push %eax
2f47: 50 push %eax
2f48: 68 d4 4f 00 00 push $0x4fd4
2f4d: 6a 01 push $0x1
2f4f: e8 8c 10 00 00 call 3fe0 <printf>
exit(0);
2f54: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f5b: e8 12 0f 00 00 call 3e72 <exit>
printf(1, "create dirfile failed\n");
2f60: 52 push %edx
2f61: 52 push %edx
2f62: 68 bd 4f 00 00 push $0x4fbd
2f67: 6a 01 push $0x1
2f69: e8 72 10 00 00 call 3fe0 <printf>
exit(0);
2f6e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f75: e8 f8 0e 00 00 call 3e72 <exit>
printf(1, "write . succeeded!\n");
2f7a: 51 push %ecx
2f7b: 51 push %ecx
2f7c: 68 71 50 00 00 push $0x5071
2f81: 6a 01 push $0x1
2f83: e8 58 10 00 00 call 3fe0 <printf>
exit(0);
2f88: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f8f: e8 de 0e 00 00 call 3e72 <exit>
printf(1, "open . for writing succeeded!\n");
2f94: 53 push %ebx
2f95: 53 push %ebx
2f96: 68 68 58 00 00 push $0x5868
2f9b: 6a 01 push $0x1
2f9d: e8 3e 10 00 00 call 3fe0 <printf>
exit(0);
2fa2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2fa9: e8 c4 0e 00 00 call 3e72 <exit>
printf(1, "unlink dirfile failed!\n");
2fae: 50 push %eax
2faf: 50 push %eax
2fb0: 68 59 50 00 00 push $0x5059
2fb5: 6a 01 push $0x1
2fb7: e8 24 10 00 00 call 3fe0 <printf>
exit(0);
2fbc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2fc3: e8 aa 0e 00 00 call 3e72 <exit>
printf(1, "link to dirfile/xx succeeded!\n");
2fc8: 50 push %eax
2fc9: 50 push %eax
2fca: 68 48 58 00 00 push $0x5848
2fcf: 6a 01 push $0x1
2fd1: e8 0a 10 00 00 call 3fe0 <printf>
exit(0);
2fd6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2fdd: e8 90 0e 00 00 call 3e72 <exit>
printf(1, "unlink dirfile/xx succeeded!\n");
2fe2: 50 push %eax
2fe3: 50 push %eax
2fe4: 68 34 50 00 00 push $0x5034
2fe9: 6a 01 push $0x1
2feb: e8 f0 0f 00 00 call 3fe0 <printf>
exit(0);
2ff0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2ff7: e8 76 0e 00 00 call 3e72 <exit>
printf(1, "mkdir dirfile/xx succeeded!\n");
2ffc: 50 push %eax
2ffd: 50 push %eax
2ffe: 68 17 50 00 00 push $0x5017
3003: 6a 01 push $0x1
3005: e8 d6 0f 00 00 call 3fe0 <printf>
exit(0);
300a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3011: e8 5c 0e 00 00 call 3e72 <exit>
3016: 8d 76 00 lea 0x0(%esi),%esi
3019: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003020 <iref>:
{
3020: 55 push %ebp
3021: 89 e5 mov %esp,%ebp
3023: 53 push %ebx
printf(1, "empty file name\n");
3024: bb 33 00 00 00 mov $0x33,%ebx
{
3029: 83 ec 0c sub $0xc,%esp
printf(1, "empty file name\n");
302c: 68 95 50 00 00 push $0x5095
3031: 6a 01 push $0x1
3033: e8 a8 0f 00 00 call 3fe0 <printf>
3038: 83 c4 10 add $0x10,%esp
303b: 90 nop
303c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(mkdir("irefd") != 0){
3040: 83 ec 0c sub $0xc,%esp
3043: 68 a6 50 00 00 push $0x50a6
3048: e8 8d 0e 00 00 call 3eda <mkdir>
304d: 83 c4 10 add $0x10,%esp
3050: 85 c0 test %eax,%eax
3052: 0f 85 bb 00 00 00 jne 3113 <iref+0xf3>
if(chdir("irefd") != 0){
3058: 83 ec 0c sub $0xc,%esp
305b: 68 a6 50 00 00 push $0x50a6
3060: e8 7d 0e 00 00 call 3ee2 <chdir>
3065: 83 c4 10 add $0x10,%esp
3068: 85 c0 test %eax,%eax
306a: 0f 85 be 00 00 00 jne 312e <iref+0x10e>
mkdir("");
3070: 83 ec 0c sub $0xc,%esp
3073: 68 5b 47 00 00 push $0x475b
3078: e8 5d 0e 00 00 call 3eda <mkdir>
link("README", "");
307d: 59 pop %ecx
307e: 58 pop %eax
307f: 68 5b 47 00 00 push $0x475b
3084: 68 52 50 00 00 push $0x5052
3089: e8 44 0e 00 00 call 3ed2 <link>
fd = open("", O_CREATE);
308e: 58 pop %eax
308f: 5a pop %edx
3090: 68 00 02 00 00 push $0x200
3095: 68 5b 47 00 00 push $0x475b
309a: e8 13 0e 00 00 call 3eb2 <open>
if(fd >= 0)
309f: 83 c4 10 add $0x10,%esp
30a2: 85 c0 test %eax,%eax
30a4: 78 0c js 30b2 <iref+0x92>
close(fd);
30a6: 83 ec 0c sub $0xc,%esp
30a9: 50 push %eax
30aa: e8 eb 0d 00 00 call 3e9a <close>
30af: 83 c4 10 add $0x10,%esp
fd = open("xx", O_CREATE);
30b2: 83 ec 08 sub $0x8,%esp
30b5: 68 00 02 00 00 push $0x200
30ba: 68 90 4c 00 00 push $0x4c90
30bf: e8 ee 0d 00 00 call 3eb2 <open>
if(fd >= 0)
30c4: 83 c4 10 add $0x10,%esp
30c7: 85 c0 test %eax,%eax
30c9: 78 0c js 30d7 <iref+0xb7>
close(fd);
30cb: 83 ec 0c sub $0xc,%esp
30ce: 50 push %eax
30cf: e8 c6 0d 00 00 call 3e9a <close>
30d4: 83 c4 10 add $0x10,%esp
unlink("xx");
30d7: 83 ec 0c sub $0xc,%esp
30da: 68 90 4c 00 00 push $0x4c90
30df: e8 de 0d 00 00 call 3ec2 <unlink>
for(i = 0; i < 50 + 1; i++){
30e4: 83 c4 10 add $0x10,%esp
30e7: 83 eb 01 sub $0x1,%ebx
30ea: 0f 85 50 ff ff ff jne 3040 <iref+0x20>
chdir("/");
30f0: 83 ec 0c sub $0xc,%esp
30f3: 68 81 43 00 00 push $0x4381
30f8: e8 e5 0d 00 00 call 3ee2 <chdir>
printf(1, "empty file name OK\n");
30fd: 58 pop %eax
30fe: 5a pop %edx
30ff: 68 d4 50 00 00 push $0x50d4
3104: 6a 01 push $0x1
3106: e8 d5 0e 00 00 call 3fe0 <printf>
}
310b: 83 c4 10 add $0x10,%esp
310e: 8b 5d fc mov -0x4(%ebp),%ebx
3111: c9 leave
3112: c3 ret
printf(1, "mkdir irefd failed\n");
3113: 83 ec 08 sub $0x8,%esp
3116: 68 ac 50 00 00 push $0x50ac
311b: 6a 01 push $0x1
311d: e8 be 0e 00 00 call 3fe0 <printf>
exit(0);
3122: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3129: e8 44 0d 00 00 call 3e72 <exit>
printf(1, "chdir irefd failed\n");
312e: 83 ec 08 sub $0x8,%esp
3131: 68 c0 50 00 00 push $0x50c0
3136: 6a 01 push $0x1
3138: e8 a3 0e 00 00 call 3fe0 <printf>
exit(0);
313d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3144: e8 29 0d 00 00 call 3e72 <exit>
3149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003150 <forktest>:
{
3150: 55 push %ebp
3151: 89 e5 mov %esp,%ebp
3153: 53 push %ebx
for(n=0; n<1000; n++){
3154: 31 db xor %ebx,%ebx
{
3156: 83 ec 0c sub $0xc,%esp
printf(1, "fork test\n");
3159: 68 e8 50 00 00 push $0x50e8
315e: 6a 01 push $0x1
3160: e8 7b 0e 00 00 call 3fe0 <printf>
3165: 83 c4 10 add $0x10,%esp
3168: eb 13 jmp 317d <forktest+0x2d>
316a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(pid == 0)
3170: 74 79 je 31eb <forktest+0x9b>
for(n=0; n<1000; n++){
3172: 83 c3 01 add $0x1,%ebx
3175: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
317b: 74 53 je 31d0 <forktest+0x80>
pid = fork();
317d: e8 e8 0c 00 00 call 3e6a <fork>
if(pid < 0)
3182: 85 c0 test %eax,%eax
3184: 79 ea jns 3170 <forktest+0x20>
for(; n > 0; n--){
3186: 85 db test %ebx,%ebx
3188: 74 1c je 31a6 <forktest+0x56>
318a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(wait(null) < 0){
3190: 83 ec 0c sub $0xc,%esp
3193: 6a 00 push $0x0
3195: e8 e0 0c 00 00 call 3e7a <wait>
319a: 83 c4 10 add $0x10,%esp
319d: 85 c0 test %eax,%eax
319f: 78 54 js 31f5 <forktest+0xa5>
for(; n > 0; n--){
31a1: 83 eb 01 sub $0x1,%ebx
31a4: 75 ea jne 3190 <forktest+0x40>
if(wait(null) != -1){
31a6: 83 ec 0c sub $0xc,%esp
31a9: 6a 00 push $0x0
31ab: e8 ca 0c 00 00 call 3e7a <wait>
31b0: 83 c4 10 add $0x10,%esp
31b3: 83 f8 ff cmp $0xffffffff,%eax
31b6: 75 58 jne 3210 <forktest+0xc0>
printf(1, "fork test OK\n");
31b8: 83 ec 08 sub $0x8,%esp
31bb: 68 1a 51 00 00 push $0x511a
31c0: 6a 01 push $0x1
31c2: e8 19 0e 00 00 call 3fe0 <printf>
}
31c7: 8b 5d fc mov -0x4(%ebp),%ebx
31ca: c9 leave
31cb: c3 ret
31cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "fork claimed to work 1000 times!\n");
31d0: 83 ec 08 sub $0x8,%esp
31d3: 68 88 58 00 00 push $0x5888
31d8: 6a 01 push $0x1
31da: e8 01 0e 00 00 call 3fe0 <printf>
exit(0);
31df: c7 04 24 00 00 00 00 movl $0x0,(%esp)
31e6: e8 87 0c 00 00 call 3e72 <exit>
exit(0);
31eb: 83 ec 0c sub $0xc,%esp
31ee: 6a 00 push $0x0
31f0: e8 7d 0c 00 00 call 3e72 <exit>
printf(1, "wait stopped early\n");
31f5: 83 ec 08 sub $0x8,%esp
31f8: 68 f3 50 00 00 push $0x50f3
31fd: 6a 01 push $0x1
31ff: e8 dc 0d 00 00 call 3fe0 <printf>
exit(0);
3204: c7 04 24 00 00 00 00 movl $0x0,(%esp)
320b: e8 62 0c 00 00 call 3e72 <exit>
printf(1, "wait got too many\n");
3210: 50 push %eax
3211: 50 push %eax
3212: 68 07 51 00 00 push $0x5107
3217: 6a 01 push $0x1
3219: e8 c2 0d 00 00 call 3fe0 <printf>
exit(0);
321e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3225: e8 48 0c 00 00 call 3e72 <exit>
322a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003230 <sbrktest>:
{
3230: 55 push %ebp
3231: 89 e5 mov %esp,%ebp
3233: 57 push %edi
3234: 56 push %esi
3235: 53 push %ebx
for(i = 0; i < 5000; i++){
3236: 31 ff xor %edi,%edi
{
3238: 83 ec 64 sub $0x64,%esp
printf(stdout, "sbrk test\n");
323b: 68 28 51 00 00 push $0x5128
3240: ff 35 e8 63 00 00 pushl 0x63e8
3246: e8 95 0d 00 00 call 3fe0 <printf>
oldbrk = sbrk(0);
324b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3252: e8 a3 0c 00 00 call 3efa <sbrk>
a = sbrk(0);
3257: c7 04 24 00 00 00 00 movl $0x0,(%esp)
oldbrk = sbrk(0);
325e: 89 c3 mov %eax,%ebx
a = sbrk(0);
3260: e8 95 0c 00 00 call 3efa <sbrk>
3265: 83 c4 10 add $0x10,%esp
3268: 89 c6 mov %eax,%esi
326a: eb 06 jmp 3272 <sbrktest+0x42>
326c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
a = b + 1;
3270: 89 c6 mov %eax,%esi
b = sbrk(1);
3272: 83 ec 0c sub $0xc,%esp
3275: 6a 01 push $0x1
3277: e8 7e 0c 00 00 call 3efa <sbrk>
if(b != a){
327c: 83 c4 10 add $0x10,%esp
327f: 39 f0 cmp %esi,%eax
3281: 0f 85 79 02 00 00 jne 3500 <sbrktest+0x2d0>
for(i = 0; i < 5000; i++){
3287: 83 c7 01 add $0x1,%edi
*b = 1;
328a: c6 06 01 movb $0x1,(%esi)
a = b + 1;
328d: 8d 46 01 lea 0x1(%esi),%eax
for(i = 0; i < 5000; i++){
3290: 81 ff 88 13 00 00 cmp $0x1388,%edi
3296: 75 d8 jne 3270 <sbrktest+0x40>
pid = fork();
3298: e8 cd 0b 00 00 call 3e6a <fork>
if(pid < 0){
329d: 85 c0 test %eax,%eax
pid = fork();
329f: 89 c7 mov %eax,%edi
if(pid < 0){
32a1: 0f 88 ed 03 00 00 js 3694 <sbrktest+0x464>
c = sbrk(1);
32a7: 83 ec 0c sub $0xc,%esp
if(c != a + 1){
32aa: 83 c6 02 add $0x2,%esi
c = sbrk(1);
32ad: 6a 01 push $0x1
32af: e8 46 0c 00 00 call 3efa <sbrk>
c = sbrk(1);
32b4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
32bb: e8 3a 0c 00 00 call 3efa <sbrk>
if(c != a + 1){
32c0: 83 c4 10 add $0x10,%esp
32c3: 39 f0 cmp %esi,%eax
32c5: 0f 85 ab 03 00 00 jne 3676 <sbrktest+0x446>
if(pid == 0)
32cb: 85 ff test %edi,%edi
32cd: 0f 84 99 03 00 00 je 366c <sbrktest+0x43c>
wait(null);
32d3: 83 ec 0c sub $0xc,%esp
32d6: 6a 00 push $0x0
32d8: e8 9d 0b 00 00 call 3e7a <wait>
a = sbrk(0);
32dd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
32e4: e8 11 0c 00 00 call 3efa <sbrk>
32e9: 89 c6 mov %eax,%esi
amt = (BIG) - (uint)a;
32eb: b8 00 00 40 06 mov $0x6400000,%eax
32f0: 29 f0 sub %esi,%eax
p = sbrk(amt);
32f2: 89 04 24 mov %eax,(%esp)
32f5: e8 00 0c 00 00 call 3efa <sbrk>
if (p != a) {
32fa: 83 c4 10 add $0x10,%esp
32fd: 39 c6 cmp %eax,%esi
32ff: 0f 85 49 03 00 00 jne 364e <sbrktest+0x41e>
a = sbrk(0);
3305: 83 ec 0c sub $0xc,%esp
*lastaddr = 99;
3308: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff
a = sbrk(0);
330f: 6a 00 push $0x0
3311: e8 e4 0b 00 00 call 3efa <sbrk>
c = sbrk(-4096);
3316: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
a = sbrk(0);
331d: 89 c6 mov %eax,%esi
c = sbrk(-4096);
331f: e8 d6 0b 00 00 call 3efa <sbrk>
if(c == (char*)0xffffffff){
3324: 83 c4 10 add $0x10,%esp
3327: 83 f8 ff cmp $0xffffffff,%eax
332a: 0f 84 00 03 00 00 je 3630 <sbrktest+0x400>
c = sbrk(0);
3330: 83 ec 0c sub $0xc,%esp
3333: 6a 00 push $0x0
3335: e8 c0 0b 00 00 call 3efa <sbrk>
if(c != a - 4096){
333a: 8d 96 00 f0 ff ff lea -0x1000(%esi),%edx
3340: 83 c4 10 add $0x10,%esp
3343: 39 d0 cmp %edx,%eax
3345: 0f 85 c7 02 00 00 jne 3612 <sbrktest+0x3e2>
a = sbrk(0);
334b: 83 ec 0c sub $0xc,%esp
334e: 6a 00 push $0x0
3350: e8 a5 0b 00 00 call 3efa <sbrk>
3355: 89 c6 mov %eax,%esi
c = sbrk(4096);
3357: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
335e: e8 97 0b 00 00 call 3efa <sbrk>
if(c != a || sbrk(0) != a + 4096){
3363: 83 c4 10 add $0x10,%esp
3366: 39 c6 cmp %eax,%esi
c = sbrk(4096);
3368: 89 c7 mov %eax,%edi
if(c != a || sbrk(0) != a + 4096){
336a: 0f 85 84 02 00 00 jne 35f4 <sbrktest+0x3c4>
3370: 83 ec 0c sub $0xc,%esp
3373: 6a 00 push $0x0
3375: e8 80 0b 00 00 call 3efa <sbrk>
337a: 8d 96 00 10 00 00 lea 0x1000(%esi),%edx
3380: 83 c4 10 add $0x10,%esp
3383: 39 d0 cmp %edx,%eax
3385: 0f 85 69 02 00 00 jne 35f4 <sbrktest+0x3c4>
if(*lastaddr == 99){
338b: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff
3392: 0f 84 3e 02 00 00 je 35d6 <sbrktest+0x3a6>
a = sbrk(0);
3398: 83 ec 0c sub $0xc,%esp
339b: 6a 00 push $0x0
339d: e8 58 0b 00 00 call 3efa <sbrk>
c = sbrk(-(sbrk(0) - oldbrk));
33a2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
a = sbrk(0);
33a9: 89 c6 mov %eax,%esi
c = sbrk(-(sbrk(0) - oldbrk));
33ab: e8 4a 0b 00 00 call 3efa <sbrk>
33b0: 89 d9 mov %ebx,%ecx
33b2: 29 c1 sub %eax,%ecx
33b4: 89 0c 24 mov %ecx,(%esp)
33b7: e8 3e 0b 00 00 call 3efa <sbrk>
if(c != a){
33bc: 83 c4 10 add $0x10,%esp
33bf: 39 c6 cmp %eax,%esi
33c1: 0f 85 f1 01 00 00 jne 35b8 <sbrktest+0x388>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
33c7: be 00 00 00 80 mov $0x80000000,%esi
ppid = getpid();
33cc: e8 21 0b 00 00 call 3ef2 <getpid>
33d1: 89 c7 mov %eax,%edi
pid = fork();
33d3: e8 92 0a 00 00 call 3e6a <fork>
if(pid < 0){
33d8: 85 c0 test %eax,%eax
33da: 0f 88 ba 01 00 00 js 359a <sbrktest+0x36a>
if(pid == 0){
33e0: 0f 84 8b 01 00 00 je 3571 <sbrktest+0x341>
wait(null);
33e6: 83 ec 0c sub $0xc,%esp
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
33e9: 81 c6 50 c3 00 00 add $0xc350,%esi
wait(null);
33ef: 6a 00 push $0x0
33f1: e8 84 0a 00 00 call 3e7a <wait>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
33f6: 83 c4 10 add $0x10,%esp
33f9: 81 fe 80 84 1e 80 cmp $0x801e8480,%esi
33ff: 75 cb jne 33cc <sbrktest+0x19c>
if(pipe(fds) != 0){
3401: 8d 45 b8 lea -0x48(%ebp),%eax
3404: 83 ec 0c sub $0xc,%esp
3407: 50 push %eax
3408: e8 75 0a 00 00 call 3e82 <pipe>
340d: 83 c4 10 add $0x10,%esp
3410: 85 c0 test %eax,%eax
3412: 0f 85 3f 01 00 00 jne 3557 <sbrktest+0x327>
3418: 8d 7d c0 lea -0x40(%ebp),%edi
341b: 89 fe mov %edi,%esi
341d: eb 23 jmp 3442 <sbrktest+0x212>
if(pids[i] != -1)
341f: 83 f8 ff cmp $0xffffffff,%eax
3422: 74 14 je 3438 <sbrktest+0x208>
read(fds[0], &scratch, 1);
3424: 8d 45 b7 lea -0x49(%ebp),%eax
3427: 83 ec 04 sub $0x4,%esp
342a: 6a 01 push $0x1
342c: 50 push %eax
342d: ff 75 b8 pushl -0x48(%ebp)
3430: e8 55 0a 00 00 call 3e8a <read>
3435: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
3438: 8d 45 e8 lea -0x18(%ebp),%eax
343b: 83 c6 04 add $0x4,%esi
343e: 39 c6 cmp %eax,%esi
3440: 74 50 je 3492 <sbrktest+0x262>
if((pids[i] = fork()) == 0){
3442: e8 23 0a 00 00 call 3e6a <fork>
3447: 85 c0 test %eax,%eax
3449: 89 06 mov %eax,(%esi)
344b: 75 d2 jne 341f <sbrktest+0x1ef>
sbrk(BIG - (uint)sbrk(0));
344d: 83 ec 0c sub $0xc,%esp
3450: 6a 00 push $0x0
3452: e8 a3 0a 00 00 call 3efa <sbrk>
3457: ba 00 00 40 06 mov $0x6400000,%edx
345c: 29 c2 sub %eax,%edx
345e: 89 14 24 mov %edx,(%esp)
3461: e8 94 0a 00 00 call 3efa <sbrk>
write(fds[1], "x", 1);
3466: 83 c4 0c add $0xc,%esp
3469: 6a 01 push $0x1
346b: 68 91 4c 00 00 push $0x4c91
3470: ff 75 bc pushl -0x44(%ebp)
3473: e8 1a 0a 00 00 call 3e92 <write>
3478: 83 c4 10 add $0x10,%esp
347b: 90 nop
347c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(;;) sleep(1000);
3480: 83 ec 0c sub $0xc,%esp
3483: 68 e8 03 00 00 push $0x3e8
3488: e8 75 0a 00 00 call 3f02 <sleep>
348d: 83 c4 10 add $0x10,%esp
3490: eb ee jmp 3480 <sbrktest+0x250>
c = sbrk(4096);
3492: 83 ec 0c sub $0xc,%esp
3495: 68 00 10 00 00 push $0x1000
349a: e8 5b 0a 00 00 call 3efa <sbrk>
349f: 83 c4 10 add $0x10,%esp
34a2: 89 45 a4 mov %eax,-0x5c(%ebp)
if(pids[i] == -1)
34a5: 8b 07 mov (%edi),%eax
34a7: 83 f8 ff cmp $0xffffffff,%eax
34aa: 74 18 je 34c4 <sbrktest+0x294>
kill(pids[i]);
34ac: 83 ec 0c sub $0xc,%esp
34af: 50 push %eax
34b0: e8 ed 09 00 00 call 3ea2 <kill>
wait(null);
34b5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
34bc: e8 b9 09 00 00 call 3e7a <wait>
34c1: 83 c4 10 add $0x10,%esp
34c4: 83 c7 04 add $0x4,%edi
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
34c7: 39 fe cmp %edi,%esi
34c9: 75 da jne 34a5 <sbrktest+0x275>
if(c == (char*)0xffffffff){
34cb: 83 7d a4 ff cmpl $0xffffffff,-0x5c(%ebp)
34cf: 74 68 je 3539 <sbrktest+0x309>
if(sbrk(0) > oldbrk)
34d1: 83 ec 0c sub $0xc,%esp
34d4: 6a 00 push $0x0
34d6: e8 1f 0a 00 00 call 3efa <sbrk>
34db: 83 c4 10 add $0x10,%esp
34de: 39 d8 cmp %ebx,%eax
34e0: 77 3e ja 3520 <sbrktest+0x2f0>
printf(stdout, "sbrk test OK\n");
34e2: 83 ec 08 sub $0x8,%esp
34e5: 68 d0 51 00 00 push $0x51d0
34ea: ff 35 e8 63 00 00 pushl 0x63e8
34f0: e8 eb 0a 00 00 call 3fe0 <printf>
}
34f5: 83 c4 10 add $0x10,%esp
34f8: 8d 65 f4 lea -0xc(%ebp),%esp
34fb: 5b pop %ebx
34fc: 5e pop %esi
34fd: 5f pop %edi
34fe: 5d pop %ebp
34ff: c3 ret
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
3500: 83 ec 0c sub $0xc,%esp
3503: 50 push %eax
3504: 56 push %esi
3505: 57 push %edi
3506: 68 33 51 00 00 push $0x5133
350b: ff 35 e8 63 00 00 pushl 0x63e8
3511: e8 ca 0a 00 00 call 3fe0 <printf>
exit(0);
3516: 83 c4 14 add $0x14,%esp
3519: 6a 00 push $0x0
351b: e8 52 09 00 00 call 3e72 <exit>
sbrk(-(sbrk(0) - oldbrk));
3520: 83 ec 0c sub $0xc,%esp
3523: 6a 00 push $0x0
3525: e8 d0 09 00 00 call 3efa <sbrk>
352a: 29 c3 sub %eax,%ebx
352c: 89 1c 24 mov %ebx,(%esp)
352f: e8 c6 09 00 00 call 3efa <sbrk>
3534: 83 c4 10 add $0x10,%esp
3537: eb a9 jmp 34e2 <sbrktest+0x2b2>
printf(stdout, "failed sbrk leaked memory\n");
3539: 50 push %eax
353a: 50 push %eax
353b: 68 b5 51 00 00 push $0x51b5
3540: ff 35 e8 63 00 00 pushl 0x63e8
3546: e8 95 0a 00 00 call 3fe0 <printf>
exit(0);
354b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3552: e8 1b 09 00 00 call 3e72 <exit>
printf(1, "pipe() failed\n");
3557: 52 push %edx
3558: 52 push %edx
3559: 68 71 46 00 00 push $0x4671
355e: 6a 01 push $0x1
3560: e8 7b 0a 00 00 call 3fe0 <printf>
exit(0);
3565: c7 04 24 00 00 00 00 movl $0x0,(%esp)
356c: e8 01 09 00 00 call 3e72 <exit>
printf(stdout, "oops could read %x = %x\n", a, *a);
3571: 0f be 06 movsbl (%esi),%eax
3574: 50 push %eax
3575: 56 push %esi
3576: 68 9c 51 00 00 push $0x519c
357b: ff 35 e8 63 00 00 pushl 0x63e8
3581: e8 5a 0a 00 00 call 3fe0 <printf>
kill(ppid);
3586: 89 3c 24 mov %edi,(%esp)
3589: e8 14 09 00 00 call 3ea2 <kill>
exit(0);
358e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3595: e8 d8 08 00 00 call 3e72 <exit>
printf(stdout, "fork failed\n");
359a: 51 push %ecx
359b: 51 push %ecx
359c: 68 79 52 00 00 push $0x5279
35a1: ff 35 e8 63 00 00 pushl 0x63e8
35a7: e8 34 0a 00 00 call 3fe0 <printf>
exit(0);
35ac: c7 04 24 00 00 00 00 movl $0x0,(%esp)
35b3: e8 ba 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
35b8: 50 push %eax
35b9: 56 push %esi
35ba: 68 7c 59 00 00 push $0x597c
35bf: ff 35 e8 63 00 00 pushl 0x63e8
35c5: e8 16 0a 00 00 call 3fe0 <printf>
exit(0);
35ca: c7 04 24 00 00 00 00 movl $0x0,(%esp)
35d1: e8 9c 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
35d6: 53 push %ebx
35d7: 53 push %ebx
35d8: 68 4c 59 00 00 push $0x594c
35dd: ff 35 e8 63 00 00 pushl 0x63e8
35e3: e8 f8 09 00 00 call 3fe0 <printf>
exit(0);
35e8: c7 04 24 00 00 00 00 movl $0x0,(%esp)
35ef: e8 7e 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
35f4: 57 push %edi
35f5: 56 push %esi
35f6: 68 24 59 00 00 push $0x5924
35fb: ff 35 e8 63 00 00 pushl 0x63e8
3601: e8 da 09 00 00 call 3fe0 <printf>
exit(0);
3606: c7 04 24 00 00 00 00 movl $0x0,(%esp)
360d: e8 60 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
3612: 50 push %eax
3613: 56 push %esi
3614: 68 ec 58 00 00 push $0x58ec
3619: ff 35 e8 63 00 00 pushl 0x63e8
361f: e8 bc 09 00 00 call 3fe0 <printf>
exit(0);
3624: c7 04 24 00 00 00 00 movl $0x0,(%esp)
362b: e8 42 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk could not deallocate\n");
3630: 56 push %esi
3631: 56 push %esi
3632: 68 81 51 00 00 push $0x5181
3637: ff 35 e8 63 00 00 pushl 0x63e8
363d: e8 9e 09 00 00 call 3fe0 <printf>
exit(0);
3642: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3649: e8 24 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
364e: 57 push %edi
364f: 57 push %edi
3650: 68 ac 58 00 00 push $0x58ac
3655: ff 35 e8 63 00 00 pushl 0x63e8
365b: e8 80 09 00 00 call 3fe0 <printf>
exit(0);
3660: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3667: e8 06 08 00 00 call 3e72 <exit>
exit(0);
366c: 83 ec 0c sub $0xc,%esp
366f: 6a 00 push $0x0
3671: e8 fc 07 00 00 call 3e72 <exit>
printf(stdout, "sbrk test failed post-fork\n");
3676: 50 push %eax
3677: 50 push %eax
3678: 68 65 51 00 00 push $0x5165
367d: ff 35 e8 63 00 00 pushl 0x63e8
3683: e8 58 09 00 00 call 3fe0 <printf>
exit(0);
3688: c7 04 24 00 00 00 00 movl $0x0,(%esp)
368f: e8 de 07 00 00 call 3e72 <exit>
printf(stdout, "sbrk test fork failed\n");
3694: 50 push %eax
3695: 50 push %eax
3696: 68 4e 51 00 00 push $0x514e
369b: ff 35 e8 63 00 00 pushl 0x63e8
36a1: e8 3a 09 00 00 call 3fe0 <printf>
exit(0);
36a6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
36ad: e8 c0 07 00 00 call 3e72 <exit>
36b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000036c0 <validateint>:
{
36c0: 55 push %ebp
36c1: 89 e5 mov %esp,%ebp
}
36c3: 5d pop %ebp
36c4: c3 ret
36c5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
36c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000036d0 <validatetest>:
{
36d0: 55 push %ebp
36d1: 89 e5 mov %esp,%ebp
36d3: 56 push %esi
36d4: 53 push %ebx
for(p = 0; p <= (uint)hi; p += 4096){
36d5: 31 db xor %ebx,%ebx
printf(stdout, "validate test\n");
36d7: 83 ec 08 sub $0x8,%esp
36da: 68 de 51 00 00 push $0x51de
36df: ff 35 e8 63 00 00 pushl 0x63e8
36e5: e8 f6 08 00 00 call 3fe0 <printf>
36ea: 83 c4 10 add $0x10,%esp
36ed: 8d 76 00 lea 0x0(%esi),%esi
if((pid = fork()) == 0){
36f0: e8 75 07 00 00 call 3e6a <fork>
36f5: 85 c0 test %eax,%eax
36f7: 89 c6 mov %eax,%esi
36f9: 74 6a je 3765 <validatetest+0x95>
sleep(0);
36fb: 83 ec 0c sub $0xc,%esp
36fe: 6a 00 push $0x0
3700: e8 fd 07 00 00 call 3f02 <sleep>
sleep(0);
3705: c7 04 24 00 00 00 00 movl $0x0,(%esp)
370c: e8 f1 07 00 00 call 3f02 <sleep>
kill(pid);
3711: 89 34 24 mov %esi,(%esp)
3714: e8 89 07 00 00 call 3ea2 <kill>
wait(null);
3719: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3720: e8 55 07 00 00 call 3e7a <wait>
if(link("nosuchfile", (char*)p) != -1){
3725: 58 pop %eax
3726: 5a pop %edx
3727: 53 push %ebx
3728: 68 ed 51 00 00 push $0x51ed
372d: e8 a0 07 00 00 call 3ed2 <link>
3732: 83 c4 10 add $0x10,%esp
3735: 83 f8 ff cmp $0xffffffff,%eax
3738: 75 35 jne 376f <validatetest+0x9f>
for(p = 0; p <= (uint)hi; p += 4096){
373a: 81 c3 00 10 00 00 add $0x1000,%ebx
3740: 81 fb 00 40 11 00 cmp $0x114000,%ebx
3746: 75 a8 jne 36f0 <validatetest+0x20>
printf(stdout, "validate ok\n");
3748: 83 ec 08 sub $0x8,%esp
374b: 68 11 52 00 00 push $0x5211
3750: ff 35 e8 63 00 00 pushl 0x63e8
3756: e8 85 08 00 00 call 3fe0 <printf>
}
375b: 83 c4 10 add $0x10,%esp
375e: 8d 65 f8 lea -0x8(%ebp),%esp
3761: 5b pop %ebx
3762: 5e pop %esi
3763: 5d pop %ebp
3764: c3 ret
exit(0);
3765: 83 ec 0c sub $0xc,%esp
3768: 6a 00 push $0x0
376a: e8 03 07 00 00 call 3e72 <exit>
printf(stdout, "link should not succeed\n");
376f: 83 ec 08 sub $0x8,%esp
3772: 68 f8 51 00 00 push $0x51f8
3777: ff 35 e8 63 00 00 pushl 0x63e8
377d: e8 5e 08 00 00 call 3fe0 <printf>
exit(0);
3782: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3789: e8 e4 06 00 00 call 3e72 <exit>
378e: 66 90 xchg %ax,%ax
00003790 <bsstest>:
{
3790: 55 push %ebp
3791: 89 e5 mov %esp,%ebp
3793: 83 ec 10 sub $0x10,%esp
printf(stdout, "bss test\n");
3796: 68 1e 52 00 00 push $0x521e
379b: ff 35 e8 63 00 00 pushl 0x63e8
37a1: e8 3a 08 00 00 call 3fe0 <printf>
if(uninit[i] != '\0'){
37a6: 83 c4 10 add $0x10,%esp
37a9: 80 3d a0 64 00 00 00 cmpb $0x0,0x64a0
37b0: 75 39 jne 37eb <bsstest+0x5b>
for(i = 0; i < sizeof(uninit); i++){
37b2: b8 01 00 00 00 mov $0x1,%eax
37b7: 89 f6 mov %esi,%esi
37b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(uninit[i] != '\0'){
37c0: 80 b8 a0 64 00 00 00 cmpb $0x0,0x64a0(%eax)
37c7: 75 22 jne 37eb <bsstest+0x5b>
for(i = 0; i < sizeof(uninit); i++){
37c9: 83 c0 01 add $0x1,%eax
37cc: 3d 10 27 00 00 cmp $0x2710,%eax
37d1: 75 ed jne 37c0 <bsstest+0x30>
printf(stdout, "bss test ok\n");
37d3: 83 ec 08 sub $0x8,%esp
37d6: 68 39 52 00 00 push $0x5239
37db: ff 35 e8 63 00 00 pushl 0x63e8
37e1: e8 fa 07 00 00 call 3fe0 <printf>
}
37e6: 83 c4 10 add $0x10,%esp
37e9: c9 leave
37ea: c3 ret
printf(stdout, "bss test failed\n");
37eb: 83 ec 08 sub $0x8,%esp
37ee: 68 28 52 00 00 push $0x5228
37f3: ff 35 e8 63 00 00 pushl 0x63e8
37f9: e8 e2 07 00 00 call 3fe0 <printf>
exit(0);
37fe: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3805: e8 68 06 00 00 call 3e72 <exit>
380a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003810 <bigargtest>:
{
3810: 55 push %ebp
3811: 89 e5 mov %esp,%ebp
3813: 83 ec 14 sub $0x14,%esp
unlink("bigarg-ok");
3816: 68 46 52 00 00 push $0x5246
381b: e8 a2 06 00 00 call 3ec2 <unlink>
pid = fork();
3820: e8 45 06 00 00 call 3e6a <fork>
if(pid == 0){
3825: 83 c4 10 add $0x10,%esp
3828: 85 c0 test %eax,%eax
382a: 74 43 je 386f <bigargtest+0x5f>
} else if(pid < 0){
382c: 0f 88 d8 00 00 00 js 390a <bigargtest+0xfa>
wait(null);
3832: 83 ec 0c sub $0xc,%esp
3835: 6a 00 push $0x0
3837: e8 3e 06 00 00 call 3e7a <wait>
fd = open("bigarg-ok", 0);
383c: 5a pop %edx
383d: 59 pop %ecx
383e: 6a 00 push $0x0
3840: 68 46 52 00 00 push $0x5246
3845: e8 68 06 00 00 call 3eb2 <open>
if(fd < 0){
384a: 83 c4 10 add $0x10,%esp
384d: 85 c0 test %eax,%eax
384f: 0f 88 97 00 00 00 js 38ec <bigargtest+0xdc>
close(fd);
3855: 83 ec 0c sub $0xc,%esp
3858: 50 push %eax
3859: e8 3c 06 00 00 call 3e9a <close>
unlink("bigarg-ok");
385e: c7 04 24 46 52 00 00 movl $0x5246,(%esp)
3865: e8 58 06 00 00 call 3ec2 <unlink>
}
386a: 83 c4 10 add $0x10,%esp
386d: c9 leave
386e: c3 ret
386f: b8 00 64 00 00 mov $0x6400,%eax
3874: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
args[i] = "bigargs test: failed\n ";
3878: c7 00 a0 59 00 00 movl $0x59a0,(%eax)
387e: 83 c0 04 add $0x4,%eax
for(i = 0; i < MAXARG-1; i++)
3881: 3d 7c 64 00 00 cmp $0x647c,%eax
3886: 75 f0 jne 3878 <bigargtest+0x68>
printf(stdout, "bigarg test\n");
3888: 50 push %eax
3889: 50 push %eax
388a: 68 50 52 00 00 push $0x5250
388f: ff 35 e8 63 00 00 pushl 0x63e8
args[MAXARG-1] = 0;
3895: c7 05 7c 64 00 00 00 movl $0x0,0x647c
389c: 00 00 00
printf(stdout, "bigarg test\n");
389f: e8 3c 07 00 00 call 3fe0 <printf>
exec("echo", args);
38a4: 58 pop %eax
38a5: 5a pop %edx
38a6: 68 00 64 00 00 push $0x6400
38ab: 68 1d 44 00 00 push $0x441d
38b0: e8 f5 05 00 00 call 3eaa <exec>
printf(stdout, "bigarg test ok\n");
38b5: 59 pop %ecx
38b6: 58 pop %eax
38b7: 68 5d 52 00 00 push $0x525d
38bc: ff 35 e8 63 00 00 pushl 0x63e8
38c2: e8 19 07 00 00 call 3fe0 <printf>
fd = open("bigarg-ok", O_CREATE);
38c7: 58 pop %eax
38c8: 5a pop %edx
38c9: 68 00 02 00 00 push $0x200
38ce: 68 46 52 00 00 push $0x5246
38d3: e8 da 05 00 00 call 3eb2 <open>
close(fd);
38d8: 89 04 24 mov %eax,(%esp)
38db: e8 ba 05 00 00 call 3e9a <close>
exit(0);
38e0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
38e7: e8 86 05 00 00 call 3e72 <exit>
printf(stdout, "bigarg test failed!\n");
38ec: 50 push %eax
38ed: 50 push %eax
38ee: 68 86 52 00 00 push $0x5286
38f3: ff 35 e8 63 00 00 pushl 0x63e8
38f9: e8 e2 06 00 00 call 3fe0 <printf>
exit(0);
38fe: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3905: e8 68 05 00 00 call 3e72 <exit>
printf(stdout, "bigargtest: fork failed\n");
390a: 50 push %eax
390b: 50 push %eax
390c: 68 6d 52 00 00 push $0x526d
3911: ff 35 e8 63 00 00 pushl 0x63e8
3917: e8 c4 06 00 00 call 3fe0 <printf>
exit(0);
391c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3923: e8 4a 05 00 00 call 3e72 <exit>
3928: 90 nop
3929: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003930 <fsfull>:
{
3930: 55 push %ebp
3931: 89 e5 mov %esp,%ebp
3933: 57 push %edi
3934: 56 push %esi
3935: 53 push %ebx
for(nfiles = 0; ; nfiles++){
3936: 31 db xor %ebx,%ebx
{
3938: 83 ec 54 sub $0x54,%esp
printf(1, "fsfull test\n");
393b: 68 9b 52 00 00 push $0x529b
3940: 6a 01 push $0x1
3942: e8 99 06 00 00 call 3fe0 <printf>
3947: 83 c4 10 add $0x10,%esp
394a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
name[1] = '0' + nfiles / 1000;
3950: b8 d3 4d 62 10 mov $0x10624dd3,%eax
name[3] = '0' + (nfiles % 100) / 10;
3955: b9 cd cc cc cc mov $0xcccccccd,%ecx
printf(1, "writing %s\n", name);
395a: 83 ec 04 sub $0x4,%esp
name[1] = '0' + nfiles / 1000;
395d: f7 e3 mul %ebx
name[0] = 'f';
395f: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[5] = '\0';
3963: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
3967: c1 ea 06 shr $0x6,%edx
396a: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
396d: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx
name[1] = '0' + nfiles / 1000;
3973: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
3976: 89 d8 mov %ebx,%eax
3978: 29 d0 sub %edx,%eax
397a: 89 c2 mov %eax,%edx
397c: b8 1f 85 eb 51 mov $0x51eb851f,%eax
3981: f7 e2 mul %edx
name[3] = '0' + (nfiles % 100) / 10;
3983: b8 1f 85 eb 51 mov $0x51eb851f,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3988: c1 ea 05 shr $0x5,%edx
398b: 83 c2 30 add $0x30,%edx
398e: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
3991: f7 e3 mul %ebx
3993: 89 d8 mov %ebx,%eax
3995: c1 ea 05 shr $0x5,%edx
3998: 6b d2 64 imul $0x64,%edx,%edx
399b: 29 d0 sub %edx,%eax
399d: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
399f: 89 d8 mov %ebx,%eax
name[3] = '0' + (nfiles % 100) / 10;
39a1: c1 ea 03 shr $0x3,%edx
39a4: 83 c2 30 add $0x30,%edx
39a7: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
39aa: f7 e1 mul %ecx
39ac: 89 d9 mov %ebx,%ecx
39ae: c1 ea 03 shr $0x3,%edx
39b1: 8d 04 92 lea (%edx,%edx,4),%eax
39b4: 01 c0 add %eax,%eax
39b6: 29 c1 sub %eax,%ecx
39b8: 89 c8 mov %ecx,%eax
39ba: 83 c0 30 add $0x30,%eax
39bd: 88 45 ac mov %al,-0x54(%ebp)
printf(1, "writing %s\n", name);
39c0: 8d 45 a8 lea -0x58(%ebp),%eax
39c3: 50 push %eax
39c4: 68 a8 52 00 00 push $0x52a8
39c9: 6a 01 push $0x1
39cb: e8 10 06 00 00 call 3fe0 <printf>
int fd = open(name, O_CREATE|O_RDWR);
39d0: 58 pop %eax
39d1: 8d 45 a8 lea -0x58(%ebp),%eax
39d4: 5a pop %edx
39d5: 68 02 02 00 00 push $0x202
39da: 50 push %eax
39db: e8 d2 04 00 00 call 3eb2 <open>
if(fd < 0){
39e0: 83 c4 10 add $0x10,%esp
39e3: 85 c0 test %eax,%eax
int fd = open(name, O_CREATE|O_RDWR);
39e5: 89 c7 mov %eax,%edi
if(fd < 0){
39e7: 78 57 js 3a40 <fsfull+0x110>
int total = 0;
39e9: 31 f6 xor %esi,%esi
39eb: eb 05 jmp 39f2 <fsfull+0xc2>
39ed: 8d 76 00 lea 0x0(%esi),%esi
total += cc;
39f0: 01 c6 add %eax,%esi
int cc = write(fd, buf, 512);
39f2: 83 ec 04 sub $0x4,%esp
39f5: 68 00 02 00 00 push $0x200
39fa: 68 c0 8b 00 00 push $0x8bc0
39ff: 57 push %edi
3a00: e8 8d 04 00 00 call 3e92 <write>
if(cc < 512)
3a05: 83 c4 10 add $0x10,%esp
3a08: 3d ff 01 00 00 cmp $0x1ff,%eax
3a0d: 7f e1 jg 39f0 <fsfull+0xc0>
printf(1, "wrote %d bytes\n", total);
3a0f: 83 ec 04 sub $0x4,%esp
3a12: 56 push %esi
3a13: 68 c4 52 00 00 push $0x52c4
3a18: 6a 01 push $0x1
3a1a: e8 c1 05 00 00 call 3fe0 <printf>
close(fd);
3a1f: 89 3c 24 mov %edi,(%esp)
3a22: e8 73 04 00 00 call 3e9a <close>
if(total == 0)
3a27: 83 c4 10 add $0x10,%esp
3a2a: 85 f6 test %esi,%esi
3a2c: 74 28 je 3a56 <fsfull+0x126>
for(nfiles = 0; ; nfiles++){
3a2e: 83 c3 01 add $0x1,%ebx
3a31: e9 1a ff ff ff jmp 3950 <fsfull+0x20>
3a36: 8d 76 00 lea 0x0(%esi),%esi
3a39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(1, "open %s failed\n", name);
3a40: 8d 45 a8 lea -0x58(%ebp),%eax
3a43: 83 ec 04 sub $0x4,%esp
3a46: 50 push %eax
3a47: 68 b4 52 00 00 push $0x52b4
3a4c: 6a 01 push $0x1
3a4e: e8 8d 05 00 00 call 3fe0 <printf>
break;
3a53: 83 c4 10 add $0x10,%esp
name[1] = '0' + nfiles / 1000;
3a56: bf d3 4d 62 10 mov $0x10624dd3,%edi
name[2] = '0' + (nfiles % 1000) / 100;
3a5b: be 1f 85 eb 51 mov $0x51eb851f,%esi
name[1] = '0' + nfiles / 1000;
3a60: 89 d8 mov %ebx,%eax
name[3] = '0' + (nfiles % 100) / 10;
3a62: b9 cd cc cc cc mov $0xcccccccd,%ecx
unlink(name);
3a67: 83 ec 0c sub $0xc,%esp
name[1] = '0' + nfiles / 1000;
3a6a: f7 e7 mul %edi
name[0] = 'f';
3a6c: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[5] = '\0';
3a70: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
3a74: c1 ea 06 shr $0x6,%edx
3a77: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
3a7a: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx
name[1] = '0' + nfiles / 1000;
3a80: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
3a83: 89 d8 mov %ebx,%eax
3a85: 29 d0 sub %edx,%eax
3a87: f7 e6 mul %esi
name[3] = '0' + (nfiles % 100) / 10;
3a89: 89 d8 mov %ebx,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3a8b: c1 ea 05 shr $0x5,%edx
3a8e: 83 c2 30 add $0x30,%edx
3a91: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
3a94: f7 e6 mul %esi
3a96: 89 d8 mov %ebx,%eax
3a98: c1 ea 05 shr $0x5,%edx
3a9b: 6b d2 64 imul $0x64,%edx,%edx
3a9e: 29 d0 sub %edx,%eax
3aa0: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
3aa2: 89 d8 mov %ebx,%eax
name[3] = '0' + (nfiles % 100) / 10;
3aa4: c1 ea 03 shr $0x3,%edx
3aa7: 83 c2 30 add $0x30,%edx
3aaa: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
3aad: f7 e1 mul %ecx
3aaf: 89 d9 mov %ebx,%ecx
nfiles--;
3ab1: 83 eb 01 sub $0x1,%ebx
name[4] = '0' + (nfiles % 10);
3ab4: c1 ea 03 shr $0x3,%edx
3ab7: 8d 04 92 lea (%edx,%edx,4),%eax
3aba: 01 c0 add %eax,%eax
3abc: 29 c1 sub %eax,%ecx
3abe: 89 c8 mov %ecx,%eax
3ac0: 83 c0 30 add $0x30,%eax
3ac3: 88 45 ac mov %al,-0x54(%ebp)
unlink(name);
3ac6: 8d 45 a8 lea -0x58(%ebp),%eax
3ac9: 50 push %eax
3aca: e8 f3 03 00 00 call 3ec2 <unlink>
while(nfiles >= 0){
3acf: 83 c4 10 add $0x10,%esp
3ad2: 83 fb ff cmp $0xffffffff,%ebx
3ad5: 75 89 jne 3a60 <fsfull+0x130>
printf(1, "fsfull test finished\n");
3ad7: 83 ec 08 sub $0x8,%esp
3ada: 68 d4 52 00 00 push $0x52d4
3adf: 6a 01 push $0x1
3ae1: e8 fa 04 00 00 call 3fe0 <printf>
}
3ae6: 83 c4 10 add $0x10,%esp
3ae9: 8d 65 f4 lea -0xc(%ebp),%esp
3aec: 5b pop %ebx
3aed: 5e pop %esi
3aee: 5f pop %edi
3aef: 5d pop %ebp
3af0: c3 ret
3af1: eb 0d jmp 3b00 <uio>
3af3: 90 nop
3af4: 90 nop
3af5: 90 nop
3af6: 90 nop
3af7: 90 nop
3af8: 90 nop
3af9: 90 nop
3afa: 90 nop
3afb: 90 nop
3afc: 90 nop
3afd: 90 nop
3afe: 90 nop
3aff: 90 nop
00003b00 <uio>:
{
3b00: 55 push %ebp
3b01: 89 e5 mov %esp,%ebp
3b03: 83 ec 10 sub $0x10,%esp
printf(1, "uio test\n");
3b06: 68 ea 52 00 00 push $0x52ea
3b0b: 6a 01 push $0x1
3b0d: e8 ce 04 00 00 call 3fe0 <printf>
pid = fork();
3b12: e8 53 03 00 00 call 3e6a <fork>
if(pid == 0){
3b17: 83 c4 10 add $0x10,%esp
3b1a: 85 c0 test %eax,%eax
3b1c: 74 1f je 3b3d <uio+0x3d>
} else if(pid < 0){
3b1e: 78 48 js 3b68 <uio+0x68>
wait(null);
3b20: 83 ec 0c sub $0xc,%esp
3b23: 6a 00 push $0x0
3b25: e8 50 03 00 00 call 3e7a <wait>
printf(1, "uio test done\n");
3b2a: 58 pop %eax
3b2b: 5a pop %edx
3b2c: 68 f4 52 00 00 push $0x52f4
3b31: 6a 01 push $0x1
3b33: e8 a8 04 00 00 call 3fe0 <printf>
}
3b38: 83 c4 10 add $0x10,%esp
3b3b: c9 leave
3b3c: c3 ret
asm volatile("outb %0,%1"::"a"(val), "d" (port));
3b3d: b8 09 00 00 00 mov $0x9,%eax
3b42: ba 70 00 00 00 mov $0x70,%edx
3b47: ee out %al,(%dx)
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
3b48: ba 71 00 00 00 mov $0x71,%edx
3b4d: ec in (%dx),%al
printf(1, "uio: uio succeeded; test FAILED\n");
3b4e: 50 push %eax
3b4f: 50 push %eax
3b50: 68 80 5a 00 00 push $0x5a80
3b55: 6a 01 push $0x1
3b57: e8 84 04 00 00 call 3fe0 <printf>
exit(0);
3b5c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3b63: e8 0a 03 00 00 call 3e72 <exit>
printf (1, "fork failed\n");
3b68: 51 push %ecx
3b69: 51 push %ecx
3b6a: 68 79 52 00 00 push $0x5279
3b6f: 6a 01 push $0x1
3b71: e8 6a 04 00 00 call 3fe0 <printf>
exit(0);
3b76: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3b7d: e8 f0 02 00 00 call 3e72 <exit>
3b82: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3b89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003b90 <argptest>:
{
3b90: 55 push %ebp
3b91: 89 e5 mov %esp,%ebp
3b93: 53 push %ebx
3b94: 83 ec 0c sub $0xc,%esp
fd = open("init", O_RDONLY);
3b97: 6a 00 push $0x0
3b99: 68 03 53 00 00 push $0x5303
3b9e: e8 0f 03 00 00 call 3eb2 <open>
if (fd < 0) {
3ba3: 83 c4 10 add $0x10,%esp
3ba6: 85 c0 test %eax,%eax
3ba8: 78 39 js 3be3 <argptest+0x53>
read(fd, sbrk(0) - 1, -1);
3baa: 83 ec 0c sub $0xc,%esp
3bad: 89 c3 mov %eax,%ebx
3baf: 6a 00 push $0x0
3bb1: e8 44 03 00 00 call 3efa <sbrk>
3bb6: 83 c4 0c add $0xc,%esp
3bb9: 83 e8 01 sub $0x1,%eax
3bbc: 6a ff push $0xffffffff
3bbe: 50 push %eax
3bbf: 53 push %ebx
3bc0: e8 c5 02 00 00 call 3e8a <read>
close(fd);
3bc5: 89 1c 24 mov %ebx,(%esp)
3bc8: e8 cd 02 00 00 call 3e9a <close>
printf(1, "arg test passed\n");
3bcd: 58 pop %eax
3bce: 5a pop %edx
3bcf: 68 15 53 00 00 push $0x5315
3bd4: 6a 01 push $0x1
3bd6: e8 05 04 00 00 call 3fe0 <printf>
}
3bdb: 83 c4 10 add $0x10,%esp
3bde: 8b 5d fc mov -0x4(%ebp),%ebx
3be1: c9 leave
3be2: c3 ret
printf(2, "open failed\n");
3be3: 51 push %ecx
3be4: 51 push %ecx
3be5: 68 08 53 00 00 push $0x5308
3bea: 6a 02 push $0x2
3bec: e8 ef 03 00 00 call 3fe0 <printf>
exit(0);
3bf1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3bf8: e8 75 02 00 00 call 3e72 <exit>
3bfd: 8d 76 00 lea 0x0(%esi),%esi
00003c00 <rand>:
randstate = randstate * 1664525 + 1013904223;
3c00: 69 05 e4 63 00 00 0d imul $0x19660d,0x63e4,%eax
3c07: 66 19 00
{
3c0a: 55 push %ebp
3c0b: 89 e5 mov %esp,%ebp
}
3c0d: 5d pop %ebp
randstate = randstate * 1664525 + 1013904223;
3c0e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax
3c13: a3 e4 63 00 00 mov %eax,0x63e4
}
3c18: c3 ret
3c19: 66 90 xchg %ax,%ax
3c1b: 66 90 xchg %ax,%ax
3c1d: 66 90 xchg %ax,%ax
3c1f: 90 nop
00003c20 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
3c20: 55 push %ebp
3c21: 89 e5 mov %esp,%ebp
3c23: 53 push %ebx
3c24: 8b 45 08 mov 0x8(%ebp),%eax
3c27: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
3c2a: 89 c2 mov %eax,%edx
3c2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3c30: 83 c1 01 add $0x1,%ecx
3c33: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
3c37: 83 c2 01 add $0x1,%edx
3c3a: 84 db test %bl,%bl
3c3c: 88 5a ff mov %bl,-0x1(%edx)
3c3f: 75 ef jne 3c30 <strcpy+0x10>
;
return os;
}
3c41: 5b pop %ebx
3c42: 5d pop %ebp
3c43: c3 ret
3c44: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3c4a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00003c50 <strcmp>:
int
strcmp(const char *p, const char *q)
{
3c50: 55 push %ebp
3c51: 89 e5 mov %esp,%ebp
3c53: 53 push %ebx
3c54: 8b 55 08 mov 0x8(%ebp),%edx
3c57: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
3c5a: 0f b6 02 movzbl (%edx),%eax
3c5d: 0f b6 19 movzbl (%ecx),%ebx
3c60: 84 c0 test %al,%al
3c62: 75 1c jne 3c80 <strcmp+0x30>
3c64: eb 2a jmp 3c90 <strcmp+0x40>
3c66: 8d 76 00 lea 0x0(%esi),%esi
3c69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
3c70: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
3c73: 0f b6 02 movzbl (%edx),%eax
p++, q++;
3c76: 83 c1 01 add $0x1,%ecx
3c79: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
3c7c: 84 c0 test %al,%al
3c7e: 74 10 je 3c90 <strcmp+0x40>
3c80: 38 d8 cmp %bl,%al
3c82: 74 ec je 3c70 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
3c84: 29 d8 sub %ebx,%eax
}
3c86: 5b pop %ebx
3c87: 5d pop %ebp
3c88: c3 ret
3c89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3c90: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
3c92: 29 d8 sub %ebx,%eax
}
3c94: 5b pop %ebx
3c95: 5d pop %ebp
3c96: c3 ret
3c97: 89 f6 mov %esi,%esi
3c99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003ca0 <strlen>:
uint
strlen(const char *s)
{
3ca0: 55 push %ebp
3ca1: 89 e5 mov %esp,%ebp
3ca3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3ca6: 80 39 00 cmpb $0x0,(%ecx)
3ca9: 74 15 je 3cc0 <strlen+0x20>
3cab: 31 d2 xor %edx,%edx
3cad: 8d 76 00 lea 0x0(%esi),%esi
3cb0: 83 c2 01 add $0x1,%edx
3cb3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3cb7: 89 d0 mov %edx,%eax
3cb9: 75 f5 jne 3cb0 <strlen+0x10>
;
return n;
}
3cbb: 5d pop %ebp
3cbc: c3 ret
3cbd: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
3cc0: 31 c0 xor %eax,%eax
}
3cc2: 5d pop %ebp
3cc3: c3 ret
3cc4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3cca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00003cd0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3cd0: 55 push %ebp
3cd1: 89 e5 mov %esp,%ebp
3cd3: 57 push %edi
3cd4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3cd7: 8b 4d 10 mov 0x10(%ebp),%ecx
3cda: 8b 45 0c mov 0xc(%ebp),%eax
3cdd: 89 d7 mov %edx,%edi
3cdf: fc cld
3ce0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3ce2: 89 d0 mov %edx,%eax
3ce4: 5f pop %edi
3ce5: 5d pop %ebp
3ce6: c3 ret
3ce7: 89 f6 mov %esi,%esi
3ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003cf0 <strchr>:
char*
strchr(const char *s, char c)
{
3cf0: 55 push %ebp
3cf1: 89 e5 mov %esp,%ebp
3cf3: 53 push %ebx
3cf4: 8b 45 08 mov 0x8(%ebp),%eax
3cf7: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
3cfa: 0f b6 10 movzbl (%eax),%edx
3cfd: 84 d2 test %dl,%dl
3cff: 74 1d je 3d1e <strchr+0x2e>
if(*s == c)
3d01: 38 d3 cmp %dl,%bl
3d03: 89 d9 mov %ebx,%ecx
3d05: 75 0d jne 3d14 <strchr+0x24>
3d07: eb 17 jmp 3d20 <strchr+0x30>
3d09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3d10: 38 ca cmp %cl,%dl
3d12: 74 0c je 3d20 <strchr+0x30>
for(; *s; s++)
3d14: 83 c0 01 add $0x1,%eax
3d17: 0f b6 10 movzbl (%eax),%edx
3d1a: 84 d2 test %dl,%dl
3d1c: 75 f2 jne 3d10 <strchr+0x20>
return (char*)s;
return 0;
3d1e: 31 c0 xor %eax,%eax
}
3d20: 5b pop %ebx
3d21: 5d pop %ebp
3d22: c3 ret
3d23: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3d29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003d30 <gets>:
char*
gets(char *buf, int max)
{
3d30: 55 push %ebp
3d31: 89 e5 mov %esp,%ebp
3d33: 57 push %edi
3d34: 56 push %esi
3d35: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
3d36: 31 f6 xor %esi,%esi
3d38: 89 f3 mov %esi,%ebx
{
3d3a: 83 ec 1c sub $0x1c,%esp
3d3d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
3d40: eb 2f jmp 3d71 <gets+0x41>
3d42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
3d48: 8d 45 e7 lea -0x19(%ebp),%eax
3d4b: 83 ec 04 sub $0x4,%esp
3d4e: 6a 01 push $0x1
3d50: 50 push %eax
3d51: 6a 00 push $0x0
3d53: e8 32 01 00 00 call 3e8a <read>
if(cc < 1)
3d58: 83 c4 10 add $0x10,%esp
3d5b: 85 c0 test %eax,%eax
3d5d: 7e 1c jle 3d7b <gets+0x4b>
break;
buf[i++] = c;
3d5f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3d63: 83 c7 01 add $0x1,%edi
3d66: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
3d69: 3c 0a cmp $0xa,%al
3d6b: 74 23 je 3d90 <gets+0x60>
3d6d: 3c 0d cmp $0xd,%al
3d6f: 74 1f je 3d90 <gets+0x60>
for(i=0; i+1 < max; ){
3d71: 83 c3 01 add $0x1,%ebx
3d74: 3b 5d 0c cmp 0xc(%ebp),%ebx
3d77: 89 fe mov %edi,%esi
3d79: 7c cd jl 3d48 <gets+0x18>
3d7b: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
3d7d: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
3d80: c6 03 00 movb $0x0,(%ebx)
}
3d83: 8d 65 f4 lea -0xc(%ebp),%esp
3d86: 5b pop %ebx
3d87: 5e pop %esi
3d88: 5f pop %edi
3d89: 5d pop %ebp
3d8a: c3 ret
3d8b: 90 nop
3d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3d90: 8b 75 08 mov 0x8(%ebp),%esi
3d93: 8b 45 08 mov 0x8(%ebp),%eax
3d96: 01 de add %ebx,%esi
3d98: 89 f3 mov %esi,%ebx
buf[i] = '\0';
3d9a: c6 03 00 movb $0x0,(%ebx)
}
3d9d: 8d 65 f4 lea -0xc(%ebp),%esp
3da0: 5b pop %ebx
3da1: 5e pop %esi
3da2: 5f pop %edi
3da3: 5d pop %ebp
3da4: c3 ret
3da5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3da9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003db0 <stat>:
int
stat(const char *n, struct stat *st)
{
3db0: 55 push %ebp
3db1: 89 e5 mov %esp,%ebp
3db3: 56 push %esi
3db4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
3db5: 83 ec 08 sub $0x8,%esp
3db8: 6a 00 push $0x0
3dba: ff 75 08 pushl 0x8(%ebp)
3dbd: e8 f0 00 00 00 call 3eb2 <open>
if(fd < 0)
3dc2: 83 c4 10 add $0x10,%esp
3dc5: 85 c0 test %eax,%eax
3dc7: 78 27 js 3df0 <stat+0x40>
return -1;
r = fstat(fd, st);
3dc9: 83 ec 08 sub $0x8,%esp
3dcc: ff 75 0c pushl 0xc(%ebp)
3dcf: 89 c3 mov %eax,%ebx
3dd1: 50 push %eax
3dd2: e8 f3 00 00 00 call 3eca <fstat>
close(fd);
3dd7: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
3dda: 89 c6 mov %eax,%esi
close(fd);
3ddc: e8 b9 00 00 00 call 3e9a <close>
return r;
3de1: 83 c4 10 add $0x10,%esp
}
3de4: 8d 65 f8 lea -0x8(%ebp),%esp
3de7: 89 f0 mov %esi,%eax
3de9: 5b pop %ebx
3dea: 5e pop %esi
3deb: 5d pop %ebp
3dec: c3 ret
3ded: 8d 76 00 lea 0x0(%esi),%esi
return -1;
3df0: be ff ff ff ff mov $0xffffffff,%esi
3df5: eb ed jmp 3de4 <stat+0x34>
3df7: 89 f6 mov %esi,%esi
3df9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003e00 <atoi>:
int
atoi(const char *s)
{
3e00: 55 push %ebp
3e01: 89 e5 mov %esp,%ebp
3e03: 53 push %ebx
3e04: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
3e07: 0f be 11 movsbl (%ecx),%edx
3e0a: 8d 42 d0 lea -0x30(%edx),%eax
3e0d: 3c 09 cmp $0x9,%al
n = 0;
3e0f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
3e14: 77 1f ja 3e35 <atoi+0x35>
3e16: 8d 76 00 lea 0x0(%esi),%esi
3e19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
3e20: 8d 04 80 lea (%eax,%eax,4),%eax
3e23: 83 c1 01 add $0x1,%ecx
3e26: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
3e2a: 0f be 11 movsbl (%ecx),%edx
3e2d: 8d 5a d0 lea -0x30(%edx),%ebx
3e30: 80 fb 09 cmp $0x9,%bl
3e33: 76 eb jbe 3e20 <atoi+0x20>
return n;
}
3e35: 5b pop %ebx
3e36: 5d pop %ebp
3e37: c3 ret
3e38: 90 nop
3e39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003e40 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
3e40: 55 push %ebp
3e41: 89 e5 mov %esp,%ebp
3e43: 56 push %esi
3e44: 53 push %ebx
3e45: 8b 5d 10 mov 0x10(%ebp),%ebx
3e48: 8b 45 08 mov 0x8(%ebp),%eax
3e4b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3e4e: 85 db test %ebx,%ebx
3e50: 7e 14 jle 3e66 <memmove+0x26>
3e52: 31 d2 xor %edx,%edx
3e54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
3e58: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
3e5c: 88 0c 10 mov %cl,(%eax,%edx,1)
3e5f: 83 c2 01 add $0x1,%edx
while(n-- > 0)
3e62: 39 d3 cmp %edx,%ebx
3e64: 75 f2 jne 3e58 <memmove+0x18>
return vdst;
}
3e66: 5b pop %ebx
3e67: 5e pop %esi
3e68: 5d pop %ebp
3e69: c3 ret
00003e6a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3e6a: b8 01 00 00 00 mov $0x1,%eax
3e6f: cd 40 int $0x40
3e71: c3 ret
00003e72 <exit>:
SYSCALL(exit)
3e72: b8 02 00 00 00 mov $0x2,%eax
3e77: cd 40 int $0x40
3e79: c3 ret
00003e7a <wait>:
SYSCALL(wait)
3e7a: b8 03 00 00 00 mov $0x3,%eax
3e7f: cd 40 int $0x40
3e81: c3 ret
00003e82 <pipe>:
SYSCALL(pipe)
3e82: b8 04 00 00 00 mov $0x4,%eax
3e87: cd 40 int $0x40
3e89: c3 ret
00003e8a <read>:
SYSCALL(read)
3e8a: b8 05 00 00 00 mov $0x5,%eax
3e8f: cd 40 int $0x40
3e91: c3 ret
00003e92 <write>:
SYSCALL(write)
3e92: b8 10 00 00 00 mov $0x10,%eax
3e97: cd 40 int $0x40
3e99: c3 ret
00003e9a <close>:
SYSCALL(close)
3e9a: b8 15 00 00 00 mov $0x15,%eax
3e9f: cd 40 int $0x40
3ea1: c3 ret
00003ea2 <kill>:
SYSCALL(kill)
3ea2: b8 06 00 00 00 mov $0x6,%eax
3ea7: cd 40 int $0x40
3ea9: c3 ret
00003eaa <exec>:
SYSCALL(exec)
3eaa: b8 07 00 00 00 mov $0x7,%eax
3eaf: cd 40 int $0x40
3eb1: c3 ret
00003eb2 <open>:
SYSCALL(open)
3eb2: b8 0f 00 00 00 mov $0xf,%eax
3eb7: cd 40 int $0x40
3eb9: c3 ret
00003eba <mknod>:
SYSCALL(mknod)
3eba: b8 11 00 00 00 mov $0x11,%eax
3ebf: cd 40 int $0x40
3ec1: c3 ret
00003ec2 <unlink>:
SYSCALL(unlink)
3ec2: b8 12 00 00 00 mov $0x12,%eax
3ec7: cd 40 int $0x40
3ec9: c3 ret
00003eca <fstat>:
SYSCALL(fstat)
3eca: b8 08 00 00 00 mov $0x8,%eax
3ecf: cd 40 int $0x40
3ed1: c3 ret
00003ed2 <link>:
SYSCALL(link)
3ed2: b8 13 00 00 00 mov $0x13,%eax
3ed7: cd 40 int $0x40
3ed9: c3 ret
00003eda <mkdir>:
SYSCALL(mkdir)
3eda: b8 14 00 00 00 mov $0x14,%eax
3edf: cd 40 int $0x40
3ee1: c3 ret
00003ee2 <chdir>:
SYSCALL(chdir)
3ee2: b8 09 00 00 00 mov $0x9,%eax
3ee7: cd 40 int $0x40
3ee9: c3 ret
00003eea <dup>:
SYSCALL(dup)
3eea: b8 0a 00 00 00 mov $0xa,%eax
3eef: cd 40 int $0x40
3ef1: c3 ret
00003ef2 <getpid>:
SYSCALL(getpid)
3ef2: b8 0b 00 00 00 mov $0xb,%eax
3ef7: cd 40 int $0x40
3ef9: c3 ret
00003efa <sbrk>:
SYSCALL(sbrk)
3efa: b8 0c 00 00 00 mov $0xc,%eax
3eff: cd 40 int $0x40
3f01: c3 ret
00003f02 <sleep>:
SYSCALL(sleep)
3f02: b8 0d 00 00 00 mov $0xd,%eax
3f07: cd 40 int $0x40
3f09: c3 ret
00003f0a <uptime>:
SYSCALL(uptime)
3f0a: b8 0e 00 00 00 mov $0xe,%eax
3f0f: cd 40 int $0x40
3f11: c3 ret
00003f12 <memsize>:
SYSCALL(memsize)
3f12: b8 16 00 00 00 mov $0x16,%eax
3f17: cd 40 int $0x40
3f19: c3 ret
00003f1a <set_ps_priority>:
SYSCALL(set_ps_priority)
3f1a: b8 17 00 00 00 mov $0x17,%eax
3f1f: cd 40 int $0x40
3f21: c3 ret
00003f22 <set_cfs_priority>:
SYSCALL(set_cfs_priority)
3f22: b8 18 00 00 00 mov $0x18,%eax
3f27: cd 40 int $0x40
3f29: c3 ret
00003f2a <policy>:
SYSCALL(policy)
3f2a: b8 19 00 00 00 mov $0x19,%eax
3f2f: cd 40 int $0x40
3f31: c3 ret
00003f32 <proc_info>:
3f32: b8 1a 00 00 00 mov $0x1a,%eax
3f37: cd 40 int $0x40
3f39: c3 ret
3f3a: 66 90 xchg %ax,%ax
3f3c: 66 90 xchg %ax,%ax
3f3e: 66 90 xchg %ax,%ax
00003f40 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
3f40: 55 push %ebp
3f41: 89 e5 mov %esp,%ebp
3f43: 57 push %edi
3f44: 56 push %esi
3f45: 53 push %ebx
3f46: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
3f49: 85 d2 test %edx,%edx
{
3f4b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
3f4e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
3f50: 79 76 jns 3fc8 <printint+0x88>
3f52: f6 45 08 01 testb $0x1,0x8(%ebp)
3f56: 74 70 je 3fc8 <printint+0x88>
x = -xx;
3f58: f7 d8 neg %eax
neg = 1;
3f5a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
3f61: 31 f6 xor %esi,%esi
3f63: 8d 5d d7 lea -0x29(%ebp),%ebx
3f66: eb 0a jmp 3f72 <printint+0x32>
3f68: 90 nop
3f69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
3f70: 89 fe mov %edi,%esi
3f72: 31 d2 xor %edx,%edx
3f74: 8d 7e 01 lea 0x1(%esi),%edi
3f77: f7 f1 div %ecx
3f79: 0f b6 92 d8 5a 00 00 movzbl 0x5ad8(%edx),%edx
}while((x /= base) != 0);
3f80: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3f82: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3f85: 75 e9 jne 3f70 <printint+0x30>
if(neg)
3f87: 8b 45 c4 mov -0x3c(%ebp),%eax
3f8a: 85 c0 test %eax,%eax
3f8c: 74 08 je 3f96 <printint+0x56>
buf[i++] = '-';
3f8e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3f93: 8d 7e 02 lea 0x2(%esi),%edi
3f96: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3f9a: 8b 7d c0 mov -0x40(%ebp),%edi
3f9d: 8d 76 00 lea 0x0(%esi),%esi
3fa0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3fa3: 83 ec 04 sub $0x4,%esp
3fa6: 83 ee 01 sub $0x1,%esi
3fa9: 6a 01 push $0x1
3fab: 53 push %ebx
3fac: 57 push %edi
3fad: 88 45 d7 mov %al,-0x29(%ebp)
3fb0: e8 dd fe ff ff call 3e92 <write>
while(--i >= 0)
3fb5: 83 c4 10 add $0x10,%esp
3fb8: 39 de cmp %ebx,%esi
3fba: 75 e4 jne 3fa0 <printint+0x60>
putc(fd, buf[i]);
}
3fbc: 8d 65 f4 lea -0xc(%ebp),%esp
3fbf: 5b pop %ebx
3fc0: 5e pop %esi
3fc1: 5f pop %edi
3fc2: 5d pop %ebp
3fc3: c3 ret
3fc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
3fc8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3fcf: eb 90 jmp 3f61 <printint+0x21>
3fd1: eb 0d jmp 3fe0 <printf>
3fd3: 90 nop
3fd4: 90 nop
3fd5: 90 nop
3fd6: 90 nop
3fd7: 90 nop
3fd8: 90 nop
3fd9: 90 nop
3fda: 90 nop
3fdb: 90 nop
3fdc: 90 nop
3fdd: 90 nop
3fde: 90 nop
3fdf: 90 nop
00003fe0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3fe0: 55 push %ebp
3fe1: 89 e5 mov %esp,%ebp
3fe3: 57 push %edi
3fe4: 56 push %esi
3fe5: 53 push %ebx
3fe6: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3fe9: 8b 75 0c mov 0xc(%ebp),%esi
3fec: 0f b6 1e movzbl (%esi),%ebx
3fef: 84 db test %bl,%bl
3ff1: 0f 84 b3 00 00 00 je 40aa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
3ff7: 8d 45 10 lea 0x10(%ebp),%eax
3ffa: 83 c6 01 add $0x1,%esi
state = 0;
3ffd: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
3fff: 89 45 d4 mov %eax,-0x2c(%ebp)
4002: eb 2f jmp 4033 <printf+0x53>
4004: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
4008: 83 f8 25 cmp $0x25,%eax
400b: 0f 84 a7 00 00 00 je 40b8 <printf+0xd8>
write(fd, &c, 1);
4011: 8d 45 e2 lea -0x1e(%ebp),%eax
4014: 83 ec 04 sub $0x4,%esp
4017: 88 5d e2 mov %bl,-0x1e(%ebp)
401a: 6a 01 push $0x1
401c: 50 push %eax
401d: ff 75 08 pushl 0x8(%ebp)
4020: e8 6d fe ff ff call 3e92 <write>
4025: 83 c4 10 add $0x10,%esp
4028: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
402b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
402f: 84 db test %bl,%bl
4031: 74 77 je 40aa <printf+0xca>
if(state == 0){
4033: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
4035: 0f be cb movsbl %bl,%ecx
4038: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
403b: 74 cb je 4008 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
403d: 83 ff 25 cmp $0x25,%edi
4040: 75 e6 jne 4028 <printf+0x48>
if(c == 'd'){
4042: 83 f8 64 cmp $0x64,%eax
4045: 0f 84 05 01 00 00 je 4150 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
404b: 81 e1 f7 00 00 00 and $0xf7,%ecx
4051: 83 f9 70 cmp $0x70,%ecx
4054: 74 72 je 40c8 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
4056: 83 f8 73 cmp $0x73,%eax
4059: 0f 84 99 00 00 00 je 40f8 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
405f: 83 f8 63 cmp $0x63,%eax
4062: 0f 84 08 01 00 00 je 4170 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4068: 83 f8 25 cmp $0x25,%eax
406b: 0f 84 ef 00 00 00 je 4160 <printf+0x180>
write(fd, &c, 1);
4071: 8d 45 e7 lea -0x19(%ebp),%eax
4074: 83 ec 04 sub $0x4,%esp
4077: c6 45 e7 25 movb $0x25,-0x19(%ebp)
407b: 6a 01 push $0x1
407d: 50 push %eax
407e: ff 75 08 pushl 0x8(%ebp)
4081: e8 0c fe ff ff call 3e92 <write>
4086: 83 c4 0c add $0xc,%esp
4089: 8d 45 e6 lea -0x1a(%ebp),%eax
408c: 88 5d e6 mov %bl,-0x1a(%ebp)
408f: 6a 01 push $0x1
4091: 50 push %eax
4092: ff 75 08 pushl 0x8(%ebp)
4095: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4098: 31 ff xor %edi,%edi
write(fd, &c, 1);
409a: e8 f3 fd ff ff call 3e92 <write>
for(i = 0; fmt[i]; i++){
409f: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
40a3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
40a6: 84 db test %bl,%bl
40a8: 75 89 jne 4033 <printf+0x53>
}
}
}
40aa: 8d 65 f4 lea -0xc(%ebp),%esp
40ad: 5b pop %ebx
40ae: 5e pop %esi
40af: 5f pop %edi
40b0: 5d pop %ebp
40b1: c3 ret
40b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
40b8: bf 25 00 00 00 mov $0x25,%edi
40bd: e9 66 ff ff ff jmp 4028 <printf+0x48>
40c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
40c8: 83 ec 0c sub $0xc,%esp
40cb: b9 10 00 00 00 mov $0x10,%ecx
40d0: 6a 00 push $0x0
40d2: 8b 7d d4 mov -0x2c(%ebp),%edi
40d5: 8b 45 08 mov 0x8(%ebp),%eax
40d8: 8b 17 mov (%edi),%edx
40da: e8 61 fe ff ff call 3f40 <printint>
ap++;
40df: 89 f8 mov %edi,%eax
40e1: 83 c4 10 add $0x10,%esp
state = 0;
40e4: 31 ff xor %edi,%edi
ap++;
40e6: 83 c0 04 add $0x4,%eax
40e9: 89 45 d4 mov %eax,-0x2c(%ebp)
40ec: e9 37 ff ff ff jmp 4028 <printf+0x48>
40f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
40f8: 8b 45 d4 mov -0x2c(%ebp),%eax
40fb: 8b 08 mov (%eax),%ecx
ap++;
40fd: 83 c0 04 add $0x4,%eax
4100: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
4103: 85 c9 test %ecx,%ecx
4105: 0f 84 8e 00 00 00 je 4199 <printf+0x1b9>
while(*s != 0){
410b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
410e: 31 ff xor %edi,%edi
s = (char*)*ap;
4110: 89 cb mov %ecx,%ebx
while(*s != 0){
4112: 84 c0 test %al,%al
4114: 0f 84 0e ff ff ff je 4028 <printf+0x48>
411a: 89 75 d0 mov %esi,-0x30(%ebp)
411d: 89 de mov %ebx,%esi
411f: 8b 5d 08 mov 0x8(%ebp),%ebx
4122: 8d 7d e3 lea -0x1d(%ebp),%edi
4125: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
4128: 83 ec 04 sub $0x4,%esp
s++;
412b: 83 c6 01 add $0x1,%esi
412e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
4131: 6a 01 push $0x1
4133: 57 push %edi
4134: 53 push %ebx
4135: e8 58 fd ff ff call 3e92 <write>
while(*s != 0){
413a: 0f b6 06 movzbl (%esi),%eax
413d: 83 c4 10 add $0x10,%esp
4140: 84 c0 test %al,%al
4142: 75 e4 jne 4128 <printf+0x148>
4144: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
4147: 31 ff xor %edi,%edi
4149: e9 da fe ff ff jmp 4028 <printf+0x48>
414e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
4150: 83 ec 0c sub $0xc,%esp
4153: b9 0a 00 00 00 mov $0xa,%ecx
4158: 6a 01 push $0x1
415a: e9 73 ff ff ff jmp 40d2 <printf+0xf2>
415f: 90 nop
write(fd, &c, 1);
4160: 83 ec 04 sub $0x4,%esp
4163: 88 5d e5 mov %bl,-0x1b(%ebp)
4166: 8d 45 e5 lea -0x1b(%ebp),%eax
4169: 6a 01 push $0x1
416b: e9 21 ff ff ff jmp 4091 <printf+0xb1>
putc(fd, *ap);
4170: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
4173: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
4176: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
4178: 6a 01 push $0x1
ap++;
417a: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
417d: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
4180: 8d 45 e4 lea -0x1c(%ebp),%eax
4183: 50 push %eax
4184: ff 75 08 pushl 0x8(%ebp)
4187: e8 06 fd ff ff call 3e92 <write>
ap++;
418c: 89 7d d4 mov %edi,-0x2c(%ebp)
418f: 83 c4 10 add $0x10,%esp
state = 0;
4192: 31 ff xor %edi,%edi
4194: e9 8f fe ff ff jmp 4028 <printf+0x48>
s = "(null)";
4199: bb d0 5a 00 00 mov $0x5ad0,%ebx
while(*s != 0){
419e: b8 28 00 00 00 mov $0x28,%eax
41a3: e9 72 ff ff ff jmp 411a <printf+0x13a>
41a8: 66 90 xchg %ax,%ax
41aa: 66 90 xchg %ax,%ax
41ac: 66 90 xchg %ax,%ax
41ae: 66 90 xchg %ax,%ax
000041b0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
41b0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
41b1: a1 80 64 00 00 mov 0x6480,%eax
{
41b6: 89 e5 mov %esp,%ebp
41b8: 57 push %edi
41b9: 56 push %esi
41ba: 53 push %ebx
41bb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
41be: 8d 4b f8 lea -0x8(%ebx),%ecx
41c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
41c8: 39 c8 cmp %ecx,%eax
41ca: 8b 10 mov (%eax),%edx
41cc: 73 32 jae 4200 <free+0x50>
41ce: 39 d1 cmp %edx,%ecx
41d0: 72 04 jb 41d6 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
41d2: 39 d0 cmp %edx,%eax
41d4: 72 32 jb 4208 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
41d6: 8b 73 fc mov -0x4(%ebx),%esi
41d9: 8d 3c f1 lea (%ecx,%esi,8),%edi
41dc: 39 fa cmp %edi,%edx
41de: 74 30 je 4210 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
41e0: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
41e3: 8b 50 04 mov 0x4(%eax),%edx
41e6: 8d 34 d0 lea (%eax,%edx,8),%esi
41e9: 39 f1 cmp %esi,%ecx
41eb: 74 3a je 4227 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
41ed: 89 08 mov %ecx,(%eax)
freep = p;
41ef: a3 80 64 00 00 mov %eax,0x6480
}
41f4: 5b pop %ebx
41f5: 5e pop %esi
41f6: 5f pop %edi
41f7: 5d pop %ebp
41f8: c3 ret
41f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
4200: 39 d0 cmp %edx,%eax
4202: 72 04 jb 4208 <free+0x58>
4204: 39 d1 cmp %edx,%ecx
4206: 72 ce jb 41d6 <free+0x26>
{
4208: 89 d0 mov %edx,%eax
420a: eb bc jmp 41c8 <free+0x18>
420c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
4210: 03 72 04 add 0x4(%edx),%esi
4213: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
4216: 8b 10 mov (%eax),%edx
4218: 8b 12 mov (%edx),%edx
421a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
421d: 8b 50 04 mov 0x4(%eax),%edx
4220: 8d 34 d0 lea (%eax,%edx,8),%esi
4223: 39 f1 cmp %esi,%ecx
4225: 75 c6 jne 41ed <free+0x3d>
p->s.size += bp->s.size;
4227: 03 53 fc add -0x4(%ebx),%edx
freep = p;
422a: a3 80 64 00 00 mov %eax,0x6480
p->s.size += bp->s.size;
422f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
4232: 8b 53 f8 mov -0x8(%ebx),%edx
4235: 89 10 mov %edx,(%eax)
}
4237: 5b pop %ebx
4238: 5e pop %esi
4239: 5f pop %edi
423a: 5d pop %ebp
423b: c3 ret
423c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00004240 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
4240: 55 push %ebp
4241: 89 e5 mov %esp,%ebp
4243: 57 push %edi
4244: 56 push %esi
4245: 53 push %ebx
4246: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4249: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
424c: 8b 15 80 64 00 00 mov 0x6480,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4252: 8d 78 07 lea 0x7(%eax),%edi
4255: c1 ef 03 shr $0x3,%edi
4258: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
425b: 85 d2 test %edx,%edx
425d: 0f 84 9d 00 00 00 je 4300 <malloc+0xc0>
4263: 8b 02 mov (%edx),%eax
4265: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
4268: 39 cf cmp %ecx,%edi
426a: 76 6c jbe 42d8 <malloc+0x98>
426c: 81 ff 00 10 00 00 cmp $0x1000,%edi
4272: bb 00 10 00 00 mov $0x1000,%ebx
4277: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
427a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
4281: eb 0e jmp 4291 <malloc+0x51>
4283: 90 nop
4284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
4288: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
428a: 8b 48 04 mov 0x4(%eax),%ecx
428d: 39 f9 cmp %edi,%ecx
428f: 73 47 jae 42d8 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
4291: 39 05 80 64 00 00 cmp %eax,0x6480
4297: 89 c2 mov %eax,%edx
4299: 75 ed jne 4288 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
429b: 83 ec 0c sub $0xc,%esp
429e: 56 push %esi
429f: e8 56 fc ff ff call 3efa <sbrk>
if(p == (char*)-1)
42a4: 83 c4 10 add $0x10,%esp
42a7: 83 f8 ff cmp $0xffffffff,%eax
42aa: 74 1c je 42c8 <malloc+0x88>
hp->s.size = nu;
42ac: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
42af: 83 ec 0c sub $0xc,%esp
42b2: 83 c0 08 add $0x8,%eax
42b5: 50 push %eax
42b6: e8 f5 fe ff ff call 41b0 <free>
return freep;
42bb: 8b 15 80 64 00 00 mov 0x6480,%edx
if((p = morecore(nunits)) == 0)
42c1: 83 c4 10 add $0x10,%esp
42c4: 85 d2 test %edx,%edx
42c6: 75 c0 jne 4288 <malloc+0x48>
return 0;
}
}
42c8: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
42cb: 31 c0 xor %eax,%eax
}
42cd: 5b pop %ebx
42ce: 5e pop %esi
42cf: 5f pop %edi
42d0: 5d pop %ebp
42d1: c3 ret
42d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
42d8: 39 cf cmp %ecx,%edi
42da: 74 54 je 4330 <malloc+0xf0>
p->s.size -= nunits;
42dc: 29 f9 sub %edi,%ecx
42de: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
42e1: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
42e4: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
42e7: 89 15 80 64 00 00 mov %edx,0x6480
}
42ed: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
42f0: 83 c0 08 add $0x8,%eax
}
42f3: 5b pop %ebx
42f4: 5e pop %esi
42f5: 5f pop %edi
42f6: 5d pop %ebp
42f7: c3 ret
42f8: 90 nop
42f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
4300: c7 05 80 64 00 00 84 movl $0x6484,0x6480
4307: 64 00 00
430a: c7 05 84 64 00 00 84 movl $0x6484,0x6484
4311: 64 00 00
base.s.size = 0;
4314: b8 84 64 00 00 mov $0x6484,%eax
4319: c7 05 88 64 00 00 00 movl $0x0,0x6488
4320: 00 00 00
4323: e9 44 ff ff ff jmp 426c <malloc+0x2c>
4328: 90 nop
4329: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
4330: 8b 08 mov (%eax),%ecx
4332: 89 0a mov %ecx,(%edx)
4334: eb b1 jmp 42e7 <malloc+0xa7>
|
Assembly Code/String/2(b).asm | Jaggesher/LabWork | 1 | 19812 | <reponame>Jaggesher/LabWork<filename>Assembly Code/String/2(b).asm
;2(b)
;Name: <NAME>
;Roll: 14025423
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB "Please Input a String=$"
MSG2 DB 0DH,0AH,"The Longest Sub Sequence IS:=$"
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV AH,9;String Out
LEA DX,MSG1
INT 21H
MOV AH,1
INT 21H
CMP AL,0DH
JE EXIT
MOV DL,AL
MOV CL,1
MOV CH,1
MOV DH,AL
POS1:
INT 21H
MOV Bl,AL
SUB AL,CH
CMP DH,AL
JNE POS2
INC CH
CMP CL,CH
JG POS3
MOV CL,CH
MOV DL,DH
JMP POS3
POS2:
MOV DH,BL
MOV CH,1
POS3:
CMP BL,0DH
JE OUTPUT
JMP POS1
OUTPUT:
MOV BL,DL
MOV AH,9
LEA DX,MSG2
INT 21H
MOV AH,2
MOV DL,BL
POS4:
INT 21H
INC DL
DEC CL
CMP CL,0
JNE POS4
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN |
target/cos_117/disasm/iop_overlay1/ISPDRV.asm | jrrk2/cray-sim | 49 | 100950 | 0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0001 (0x000002) 0x291D- f:00024 d: 285 | OR[285] = A
0x0002 (0x000004) 0x3118- f:00030 d: 280 | A = (OR[280])
0x0003 (0x000006) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0004 (0x000008) 0x291E- f:00024 d: 286 | OR[286] = A
0x0005 (0x00000A) 0x211D- f:00020 d: 285 | A = OR[285]
0x0006 (0x00000C) 0x8664- f:00103 d: 100 | P = P + 100 (0x006A), A # 0
0x0007 (0x00000E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0008 (0x000010) 0x290D- f:00024 d: 269 | OR[269] = A
0x0009 (0x000012) 0x2118- f:00020 d: 280 | A = OR[280]
0x000A (0x000014) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x000B (0x000016) 0x2908- f:00024 d: 264 | OR[264] = A
0x000C (0x000018) 0x3108- f:00030 d: 264 | A = (OR[264])
0x000D (0x00001A) 0x8613- f:00103 d: 19 | P = P + 19 (0x0020), A # 0
0x000E (0x00001C) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x000F (0x00001E) 0x2926- f:00024 d: 294 | OR[294] = A
0x0010 (0x000020) 0x2118- f:00020 d: 280 | A = OR[280]
0x0011 (0x000022) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x0012 (0x000024) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0013 (0x000026) 0x2927- f:00024 d: 295 | OR[295] = A
0x0014 (0x000028) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0015 (0x00002A) 0x2928- f:00024 d: 296 | OR[296] = A
0x0016 (0x00002C) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0017 (0x00002E) 0x5800- f:00054 d: 0 | B = A
0x0018 (0x000030) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x001A (0x000034) 0x7C09- f:00076 d: 9 | R = OR[9]
0x001B (0x000036) 0x2006- f:00020 d: 6 | A = OR[6]
0x001C (0x000038) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x001D (0x00003A) 0x2908- f:00024 d: 264 | OR[264] = A
0x001E (0x00003C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x001F (0x00003E) 0x290D- f:00024 d: 269 | OR[269] = A
0x0020 (0x000040) 0x2118- f:00020 d: 280 | A = OR[280]
0x0021 (0x000042) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x0022 (0x000044) 0x2908- f:00024 d: 264 | OR[264] = A
0x0023 (0x000046) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0024 (0x000048) 0x2919- f:00024 d: 281 | OR[281] = A
0x0025 (0x00004A) 0x2118- f:00020 d: 280 | A = OR[280]
0x0026 (0x00004C) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x0027 (0x00004E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0028 (0x000050) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0029 (0x000052) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x002A (0x000054) 0x210D- f:00020 d: 269 | A = OR[269]
0x002B (0x000056) 0x2119- f:00020 d: 281 | A = OR[281]
0x002C (0x000058) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003)
0x002D (0x00005A) 0x8402- f:00102 d: 2 | P = P + 2 (0x002F), A = 0
0x002E (0x00005C) 0x7003- f:00070 d: 3 | P = P + 3 (0x0031)
0x002F (0x00005E) 0x7441- f:00072 d: 65 | R = P + 65 (0x0070)
0x0030 (0x000060) 0x7027- f:00070 d: 39 | P = P + 39 (0x0057)
0x0031 (0x000062) 0x2119- f:00020 d: 281 | A = OR[281]
0x0032 (0x000064) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004)
0x0033 (0x000066) 0x8402- f:00102 d: 2 | P = P + 2 (0x0035), A = 0
0x0034 (0x000068) 0x7003- f:00070 d: 3 | P = P + 3 (0x0037)
0x0035 (0x00006A) 0x7455- f:00072 d: 85 | R = P + 85 (0x008A)
0x0036 (0x00006C) 0x7021- f:00070 d: 33 | P = P + 33 (0x0057)
0x0037 (0x00006E) 0x2119- f:00020 d: 281 | A = OR[281]
0x0038 (0x000070) 0x1605- f:00013 d: 5 | A = A - 5 (0x0005)
0x0039 (0x000072) 0x8402- f:00102 d: 2 | P = P + 2 (0x003B), A = 0
0x003A (0x000074) 0x7003- f:00070 d: 3 | P = P + 3 (0x003D)
0x003B (0x000076) 0x7454- f:00072 d: 84 | R = P + 84 (0x008F)
0x003C (0x000078) 0x701B- f:00070 d: 27 | P = P + 27 (0x0057)
0x003D (0x00007A) 0x2119- f:00020 d: 281 | A = OR[281]
0x003E (0x00007C) 0x1606- f:00013 d: 6 | A = A - 6 (0x0006)
0x003F (0x00007E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0041), A = 0
0x0040 (0x000080) 0x7003- f:00070 d: 3 | P = P + 3 (0x0043)
0x0041 (0x000082) 0x744E- f:00072 d: 78 | R = P + 78 (0x008F)
0x0042 (0x000084) 0x7015- f:00070 d: 21 | P = P + 21 (0x0057)
0x0043 (0x000086) 0x2119- f:00020 d: 281 | A = OR[281]
0x0044 (0x000088) 0x1607- f:00013 d: 7 | A = A - 7 (0x0007)
0x0045 (0x00008A) 0x8402- f:00102 d: 2 | P = P + 2 (0x0047), A = 0
0x0046 (0x00008C) 0x7003- f:00070 d: 3 | P = P + 3 (0x0049)
0x0047 (0x00008E) 0x7448- f:00072 d: 72 | R = P + 72 (0x008F)
0x0048 (0x000090) 0x700F- f:00070 d: 15 | P = P + 15 (0x0057)
0x0049 (0x000092) 0x2119- f:00020 d: 281 | A = OR[281]
0x004A (0x000094) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x004B (0x000096) 0x8402- f:00102 d: 2 | P = P + 2 (0x004D), A = 0
0x004C (0x000098) 0x7003- f:00070 d: 3 | P = P + 3 (0x004F)
0x004D (0x00009A) 0x7442- f:00072 d: 66 | R = P + 66 (0x008F)
0x004E (0x00009C) 0x7009- f:00070 d: 9 | P = P + 9 (0x0057)
0x004F (0x00009E) 0x2119- f:00020 d: 281 | A = OR[281]
0x0050 (0x0000A0) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x0051 (0x0000A2) 0x8202- f:00101 d: 2 | P = P + 2 (0x0053), C = 1
0x0052 (0x0000A4) 0x7003- f:00070 d: 3 | P = P + 3 (0x0055)
0x0053 (0x0000A6) 0x74E1- f:00072 d: 225 | R = P + 225 (0x0134)
0x0054 (0x0000A8) 0x7003- f:00070 d: 3 | P = P + 3 (0x0057)
0x0055 (0x0000AA) 0x1023- f:00010 d: 35 | A = 35 (0x0023)
0x0056 (0x0000AC) 0x291A- f:00024 d: 282 | OR[282] = A
0x0057 (0x0000AE) 0x2118- f:00020 d: 280 | A = OR[280]
0x0058 (0x0000B0) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C)
0x0059 (0x0000B2) 0x290D- f:00024 d: 269 | OR[269] = A
0x005A (0x0000B4) 0x211A- f:00020 d: 282 | A = OR[282]
0x005B (0x0000B6) 0x390D- f:00034 d: 269 | (OR[269]) = A
0x005C (0x0000B8) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x005D (0x0000BA) 0x310D- f:00030 d: 269 | A = (OR[269])
0x005E (0x0000BC) 0x840B- f:00102 d: 11 | P = P + 11 (0x0069), A = 0
0x005F (0x0000BE) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x0060 (0x0000C0) 0x2926- f:00024 d: 294 | OR[294] = A
0x0061 (0x0000C2) 0x210D- f:00020 d: 269 | A = OR[269]
0x0062 (0x0000C4) 0x2927- f:00024 d: 295 | OR[295] = A
0x0063 (0x0000C6) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0064 (0x0000C8) 0x2928- f:00024 d: 296 | OR[296] = A
0x0065 (0x0000CA) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0066 (0x0000CC) 0x5800- f:00054 d: 0 | B = A
0x0067 (0x0000CE) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0068 (0x0000D0) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0069 (0x0000D2) 0x7264- f:00071 d: 100 | P = P - 100 (0x0005)
0x006A (0x0000D4) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x006B (0x0000D6) 0x2926- f:00024 d: 294 | OR[294] = A
0x006C (0x0000D8) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x006D (0x0000DA) 0x5800- f:00054 d: 0 | B = A
0x006E (0x0000DC) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x006F (0x0000DE) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0070 (0x0000E0) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0071 (0x0000E2) 0x291A- f:00024 d: 282 | OR[282] = A
0x0072 (0x0000E4) 0x2118- f:00020 d: 280 | A = OR[280]
0x0073 (0x0000E6) 0x1419- f:00012 d: 25 | A = A + 25 (0x0019)
0x0074 (0x0000E8) 0x2908- f:00024 d: 264 | OR[264] = A
0x0075 (0x0000EA) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0076 (0x0000EC) 0x2913- f:00024 d: 275 | OR[275] = A
0x0077 (0x0000EE) 0x2113- f:00020 d: 275 | A = OR[275]
0x0078 (0x0000F0) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C)
0x0079 (0x0000F2) 0x2908- f:00024 d: 264 | OR[264] = A
0x007A (0x0000F4) 0x3108- f:00030 d: 264 | A = (OR[264])
0x007B (0x0000F6) 0x080F- f:00004 d: 15 | A = A > 15 (0x000F)
0x007C (0x0000F8) 0x2914- f:00024 d: 276 | OR[276] = A
0x007D (0x0000FA) 0x2118- f:00020 d: 280 | A = OR[280]
0x007E (0x0000FC) 0x140D- f:00012 d: 13 | A = A + 13 (0x000D)
0x007F (0x0000FE) 0x2908- f:00024 d: 264 | OR[264] = A
0x0080 (0x000100) 0x2114- f:00020 d: 276 | A = OR[276]
0x0081 (0x000102) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0082 (0x000104) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0083 (0x000106) 0x291F- f:00024 d: 287 | OR[287] = A
0x0084 (0x000108) 0x2920- f:00024 d: 288 | OR[288] = A
0x0085 (0x00010A) 0x2921- f:00024 d: 289 | OR[289] = A
0x0086 (0x00010C) 0x2922- f:00024 d: 290 | OR[290] = A
0x0087 (0x00010E) 0x2925- f:00024 d: 293 | OR[293] = A
0x0088 (0x000110) 0x7518- f:00072 d: 280 | R = P + 280 (0x01A0)
0x0089 (0x000112) 0x0200- f:00001 d: 0 | EXIT
0x008A (0x000114) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x008B (0x000116) 0x291A- f:00024 d: 282 | OR[282] = A
0x008C (0x000118) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x008D (0x00011A) 0x291D- f:00024 d: 285 | OR[285] = A
0x008E (0x00011C) 0x0200- f:00001 d: 0 | EXIT
0x008F (0x00011E) 0x2118- f:00020 d: 280 | A = OR[280]
0x0090 (0x000120) 0x140D- f:00012 d: 13 | A = A + 13 (0x000D)
0x0091 (0x000122) 0x2908- f:00024 d: 264 | OR[264] = A
0x0092 (0x000124) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0093 (0x000126) 0x2913- f:00024 d: 275 | OR[275] = A
0x0094 (0x000128) 0x2113- f:00020 d: 275 | A = OR[275]
0x0095 (0x00012A) 0x8452- f:00102 d: 82 | P = P + 82 (0x00E7), A = 0
0x0096 (0x00012C) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x0097 (0x00012E) 0x291A- f:00024 d: 282 | OR[282] = A
0x0098 (0x000130) 0x211A- f:00020 d: 282 | A = OR[282]
0x0099 (0x000132) 0x844D- f:00102 d: 77 | P = P + 77 (0x00E6), A = 0
0x009A (0x000134) 0x211A- f:00020 d: 282 | A = OR[282]
0x009B (0x000136) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x009C (0x000138) 0x824A- f:00101 d: 74 | P = P + 74 (0x00E6), C = 1
0x009D (0x00013A) 0x749A- f:00072 d: 154 | R = P + 154 (0x0137)
0x009E (0x00013C) 0x211A- f:00020 d: 282 | A = OR[282]
0x009F (0x00013E) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x00A0 (0x000140) 0x8002- f:00100 d: 2 | P = P + 2 (0x00A2), C = 0
0x00A1 (0x000142) 0x7044- f:00070 d: 68 | P = P + 68 (0x00E5)
0x00A2 (0x000144) 0x2119- f:00020 d: 281 | A = OR[281]
0x00A3 (0x000146) 0x1605- f:00013 d: 5 | A = A - 5 (0x0005)
0x00A4 (0x000148) 0x8405- f:00102 d: 5 | P = P + 5 (0x00A9), A = 0
0x00A5 (0x00014A) 0x2119- f:00020 d: 281 | A = OR[281]
0x00A6 (0x00014C) 0x1607- f:00013 d: 7 | A = A - 7 (0x0007)
0x00A7 (0x00014E) 0x8402- f:00102 d: 2 | P = P + 2 (0x00A9), A = 0
0x00A8 (0x000150) 0x703A- f:00070 d: 58 | P = P + 58 (0x00E2)
0x00A9 (0x000152) 0x2118- f:00020 d: 280 | A = OR[280]
0x00AA (0x000154) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C)
0x00AB (0x000156) 0x290D- f:00024 d: 269 | OR[269] = A
0x00AC (0x000158) 0x211A- f:00020 d: 282 | A = OR[282]
0x00AD (0x00015A) 0x390D- f:00034 d: 269 | (OR[269]) = A
0x00AE (0x00015C) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x00AF (0x00015E) 0x310D- f:00030 d: 269 | A = (OR[269])
0x00B0 (0x000160) 0x840B- f:00102 d: 11 | P = P + 11 (0x00BB), A = 0
0x00B1 (0x000162) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x00B2 (0x000164) 0x2926- f:00024 d: 294 | OR[294] = A
0x00B3 (0x000166) 0x210D- f:00020 d: 269 | A = OR[269]
0x00B4 (0x000168) 0x2927- f:00024 d: 295 | OR[295] = A
0x00B5 (0x00016A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00B6 (0x00016C) 0x2928- f:00024 d: 296 | OR[296] = A
0x00B7 (0x00016E) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00B8 (0x000170) 0x5800- f:00054 d: 0 | B = A
0x00B9 (0x000172) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00BA (0x000174) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00BB (0x000176) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00BC (0x000178) 0x290D- f:00024 d: 269 | OR[269] = A
0x00BD (0x00017A) 0x2118- f:00020 d: 280 | A = OR[280]
0x00BE (0x00017C) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00BF (0x00017E) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C0 (0x000180) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00C1 (0x000182) 0x8613- f:00103 d: 19 | P = P + 19 (0x00D4), A # 0
0x00C2 (0x000184) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x00C3 (0x000186) 0x2926- f:00024 d: 294 | OR[294] = A
0x00C4 (0x000188) 0x2118- f:00020 d: 280 | A = OR[280]
0x00C5 (0x00018A) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00C6 (0x00018C) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00C7 (0x00018E) 0x2927- f:00024 d: 295 | OR[295] = A
0x00C8 (0x000190) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00C9 (0x000192) 0x2928- f:00024 d: 296 | OR[296] = A
0x00CA (0x000194) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00CB (0x000196) 0x5800- f:00054 d: 0 | B = A
0x00CC (0x000198) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x00CE (0x00019C) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00CF (0x00019E) 0x2006- f:00020 d: 6 | A = OR[6]
0x00D0 (0x0001A0) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x00D1 (0x0001A2) 0x2908- f:00024 d: 264 | OR[264] = A
0x00D2 (0x0001A4) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00D3 (0x0001A6) 0x290D- f:00024 d: 269 | OR[269] = A
0x00D4 (0x0001A8) 0x2118- f:00020 d: 280 | A = OR[280]
0x00D5 (0x0001AA) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00D6 (0x0001AC) 0x2908- f:00024 d: 264 | OR[264] = A
0x00D7 (0x0001AE) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00D8 (0x0001B0) 0x2919- f:00024 d: 281 | OR[281] = A
0x00D9 (0x0001B2) 0x2118- f:00020 d: 280 | A = OR[280]
0x00DA (0x0001B4) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x00DB (0x0001B6) 0x2908- f:00024 d: 264 | OR[264] = A
0x00DC (0x0001B8) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00DD (0x0001BA) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00DE (0x0001BC) 0x210D- f:00020 d: 269 | A = OR[269]
0x00DF (0x0001BE) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x00E0 (0x0001C0) 0x291A- f:00024 d: 282 | OR[282] = A
0x00E1 (0x0001C2) 0x7003- f:00070 d: 3 | P = P + 3 (0x00E4)
0x00E2 (0x0001C4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00E3 (0x0001C6) 0x291A- f:00024 d: 282 | OR[282] = A
0x00E4 (0x0001C8) 0x74E8- f:00072 d: 232 | R = P + 232 (0x01CC)
0x00E5 (0x0001CA) 0x724D- f:00071 d: 77 | P = P - 77 (0x0098)
0x00E6 (0x0001CC) 0x0200- f:00001 d: 0 | EXIT
0x00E7 (0x0001CE) 0x2119- f:00020 d: 281 | A = OR[281]
0x00E8 (0x0001D0) 0x1605- f:00013 d: 5 | A = A - 5 (0x0005)
0x00E9 (0x0001D2) 0x8405- f:00102 d: 5 | P = P + 5 (0x00EE), A = 0
0x00EA (0x0001D4) 0x2119- f:00020 d: 281 | A = OR[281]
0x00EB (0x0001D6) 0x1607- f:00013 d: 7 | A = A - 7 (0x0007)
0x00EC (0x0001D8) 0x8402- f:00102 d: 2 | P = P + 2 (0x00EE), A = 0
0x00ED (0x0001DA) 0x7004- f:00070 d: 4 | P = P + 4 (0x00F1)
0x00EE (0x0001DC) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x00EF (0x0001DE) 0x291A- f:00024 d: 282 | OR[282] = A
0x00F0 (0x0001E0) 0x7003- f:00070 d: 3 | P = P + 3 (0x00F3)
0x00F1 (0x0001E2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00F2 (0x0001E4) 0x291A- f:00024 d: 282 | OR[282] = A
0x00F3 (0x0001E6) 0x7444- f:00072 d: 68 | R = P + 68 (0x0137)
0x00F4 (0x0001E8) 0x211A- f:00020 d: 282 | A = OR[282]
0x00F5 (0x0001EA) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x00F6 (0x0001EC) 0x8002- f:00100 d: 2 | P = P + 2 (0x00F8), C = 0
0x00F7 (0x0001EE) 0x0200- f:00001 d: 0 | EXIT
0x00F8 (0x0001F0) 0x74D4- f:00072 d: 212 | R = P + 212 (0x01CC)
0x00F9 (0x0001F2) 0x211A- f:00020 d: 282 | A = OR[282]
0x00FA (0x0001F4) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x00FB (0x0001F6) 0x8402- f:00102 d: 2 | P = P + 2 (0x00FD), A = 0
0x00FC (0x0001F8) 0x0200- f:00001 d: 0 | EXIT
0x00FD (0x0001FA) 0x2118- f:00020 d: 280 | A = OR[280]
0x00FE (0x0001FC) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C)
0x00FF (0x0001FE) 0x290D- f:00024 d: 269 | OR[269] = A
0x0100 (0x000200) 0x211A- f:00020 d: 282 | A = OR[282]
0x0101 (0x000202) 0x390D- f:00034 d: 269 | (OR[269]) = A
0x0102 (0x000204) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x0103 (0x000206) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0104 (0x000208) 0x840B- f:00102 d: 11 | P = P + 11 (0x010F), A = 0
0x0105 (0x00020A) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x0106 (0x00020C) 0x2926- f:00024 d: 294 | OR[294] = A
0x0107 (0x00020E) 0x210D- f:00020 d: 269 | A = OR[269]
0x0108 (0x000210) 0x2927- f:00024 d: 295 | OR[295] = A
0x0109 (0x000212) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x010A (0x000214) 0x2928- f:00024 d: 296 | OR[296] = A
0x010B (0x000216) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x010C (0x000218) 0x5800- f:00054 d: 0 | B = A
0x010D (0x00021A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x010E (0x00021C) 0x7C09- f:00076 d: 9 | R = OR[9]
0x010F (0x00021E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0110 (0x000220) 0x290D- f:00024 d: 269 | OR[269] = A
0x0111 (0x000222) 0x2118- f:00020 d: 280 | A = OR[280]
0x0112 (0x000224) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x0113 (0x000226) 0x2908- f:00024 d: 264 | OR[264] = A
0x0114 (0x000228) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0115 (0x00022A) 0x8613- f:00103 d: 19 | P = P + 19 (0x0128), A # 0
0x0116 (0x00022C) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0117 (0x00022E) 0x2926- f:00024 d: 294 | OR[294] = A
0x0118 (0x000230) 0x2118- f:00020 d: 280 | A = OR[280]
0x0119 (0x000232) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x011A (0x000234) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x011B (0x000236) 0x2927- f:00024 d: 295 | OR[295] = A
0x011C (0x000238) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x011D (0x00023A) 0x2928- f:00024 d: 296 | OR[296] = A
0x011E (0x00023C) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x011F (0x00023E) 0x5800- f:00054 d: 0 | B = A
0x0120 (0x000240) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0122 (0x000244) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0123 (0x000246) 0x2006- f:00020 d: 6 | A = OR[6]
0x0124 (0x000248) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x0125 (0x00024A) 0x2908- f:00024 d: 264 | OR[264] = A
0x0126 (0x00024C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0127 (0x00024E) 0x290D- f:00024 d: 269 | OR[269] = A
0x0128 (0x000250) 0x2118- f:00020 d: 280 | A = OR[280]
0x0129 (0x000252) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x012A (0x000254) 0x2908- f:00024 d: 264 | OR[264] = A
0x012B (0x000256) 0x3108- f:00030 d: 264 | A = (OR[264])
0x012C (0x000258) 0x2919- f:00024 d: 281 | OR[281] = A
0x012D (0x00025A) 0x2118- f:00020 d: 280 | A = OR[280]
0x012E (0x00025C) 0x1414- f:00012 d: 20 | A = A + 20 (0x0014)
0x012F (0x00025E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0130 (0x000260) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0131 (0x000262) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0132 (0x000264) 0x210D- f:00020 d: 269 | A = OR[269]
0x0133 (0x000266) 0x724C- f:00071 d: 76 | P = P - 76 (0x00E7)
0x0134 (0x000268) 0x1023- f:00010 d: 35 | A = 35 (0x0023)
0x0135 (0x00026A) 0x291A- f:00024 d: 282 | OR[282] = A
0x0136 (0x00026C) 0x0200- f:00001 d: 0 | EXIT
0x0137 (0x00026E) 0x2125- f:00020 d: 293 | A = OR[293]
0x0138 (0x000270) 0x8421- f:00102 d: 33 | P = P + 33 (0x0159), A = 0
0x0139 (0x000272) 0x211E- f:00020 d: 286 | A = OR[286]
0x013A (0x000274) 0x5800- f:00054 d: 0 | B = A
0x013B (0x000276) 0xF200- f:00171 d: 0 | IOB , fn011
0x013C (0x000278) 0x1A00-0x8000 f:00015 d: 0 | A = A & 32768 (0x8000)
0x013E (0x00027C) 0x2908- f:00024 d: 264 | OR[264] = A
0x013F (0x00027E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0140 (0x000280) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0141 (0x000282) 0x8602- f:00103 d: 2 | P = P + 2 (0x0143), A # 0
0x0142 (0x000284) 0x7003- f:00070 d: 3 | P = P + 3 (0x0145)
0x0143 (0x000286) 0x745D- f:00072 d: 93 | R = P + 93 (0x01A0)
0x0144 (0x000288) 0x7015- f:00070 d: 21 | P = P + 21 (0x0159)
0x0145 (0x00028A) 0x1007- f:00010 d: 7 | A = 7 (0x0007)
0x0146 (0x00028C) 0x2926- f:00024 d: 294 | OR[294] = A
0x0147 (0x00028E) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0148 (0x000290) 0x2927- f:00024 d: 295 | OR[295] = A
0x0149 (0x000292) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x014A (0x000294) 0x5800- f:00054 d: 0 | B = A
0x014B (0x000296) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x014D (0x00029A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x014E (0x00029C) 0x2F25- f:00027 d: 293 | OR[293] = OR[293] - 1
0x014F (0x00029E) 0x2125- f:00020 d: 293 | A = OR[293]
0x0150 (0x0002A0) 0x8E19- f:00107 d: 25 | P = P - 25 (0x0137), A # 0
0x0151 (0x0002A2) 0x2118- f:00020 d: 280 | A = OR[280]
0x0152 (0x0002A4) 0x1421- f:00012 d: 33 | A = A + 33 (0x0021)
0x0153 (0x0002A6) 0x2908- f:00024 d: 264 | OR[264] = A
0x0154 (0x0002A8) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0155 (0x0002AA) 0x2925- f:00024 d: 293 | OR[293] = A
0x0156 (0x0002AC) 0x1020- f:00010 d: 32 | A = 32 (0x0020)
0x0157 (0x0002AE) 0x291A- f:00024 d: 282 | OR[282] = A
0x0158 (0x0002B0) 0x0200- f:00001 d: 0 | EXIT
0x0159 (0x0002B2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x015A (0x0002B4) 0x2925- f:00024 d: 293 | OR[293] = A
0x015B (0x0002B6) 0x2118- f:00020 d: 280 | A = OR[280]
0x015C (0x0002B8) 0x1417- f:00012 d: 23 | A = A + 23 (0x0017)
0x015D (0x0002BA) 0x2908- f:00024 d: 264 | OR[264] = A
0x015E (0x0002BC) 0x3108- f:00030 d: 264 | A = (OR[264])
0x015F (0x0002BE) 0x291B- f:00024 d: 283 | OR[283] = A
0x0160 (0x0002C0) 0x211B- f:00020 d: 283 | A = OR[283]
0x0161 (0x0002C2) 0xB434- f:00132 d: 52 | R = OR[52], A = 0
0x0162 (0x0002C4) 0x0000- f:00000 d: 0 | PASS
0x0163 (0x0002C6) 0x2118- f:00020 d: 280 | A = OR[280]
0x0164 (0x0002C8) 0x1417- f:00012 d: 23 | A = A + 23 (0x0017)
0x0165 (0x0002CA) 0x2908- f:00024 d: 264 | OR[264] = A
0x0166 (0x0002CC) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0167 (0x0002CE) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0168 (0x0002D0) 0x2118- f:00020 d: 280 | A = OR[280]
0x0169 (0x0002D2) 0x1418- f:00012 d: 24 | A = A + 24 (0x0018)
0x016A (0x0002D4) 0x2908- f:00024 d: 264 | OR[264] = A
0x016B (0x0002D6) 0x3108- f:00030 d: 264 | A = (OR[264])
0x016C (0x0002D8) 0x291C- f:00024 d: 284 | OR[284] = A
0x016D (0x0002DA) 0x2118- f:00020 d: 280 | A = OR[280]
0x016E (0x0002DC) 0x1418- f:00012 d: 24 | A = A + 24 (0x0018)
0x016F (0x0002DE) 0x2908- f:00024 d: 264 | OR[264] = A
0x0170 (0x0002E0) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0171 (0x0002E2) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0172 (0x0002E4) 0x211C- f:00020 d: 284 | A = OR[284]
0x0173 (0x0002E6) 0x8602- f:00103 d: 2 | P = P + 2 (0x0175), A # 0
0x0174 (0x0002E8) 0x7029- f:00070 d: 41 | P = P + 41 (0x019D)
0x0175 (0x0002EA) 0x211E- f:00020 d: 286 | A = OR[286]
0x0176 (0x0002EC) 0x5800- f:00054 d: 0 | B = A
0x0177 (0x0002EE) 0xE000- f:00160 d: 0 | IOB , fn000
0x0178 (0x0002F0) 0xE600- f:00163 d: 0 | IOB , fn003
0x0179 (0x0002F2) 0xEC00- f:00166 d: 0 | IOB , fn006
0x017A (0x0002F4) 0x2118- f:00020 d: 280 | A = OR[280]
0x017B (0x0002F6) 0x1426- f:00012 d: 38 | A = A + 38 (0x0026)
0x017C (0x0002F8) 0x2908- f:00024 d: 264 | OR[264] = A
0x017D (0x0002FA) 0x3108- f:00030 d: 264 | A = (OR[264])
0x017E (0x0002FC) 0x1A00-0xBFFF f:00015 d: 0 | A = A & 49151 (0xBFFF)
0x0180 (0x000300) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0181 (0x000302) 0x2119- f:00020 d: 281 | A = OR[281]
0x0182 (0x000304) 0x1607- f:00013 d: 7 | A = A - 7 (0x0007)
0x0183 (0x000306) 0x8402- f:00102 d: 2 | P = P + 2 (0x0185), A = 0
0x0184 (0x000308) 0x7005- f:00070 d: 5 | P = P + 5 (0x0189)
0x0185 (0x00030A) 0x1800-0x0200 f:00014 d: 0 | A = 512 (0x0200)
0x0187 (0x00030E) 0xE800- f:00164 d: 0 | IOB , fn004
0x0188 (0x000310) 0x7007- f:00070 d: 7 | P = P + 7 (0x018F)
0x0189 (0x000312) 0x2119- f:00020 d: 281 | A = OR[281]
0x018A (0x000314) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x018B (0x000316) 0x8402- f:00102 d: 2 | P = P + 2 (0x018D), A = 0
0x018C (0x000318) 0x7003- f:00070 d: 3 | P = P + 3 (0x018F)
0x018D (0x00031A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x018E (0x00031C) 0xE800- f:00164 d: 0 | IOB , fn004
0x018F (0x00031E) 0x211C- f:00020 d: 284 | A = OR[284]
0x0190 (0x000320) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0191 (0x000322) 0xE400- f:00162 d: 0 | IOB , fn002
0x0192 (0x000324) 0x211B- f:00020 d: 283 | A = OR[283]
0x0193 (0x000326) 0xE200- f:00161 d: 0 | IOB , fn001
0x0194 (0x000328) 0x2118- f:00020 d: 280 | A = OR[280]
0x0195 (0x00032A) 0x1426- f:00012 d: 38 | A = A + 38 (0x0026)
0x0196 (0x00032C) 0x2908- f:00024 d: 264 | OR[264] = A
0x0197 (0x00032E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0198 (0x000330) 0x0A02- f:00005 d: 2 | A = A < 2 (0x0002)
0x0199 (0x000332) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x019A (0x000334) 0x0C02- f:00006 d: 2 | A = A >> 2 (0x0002)
0x019B (0x000336) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x019C (0x000338) 0x7003- f:00070 d: 3 | P = P + 3 (0x019F)
0x019D (0x00033A) 0x1024- f:00010 d: 36 | A = 36 (0x0024)
0x019E (0x00033C) 0x291A- f:00024 d: 282 | OR[282] = A
0x019F (0x00033E) 0x0200- f:00001 d: 0 | EXIT
0x01A0 (0x000340) 0x211E- f:00020 d: 286 | A = OR[286]
0x01A1 (0x000342) 0x5800- f:00054 d: 0 | B = A
0x01A2 (0x000344) 0x5000- f:00050 d: 0 | A = B
0x01A3 (0x000346) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x01A4 (0x000348) 0x2908- f:00024 d: 264 | OR[264] = A
0x01A5 (0x00034A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01A6 (0x00034C) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x01A7 (0x00034E) 0x8402- f:00102 d: 2 | P = P + 2 (0x01A9), A = 0
0x01A8 (0x000350) 0x7006- f:00070 d: 6 | P = P + 6 (0x01AE)
0x01A9 (0x000352) 0x3118- f:00030 d: 280 | A = (OR[280])
0x01AA (0x000354) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x01AB (0x000356) 0x291E- f:00024 d: 286 | OR[286] = A
0x01AC (0x000358) 0x211E- f:00020 d: 286 | A = OR[286]
0x01AD (0x00035A) 0x5800- f:00054 d: 0 | B = A
0x01AE (0x00035C) 0x5000- f:00050 d: 0 | A = B
0x01AF (0x00035E) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x01B0 (0x000360) 0x2908- f:00024 d: 264 | OR[264] = A
0x01B1 (0x000362) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x01B2 (0x000364) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x01B3 (0x000366) 0x8402- f:00102 d: 2 | P = P + 2 (0x01B5), A = 0
0x01B4 (0x000368) 0x7014- f:00070 d: 20 | P = P + 20 (0x01C8)
0x01B5 (0x00036A) 0xE000- f:00160 d: 0 | IOB , fn000
0x01B6 (0x00036C) 0xE600- f:00163 d: 0 | IOB , fn003
0x01B7 (0x00036E) 0x1800-0x4000 f:00014 d: 0 | A = 16384 (0x4000)
0x01B9 (0x000372) 0xE800- f:00164 d: 0 | IOB , fn004
0x01BA (0x000374) 0x100A- f:00010 d: 10 | A = 10 (0x000A)
0x01BB (0x000376) 0x8403- f:00102 d: 3 | P = P + 3 (0x01BE), A = 0
0x01BC (0x000378) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x01BD (0x00037A) 0x7202- f:00071 d: 2 | P = P - 2 (0x01BB)
0x01BE (0x00037C) 0x211E- f:00020 d: 286 | A = OR[286]
0x01BF (0x00037E) 0x5800- f:00054 d: 0 | B = A
0x01C0 (0x000380) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01C1 (0x000382) 0xE800- f:00164 d: 0 | IOB , fn004
0x01C2 (0x000384) 0xE000- f:00160 d: 0 | IOB , fn000
0x01C3 (0x000386) 0xE600- f:00163 d: 0 | IOB , fn003
0x01C4 (0x000388) 0x1014- f:00010 d: 20 | A = 20 (0x0014)
0x01C5 (0x00038A) 0x8403- f:00102 d: 3 | P = P + 3 (0x01C8), A = 0
0x01C6 (0x00038C) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x01C7 (0x00038E) 0x7202- f:00071 d: 2 | P = P - 2 (0x01C5)
0x01C8 (0x000390) 0x3118- f:00030 d: 280 | A = (OR[280])
0x01C9 (0x000392) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x01CA (0x000394) 0x291E- f:00024 d: 286 | OR[286] = A
0x01CB (0x000396) 0x0200- f:00001 d: 0 | EXIT
0x01CC (0x000398) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01CD (0x00039A) 0x2924- f:00024 d: 292 | OR[292] = A
0x01CE (0x00039C) 0x211E- f:00020 d: 286 | A = OR[286]
0x01CF (0x00039E) 0x5800- f:00054 d: 0 | B = A
0x01D0 (0x0003A0) 0x0400- f:00002 d: 0 | I = 0
0x01D1 (0x0003A2) 0x0000- f:00000 d: 0 | PASS
0x01D2 (0x0003A4) 0x2118- f:00020 d: 280 | A = OR[280]
0x01D3 (0x0003A6) 0x1426- f:00012 d: 38 | A = A + 38 (0x0026)
0x01D4 (0x0003A8) 0x2908- f:00024 d: 264 | OR[264] = A
0x01D5 (0x0003AA) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01D6 (0x0003AC) 0x080E- f:00004 d: 14 | A = A > 14 (0x000E)
0x01D7 (0x0003AE) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x01D8 (0x0003B0) 0x2913- f:00024 d: 275 | OR[275] = A
0x01D9 (0x0003B2) 0x2113- f:00020 d: 275 | A = OR[275]
0x01DA (0x0003B4) 0x8403- f:00102 d: 3 | P = P + 3 (0x01DD), A = 0
0x01DB (0x0003B6) 0x7A03-0x022B f:00075 d: 3 | P = OR[3]+555 (0x022B)
0x01DD (0x0003BA) 0x2118- f:00020 d: 280 | A = OR[280]
0x01DE (0x0003BC) 0x1424- f:00012 d: 36 | A = A + 36 (0x0024)
0x01DF (0x0003BE) 0x2913- f:00024 d: 275 | OR[275] = A
0x01E0 (0x0003C0) 0x2124- f:00020 d: 292 | A = OR[292]
0x01E1 (0x0003C2) 0x2914- f:00024 d: 276 | OR[276] = A
0x01E2 (0x0003C4) 0x2114- f:00020 d: 276 | A = OR[276]
0x01E3 (0x0003C6) 0x8402- f:00102 d: 2 | P = P + 2 (0x01E5), A = 0
0x01E4 (0x0003C8) 0x7006- f:00070 d: 6 | P = P + 6 (0x01EA)
0x01E5 (0x0003CA) 0x2118- f:00020 d: 280 | A = OR[280]
0x01E6 (0x0003CC) 0x1421- f:00012 d: 33 | A = A + 33 (0x0021)
0x01E7 (0x0003CE) 0x2908- f:00024 d: 264 | OR[264] = A
0x01E8 (0x0003D0) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01E9 (0x0003D2) 0x2914- f:00024 d: 276 | OR[276] = A
0x01EA (0x0003D4) 0xEE00- f:00167 d: 0 | IOB , fn007
0x01EB (0x0003D6) 0x1009- f:00010 d: 9 | A = 9 (0x0009)
0x01EC (0x0003D8) 0x2926- f:00024 d: 294 | OR[294] = A
0x01ED (0x0003DA) 0x2113- f:00020 d: 275 | A = OR[275]
0x01EE (0x0003DC) 0x2927- f:00024 d: 295 | OR[295] = A
0x01EF (0x0003DE) 0x2114- f:00020 d: 276 | A = OR[276]
0x01F0 (0x0003E0) 0x2928- f:00024 d: 296 | OR[296] = A
0x01F1 (0x0003E2) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x01F2 (0x0003E4) 0x5800- f:00054 d: 0 | B = A
0x01F3 (0x0003E6) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x01F5 (0x0003EA) 0x7C09- f:00076 d: 9 | R = OR[9]
0x01F6 (0x0003EC) 0x2006- f:00020 d: 6 | A = OR[6]
0x01F7 (0x0003EE) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x01F8 (0x0003F0) 0x2908- f:00024 d: 264 | OR[264] = A
0x01F9 (0x0003F2) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01FA (0x0003F4) 0x0400- f:00002 d: 0 | I = 0
0x01FB (0x0003F6) 0x0000- f:00000 d: 0 | PASS
0x01FC (0x0003F8) 0x211E- f:00020 d: 286 | A = OR[286]
0x01FD (0x0003FA) 0x5800- f:00054 d: 0 | B = A
0x01FE (0x0003FC) 0x2118- f:00020 d: 280 | A = OR[280]
0x01FF (0x0003FE) 0x1426- f:00012 d: 38 | A = A + 38 (0x0026)
0x0200 (0x000400) 0x2908- f:00024 d: 264 | OR[264] = A
0x0201 (0x000402) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0202 (0x000404) 0x080E- f:00004 d: 14 | A = A > 14 (0x000E)
0x0203 (0x000406) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0204 (0x000408) 0x2913- f:00024 d: 275 | OR[275] = A
0x0205 (0x00040A) 0x2113- f:00020 d: 275 | A = OR[275]
0x0206 (0x00040C) 0x8402- f:00102 d: 2 | P = P + 2 (0x0208), A = 0
0x0207 (0x00040E) 0x701E- f:00070 d: 30 | P = P + 30 (0x0225)
0x0208 (0x000410) 0x2124- f:00020 d: 292 | A = OR[292]
0x0209 (0x000412) 0x8402- f:00102 d: 2 | P = P + 2 (0x020B), A = 0
0x020A (0x000414) 0x7008- f:00070 d: 8 | P = P + 8 (0x0212)
0x020B (0x000416) 0xF000- f:00170 d: 0 | IOB , fn010
0x020C (0x000418) 0x271B- f:00023 d: 283 | A = A - OR[283]
0x020D (0x00041A) 0x8602- f:00103 d: 2 | P = P + 2 (0x020F), A # 0
0x020E (0x00041C) 0x7004- f:00070 d: 4 | P = P + 4 (0x0212)
0x020F (0x00041E) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0210 (0x000420) 0x2924- f:00024 d: 292 | OR[292] = A
0x0211 (0x000422) 0x7243- f:00071 d: 67 | P = P - 67 (0x01CE)
0x0212 (0x000424) 0xE000- f:00160 d: 0 | IOB , fn000
0x0213 (0x000426) 0xE600- f:00163 d: 0 | IOB , fn003
0x0214 (0x000428) 0xEC00- f:00166 d: 0 | IOB , fn006
0x0215 (0x00042A) 0x5000- f:00050 d: 0 | A = B
0x0216 (0x00042C) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0217 (0x00042E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0218 (0x000430) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0219 (0x000432) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x021A (0x000434) 0x8402- f:00102 d: 2 | P = P + 2 (0x021C), A = 0
0x021B (0x000436) 0x7006- f:00070 d: 6 | P = P + 6 (0x0221)
0x021C (0x000438) 0x2118- f:00020 d: 280 | A = OR[280]
0x021D (0x00043A) 0x1421- f:00012 d: 33 | A = A + 33 (0x0021)
0x021E (0x00043C) 0x2908- f:00024 d: 264 | OR[264] = A
0x021F (0x00043E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0220 (0x000440) 0x2925- f:00024 d: 293 | OR[293] = A
0x0221 (0x000442) 0x0600- f:00003 d: 0 | I = 1
0x0222 (0x000444) 0x1020- f:00010 d: 32 | A = 32 (0x0020)
0x0223 (0x000446) 0x291A- f:00024 d: 282 | OR[282] = A
0x0224 (0x000448) 0x0200- f:00001 d: 0 | EXIT
0x0225 (0x00044A) 0x0600- f:00003 d: 0 | I = 1
0x0226 (0x00044C) 0x2118- f:00020 d: 280 | A = OR[280]
0x0227 (0x00044E) 0x141F- f:00012 d: 31 | A = A + 31 (0x001F)
0x0228 (0x000450) 0x2908- f:00024 d: 264 | OR[264] = A
0x0229 (0x000452) 0x211B- f:00020 d: 283 | A = OR[283]
0x022A (0x000454) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x022B (0x000456) 0x2118- f:00020 d: 280 | A = OR[280]
0x022C (0x000458) 0x1428- f:00012 d: 40 | A = A + 40 (0x0028)
0x022D (0x00045A) 0x2908- f:00024 d: 264 | OR[264] = A
0x022E (0x00045C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x022F (0x00045E) 0x2923- f:00024 d: 291 | OR[291] = A
0x0230 (0x000460) 0x2123- f:00020 d: 291 | A = OR[291]
0x0231 (0x000462) 0x271B- f:00023 d: 283 | A = A - OR[283]
0x0232 (0x000464) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x0233 (0x000466) 0x2923- f:00024 d: 291 | OR[291] = A
0x0234 (0x000468) 0x2118- f:00020 d: 280 | A = OR[280]
0x0235 (0x00046A) 0x1420- f:00012 d: 32 | A = A + 32 (0x0020)
0x0236 (0x00046C) 0x2908- f:00024 d: 264 | OR[264] = A
0x0237 (0x00046E) 0x2123- f:00020 d: 291 | A = OR[291]
0x0238 (0x000470) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0239 (0x000472) 0x2123- f:00020 d: 291 | A = OR[291]
0x023A (0x000474) 0x271C- f:00023 d: 284 | A = A - OR[284]
0x023B (0x000476) 0x8203- f:00101 d: 3 | P = P + 3 (0x023E), C = 1
0x023C (0x000478) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x023D (0x00047A) 0x291A- f:00024 d: 282 | OR[282] = A
0x023E (0x00047C) 0x211E- f:00020 d: 286 | A = OR[286]
0x023F (0x00047E) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0240 (0x000480) 0x2908- f:00024 d: 264 | OR[264] = A
0x0241 (0x000482) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0242 (0x000484) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0243 (0x000486) 0x8402- f:00102 d: 2 | P = P + 2 (0x0245), A = 0
0x0244 (0x000488) 0x703E- f:00070 d: 62 | P = P + 62 (0x0282)
0x0245 (0x00048A) 0x2118- f:00020 d: 280 | A = OR[280]
0x0246 (0x00048C) 0x1427- f:00012 d: 39 | A = A + 39 (0x0027)
0x0247 (0x00048E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0248 (0x000490) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0249 (0x000492) 0x2913- f:00024 d: 275 | OR[275] = A
0x024A (0x000494) 0x2113- f:00020 d: 275 | A = OR[275]
0x024B (0x000496) 0x1A00-0x7FFF f:00015 d: 0 | A = A & 32767 (0x7FFF)
0x024D (0x00049A) 0x2908- f:00024 d: 264 | OR[264] = A
0x024E (0x00049C) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x024F (0x00049E) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0250 (0x0004A0) 0x8602- f:00103 d: 2 | P = P + 2 (0x0252), A # 0
0x0251 (0x0004A2) 0x7008- f:00070 d: 8 | P = P + 8 (0x0259)
0x0252 (0x0004A4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0253 (0x0004A6) 0x291F- f:00024 d: 287 | OR[287] = A
0x0254 (0x0004A8) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0255 (0x0004AA) 0x2920- f:00024 d: 288 | OR[288] = A
0x0256 (0x0004AC) 0x1021- f:00010 d: 33 | A = 33 (0x0021)
0x0257 (0x0004AE) 0x291A- f:00024 d: 282 | OR[282] = A
0x0258 (0x0004B0) 0x0200- f:00001 d: 0 | EXIT
0x0259 (0x0004B2) 0x211F- f:00020 d: 287 | A = OR[287]
0x025A (0x0004B4) 0x8402- f:00102 d: 2 | P = P + 2 (0x025C), A = 0
0x025B (0x0004B6) 0x7005- f:00070 d: 5 | P = P + 5 (0x0260)
0x025C (0x0004B8) 0x2120- f:00020 d: 288 | A = OR[288]
0x025D (0x0004BA) 0x8402- f:00102 d: 2 | P = P + 2 (0x025F), A = 0
0x025E (0x0004BC) 0x7002- f:00070 d: 2 | P = P + 2 (0x0260)
0x025F (0x0004BE) 0x7424- f:00072 d: 36 | R = P + 36 (0x0283)
0x0260 (0x0004C0) 0x211A- f:00020 d: 282 | A = OR[282]
0x0261 (0x0004C2) 0x8602- f:00103 d: 2 | P = P + 2 (0x0263), A # 0
0x0262 (0x0004C4) 0x7016- f:00070 d: 22 | P = P + 22 (0x0278)
0x0263 (0x0004C6) 0x2123- f:00020 d: 291 | A = OR[291]
0x0264 (0x0004C8) 0x1407- f:00012 d: 7 | A = A + 7 (0x0007)
0x0265 (0x0004CA) 0x0803- f:00004 d: 3 | A = A > 3 (0x0003)
0x0266 (0x0004CC) 0x2913- f:00024 d: 275 | OR[275] = A
0x0267 (0x0004CE) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0268 (0x0004D0) 0x290F- f:00024 d: 271 | OR[271] = A
0x0269 (0x0004D2) 0x2120- f:00020 d: 288 | A = OR[288]
0x026A (0x0004D4) 0x2713- f:00023 d: 275 | A = A - OR[275]
0x026B (0x0004D6) 0x2920- f:00024 d: 288 | OR[288] = A
0x026C (0x0004D8) 0x8202- f:00101 d: 2 | P = P + 2 (0x026E), C = 1
0x026D (0x0004DA) 0x2F1F- f:00027 d: 287 | OR[287] = OR[287] - 1
0x026E (0x0004DC) 0x0810- f:00004 d: 16 | A = A > 16 (0x0010)
0x026F (0x0004DE) 0x230F- f:00021 d: 271 | A = A & OR[271]
0x0270 (0x0004E0) 0x8602- f:00103 d: 2 | P = P + 2 (0x0272), A # 0
0x0271 (0x0004E2) 0x7007- f:00070 d: 7 | P = P + 7 (0x0278)
0x0272 (0x0004E4) 0x2120- f:00020 d: 288 | A = OR[288]
0x0273 (0x0004E6) 0x8402- f:00102 d: 2 | P = P + 2 (0x0275), A = 0
0x0274 (0x0004E8) 0x0200- f:00001 d: 0 | EXIT
0x0275 (0x0004EA) 0x211F- f:00020 d: 287 | A = OR[287]
0x0276 (0x0004EC) 0x8402- f:00102 d: 2 | P = P + 2 (0x0278), A = 0
0x0277 (0x0004EE) 0x0200- f:00001 d: 0 | EXIT
0x0278 (0x0004F0) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0279 (0x0004F2) 0x291A- f:00024 d: 282 | OR[282] = A
0x027A (0x0004F4) 0x2121- f:00020 d: 289 | A = OR[289]
0x027B (0x0004F6) 0x291F- f:00024 d: 287 | OR[287] = A
0x027C (0x0004F8) 0x2122- f:00020 d: 290 | A = OR[290]
0x027D (0x0004FA) 0x2920- f:00024 d: 288 | OR[288] = A
0x027E (0x0004FC) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x027F (0x0004FE) 0x2921- f:00024 d: 289 | OR[289] = A
0x0280 (0x000500) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0281 (0x000502) 0x2922- f:00024 d: 290 | OR[290] = A
0x0282 (0x000504) 0x0200- f:00001 d: 0 | EXIT
0x0283 (0x000506) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0284 (0x000508) 0x291F- f:00024 d: 287 | OR[287] = A
0x0285 (0x00050A) 0x2920- f:00024 d: 288 | OR[288] = A
0x0286 (0x00050C) 0x2921- f:00024 d: 289 | OR[289] = A
0x0287 (0x00050E) 0x2922- f:00024 d: 290 | OR[290] = A
0x0288 (0x000510) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0289 (0x000512) 0x2913- f:00024 d: 275 | OR[275] = A
0x028A (0x000514) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x028B (0x000516) 0x2914- f:00024 d: 276 | OR[276] = A
0x028C (0x000518) 0x211B- f:00020 d: 283 | A = OR[283]
0x028D (0x00051A) 0x2915- f:00024 d: 277 | OR[277] = A
0x028E (0x00051C) 0x2114- f:00020 d: 276 | A = OR[276]
0x028F (0x00051E) 0x8411- f:00102 d: 17 | P = P + 17 (0x02A0), A = 0
0x0290 (0x000520) 0x3115- f:00030 d: 277 | A = (OR[277])
0x0291 (0x000522) 0x2916- f:00024 d: 278 | OR[278] = A
0x0292 (0x000524) 0x1800-0xFFFF f:00014 d: 0 | A = 65535 (0xFFFF)
0x0294 (0x000528) 0x2713- f:00023 d: 275 | A = A - OR[275]
0x0295 (0x00052A) 0x2316- f:00021 d: 278 | A = A & OR[278]
0x0296 (0x00052C) 0x290D- f:00024 d: 269 | OR[269] = A
0x0297 (0x00052E) 0x1800-0xFFFF f:00014 d: 0 | A = 65535 (0xFFFF)
0x0299 (0x000532) 0x2716- f:00023 d: 278 | A = A - OR[278]
0x029A (0x000534) 0x2313- f:00021 d: 275 | A = A & OR[275]
0x029B (0x000536) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x029C (0x000538) 0x2913- f:00024 d: 275 | OR[275] = A
0x029D (0x00053A) 0x2D15- f:00026 d: 277 | OR[277] = OR[277] + 1
0x029E (0x00053C) 0x2F14- f:00027 d: 276 | OR[276] = OR[276] - 1
0x029F (0x00053E) 0x7211- f:00071 d: 17 | P = P - 17 (0x028E)
0x02A0 (0x000540) 0x2113- f:00020 d: 275 | A = OR[275]
0x02A1 (0x000542) 0x8402- f:00102 d: 2 | P = P + 2 (0x02A3), A = 0
0x02A2 (0x000544) 0x0200- f:00001 d: 0 | EXIT
0x02A3 (0x000546) 0x211B- f:00020 d: 283 | A = OR[283]
0x02A4 (0x000548) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x02A5 (0x00054A) 0x2908- f:00024 d: 264 | OR[264] = A
0x02A6 (0x00054C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x02A7 (0x00054E) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x02A8 (0x000550) 0x2913- f:00024 d: 275 | OR[275] = A
0x02A9 (0x000552) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x02AA (0x000554) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x02AB (0x000556) 0x2908- f:00024 d: 264 | OR[264] = A
0x02AC (0x000558) 0x2113- f:00020 d: 275 | A = OR[275]
0x02AD (0x00055A) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x02AE (0x00055C) 0x8402- f:00102 d: 2 | P = P + 2 (0x02B0), A = 0
0x02AF (0x00055E) 0x0200- f:00001 d: 0 | EXIT
0x02B0 (0x000560) 0x211B- f:00020 d: 283 | A = OR[283]
0x02B1 (0x000562) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x02B2 (0x000564) 0x2908- f:00024 d: 264 | OR[264] = A
0x02B3 (0x000566) 0x3108- f:00030 d: 264 | A = (OR[264])
0x02B4 (0x000568) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x02B5 (0x00056A) 0x2914- f:00024 d: 276 | OR[276] = A
0x02B6 (0x00056C) 0x2113- f:00020 d: 275 | A = OR[275]
0x02B7 (0x00056E) 0x141C- f:00012 d: 28 | A = A + 28 (0x001C)
0x02B8 (0x000570) 0x2908- f:00024 d: 264 | OR[264] = A
0x02B9 (0x000572) 0x2114- f:00020 d: 276 | A = OR[276]
0x02BA (0x000574) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x02BB (0x000576) 0x2114- f:00020 d: 276 | A = OR[276]
0x02BC (0x000578) 0x8402- f:00102 d: 2 | P = P + 2 (0x02BE), A = 0
0x02BD (0x00057A) 0x0200- f:00001 d: 0 | EXIT
0x02BE (0x00057C) 0x211B- f:00020 d: 283 | A = OR[283]
0x02BF (0x00057E) 0x1405- f:00012 d: 5 | A = A + 5 (0x0005)
0x02C0 (0x000580) 0x2908- f:00024 d: 264 | OR[264] = A
0x02C1 (0x000582) 0x3108- f:00030 d: 264 | A = (OR[264])
0x02C2 (0x000584) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x02C3 (0x000586) 0x2913- f:00024 d: 275 | OR[275] = A
0x02C4 (0x000588) 0x211B- f:00020 d: 283 | A = OR[283]
0x02C5 (0x00058A) 0x1405- f:00012 d: 5 | A = A + 5 (0x0005)
0x02C6 (0x00058C) 0x2908- f:00024 d: 264 | OR[264] = A
0x02C7 (0x00058E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x02C8 (0x000590) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x02C9 (0x000592) 0x2914- f:00024 d: 276 | OR[276] = A
0x02CA (0x000594) 0x211B- f:00020 d: 283 | A = OR[283]
0x02CB (0x000596) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x02CC (0x000598) 0x2908- f:00024 d: 264 | OR[264] = A
0x02CD (0x00059A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x02CE (0x00059C) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x02CF (0x00059E) 0x2915- f:00024 d: 277 | OR[277] = A
0x02D0 (0x0005A0) 0x103F- f:00010 d: 63 | A = 63 (0x003F)
0x02D1 (0x0005A2) 0x2B15- f:00025 d: 277 | OR[277] = A + OR[277]
0x02D2 (0x0005A4) 0x2115- f:00020 d: 277 | A = OR[277]
0x02D3 (0x0005A6) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x02D4 (0x0005A8) 0x2514- f:00022 d: 276 | A = A + OR[276]
0x02D5 (0x0005AA) 0x2914- f:00024 d: 276 | OR[276] = A
0x02D6 (0x0005AC) 0x2114- f:00020 d: 276 | A = OR[276]
0x02D7 (0x0005AE) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x02D8 (0x0005B0) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x02D9 (0x0005B2) 0x2913- f:00024 d: 275 | OR[275] = A
0x02DA (0x0005B4) 0x2115- f:00020 d: 277 | A = OR[277]
0x02DB (0x0005B6) 0x0806- f:00004 d: 6 | A = A > 6 (0x0006)
0x02DC (0x0005B8) 0x1203- f:00011 d: 3 | A = A & 3 (0x0003)
0x02DD (0x0005BA) 0x2920- f:00024 d: 288 | OR[288] = A
0x02DE (0x0005BC) 0x2114- f:00020 d: 276 | A = OR[276]
0x02DF (0x0005BE) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x02E0 (0x0005C0) 0x0A02- f:00005 d: 2 | A = A < 2 (0x0002)
0x02E1 (0x0005C2) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x02E2 (0x0005C4) 0x2920- f:00024 d: 288 | OR[288] = A
0x02E3 (0x0005C6) 0x2113- f:00020 d: 275 | A = OR[275]
0x02E4 (0x0005C8) 0x123F- f:00011 d: 63 | A = A & 63 (0x003F)
0x02E5 (0x0005CA) 0x0A0A- f:00005 d: 10 | A = A < 10 (0x000A)
0x02E6 (0x0005CC) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x02E7 (0x0005CE) 0x2920- f:00024 d: 288 | OR[288] = A
0x02E8 (0x0005D0) 0x2113- f:00020 d: 275 | A = OR[275]
0x02E9 (0x0005D2) 0x0806- f:00004 d: 6 | A = A > 6 (0x0006)
0x02EA (0x0005D4) 0x1203- f:00011 d: 3 | A = A & 3 (0x0003)
0x02EB (0x0005D6) 0x291F- f:00024 d: 287 | OR[287] = A
0x02EC (0x0005D8) 0x2118- f:00020 d: 280 | A = OR[280]
0x02ED (0x0005DA) 0x1419- f:00012 d: 25 | A = A + 25 (0x0019)
0x02EE (0x0005DC) 0x2908- f:00024 d: 264 | OR[264] = A
0x02EF (0x0005DE) 0x3108- f:00030 d: 264 | A = (OR[264])
0x02F0 (0x0005E0) 0x2913- f:00024 d: 275 | OR[275] = A
0x02F1 (0x0005E2) 0x2113- f:00020 d: 275 | A = OR[275]
0x02F2 (0x0005E4) 0x141D- f:00012 d: 29 | A = A + 29 (0x001D)
0x02F3 (0x0005E6) 0x2908- f:00024 d: 264 | OR[264] = A
0x02F4 (0x0005E8) 0x2120- f:00020 d: 288 | A = OR[288]
0x02F5 (0x0005EA) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x02F6 (0x0005EC) 0x211B- f:00020 d: 283 | A = OR[283]
0x02F7 (0x0005EE) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x02F8 (0x0005F0) 0x2908- f:00024 d: 264 | OR[264] = A
0x02F9 (0x0005F2) 0x3108- f:00030 d: 264 | A = (OR[264])
0x02FA (0x0005F4) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x02FB (0x0005F6) 0x2913- f:00024 d: 275 | OR[275] = A
0x02FC (0x0005F8) 0x211B- f:00020 d: 283 | A = OR[283]
0x02FD (0x0005FA) 0x1407- f:00012 d: 7 | A = A + 7 (0x0007)
0x02FE (0x0005FC) 0x2908- f:00024 d: 264 | OR[264] = A
0x02FF (0x0005FE) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0300 (0x000600) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0301 (0x000602) 0x2914- f:00024 d: 276 | OR[276] = A
0x0302 (0x000604) 0x211B- f:00020 d: 283 | A = OR[283]
0x0303 (0x000606) 0x1407- f:00012 d: 7 | A = A + 7 (0x0007)
0x0304 (0x000608) 0x2908- f:00024 d: 264 | OR[264] = A
0x0305 (0x00060A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0306 (0x00060C) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0307 (0x00060E) 0x2915- f:00024 d: 277 | OR[277] = A
0x0308 (0x000610) 0x2113- f:00020 d: 275 | A = OR[275]
0x0309 (0x000612) 0x2514- f:00022 d: 276 | A = A + OR[276]
0x030A (0x000614) 0x8605- f:00103 d: 5 | P = P + 5 (0x030F), A # 0
0x030B (0x000616) 0x2115- f:00020 d: 277 | A = OR[277]
0x030C (0x000618) 0x1780- f:00013 d: 384 | A = A - 384 (0x0180)
0x030D (0x00061A) 0x8202- f:00101 d: 2 | P = P + 2 (0x030F), C = 1
0x030E (0x00061C) 0x700C- f:00070 d: 12 | P = P + 12 (0x031A)
0x030F (0x00061E) 0x103F- f:00010 d: 63 | A = 63 (0x003F)
0x0310 (0x000620) 0x2B15- f:00025 d: 277 | OR[277] = A + OR[277]
0x0311 (0x000622) 0x2115- f:00020 d: 277 | A = OR[277]
0x0312 (0x000624) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0313 (0x000626) 0x2514- f:00022 d: 276 | A = A + OR[276]
0x0314 (0x000628) 0x2914- f:00024 d: 276 | OR[276] = A
0x0315 (0x00062A) 0x2114- f:00020 d: 276 | A = OR[276]
0x0316 (0x00062C) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0317 (0x00062E) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x0318 (0x000630) 0x2913- f:00024 d: 275 | OR[275] = A
0x0319 (0x000632) 0x7006- f:00070 d: 6 | P = P + 6 (0x031F)
0x031A (0x000634) 0x1180- f:00010 d: 384 | A = 384 (0x0180)
0x031B (0x000636) 0x2915- f:00024 d: 277 | OR[277] = A
0x031C (0x000638) 0x2115- f:00020 d: 277 | A = OR[277]
0x031D (0x00063A) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x031E (0x00063C) 0x2914- f:00024 d: 276 | OR[276] = A
0x031F (0x00063E) 0x2115- f:00020 d: 277 | A = OR[277]
0x0320 (0x000640) 0x0806- f:00004 d: 6 | A = A > 6 (0x0006)
0x0321 (0x000642) 0x1203- f:00011 d: 3 | A = A & 3 (0x0003)
0x0322 (0x000644) 0x2922- f:00024 d: 290 | OR[290] = A
0x0323 (0x000646) 0x2114- f:00020 d: 276 | A = OR[276]
0x0324 (0x000648) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0325 (0x00064A) 0x0A02- f:00005 d: 2 | A = A < 2 (0x0002)
0x0326 (0x00064C) 0x2522- f:00022 d: 290 | A = A + OR[290]
0x0327 (0x00064E) 0x2922- f:00024 d: 290 | OR[290] = A
0x0328 (0x000650) 0x2113- f:00020 d: 275 | A = OR[275]
0x0329 (0x000652) 0x123F- f:00011 d: 63 | A = A & 63 (0x003F)
0x032A (0x000654) 0x0A0A- f:00005 d: 10 | A = A < 10 (0x000A)
0x032B (0x000656) 0x2522- f:00022 d: 290 | A = A + OR[290]
0x032C (0x000658) 0x2922- f:00024 d: 290 | OR[290] = A
0x032D (0x00065A) 0x2113- f:00020 d: 275 | A = OR[275]
0x032E (0x00065C) 0x0806- f:00004 d: 6 | A = A > 6 (0x0006)
0x032F (0x00065E) 0x1203- f:00011 d: 3 | A = A & 3 (0x0003)
0x0330 (0x000660) 0x2921- f:00024 d: 289 | OR[289] = A
0x0331 (0x000662) 0x2118- f:00020 d: 280 | A = OR[280]
0x0332 (0x000664) 0x1419- f:00012 d: 25 | A = A + 25 (0x0019)
0x0333 (0x000666) 0x2908- f:00024 d: 264 | OR[264] = A
0x0334 (0x000668) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0335 (0x00066A) 0x2913- f:00024 d: 275 | OR[275] = A
0x0336 (0x00066C) 0x2113- f:00020 d: 275 | A = OR[275]
0x0337 (0x00066E) 0x141E- f:00012 d: 30 | A = A + 30 (0x001E)
0x0338 (0x000670) 0x2908- f:00024 d: 264 | OR[264] = A
0x0339 (0x000672) 0x2121- f:00020 d: 289 | A = OR[289]
0x033A (0x000674) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x033B (0x000676) 0x2113- f:00020 d: 275 | A = OR[275]
0x033C (0x000678) 0x141F- f:00012 d: 31 | A = A + 31 (0x001F)
0x033D (0x00067A) 0x2908- f:00024 d: 264 | OR[264] = A
0x033E (0x00067C) 0x2122- f:00020 d: 290 | A = OR[290]
0x033F (0x00067E) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0340 (0x000680) 0x0200- f:00001 d: 0 | EXIT
0x0341 (0x000682) 0x0000- f:00000 d: 0 | PASS
0x0342 (0x000684) 0x0000- f:00000 d: 0 | PASS
0x0343 (0x000686) 0x0000- f:00000 d: 0 | PASS
|
oeis/297/A297446.asm | neoneye/loda-programs | 11 | 87034 | <filename>oeis/297/A297446.asm
; A297446: a(1) = 1; a(n) = (2^n - 1)*((3^n - 1)/(2^n - 1) mod 1), n >= 2. Unreduced numerators of fractional parts of (3^n - 1)/(2^n - 1).
; Submitted by <NAME>
; 1,2,5,5,25,35,27,185,264,737,1104,3185,5268,15515,29727,55760,35227,235277,441474,272525,1861165,3478865,6231072,1899170,5672261,50533340,17325481,186108950,21328108,63792575,1264831924,3794064335,7086578553,12668830331,20825165703,28113574580,84337447496,253007428121,484137005868,352888332500,1058648411504,3175920355517,5129677236954,15388975733120,10982471143915,68131659570653,134026045609410,120602876730245,80333228399082,240999047575748,722996186294996,2168987124236615,2003359593366789
add $0,1
mov $1,3
pow $1,$0
mov $2,2
pow $2,$0
sub $1,$2
sub $1,1
sub $2,1
mod $1,$2
mov $0,$1
add $0,1
|
src/lab-code/howmany/src/main.adb | hannesb0/rtpl18 | 0 | 25776 | with Ada.Numerics.Generic_Elementary_Functions;
procedure main with SPARK_Mode is
-- user-defined float type
type Meters is new Float range 0.0 .. 1_000_000.0;
-- instantiate generic package for my type
package Meter_Functions is new Ada.Numerics.Generic_Elementary_Functions (Meters);
use Meter_Functions;
-- define a new vector type that can be indexed with an enum
type Cartesian is (X, Y, Z);
type Vector_3D_Type is array (Cartesian) of Meters;
-- declaration of function with contract
function "abs" (v : Vector_3D_Type) return Meters
with Pre => True; -- prevent inlining
-- definition of the function
function "abs" (v : Vector_3D_Type) return Meters is
m : Meters;
begin
m := (v(X)*v(X) + v(Y)*v(Y)) + v(Z)*v(Z);
return m;
end "abs";
-- main's stack variables
l : Meters;
v : Vector_3D_Type;
begin
--v(X) := Meters'Last;
l := abs (v);
end main;
|
prod-cons.asm | zzddhhtjzz/xv6 | 0 | 85584 | <reponame>zzddhhtjzz/xv6<filename>prod-cons.asm
_prod-cons: file format elf32-i386
Disassembly of section .text:
00000000 <put>:
mpthread_mutex_t mutex;
mpthread_cond_t empty;
mpthread_cond_t full;
void put(int value){
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
buffer[right] = value;
3: a1 a8 11 00 00 mov 0x11a8,%eax
8: 8b 55 08 mov 0x8(%ebp),%edx
b: 89 14 85 c0 11 00 00 mov %edx,0x11c0(,%eax,4)
right = (right +1) % SIZE;
12: a1 a8 11 00 00 mov 0x11a8,%eax
17: 8d 48 01 lea 0x1(%eax),%ecx
1a: ba 67 66 66 66 mov $0x66666667,%edx
1f: 89 c8 mov %ecx,%eax
21: f7 ea imul %edx
23: c1 fa 02 sar $0x2,%edx
26: 89 c8 mov %ecx,%eax
28: c1 f8 1f sar $0x1f,%eax
2b: 29 c2 sub %eax,%edx
2d: 89 d0 mov %edx,%eax
2f: c1 e0 02 shl $0x2,%eax
32: 01 d0 add %edx,%eax
34: 01 c0 add %eax,%eax
36: 29 c1 sub %eax,%ecx
38: 89 ca mov %ecx,%edx
3a: 89 15 a8 11 00 00 mov %edx,0x11a8
count ++;
40: a1 e8 11 00 00 mov 0x11e8,%eax
45: 83 c0 01 add $0x1,%eax
48: a3 e8 11 00 00 mov %eax,0x11e8
}
4d: 5d pop %ebp
4e: c3 ret
0000004f <get>:
int get(){
4f: 55 push %ebp
50: 89 e5 mov %esp,%ebp
52: 83 ec 10 sub $0x10,%esp
int value = buffer[left];
55: a1 ac 11 00 00 mov 0x11ac,%eax
5a: 8b 04 85 c0 11 00 00 mov 0x11c0(,%eax,4),%eax
61: 89 45 fc mov %eax,-0x4(%ebp)
left = (left + 1) % SIZE;
64: a1 ac 11 00 00 mov 0x11ac,%eax
69: 8d 48 01 lea 0x1(%eax),%ecx
6c: ba 67 66 66 66 mov $0x66666667,%edx
71: 89 c8 mov %ecx,%eax
73: f7 ea imul %edx
75: c1 fa 02 sar $0x2,%edx
78: 89 c8 mov %ecx,%eax
7a: c1 f8 1f sar $0x1f,%eax
7d: 29 c2 sub %eax,%edx
7f: 89 d0 mov %edx,%eax
81: c1 e0 02 shl $0x2,%eax
84: 01 d0 add %edx,%eax
86: 01 c0 add %eax,%eax
88: 29 c1 sub %eax,%ecx
8a: 89 ca mov %ecx,%edx
8c: 89 15 ac 11 00 00 mov %edx,0x11ac
count --;
92: a1 e8 11 00 00 mov 0x11e8,%eax
97: 83 e8 01 sub $0x1,%eax
9a: a3 e8 11 00 00 mov %eax,0x11e8
return value;
9f: 8b 45 fc mov -0x4(%ebp),%eax
}
a2: c9 leave
a3: c3 ret
000000a4 <producer>:
void producer(void *arg)
{
a4: 55 push %ebp
a5: 89 e5 mov %esp,%ebp
a7: 83 ec 28 sub $0x28,%esp
int i;
for(i = 0; i< NITER; i++)
aa: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
b1: eb 53 jmp 106 <producer+0x62>
{
pthread_mutex_lock(&mutex);
b3: c7 04 24 b0 11 00 00 movl $0x11b0,(%esp)
ba: e8 4f 0a 00 00 call b0e <pthread_mutex_lock>
while(count == SIZE)
bf: eb 14 jmp d5 <producer+0x31>
pthread_cond_wait(&full, &mutex);
c1: c7 44 24 04 b0 11 00 movl $0x11b0,0x4(%esp)
c8: 00
c9: c7 04 24 a0 11 00 00 movl $0x11a0,(%esp)
d0: e8 8f 0a 00 00 call b64 <pthread_cond_wait>
{
int i;
for(i = 0; i< NITER; i++)
{
pthread_mutex_lock(&mutex);
while(count == SIZE)
d5: a1 e8 11 00 00 mov 0x11e8,%eax
da: 83 f8 0a cmp $0xa,%eax
dd: 74 e2 je c1 <producer+0x1d>
pthread_cond_wait(&full, &mutex);
put(i);
df: 8b 45 f4 mov -0xc(%ebp),%eax
e2: 89 04 24 mov %eax,(%esp)
e5: e8 16 ff ff ff call 0 <put>
pthread_cond_signal(&empty);
ea: c7 04 24 ec 11 00 00 movl $0x11ec,(%esp)
f1: e8 fa 0a 00 00 call bf0 <pthread_cond_signal>
pthread_mutex_unlock(&mutex);
f6: c7 04 24 b0 11 00 00 movl $0x11b0,(%esp)
fd: e8 2d 0a 00 00 call b2f <pthread_mutex_unlock>
}
void producer(void *arg)
{
int i;
for(i = 0; i< NITER; i++)
102: 83 45 f4 01 addl $0x1,-0xc(%ebp)
106: 83 7d f4 31 cmpl $0x31,-0xc(%ebp)
10a: 7e a7 jle b3 <producer+0xf>
pthread_cond_wait(&full, &mutex);
put(i);
pthread_cond_signal(&empty);
pthread_mutex_unlock(&mutex);
}
exit();
10c: e8 ab 03 00 00 call 4bc <exit>
00000111 <consumer>:
}
void consumer(void *arg){
111: 55 push %ebp
112: 89 e5 mov %esp,%ebp
114: 83 ec 28 sub $0x28,%esp
int i;
for(i=0; i < NITER; i++){
117: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
11e: eb 70 jmp 190 <consumer+0x7f>
pthread_mutex_lock(&mutex);
120: c7 04 24 b0 11 00 00 movl $0x11b0,(%esp)
127: e8 e2 09 00 00 call b0e <pthread_mutex_lock>
while(count == 0)
12c: eb 14 jmp 142 <consumer+0x31>
pthread_cond_wait(&full, &mutex);
12e: c7 44 24 04 b0 11 00 movl $0x11b0,0x4(%esp)
135: 00
136: c7 04 24 a0 11 00 00 movl $0x11a0,(%esp)
13d: e8 22 0a 00 00 call b64 <pthread_cond_wait>
void consumer(void *arg){
int i;
for(i=0; i < NITER; i++){
pthread_mutex_lock(&mutex);
while(count == 0)
142: a1 e8 11 00 00 mov 0x11e8,%eax
147: 85 c0 test %eax,%eax
149: 74 e3 je 12e <consumer+0x1d>
pthread_cond_wait(&full, &mutex);
int value = get(i);
14b: 8b 45 f4 mov -0xc(%ebp),%eax
14e: 89 04 24 mov %eax,(%esp)
151: e8 f9 fe ff ff call 4f <get>
156: 89 45 f0 mov %eax,-0x10(%ebp)
pthread_cond_signal(&full);
159: c7 04 24 a0 11 00 00 movl $0x11a0,(%esp)
160: e8 8b 0a 00 00 call bf0 <pthread_cond_signal>
pthread_mutex_unlock(&mutex);
165: c7 04 24 b0 11 00 00 movl $0x11b0,(%esp)
16c: e8 be 09 00 00 call b2f <pthread_mutex_unlock>
printf(1, "%d\n", value);
171: 8b 45 f0 mov -0x10(%ebp),%eax
174: 89 44 24 08 mov %eax,0x8(%esp)
178: c7 44 24 04 d8 0c 00 movl $0xcd8,0x4(%esp)
17f: 00
180: c7 04 24 01 00 00 00 movl $0x1,(%esp)
187: e8 d8 04 00 00 call 664 <printf>
exit();
}
void consumer(void *arg){
int i;
for(i=0; i < NITER; i++){
18c: 83 45 f4 01 addl $0x1,-0xc(%ebp)
190: 83 7d f4 31 cmpl $0x31,-0xc(%ebp)
194: 7e 8a jle 120 <consumer+0xf>
int value = get(i);
pthread_cond_signal(&full);
pthread_mutex_unlock(&mutex);
printf(1, "%d\n", value);
}
exit();
196: e8 21 03 00 00 call 4bc <exit>
0000019b <main>:
}
int main(){
19b: 55 push %ebp
19c: 89 e5 mov %esp,%ebp
19e: 83 e4 f0 and $0xfffffff0,%esp
1a1: 83 ec 20 sub $0x20,%esp
printf(1, "Parent starts\n");
1a4: c7 44 24 04 dc 0c 00 movl $0xcdc,0x4(%esp)
1ab: 00
1ac: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1b3: e8 ac 04 00 00 call 664 <printf>
mpthread_t p1, p2;
pthread_mutex_init(&mutex);
1b8: c7 04 24 b0 11 00 00 movl $0x11b0,(%esp)
1bf: e8 3b 09 00 00 call aff <pthread_mutex_init>
pthread_cond_init(&empty);
1c4: c7 04 24 ec 11 00 00 movl $0x11ec,(%esp)
1cb: e8 7b 09 00 00 call b4b <pthread_cond_init>
pthread_cond_init(&full);
1d0: c7 04 24 a0 11 00 00 movl $0x11a0,(%esp)
1d7: e8 6f 09 00 00 call b4b <pthread_cond_init>
pthread_create(&p1, NULL, producer, NULL);
1dc: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
1e3: 00
1e4: c7 44 24 08 a4 00 00 movl $0xa4,0x8(%esp)
1eb: 00
1ec: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1f3: 00
1f4: 8d 44 24 1c lea 0x1c(%esp),%eax
1f8: 89 04 24 mov %eax,(%esp)
1fb: e8 4e 08 00 00 call a4e <pthread_create>
pthread_create(&p2, NULL, consumer, NULL);
200: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
207: 00
208: c7 44 24 08 11 01 00 movl $0x111,0x8(%esp)
20f: 00
210: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
217: 00
218: 8d 44 24 18 lea 0x18(%esp),%eax
21c: 89 04 24 mov %eax,(%esp)
21f: e8 2a 08 00 00 call a4e <pthread_create>
pthread_join(p1, NULL);
224: 8b 44 24 1c mov 0x1c(%esp),%eax
228: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
22f: 00
230: 89 04 24 mov %eax,(%esp)
233: e8 92 08 00 00 call aca <pthread_join>
pthread_join(p2, NULL);
238: 8b 44 24 18 mov 0x18(%esp),%eax
23c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
243: 00
244: 89 04 24 mov %eax,(%esp)
247: e8 7e 08 00 00 call aca <pthread_join>
exit();
24c: e8 6b 02 00 00 call 4bc <exit>
251: 66 90 xchg %ax,%ax
253: 90 nop
00000254 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
254: 55 push %ebp
255: 89 e5 mov %esp,%ebp
257: 57 push %edi
258: 53 push %ebx
asm volatile("cld; rep stosb" :
259: 8b 4d 08 mov 0x8(%ebp),%ecx
25c: 8b 55 10 mov 0x10(%ebp),%edx
25f: 8b 45 0c mov 0xc(%ebp),%eax
262: 89 cb mov %ecx,%ebx
264: 89 df mov %ebx,%edi
266: 89 d1 mov %edx,%ecx
268: fc cld
269: f3 aa rep stos %al,%es:(%edi)
26b: 89 ca mov %ecx,%edx
26d: 89 fb mov %edi,%ebx
26f: 89 5d 08 mov %ebx,0x8(%ebp)
272: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
275: 5b pop %ebx
276: 5f pop %edi
277: 5d pop %ebp
278: c3 ret
00000279 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
279: 55 push %ebp
27a: 89 e5 mov %esp,%ebp
27c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
27f: 8b 45 08 mov 0x8(%ebp),%eax
282: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
285: 90 nop
286: 8b 45 08 mov 0x8(%ebp),%eax
289: 8d 50 01 lea 0x1(%eax),%edx
28c: 89 55 08 mov %edx,0x8(%ebp)
28f: 8b 55 0c mov 0xc(%ebp),%edx
292: 8d 4a 01 lea 0x1(%edx),%ecx
295: 89 4d 0c mov %ecx,0xc(%ebp)
298: 0f b6 12 movzbl (%edx),%edx
29b: 88 10 mov %dl,(%eax)
29d: 0f b6 00 movzbl (%eax),%eax
2a0: 84 c0 test %al,%al
2a2: 75 e2 jne 286 <strcpy+0xd>
;
return os;
2a4: 8b 45 fc mov -0x4(%ebp),%eax
}
2a7: c9 leave
2a8: c3 ret
000002a9 <strcmp>:
int
strcmp(const char *p, const char *q)
{
2a9: 55 push %ebp
2aa: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
2ac: eb 08 jmp 2b6 <strcmp+0xd>
p++, q++;
2ae: 83 45 08 01 addl $0x1,0x8(%ebp)
2b2: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
2b6: 8b 45 08 mov 0x8(%ebp),%eax
2b9: 0f b6 00 movzbl (%eax),%eax
2bc: 84 c0 test %al,%al
2be: 74 10 je 2d0 <strcmp+0x27>
2c0: 8b 45 08 mov 0x8(%ebp),%eax
2c3: 0f b6 10 movzbl (%eax),%edx
2c6: 8b 45 0c mov 0xc(%ebp),%eax
2c9: 0f b6 00 movzbl (%eax),%eax
2cc: 38 c2 cmp %al,%dl
2ce: 74 de je 2ae <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
2d0: 8b 45 08 mov 0x8(%ebp),%eax
2d3: 0f b6 00 movzbl (%eax),%eax
2d6: 0f b6 d0 movzbl %al,%edx
2d9: 8b 45 0c mov 0xc(%ebp),%eax
2dc: 0f b6 00 movzbl (%eax),%eax
2df: 0f b6 c0 movzbl %al,%eax
2e2: 29 c2 sub %eax,%edx
2e4: 89 d0 mov %edx,%eax
}
2e6: 5d pop %ebp
2e7: c3 ret
000002e8 <strlen>:
uint
strlen(char *s)
{
2e8: 55 push %ebp
2e9: 89 e5 mov %esp,%ebp
2eb: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
2ee: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
2f5: eb 04 jmp 2fb <strlen+0x13>
2f7: 83 45 fc 01 addl $0x1,-0x4(%ebp)
2fb: 8b 55 fc mov -0x4(%ebp),%edx
2fe: 8b 45 08 mov 0x8(%ebp),%eax
301: 01 d0 add %edx,%eax
303: 0f b6 00 movzbl (%eax),%eax
306: 84 c0 test %al,%al
308: 75 ed jne 2f7 <strlen+0xf>
;
return n;
30a: 8b 45 fc mov -0x4(%ebp),%eax
}
30d: c9 leave
30e: c3 ret
0000030f <memset>:
void*
memset(void *dst, int c, uint n)
{
30f: 55 push %ebp
310: 89 e5 mov %esp,%ebp
312: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
315: 8b 45 10 mov 0x10(%ebp),%eax
318: 89 44 24 08 mov %eax,0x8(%esp)
31c: 8b 45 0c mov 0xc(%ebp),%eax
31f: 89 44 24 04 mov %eax,0x4(%esp)
323: 8b 45 08 mov 0x8(%ebp),%eax
326: 89 04 24 mov %eax,(%esp)
329: e8 26 ff ff ff call 254 <stosb>
return dst;
32e: 8b 45 08 mov 0x8(%ebp),%eax
}
331: c9 leave
332: c3 ret
00000333 <strchr>:
char*
strchr(const char *s, char c)
{
333: 55 push %ebp
334: 89 e5 mov %esp,%ebp
336: 83 ec 04 sub $0x4,%esp
339: 8b 45 0c mov 0xc(%ebp),%eax
33c: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
33f: eb 14 jmp 355 <strchr+0x22>
if(*s == c)
341: 8b 45 08 mov 0x8(%ebp),%eax
344: 0f b6 00 movzbl (%eax),%eax
347: 3a 45 fc cmp -0x4(%ebp),%al
34a: 75 05 jne 351 <strchr+0x1e>
return (char*)s;
34c: 8b 45 08 mov 0x8(%ebp),%eax
34f: eb 13 jmp 364 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
351: 83 45 08 01 addl $0x1,0x8(%ebp)
355: 8b 45 08 mov 0x8(%ebp),%eax
358: 0f b6 00 movzbl (%eax),%eax
35b: 84 c0 test %al,%al
35d: 75 e2 jne 341 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
35f: b8 00 00 00 00 mov $0x0,%eax
}
364: c9 leave
365: c3 ret
00000366 <gets>:
char*
gets(char *buf, int max)
{
366: 55 push %ebp
367: 89 e5 mov %esp,%ebp
369: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
36c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
373: eb 4c jmp 3c1 <gets+0x5b>
cc = read(0, &c, 1);
375: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
37c: 00
37d: 8d 45 ef lea -0x11(%ebp),%eax
380: 89 44 24 04 mov %eax,0x4(%esp)
384: c7 04 24 00 00 00 00 movl $0x0,(%esp)
38b: e8 44 01 00 00 call 4d4 <read>
390: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
393: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
397: 7f 02 jg 39b <gets+0x35>
break;
399: eb 31 jmp 3cc <gets+0x66>
buf[i++] = c;
39b: 8b 45 f4 mov -0xc(%ebp),%eax
39e: 8d 50 01 lea 0x1(%eax),%edx
3a1: 89 55 f4 mov %edx,-0xc(%ebp)
3a4: 89 c2 mov %eax,%edx
3a6: 8b 45 08 mov 0x8(%ebp),%eax
3a9: 01 c2 add %eax,%edx
3ab: 0f b6 45 ef movzbl -0x11(%ebp),%eax
3af: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
3b1: 0f b6 45 ef movzbl -0x11(%ebp),%eax
3b5: 3c 0a cmp $0xa,%al
3b7: 74 13 je 3cc <gets+0x66>
3b9: 0f b6 45 ef movzbl -0x11(%ebp),%eax
3bd: 3c 0d cmp $0xd,%al
3bf: 74 0b je 3cc <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
3c1: 8b 45 f4 mov -0xc(%ebp),%eax
3c4: 83 c0 01 add $0x1,%eax
3c7: 3b 45 0c cmp 0xc(%ebp),%eax
3ca: 7c a9 jl 375 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
3cc: 8b 55 f4 mov -0xc(%ebp),%edx
3cf: 8b 45 08 mov 0x8(%ebp),%eax
3d2: 01 d0 add %edx,%eax
3d4: c6 00 00 movb $0x0,(%eax)
return buf;
3d7: 8b 45 08 mov 0x8(%ebp),%eax
}
3da: c9 leave
3db: c3 ret
000003dc <stat>:
int
stat(char *n, struct stat *st)
{
3dc: 55 push %ebp
3dd: 89 e5 mov %esp,%ebp
3df: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
3e2: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3e9: 00
3ea: 8b 45 08 mov 0x8(%ebp),%eax
3ed: 89 04 24 mov %eax,(%esp)
3f0: e8 07 01 00 00 call 4fc <open>
3f5: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
3f8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
3fc: 79 07 jns 405 <stat+0x29>
return -1;
3fe: b8 ff ff ff ff mov $0xffffffff,%eax
403: eb 23 jmp 428 <stat+0x4c>
r = fstat(fd, st);
405: 8b 45 0c mov 0xc(%ebp),%eax
408: 89 44 24 04 mov %eax,0x4(%esp)
40c: 8b 45 f4 mov -0xc(%ebp),%eax
40f: 89 04 24 mov %eax,(%esp)
412: e8 fd 00 00 00 call 514 <fstat>
417: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
41a: 8b 45 f4 mov -0xc(%ebp),%eax
41d: 89 04 24 mov %eax,(%esp)
420: e8 bf 00 00 00 call 4e4 <close>
return r;
425: 8b 45 f0 mov -0x10(%ebp),%eax
}
428: c9 leave
429: c3 ret
0000042a <atoi>:
int
atoi(const char *s)
{
42a: 55 push %ebp
42b: 89 e5 mov %esp,%ebp
42d: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
430: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
437: eb 25 jmp 45e <atoi+0x34>
n = n*10 + *s++ - '0';
439: 8b 55 fc mov -0x4(%ebp),%edx
43c: 89 d0 mov %edx,%eax
43e: c1 e0 02 shl $0x2,%eax
441: 01 d0 add %edx,%eax
443: 01 c0 add %eax,%eax
445: 89 c1 mov %eax,%ecx
447: 8b 45 08 mov 0x8(%ebp),%eax
44a: 8d 50 01 lea 0x1(%eax),%edx
44d: 89 55 08 mov %edx,0x8(%ebp)
450: 0f b6 00 movzbl (%eax),%eax
453: 0f be c0 movsbl %al,%eax
456: 01 c8 add %ecx,%eax
458: 83 e8 30 sub $0x30,%eax
45b: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
45e: 8b 45 08 mov 0x8(%ebp),%eax
461: 0f b6 00 movzbl (%eax),%eax
464: 3c 2f cmp $0x2f,%al
466: 7e 0a jle 472 <atoi+0x48>
468: 8b 45 08 mov 0x8(%ebp),%eax
46b: 0f b6 00 movzbl (%eax),%eax
46e: 3c 39 cmp $0x39,%al
470: 7e c7 jle 439 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
472: 8b 45 fc mov -0x4(%ebp),%eax
}
475: c9 leave
476: c3 ret
00000477 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
477: 55 push %ebp
478: 89 e5 mov %esp,%ebp
47a: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
47d: 8b 45 08 mov 0x8(%ebp),%eax
480: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
483: 8b 45 0c mov 0xc(%ebp),%eax
486: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
489: eb 17 jmp 4a2 <memmove+0x2b>
*dst++ = *src++;
48b: 8b 45 fc mov -0x4(%ebp),%eax
48e: 8d 50 01 lea 0x1(%eax),%edx
491: 89 55 fc mov %edx,-0x4(%ebp)
494: 8b 55 f8 mov -0x8(%ebp),%edx
497: 8d 4a 01 lea 0x1(%edx),%ecx
49a: 89 4d f8 mov %ecx,-0x8(%ebp)
49d: 0f b6 12 movzbl (%edx),%edx
4a0: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
4a2: 8b 45 10 mov 0x10(%ebp),%eax
4a5: 8d 50 ff lea -0x1(%eax),%edx
4a8: 89 55 10 mov %edx,0x10(%ebp)
4ab: 85 c0 test %eax,%eax
4ad: 7f dc jg 48b <memmove+0x14>
*dst++ = *src++;
return vdst;
4af: 8b 45 08 mov 0x8(%ebp),%eax
}
4b2: c9 leave
4b3: c3 ret
000004b4 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
4b4: b8 01 00 00 00 mov $0x1,%eax
4b9: cd 40 int $0x40
4bb: c3 ret
000004bc <exit>:
SYSCALL(exit)
4bc: b8 02 00 00 00 mov $0x2,%eax
4c1: cd 40 int $0x40
4c3: c3 ret
000004c4 <wait>:
SYSCALL(wait)
4c4: b8 03 00 00 00 mov $0x3,%eax
4c9: cd 40 int $0x40
4cb: c3 ret
000004cc <pipe>:
SYSCALL(pipe)
4cc: b8 04 00 00 00 mov $0x4,%eax
4d1: cd 40 int $0x40
4d3: c3 ret
000004d4 <read>:
SYSCALL(read)
4d4: b8 05 00 00 00 mov $0x5,%eax
4d9: cd 40 int $0x40
4db: c3 ret
000004dc <write>:
SYSCALL(write)
4dc: b8 10 00 00 00 mov $0x10,%eax
4e1: cd 40 int $0x40
4e3: c3 ret
000004e4 <close>:
SYSCALL(close)
4e4: b8 15 00 00 00 mov $0x15,%eax
4e9: cd 40 int $0x40
4eb: c3 ret
000004ec <kill>:
SYSCALL(kill)
4ec: b8 06 00 00 00 mov $0x6,%eax
4f1: cd 40 int $0x40
4f3: c3 ret
000004f4 <exec>:
SYSCALL(exec)
4f4: b8 07 00 00 00 mov $0x7,%eax
4f9: cd 40 int $0x40
4fb: c3 ret
000004fc <open>:
SYSCALL(open)
4fc: b8 0f 00 00 00 mov $0xf,%eax
501: cd 40 int $0x40
503: c3 ret
00000504 <mknod>:
SYSCALL(mknod)
504: b8 11 00 00 00 mov $0x11,%eax
509: cd 40 int $0x40
50b: c3 ret
0000050c <unlink>:
SYSCALL(unlink)
50c: b8 12 00 00 00 mov $0x12,%eax
511: cd 40 int $0x40
513: c3 ret
00000514 <fstat>:
SYSCALL(fstat)
514: b8 08 00 00 00 mov $0x8,%eax
519: cd 40 int $0x40
51b: c3 ret
0000051c <link>:
SYSCALL(link)
51c: b8 13 00 00 00 mov $0x13,%eax
521: cd 40 int $0x40
523: c3 ret
00000524 <mkdir>:
SYSCALL(mkdir)
524: b8 14 00 00 00 mov $0x14,%eax
529: cd 40 int $0x40
52b: c3 ret
0000052c <chdir>:
SYSCALL(chdir)
52c: b8 09 00 00 00 mov $0x9,%eax
531: cd 40 int $0x40
533: c3 ret
00000534 <dup>:
SYSCALL(dup)
534: b8 0a 00 00 00 mov $0xa,%eax
539: cd 40 int $0x40
53b: c3 ret
0000053c <getpid>:
SYSCALL(getpid)
53c: b8 0b 00 00 00 mov $0xb,%eax
541: cd 40 int $0x40
543: c3 ret
00000544 <sbrk>:
SYSCALL(sbrk)
544: b8 0c 00 00 00 mov $0xc,%eax
549: cd 40 int $0x40
54b: c3 ret
0000054c <sleep>:
SYSCALL(sleep)
54c: b8 0d 00 00 00 mov $0xd,%eax
551: cd 40 int $0x40
553: c3 ret
00000554 <uptime>:
SYSCALL(uptime)
554: b8 0e 00 00 00 mov $0xe,%eax
559: cd 40 int $0x40
55b: c3 ret
0000055c <date>:
SYSCALL(date)
55c: b8 16 00 00 00 mov $0x16,%eax
561: cd 40 int $0x40
563: c3 ret
00000564 <clone>:
SYSCALL(clone)
564: b8 17 00 00 00 mov $0x17,%eax
569: cd 40 int $0x40
56b: c3 ret
0000056c <join>:
SYSCALL(join)
56c: b8 18 00 00 00 mov $0x18,%eax
571: cd 40 int $0x40
573: c3 ret
00000574 <threadSleep>:
SYSCALL(threadSleep)
574: b8 19 00 00 00 mov $0x19,%eax
579: cd 40 int $0x40
57b: c3 ret
0000057c <threadWake>:
SYSCALL(threadWake)
57c: b8 1a 00 00 00 mov $0x1a,%eax
581: cd 40 int $0x40
583: c3 ret
00000584 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
584: 55 push %ebp
585: 89 e5 mov %esp,%ebp
587: 83 ec 18 sub $0x18,%esp
58a: 8b 45 0c mov 0xc(%ebp),%eax
58d: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
590: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
597: 00
598: 8d 45 f4 lea -0xc(%ebp),%eax
59b: 89 44 24 04 mov %eax,0x4(%esp)
59f: 8b 45 08 mov 0x8(%ebp),%eax
5a2: 89 04 24 mov %eax,(%esp)
5a5: e8 32 ff ff ff call 4dc <write>
}
5aa: c9 leave
5ab: c3 ret
000005ac <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
5ac: 55 push %ebp
5ad: 89 e5 mov %esp,%ebp
5af: 56 push %esi
5b0: 53 push %ebx
5b1: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
5b4: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
5bb: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
5bf: 74 17 je 5d8 <printint+0x2c>
5c1: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
5c5: 79 11 jns 5d8 <printint+0x2c>
neg = 1;
5c7: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
5ce: 8b 45 0c mov 0xc(%ebp),%eax
5d1: f7 d8 neg %eax
5d3: 89 45 ec mov %eax,-0x14(%ebp)
5d6: eb 06 jmp 5de <printint+0x32>
} else {
x = xx;
5d8: 8b 45 0c mov 0xc(%ebp),%eax
5db: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
5de: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
5e5: 8b 4d f4 mov -0xc(%ebp),%ecx
5e8: 8d 41 01 lea 0x1(%ecx),%eax
5eb: 89 45 f4 mov %eax,-0xc(%ebp)
5ee: 8b 5d 10 mov 0x10(%ebp),%ebx
5f1: 8b 45 ec mov -0x14(%ebp),%eax
5f4: ba 00 00 00 00 mov $0x0,%edx
5f9: f7 f3 div %ebx
5fb: 89 d0 mov %edx,%eax
5fd: 0f b6 80 60 11 00 00 movzbl 0x1160(%eax),%eax
604: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
608: 8b 75 10 mov 0x10(%ebp),%esi
60b: 8b 45 ec mov -0x14(%ebp),%eax
60e: ba 00 00 00 00 mov $0x0,%edx
613: f7 f6 div %esi
615: 89 45 ec mov %eax,-0x14(%ebp)
618: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
61c: 75 c7 jne 5e5 <printint+0x39>
if(neg)
61e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
622: 74 10 je 634 <printint+0x88>
buf[i++] = '-';
624: 8b 45 f4 mov -0xc(%ebp),%eax
627: 8d 50 01 lea 0x1(%eax),%edx
62a: 89 55 f4 mov %edx,-0xc(%ebp)
62d: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
632: eb 1f jmp 653 <printint+0xa7>
634: eb 1d jmp 653 <printint+0xa7>
putc(fd, buf[i]);
636: 8d 55 dc lea -0x24(%ebp),%edx
639: 8b 45 f4 mov -0xc(%ebp),%eax
63c: 01 d0 add %edx,%eax
63e: 0f b6 00 movzbl (%eax),%eax
641: 0f be c0 movsbl %al,%eax
644: 89 44 24 04 mov %eax,0x4(%esp)
648: 8b 45 08 mov 0x8(%ebp),%eax
64b: 89 04 24 mov %eax,(%esp)
64e: e8 31 ff ff ff call 584 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
653: 83 6d f4 01 subl $0x1,-0xc(%ebp)
657: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
65b: 79 d9 jns 636 <printint+0x8a>
putc(fd, buf[i]);
}
65d: 83 c4 30 add $0x30,%esp
660: 5b pop %ebx
661: 5e pop %esi
662: 5d pop %ebp
663: c3 ret
00000664 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
664: 55 push %ebp
665: 89 e5 mov %esp,%ebp
667: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
66a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
671: 8d 45 0c lea 0xc(%ebp),%eax
674: 83 c0 04 add $0x4,%eax
677: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
67a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
681: e9 7c 01 00 00 jmp 802 <printf+0x19e>
c = fmt[i] & 0xff;
686: 8b 55 0c mov 0xc(%ebp),%edx
689: 8b 45 f0 mov -0x10(%ebp),%eax
68c: 01 d0 add %edx,%eax
68e: 0f b6 00 movzbl (%eax),%eax
691: 0f be c0 movsbl %al,%eax
694: 25 ff 00 00 00 and $0xff,%eax
699: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
69c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
6a0: 75 2c jne 6ce <printf+0x6a>
if(c == '%'){
6a2: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
6a6: 75 0c jne 6b4 <printf+0x50>
state = '%';
6a8: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
6af: e9 4a 01 00 00 jmp 7fe <printf+0x19a>
} else {
putc(fd, c);
6b4: 8b 45 e4 mov -0x1c(%ebp),%eax
6b7: 0f be c0 movsbl %al,%eax
6ba: 89 44 24 04 mov %eax,0x4(%esp)
6be: 8b 45 08 mov 0x8(%ebp),%eax
6c1: 89 04 24 mov %eax,(%esp)
6c4: e8 bb fe ff ff call 584 <putc>
6c9: e9 30 01 00 00 jmp 7fe <printf+0x19a>
}
} else if(state == '%'){
6ce: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
6d2: 0f 85 26 01 00 00 jne 7fe <printf+0x19a>
if(c == 'd'){
6d8: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
6dc: 75 2d jne 70b <printf+0xa7>
printint(fd, *ap, 10, 1);
6de: 8b 45 e8 mov -0x18(%ebp),%eax
6e1: 8b 00 mov (%eax),%eax
6e3: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
6ea: 00
6eb: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
6f2: 00
6f3: 89 44 24 04 mov %eax,0x4(%esp)
6f7: 8b 45 08 mov 0x8(%ebp),%eax
6fa: 89 04 24 mov %eax,(%esp)
6fd: e8 aa fe ff ff call 5ac <printint>
ap++;
702: 83 45 e8 04 addl $0x4,-0x18(%ebp)
706: e9 ec 00 00 00 jmp 7f7 <printf+0x193>
} else if(c == 'x' || c == 'p'){
70b: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
70f: 74 06 je 717 <printf+0xb3>
711: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
715: 75 2d jne 744 <printf+0xe0>
printint(fd, *ap, 16, 0);
717: 8b 45 e8 mov -0x18(%ebp),%eax
71a: 8b 00 mov (%eax),%eax
71c: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
723: 00
724: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
72b: 00
72c: 89 44 24 04 mov %eax,0x4(%esp)
730: 8b 45 08 mov 0x8(%ebp),%eax
733: 89 04 24 mov %eax,(%esp)
736: e8 71 fe ff ff call 5ac <printint>
ap++;
73b: 83 45 e8 04 addl $0x4,-0x18(%ebp)
73f: e9 b3 00 00 00 jmp 7f7 <printf+0x193>
} else if(c == 's'){
744: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
748: 75 45 jne 78f <printf+0x12b>
s = (char*)*ap;
74a: 8b 45 e8 mov -0x18(%ebp),%eax
74d: 8b 00 mov (%eax),%eax
74f: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
752: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
756: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
75a: 75 09 jne 765 <printf+0x101>
s = "(null)";
75c: c7 45 f4 eb 0c 00 00 movl $0xceb,-0xc(%ebp)
while(*s != 0){
763: eb 1e jmp 783 <printf+0x11f>
765: eb 1c jmp 783 <printf+0x11f>
putc(fd, *s);
767: 8b 45 f4 mov -0xc(%ebp),%eax
76a: 0f b6 00 movzbl (%eax),%eax
76d: 0f be c0 movsbl %al,%eax
770: 89 44 24 04 mov %eax,0x4(%esp)
774: 8b 45 08 mov 0x8(%ebp),%eax
777: 89 04 24 mov %eax,(%esp)
77a: e8 05 fe ff ff call 584 <putc>
s++;
77f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
783: 8b 45 f4 mov -0xc(%ebp),%eax
786: 0f b6 00 movzbl (%eax),%eax
789: 84 c0 test %al,%al
78b: 75 da jne 767 <printf+0x103>
78d: eb 68 jmp 7f7 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
78f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
793: 75 1d jne 7b2 <printf+0x14e>
putc(fd, *ap);
795: 8b 45 e8 mov -0x18(%ebp),%eax
798: 8b 00 mov (%eax),%eax
79a: 0f be c0 movsbl %al,%eax
79d: 89 44 24 04 mov %eax,0x4(%esp)
7a1: 8b 45 08 mov 0x8(%ebp),%eax
7a4: 89 04 24 mov %eax,(%esp)
7a7: e8 d8 fd ff ff call 584 <putc>
ap++;
7ac: 83 45 e8 04 addl $0x4,-0x18(%ebp)
7b0: eb 45 jmp 7f7 <printf+0x193>
} else if(c == '%'){
7b2: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
7b6: 75 17 jne 7cf <printf+0x16b>
putc(fd, c);
7b8: 8b 45 e4 mov -0x1c(%ebp),%eax
7bb: 0f be c0 movsbl %al,%eax
7be: 89 44 24 04 mov %eax,0x4(%esp)
7c2: 8b 45 08 mov 0x8(%ebp),%eax
7c5: 89 04 24 mov %eax,(%esp)
7c8: e8 b7 fd ff ff call 584 <putc>
7cd: eb 28 jmp 7f7 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
7cf: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
7d6: 00
7d7: 8b 45 08 mov 0x8(%ebp),%eax
7da: 89 04 24 mov %eax,(%esp)
7dd: e8 a2 fd ff ff call 584 <putc>
putc(fd, c);
7e2: 8b 45 e4 mov -0x1c(%ebp),%eax
7e5: 0f be c0 movsbl %al,%eax
7e8: 89 44 24 04 mov %eax,0x4(%esp)
7ec: 8b 45 08 mov 0x8(%ebp),%eax
7ef: 89 04 24 mov %eax,(%esp)
7f2: e8 8d fd ff ff call 584 <putc>
}
state = 0;
7f7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
7fe: 83 45 f0 01 addl $0x1,-0x10(%ebp)
802: 8b 55 0c mov 0xc(%ebp),%edx
805: 8b 45 f0 mov -0x10(%ebp),%eax
808: 01 d0 add %edx,%eax
80a: 0f b6 00 movzbl (%eax),%eax
80d: 84 c0 test %al,%al
80f: 0f 85 71 fe ff ff jne 686 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
815: c9 leave
816: c3 ret
817: 90 nop
00000818 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
818: 55 push %ebp
819: 89 e5 mov %esp,%ebp
81b: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
81e: 8b 45 08 mov 0x8(%ebp),%eax
821: 83 e8 08 sub $0x8,%eax
824: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
827: a1 88 11 00 00 mov 0x1188,%eax
82c: 89 45 fc mov %eax,-0x4(%ebp)
82f: eb 24 jmp 855 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
831: 8b 45 fc mov -0x4(%ebp),%eax
834: 8b 00 mov (%eax),%eax
836: 3b 45 fc cmp -0x4(%ebp),%eax
839: 77 12 ja 84d <free+0x35>
83b: 8b 45 f8 mov -0x8(%ebp),%eax
83e: 3b 45 fc cmp -0x4(%ebp),%eax
841: 77 24 ja 867 <free+0x4f>
843: 8b 45 fc mov -0x4(%ebp),%eax
846: 8b 00 mov (%eax),%eax
848: 3b 45 f8 cmp -0x8(%ebp),%eax
84b: 77 1a ja 867 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
84d: 8b 45 fc mov -0x4(%ebp),%eax
850: 8b 00 mov (%eax),%eax
852: 89 45 fc mov %eax,-0x4(%ebp)
855: 8b 45 f8 mov -0x8(%ebp),%eax
858: 3b 45 fc cmp -0x4(%ebp),%eax
85b: 76 d4 jbe 831 <free+0x19>
85d: 8b 45 fc mov -0x4(%ebp),%eax
860: 8b 00 mov (%eax),%eax
862: 3b 45 f8 cmp -0x8(%ebp),%eax
865: 76 ca jbe 831 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
867: 8b 45 f8 mov -0x8(%ebp),%eax
86a: 8b 40 04 mov 0x4(%eax),%eax
86d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
874: 8b 45 f8 mov -0x8(%ebp),%eax
877: 01 c2 add %eax,%edx
879: 8b 45 fc mov -0x4(%ebp),%eax
87c: 8b 00 mov (%eax),%eax
87e: 39 c2 cmp %eax,%edx
880: 75 24 jne 8a6 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
882: 8b 45 f8 mov -0x8(%ebp),%eax
885: 8b 50 04 mov 0x4(%eax),%edx
888: 8b 45 fc mov -0x4(%ebp),%eax
88b: 8b 00 mov (%eax),%eax
88d: 8b 40 04 mov 0x4(%eax),%eax
890: 01 c2 add %eax,%edx
892: 8b 45 f8 mov -0x8(%ebp),%eax
895: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
898: 8b 45 fc mov -0x4(%ebp),%eax
89b: 8b 00 mov (%eax),%eax
89d: 8b 10 mov (%eax),%edx
89f: 8b 45 f8 mov -0x8(%ebp),%eax
8a2: 89 10 mov %edx,(%eax)
8a4: eb 0a jmp 8b0 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
8a6: 8b 45 fc mov -0x4(%ebp),%eax
8a9: 8b 10 mov (%eax),%edx
8ab: 8b 45 f8 mov -0x8(%ebp),%eax
8ae: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
8b0: 8b 45 fc mov -0x4(%ebp),%eax
8b3: 8b 40 04 mov 0x4(%eax),%eax
8b6: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
8bd: 8b 45 fc mov -0x4(%ebp),%eax
8c0: 01 d0 add %edx,%eax
8c2: 3b 45 f8 cmp -0x8(%ebp),%eax
8c5: 75 20 jne 8e7 <free+0xcf>
p->s.size += bp->s.size;
8c7: 8b 45 fc mov -0x4(%ebp),%eax
8ca: 8b 50 04 mov 0x4(%eax),%edx
8cd: 8b 45 f8 mov -0x8(%ebp),%eax
8d0: 8b 40 04 mov 0x4(%eax),%eax
8d3: 01 c2 add %eax,%edx
8d5: 8b 45 fc mov -0x4(%ebp),%eax
8d8: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
8db: 8b 45 f8 mov -0x8(%ebp),%eax
8de: 8b 10 mov (%eax),%edx
8e0: 8b 45 fc mov -0x4(%ebp),%eax
8e3: 89 10 mov %edx,(%eax)
8e5: eb 08 jmp 8ef <free+0xd7>
} else
p->s.ptr = bp;
8e7: 8b 45 fc mov -0x4(%ebp),%eax
8ea: 8b 55 f8 mov -0x8(%ebp),%edx
8ed: 89 10 mov %edx,(%eax)
freep = p;
8ef: 8b 45 fc mov -0x4(%ebp),%eax
8f2: a3 88 11 00 00 mov %eax,0x1188
}
8f7: c9 leave
8f8: c3 ret
000008f9 <morecore>:
static Header*
morecore(uint nu)
{
8f9: 55 push %ebp
8fa: 89 e5 mov %esp,%ebp
8fc: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
8ff: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
906: 77 07 ja 90f <morecore+0x16>
nu = 4096;
908: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
90f: 8b 45 08 mov 0x8(%ebp),%eax
912: c1 e0 03 shl $0x3,%eax
915: 89 04 24 mov %eax,(%esp)
918: e8 27 fc ff ff call 544 <sbrk>
91d: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
920: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
924: 75 07 jne 92d <morecore+0x34>
return 0;
926: b8 00 00 00 00 mov $0x0,%eax
92b: eb 22 jmp 94f <morecore+0x56>
hp = (Header*)p;
92d: 8b 45 f4 mov -0xc(%ebp),%eax
930: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
933: 8b 45 f0 mov -0x10(%ebp),%eax
936: 8b 55 08 mov 0x8(%ebp),%edx
939: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
93c: 8b 45 f0 mov -0x10(%ebp),%eax
93f: 83 c0 08 add $0x8,%eax
942: 89 04 24 mov %eax,(%esp)
945: e8 ce fe ff ff call 818 <free>
return freep;
94a: a1 88 11 00 00 mov 0x1188,%eax
}
94f: c9 leave
950: c3 ret
00000951 <malloc>:
void*
malloc(uint nbytes)
{
951: 55 push %ebp
952: 89 e5 mov %esp,%ebp
954: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
957: 8b 45 08 mov 0x8(%ebp),%eax
95a: 83 c0 07 add $0x7,%eax
95d: c1 e8 03 shr $0x3,%eax
960: 83 c0 01 add $0x1,%eax
963: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
966: a1 88 11 00 00 mov 0x1188,%eax
96b: 89 45 f0 mov %eax,-0x10(%ebp)
96e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
972: 75 23 jne 997 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
974: c7 45 f0 80 11 00 00 movl $0x1180,-0x10(%ebp)
97b: 8b 45 f0 mov -0x10(%ebp),%eax
97e: a3 88 11 00 00 mov %eax,0x1188
983: a1 88 11 00 00 mov 0x1188,%eax
988: a3 80 11 00 00 mov %eax,0x1180
base.s.size = 0;
98d: c7 05 84 11 00 00 00 movl $0x0,0x1184
994: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
997: 8b 45 f0 mov -0x10(%ebp),%eax
99a: 8b 00 mov (%eax),%eax
99c: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
99f: 8b 45 f4 mov -0xc(%ebp),%eax
9a2: 8b 40 04 mov 0x4(%eax),%eax
9a5: 3b 45 ec cmp -0x14(%ebp),%eax
9a8: 72 4d jb 9f7 <malloc+0xa6>
if(p->s.size == nunits)
9aa: 8b 45 f4 mov -0xc(%ebp),%eax
9ad: 8b 40 04 mov 0x4(%eax),%eax
9b0: 3b 45 ec cmp -0x14(%ebp),%eax
9b3: 75 0c jne 9c1 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
9b5: 8b 45 f4 mov -0xc(%ebp),%eax
9b8: 8b 10 mov (%eax),%edx
9ba: 8b 45 f0 mov -0x10(%ebp),%eax
9bd: 89 10 mov %edx,(%eax)
9bf: eb 26 jmp 9e7 <malloc+0x96>
else {
p->s.size -= nunits;
9c1: 8b 45 f4 mov -0xc(%ebp),%eax
9c4: 8b 40 04 mov 0x4(%eax),%eax
9c7: 2b 45 ec sub -0x14(%ebp),%eax
9ca: 89 c2 mov %eax,%edx
9cc: 8b 45 f4 mov -0xc(%ebp),%eax
9cf: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
9d2: 8b 45 f4 mov -0xc(%ebp),%eax
9d5: 8b 40 04 mov 0x4(%eax),%eax
9d8: c1 e0 03 shl $0x3,%eax
9db: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
9de: 8b 45 f4 mov -0xc(%ebp),%eax
9e1: 8b 55 ec mov -0x14(%ebp),%edx
9e4: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
9e7: 8b 45 f0 mov -0x10(%ebp),%eax
9ea: a3 88 11 00 00 mov %eax,0x1188
return (void*)(p + 1);
9ef: 8b 45 f4 mov -0xc(%ebp),%eax
9f2: 83 c0 08 add $0x8,%eax
9f5: eb 38 jmp a2f <malloc+0xde>
}
if(p == freep)
9f7: a1 88 11 00 00 mov 0x1188,%eax
9fc: 39 45 f4 cmp %eax,-0xc(%ebp)
9ff: 75 1b jne a1c <malloc+0xcb>
if((p = morecore(nunits)) == 0)
a01: 8b 45 ec mov -0x14(%ebp),%eax
a04: 89 04 24 mov %eax,(%esp)
a07: e8 ed fe ff ff call 8f9 <morecore>
a0c: 89 45 f4 mov %eax,-0xc(%ebp)
a0f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
a13: 75 07 jne a1c <malloc+0xcb>
return 0;
a15: b8 00 00 00 00 mov $0x0,%eax
a1a: eb 13 jmp a2f <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
a1c: 8b 45 f4 mov -0xc(%ebp),%eax
a1f: 89 45 f0 mov %eax,-0x10(%ebp)
a22: 8b 45 f4 mov -0xc(%ebp),%eax
a25: 8b 00 mov (%eax),%eax
a27: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
a2a: e9 70 ff ff ff jmp 99f <malloc+0x4e>
}
a2f: c9 leave
a30: c3 ret
a31: 66 90 xchg %ax,%ax
a33: 90 nop
00000a34 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
a34: 55 push %ebp
a35: 89 e5 mov %esp,%ebp
a37: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
a3a: 8b 55 08 mov 0x8(%ebp),%edx
a3d: 8b 45 0c mov 0xc(%ebp),%eax
a40: 8b 4d 08 mov 0x8(%ebp),%ecx
a43: f0 87 02 lock xchg %eax,(%edx)
a46: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
a49: 8b 45 fc mov -0x4(%ebp),%eax
}
a4c: c9 leave
a4d: c3 ret
00000a4e <pthread_create>:
#define NULL 0
#define PGSIZE (4096)
int pthread_create(mpthread_t *thread, mpthread_attr_t *attr, void(*func)(void*), void*arg){
a4e: 55 push %ebp
a4f: 89 e5 mov %esp,%ebp
a51: 83 ec 28 sub $0x28,%esp
void *stack = malloc((uint)PGSIZE*2);
a54: c7 04 24 00 20 00 00 movl $0x2000,(%esp)
a5b: e8 f1 fe ff ff call 951 <malloc>
a60: 89 45 f4 mov %eax,-0xc(%ebp)
if((uint)stack <= 0){
a63: 8b 45 f4 mov -0xc(%ebp),%eax
a66: 85 c0 test %eax,%eax
a68: 75 1b jne a85 <pthread_create+0x37>
printf(1, "Malloc new stack failed in pthread_create\n");
a6a: c7 44 24 04 f4 0c 00 movl $0xcf4,0x4(%esp)
a71: 00
a72: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a79: e8 e6 fb ff ff call 664 <printf>
return -1;
a7e: b8 ff ff ff ff mov $0xffffffff,%eax
a83: eb 43 jmp ac8 <pthread_create+0x7a>
}
if((uint)stack % PGSIZE){
a85: 8b 45 f4 mov -0xc(%ebp),%eax
a88: 25 ff 0f 00 00 and $0xfff,%eax
a8d: 85 c0 test %eax,%eax
a8f: 74 14 je aa5 <pthread_create+0x57>
stack += 4096 - ((uint)stack % PGSIZE);
a91: 8b 45 f4 mov -0xc(%ebp),%eax
a94: 25 ff 0f 00 00 and $0xfff,%eax
a99: 89 c2 mov %eax,%edx
a9b: b8 00 10 00 00 mov $0x1000,%eax
aa0: 29 d0 sub %edx,%eax
aa2: 01 45 f4 add %eax,-0xc(%ebp)
}
*thread = clone(func, arg, stack);
aa5: 8b 45 f4 mov -0xc(%ebp),%eax
aa8: 89 44 24 08 mov %eax,0x8(%esp)
aac: 8b 45 14 mov 0x14(%ebp),%eax
aaf: 89 44 24 04 mov %eax,0x4(%esp)
ab3: 8b 45 10 mov 0x10(%ebp),%eax
ab6: 89 04 24 mov %eax,(%esp)
ab9: e8 a6 fa ff ff call 564 <clone>
abe: 8b 55 08 mov 0x8(%ebp),%edx
ac1: 89 02 mov %eax,(%edx)
return *thread;
ac3: 8b 45 08 mov 0x8(%ebp),%eax
ac6: 8b 00 mov (%eax),%eax
}
ac8: c9 leave
ac9: c3 ret
00000aca <pthread_join>:
int pthread_join(mpthread_t thread, void **retval){
aca: 55 push %ebp
acb: 89 e5 mov %esp,%ebp
acd: 83 ec 28 sub $0x28,%esp
void *stack;
if(join((uint)thread, &stack)<0){
ad0: 8d 45 f4 lea -0xc(%ebp),%eax
ad3: 89 44 24 04 mov %eax,0x4(%esp)
ad7: 8b 45 08 mov 0x8(%ebp),%eax
ada: 89 04 24 mov %eax,(%esp)
add: e8 8a fa ff ff call 56c <join>
ae2: 85 c0 test %eax,%eax
ae4: 79 07 jns aed <pthread_join+0x23>
return -1;
ae6: b8 ff ff ff ff mov $0xffffffff,%eax
aeb: eb 10 jmp afd <pthread_join+0x33>
}
free(stack);
aed: 8b 45 f4 mov -0xc(%ebp),%eax
af0: 89 04 24 mov %eax,(%esp)
af3: e8 20 fd ff ff call 818 <free>
return 0;
af8: b8 00 00 00 00 mov $0x0,%eax
}
afd: c9 leave
afe: c3 ret
00000aff <pthread_mutex_init>:
void pthread_mutex_init(mpthread_mutex_t *mutex){
aff: 55 push %ebp
b00: 89 e5 mov %esp,%ebp
*mutex = 0;
b02: 8b 45 08 mov 0x8(%ebp),%eax
b05: c7 00 00 00 00 00 movl $0x0,(%eax)
return;
b0b: 90 nop
}
b0c: 5d pop %ebp
b0d: c3 ret
00000b0e <pthread_mutex_lock>:
void pthread_mutex_lock(mpthread_mutex_t *mutex){
b0e: 55 push %ebp
b0f: 89 e5 mov %esp,%ebp
b11: 83 ec 08 sub $0x8,%esp
while(xchg(mutex, 1) != 0);
b14: 90 nop
b15: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
b1c: 00
b1d: 8b 45 08 mov 0x8(%ebp),%eax
b20: 89 04 24 mov %eax,(%esp)
b23: e8 0c ff ff ff call a34 <xchg>
b28: 85 c0 test %eax,%eax
b2a: 75 e9 jne b15 <pthread_mutex_lock+0x7>
return;
b2c: 90 nop
}
b2d: c9 leave
b2e: c3 ret
00000b2f <pthread_mutex_unlock>:
void pthread_mutex_unlock(mpthread_mutex_t *mutex){
b2f: 55 push %ebp
b30: 89 e5 mov %esp,%ebp
b32: 83 ec 08 sub $0x8,%esp
xchg(mutex, 0);
b35: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
b3c: 00
b3d: 8b 45 08 mov 0x8(%ebp),%eax
b40: 89 04 24 mov %eax,(%esp)
b43: e8 ec fe ff ff call a34 <xchg>
return;
b48: 90 nop
}
b49: c9 leave
b4a: c3 ret
00000b4b <pthread_cond_init>:
void pthread_cond_init(mpthread_cond_t *cond){
b4b: 55 push %ebp
b4c: 89 e5 mov %esp,%ebp
cond->threadId = -1;
b4e: 8b 45 08 mov 0x8(%ebp),%eax
b51: c7 00 ff ff ff ff movl $0xffffffff,(%eax)
cond->next = NULL;
b57: 8b 45 08 mov 0x8(%ebp),%eax
b5a: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
return;
b61: 90 nop
}
b62: 5d pop %ebp
b63: c3 ret
00000b64 <pthread_cond_wait>:
void pthread_cond_wait(mpthread_cond_t *cond, mpthread_mutex_t *mutex){
b64: 55 push %ebp
b65: 89 e5 mov %esp,%ebp
b67: 53 push %ebx
b68: 83 ec 24 sub $0x24,%esp
mpthread_cond_t *mycond = cond;
b6b: 8b 45 08 mov 0x8(%ebp),%eax
b6e: 89 45 f4 mov %eax,-0xc(%ebp)
pthread_mutex_unlock(mutex);
b71: 8b 45 0c mov 0xc(%ebp),%eax
b74: 89 04 24 mov %eax,(%esp)
b77: e8 b3 ff ff ff call b2f <pthread_mutex_unlock>
//iterate the linked-list pointer to the end;
while(mycond->next != NULL)
b7c: eb 09 jmp b87 <pthread_cond_wait+0x23>
mycond = mycond->next;
b7e: 8b 45 f4 mov -0xc(%ebp),%eax
b81: 8b 40 04 mov 0x4(%eax),%eax
b84: 89 45 f4 mov %eax,-0xc(%ebp)
void pthread_cond_wait(mpthread_cond_t *cond, mpthread_mutex_t *mutex){
mpthread_cond_t *mycond = cond;
pthread_mutex_unlock(mutex);
//iterate the linked-list pointer to the end;
while(mycond->next != NULL)
b87: 8b 45 f4 mov -0xc(%ebp),%eax
b8a: 8b 40 04 mov 0x4(%eax),%eax
b8d: 85 c0 test %eax,%eax
b8f: 75 ed jne b7e <pthread_cond_wait+0x1a>
mycond = mycond->next;
mycond->next = (mpthread_cond_t *)malloc(sizeof(mpthread_cond_t));
b91: c7 04 24 08 00 00 00 movl $0x8,(%esp)
b98: e8 b4 fd ff ff call 951 <malloc>
b9d: 8b 55 f4 mov -0xc(%ebp),%edx
ba0: 89 42 04 mov %eax,0x4(%edx)
mycond->next->threadId = getpid();
ba3: 8b 45 f4 mov -0xc(%ebp),%eax
ba6: 8b 58 04 mov 0x4(%eax),%ebx
ba9: e8 8e f9 ff ff call 53c <getpid>
bae: 89 03 mov %eax,(%ebx)
mycond->next->next = NULL;
bb0: 8b 45 f4 mov -0xc(%ebp),%eax
bb3: 8b 40 04 mov 0x4(%eax),%eax
bb6: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
pthread_mutex_lock(mutex);
bbd: 8b 45 0c mov 0xc(%ebp),%eax
bc0: 89 04 24 mov %eax,(%esp)
bc3: e8 46 ff ff ff call b0e <pthread_mutex_lock>
pthread_mutex_unlock(mutex);
bc8: 8b 45 0c mov 0xc(%ebp),%eax
bcb: 89 04 24 mov %eax,(%esp)
bce: e8 5c ff ff ff call b2f <pthread_mutex_unlock>
threadSleep(mutex);
bd3: 8b 45 0c mov 0xc(%ebp),%eax
bd6: 89 04 24 mov %eax,(%esp)
bd9: e8 96 f9 ff ff call 574 <threadSleep>
pthread_mutex_lock(mutex);
bde: 8b 45 0c mov 0xc(%ebp),%eax
be1: 89 04 24 mov %eax,(%esp)
be4: e8 25 ff ff ff call b0e <pthread_mutex_lock>
return;
be9: 90 nop
}
bea: 83 c4 24 add $0x24,%esp
bed: 5b pop %ebx
bee: 5d pop %ebp
bef: c3 ret
00000bf0 <pthread_cond_signal>:
void pthread_cond_signal(mpthread_cond_t *cond){
bf0: 55 push %ebp
bf1: 89 e5 mov %esp,%ebp
bf3: 83 ec 28 sub $0x28,%esp
mpthread_cond_t *mycond = cond;
bf6: 8b 45 08 mov 0x8(%ebp),%eax
bf9: 89 45 f4 mov %eax,-0xc(%ebp)
while(mycond->threadId==-1)
bfc: eb 09 jmp c07 <pthread_cond_signal+0x17>
mycond = mycond->next;
bfe: 8b 45 f4 mov -0xc(%ebp),%eax
c01: 8b 40 04 mov 0x4(%eax),%eax
c04: 89 45 f4 mov %eax,-0xc(%ebp)
return;
}
void pthread_cond_signal(mpthread_cond_t *cond){
mpthread_cond_t *mycond = cond;
while(mycond->threadId==-1)
c07: 8b 45 f4 mov -0xc(%ebp),%eax
c0a: 8b 00 mov (%eax),%eax
c0c: 83 f8 ff cmp $0xffffffff,%eax
c0f: 74 ed je bfe <pthread_cond_signal+0xe>
mycond = mycond->next;
if(mycond!=NULL){
c11: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
c15: 74 33 je c4a <pthread_cond_signal+0x5a>
int threadId = mycond->threadId;
c17: 8b 45 f4 mov -0xc(%ebp),%eax
c1a: 8b 00 mov (%eax),%eax
c1c: 89 45 f0 mov %eax,-0x10(%ebp)
mpthread_cond_t *garbage = mycond;
c1f: 8b 45 f4 mov -0xc(%ebp),%eax
c22: 89 45 ec mov %eax,-0x14(%ebp)
cond->next = cond->next->next;
c25: 8b 45 08 mov 0x8(%ebp),%eax
c28: 8b 40 04 mov 0x4(%eax),%eax
c2b: 8b 50 04 mov 0x4(%eax),%edx
c2e: 8b 45 08 mov 0x8(%ebp),%eax
c31: 89 50 04 mov %edx,0x4(%eax)
free(garbage);
c34: 8b 45 ec mov -0x14(%ebp),%eax
c37: 89 04 24 mov %eax,(%esp)
c3a: e8 d9 fb ff ff call 818 <free>
threadWake(threadId);
c3f: 8b 45 f0 mov -0x10(%ebp),%eax
c42: 89 04 24 mov %eax,(%esp)
c45: e8 32 f9 ff ff call 57c <threadWake>
}
return;
c4a: 90 nop
}
c4b: c9 leave
c4c: c3 ret
00000c4d <pthread_sem_init>:
void pthread_sem_init(mpthread_sem_t* sem, int flag, int value){
c4d: 55 push %ebp
c4e: 89 e5 mov %esp,%ebp
c50: 83 ec 04 sub $0x4,%esp
sem->value = value;
c53: 8b 45 08 mov 0x8(%ebp),%eax
c56: 8b 55 10 mov 0x10(%ebp),%edx
c59: 89 10 mov %edx,(%eax)
pthread_cond_init(&sem->cond);
c5b: 8b 45 08 mov 0x8(%ebp),%eax
c5e: 83 c0 04 add $0x4,%eax
c61: 89 04 24 mov %eax,(%esp)
c64: e8 e2 fe ff ff call b4b <pthread_cond_init>
pthread_mutex_init(&sem->mutex);
c69: 8b 45 08 mov 0x8(%ebp),%eax
c6c: 83 c0 0c add $0xc,%eax
c6f: 89 04 24 mov %eax,(%esp)
c72: e8 88 fe ff ff call aff <pthread_mutex_init>
return;
c77: 90 nop
}
c78: c9 leave
c79: c3 ret
00000c7a <pthread_sem_wait>:
void pthread_sem_wait(mpthread_sem_t* sem){
c7a: 55 push %ebp
c7b: 89 e5 mov %esp,%ebp
c7d: 83 ec 18 sub $0x18,%esp
sem->value --;
c80: 8b 45 08 mov 0x8(%ebp),%eax
c83: 8b 00 mov (%eax),%eax
c85: 8d 50 ff lea -0x1(%eax),%edx
c88: 8b 45 08 mov 0x8(%ebp),%eax
c8b: 89 10 mov %edx,(%eax)
if(sem->value < 0){
c8d: 8b 45 08 mov 0x8(%ebp),%eax
c90: 8b 00 mov (%eax),%eax
c92: 85 c0 test %eax,%eax
c94: 79 18 jns cae <pthread_sem_wait+0x34>
pthread_cond_wait(&sem->cond, &sem->mutex);
c96: 8b 45 08 mov 0x8(%ebp),%eax
c99: 8d 50 0c lea 0xc(%eax),%edx
c9c: 8b 45 08 mov 0x8(%ebp),%eax
c9f: 83 c0 04 add $0x4,%eax
ca2: 89 54 24 04 mov %edx,0x4(%esp)
ca6: 89 04 24 mov %eax,(%esp)
ca9: e8 b6 fe ff ff call b64 <pthread_cond_wait>
}
return;
cae: 90 nop
}
caf: c9 leave
cb0: c3 ret
00000cb1 <pthread_sem_post>:
void pthread_sem_post(mpthread_sem_t* sem){
cb1: 55 push %ebp
cb2: 89 e5 mov %esp,%ebp
cb4: 83 ec 18 sub $0x18,%esp
sem->value ++;
cb7: 8b 45 08 mov 0x8(%ebp),%eax
cba: 8b 00 mov (%eax),%eax
cbc: 8d 50 01 lea 0x1(%eax),%edx
cbf: 8b 45 08 mov 0x8(%ebp),%eax
cc2: 89 10 mov %edx,(%eax)
pthread_cond_signal(&sem->cond);
cc4: 8b 45 08 mov 0x8(%ebp),%eax
cc7: 83 c0 04 add $0x4,%eax
cca: 89 04 24 mov %eax,(%esp)
ccd: e8 1e ff ff ff call bf0 <pthread_cond_signal>
return;
cd2: 90 nop
}
cd3: c9 leave
cd4: c3 ret
|
alloy4fun_models/trainstlt/models/2/x6DdzCStZ73SduoCY.als | Kaixi26/org.alloytools.alloy | 0 | 201 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idx6DdzCStZ73SduoCY_prop3 {
all t,tt:Track | t->tt in prox implies always t->tt in prox
}
pred __repair { idx6DdzCStZ73SduoCY_prop3 }
check __repair { idx6DdzCStZ73SduoCY_prop3 <=> prop3o } |
test/Succeed/Issue259c.agda | cruhland/agda | 1,989 | 313 | {- This example used to fail but after the point-free evaluation fix
it seems to work #-}
module Issue259c where
postulate
A : Set
a : A
b : ({x : A} → A) → A
C : A → Set
d : {x : A} → A
d {x} = a
e : A
e = b (λ {x} → d {x})
F : C e → Set₁
F _ with Set
F _ | _ = Set
|
demo/tutorial/game_maps.adb | csb6/libtcod-ada | 0 | 11161 | <filename>demo/tutorial/game_maps.adb
with Libtcod.Color, Libtcod.Maps.FOV;
package body Game_Maps is
dark_wall : constant Color.RGB_Color := Color.make_RGB_color(0, 0, 100);
dark_ground : constant Color.RGB_Color := Color.make_RGB_color(50, 50, 150);
light_wall : constant Color.RGB_Color := Color.make_RGB_color(130, 110, 50);
light_ground : constant Color.RGB_Color := Color.make_RGB_color(200, 180, 50);
-------------
-- is_wall --
-------------
function is_wall(self : Game_Map; x : Maps.X_Pos; y : Maps.Y_Pos) return Boolean is
(not self.map.is_walkable(x, y));
-----------------
-- is_explored --
-----------------
function is_explored(self : Game_Map; x : Maps.X_Pos; y : Maps.Y_Pos) return Boolean is
(self.tiles(y, x).flags(Explored));
------------
-- in_fov --
------------
function in_fov(self : in out Game_Map; x : Maps.X_Pos; y : Maps.Y_Pos) return Boolean is
begin
if Maps.FOV.in_FOV(self.map, x, y) then
self.tiles(y, x).flags(Explored) := True;
return True;
end if;
return False;
end in_fov;
-----------------
-- compute_fov --
-----------------
procedure compute_fov(self : in out Game_Map; source_x : Maps.X_Pos; source_y : Maps.Y_Pos;
radius : Maps.Radius) is
begin
Maps.FOV.compute_FOV(self.map, source_x, source_y, radius);
end compute_fov;
---------
-- dig --
---------
procedure dig(self : in out Game_Map; x1 : Maps.X_Pos; y1 : Maps.Y_Pos;
x2 : Maps.X_Pos; y2 : Maps.Y_Pos) is
begin
for y in Maps.Y_Pos'Min(y1, y2) .. Maps.Y_Pos'Max(y1, y2) loop
for x in Maps.X_Pos'Min(x1, x2) .. Maps.X_Pos'Max(x1, x2) loop
self.map.set_properties(x, y, walkable => True, transparent => True);
end loop;
end loop;
end dig;
-------------------
-- make_game_map --
-------------------
function make_game_map(w : Width; h : Height) return Game_Map is
begin
return map : Game_Map := (width => Maps.X_Pos(w),
height => Maps.Y_Pos(h), tiles => <>,
map => Maps.make_map(w, h));
end make_game_map;
------------
-- render --
------------
procedure render(self : in out Game_Map; screen : in out Console.Screen) is
begin
for y in self.tiles'Range loop
for x in self.tiles'Range(2) loop
if self.in_fov(x, y) then
screen.set_char_bg(Console.X_Pos(x), Console.Y_Pos(y),
(if self.is_wall(x, y) then light_wall
else light_ground));
elsif self.is_explored(x, y) then
screen.set_char_bg(Console.X_Pos(x), Console.Y_Pos(y),
(if self.is_wall(x, y) then dark_wall
else dark_ground));
end if;
end loop;
end loop;
end render;
end Game_Maps;
|
src/Channel.agda | peterthiemann/definitional-session | 9 | 914 | module Channel where
open import Data.Bool hiding (_≤_)
open import Data.Fin hiding (_≤_)
open import Data.List hiding (map)
open import Data.Maybe
open import Data.Nat
open import Data.Nat.Properties
open import Data.Product hiding (map)
open import Relation.Binary.PropositionalEquality
open import Typing
open import Syntax hiding (send ; recv)
open import Global
data ChannelEnd : Set where
POS NEG : ChannelEnd
otherEnd : ChannelEnd → ChannelEnd
otherEnd POS = NEG
otherEnd NEG = POS
-- the main part of a channel endpoint value is a valid channel reference
-- the channel end determines whether it's the front end or the back end of the channel
-- enforces that the session context has only one channel
data ChannelRef : (G : SCtx) (ce : ChannelEnd) (s : STypeF SType) → Set where
here-pos : ∀ {s s'} {G : SCtx}
→ (ina-G : Inactive G)
→ s ≲' s'
→ ChannelRef (just (s , POS) ∷ G) POS s'
here-neg : ∀ {s s'} {G : SCtx}
→ (ina-G : Inactive G)
→ dualF s ≲' s'
→ ChannelRef (just (s , NEG) ∷ G) NEG s'
there : ∀ {b s} {G : SCtx}
→ (vcr : ChannelRef G b s)
→ ChannelRef (nothing ∷ G) b s
-- coerce channel ref to a supertype
vcr-coerce : ∀ {G b s s'} → ChannelRef G b s → s ≲' s' → ChannelRef G b s'
vcr-coerce (here-pos ina-G x) s≤s' = here-pos ina-G (subF-trans x s≤s')
vcr-coerce (here-neg ina-G x) s≤s' = here-neg ina-G (subF-trans x s≤s')
vcr-coerce (there vcr) s≤s' = there (vcr-coerce vcr s≤s')
-- find matching wait instruction in thread pool
vcr-match : ∀ {G G₁ G₂ b₁ b₂ s₁ s₂}
→ SSplit G G₁ G₂
→ ChannelRef G₁ b₁ s₁
→ ChannelRef G₂ b₂ s₂
→ Maybe (b₁ ≡ otherEnd b₂ × dualF s₂ ≲' s₁)
vcr-match () (here-pos _ _) (here-pos _ _)
vcr-match (ss-posneg ss) (here-pos{s} ina-G s<=s') (here-neg ina-G₁ ds<=s'') = just (refl , subF-trans (dual-subF ds<=s'') (subF-trans (eqF-implies-subF (eqF-sym (dual-involutionF s))) s<=s'))
vcr-match (ss-left ss) (here-pos _ _) (there vcr2) = nothing
vcr-match (ss-negpos ss) (here-neg ina-G ds<=s') (here-pos ina-G₁ s<=s'') = just (refl , subF-trans (dual-subF s<=s'') ds<=s')
vcr-match (ss-left ss) (here-neg _ _) (there vcr2) = nothing
vcr-match (ss-right ss) (there vcr1) (here-pos _ ina-G) = nothing
vcr-match (ss-right ss) (there vcr1) (here-neg _ ina-G) = nothing
vcr-match (ss-both ss) (there vcr1) (there vcr2) = vcr-match ss vcr1 vcr2
-- ok. brute force for a fixed tree with three levels
data SSplit2 (G G₁ G₂ G₁₁ G₁₂ : SCtx) : Set where
ssplit2 :
(ss1 : SSplit G G₁ G₂)
→ (ss2 : SSplit G₁ G₁₁ G₁₂)
→ SSplit2 G G₁ G₂ G₁₁ G₁₂
vcr-match-2-sr : ∀ {G G₁ G₂ G₁₁ G₁₂ b₁ b₂ s₁ s₂ t₁ t₂}
→ SSplit2 G G₁ G₂ G₁₁ G₁₂
→ ChannelRef G₁₁ b₁ (recv t₁ s₁)
→ ChannelRef G₁₂ b₂ (send t₂ s₂)
→ Maybe (SubT t₂ t₁ × dual s₂ ≲ s₁ ×
∃ λ G' → ∃ λ G₁' → ∃ λ G₁₁' → ∃ λ G₁₂' →
SSplit2 G' G₁' G₂ G₁₁' G₁₂' ×
ChannelRef G₁₁' b₁ (SType.force s₁) ×
ChannelRef G₁₂' b₂ (SType.force s₂))
vcr-match-2-sr (ssplit2 ss-[] ()) (here-pos ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (here-pos ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-left ss1) ()) (here-pos ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (here-pos ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-posneg ss1) ()) (here-pos ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-negpos ss1) ()) (here-pos ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 ss-[] ()) (here-pos ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (here-pos ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-left ss1) (ss-posneg ss2)) (here-pos ina-G (sub-recv{s1} t t' t<=t' s1<=s1')) (here-neg ina-G₁ (sub-send .t t'' t'<=t s1<=s1'')) = just ((subt-trans t'<=t t<=t') , (sub-trans (dual-sub s1<=s1'') (sub-trans (eq-implies-sub (eq-sym (dual-involution s1))) s1<=s1')) , _ , _ , _ , _ , ssplit2 (ss-left ss1) (ss-posneg ss2) , here-pos ina-G (Sub.force s1<=s1') , here-neg ina-G₁ (Sub.force s1<=s1''))
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (here-pos ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-posneg ss1) ()) (here-pos ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-negpos ss1) ()) (here-pos ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 ss-[] ()) (here-pos ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (here-pos ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-left ss1) (ss-left ss2)) (here-pos ina-G x) (there vcr2) = nothing
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (here-pos ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-posneg ss1) (ss-left ss2)) (here-pos ina-G x) (there vcr2) = nothing
vcr-match-2-sr (ssplit2 (ss-negpos ss1) ()) (here-pos ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 ss-[] ()) (here-neg ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr {s₁ = s₁} {s₂} (ssplit2 (ss-left ss1) (ss-negpos ss2)) (here-neg ina-G (sub-recv .t t'' t<=t' s1<=s1'')) (here-pos ina-G₁ (sub-send t t' t'<=t s1<=s1')) = just ((subt-trans t'<=t t<=t') , ((sub-trans (dual-sub s1<=s1') s1<=s1'') , (_ , (_ , (_ , (_ , ((ssplit2 (ss-left ss1) (ss-negpos ss2)) , ((here-neg ina-G (Sub.force s1<=s1'')) , (here-pos ina-G₁ (Sub.force s1<=s1'))))))))))
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-posneg ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-negpos ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ x₁)
vcr-match-2-sr (ssplit2 ss-[] ()) (here-neg ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (here-neg ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (here-neg ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-posneg ss1) ()) (here-neg ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 (ss-negpos ss1) ()) (here-neg ina-G x) (here-neg ina-G₁ x₁)
vcr-match-2-sr (ssplit2 ss-[] ()) (here-neg ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (here-neg ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-left ss1) (ss-left ss2)) (here-neg ina-G x) (there vcr2) = nothing
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (here-neg ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-posneg ss1) ()) (here-neg ina-G x) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-negpos ss1) (ss-left ss2)) (here-neg ina-G x) (there vcr2) = nothing
vcr-match-2-sr (ssplit2 ss-[] ()) (there vcr1) (here-pos ina-G x)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (there vcr1) (here-pos ina-G x)
vcr-match-2-sr (ssplit2 (ss-left ss1) (ss-right ss2)) (there vcr1) (here-pos ina-G x) = nothing
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (there vcr1) (here-pos ina-G x)
vcr-match-2-sr (ssplit2 (ss-posneg ss1) (ss-right ss2)) (there vcr1) (here-pos ina-G x) = nothing
vcr-match-2-sr (ssplit2 (ss-negpos ss1) ()) (there vcr1) (here-pos ina-G x)
vcr-match-2-sr (ssplit2 ss-[] ()) (there vcr1) (here-neg ina-G x)
vcr-match-2-sr (ssplit2 (ss-both ss1) ()) (there vcr1) (here-neg ina-G x)
vcr-match-2-sr (ssplit2 (ss-left ss1) (ss-right ss2)) (there vcr1) (here-neg ina-G x) = nothing
vcr-match-2-sr (ssplit2 (ss-right ss1) ()) (there vcr1) (here-neg ina-G x)
vcr-match-2-sr (ssplit2 (ss-negpos ss1) (ss-right ss2)) (there vcr1) (here-neg ina-G x) = nothing
vcr-match-2-sr (ssplit2 ss-[] ()) (there vcr1) (there vcr2)
vcr-match-2-sr (ssplit2 (ss-both ss1) (ss-both ss2)) (there vcr1) (there vcr2) with vcr-match-2-sr (ssplit2 ss1 ss2) vcr1 vcr2
... | nothing = nothing
... | just (t2<=t1 , ds2<=s1 , _ , _ , _ , _ , ssplit2 ss1' ss2' , vcr1' , vcr2') = just (t2<=t1 , ds2<=s1 , _ , _ , _ , _ , (ssplit2 (ss-both ss1') (ss-both ss2')) , ((there vcr1') , (there vcr2')))
vcr-match-2-sr (ssplit2 (ss-right ss1) (ss-both ss2)) (there vcr1) (there vcr2) = map (λ { (t2<=t1 , ds2<=s1 , _ , _ , _ , _ , ssplit2 ss1' ss2' , vcr1' , vcr2') → t2<=t1 , ds2<=s1 , _ , _ , _ , _ , (ssplit2 (ss-right ss1') (ss-both ss2')) , (there vcr1') , (there vcr2') }) (vcr-match-2-sr (ssplit2 ss1 ss2) vcr1 vcr2)
vcr-match-2-sr (ssplit2 (ss-negpos ss1) ()) (there vcr1) (there vcr2)
vcr-match-2-sb : ∀ {G G₁ G₂ G₁₁ G₁₂ b₁ b₂ s₁₁ s₁₂ s₂₁ s₂₂}
→ SSplit2 G G₁ G₂ G₁₁ G₁₂
→ ChannelRef G₁₁ b₁ (sintern s₁₁ s₁₂)
→ ChannelRef G₁₂ b₂ (sextern s₂₁ s₂₂)
→ (lab : Selector)
→ Maybe (dual s₂₁ ≲ s₁₁ × dual s₂₂ ≲ s₁₂ ×
∃ λ G' → ∃ λ G₁' → ∃ λ G₁₁' → ∃ λ G₁₂' →
SSplit2 G' G₁' G₂ G₁₁' G₁₂' ×
ChannelRef G₁₁' b₁ (selection lab (SType.force s₁₁) (SType.force s₁₂)) ×
ChannelRef G₁₂' b₂ (selection lab (SType.force s₂₁) (SType.force s₂₂)))
vcr-match-2-sb (ssplit2 ss1 ss2) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-pos ina-G₁ (sub-sextern s1<=s1'' s2<=s2'')) lab = nothing
vcr-match-2-sb (ssplit2 ss-[] ()) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-neg ina-G₁ x₁) lab
vcr-match-2-sb (ssplit2 (ss-both ss1) ()) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-neg ina-G₁ x₁) lab
vcr-match-2-sb (ssplit2 (ss-left ss1) (ss-posneg ss2)) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-neg ina-G₁ (sub-sextern s1<=s1'' s2<=s2'')) Left = just ((sub-trans (dual-sub s1<=s1'') (sub-trans (eq-implies-sub (eq-sym (dual-involution _))) s1<=s1')) , (sub-trans (dual-sub s2<=s2'') (sub-trans (eq-implies-sub (eq-sym (dual-involution _))) s2<=s2')) , _ , _ , _ , _ , (ssplit2 (ss-left ss1) (ss-posneg ss2)) , (here-pos ina-G (Sub.force s1<=s1')) , (here-neg ina-G₁ (Sub.force s1<=s1'')))
vcr-match-2-sb (ssplit2 (ss-left ss1) (ss-posneg ss2)) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-neg ina-G₁ (sub-sextern s1<=s1'' s2<=s2'')) Right = just ((sub-trans (dual-sub s1<=s1'') (sub-trans (eq-implies-sub (eq-sym (dual-involution _))) s1<=s1')) , (sub-trans (dual-sub s2<=s2'') (sub-trans (eq-implies-sub (eq-sym (dual-involution _))) s2<=s2')) , _ , _ , _ , _ , (ssplit2 (ss-left ss1) (ss-posneg ss2)) , (here-pos ina-G (Sub.force s2<=s2')) , (here-neg ina-G₁ (Sub.force s2<=s2'')))
vcr-match-2-sb (ssplit2 (ss-right ss1) ()) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-neg ina-G₁ x₁) lab
vcr-match-2-sb (ssplit2 (ss-posneg ss1) ()) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-neg ina-G₁ x₁) lab
vcr-match-2-sb (ssplit2 (ss-negpos ss1) ()) (here-pos ina-G (sub-sintern s1<=s1' s2<=s2')) (here-neg ina-G₁ x₁) lab
vcr-match-2-sb (ssplit2 ss1 ss2) (here-pos ina-G x) (there vcr2) lab = nothing
vcr-match-2-sb (ssplit2 ss-[] ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextern s1<=s1' s2<=s2')) lab
vcr-match-2-sb (ssplit2 (ss-both ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextern s1<=s1' s2<=s2')) lab
vcr-match-2-sb (ssplit2 (ss-left ss1) (ss-negpos ss2)) (here-neg ina-G (sub-sintern s1<=s1'' s2<=s2'')) (here-pos ina-G₁ (sub-sextern s1<=s1' s2<=s2')) Left = just ((sub-trans (dual-sub s1<=s1') s1<=s1'') , ((sub-trans (dual-sub s2<=s2') s2<=s2'') , (_ , (_ , (_ , (_ , ((ssplit2 (ss-left ss1) (ss-negpos ss2)) , ((here-neg ina-G (Sub.force s1<=s1'')) , (here-pos ina-G₁ (Sub.force s1<=s1'))))))))))
vcr-match-2-sb (ssplit2 (ss-left ss1) (ss-negpos ss2)) (here-neg ina-G (sub-sintern s1<=s1'' s2<=s2'')) (here-pos ina-G₁ (sub-sextern s1<=s1' s2<=s2')) Right = just ((sub-trans (dual-sub s1<=s1') s1<=s1'') , ((sub-trans (dual-sub s2<=s2') s2<=s2'') , (_ , (_ , (_ , (_ , ((ssplit2 (ss-left ss1) (ss-negpos ss2)) , ((here-neg ina-G (Sub.force s2<=s2'')) , (here-pos ina-G₁ (Sub.force s2<=s2'))))))))))
vcr-match-2-sb (ssplit2 (ss-right ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextern s1<=s1' s2<=s2')) lab
vcr-match-2-sb (ssplit2 (ss-posneg ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextern s1<=s1' s2<=s2')) lab
vcr-match-2-sb (ssplit2 (ss-negpos ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextern s1<=s1' s2<=s2')) lab
vcr-match-2-sb (ssplit2 ss1 ss2) (here-neg ina-G x) (here-neg ina-G₁ x₁) lab = nothing
vcr-match-2-sb (ssplit2 ss1 ss2) (here-neg ina-G x) (there vcr2) lab = nothing
vcr-match-2-sb (ssplit2 ss1 ss2) (there vcr1) (here-pos ina-G x) lab = nothing
vcr-match-2-sb (ssplit2 ss1 ss2) (there vcr1) (here-neg ina-G x) lab = nothing
vcr-match-2-sb (ssplit2 ss-[] ()) (there vcr1) (there vcr2) lab
vcr-match-2-sb (ssplit2 (ss-both ss1) (ss-both ss2)) (there vcr1) (there vcr2) lab = map (λ { (ds21<=s11 , ds22<=s12 , _ , _ , _ , _ , ssplit2 ss1' ss2' , vcr1' , vcr2') → ds21<=s11 , ds22<=s12 , _ , _ , _ , _ , (ssplit2 (ss-both ss1') (ss-both ss2')) , ((there vcr1') , (there vcr2')) }) (vcr-match-2-sb (ssplit2 ss1 ss2) vcr1 vcr2 lab)
vcr-match-2-sb (ssplit2 (ss-left ss1) ()) (there vcr1) (there vcr2) lab
vcr-match-2-sb (ssplit2 (ss-right ss1) (ss-both ss2)) (there vcr1) (there vcr2) lab = map (λ { (ds21<=s11 , ds22<=s12 , _ , _ , _ , _ , ssplit2 ss1' ss2' , vcr1' , vcr2') → ds21<=s11 , ds22<=s12 , _ , _ , _ , _ , (ssplit2 (ss-right ss1') (ss-both ss2')) , ((there vcr1') , (there vcr2')) }) (vcr-match-2-sb (ssplit2 ss1 ss2) vcr1 vcr2 lab)
vcr-match-2-sb (ssplit2 (ss-posneg ss1) ()) (there vcr1) (there vcr2) lab
vcr-match-2-sb (ssplit2 (ss-negpos ss1) ()) (there vcr1) (there vcr2) lab
vcr-match-2-nsb : ∀ {G G₁ G₂ G₁₁ G₁₂ b₁ b₂ m₁ m₂ alti alte}
→ SSplit2 G G₁ G₂ G₁₁ G₁₂
→ ChannelRef G₁₁ b₁ (sintN m₁ alti)
→ ChannelRef G₁₂ b₂ (sextN m₂ alte)
→ (lab : Fin m₁)
→ Maybe (Σ (m₁ ≤ m₂) λ { p →
((i : Fin m₁) → dual (alti i) ≲ alte (inject≤ i p)) ×
∃ λ G' → ∃ λ G₁' → ∃ λ G₁₁' → ∃ λ G₁₂' →
SSplit2 G' G₁' G₂ G₁₁' G₁₂' ×
ChannelRef G₁₁' b₁ (SType.force (alti lab)) ×
ChannelRef G₁₂' b₂ (SType.force (alte (inject≤ lab p)))})
vcr-match-2-nsb (ssplit2 ss1 ss2) (here-pos ina-G _) (here-pos ina-G₁ _) lab = nothing
vcr-match-2-nsb (ssplit2 ss-[] ()) (here-pos ina-G (sub-sintN m'≤m x)) (here-neg ina-G₁ x₁) lab
vcr-match-2-nsb (ssplit2 (ss-both ss1) ()) (here-pos ina-G (sub-sintN m'≤m x)) (here-neg ina-G₁ x₁) lab
vcr-match-2-nsb {m₁ = m₁} {alti = alti} {alte = alte} (ssplit2 (ss-left ss1) (ss-posneg ss2)) (here-pos ina-G (sub-sintN {alt = alt} m'≤m subint)) (here-neg ina-G₁ (sub-sextN m≤m' subext)) lab = just (≤-trans m'≤m m≤m' , auxSub , _ , _ , _ , _ , (ssplit2 (ss-left ss1) (ss-posneg ss2)) , (here-pos ina-G (Sub.force (subint lab))) , (here-neg ina-G₁ auxExt))
where
auxSub : (i : Fin m₁) → dual (alti i) ≲ alte (inject≤ i (≤-trans m'≤m m≤m'))
auxSub i with subext (inject≤ i m'≤m)
... | r rewrite (inject-trans m≤m' m'≤m i) = sub-trans (dual-sub (subint i)) r
auxExt : dualF (SType.force (alt (inject≤ lab m'≤m))) ≲' SType.force (alte (inject≤ lab (≤-trans m'≤m m≤m')))
auxExt with Sub.force (subext (inject≤ lab m'≤m))
... | se rewrite inject-trans m≤m' m'≤m lab = se
vcr-match-2-nsb (ssplit2 (ss-right ss1) ()) (here-pos ina-G (sub-sintN m'≤m x)) (here-neg ina-G₁ x₁) lab
vcr-match-2-nsb (ssplit2 (ss-posneg ss1) ()) (here-pos ina-G (sub-sintN m'≤m x)) (here-neg ina-G₁ x₁) lab
vcr-match-2-nsb (ssplit2 (ss-negpos ss1) ()) (here-pos ina-G (sub-sintN m'≤m x)) (here-neg ina-G₁ x₁) lab
vcr-match-2-nsb (ssplit2 ss1 ss2) (here-pos ina-G x) (there vcr2) lab = nothing
vcr-match-2-nsb (ssplit2 ss-[] ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextN m≤m' x₁)) lab
vcr-match-2-nsb (ssplit2 (ss-both ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextN m≤m' x₁)) lab
vcr-match-2-nsb {m₁ = m₁} {alti = alti} {alte = alte} (ssplit2 (ss-left ss1) (ss-negpos ss2)) (here-neg ina-G (sub-sintN m'≤m subint)) (here-pos ina-G₁ (sub-sextN {alt = alt} m≤m' subext)) lab = just ((≤-trans m'≤m m≤m') , auxSub , _ , _ , _ , _ , ssplit2 (ss-left ss1) (ss-negpos ss2) , here-neg ina-G (Sub.force (subint lab)) , here-pos ina-G₁ auxExt)
where
auxSub : (i : Fin m₁) → dual (alti i) ≲ alte (inject≤ i (≤-trans m'≤m m≤m'))
auxSub i with subext (inject≤ i m'≤m)
... | sub2 rewrite (inject-trans m≤m' m'≤m i) =
sub-trans (sub-trans (dual-sub (subint i)) (eq-implies-sub (eq-sym (dual-involution _)))) sub2
auxExt : SType.force (alt (inject≤ lab m'≤m)) ≲' SType.force (alte (inject≤ lab (≤-trans m'≤m m≤m')))
auxExt with Sub.force (subext (inject≤ lab m'≤m))
... | se rewrite (inject-trans m≤m' m'≤m lab) = se
vcr-match-2-nsb (ssplit2 (ss-right ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextN m≤m' x₁)) lab
vcr-match-2-nsb (ssplit2 (ss-posneg ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextN m≤m' x₁)) lab
vcr-match-2-nsb (ssplit2 (ss-negpos ss1) ()) (here-neg ina-G x) (here-pos ina-G₁ (sub-sextN m≤m' x₁)) lab
vcr-match-2-nsb (ssplit2 ss1 ss2) (here-neg ina-G x) (here-neg ina-G₁ x₁) lab = nothing
vcr-match-2-nsb (ssplit2 ss1 ss2) (here-neg ina-G x) (there vcr2) lab = nothing
vcr-match-2-nsb (ssplit2 ss1 ss2) (there vcr1) (here-pos ina-G x) lab = nothing
vcr-match-2-nsb (ssplit2 ss1 ss2) (there vcr1) (here-neg ina-G x) lab = nothing
vcr-match-2-nsb (ssplit2 ss-[] ()) (there vcr1) (there vcr2) lab
vcr-match-2-nsb (ssplit2 (ss-both ss1) (ss-both ss2)) (there vcr1) (there vcr2) lab =
map (λ { (m1≤m2 , fdi≤e , _ , _ , _ , _ , ssplit2 ss1' ss2' , vcr1' , vcr2') → m1≤m2 , fdi≤e , _ , _ , _ , _ , (ssplit2 (ss-both ss1') (ss-both ss2')) , there vcr1' , there vcr2' })
(vcr-match-2-nsb (ssplit2 ss1 ss2) vcr1 vcr2 lab)
vcr-match-2-nsb (ssplit2 (ss-left ss1) ()) (there vcr1) (there vcr2) lab
vcr-match-2-nsb (ssplit2 (ss-right ss1) (ss-both ss2)) (there vcr1) (there vcr2) lab =
map (λ { (m1≤m2 , fdi≤e , _ , _ , _ , _ , ssplit2 ss1' ss2' , vcr1' , vcr2') → m1≤m2 , fdi≤e , _ , _ , _ , _ , (ssplit2 (ss-right ss1') (ss-both ss2')) , there vcr1' , there vcr2' })
(vcr-match-2-nsb (ssplit2 ss1 ss2) vcr1 vcr2 lab)
vcr-match-2-nsb (ssplit2 (ss-posneg ss1) ()) (there vcr1) (there vcr2) lab
vcr-match-2-nsb (ssplit2 (ss-negpos ss1) ()) (there vcr1) (there vcr2) lab
|
oeis/182/A182230.asm | neoneye/loda-programs | 11 | 160360 | ; A182230: a(n) = a(n-1)+floor(a(n-2)/4) with a(0)=3, a(1)=4.
; 3,4,4,5,6,7,8,9,11,13,15,18,21,25,30,36,43,52,62,75,90,108,130,157,189,228,275,332,400,483,583,703,848,1023,1235,1490,1798,2170,2619,3161,3815,4605,5558,6709,8098,9775,11799,14242,17191,20751,25048,30235,36497,44055,53179,64192,77486,93534,112905,136288,164514,198586,239714,289360,349288,421628,508950,614357,741594,895183,1080581,1304376,1574521,1900615,2294245,2769398,3342959,4035308,4871047,5879874,7097635,8567603,10342011,12483911,15069413,18190390,21957743,26505340,31994775,38621110
mov $3,1
mov $4,1
lpb $0
sub $0,1
mov $1,$3
add $4,3
div $4,4
add $2,$4
mov $4,$3
mov $3,$2
lpe
add $1,3
mov $0,$1
|
exercises/x86-64-assembly-1-a/x86_64_assembly_1_a.asm | ErikSchierboom/research_experiment_1 | 0 | 241799 | <filename>exercises/x86-64-assembly-1-a/x86_64_assembly_1_a.asm
section .text
global str_isalpha
str_isalpha:
; Provide your implementation here
ret
|
bb-runtimes/src/s-bbsumu__8641d.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 4270 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- SYSTEM.BB.BOARD_SUPPORT.MULTIPROCESSORS --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
-- Copyright (C) 2003-2005 The European Space Agency --
-- Copyright (C) 2003-2016, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
-- The port of GNARL to bare board targets was initially developed by the --
-- Real-Time Systems Group at the Technical University of Madrid. --
-- --
------------------------------------------------------------------------------
with System.BB.Board_Parameters; use System.BB.Board_Parameters;
with System.BB.CPU_Primitives.Multiprocessors;
separate (System.BB.Board_Support)
package body Multiprocessors is
use System.Multiprocessors;
Poke_Interrupt : constant BB.Interrupts.Interrupt_ID := 1;
-- Use interrupt #1
FRR : Unsigned_32;
for FRR'Address use 16#f804_1000#;
pragma Import (Ada, FRR);
-- ePIC's Feature Reporting Register
MCM_PCR : Unsigned_32;
for MCM_PCR'Address use System'To_Address (CCSRBAR + 16#1010#);
pragma Import (Ada, MCM_PCR);
-- Port configuration register
procedure Poke_Handler (Interrupt : BB.Interrupts.Interrupt_ID);
-- Poke interrupt handler
--------------------
-- Number_Of_CPUs --
--------------------
function Number_Of_CPUs return CPU is
NCPUs : CPU;
begin
NCPUs := CPU (Shift_Right (FRR and 16#00001f00#, 8) + 1);
return NCPUs;
end Number_Of_CPUs;
-----------------
-- Current_CPU --
-----------------
function Current_CPU return CPU is
Cpu_Id : Unsigned_32;
for Cpu_Id'Address use System'To_Address (CCSRBAR + 16#4_0090#);
pragma Import (Ada, Cpu_Id);
-- Per-CPU WHOAMI register
begin
return CPU_Range (Cpu_Id) + CPU'First;
end Current_CPU;
--------------
-- Poke_CPU --
--------------
procedure Poke_CPU (CPU_Id : CPU) is
Val : Unsigned_32;
IPI : Unsigned_32;
for IPI'Address use System'To_Address (CCSRBAR + 16#4_0040#);
pragma Import (Ada, IPI);
-- Per-CPU interproces interrupt dispatch register (IPIDR0)
begin
-- Send IPI0 to processor CPU_Id
Val := Shift_Left (1, CPU_Range'Pos (CPU_Id - CPU'First));
IPI := IPI or Val;
end Poke_CPU;
------------------
-- Poke_Handler --
------------------
procedure Poke_Handler (Interrupt : BB.Interrupts.Interrupt_ID) is
Bogus : Unsigned_32;
pragma Unreferenced (Bogus);
IACK : Unsigned_32;
for IACK'Address use System'To_Address (CCSRBAR + 16#4_00a0#);
pragma Import (Ada, IACK);
EOI : Unsigned_32;
for EOI'Address use System'To_Address (CCSRBAR + 16#4_00b0#);
pragma Import (Ada, EOI);
begin
-- Make sure we are handling the right interrupt
pragma Assert (Interrupt = Poke_Interrupt);
-- Acknowledge the interrupt by reading the OpenPIC IACK register
Bogus := IACK;
CPU_Primitives.Multiprocessors.Poke_Handler;
EOI := 0;
end Poke_Handler;
--------------------
-- Start_All_CPUs --
--------------------
procedure Start_All_CPUs is
Val : Unsigned_32;
IPIVPR : Unsigned_32;
for IPIVPR'Address use System'To_Address (CCSRBAR + 16#4_10a0#);
pragma Import (Ada, IPIVPR);
-- IPI0 vector/priority register
PCTP : Unsigned_32;
for PCTP'Address use System'To_Address (CCSRBAR + 16#6_1080#);
pragma Import (Ada, PCTP);
-- Processor 1 current task priority register
begin
BB.Interrupts.Attach_Handler
(Poke_Handler'Access, Poke_Interrupt, Interrupt_Priority'First);
PCTP := 0;
-- Unask IPI, priority 15, vector #0
IPIVPR := (IPIVPR or 16#000f_0000#) and (not 16#8000_0000#);
-- Enable all CPUs
Val := Shift_Left
(Shift_Left (1, CPU_Range'Pos (Number_Of_CPUs)) - 1, 24);
MCM_PCR := MCM_PCR or Val;
end Start_All_CPUs;
end Multiprocessors;
|
src/ada/src/uxas-comms-lmcp_net_client-service-automation_request_validation-spark.adb | pat-rogers/OpenUxAS | 0 | 18073 | <reponame>pat-rogers/OpenUxAS
with Bounded_Dynamic_Strings;
with afrl.cmasi.KeyValuePair; use afrl.cmasi.KeyValuePair;
with Ada.Strings.Unbounded;
with afrl.cmasi.AutomationResponse; use afrl.cmasi.AutomationResponse;
package body UxAS.Comms.LMCP_Net_Client.Service.Automation_Request_Validation.SPARK with SPARK_Mode is
function Prove_Same_Requests_Valid
(This : Configuration_Data;
R, S : My_UniqueAutomationRequest) return Boolean
is (Valid_Automation_Request (This, S))
with
Ghost,
Global => null,
Pre => Same_Requests (R, S) and then Valid_Automation_Request (This, R),
Post => Prove_Same_Requests_Valid'Result;
procedure Prove_Validity_Preserved
(Data1, Data2 : Configuration_Data;
R : My_UniqueAutomationRequest)
with
Ghost,
Global => null,
Pre => Data1 = Data2,
Post => Valid_Automation_Request (Data1, R) = Valid_Automation_Request (Data2, R);
procedure Prove_Validity_Preserved
(Data1, Data2 : Configuration_Data;
R_Queue : UniqueAutomationRequest_Lists.Formal_Model.M.Sequence)
with
Ghost,
Global => null,
Pre => Data1 = Data2,
Post => (for all R of R_Queue => Valid_Automation_Request (Data1, R.Content) = Valid_Automation_Request (Data2, R.Content));
procedure Prove_Validity_Preserved
(Data : Configuration_Data;
R_Queue1, R_Queue2 : UniqueAutomationRequest_Lists.Formal_Model.M.Sequence)
with
Ghost,
Global => null,
Pre => Same_Requests (R_Queue1, R_Queue2),
Post =>
(for all I in 1 .. UniqueAutomationRequest_Lists.Formal_Model.M.Length (R_Queue1) =>
Valid_Automation_Request (Data,
UniqueAutomationRequest_Lists.Formal_Model.Element (R_Queue1, I).Content) =
Valid_Automation_Request (Data,
UniqueAutomationRequest_Lists.Formal_Model.Element (R_Queue2, I).Content));
procedure Prove_Validity_Preserved
(Data1, Data2 : Configuration_Data;
R : My_UniqueAutomationRequest) is null;
procedure Prove_Validity_Preserved
(Data1, Data2 : Configuration_Data;
R_Queue : UniqueAutomationRequest_Lists.Formal_Model.M.Sequence)
is
use UniqueAutomationRequest_Lists.Formal_Model;
begin
for I in 1 .. M.Length (R_Queue) loop
Prove_Validity_Preserved (Data1, Data2, M.Get (R_Queue, I).Content);
pragma Loop_Invariant
(for all J in 1 .. I =>
Valid_Automation_Request (Data1, M.Get (R_Queue, J).Content) = Valid_Automation_Request (Data2, M.Get (R_Queue, J).Content));
end loop;
end Prove_Validity_Preserved;
procedure Prove_Validity_Preserved
(Data : Configuration_Data;
R_Queue1, R_Queue2 : UniqueAutomationRequest_Lists.Formal_Model.M.Sequence) is null;
procedure Send_Next_Request_Wrapper (This : in out Automation_Request_Validator_Service) with
Post => This.Configs'Old = This.Configs
and Same_Requests
(UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks),
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks)'Old)
and Same_Requests
(UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests),
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests)'Old);
-- Wrapper to add a contract to Send_Next_Request
procedure Send_Next_Request_Wrapper (This : in out Automation_Request_Validator_Service) with
SPARK_Mode => Off
is
begin
This.Send_Next_Request;
end Send_Next_Request_Wrapper;
-----------------------------
-- Check_Tasks_Initialized --
-----------------------------
procedure Check_Tasks_Initialized
(This : in out Automation_Request_Validator_Service)
is
-- checks to ensure all tasks are initialized for the requests in the 'task wait' queue
-- if so, moves them to the 'pending' queue, otherwise sets a timer to wait
AreAllTasksReady : Boolean := True;
IsNewPendingRequest : Boolean := False;
All_Requests_Valid_Old : constant Boolean := All_Requests_Valid (This) with Ghost;
begin
while AreAllTasksReady
and then not UniqueAutomationRequest_Lists.Is_Empty
(This.Requests_Waiting_For_Tasks)
loop
pragma Loop_Invariant
(if All_Requests_Valid (This)'Loop_Entry then All_Requests_Valid (This));
declare
use Int64_Vects;
use UniqueAutomationRequest_Lists;
TaskIds : constant Int64_Vect := Get_TaskList_From_OriginalRequest
(First_Element (This.Requests_Waiting_For_Tasks).Content);
Request_Q_Tmp : UniqueAutomationRequest_Ref_Deque with Ghost;
use UniqueAutomationRequest_Lists.Formal_Model;
begin
for I in First_Index (TaskIds) .. Last_Index (TaskIds) loop
declare
use Int64_Sets;
TaskId : constant Int64 := Element (TaskIds, I);
ItStartedTaskId : constant Boolean :=
Contains (This.Configs.Available_Initialized_Tasks, taskId);
begin
if not itStartedTaskId then
AreAllTasksReady := False;
exit;
end if;
end;
end loop;
if AreAllTasksReady then
-- move from 'task wait' queue
IsNewPendingRequest := True;
pragma Assert
(if All_Requests_Valid_Old then
Prove_Same_Requests_Valid
(This.Configs,
M.Get (Model (This.Requests_Waiting_For_Tasks), 1).Content,
First_Element (This.Requests_Waiting_For_Tasks).Content));
Request_Q_Tmp := This.Pending_Requests;
Append (This.Pending_Requests, First_Element (This.Requests_Waiting_For_Tasks));
pragma Assert (if All_Requests_Valid_Old then (for all I in 1 .. Length (Request_Q_Tmp) =>
Prove_Same_Requests_Valid (This.Configs,
M.Get (Model (Request_Q_Tmp), I).Content,
M.Get (Model (This.Pending_Requests), I).Content)));
pragma Assert
(if All_Requests_Valid_Old then
Prove_Same_Requests_Valid (This.Configs, First_Element (This.Requests_Waiting_For_Tasks).Content,
M.Get (Model (This.Pending_Requests), Length (This.Pending_Requests)).Content));
pragma Assert (if All_Requests_Valid_Old then All_Requests_Valid (This));
Request_Q_Tmp := This.Requests_Waiting_For_Tasks;
Delete_First (This.Requests_Waiting_For_Tasks);
pragma Assert
(if All_Requests_Valid_Old then
(for all I in 1 .. Length (This.Requests_Waiting_For_Tasks) =>
Prove_Same_Requests_Valid
(This.Configs,
M.Get (Model (Request_Q_Tmp), I + 1).Content,
M.Get (Model (This.Requests_Waiting_For_Tasks), I).Content)));
-- re-set the task initialized check timer
-- [Claire] ToDo : I could not find TimerManager
-- uxas.Common.TimerManager::getInstance().startSingleShotTimer(m_taskInitTimerId, m_maxResponseTime_ms);
pragma Compile_time_Warning (Standard.True, "Check_Tasks_Initialized is incomplete");
end if;
end;
end loop;
pragma Assert
(if All_Requests_Valid_Old then All_Requests_Valid (This));
-- [Claire] ToDo : I could not find TimerManager
-- if(isNewPendingRequest)
if IsNewPendingRequest then
-- {
-- // if timer not started (i.e. not currently waiting for a response),
-- // then send the one that just got added
-- if(!uxas::common::TimerManager::getInstance().isTimerActive(m_responseTimerId))
-- {
-- sendNextRequest();
declare
Old_Confs : constant Configuration_Data := This.Configs with Ghost;
Old_Pending_Request : constant UniqueAutomationRequest_Lists.Formal_Model.M.Sequence :=
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests) with Ghost;
Old_Waiting_Request : constant UniqueAutomationRequest_Lists.Formal_Model.M.Sequence :=
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks) with Ghost;
begin
Send_Next_Request_Wrapper (This);
Prove_Validity_Preserved (Old_Confs, Old_Waiting_Request, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks));
Prove_Validity_Preserved (Old_Confs, Old_Pending_Request, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests));
Prove_Validity_Preserved (Old_Confs, This.Configs, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks));
Prove_Validity_Preserved (Old_Confs, This.Configs, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests));
pragma Assert
(if All_Requests_Valid_Old then All_Requests_Valid (This));
end;
-- }
-- }
-- else if(!uxas::common::TimerManager::getInstance().isTimerActive(m_taskInitTimerId) && !m_requestsWaitingForTasks.empty())
-- {
-- // top of task-init queue is still not ready, start timer if not already started
-- uxas::common::TimerManager::getInstance().startSingleShotTimer(m_taskInitTimerId, m_maxResponseTime_ms);
-- }
end if;
-- if(m_requestsWaitingForTasks.empty())
-- {
-- // all tasks have been initialized, so disable timer
-- uxas::common::TimerManager::getInstance().disableTimer(m_taskInitTimerId, 0);
-- }
end Check_Tasks_Initialized;
------------------
-- Empty_Vector --
------------------
function Empty_Vector return Int64_Vect is
begin
pragma Warnings (Off);
return V : Int64_Vect do
null;
end return;
pragma Warnings (On);
end Empty_Vector;
-------------------------------
-- Handle_Automation_Request --
-------------------------------
procedure Handle_Automation_Request
(This : in out Automation_Request_Validator_Service;
Auto_Request : My_Object_Any)
is
Request : Object'Class renames Deref (Auto_Request);
UniqueAutomationReq : My_UniqueAutomationRequest;
Id : Int64;
All_Requests_Valid_Old : constant Boolean := All_Requests_Valid (This) with Ghost;
begin
pragma Assert (if All_Requests_Valid_Old then All_Requests_Valid (This));
Get_Unique_Entity_Send_Message_Id (Id);
setRequestID (UniqueAutomationReq, Id);
pragma Assert (if All_Requests_Valid_Old then All_Requests_Valid (This));
-- [Claire] Use membership test instead of IsImpactAutomationRequest
if Request in ImpactAutomationRequest then
declare
Sand : ImpactAutomationRequest renames ImpactAutomationRequest (Request);
Details : constant Request_Details :=
(RequestType => Sandbox_Automation_Request,
Play_Id => Sand.getPlayID,
Soln_Id => Sand.getSolutionID,
Task_Request_Id => <>);
begin
setRequestID (UniqueAutomationReq, Sand.getRequestID);
Int64_Request_Details_Maps.Insert
(This.Sandbox, getRequestID (uniqueAutomationReq), Details);
Copy_OriginalRequest_From_ImpactAutomationRequest
(Target => UniqueAutomationReq,
Source => Sand);
end;
pragma Assert (if All_Requests_Valid_Old then All_Requests_Valid (This));
pragma Assert
(Is_Corresponding_UniqueRequest (uniqueAutomationReq, Request));
-- [Claire] Use membership test instead of IsTaskAutomationRequest
elsif Request in TaskAutomationRequest then
declare
TaskAutomationReq : TaskAutomationRequest renames TaskAutomationRequest (Request);
Details : constant Request_Details :=
(RequestType => Task_Automation_Request,
Task_Request_Id => TaskAutomationReq.getRequestID,
others => <>);
begin
setRequestID (UniqueAutomationReq, TaskAutomationReq.getRequestID);
Copy_OriginalRequest_From_TaskAutomationRequest
(Target => UniqueAutomationReq,
Source => TaskAutomationReq);
Copy_PlanningState_From_TaskAutomationRequest
(Target => UniqueAutomationReq,
Source => TaskAutomationReq);
Int64_Request_Details_Maps.Insert
(This.Sandbox, getRequestID (uniqueAutomationReq), Details);
end;
pragma Assert (if All_Requests_Valid_Old then All_Requests_Valid (This));
pragma Assert
(Is_Corresponding_UniqueRequest (uniqueAutomationReq, Request));
else
declare
Details : constant Request_Details :=
(RequestType => Automation_Request,
others => <>);
begin
Copy_OriginalRequest_From_AutomationRequest
(Target => UniqueAutomationReq,
Source => Auto_Request);
Int64_Request_Details_Maps.Insert
(This.Sandbox, getRequestID (uniqueAutomationReq), Details);
end;
pragma Assert (if All_Requests_Valid_Old then All_Requests_Valid (This));
pragma Assert
(Is_Corresponding_UniqueRequest (uniqueAutomationReq, Request));
end if;
declare
IsReady : Boolean;
Request_Q_Tmp : UniqueAutomationRequest_Ref_Deque;
use UniqueAutomationRequest_Lists;
use UniqueAutomationRequest_Lists.Formal_Model;
begin
Check_Automation_Request_Requirements (This, UniqueAutomationReq, IsReady);
pragma Assert (if All_Requests_Valid_Old then All_Requests_Valid (This));
if IsReady then
Request_Q_Tmp := This.Requests_Waiting_For_Tasks;
Append
(This.Requests_Waiting_For_Tasks, (Content => UniqueAutomationReq));
pragma Assert (Valid_Automation_Request (This.Configs, UniqueAutomationReq));
pragma Assert
(if All_Requests_Valid_Old then
(for all I in 1 ..UniqueAutomationRequest_Lists.Length (Request_Q_Tmp) =>
Prove_Same_Requests_Valid
(This.Configs,
M.Get (Model (Request_Q_Tmp), I).Content,
M.Get (Model (This.Requests_Waiting_For_Tasks), I).Content)));
pragma Assert
(Prove_Same_Requests_Valid (This.Configs, UniqueAutomationReq,
M.Get (Model (This.Requests_Waiting_For_Tasks), Length (This.Requests_Waiting_For_Tasks)).Content));
Check_Tasks_Initialized (This);
end if;
end;
end Handle_Automation_Request;
------------------------------------------
-- IsCheckAutomationRequestRequirements --
------------------------------------------
procedure Check_Automation_Request_Requirements
(This : in out Automation_Request_Validator_Service;
Request : My_UniqueAutomationRequest;
IsReady : out Boolean)
is
procedure Send_Error_Response
(This : in out Automation_Request_Validator_Service;
Request : My_UniqueAutomationRequest;
ReasonForFailure : Bounded_Dynamic_Strings.Sequence;
ErrResponseID : out Int64)
with Post => This.Configs'Old = This.Configs
and Same_Requests
(UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks),
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks)'Old)
and Same_Requests
(UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests),
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests)'Old);
-- [Claire] Code factored out because of access types.
-------------------------
-- Send_Error_Response --
-------------------------
procedure Send_Error_Response
(This : in out Automation_Request_Validator_Service;
Request : My_UniqueAutomationRequest;
ReasonForFailure : Bounded_Dynamic_Strings.Sequence;
ErrResponseID : out Int64)
with SPARK_Mode => Off
is
KValuePair : constant KeyValuePair_Acc := new KeyValuePair;
ErrResponse : constant UniqueAutomationResponse_Acc :=
new UniqueAutomationResponse;
begin
-- [Claire] ToDo : What is that?
-- UXAS_LOG_WARN(reasonForFailure.str());
KValuePair.setKey (Ada.Strings.Unbounded.To_Unbounded_String ("RequestValidator"));
KValuePair.setValue (Ada.Strings.Unbounded.To_Unbounded_String (Bounded_Dynamic_Strings.Value (ReasonForFailure)));
if ErrResponse.getOriginalResponse = null then
ErrResponse.setOriginalResponse (new AutomationResponse);
end if;
ErrResponse.setResponseID (getRequestID (Request));
afrl.cmasi.AutomationResponse.Vect_KeyValuePair_Acc.Append (ErrResponse.GetOriginalResponse.GetInfo.all, KValuePair);
Send_Response(This, ErrResponse);
ErrResponseID := ErrResponse.getResponseID;
end Send_Error_Response;
use Int64_Vects;
use Bounded_Dynamic_Strings;
ReasonForFailure : Sequence (100) :=
Instance
(100, String'("Automation Request ID["
& Int64'Image (getRequestID (Request)) & "] Not Ready ::"));
EntityIds : constant Int64_Vect :=
Get_EntityList_From_OriginalRequest (Request);
begin
IsReady := True;
if not Is_Empty (EntityIds) then
-- check for required entity configurations, if none are required, make sure there is at least one
if not (Int64_Sets.Is_Empty (This.Configs.Available_Configuration_Entity_Ids)) then
-- [Claire] Redundant check?
if not Is_Empty (EntityIds) then
for I in First_Index (EntityIds) .. Last_Index (EntityIds) loop
declare
use Int64_Sets;
Id : constant Int64 := Element (EntityIds, I);
begin
if not Contains (This.Configs.Available_Configuration_Entity_Ids, Id) then
Append (To => ReasonForFailure,
Tail => String'("- EntityConfiguration for Entity Id["
& Int64'Image (id) & "] not available."));
IsReady := False;
end if;
pragma Loop_Invariant
(IsReady
= (for all K in First_Index (EntityIds) .. I =>
Contains (This.Configs.Available_Configuration_Entity_Ids, Element (EntityIds, K))));
end;
end loop;
end if;
else
Append (To => ReasonForFailure,
Tail => "- No EntityConfigurations available." );
IsReady := False;
end if;
-- check for required entity states, if none are required, make sure there is at least one with matching configuration
if not (Int64_Sets.Is_Empty (This.Configs.Available_State_Entity_Ids)) then
for I in First_Index (EntityIds) .. Last_Index (EntityIds) loop
pragma Loop_Invariant
(IsReady = (IsReady'Loop_Entry
and then ((for all K in First_Index (EntityIds) .. I - 1 =>
Int64_Sets.Contains (This.Configs.Available_State_Entity_Ids, Element (EntityIds, K))
or Contains (Get_PlanningStates_Ids (Request), Element (EntityIds, K))))));
declare
use Int64_Sets;
Id : constant Int64 := Element (EntityIds, I);
IsReadyLocal : Boolean := false;
begin
if Contains (This.Configs.Available_State_Entity_Ids, Id) then
IsReadyLocal := true;
end if;
if not IsReadyLocal then
declare
planningStateIds : constant Int64_Vect :=
Get_PlanningStates_Ids (Request);
begin
for I in First_Index (planningStateIds) .. Last_Index (planningStateIds) loop
declare
planningStateId : constant Int64 := Element (planningStateIds, I);
begin
if planningStateId = Id then
pragma Assert (Contains (Get_PlanningStates_Ids (Request), Id));
IsReadyLocal := true;
exit;
end if;
end;
pragma Loop_Invariant
(for all K in First_Index (planningStateIds) .. I =>
Element (planningStateIds, K) /= Id);
end loop;
end;
end if;
pragma Assert
(IsReadyLocal =
(Contains (This.Configs.Available_State_Entity_Ids, Element (EntityIds, I))
or Contains (Get_PlanningStates_Ids (Request), Element (EntityIds, I))));
if not IsReadyLocal then
IsReady := False;
Append (To => ReasonForFailure,
Tail => "- EntityState for Entity Id["
& Int64'Image (id) & "] not available.");
end if;
end;
end loop;
pragma Assert
(IsReady =
Check_For_Required_Entity_Configurations
(Entity_Ids => EntityIds,
Configurations => This.Configs.Available_Configuration_Entity_Ids,
States => This.Configs.Available_State_Entity_Ids,
Planning_States => Get_PlanningStates_Ids (Request)));
else
Append (To => ReasonForFailure,
Tail => "- No EntityStates available.");
IsReady := False;
pragma Assert
(not (Int64_Sets.Contains
(This.Configs.Available_State_Entity_Ids, Int64_Vects.First_Element (EntityIds))));
pragma Assert
(not Check_For_Required_Entity_Configurations
(Entity_Ids => EntityIds,
Configurations => This.Configs.Available_Configuration_Entity_Ids,
States => This.Configs.Available_State_Entity_Ids,
Planning_States => Get_PlanningStates_Ids (Request)));
end if;
pragma Assert
(IsReady =
Check_For_Required_Entity_Configurations
(Entity_Ids => EntityIds,
Configurations => This.Configs.Available_Configuration_Entity_Ids,
States => This.Configs.Available_State_Entity_Ids,
Planning_States => Get_PlanningStates_Ids (Request)));
else -- if(!uniqueAutomationRequest->getOriginalRequest()->getEntityList().empty())
pragma Assert (Is_Empty (EntityIds));
if not (Int64_Sets.Is_Empty (This.Configs.Available_Configuration_Entity_Ids))
and then not Int64_Sets.Is_Empty (This.Configs.Available_State_Entity_Ids)
then
declare
IsFoundAMatch : Boolean := False;
use Int64_Sets;
use Int64_Sets.Formal_Model;
use all type P.Map;
use all type E.Sequence;
begin
-- [Claire] Should one of the loops be on This.Available_State_Entity_Ids ?
-- I assumed so and corrected the loop.
for Id1 in This.Configs.Available_Configuration_Entity_Ids loop
pragma Loop_Invariant
(for all K in 1 .. Get (Positions (This.Configs.Available_Configuration_Entity_Ids), Id1) - 1 =>
not Contains (This.Configs.Available_State_Entity_Ids, Get (Elements (This.Configs.Available_Configuration_Entity_Ids), K)));
pragma Loop_Invariant (not IsFoundAMatch);
for Id2 in This.Configs.Available_State_Entity_Ids loop
if Element (This.Configs.Available_Configuration_Entity_Ids, Id1) = Element (This.Configs.Available_State_Entity_Ids, Id2) then
IsFoundAMatch := True;
exit;
end if;
pragma Loop_Invariant
(for all K in 1 .. Get (Positions (This.Configs.Available_State_Entity_Ids), Id2) =>
Element (This.Configs.Available_Configuration_Entity_Ids, Id1) /= Get (Elements (This.Configs.Available_State_Entity_Ids), K));
pragma Loop_Invariant (not IsFoundAMatch);
end loop;
if IsFoundAMatch then
exit;
end if;
end loop;
if not IsFoundAMatch then
Append (To => ReasonForFailure,
Tail => "- No EntityStates that match EntityConfigurations are available.");
IsReady := False;
end if;
end;
else
if Int64_Sets.Is_Empty (This.Configs.Available_Configuration_Entity_Ids) then
Append (To => ReasonForFailure,
Tail => "- No EntityConfigurations available." );
else
Append (To => ReasonForFailure,
Tail => "- No EntityStates available.");
end if;
IsReady := False;
end if;
pragma Assert
(IsReady =
Check_For_Required_Entity_Configurations
(Entity_Ids => EntityIds,
Configurations => This.Configs.Available_Configuration_Entity_Ids,
States => This.Configs.Available_State_Entity_Ids,
Planning_States => Get_PlanningStates_Ids (Request)));
end if;
pragma Assert_And_Cut
(IsReady =
Check_For_Required_Entity_Configurations
(Entity_Ids => EntityIds,
Configurations => This.Configs.Available_Configuration_Entity_Ids,
States => This.Configs.Available_State_Entity_Ids,
Planning_States => Get_PlanningStates_Ids (Request)));
-- check for required operating region and keepin/keepout zones
if Get_OperatingRegion_From_OriginalRequest (Request) /= 0 then
declare
use all type Int64_Operating_Region_Maps.Cursor;
Pos : constant Int64_Operating_Region_Maps.Cursor :=
Find (This.Configs.Available_Operating_Regions,
Get_OperatingRegion_From_OriginalRequest (Request));
begin
if Pos /= Int64_Operating_Region_Maps.No_Element then
pragma Assert (Contains (This.Configs.Available_Operating_Regions,
Get_OperatingRegion_From_OriginalRequest (Request)));
declare
ItOperatingRegion : constant OperatingRegionAreas :=
Element (This.Configs.Available_Operating_Regions, Pos);
KeepInAreas : constant Int64_Vect := ItOperatingRegion.KeepInAreas;
KeepOutAreas : constant Int64_Vect := ItOperatingRegion.KeepOutAreas;
use Int64_Sets;
begin
for I in First_Index (KeepInAreas) .. Last_Index (KeepInAreas) loop
declare
KeepInArea : constant Int64 := Element (KeepInAreas, I);
begin
if not Contains (This.Configs.Available_KeepIn_Zones_Ids, KeepInArea) then
Append (To => ReasonForFailure,
Tail => "- KeepInArea Id["
& Int64'Image (keepInArea) & "] not available.");
IsReady := False;
end if;
pragma Loop_Invariant
(IsReady =
(IsReady'Loop_Entry and then
(for all K in First_Index (KeepInAreas) .. I =>
Contains (This.Configs.Available_KeepIn_Zones_Ids, Element (KeepInAreas, K)))));
end;
end loop;
for I in First_Index (KeepOutAreas) .. Last_Index (KeepOutAreas) loop
declare
KeepOutArea : constant Int64 := Element (KeepOutAreas, I);
begin
if not Contains (This.Configs.Available_KeepOut_Zones_Ids, KeepOutArea) then
Append (To => ReasonForFailure,
Tail => "- KeepOutArea Id["
& Int64'Image (keepOutArea) & "] not available.");
IsReady := False;
end if;
pragma Loop_Invariant
(IsReady =
(IsReady'Loop_Entry and then
(for all K in First_Index (KeepOutAreas) .. I =>
Contains (This.Configs.Available_KeepOut_Zones_Ids, Element (KeepOutAreas, K)))));
end;
end loop;
end;
pragma Assert
(IsReady =
(Check_For_Required_Entity_Configurations
(Entity_Ids => EntityIds,
Configurations => This.Configs.Available_Configuration_Entity_Ids,
States => This.Configs.Available_State_Entity_Ids,
Planning_States => Get_PlanningStates_Ids (Request))
and then
Check_For_Required_Operating_Region_And_Keepin_Keepout_Zones
(Operating_Region => Get_OperatingRegion_From_OriginalRequest (Request),
Operating_Regions => This.Configs.Available_Operating_Regions,
KeepIn_Zones_Ids => This.Configs.Available_KeepIn_Zones_Ids,
KeepOut_Zones_Ids => This.Configs.Available_KeepOut_Zones_Ids)));
else
Append (To => ReasonForFailure,
Tail => "- OperatingRegion Id["
& Int64'Image (Get_OperatingRegion_From_OriginalRequest (Request))
& "] not available.");
IsReady := False;
pragma Assert
(not Check_For_Required_Operating_Region_And_Keepin_Keepout_Zones
(Operating_Region => Get_OperatingRegion_From_OriginalRequest (Request),
Operating_Regions => This.Configs.Available_Operating_Regions,
KeepIn_Zones_Ids => This.Configs.Available_KeepIn_Zones_Ids,
KeepOut_Zones_Ids => This.Configs.Available_KeepOut_Zones_Ids));
end if;
end;
end if;
pragma Assert_And_Cut
(IsReady =
(Check_For_Required_Entity_Configurations
(Entity_Ids => EntityIds,
Configurations => This.Configs.Available_Configuration_Entity_Ids,
States => This.Configs.Available_State_Entity_Ids,
Planning_States => Get_PlanningStates_Ids (Request))
and then
Check_For_Required_Operating_Region_And_Keepin_Keepout_Zones
(Operating_Region => Get_OperatingRegion_From_OriginalRequest (Request),
Operating_Regions => This.Configs.Available_Operating_Regions,
KeepIn_Zones_Ids => This.Configs.Available_KeepIn_Zones_Ids,
KeepOut_Zones_Ids => This.Configs.Available_KeepOut_Zones_Ids)));
-- check for required tasks and task requirements
declare
TaskIds : constant Int64_Vect := Get_TaskList_From_OriginalRequest (Request);
begin
for I in First_Index (TaskIds) .. Last_Index (TaskIds) loop
pragma Loop_Invariant
(IsReady =
(IsReady'Loop_Entry and then
(for all K in First_Index (TaskIds) .. I - 1 =>
Int64_CMASI_Task_Maps.Contains
(This.Configs.Available_Tasks, Element (TaskIds, K))
and then Check_For_Specific_Task_Requirements
(Available_Area_of_Interest_Ids => This.Configs.Available_Area_of_Interest_Ids,
Available_Line_of_Interest_Ids => This.Configs.Available_Line_of_Interest_Ids,
Available_Point_of_Interest_Ids => This.Configs.Available_Point_of_Interest_Ids,
ItTask => Int64_CMASI_Task_Maps.Element
(This.Configs.Available_Tasks, Element (TaskIds, K))))));
declare
use Int64_CMASI_Task_Maps;
TaskId : constant Int64 := Element (TaskIds, I);
Pos : constant Cursor := Find (This.Configs.Available_Tasks, TaskId);
IsReadyPrev : constant Boolean := IsReady with Ghost;
begin
if Pos /= No_Element then
declare
ItTask : constant Task_Kind_And_Id :=
Element (This.Configs.Available_Tasks, Pos);
use Int64_Sets;
begin
-- check for specific task requirements
if ItTask.Kind = AngledAreaSearchTask then
if ItTask.SearchAreaID /= 0 then
if not Contains (This.Configs.Available_Area_of_Interest_Ids,
ItTask.SearchAreaID)
then
Append (To => ReasonForFailure,
Tail => "- AreaOfInterest Id["
& Int64'Image (ItTask.SearchAreaID)
& "] not available.");
IsReady := false;
end if;
end if;
elsif ItTask.Kind = ImpactLineSearchTask then
if ItTask.LineID /= 0 then
if not Contains (This.Configs.Available_Line_of_Interest_Ids,
ItTask.LineID)
then
Append (To => ReasonForFailure,
Tail => "- LineOfInterest Id["
& Int64'Image (ItTask.LineID)
& "] not available.");
IsReady := False;
end if;
end if;
elsif ItTask.Kind = ImpactPointSearchTask then
if ItTask.SearchLocationID /= 0 then
if not Contains (This.Configs.Available_Point_of_Interest_Ids,
ItTask.SearchLocationID)
then
Append (To => ReasonForFailure,
-- Point of interest ??
Tail => "- LineOfInterest Id["
& Int64'Image (ItTask.SearchLocationID)
& "] not available.");
IsReady := False;
end if;
end if;
end if;
pragma Assert
(IsReady = (IsReadyPrev and then
Check_For_Specific_Task_Requirements
(Available_Area_of_Interest_Ids => This.Configs.Available_Area_of_Interest_Ids,
Available_Line_of_Interest_Ids => This.Configs.Available_Line_of_Interest_Ids,
Available_Point_of_Interest_Ids => This.Configs.Available_Point_of_Interest_Ids,
ItTask => ItTask)));
end;
else
pragma Assert (not Int64_CMASI_Task_Maps.Contains
(This.Configs.Available_Tasks, TaskId));
Append (To => ReasonForFailure,
Tail => "- Task with the Id[" & Int64'Image (TaskId)
& "] is unknown. Ensure task description preceeds automation request.");
IsReady := False;
end if;
pragma Assert
(IsReady = (IsReadyPrev and then
Int64_CMASI_Task_Maps.Contains
(This.Configs.Available_Tasks, Element (TaskIds, I))
and then Check_For_Specific_Task_Requirements
(Available_Area_of_Interest_Ids => This.Configs.Available_Area_of_Interest_Ids,
Available_Line_of_Interest_Ids => This.Configs.Available_Line_of_Interest_Ids,
Available_Point_of_Interest_Ids => This.Configs.Available_Point_of_Interest_Ids,
ItTask => Int64_CMASI_Task_Maps.Element
(This.Configs.Available_Tasks, Element (TaskIds, I)))));
end;
end loop;
end;
pragma Assert (IsReady = Valid_Automation_Request (This.Configs, Request));
if not IsReady then
declare
ErrResponseID : Int64;
Old_Confs : constant Configuration_Data := This.Configs with Ghost;
Old_Pending_Request : constant UniqueAutomationRequest_Lists.Formal_Model.M.Sequence :=
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests) with Ghost;
Old_Waiting_Request : constant UniqueAutomationRequest_Lists.Formal_Model.M.Sequence :=
UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks) with Ghost;
begin
Send_Error_Response (This, Request, ReasonForFailure, ErrResponseID);
Prove_Validity_Preserved (Old_Confs, This.Configs, Request);
Prove_Validity_Preserved (Old_Confs, Old_Pending_Request, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests));
Prove_Validity_Preserved (Old_Confs, Old_Waiting_Request, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks));
Prove_Validity_Preserved (Old_Confs, This.Configs, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Pending_Requests));
Prove_Validity_Preserved (Old_Confs, This.Configs, UniqueAutomationRequest_Lists.Formal_Model.Model (This.Requests_Waiting_For_Tasks));
Int64_Request_Details_Maps.Delete (This.Sandbox, ErrResponseID);
end;
end if;
end Check_Automation_Request_Requirements;
end UxAS.Comms.LMCP_Net_Client.Service.Automation_Request_Validation.SPARK;
|
alloy4fun_models/trashltl/models/7/6za4n2GXeYwciDE28.als | Kaixi26/org.alloytools.alloy | 0 | 790 | <filename>alloy4fun_models/trashltl/models/7/6za4n2GXeYwciDE28.als<gh_stars>0
open main
pred id6za4n2GXeYwciDE28_prop8 {
eventually ( some f1,f2 : File | f1->f2 in link implies f1 in Trash )
}
pred __repair { id6za4n2GXeYwciDE28_prop8 }
check __repair { id6za4n2GXeYwciDE28_prop8 <=> prop8o } |
programs/oeis/189/A189631.asm | neoneye/loda | 22 | 167478 | ; A189631: Partial sums of A189628.
; 0,0,1,1,1,2,2,3,3,3,3,4,4,4,5,5,6,6,6,6,7,7,8,8,8,8,9,9,9,10,10,10,11,11,12,12,12,12,13,13,13,14,14,15,15,15,15,16,16,17,17,17,17,18,18,18,19,19,19,20,20,21,21,21,21,22,22,23,23,23,23,24,24,24,25,25,25,26,26,27,27,27
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,189628 ; Fixed point of the morphism 0->001, 1->010.
add $1,$0
lpe
mov $0,$1
|
oeis/020/A020108.asm | neoneye/loda-programs | 11 | 170827 | ; A020108: Ceiling of GAMMA(n+1/10)/GAMMA(1/10).
; Submitted by <NAME>
; 1,1,1,1,1,3,15,92,649,5253,47802,482797,5359036,64844333,849460757,11977396666,180858689642,2911824903230,49792205845229,901238925798639,17213663482753994,345994636003355265,7300486819670796088
mov $2,$0
cmp $2,0
add $0,$2
seq $0,20063 ; Integer part of Gamma(n+1/10)/Gamma(1/10).
add $0,1
|
game-projects/Sonic2/Objects/SpecialStage/HalfPipe/HalfPipe.asm | wide-dot/thomson-to8-game-engine | 11 | 101414 | <reponame>wide-dot/thomson-to8-game-engine<filename>game-projects/Sonic2/Objects/SpecialStage/HalfPipe/HalfPipe.asm
; ---------------------------------------------------------------------------
; Object - Special Stage
;
; input REG : [u] pointer to Object Status Table (OST)
; ---------
;
; Two objects in one to reduce the call of page swap routine
;
; ---------------------------------------------------------------------------
INCLUDE "./Objects/SpecialStage/SSBomb/Constants.asm"
INCLUDE "./Engine/Macros.asm"
HalfPipe_Img_Duration equ 5 ; (min value = 5) track maximum refresh rate: 50Hz/HalfPipe_Img_Duration= x fps
HalfPipe_one_z_step equ (HalfPipe_Img_z_depth*256)/HalfPipe_Img_Duration
SpecialStage
lda routine,u
asla
ldx #SpecialStage_Routines
jmp [a,x]
SpecialStage_Routines
fdb SpecialStage_Init
fdb SpecialStage_Main
*; ===========================================================================
*; loc_4F64:
SpecialStage_Init *SpecialStage:
inc routine,u
lda Current_Special_Stage
cmpa #7 * cmpi.b #7,(Current_Special_Stage).w
blo @a * blo.s +
clr Current_Special_Stage * move.b #0,(Current_Special_Stage).w
@a *+
* move.w #SndID_SpecStageEntry,d0 ; play that funky special stage entry sound
* bsr.w PlaySound
* move.b #MusID_FadeOut,d0 ; fade out the music
* bsr.w PlayMusic
* bsr.w Pal_FadeToWhite
* tst.w (Two_player_mode).w
* beq.s +
* move.w #0,(Two_player_mode).w
* st.b (SS_2p_Flag).w ; set to -1
* bra.s ++
*; ===========================================================================
*+
* sf.b (SS_2p_Flag).w ; set to 0
*; (!)
*+
* move #$2700,sr ; Mask all interrupts
* lea (VDP_control_port).l,a6
* move.w #$8B03,(a6) ; EXT-INT disabled, V scroll by screen, H scroll by line
* move.w #$8004,(a6) ; H-INT disabled
* move.w #$8ADF,(Hint_counter_reserve).w ; H-INT every 224th scanline
* move.w #$8200|(VRAM_SS_Plane_A_Name_Table1/$400),(a6) ; PNT A base: $C000
* move.w #$8400|(VRAM_SS_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $A000
* move.w #$8C08,(a6) ; H res 32 cells, no interlace, S/H enabled
* move.w #$9003,(a6) ; Scroll table size: 128x32
* move.w #$8700,(a6) ; Background palette/color: 0/0
* move.w #$8D00|(VRAM_SS_Horiz_Scroll_Table/$400),(a6) ; H scroll table base: $FC00
* move.w #$8500|(VRAM_SS_Sprite_Attribute_Table/$200),(a6) ; Sprite attribute table base: $F800
* move.w (VDP_Reg1_val).w,d0
* andi.b #$BF,d0
* move.w d0,(VDP_control_port).l
*
*; /------------------------------------------------------------------------\
*; | We're gonna zero-fill a bunch of VRAM regions. This was done by macro, |
*; | so there's gonna be a lot of wasted cycles. |
*; \------------------------------------------------------------------------/
*
* dmaFillVRAM 0,VRAM_SS_Plane_A_Name_Table2,VRAM_SS_Plane_Table_Size ; clear Plane A pattern name table 1
* dmaFillVRAM 0,VRAM_SS_Plane_A_Name_Table1,VRAM_SS_Plane_Table_Size ; clear Plane A pattern name table 2
* dmaFillVRAM 0,VRAM_SS_Plane_B_Name_Table,VRAM_SS_Plane_Table_Size ; clear Plane B pattern name table
* dmaFillVRAM 0,VRAM_SS_Horiz_Scroll_Table,VRAM_SS_Horiz_Scroll_Table_Size ; clear Horizontal scroll table
*
* clr.l (Vscroll_Factor).w
* clr.l (unk_F61A).w
* clr.b (SpecialStage_Started).w
*
*; /------------------------------------------------------------------------\
*; | Now we clear out some regions in main RAM where we want to store some |
*; | of our data structures. |
*; \------------------------------------------------------------------------/
* ; Bug: These '+4's shouldn't be here; clearRAM accidentally clears an additional 4 bytes
* clearRAM SS_Sprite_Table,SS_Sprite_Table_End+4
* clearRAM SS_Horiz_Scroll_Buf_1,SS_Horiz_Scroll_Buf_1_End+4
* clearRAM SS_Misc_Variables,SS_Misc_Variables_End+4
* clearRAM SS_Sprite_Table_Input,SS_Sprite_Table_Input_End
* clearRAM SS_Object_RAM,SS_Object_RAM_End
*
* ; However, the '+4' after SS_Misc_Variables_End is very useful. It resets the
* ; VDP_Command_Buffer queue, avoiding graphical glitches in the Special Stage.
* ; In fact, without reset of the VDP_Command_Buffer queue, Tails sprite DPLCs and other
* ; level DPLCs that are still in the queue erase the Special Stage graphics the next
* ; time ProcessDMAQueue is called.
* ; This '+4' doesn't seem to be intentional, because of the other useless '+4' above,
* ; and because a '+2' is enough to reset the VDP_Command_Buffer queue and fix this bug.
* ; This is a fortunate accident!
* ; Note that this is not a clean way to reset the VDP_Command_Buffer queue because the
* ; VDP_Command_Buffer_Slot address shall be updated as well. They tried to do that in a
* ; clean way after branching to ClearScreen (see below). But they messed up by doing it
* ; after several WaitForVint calls.
* ; You can uncomment the two lines below to clear the VDP_Command_Buffer queue intentionally.
* ;clr.w (VDP_Command_Buffer).w
* ;move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
*
* move #$2300,sr
* lea (VDP_control_port).l,a6
* move.w #$8F02,(a6) ; VRAM pointer increment: $0002
* bsr.w ssInitTableBuffers
* bsr.w ssLdComprsdData
; moved to HalfPipe_Init * move.w #0,(SpecialStage_CurrentSegment).w
* moveq #PLCID_SpecialStage,d0
* bsr.w RunPLC_ROM
* clr.b (Level_started_flag).w
* move.l #0,(Camera_X_pos).w ; probably means something else in this context
* move.l #0,(Camera_Y_pos).w
* move.l #0,(Camera_X_pos_copy).w
* move.l #0,(Camera_Y_pos_copy).w
* cmpi.w #1,(Player_mode).w ; is this a Tails alone game?
* bgt.s + ; if yes, branch
ldu #MainCharacter
;lda #ObjID_SSSonic
;sta id,u * move.b #ObjID_SonicSS,(MainCharacter+id).w ; load Obj09 (special stage Sonic)
* tst.w (Player_mode).w ; is this a Sonic and Tails game?
* bne.s ++ ; if not, branch
*+ move.b #ObjID_TailsSS,(Sidekick+id).w ; load Obj10 (special stage Tails)
;ldu #SpecialStageHUD
;lda #ObjID_SSHUD
;sta id,u *+ move.b #ObjID_SSHUD,(SpecialStageHUD+id).w ; load Obj5E (special stage HUD)
;ldu #SpecialStageStartBanner
;lda #ObjID_StartBanner
;sta id,u * move.b #ObjID_StartBanner,(SpecialStageStartBanner+id).w ; load Obj5F (special stage banner)
;ldu #SpecialStageNumberOfRings
;lda #ObjID_SSNumberOfRings
;sta id,u * move.b #ObjID_SSNumberOfRings,(SpecialStageNumberOfRings+id).w ; load Obj87 (special stage ring count)
lda #$00
sta SS_Offset_X * move.w #$80,(SS_Offset_X).w
sta SS_Offset_Y * move.w #$36,(SS_Offset_Y).w
* bsr.w SSPlaneB_Background
* bsr.w SSDecompressPlayerArt
jsr SSInitPalAndData * bsr.w SSInitPalAndData
; Set Key Frame
; --------------------------------------------
ldb #$02 ; load page 2
stb $E7E5 ; in data space ($A000-$DFFF)
ldx #Bgi_specialStage
jsr DrawFullscreenImage
IFDEF TRACK_INTERLACED
ldx #$3333
jsr ClearInterlacedEvenDataMemory
ENDC
IFDEF TRACK_HALFLINES
ldx #$3333
jsr ClearInterlacedOddDataMemory
ENDC
lda $E7DD ; set border color
anda #$F0
adda #$03 ; color ref
sta $E7DD
anda #$0F
adda #$80
sta glb_screen_border_color+1 ; maj WaitVBL
jsr WaitVBL
ldb #$03 ; load page 3
stb $E7E5 ; data space ($A000-$DFFF)
ldx #Bgi_specialStage
jsr DrawFullscreenImage
IFDEF TRACK_INTERLACED
ldx #$3333
jsr ClearInterlacedOddDataMemory
ENDC
IFDEF TRACK_HALFLINES
ldx #$3333
jsr ClearInterlacedOddDataMemory
ENDC
lda #IdImg_tk_key_004 ; store original image id for access
sta SSTrack_mapping_frame ; of perspective data
ldd #Pal_HalfPipe
std Cur_palette
clr Refresh_palette
* move.l #$C0000,(SS_New_Speed_Factor).w
* clr.w (Ctrl_1_Logical).w
* clr.w (Ctrl_2_Logical).w
*
*- move.b #VintID_S2SS,(Vint_routine).w
jsr WaitVBL * bsr.w WaitForVint
* move.b (SSTrack_drawing_index).w,d0
* bne.s -
*
; Init Track_Draw
; --------------------------------------------
ldu #HalfPipeEven
lda #ObjID_HalfPipe
sta id,u
jsr HalfPipe_Init
ldu #HalfPipeOdd
lda #ObjID_HalfPipe
sta id,u
jsr HalfPipe_Init * bsr.w SSTrack_Draw
*
*- move.b #VintID_S2SS,(Vint_routine).w
* bsr.w WaitForVint
* bsr.w SSTrack_Draw
* bsr.w SSLoadCurrentPerspective
* bsr.w SSObjectsManager
* move.b (SSTrack_duration_timer).w,d0
* subq.w #1,d0
* bne.s -
*
* jsr (Obj5A_CreateRingsToGoText).l
* bsr.w SS_ScrollBG
* jsr (RunObjects).l
* jsr (BuildSprites).l
* bsr.w RunPLC_RAM
* move.b #VintID_CtrlDMA,(Vint_routine).w
* bsr.w WaitForVint
lda #$01 ; 1: play 60hz track at 50hz, 0: do not skip frames
sta Smps.60HzData
jsr IrqSet50Hz
jsr YM2413_DrumModeOn
ldx #Smps_SpecialStage * move.w #MusID_SpecStage,d0
jmp PlayMusic * bsr.w PlayMusic
* move.w (VDP_Reg1_val).w,d0
* ori.b #$40,d0
* move.w d0,(VDP_control_port).l
; Pal fade in * bsr.w Pal_FadeFromWhite
*
*- bsr.w PauseGame
* move.w (Ctrl_1).w,(Ctrl_1_Logical).w
* move.w (Ctrl_2).w,(Ctrl_2_Logical).w
* cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode?
* bne.w SpecialStage_Unpause ; if not, branch
* move.b #VintID_S2SS,(Vint_routine).w
* bsr.w WaitForVint
* bsr.w SSTrack_Draw
* bsr.w SSSetGeometryOffsets
* bsr.w SSLoadCurrentPerspective
* bsr.w SSObjectsManager
* bsr.w SS_ScrollBG
* jsr (RunObjects).l
* jsr (BuildSprites).l
* bsr.w RunPLC_RAM
* tst.b (SpecialStage_Started).w
* beq.s -
*
* moveq #PLCID_SpecStageBombs,d0
* bsr.w LoadPLC
rts *
SpecialStage_Main *- bsr.w PauseGame
* cmpi.b #GameModeID_SpecialStage,(Game_Mode).w ; special stage mode?
* bne.w SpecialStage_Unpause ; if not, branch
* move.b #VintID_S2SS,(Vint_routine).w
* bsr.w WaitForVint
IFDEF TRACK_INTERLACED
lda $E7E5
cmpa #$02
beq SSM_Odd
ENDC
ldu #HalfPipeEven
jsr HalfPipe_Display
IFDEF TRACK_INTERLACED
bra SSM_Skip
SSM_Odd
ENDC
IFDEF TRACK_HALFLINES
ELSE
ldu #HalfPipeOdd
jsr HalfPipe_Display * bsr.w SSTrack_Draw
ENDC
SSM_Skip
jsr SSSetGeometryOffsets * bsr.w SSSetGeometryOffsets
; moved to SSBomb * bsr.w SSLoadCurrentPerspective
jsr SSObjectsManager * bsr.w SSObjectsManager
* bsr.w SS_ScrollBG
* bsr.w PalCycle_SS
* tst.b (SS_Pause_Only_flag).w
* beq.s +
* move.w (Ctrl_1).w,d0
* andi.w #(button_start_mask<<8)|button_start_mask,d0
* move.w d0,(Ctrl_1_Logical).w
* move.w (Ctrl_2).w,d0
* andi.w #(button_start_mask<<8)|button_start_mask,d0
* move.w d0,(Ctrl_2_Logical).w
* bra.s ++
*; ===========================================================================
*+
* move.w (Ctrl_1).w,(Ctrl_1_Logical).w
* move.w (Ctrl_2).w,(Ctrl_2_Logical).w
*+
* jsr (RunObjects).l
* tst.b (SS_Check_Rings_flag).w
* bne.s +
* jsr (BuildSprites).l
* bsr.w RunPLC_RAM
rts * bra.s -
*; ===========================================================================
*+
* andi.b #7,(Emerald_count).w
* tst.b (SS_2p_Flag).w
* beq.s +
* lea (SS2p_RingBuffer).w,a0
* move.w (a0)+,d0
* add.w (a0)+,d0
* add.w (a0)+,d0
* add.w (a0)+,d0
* add.w (a0)+,d0
* add.w (a0)+,d0
* bra.s ++
*; ===========================================================================
*+
* move.w (Ring_count).w,d0
* add.w (Ring_count_2P).w,d0
*+
* cmp.w (SS_Perfect_rings_left).w,d0
* bne.s +
* st.b (Perfect_rings_flag).w
*+
* bsr.w Pal_FadeToWhite
* tst.w (Two_player_mode_copy).w
* bne.w loc_540C
* move #$2700,sr
* lea (VDP_control_port).l,a6
* move.w #$8200|(VRAM_Menu_Plane_A_Name_Table/$400),(a6) ; PNT A base: $C000
* move.w #$8400|(VRAM_Menu_Plane_B_Name_Table/$2000),(a6) ; PNT B base: $E000
* move.w #$9001,(a6) ; Scroll table size: 64x32
* move.w #$8C81,(a6) ; H res 40 cells, no interlace, S/H disabled
* bsr.w ClearScreen
* jsrto (Hud_Base).l, JmpTo_Hud_Base
* clr.w (VDP_Command_Buffer).w
* move.l #VDP_Command_Buffer,(VDP_Command_Buffer_Slot).w
* move #$2300,sr
* moveq #PalID_Result,d0
* bsr.w PalLoad_Now
* moveq #PLCID_Std1,d0
* bsr.w LoadPLC2
* move.l #vdpComm(tiles_to_bytes(ArtTile_VRAM_Start+2),VRAM,WRITE),d0
* lea SpecialStage_ResultsLetters(pc),a0
* jsrto (LoadTitleCardSS).l, JmpTo_LoadTitleCardSS
* move.l #vdpComm(tiles_to_bytes(ArtTile_ArtNem_SpecialStageResults),VRAM,WRITE),(VDP_control_port).l
* lea (ArtNem_SpecialStageResults).l,a0
* bsr.w NemDec
* move.w (Player_mode).w,d0
* beq.s ++
* subq.w #1,d0
* beq.s +
* clr.w (Ring_count).w
* bra.s ++
*; ===========================================================================
*+
* clr.w (Ring_count_2P).w
*+
* move.w (Ring_count).w,(Bonus_Countdown_1).w
* move.w (Ring_count_2P).w,(Bonus_Countdown_2).w
* clr.w (Total_Bonus_Countdown).w
* tst.b (Got_Emerald).w
* beq.s +
* move.w #1000,(Total_Bonus_Countdown).w
*+
* move.b #1,(Update_HUD_score).w
* move.b #1,(Update_Bonus_score).w
* move.w #MusID_EndLevel,d0
* jsr (PlaySound).l
*
* clearRAM SS_Sprite_Table_Input,SS_Sprite_Table_Input_End
* clearRAM SS_Object_RAM,SS_Object_RAM_End
*
* move.b #ObjID_SSResults,(SpecialStageResults+id).w ; load Obj6F (special stage results) at $FFFFB800
*-
* move.b #VintID_Level,(Vint_routine).w
* bsr.w WaitForVint
* jsr (RunObjects).l
* jsr (BuildSprites).l
* bsr.w RunPLC_RAM
* tst.w (Level_Inactive_flag).w
* beq.s -
* tst.l (Plc_Buffer).w
* bne.s -
* move.w #SndID_SpecStageEntry,d0
* bsr.w PlaySound
* bsr.w Pal_FadeToWhite
* tst.w (Two_player_mode_copy).w
* bne.s loc_540C
* move.b #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
* rts
*; ===========================================================================
*
*loc_540C:
* move.w #VsRSID_SS,(Results_Screen_2P).w
* move.b #GameModeID_2PResults,(Game_Mode).w ; => TwoPlayerResults
* rts
*; ===========================================================================
*
*; loc_541A:
*SpecialStage_Unpause:
* move.b #MusID_Unpause,(Music_to_play).w
* move.b #VintID_Level,(Vint_routine).w
* bra.w WaitForVint
*; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
*
*
*;sub_5534
SSObjectsManager *SSObjectsManager:
; Frame should be fully rendered
lda SSTrack_drawing_index * cmpi.b #4,(SSTrack_drawing_index).w
bne SSObjectsManager_return * bne.w return_55DC
; Run only each time a new segment is loaded
; testing LSB only is ok
* moveq #0,d0
ldb SpecialStage_CurrentSegment+1 * move.b (SpecialStage_CurrentSegment).w,d0
cmpb SpecialStage_LastSegment2+1 * cmp.b (SpecialStage_LastSegment2).w,d0
beq SSObjectsManager_return * beq.w return_55DC
stb SpecialStage_LastSegment2+1 * move.b d0,(SpecialStage_LastSegment2).w
; Get current segment length
* movea.l (SS_CurrentLevelLayout).w,a1
lda HalfPipe_Seq * move.b (a1,d0.w),d3
anda #$7F ; ignore orientation * andi.w #$7F,d3
asla
ldx #Ani_SSTrack_Len * lea (Ani_SSTrack_Len).l,a0
ldd a,x * move.b (a0,d3.w),d3
* add.w d3,d3
* add.w d3,d3
std SS_Seg_Len_x4
; Read object locations
ldx SS_CurrentLevelObjectLocations * movea.l (SS_CurrentLevelObjectLocations).w,a0
SSObjectsManager_LoadObject *-
jsr SSSingleObjLoad * bsr.w SSSingleObjLoad
bne SSObjectsManager_return * bne.s return_55DC
* moveq #0,d0
ldb ,x+ * move.b (a0)+,d0
bmi SSObjectsManager_LoadSegmentType * bmi.s ++
tfr b,a * move.b d0,d1
anda #$40 * andi.b #$40,d1
bne SSObjectsManager_Bomb * bne.s +
* addq.w #1,(SS_Perfect_rings_left).w
lda #$01
@a sta subtype,u
lda #ObjID_SSBomb
sta id,u * move.b #ObjID_SSRing,id(a1)
lda #$00
aslb * add.w d0,d0
rola
aslb * add.w d0,d0
rola
addd SS_Seg_Len_x4 * add.w d3,d0
std ss_z_pos,u * move.w d0,objoff_30(a1)
std ss_z_pos_img_start,u
lda ,x+
sta angle,u * move.b (a0)+,angle(a1)
bra SSObjectsManager_LoadObject * bra.s -
*; ===========================================================================
SSObjectsManager_Bomb *+
andb #$3F * andi.w #$3F,d0
lda #$00
bra @a
* move.b #ObjID_SSBomb,id(a1)
* add.w d0,d0
* add.w d0,d0
* add.w d3,d0
* move.w d0,objoff_30(a1)
* move.b (a0)+,angle(a1)
* bra.s -
*; ===========================================================================
SSObjectsManager_LoadSegmentType *+
stx SS_CurrentLevelObjectLocations * move.l a0,(SS_CurrentLevelObjectLocations).w
incb * addq.b #1,d0
beq SSObjectsManager_return ;$FF * beq.s return_55DC
incb * addq.b #1,d0
beq SSObjectsManager_LoadCheckpoint ;$FE * beq.s ++
incb * addq.b #1,d0
beq SSObjectsManager_Emerald * beq.s +
ldd #$FF00
sta SS_NoCheckpoint_flag * st.b (SS_NoCheckpoint_flag).w
stb SS_NoCheckpointMsg_flag * sf.b (SS_NoCheckpointMsg_flag).w
bra SSObjectsManager_LoadCheckpoint * bra.s ++
*; ===========================================================================
SSObjectsManager_Emerald *+
* tst.b (SS_2p_Flag).w
* bne.s +
;lda #ObjID_SSEmerald * move.b #ObjID_SSEmerald,id(a1)
;sta id,u
bra *
rts * rts
*; ===========================================================================
SSObjectsManager_LoadCheckpoint *+
;lda #ObjID_SSMessage * move.b #ObjID_SSMessage,id(a1)
;sta id,u
*
SSObjectsManager_return *return_55DC:
rts * rts
*; End of function SSObjectsManager
*; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
*
*;sub_7650
SSSetGeometryOffsets *SSSetGeometryOffsets:
lda SSTrack_drawing_index * move.b (SSTrack_drawing_index).w,d0 ; Get drawing position
;cmpa SS_player_anim_frame_timer * cmp.b (SS_player_anim_frame_timer).w,d0 ; Compare to player frame duration
beq @a * beq.s + ; If both are equal, branch
rts * rts
*; ===========================================================================
*+
* moveq #0,d0
@a lda SSTrack_mapping_frame * move.b (SSTrack_mapping_frame).w,d0 ; Get current track mapping frame
asla * add.w d0,d0 ; Convert to index
ldx #SSCurveOffsets
leax a,x * lea SSCurveOffsets(pc,d0.w),a2 ; Load current curve offsets into a2
lda ,x+ * move.b (a2)+,d0 ; Get x offset
tst SSTrack_Orientation * tst.b (SSTrack_Orientation).w ; Is track flipped?
beq @b * beq.s + ; Branch if not
nega * neg.b d0 ; Change sign of offset
@b *+
* ext.w d0 ; Extend to word
* addi.w #$80,d0 ; Add 128 (why?)
sta SS_Offset_X * move.w d0,(SS_Offset_X).w ; Set X geometry offset
lda ,x * move.b (a2),d0 ; Get y offset
* ext.w d0 ; Extend to word
* addi.w #$36,d0 ; Add $36 (why?)
sta SS_Offset_Y * move.w d0,(SS_Offset_Y).w ; Set Y geometry offset
rts * rts
*; End of function SSSetGeometryOffsets
*
*; ===========================================================================
*; Position offsets to sort-of rotate the plane sonic/tails are in
*; when the special stage track is curving, so they follow it better.
*; Each word seems to be (x_offset, y_offset)
*; See also Ani_SpecialStageTrack.
SSCurveOffsets *SSCurveOffsets: ; word_768A:
fcb $13,0,$13,0,$13,0,$13,0 * dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $00
fcb 9,-$A,0,-$1C,0,-$1C,0,-$20 * dc.b 9, -$A, 0,-$1C, 0,-$1C, 0,-$20 ; $04
fcb 0,-$24,0,-$2A,0,-$10,0,6 * dc.b 0,-$24, 0,-$2A, 0,-$10, 0, 6 ; $08
fcb 0,$E,0,$10,0,$12,0,$12 * dc.b 0, $E, 0, $10, 0, $12, 0, $12 ; $0C
fcb 9,$12 * dc.b 9, $12 ; $10; upward curve
fcb 0,0,0,0,0,0,0,0 * dc.b 0, 0, 0, 0, 0, 0, 0, 0 ; $11; straight
fcb $13,0,$13,0,$13,0,$13,0 * dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $15
fcb $B,$C,0,$C,0,$12,0,$A * dc.b $B, $C, 0, $C, 0, $12, 0, $A ; $19
fcb 0,8,0,2,0,$10,0,-$20 * dc.b 0, 8, 0, 2, 0, $10, 0,-$20 ; $1D
fcb 0,-$1F,0,-$1E,0,-$1B,0,-$18 * dc.b 0,-$1F, 0,-$1E, 0,-$1B, 0,-$18 ; $21
fcb 0,-$E * dc.b 0, -$E ; $25; downward curve
fcb $13,0,$13,0,$13,0,$13,0 * dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $26
fcb $13,0,$13,0 * dc.b $13, 0, $13, 0 ; $2B; turning
fcb $13,0,$13,0,$13,0,$13,0 * dc.b $13, 0, $13, 0, $13, 0, $13, 0 ; $2C
fcb $B,0 * dc.b $B, 0 ; $30; exit turn
fcb 0,0,0,0,0,0,0,0 * dc.b 0, 0, 0, 0, 0, 0, 0, 0 ; $31
fcb 0,0,0,0,3,0 * dc.b 0, 0, 0, 0, 3, 0 ; $35; straight
*; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
; search for a free object slot
; OUT
; [u]: object slot
; [cc|z]: 1=found 0=not found
*; sub_6F8E:
SSSingleObjLoad *SSSingleObjLoad:
ldu #Dynamic_Object_RAM * lea (SS_Dynamic_Object_RAM).w,a1
* move.w #(SS_Dynamic_Object_RAM_End-SS_Dynamic_Object_RAM)/object_size-1,d5
*
@b tst id,u *- tst.b id(a1)
beq @a * beq.s + ; rts
leau next_object,u * lea next_object(a1),a1 ; a1=object
cmpu #Dynamic_Object_RAM_End * dbf d5,-
bne @b *+
lda #$FF
@a rts * rts
*; End of function sub_6F8E
*;sub_77A2
SSInitPalAndData *SSInitPalAndData:
* clr.b (Current_Special_Act).w
; moved to HalfPipe_Init * move.b #-1,(SpecialStage_LastSegment2).w
ldd #0
std Ring_count * move.w #0,(Ring_count).w
* move.w #0,(Ring_count_2P).w
* move.b #0,(Perfect_rings_flag).w
* move.b #0,(Got_Emerald).w
* move.b #4,(SS_Star_color_2).w
* lea (SS2p_RingBuffer).w,a2
* moveq #0,d0
* move.w d0,(a2)+
* move.w d0,(a2)+
* move.w d0,(a2)+
* move.w d0,(a2)+
* move.w d0,(a2)+
* move.w d0,(a2)+
* moveq #PalID_SS,d0
* bsr.w PalLoad_ForFade
* lea_ SpecialStage_Palettes,a1
* moveq #0,d0
ldb Current_Special_Stage * move.b (Current_Special_Stage).w,d0
aslb * add.w d0,d0
* move.w d0,d1
* tst.b (SS_2p_Flag).w
* beq.s +
* cmpi.b #4,d0
* blo.s +
* addi_.w #6,d0
*+
* move.w (a1,d0.w),d0
* bsr.w PalLoad_ForFade
ldx #SpecialObjectLocations * lea (SSRAM_MiscKoz_SpecialObjectLocations).w,a0
abx * adda.w (a0,d1.w),a0
ldd ,x
leax d,x
stx SS_CurrentLevelObjectLocations * move.l a0,(SS_CurrentLevelObjectLocations).w
ldb Current_Special_Stage
aslb
ldx #SpecialLevelLayout * lea (SSRAM_MiscNem_SpecialLevelLayout).w,a0
abx * adda.w (a0,d1.w),a0
ldd ,x
leax d,x
stx SS_CurrentLevelLayout * move.l a0,(SS_CurrentLevelLayout).w
rts * rts
*; End of function SSInitPalAndData
Ani_SSTrack_Len
; fdb (24*4)+HalfPipe_Img_z_depth ; 0
; fdb (24*4)+HalfPipe_Img_z_depth ; 1
; fdb (12*4)+HalfPipe_Img_z_depth ; 2
; fdb (16*4)+HalfPipe_Img_z_depth ; 3
; fdb (11*4)+HalfPipe_Img_z_depth ; 4
; fdb 0 ; 5
fdb (24*4) ; 0
fdb (24*4) ; 1
fdb (12*4) ; 2
fdb (16*4) ; 3
fdb (11*4) ; 4
fdb 0 ; 5
SpecialLevelLayout
INCLUDEBIN "./GameMode/SpecialStage/Special stage level layouts.bin"
; -------------------------------------------------------------------------------------------------------------
; Level Layout
; -------------------------------------------------------------------------------------------------------------
;
; Index (words)
; -----
; Offset to each level data (7 word offsets for the 7 levels)
;
; Orientation/Track (bytes)
; -----------------
; $0x Towards right
; $8x Towards left
; $x0 Turn the rise
; $x1 Turn then drop
; $x2 Turn then straight
; $x3 straight
; $x4 Straight then turn
; -------------------------------------------------------------------------------------------------------------
SpecialObjectLocations
INCLUDEBIN "./GameMode/SpecialStage/Special stage object location lists.bin"
; -------------------------------------------------------------------------------------------------------------
; Object Locations
; -------------------------------------------------------------------------------------------------------------
;
; Index (words)
; -----
; Offset to each level data (7 word offsets for the 7 levels)
;
; Segment Objects (group of bytes)
; ---------------
; byte : bit6 (0:ring,1:bomb) bit5-0 ($00-$17 : 0-23 position in frame $00:near, $17 far, 24 frames is maximum for a segment in original game)
; byte : (angle : $00 right, $40 center, $80 left, $c0 top)
; byte : $ff (end of regular segment), $fe (end of checkpoint segment), $fd (end of choas emerald segment), $fc (end of rings message segment)
;
; -------------------------------------------------------------------------------------------------------------
SpecialPerspective
INCLUDEBIN "./GameMode/SpecialStage/Special stage object perspective data.bin"
; -------------------------------------------------------------------------------------------------------------
; Perspective data
; -------------------------------------------------------------------------------------------------------------
;
; Index (words)
; -----
; Offset to each halfpipe image perspective data (56 word offsets for the 56 images)
;
; Image perspective data
; ----------------------
; 1 word : n number of z_pos defined for this frame from 1 (camera front) to n (far away)
; n groups of 6 bytes : 7b dd b8 e6 00 00 that defines an elipse arc
; | | | | | |___ angle min (excl.) of visible area (0: no invisible area)
; | | | | |______ angle max (incl.) of visible area
; | | | |_________ y radius
; | | |____________ x radius
; | |_______________ y origin
; |__________________ x origin
;
; -------------------------------------------------------------------------------------------------------------
; ---------------------------------------------------------------------------
; Object - Half Pipe for Special Stage
;
; input REG : [u] pointer to Object Status Table (OST)
; ---------
;
; Half pipe is rendered interlaced
; ---------------------------------------------------------------------------
HalfPipe_Init
ldb #$05
stb priority,u
lda render_flags,u
ora #render_overlay_mask
sta render_flags,u
ldd #$807F
cmpu #HalfPipeEven
beq @a
incb ; +1 for odd line
std xy_pixel,u
rts
@a std xy_pixel,u
ldd Vint_runcount
std HalfPipe_Vint_Track_Image ; store number of vint between two rendered images
std HalfPipe_Vint_Main_Loop ; store number of vint between two main loops execution
; load start of sequences for this level
; ----------------------------------------------
ldx SS_CurrentLevelLayout
stx SpecialStage_CurrentSegment
; load first animation id
; -----------------------
ldb ,x
stb HalfPipe_Seq
andb #$7F
leax -1,x
stx SpecialStage_LastSegment2 ; init last segment to another value to run ObjectManager
ldx #Ani_SpecialStageTrack
aslb
abx
ldd ,x
std anim,u
jmp AnimateSprite
HalfPipe_Display
cmpu #HalfPipeEven
beq @a
ldx #HalfPipeEven
ldd image_set,x ; clone image_set when secondary HalfPipe sprite is running
std image_set,u
lda render_flags,x
sta render_flags,u
jmp DisplaySprite ; return
@a
ldd Vint_runcount
subd HalfPipe_Vint_Main_Loop
stb HalfPipe_Nb_Elapsed_Frames ; ajust object z speed
ldd Vint_runcount
std HalfPipe_Vint_Main_Loop
subd HalfPipe_Vint_Track_Image
stb SSTrack_drawing_index
; if n-2 image is different from n-1 image
; we must call HalfPipe_KeepSameTrackImage
; otherwise it would drop an intermediate image
ldd rsv_prev_mapping_frame_0,u
cmpd rsv_prev_mapping_frame_1,u
bne HalfPipe_KeepSameTrackImage
ldb SSTrack_drawing_index
cmpb #HalfPipe_Img_Duration ; ensure track is not refreshed more than max fps
bge HalfPipe_LoadNewTrackImage
HalfPipe_KeepSameTrackImage
IFGE (HalfPipe_one_z_step-255)
ldb HalfPipe_Nb_Elapsed_Frames ; 8x16 bit mul sucks
ldy #HalfPipe_one_z_step ; TODO NEVER TESTED
pshs y,d,cc ; USAGE WHEN track refresh rate >= 12fps (HalfPipe_Img_Duration <= 4)
lda 4,s ; CAP to HalfPipe_Img_z_depth
mul
std 3,s
tfr y,d
ldb 2,s
clr 2,s
mul
addd 2,s
std 2,s
puls pc,y,d,cc
sty HalfPipe_z_step
jmp DisplaySprite
ELSE
lda HalfPipe_Nb_Elapsed_Frames ; 8x8 bit mul is the way to go
ldb #HalfPipe_one_z_step ; look for one main loop duration and adjust
mul ; object position to keep a constant speed
cmpd #((HalfPipe_Img_z_depth*256)/2)
bls @a
ldd #((HalfPipe_Img_z_depth*256)/2) ; one sub step can not be more than an img z depth
@a std HalfPipe_z_step
jmp DisplaySprite ; return
ENDC
HalfPipe_LoadNewTrackImage
ldd Vint_runcount
std HalfPipe_Vint_Track_Image
clr SSTrack_drawing_index
jsr AnimateSprite
jsr GetImgIdA
sta SSTrack_mapping_frame
; chain animations (AnimateSprite will inc routine_secondary after each animation ends)
; -------------------------------------------------------------------------------------
lda routine_secondary,u
asla
ldx #HalfPipe_SubRoutines
jmp [a,x]
HalfPipe_SubRoutines
fdb HalfPipe_Continue
fdb HalfPipe_LoadNewSequence
HalfPipe_LoadNewSequence
ldx SpecialStage_CurrentSegment
leax 1,x
stx SpecialStage_CurrentSegment
lda HalfPipe_Seq
anda #$7F
ldb ,x
stb HalfPipe_Seq
andb #$7F
cmpd #$0203 ; special case
bne @a
ldd #Ani_Straight_From_TurnThenStraight
std anim,u
bra @d
@a cmpd #$0002 ; special case
bne @b
ldd #Ani_TurnThenStraight_From_Rise
std anim,u
bra @d
@b cmpd #$0102 ; special case
bne @c
ldd #Ani_TurnThenStraight_From_Drop
std anim,u
bra @d
@c ldx #Ani_SpecialStageTrack ; use lookup table
aslb
abx
ldd ,x
std anim,u
@d ldd #0
sta routine_secondary,u
std prev_anim,u ; force loading of new animation
jsr AnimateSprite
jsr GetImgIdA
sta SSTrack_mapping_frame
HalfPipe_Continue
; set orirentation of track
; -------------------------
lda HalfPipe_Seq_UpdFlip
beq @a
ldb HalfPipe_Seq_UpdFlip+1
bpl @b
lda render_flags,u
ora #render_xmirror_mask ; set flip - left orientation
sta render_flags,u
lda #$FF
sta SSTrack_Orientation
bra @c
@b lda render_flags,u
anda #^render_xmirror_mask ; unset flip - right orientation
sta render_flags,u
lda #0
sta SSTrack_Orientation
@c com HalfPipe_Seq_UpdFlip
@a ldd image_set,u ; orientation can only change on specific frames
cmpd #Img_tk_036
beq @d
cmpd #Img_tk_044
beq @d
cmpd #Img_tk_002
beq @d
jmp DisplaySprite
@d com HalfPipe_Seq_UpdFlip
ldb HalfPipe_Seq
stb HalfPipe_Seq_UpdFlip+1
jmp DisplaySprite
Ani_SpecialStageTrack
fdb Ani_TurnThenRise
fdb Ani_TurnThenDrop
fdb Ani_TurnThenStraight
fdb Ani_Straight
fdb Ani_StraightThenTurn
|
src/main/antlr/org/hibernate/query/sqm/hql/internal/antlr/HqlParser.g4 | hibernate/hibernate-semantic-query | 9 | 3422 | <filename>src/main/antlr/org/hibernate/query/sqm/hql/internal/antlr/HqlParser.g4
parser grammar HqlParser;
options {
tokenVocab=HqlLexer;
}
@header {
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.sqm.parser.hql.internal.antlr;
}
@members {
protected void logUseOfReservedWordAsIdentifier(Token token) {
}
}
statement
: ( selectStatement | updateStatement | deleteStatement | insertStatement ) EOF
;
selectStatement
: querySpec
;
updateStatement
: UPDATE FROM? mainEntityPersisterReference setClause whereClause
;
setClause
: SET assignment+
;
assignment
: dotIdentifierSequence EQUAL expression
;
deleteStatement
: DELETE FROM? mainEntityPersisterReference whereClause
;
insertStatement
// todo : VERSIONED
: INSERT insertSpec querySpec
;
insertSpec
: intoSpec targetFieldsSpec
;
intoSpec
: INTO dotIdentifierSequence
;
targetFieldsSpec
: LEFT_PAREN dotIdentifierSequence (COMMA dotIdentifierSequence)* RIGHT_PAREN
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ORDER BY clause
orderByClause
// todo : null precedence
: ORDER BY sortSpecification (COMMA sortSpecification)*
;
sortSpecification
: expression collationSpecification? orderingSpecification?
;
collationSpecification
: COLLATE collateName
;
collateName
: dotIdentifierSequence
;
orderingSpecification
: ASC
| DESC
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LIMIT/OFFSET clause
limitClause
: LIMIT parameterOrNumberLiteral
;
offsetClause
: OFFSET parameterOrNumberLiteral
;
parameterOrNumberLiteral
: parameter
| INTEGER_LITERAL
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// QUERY SPEC - general structure of root sqm or sub sqm
querySpec
: selectClause? fromClause whereClause? ( groupByClause havingClause? )? orderByClause? limitClause? offsetClause?
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SELECT clause
selectClause
: SELECT DISTINCT? selectionList
;
selectionList
: selection (COMMA selection)*
;
selection
// I have noticed that without this predicate, Antlr will sometimes
// interpret `select a.b from Something ...` as `from` being the
// select-expression alias
: selectExpression (resultIdentifier)?
;
resultIdentifier
: (AS identifier)
| IDENTIFIER
;
selectExpression
: dynamicInstantiation
| jpaSelectObjectSyntax
| expression
;
dynamicInstantiation
: NEW dynamicInstantiationTarget LEFT_PAREN dynamicInstantiationArgs RIGHT_PAREN
;
dynamicInstantiationTarget
: LIST
| MAP
| dotIdentifierSequence
;
dotIdentifierSequence
: identifier (DOT identifier)*
;
path
// a SimplePath may be any number of things like:
// * Class FQN
// * Java constant (enum/static)
// * a simple dotIdentifierSequence-style path
// :(
: dotIdentifierSequence # SimplePath
// a Map.Entry cannot be further dereferenced
| ENTRY LEFT_PAREN pathAsMap RIGHT_PAREN # MapEntryPath
// only one index-access is allowed per path
| path LEFT_BRACKET expression RIGHT_BRACKET (pathTerminal)? # IndexedPath
| pathRoot (pathTerminal)? # CompoundPath
;
pathRoot
: identifier # SimplePathRoot
| TREAT LEFT_PAREN dotIdentifierSequence AS dotIdentifierSequence RIGHT_PAREN # TreatedPathRoot
| KEY LEFT_PAREN pathAsMap RIGHT_PAREN # MapKeyPathRoot
| VALUE LEFT_PAREN collectionReference RIGHT_PAREN # CollectionValuePathRoot
;
pathTerminal
: (DOT identifier)+
;
collectionReference
// having as a separate rule allows us to validate that the path indeed resolves to a Collection attribute
: path
;
pathAsMap
// having as a separate rule allows us to validate that the path indeed resolves to a Map attribute
: path
;
dynamicInstantiationArgs
: dynamicInstantiationArg ( COMMA dynamicInstantiationArg )*
;
dynamicInstantiationArg
: dynamicInstantiationArgExpression (AS? identifier)?
;
dynamicInstantiationArgExpression
: expression
| dynamicInstantiation
;
jpaSelectObjectSyntax
: OBJECT LEFT_PAREN identifier RIGHT_PAREN
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// FROM clause
fromClause
: FROM fromElementSpace (COMMA fromElementSpace)*
;
fromElementSpace
: fromElementSpaceRoot ( crossJoin | jpaCollectionJoin | qualifiedJoin )*
;
fromElementSpaceRoot
: mainEntityPersisterReference
;
mainEntityPersisterReference
: dotIdentifierSequence (identificationVariableDef)?
;
identificationVariableDef
: (AS identificationVariable)
| IDENTIFIER
;
identificationVariable
: identifier
;
crossJoin
: CROSS JOIN mainEntityPersisterReference
;
jpaCollectionJoin
: COMMA IN LEFT_PAREN path RIGHT_PAREN (identificationVariableDef)?
;
qualifiedJoin
: ( INNER | ((LEFT|RIGHT|FULL)? OUTER) )? JOIN FETCH? qualifiedJoinRhs (qualifiedJoinPredicate)?
;
qualifiedJoinRhs
: path (identificationVariableDef)?
;
qualifiedJoinPredicate
: (ON | WITH) predicate
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// GROUP BY clause
groupByClause
: GROUP BY groupingSpecification
;
groupingSpecification
: groupingValue ( COMMA groupingValue )*
;
groupingValue
: expression collationSpecification?
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//HAVING clause
havingClause
: HAVING predicate
;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// WHERE clause
whereClause
: WHERE predicate
;
predicate
: LEFT_PAREN predicate RIGHT_PAREN # GroupedPredicate
| predicate OR predicate # OrPredicate
| predicate AND predicate # AndPredicate
| NOT predicate # NegatedPredicate
| expression IS (NOT)? NULL # IsNullPredicate
| expression IS (NOT)? EMPTY # IsEmptyPredicate
| expression EQUAL expression # EqualityPredicate
| expression NOT_EQUAL expression # InequalityPredicate
| expression GREATER expression # GreaterThanPredicate
| expression GREATER_EQUAL expression # GreaterThanOrEqualPredicate
| expression LESS expression # LessThanPredicate
| expression LESS_EQUAL expression # LessThanOrEqualPredicate
| expression (NOT)? IN inList # InPredicate
| expression (NOT)? BETWEEN expression AND expression # BetweenPredicate
| expression (NOT)? LIKE expression (likeEscape)? # LikePredicate
| MEMBER OF path # MemberOfPredicate
;
inList
: ELEMENTS? LEFT_PAREN dotIdentifierSequence RIGHT_PAREN # PersistentCollectionReferenceInList
| LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN # ExplicitTupleInList
| expression # SubQueryInList
;
likeEscape
: ESCAPE expression
;
expression
: expression DOUBLE_PIPE expression # ConcatenationExpression
| expression PLUS expression # AdditionExpression
| expression MINUS expression # SubtractionExpression
| expression ASTERISK expression # MultiplicationExpression
| expression SLASH expression # DivisionExpression
| expression PERCENT expression # ModuloExpression
| MINUS expression # UnaryMinusExpression
| PLUS expression # UnaryPlusExpression
| caseStatement # CaseExpression
| coalesce # CoalesceExpression
| nullIf # NullIfExpression
| literal # LiteralExpression
| parameter # ParameterExpression
| entityTypeReference # EntityTypeExpression
| path # PathExpression
| function # FunctionExpression
| LEFT_PAREN querySpec RIGHT_PAREN # SubQueryExpression
;
entityTypeReference
: TYPE LEFT_PAREN (path | parameter) RIGHT_PAREN
;
entityLiteralReference
:
;
caseStatement
: simpleCaseStatement
| searchedCaseStatement
;
simpleCaseStatement
: CASE expression (simpleCaseWhen)+ (caseOtherwise)? END
;
simpleCaseWhen
: WHEN expression THEN expression
;
caseOtherwise
: ELSE expression
;
searchedCaseStatement
: CASE (searchedCaseWhen)+ (caseOtherwise)? END
;
searchedCaseWhen
: WHEN predicate THEN expression
;
coalesce
: COALESCE LEFT_PAREN expression (COMMA expression)+ RIGHT_PAREN
;
nullIf
: NULLIF LEFT_PAREN expression COMMA expression RIGHT_PAREN
;
literal
: STRING_LITERAL
| CHARACTER_LITERAL
| INTEGER_LITERAL
| LONG_LITERAL
| BIG_INTEGER_LITERAL
| FLOAT_LITERAL
| DOUBLE_LITERAL
| BIG_DECIMAL_LITERAL
| HEX_LITERAL
| OCTAL_LITERAL
| NULL
| TRUE
| FALSE
| timestampLiteral
| dateLiteral
| timeLiteral
;
timestampLiteral
: TIMESTAMP_ESCAPE_START dateTimeLiteralText RIGHT_BRACE
;
dateLiteral
: DATE_ESCAPE_START dateTimeLiteralText RIGHT_BRACE
;
timeLiteral
: TIME_ESCAPE_START dateTimeLiteralText RIGHT_BRACE
;
dateTimeLiteralText
: STRING_LITERAL | CHARACTER_LITERAL
;
parameter
: COLON identifier # NamedParameter
| QUESTION_MARK INTEGER_LITERAL? # PositionalParameter
;
function
: standardFunction
| aggregateFunction
| jpaCollectionFunction
| hqlCollectionFunction
| jpaNonStandardFunction
| nonStandardFunction
;
jpaNonStandardFunction
: FUNCTION LEFT_PAREN nonStandardFunctionName (COMMA nonStandardFunctionArguments)? RIGHT_PAREN
;
nonStandardFunctionName
: dotIdentifierSequence
;
nonStandardFunctionArguments
: expression (COMMA expression)*
;
nonStandardFunction
: nonStandardFunctionName LEFT_PAREN nonStandardFunctionArguments? RIGHT_PAREN
;
jpaCollectionFunction
: SIZE LEFT_PAREN path RIGHT_PAREN # CollectionSizeFunction
| INDEX LEFT_PAREN identifier RIGHT_PAREN # CollectionIndexFunction
;
hqlCollectionFunction
: MAXINDEX LEFT_PAREN path RIGHT_PAREN # MaxIndexFunction
| MAXELEMENT LEFT_PAREN path RIGHT_PAREN # MaxElementFunction
| MININDEX LEFT_PAREN path RIGHT_PAREN # MinIndexFunction
| MINELEMENT LEFT_PAREN path RIGHT_PAREN # MinElementFunction
;
aggregateFunction
: avgFunction
| sumFunction
| minFunction
| maxFunction
| countFunction
;
avgFunction
: AVG LEFT_PAREN DISTINCT? expression RIGHT_PAREN
;
sumFunction
: SUM LEFT_PAREN DISTINCT? expression RIGHT_PAREN
;
minFunction
: MIN LEFT_PAREN DISTINCT? expression RIGHT_PAREN
;
maxFunction
: MAX LEFT_PAREN DISTINCT? expression RIGHT_PAREN
;
countFunction
: COUNT LEFT_PAREN DISTINCT? (expression | ASTERISK) RIGHT_PAREN
;
standardFunction
: castFunction
| concatFunction
| substringFunction
| trimFunction
| upperFunction
| lowerFunction
| lengthFunction
| locateFunction
| absFunction
| sqrtFunction
| modFunction
| currentDateFunction
| currentTimeFunction
| currentTimestampFunction
| extractFunction
| positionFunction
| charLengthFunction
| octetLengthFunction
| bitLengthFunction
;
castFunction
: CAST LEFT_PAREN expression AS dataType RIGHT_PAREN
;
dataType
: IDENTIFIER
;
concatFunction
: CONCAT LEFT_PAREN expression (COMMA expression)+ RIGHT_PAREN
;
substringFunction
: SUBSTRING LEFT_PAREN expression COMMA substringFunctionStartArgument (COMMA substringFunctionLengthArgument)? RIGHT_PAREN
;
substringFunctionStartArgument
: expression
;
substringFunctionLengthArgument
: expression
;
trimFunction
: TRIM LEFT_PAREN trimSpecification? trimCharacter? FROM? expression RIGHT_PAREN
;
trimSpecification
: LEADING
| TRAILING
| BOTH
;
trimCharacter
: CHARACTER_LITERAL | STRING_LITERAL
;
upperFunction
: UPPER LEFT_PAREN expression RIGHT_PAREN
;
lowerFunction
: LOWER LEFT_PAREN expression RIGHT_PAREN
;
lengthFunction
: LENGTH LEFT_PAREN expression RIGHT_PAREN
;
locateFunction
: LOCATE LEFT_PAREN locateFunctionSubstrArgument COMMA locateFunctionStringArgument (COMMA locateFunctionStartArgument)? RIGHT_PAREN
;
locateFunctionSubstrArgument
: expression
;
locateFunctionStringArgument
: expression
;
locateFunctionStartArgument
: expression
;
absFunction
: ABS LEFT_PAREN expression RIGHT_PAREN
;
sqrtFunction
: SQRT LEFT_PAREN expression RIGHT_PAREN
;
modFunction
: MOD LEFT_PAREN modDividendArgument COMMA modDivisorArgument RIGHT_PAREN
;
modDividendArgument
: expression
;
modDivisorArgument
: expression
;
currentDateFunction
: CURRENT_DATE (LEFT_PAREN RIGHT_PAREN)?
;
currentTimeFunction
: CURRENT_TIME (LEFT_PAREN RIGHT_PAREN)?
;
currentTimestampFunction
: CURRENT_TIMESTAMP (LEFT_PAREN RIGHT_PAREN)?
;
extractFunction
: EXTRACT LEFT_PAREN extractField FROM expression RIGHT_PAREN
;
extractField
: datetimeField
| timeZoneField
;
datetimeField
: nonSecondDatetimeField
| SECOND
;
nonSecondDatetimeField
: YEAR
| MONTH
| DAY
| HOUR
| MINUTE
;
timeZoneField
: TIMEZONE_HOUR
| TIMEZONE_MINUTE
;
positionFunction
: POSITION LEFT_PAREN positionSubstrArgument IN positionStringArgument RIGHT_PAREN
;
positionSubstrArgument
: expression
;
positionStringArgument
: expression
;
charLengthFunction
: CAST LEFT_PAREN expression RIGHT_PAREN
;
octetLengthFunction
: OCTET_LENGTH LEFT_PAREN expression RIGHT_PAREN
;
bitLengthFunction
: BIT_LENGTH LEFT_PAREN expression RIGHT_PAREN
;
/**
* The `identifier` is used to provide "keyword as identifier" handling.
*
* The lexer hands us recognized keywords using their specific tokens. This is important
* for the recognition of sqm structure, especially in terms of performance!
*
* However we want to continue to allow users to use mopst keywords as identifiers (e.g., attribute names).
* This parser rule helps with that. Here we expect that the caller already understands their
* context enough to know that keywords-as-identifiers are allowed.
*/
identifier
: IDENTIFIER
| (ABS
| ALL
| AND
| ANY
| AS
| ASC
| AVG
| BY
| BETWEEN
| BIT_LENGTH
| BOTH
| CAST
| COALESCE
| COLLATE
| CONCAT
| COUNT
| CROSS
| DAY
| DELETE
| DESC
| DISTINCT
| ELEMENTS
| ENTRY
| FROM
| FULL
| FUNCTION
| GROUP
| HOUR
| IN
| INDEX
| INNER
| INSERT
| JOIN
| KEY
| LEADING
| LEFT
| LENGTH
| LIKE
| LIST
| LOWER
| MAP
| MAX
| MIN
| MINUTE
| MEMBER
| MONTH
| OBJECT
| ON
| OR
| ORDER
| OUTER
| POSITION
| RIGHT
| SELECT
| SECOND
| SET
| SQRT
| SUBSTRING
| SUM
| TRAILING
| TREAT
| UPDATE
| UPPER
| VALUE
| WHERE
| WITH
| YEAR) {
logUseOfReservedWordAsIdentifier(getCurrentToken());
}
;
|
src/numerics-sparse_matrices-cumulative_sum.adb | sciencylab/lagrangian-solver | 0 | 9454 | separate (Numerics.Sparse_Matrices)
-- function Cumulative_Sum (Item : in Int_Array) return Int_Array is
-- Result : Int_Array (Item'Range);
-- Tmp : Int := 1;
-- begin
-- for I in Item'Range loop
-- Result (I) := Tmp;
-- Tmp := Tmp + Item (I);
-- end loop;
-- return Result;
-- end Cumulative_Sum;
procedure Cumulative_Sum (Item : in out Int_Array) is
use Ada.Text_IO;
N : Pos := 1;
M : Pos;
begin
for I in Item'Range loop
M := Item (I);
Item (I) := N;
N := N + M;
end loop;
end Cumulative_Sum;
|
source/asis/asis-gela-overloads-walk.ads | faelys/gela-asis | 4 | 15685 | <filename>source/asis/asis-gela-overloads-walk.ads
------------------------------------------------------------------------------
-- G E L A A S I S --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of this file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
-- Purpose:
-- Two passes to resolve names:
-- First one (down to) Up collects possible interpretations of an expression
-- Second one (up to) Down fixes AST to correspond chosen interpretation
with Gela.Containers.Stacks; use Gela;
with Asis.Gela.Overloads.Types; use Asis.Gela.Overloads.Types;
package Asis.Gela.Overloads.Walk is
type Up_Resolver is limited private;
procedure Before
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Up_Resolver);
procedure After
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Up_Resolver);
function Get_Interpretations
(Resolver : in Up_Resolver) return Up_Interpretation_Set;
function Get_Implicits
(Resolver : in Up_Resolver) return Implicit_Set;
type Down_Resolver is limited private;
procedure Before
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Down_Resolver);
procedure After
(Element : in out Asis.Element;
Control : in out Traverse_Control;
Resolver : in out Down_Resolver);
procedure Set_Interpretation
(Resolver : in out Down_Resolver;
Item : in Down_Interpretation);
procedure Copy_Store_Set
(Source : in Up_Resolver;
Target : in out Down_Resolver);
procedure Destroy_Store_Set
(Source : in out Up_Resolver);
procedure Set_Declaration
(Element : in out Asis.Identifier;
Decl : in Asis.Declaration);
procedure Check_Association (Element : in out Asis.Element);
private
package U is new Containers.Stacks (Up_Interpretation_Set);
type Up_Resolver is limited record
Stack : U.Stack;
Store : Stored_Sets := Create;
Implicit : Implicit_Set := Create;
end record;
package D is new Containers.Stacks (Down_Interpretation);
type Down_Resolver is limited record
Stack : D.Stack;
Store : Stored_Sets;
Implicit : Implicit_Set;
end record;
-- Common subroutines for child packages
function Is_Subprogram (Decl : Asis.Declaration) return Boolean;
function Is_Expanded_Name (Item : Asis.Element) return Boolean;
procedure Find_Formal_Index
(Params : in Asis.Association_List;
Actual_Index : in List_Index;
Profile : in Asis.Parameter_Specification_List;
Formal_Index : out List_Index;
Found : out Boolean);
function Get_Formal_Parameter
(Params : Asis.Association_List;
Index : List_Index) return Asis.Identifier;
function Get_Actual_Parameter
(Params : Asis.Association_List;
Index : List_Index) return Asis.Expression;
procedure Drop_One (Resolver : in out Up_Resolver);
-- function Get_Array_Index_Type
-- (Tipe : Type_Info;
-- Index : Asis.List_Index := 1) return Tipe_Info;
-- function Get_Array_Element_Type
-- (Tipe : Asis.Element) return Asis.Declaration;
function Could_Be_Positional_Array_Aggregate
(Item : Asis.Element) return Boolean;
function Could_Be_Named_Array_Aggregate
(Item : Asis.Element) return Boolean;
function Could_Be_Record_Aggregate
(Item : Asis.Element;
Extension : Boolean) return Boolean;
function Get_Call_Parameters (Element : Asis.Element )
return Asis.Association_List;
end Asis.Gela.Overloads.Walk;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <NAME>
-- 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 <NAME>, 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 OWNER 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.
------------------------------------------------------------------------------
|
libsrc/_DEVELOPMENT/l/sdcc/___muluint2ulong_callee.asm | dikdom/z88dk | 0 | 5046 | <filename>libsrc/_DEVELOPMENT/l/sdcc/___muluint2ulong_callee.asm
SECTION code_clib
SECTION code_l_sdcc
PUBLIC ___muluint2ulong_callee
EXTERN l_mulu_32_16x16
___muluint2ulong_callee:
; 16-bit multiplication, 32-bit result
;
; enter : stack = multiplicand, multiplicand, ret
;
; exit : dehl = product
pop af
pop hl
pop de
push af
jp l_mulu_32_16x16
|
oeis/021/A021549.asm | neoneye/loda-programs | 11 | 6257 | ; A021549: Decimal expansion of 1/545.
; Submitted by Jon Maiga
; 0,0,1,8,3,4,8,6,2,3,8,5,3,2,1,1,0,0,9,1,7,4,3,1,1,9,2,6,6,0,5,5,0,4,5,8,7,1,5,5,9,6,3,3,0,2,7,5,2,2,9,3,5,7,7,9,8,1,6,5,1,3,7,6,1,4,6,7,8,8,9,9,0,8,2,5,6,8,8,0,7,3,3,9,4,4,9,5,4,1,2,8,4,4,0,3,6,6,9
seq $0,199689 ; 8*10^n+1
div $0,436
mod $0,10
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_702.asm | ljhsiun2/medusa | 9 | 24010 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r9
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xa080, %rsi
lea addresses_normal_ht+0x10c50, %rdi
and %r11, %r11
mov $85, %rcx
rep movsw
nop
nop
cmp %rcx, %rcx
lea addresses_WT_ht+0x1a100, %rsi
lea addresses_D_ht+0xd2e0, %rdi
nop
nop
nop
nop
nop
xor $30970, %r11
mov $10, %rcx
rep movsw
nop
nop
nop
nop
nop
and $5008, %rcx
lea addresses_WC_ht+0x5300, %rsi
lea addresses_normal_ht+0x17900, %rdi
nop
xor $27029, %r9
mov $76, %rcx
rep movsw
nop
nop
nop
nop
add $12479, %rcx
lea addresses_D_ht+0x1bbb8, %rsi
nop
nop
nop
xor $11985, %rbx
mov (%rsi), %r9
sub %rcx, %rcx
lea addresses_A_ht+0xd080, %rbx
nop
inc %rax
movl $0x61626364, (%rbx)
and %rdi, %rdi
lea addresses_WT_ht+0x1d500, %rsi
nop
nop
xor $65189, %rbx
mov (%rsi), %di
nop
nop
nop
and %rbx, %rbx
lea addresses_A_ht+0x1e100, %rsi
lea addresses_UC_ht+0x182c, %rdi
clflush (%rsi)
nop
nop
nop
and %rbp, %rbp
mov $94, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %rsi
lea addresses_WC_ht+0x106c4, %rsi
lea addresses_normal_ht+0xa340, %rdi
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov $1, %rcx
rep movsw
nop
nop
nop
xor %rax, %rax
lea addresses_normal_ht+0xe8a0, %rax
nop
cmp %r9, %r9
movups (%rax), %xmm0
vpextrq $0, %xmm0, %rbp
nop
nop
nop
nop
xor %rbp, %rbp
lea addresses_WC_ht+0x1aeab, %rdi
nop
cmp $50151, %rbx
mov $0x6162636465666768, %rsi
movq %rsi, (%rdi)
nop
nop
add $12925, %rax
lea addresses_UC_ht+0x7500, %r9
nop
nop
and $10506, %rcx
movb (%r9), %bl
cmp %rbx, %rbx
lea addresses_UC_ht+0xc3b8, %rsi
nop
nop
nop
nop
xor $12749, %rbx
and $0xffffffffffffffc0, %rsi
movaps (%rsi), %xmm5
vpextrq $1, %xmm5, %r11
nop
nop
cmp %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r8
push %r9
push %rcx
push %rdx
// Store
lea addresses_normal+0x10814, %r8
nop
inc %r10
movl $0x51525354, (%r8)
nop
nop
nop
nop
nop
sub %rdx, %rdx
// Load
mov $0x4fa45f00000006a0, %rcx
nop
nop
dec %r14
mov (%rcx), %r10w
nop
nop
nop
nop
and %rcx, %rcx
// Store
lea addresses_RW+0x1cba0, %r10
dec %rdx
movl $0x51525354, (%r10)
nop
nop
nop
nop
add %r10, %r10
// Store
lea addresses_normal+0x16100, %rdx
nop
nop
nop
nop
sub %r10, %r10
mov $0x5152535455565758, %r8
movq %r8, (%rdx)
nop
nop
nop
nop
add %r10, %r10
// Store
lea addresses_RW+0x1afec, %r14
nop
nop
nop
nop
xor %r13, %r13
movb $0x51, (%r14)
nop
nop
inc %r8
// Store
lea addresses_UC+0xbf48, %r8
nop
nop
nop
and %r9, %r9
movw $0x5152, (%r8)
nop
nop
and %r9, %r9
// Faulty Load
lea addresses_normal+0x11d00, %r13
nop
nop
cmp %r9, %r9
mov (%r13), %r8w
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rdx
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_NC', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_RW', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_normal', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': True, 'congruent': 2, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 2, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 16}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
tests/z80test-1.0/src/testmacros.asm | PhylumChordata/chips-test | 674 | 84376 | ; Macros for defining the test vectors.
;
; Copyright (C) 2012 <NAME> (<EMAIL>)
;
; This source code is released under the MIT license, see included license.txt.
macro db8 b7,b6,b5,b4,b3,b2,b1,b0
db (b7<<7)|(b6<<6)|(b5<<5)|(b4<<4)|(b3<<3)|(b2<<2)|(b1<<1)|b0
endm
macro ddbe n
db (n>>24)&0xff
db (n>>16)&0xff
db (n>>8)&0xff
db n&0xff
endm
macro inst op1,op2,op3,op4,tail
; Unfortunately, elseifidn doesn't seem to work properly.
ifidn op4,stop
db op1,op2,op3,tail,0
else
ifidn op3,stop
db op1,op2,tail,op4,0
else
ifidn op2,stop
db op1,tail,op3,op4,0
else
db op1,op2,op3,op4,tail
endif
endif
endif
endm
macro flags sn,s,zn,z,f5n,f5,hcn,hc,f3n,f3,pvn,pv,nn,n,cn,c
if maskflags
db8 s,z,f5,hc,f3,pv,n,c
else
db 0xff
endif
endm
.veccount := 0
macro vec op1,op2,op3,op4,memn,mem,an,a,fn,f,bcn,bc,den,de,hln,hl,ixn,ix,iyn,iy,spn,sp
if postccf
if ( .@veccount % 3 ) == 0
inst op1,op2,op3,op4,tail
.@areg := 0
else
db op1,op2,op3,op4,0
.@areg := .@areg | a
endif
else
db op1,op2,op3,op4
endif
db f
if postccf & ( ( .veccount % 3 ) == 2 )
db a | ( ( ~ .@areg ) & 0x28 )
else
db a
endif
dw bc,de,hl,ix,iy
dw mem
dw sp
.@veccount := .@veccount+1
endm
macro crcs allflagsn,allflags,alln,all,docflagsn,docflags,docn,doc,ccfn,ccf,mptrn,mptr
if postccf
ddbe ccf
elseif memptr
ddbe mptr
else
if maskflags
if onlyflags
ddbe docflags
else
ddbe doc
endif
else
if onlyflags
ddbe allflags
else
ddbe all
endif
endif
endif
endm
macro name n
dz n
endm
; EOF ;
|
libsrc/ace/ace_freemem.asm | andydansby/z88dk-mk2 | 1 | 101797 | <reponame>andydansby/z88dk-mk2<filename>libsrc/ace/ace_freemem.asm
;
; Jupiter ACE specific routines
; by <NAME>, 31/05/2010
;
; unsigned int ace_freemem();
;
; This function returns the free memory size
;
; $Id: ace_freemem.asm,v 1.1 2010/05/31 08:29:06 stefano Exp $
;
XLIB ace_freemem
ace_freemem:
ld hl,($3C3B) ; Spare
ret
|
oeis/076/A076149.asm | neoneye/loda-programs | 11 | 83911 | <reponame>neoneye/loda-programs
; A076149: Expansion of x^2(3+2x)/(1-x-5x^2-3x^3).
; Submitted by <NAME>
; 0,3,5,20,54,169,499,1506,4508,13535,40593,121792,365362,1096101,3288287,9864878,29594616,88783867,266351581,799054764,2397164270,7191492833,21574478475,64723435450,194170306324,582510918999
mov $1,1
lpb $0
sub $0,1
mov $2,$1
add $1,$4
mul $2,2
cmp $3,0
add $2,$3
mul $2,2
add $4,$2
lpe
mov $0,$4
div $0,2
|
programs/oeis/080/A080538.asm | neoneye/loda | 22 | 29837 | ; A080538: Number of neutrons in longest known radioactive decay series ending with Lead 207 ("actinium series"), reversed.
; 125,126,128,129,131,132,134,136,138,139,141,143,145,147,149,151,153,155,157,159,161
mul $0,-2
add $0,256
mov $1,50176
div $1,$0
sub $1,71
mov $0,$1
|
programs/oeis/204/A204160.asm | karttu/loda | 0 | 244997 | ; A204160: Symmetric matrix based on f(i,j)=(3i-2 if i=j and = 0 otherwise), by antidiagonals.
; 1,1,1,1,4,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,1,1,10,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,13,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,16,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,19,1,1,1,1,1,1,1,1,1,1,1,1
lpb $0,1
add $1,4
sub $0,$1
lpe
lpb $0,1
div $0,8
mov $1,$2
lpe
div $1,4
mul $1,3
add $1,1
|
oeis/285/A285309.asm | neoneye/loda-programs | 11 | 21849 | <filename>oeis/285/A285309.asm
; A285309: Sum of nonsquare divisors of n.
; Submitted by <NAME>
; 0,2,3,2,5,11,7,10,3,17,11,23,13,23,23,10,17,29,19,37,31,35,23,55,5,41,30,51,29,71,31,42,47,53,47,41,37,59,55,85,41,95,43,79,68,71,47,103,7,67,71,93,53,110,71,115,79,89,59,163,61,95,94,42,83,143,67,121,95,143,71,145,73,113,98,135,95,167,79,165,30,125,83,219,107,131,119,175,89,224,111,163,127,143,119,231,97,121,146,87
mov $1,$0
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
seq $1,35316 ; Sum of the square divisors of n.
sub $0,$1
|
Sources/Swarm/swarm_configuration.ads | ForYouEyesOnly/Space-Convoy | 1 | 27958 | <filename>Sources/Swarm/swarm_configuration.ads<gh_stars>1-10
--
-- Jan & <NAME>, Australia, July 2011
--
with Ada.Numerics; use Ada.Numerics;
with Ada.Real_Time; use Ada.Real_Time;
with Graphics_Configuration; use Graphics_Configuration;
with Real_Type; use Real_Type;
with Swarm_Configurations; use Swarm_Configurations;
with Swarm_Structures_Base; use Swarm_Structures_Base;
with System.Multiprocessors; use System.Multiprocessors;
with Vectors_3D; use Vectors_3D;
pragma Elaborate_All (Swarm_Configurations);
package Swarm_Configuration is
-----------------------------------------------------------------------------
Configuration : Configurations := Dual_Globes_In_Orbit;
-- valid Configurations are (Single_Globe_In_Orbit, Dual_Globes_In_Orbit, Dual_Globes_In_Orbit_Fast, Globe_Grid_In_Centre, Globe_Grid_Drifting)
-----------------------------------------------------------------------------
Initial_No_of_Elements : constant Positive := 64;
Initial_Swarm_Position : constant Vector_3D := Zero_Vector_3D;
Initual_Edge_Length : constant Real := 1.0;
Repulse_Strength : constant Real := 1.00;
Repulse_Centre : constant Real := 0.12;
Repulse_Steepness : constant Real := 30.00;
Unconditional_Repulse_Dist : constant Real := 0.30;
Attract_Strength : constant Real := 0.20;
Attract_Close_Centre : constant Real := 0.80;
Attract_Close_Steepness : constant Real := 50.00;
Attract_Far_Centre : constant Real := 2.00;
Attract_Far_Steepness : constant Real := 4.00;
Approach_Strength : constant Real := 1.00;
Approach_Steepness : constant Real := 1.00;
Max_Approach_Velocity : constant Real := 3.00;
Target_Fetch_Range : constant Real := 0.03;
Detection_Range : constant Real := 3.00;
Comms_Range : constant Real := 0.20;
Velocity_Matching_Range : constant Real := 0.30;
Velocity_Matching_Strength : constant Real := 0.05;
Friction : constant Real := 0.02;
No_of_Cores_for_Swarm : constant Positive := Positive (Number_Of_CPUs);
Max_Assumed_Acceleration : constant Real := 1.50;
Max_Update_Interval : constant Real := 0.10; -- sec.
Charging_Setup : constant Charging_Setups_R := Charging_Setups (Configuration);
Energy_Globe_Detection : constant Real := Energy_Globe_Detections (Configuration);
Energy_Globes_Defaults : constant Energy_Globes := Default_Globes (Configuration);
Energy_Globes_Velocity : constant Vector_3D := (x => 0.15, y => 0.0, z => 0.0);
-- Orbiting parameters for globes
Sphere_Increment : constant Vector_3D := (x => 2.0 * Pi / Intented_Framerate / 1000.0,
y => 2.0 * Pi / Intented_Framerate / 1100.0,
z => 2.0 * Pi / Intented_Framerate / 120.0);
Sphere_Increment_Fast : constant Vector_3D := (x => 2.0 * Pi / Intented_Framerate / 100.0,
y => 2.0 * Pi / Intented_Framerate / 110.0,
z => 2.0 * Pi / Intented_Framerate / 12.0);
Tolerated_Vehicle_Activation_Delay : constant Duration := To_Duration (Milliseconds (100));
Tolerated_Identify_Call_Delay : constant Duration := To_Duration (Milliseconds (100));
function Inter_Swarm_Attraction (x : Distances) return Acc_Scalar;
function Inter_Swarm_Repulsion (x : Distances) return Acc_Scalar;
function Inter_Swarm_Acceleration (x : Distances) return Acc_Scalar;
function Approach_Acceleration (Velocity_Towards_Goal : Real) return Acc_Scalar;
function Approach_Acceleration (x : Distances;
Velocity_Towards_Goal : Real) return Acc_Scalar;
function Velocity_Matching (Velocity, Velocity_Difference : Velocities) return Accelerations;
end Swarm_Configuration;
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_515.asm | ljhsiun2/medusa | 9 | 163192 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x5893, %rsi
nop
nop
nop
nop
nop
inc %r14
movl $0x61626364, (%rsi)
nop
nop
nop
nop
inc %r9
lea addresses_A_ht+0x17bf3, %r14
nop
nop
xor %rbp, %rbp
vmovups (%r14), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_normal_ht+0xb7b3, %rbp
nop
nop
nop
nop
nop
sub $4366, %rsi
movups (%rbp), %xmm3
vpextrq $0, %xmm3, %r14
nop
nop
nop
nop
nop
sub %r9, %r9
lea addresses_normal_ht+0x12273, %rcx
nop
nop
nop
add $58067, %r10
vmovups (%rcx), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r14
nop
nop
nop
dec %r9
lea addresses_WT_ht+0x13ff3, %rcx
clflush (%rcx)
nop
nop
nop
sub %r9, %r9
movb $0x61, (%rcx)
nop
nop
nop
sub $51519, %r10
lea addresses_UC_ht+0x7af3, %rsi
nop
nop
nop
nop
nop
add $57751, %r9
movb (%rsi), %cl
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_D_ht+0x7cf3, %rsi
lea addresses_normal_ht+0x13df3, %rdi
nop
nop
nop
sub $55434, %r9
mov $100, %rcx
rep movsb
nop
nop
nop
nop
nop
inc %rbx
lea addresses_A_ht+0x11df3, %r14
nop
nop
nop
and %r9, %r9
movw $0x6162, (%r14)
nop
nop
sub $63633, %rbp
lea addresses_UC_ht+0x83f3, %rbx
nop
cmp $35752, %rbp
mov (%rbx), %edi
nop
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_normal_ht+0x1b0f3, %rcx
clflush (%rcx)
nop
nop
nop
nop
cmp $63902, %rbx
movb (%rcx), %r9b
nop
sub $27864, %rdi
lea addresses_D_ht+0x1df3, %r9
nop
add $25704, %rdi
mov (%r9), %si
nop
xor %rsi, %rsi
lea addresses_UC_ht+0x85f3, %r9
nop
nop
nop
nop
dec %rbx
mov $0x6162636465666768, %rdi
movq %rdi, (%r9)
nop
nop
nop
nop
sub %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r9
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WC+0x1f3, %r13
nop
nop
nop
nop
nop
cmp $20336, %rdi
mov $0x5152535455565758, %rsi
movq %rsi, %xmm1
movups %xmm1, (%r13)
nop
dec %rdi
// Load
mov $0x5f3, %rcx
nop
nop
nop
nop
nop
and $14582, %r14
mov (%rcx), %rsi
nop
nop
nop
sub %rsi, %rsi
// Store
lea addresses_A+0x25f3, %r9
nop
nop
nop
nop
nop
cmp $27610, %rsi
mov $0x5152535455565758, %r13
movq %r13, (%r9)
nop
nop
nop
dec %r14
// Store
lea addresses_WC+0x9a23, %r9
nop
nop
nop
nop
cmp %r12, %r12
movb $0x51, (%r9)
and $24457, %r13
// Store
lea addresses_RW+0x169f3, %r13
nop
nop
nop
xor $26323, %r12
mov $0x5152535455565758, %rcx
movq %rcx, %xmm2
movups %xmm2, (%r13)
nop
xor $32175, %r14
// Store
mov $0x3f3, %r9
nop
nop
nop
nop
cmp %r12, %r12
mov $0x5152535455565758, %rsi
movq %rsi, (%r9)
nop
nop
nop
nop
nop
xor $13356, %r12
// Store
lea addresses_US+0xe8cb, %r9
nop
xor %rcx, %rcx
mov $0x5152535455565758, %r13
movq %r13, %xmm1
movups %xmm1, (%r9)
nop
nop
xor $48221, %r12
// Faulty Load
lea addresses_UC+0x7df3, %r9
nop
nop
nop
cmp %rsi, %rsi
mov (%r9), %r12d
lea oracles, %rcx
and $0xff, %r12
shlq $12, %r12
mov (%rcx,%r12,1), %r12
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_P', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WC', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_RW', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_P', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_US', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': True, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 1}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 8, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'src': {'NT': True, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}}
{'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
*/
|
data/mapHeaders/daycarem.asm | adhi-thirumala/EvoYellow | 16 | 94662 | <reponame>adhi-thirumala/EvoYellow
DayCareM_h:
db HOUSE ; tileset
db DAYCAREM_HEIGHT, DAYCAREM_WIDTH ; dimensions (y, x)
dw DayCareMBlocks, DayCareMTextPointers, DayCareMScript ; blocks, texts, scripts
db $00 ; connections
dw DayCareMObject ; objects
|
source/strings/a-sbwsfm.ads | ytomino/drake | 33 | 25500 | pragma License (Unrestricted);
-- extended unit
with Ada.Strings.Wide_Functions.Maps;
package Ada.Strings.Bounded_Wide_Strings.Functions.Maps is
new Generic_Maps (Wide_Functions.Maps);
pragma Preelaborate (Ada.Strings.Bounded_Wide_Strings.Functions.Maps);
|
alloy4fun_models/trashltl/models/5/Dga4tJv8cA5TtRD9c.als | Kaixi26/org.alloytools.alloy | 0 | 196 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idDga4tJv8cA5TtRD9c_prop6 {
all f:Trash | always f in Trash'
}
pred __repair { idDga4tJv8cA5TtRD9c_prop6 }
check __repair { idDga4tJv8cA5TtRD9c_prop6 <=> prop6o } |
Categories/Support/FinSet.agda | copumpkin/categories | 98 | 7953 | <gh_stars>10-100
{-# OPTIONS --universe-polymorphism #-}
module Support.FinSet where
open import Support
open import Support.Nat
unbound : ∀ {n} (m : Fin n) → ℕ
unbound zero = zero
unbound {suc n} (suc y) = suc (unbound {n} y)
.Fin-is-bounded : ∀ (n : ℕ) (m : Fin n) → (unbound m < n)
Fin-is-bounded .(suc n) (zero {n}) = Z<Sn
Fin-is-bounded .(suc n) (suc {n} y) = raise< (Fin-is-bounded n y)
enlarge : ∀ {a} (b : Fin (suc a)) (c : Fin (unbound b)) → Fin a
enlarge {zero} zero ()
enlarge {zero} (suc ()) c
enlarge {suc a′} zero ()
enlarge {suc a′} (suc b′) zero = zero
enlarge {suc a′} (suc b′) (suc c′) = suc (enlarge b′ c′)
widen-by : ∀ {a} {b} (a≤b : a < suc b) (c : Fin a) → Fin b
widen-by Z<Sn ()
widen-by (raise< Z<Sn) zero = zero
widen-by (raise< (raise< n<m)) zero = zero
widen-by (raise< Z<Sn) (suc ())
widen-by (raise< (raise< n<m)) (suc y') = suc (widen-by (raise< n<m) y')
widen-+ : (b : ℕ) → ∀ {a} (c : Fin a) → Fin (a + b)
widen-+ b zero = zero
widen-+ b (suc y) = suc (widen-+ b y)
shift : (a : ℕ) → ∀ {b} (c : Fin b) → Fin (a + b)
shift zero c = c
shift (suc y) c = suc (shift y c)
_bounded-by_ : (m : ℕ) → ∀ {n} (m<n : m < n) → Fin n
.0 bounded-by Z<Sn = zero
.(suc n) bounded-by (raise< {n} n<m) = suc (n bounded-by n<m)
unbound-unbounds-bounded-by : ∀ (m n : ℕ) (m<n : m < n) → unbound (m bounded-by m<n) ≣ m
unbound-unbounds-bounded-by .0 .(suc n) (Z<Sn {n}) = ≣-refl
unbound-unbounds-bounded-by .(suc n) .(suc m) (raise< {n} {m} n<m) = ≣-cong suc (unbound-unbounds-bounded-by n m n<m)
_lessen_ : (n : ℕ) → (m : Fin (suc n)) → ℕ
n lessen zero = n
.0 lessen suc {zero} ()
.(suc y) lessen suc {suc y} y' = y lessen y'
lessen-is-subtraction₁ : ∀ (n : ℕ) (m : Fin (suc n)) → (unbound m + (n lessen m)) ≣ n
lessen-is-subtraction₁ n zero = ≣-refl
lessen-is-subtraction₁ .0 (suc {zero} ())
lessen-is-subtraction₁ .(suc y) (suc {suc y} y') = ≣-cong suc (lessen-is-subtraction₁ y y')
lessen-is-subtraction₂ : ∀ (n m : ℕ) → ((n + m) lessen (n bounded-by (+-is-nondecreasingʳ n m)) ≣ m)
lessen-is-subtraction₂ zero m = ≣-refl
lessen-is-subtraction₂ (suc y) m = lessen-is-subtraction₂ y m
_split_ : ∀ {n} (k : Fin n) (m : Fin (suc n)) → Either (Fin (unbound m)) (Fin (n lessen m))
k split zero = inr k
zero split suc y = inl zero
suc y split suc y' = left suc (y split y')
_chops_ : (n : ℕ) → ∀ {m} (k : Fin (n + m)) → Either (Fin n) (Fin m)
0 chops k = inr k
suc n chops zero = inl zero
suc n chops suc k = left suc (n chops k)
rejoin-chops : (n m : ℕ) (k : Fin (n + m)) → either₀ (widen-+ m) (shift n) (n chops k) ≣ k
rejoin-chops zero _ _ = ≣-refl
rejoin-chops (suc _) _ zero = ≣-refl
rejoin-chops (suc n') m (suc k') with n' chops k' | rejoin-chops n' m k'
rejoin-chops (suc _) _ (suc ._) | inl _ | ≣-refl = ≣-refl
rejoin-chops (suc _) _ (suc ._) | inr _ | ≣-refl = ≣-refl
chop-widen-+ : (n m : ℕ) (k : Fin n) → n chops widen-+ m k ≣ inl k
chop-widen-+ zero _ ()
chop-widen-+ (suc n') _ zero = ≣-refl
chop-widen-+ (suc n') m (suc k') with n' chops widen-+ m k' | chop-widen-+ n' m k'
chop-widen-+ (suc n') m (suc ._) | inl k' | ≣-refl = ≣-refl
chop-widen-+ (suc n') m (suc _) | inr _ | ()
chop-shift : (n m : ℕ) (k : Fin m) → n chops shift n k ≣ inr k
chop-shift zero m k = ≣-refl
chop-shift (suc n') m k = ≣-cong (left suc) (chop-shift n' m k)
_cat₀_ : ∀ {ℓ} {n m} {A : Set ℓ} (f : Fin n → A) (g : Fin m → A) → Fin (n + m) → A
_cat₀_ {n = n} {m} f g i = either₀ f g (n chops i)
∙-dist-cat₀ : ∀ {ℓ ℓ′} {n m} {A : Set ℓ} {A′ : Set ℓ′} (f : Fin n → A) (g : Fin m → A) (h : A → A′) {i : Fin (n + m)} → (h ∙ (f cat₀ g)) i ≣ ((h ∙ f) cat₀ (h ∙ g)) i
∙-dist-cat₀ {n = n} {A′ = A′} f g h {i} = answer
where
open ≣-reasoning A′
split-i = n chops i
answer = begin
((h ∙ (f cat₀ g)) i)
≈⟨ ≣-refl ⟩
(h ((f cat₀ g) i))
≈⟨ ≣-cong h ≣-refl ⟩
h (either₀ f g split-i)
≈⟨ ≣-refl ⟩
(h ∙ either₀ f g) split-i
≈⟨ ∙-dist-either₀ f g h {split-i} ⟩
either₀ (h ∙ f) (h ∙ g) split-i
≈⟨ ≣-refl ⟩
((h ∙ f) cat₀ (h ∙ g)) i
∎
_cat_ : ∀ {ℓ} {n m} {A : Fin n → Set ℓ} {B : Fin m → Set ℓ} (f : (i : Fin n) → A i) (g : (j : Fin m) → B j) → (k : Fin (n + m)) → (A cat₀ B) k
_cat_ {n = n} f g i = either f g (n chops i)
_cat′_ : ∀ {ℓ} {n m} {A : Fin (n + m) → Set ℓ} (f : (i : Fin n) → A (widen-+ m i)) (g : (j : Fin m) → A (shift n j)) → (k : Fin (n + m)) → A k
_cat′_ {n = n} {m = m} {A = T} f g k = ≣-subst T (rejoin-chops n m k) (either′ {A = T ∙ either₀ (widen-+ m) (shift n)} f g (n chops k))
_✂_ : ∀ {n} (m : Fin (suc n)) {ℓ} {A : Set ℓ} (f : Fin n → A) → (Fin (unbound m) → A) × (Fin (n lessen m) → A)
_✂_ {n = n} m f = f ∙ enlarge m , f ∙ (≣-subst Fin (lessen-is-subtraction₁ n m) ∙ shift (unbound m))
_✂₀′_ : (m : ℕ) → ∀ {ℓ} {A : Set ℓ} {n} (f : Fin (m + n) → A) → (Fin m → A) × (Fin n → A)
_✂₀′_ m {n = n} f = f ∙ widen-+ n , f ∙ shift m
_✂′_ : (m : ℕ) → ∀ {ℓ} {n} {A : Fin (m + n) → Set ℓ} (f : (k : Fin (m + n)) → A k) → uncurry₀ _×_ (⟨ (λ Aˡ → (i : Fin m) → Aˡ i) , (λ Aʳ → (j : Fin n) → Aʳ j) ⟩ (m ✂₀′ A))
_✂′_ m {n = n} f = f ∙ widen-+ n , f ∙ shift m
|
graphwalker-dsl/src/main/antlr4/org/graphwalker/dsl/yed/YEdVertexParser.g4 | bilred/graphwalker-project | 0 | 5320 | <reponame>bilred/graphwalker-project
parser grammar YEdVertexParser;
options {
tokenVocab=YEdLabelLexer;
}
parse
locals [java.util.Set<String> fields = new java.util.HashSet<String>();]
: start
| field* EOF
;
field
: {!$parse::fields.contains("names")}? names {$parse::fields.add("names");}
| {!$parse::fields.contains("shared")}? shared {$parse::fields.add("shared");}
| {!$parse::fields.contains("blocked")}? blocked {$parse::fields.add("blocked");}
| {!$parse::fields.contains("actions")}? actions {$parse::fields.add("actions");}
| {!$parse::fields.contains("reqtags")}? reqtags {$parse::fields.add("reqtags");}
;
start
: START
;
shared
: SHARED COLON Identifier
;
names
: name (SEMICOLON name)*
;
name
: Identifier (DOT Identifier)*
;
blocked
: BLOCKED
;
actions
: INIT COLON (action)+
;
action
: ~(SEMICOLON)* SEMICOLON
;
reqtags
: REQTAG (COLON | ASSIGN) reqtagList
;
reqtagList
: (reqtag COMMA)* reqtag
;
reqtag
: ~(COMMA)+
; |
ManagedDll/Release/.NETFramework,Version=v4.0.AssemblyAttributes.asm | TheodorLindberg/Mindstorm-controller | 0 | 82618 | <filename>ManagedDll/Release/.NETFramework,Version=v4.0.AssemblyAttributes.asm
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.14.26428.1
; Generated by VC++ for Common Language Runtime
.file "C:\Users\Theodor\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cpp"
|
programs/oeis/156/A156660.asm | karttu/loda | 0 | 3834 | ; A156660: Characteristic function of Sophie Germain primes.
; 0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,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,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,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,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,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,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
mov $5,$0
mov $7,2
lpb $7,1
clr $0,5
mov $0,$5
sub $7,1
add $0,$7
sub $0,2
cal $0,156874 ; Number of Sophie Germain primes <= n.
sub $0,9
add $4,9
add $4,$0
mov $1,$4
mov $8,$7
lpb $8,1
mov $6,$1
sub $8,1
lpe
lpe
lpb $5,1
mov $5,0
sub $6,$1
lpe
mov $1,$6
|
org.alloytools.alloy.extra/extra/models/book/appendixA/phones.als | Kaixi26/org.alloytools.alloy | 527 | 4392 | module appendixA/phones
sig Phone {
requests: set Phone,
connects: lone Phone
}
|
install/scripts/lock.scpt | CoderVikas/mindotfiles | 0 | 951 | #!/usr/bin/osascript
activate application "Keychain Access"
tell application "System Events"
keystroke "," using command down
tell process "Keychain Access"
click checkbox "Show keychain status in menu bar" of tab group 1 of window 1
delay 10
end tell
end tell
tell application "Keychain Access"
quit
end tell
|
oeis/111/A111052.asm | neoneye/loda-programs | 11 | 102801 | <filename>oeis/111/A111052.asm
; A111052: Numbers n such that 3*n^2 + 4 is prime.
; Submitted by <NAME>
; 1,3,5,7,11,19,21,25,31,33,37,39,45,49,53,73,75,77,81,89,91,93,107,115,119,129,131,135,137,145,157,185,187,193,203,205,207,213,215,221,227,229,231,249,259,261,263,271,283,291,297,299,301,317,325,327,331,343,345,357,359,361,387,395,397,401,413,415,417,423,429,439,441,471,481,497,501,509,513,515,521,525,527,549,551,585,593,613,619,621,639,647,649,663,681,683,691,703,705,707
mov $2,332202
lpb $2
add $6,6
mov $3,$6
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,24
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
add $5,$1
mov $6,$5
lpe
mov $0,$1
div $0,12
add $0,1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.